Show More
@@ -279,7 +279,7 b' def executablepath():' | |||
|
279 | 279 | buf = ctypes.create_string_buffer(size + 1) |
|
280 | 280 | len = _kernel32.GetModuleFileNameA(None, ctypes.byref(buf), size) |
|
281 | 281 | if len == 0: |
|
282 | raise ctypes.WinError | |
|
282 | raise ctypes.WinError() | |
|
283 | 283 | elif len == size: |
|
284 | 284 | raise ctypes.WinError(_ERROR_INSUFFICIENT_BUFFER) |
|
285 | 285 | return buf.value |
@@ -289,7 +289,7 b' def getuser():' | |||
|
289 | 289 | size = _DWORD(300) |
|
290 | 290 | buf = ctypes.create_string_buffer(size.value + 1) |
|
291 | 291 | if not _advapi32.GetUserNameA(ctypes.byref(buf), ctypes.byref(size)): |
|
292 | raise ctypes.WinError | |
|
292 | raise ctypes.WinError() | |
|
293 | 293 | return buf.value |
|
294 | 294 | |
|
295 | 295 | _signalhandler = [] |
@@ -307,7 +307,7 b' def setsignalhandler():' | |||
|
307 | 307 | h = _SIGNAL_HANDLER(handler) |
|
308 | 308 | _signalhandler.append(h) # needed to prevent garbage collection |
|
309 | 309 | if not _kernel32.SetConsoleCtrlHandler(h, True): |
|
310 | raise ctypes.WinError | |
|
310 | raise ctypes.WinError() | |
|
311 | 311 | |
|
312 | 312 | def hidewindow(): |
|
313 | 313 | |
@@ -349,7 +349,7 b' def _1stchild(pid):' | |||
|
349 | 349 | # create handle to list all processes |
|
350 | 350 | ph = _kernel32.CreateToolhelp32Snapshot(_TH32CS_SNAPPROCESS, 0) |
|
351 | 351 | if ph == _INVALID_HANDLE_VALUE: |
|
352 | raise ctypes.WinError | |
|
352 | raise ctypes.WinError() | |
|
353 | 353 | try: |
|
354 | 354 | r = _kernel32.Process32First(ph, ctypes.byref(pe)) |
|
355 | 355 | # loop over all processes |
@@ -361,7 +361,7 b' def _1stchild(pid):' | |||
|
361 | 361 | finally: |
|
362 | 362 | _kernel32.CloseHandle(ph) |
|
363 | 363 | if _kernel32.GetLastError() != _ERROR_NO_MORE_FILES: |
|
364 | raise ctypes.WinError | |
|
364 | raise ctypes.WinError() | |
|
365 | 365 | return None # no child found |
|
366 | 366 | |
|
367 | 367 | class _tochildpid(int): # pid is _DWORD, which always matches in an int |
@@ -413,7 +413,7 b' def spawndetached(args):' | |||
|
413 | 413 | None, args, None, None, False, _CREATE_NO_WINDOW, |
|
414 | 414 | env, os.getcwd(), ctypes.byref(si), ctypes.byref(pi)) |
|
415 | 415 | if not res: |
|
416 | raise ctypes.WinError | |
|
416 | raise ctypes.WinError() | |
|
417 | 417 | |
|
418 | 418 | # _tochildpid because the process is the child of COMSPEC |
|
419 | 419 | return _tochildpid(pi.dwProcessId) |
General Comments 0
You need to be logged in to leave comments.
Login now