本文整理汇总了Python中win32security.SECURITY_ATTRIBUTES属性的典型用法代码示例。如果您正苦于以下问题:Python win32security.SECURITY_ATTRIBUTES属性的具体用法?Python win32security.SECURITY_ATTRIBUTES怎么用?Python win32security.SECURITY_ATTRIBUTES使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类win32security
的用法示例。
在下文中一共展示了win32security.SECURITY_ATTRIBUTES属性的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: import win32security [as 别名]
# 或者: from win32security import SECURITY_ATTRIBUTES [as 别名]
def __init__(self, filename):
self._hfile = win32file.CreateFile(filename,
win32con.GENERIC_READ | win32con.GENERIC_WRITE,
win32con.FILE_SHARE_READ | win32con.FILE_SHARE_WRITE,
win32security.SECURITY_ATTRIBUTES(),
win32con.OPEN_EXISTING,
win32con.FILE_FLAG_OVERLAPPED,
0)
self._read_ovrlpd = pywintypes.OVERLAPPED()
self._read_ovrlpd.hEvent = win32event.CreateEvent(None, True,
False, None)
self._write_ovrlpd = pywintypes.OVERLAPPED()
self._write_ovrlpd.hEvent = win32event.CreateEvent(None, True,
False, None)
self._bufs = []
self._n = 0
示例2: start
# 需要导入模块: import win32security [as 别名]
# 或者: from win32security import SECURITY_ATTRIBUTES [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]))