## Opens a Process

# Global Imports
import ctypes

k_handle = ctypes.WinDLL("Kernel32.dll")

# Shortcut to give "All Access" rights to the current process. 
# The |'s are being used as "or" statements, as a shortcut instead of typing out every variable needed, and their values.
PROCESS_ALL_ACCESS = ( 0x000f0000 | 0x00100000 | 0xFFF)

dwDesiredAccess = PROCESS_ALL_ACCESS    #dw is short for DWord
bInheritHandle = False                  #b is short for Boolean Variable, True or False.
dwProcessId = 0x2508

response = k_handle.OpenProcess(dwDesiredAccess, bInheritHandle, dwProcessId)

error = k_handle.GetLastError()
if error !=0:
    print("Error Code: {0}".format(error))
    exit(1)

if response <= 0:
    print("Handle was not created.")
else:
    print("Handle was Created.")
## Opens a Process

# Global Imports
import ctypes

k_handle = ctypes.WinDLL("Kernel32.dll")

# Shortcut to give "All Access" rights to the current process. 
# The |'s are being used as "or" statements, as a shortcut instead of typing out every variable needed, and their values.
PROCESS_ALL_ACCESS = ( 0x000f0000 | 0x00100000 | 0xFFF)

dwDesiredAccess = PROCESS_ALL_ACCESS    #dw is short for DWord
bInheritHandle = False                  #b is short for Boolean Variable, True or False.
dwProcessId = 0x2508

response = k_handle.OpenProcess(dwDesiredAccess, bInheritHandle, dwProcessId)

error = k_handle.GetLastError()
if error !=0:
    print("Error Code: {0}".format(error))
    exit(1)

if response <= 0:
    print("Handle was not created.")
else:
    print("Handle was Created.")
## Opens a Process # Global Imports # Shortcut to give "All Access" rights to the current process. # The |'s are being used as "or" statements, as a shortcut instead of typing out every variable needed, and their values. #dw is short for DWord #b is short for Boolean Variable, True or False.