|
|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
from ctypes import *
from _overlapped import NULL
WORD = c_ushort
DWORD = c_ulong
LPBYTE = POINTER(c_ubyte)
LPTSTR = POINTER(c_wchar)
HANDLE = c_void_p
kernel32 = windll.kernel32
class STARTUPINFO(Structure):
_fields_ = [
("cb", DWORD),
("lpReserved", LPTSTR),
("lpDesktop", LPTSTR),
("lpTitle", LPTSTR),
("dwX", DWORD),
("dwY", DWORD),
("dwXSize", DWORD),
("dwYSize", DWORD),
("dwXCountChars",DWORD),
("dwYCountChars",DWORD),
("dwFillAttribute",DWORD),
("dwFlags", DWORD),
("wShowWindow", WORD),
("cbReserved2", WORD),
("lpReserved2", LPBYTE),
("hStdInput", HANDLE),
("hStdOutput", HANDLE),
("hStdError", HANDLE),
]
class PROCESS_INFORMATION(Structure):
_fields_ = [
("hProcess",HANDLE),
("hThread",HANDLE),
("dwProcessId",DWORD),
("dwThreadId",DWORD),
]
DEBUG_PROCESS = 0x00000001
CREATE_NEW_CONSOLE = 0x00000010
PATH = "H:\\phyton\\test\\calc.exe"
creation_flags = DEBUG_PROCESS
startupinfo = STARTUPINFO()
process_information = PROCESS_INFORMATION()
memset(addressof(startupinfo),0,sizeof(startupinfo))
startupinfo.cb = sizeof(startupinfo)
startupinfo.dwFlags = 0x1
startupinfo.wShowWindow = 0x0
if kernel32.CreateProcessA(None,
PATH,
None,
None,
False,
creation_flags,
None,
None,
byref(startupinfo),
byref(process_information)):
print("[*] lauch the process success")
print("[*] PID %d", process_information)
else:
print("[*]Error :%d ", kernel32.GetLastError())
运行这段代码老是 错误代码2 有遇到这种情况的么? |
|