當前位置: 首頁>>代碼示例>>Python>>正文


Python win32process.STARTUPINFO屬性代碼示例

本文整理匯總了Python中win32process.STARTUPINFO屬性的典型用法代碼示例。如果您正苦於以下問題:Python win32process.STARTUPINFO屬性的具體用法?Python win32process.STARTUPINFO怎麽用?Python win32process.STARTUPINFO使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在win32process的用法示例。


在下文中一共展示了win32process.STARTUPINFO屬性的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: create_desktop

# 需要導入模塊: import win32process [as 別名]
# 或者: from win32process import STARTUPINFO [as 別名]
def create_desktop(desktop_name, start_explorer=1):
    """ Creates a new desktop and spawns a thread running on it
        Will also start a new icon thread on an existing desktop
    """
    sa=pywintypes.SECURITY_ATTRIBUTES()
    sa.bInheritHandle=1

    try:
        hdesk=win32service.CreateDesktop(desktop_name, 0, win32con.MAXIMUM_ALLOWED, sa)
    except win32service.error:
        traceback.print_exc()
        errbuf=cStringIO.StringIO()
        traceback.print_exc(None,errbuf)
        win32api.MessageBox(0, errbuf.getvalue(), 'Desktop creation failed')
        return
    if start_explorer:
        s=win32process.STARTUPINFO()
        s.lpDesktop=desktop_name
        prc_info=win32process.CreateProcess(None, "Explorer.exe",None,None,True,win32con.CREATE_NEW_CONSOLE,None,'c:\\',s)

    th=thread.start_new_thread(new_icon,(hdesk,desktop_name))
    hdesk.SwitchDesktop() 
開發者ID:IronLanguages,項目名稱:ironpython2,代碼行數:24,代碼來源:desktopmanager.py

示例2: main

# 需要導入模塊: import win32process [as 別名]
# 或者: from win32process import STARTUPINFO [as 別名]
def main():
    if sys.argv[1] == 'child':
        if sys.argv[2] == 'windows':
            import win32api as api, win32process as proc
            info = proc.STARTUPINFO()
            info.hStdInput = api.GetStdHandle(api.STD_INPUT_HANDLE)
            info.hStdOutput = api.GetStdHandle(api.STD_OUTPUT_HANDLE)
            info.hStdError = api.GetStdHandle(api.STD_ERROR_HANDLE)
            python = sys.executable
            scriptDir = os.path.dirname(__file__)
            scriptName = os.path.basename(__file__)
            proc.CreateProcess(
                None, " ".join((python, scriptName, "grandchild")), None,
                None, 1, 0, os.environ, scriptDir, info)
        else:
            if os.fork() == 0:
                grandchild()
    else:
        grandchild() 
開發者ID:wistbean,項目名稱:learn_python3_spider,代碼行數:21,代碼來源:process_helper.py

示例3: LaunchWin32Process

# 需要導入模塊: import win32process [as 別名]
# 或者: from win32process import STARTUPINFO [as 別名]
def LaunchWin32Process(self, command):
        try:
            StartupInfo = win32process.STARTUPINFO()
            StartupInfo.dwFlags = win32process.STARTF_USESHOWWINDOW
            StartupInfo.wShowWindow = win32con.SW_NORMAL
            win32process.CreateProcess(
                None,
                command,
                None,
                None,
                0,
                win32process.NORMAL_PRIORITY_CLASS,
                None,
                None,
                StartupInfo)
        except Exception as e:
            print(sys.exc_info())
            print("Exception in LaunchWin32Process")
            pass 
開發者ID:MozillaSecurity,項目名稱:peach,代碼行數:21,代碼來源:agent.py

示例4: start

# 需要導入模塊: import win32process [as 別名]
# 或者: from win32process import STARTUPINFO [as 別名]
def start(self):
        procHandle, threadHandle, procId, threadId  = win32process.CreateProcess(
            None, # appName
            'python.exe "%s" /run_test_process %s %s' % (this_file,
                                                         self.BucketCount,
                                                         self.threadCount),
            None, # process security
            None, # thread security
            0, # inherit handles
            win32process.NORMAL_PRIORITY_CLASS,
            None, # new environment
            None, # Current directory
            win32process.STARTUPINFO(), # startup info
            )
        self.processHandle = procHandle 
開發者ID:IronLanguages,項目名稱:ironpython2,代碼行數:17,代碼來源:test_win32trace.py

示例5: start

# 需要導入模塊: import win32process [as 別名]
# 或者: from win32process import STARTUPINFO [as 別名]
def start(self, cmd):
        sAttr = win32security.SECURITY_ATTRIBUTES()
        sAttr.bInheritHandle = True

        stdout_r, stdout_w = win32pipe.CreatePipe(sAttr,0)
        stdin_r, stdin_w = win32pipe.CreatePipe(sAttr,0)
        self.read_handle=stdout_r
        self.write_handle=stdout_w
        self.stdin_write=stdin_w

        si = win32process.STARTUPINFO()
        si.dwFlags = win32process.STARTF_USESHOWWINDOW | win32process.STARTF_USESTDHANDLES
        si.wShowWindow = win32con.SW_HIDE
        si.hStdInput = stdin_r            # file descriptor of origin stdin
        si.hStdOutput = stdout_w
        si.hStdError = stdout_w
        hProcess, hThread, dwProcessID, dwThreadID = win32process.CreateProcess(None,"cmd", None, None, True, win32process.CREATE_NEW_CONSOLE, None, None, si)
        self.dwProcessID=dwProcessID
        self.hProcess=hProcess
        sleep(0.5)
        if self.hProcess == 0:
            DebugOutput("Start Process Fail:{:d}".format(win32api.GetLastError()))
        DebugOutput('[*] pid: {:x}'.format(self.dwProcessID))
        self.Console_hwnd = get_hwnds_for_pid(self.dwProcessID)
        if len(self.Console_hwnd)==0:
            raise Exception("Fail to run,No Process!")
        DebugOutput('[*] hwnd:{:x}'.format(self.Console_hwnd[0])) 
開發者ID:turingsec,項目名稱:marsnake,代碼行數:29,代碼來源:winpty.py

示例6: launch_chrome

# 需要導入模塊: import win32process [as 別名]
# 或者: from win32process import STARTUPINFO [as 別名]
def launch_chrome():
    global chrome
    if os.path.exists(chrome_path):
        command="\"{}\"--remote-debugging-port={}".format(chrome_path, port_chrome)
        print(u"如果Chrome白屏,請使用CMD手動運行以下命令:\n{}".format(command))
        chrome = win32process.CreateProcess(None, "{} --remote-debugging-port={}".format(chrome_path, port_chrome),None, None, 0, 0, None, None, win32process.STARTUPINFO())
    else:
        print(u"未找到Chrome安裝目錄")
        exit(-1) 
開發者ID:LiuChangFreeman,項目名稱:perfect_video_downloader,代碼行數:11,代碼來源:main.py

示例7: jitInject

# 需要導入模塊: import win32process [as 別名]
# 或者: from win32process import STARTUPINFO [as 別名]
def jitInject(path, shellcode):
	info = win32process.CreateProcess(None, path, None, None, False, 0x04, None, None, win32process.STARTUPINFO())  
	page_rwx_value = 0x40
	process_all = 0x1F0FFF
	memcommit = 0x00001000

	shellcode_length = len(shellcode)
	process_handle = info[0].handle # phandle

	VirtualAllocEx = windll.kernel32.VirtualAllocEx
	VirtualAllocEx.restype = LPVOID
	VirtualAllocEx.argtypes = (HANDLE, LPVOID, DWORD, DWORD, DWORD)

	WriteProcessMemory = ctypes.windll.kernel32.WriteProcessMemory
	WriteProcessMemory.restype = BOOL
	WriteProcessMemory.argtypes = (HANDLE, LPVOID, LPCVOID, DWORD, DWORD)

	CreateRemoteThread = ctypes.windll.kernel32.CreateRemoteThread
	CreateRemoteThread.restype = HANDLE
	CreateRemoteThread.argtypes = (HANDLE, LPSECURITY_ATTRIBUTES, DWORD, LPTHREAD_START_ROUTINE, LPVOID, DWORD, DWORD)

	lpBuffer = VirtualAllocEx(process_handle, 0, shellcode_length, memcommit, page_rwx_value)
	print(hex(lpBuffer))
	WriteProcessMemory(process_handle, lpBuffer, shellcode, shellcode_length, 0)
	CreateRemoteThread(process_handle, None, 0, lpBuffer, 0, 0, 0)
	print('JIT Injection, done.')
# -------------------------------------------------- # 
開發者ID:aaaddress1,項目名稱:shellDev.py,代碼行數:29,代碼來源:shellDev.py


注:本文中的win32process.STARTUPINFO屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。