Created
August 10, 2019 17:28
-
-
Save IISResetMe/23eeebb5c46bfbe48284cd14f1637f84 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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