Skip to content

Instantly share code, notes, and snippets.

@IISResetMe
Created August 10, 2019 17:28
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save IISResetMe/23eeebb5c46bfbe48284cd14f1637f84 to your computer and use it in GitHub Desktop.
Save IISResetMe/23eeebb5c46bfbe48284cd14f1637f84 to your computer and use it in GitHub Desktop.
from ctypes import windll,c_ushort,byref
import platform
def is_syswow64_process():
if platform.architecture()[0] != "64bit":
# 32-bit OS, no syswow64 handling
return False
# Ok, 64-bit OS, let's see if the process is 32-bit
# Obtain process handle to self
this_process = windll.kernel32.GetCurrentProcess()
# Declare ref arguments
proc_type, platform_type = c_ushort(), c_ushort()
# Query Windows for the information
wow64_call = windll.kernel32.IsWow64Process2(this_process, byref(proc_type), byref(platform_type))
if wow64_call == 0:
# you'd probably want to call kernel32!GetLastError here
raise Exception("Problem querying kernel32!IsWow64Process2")
return proc_type.value == 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment