OLD | NEW |
| (Empty) |
1 # Copyright (c) 2007-2008 Twisted Matrix Laboratories. | |
2 # See LICENSE for details. | |
3 | |
4 """ | |
5 This is a mock win32process module. | |
6 | |
7 The purpose of this module is mock process creation for the PID test. | |
8 | |
9 CreateProcess(...) will spawn a process, and always return a PID of 42. | |
10 """ | |
11 | |
12 import win32process | |
13 GetExitCodeProcess = win32process.GetExitCodeProcess | |
14 STARTUPINFO = win32process.STARTUPINFO | |
15 | |
16 STARTF_USESTDHANDLES = win32process.STARTF_USESTDHANDLES | |
17 | |
18 | |
19 def CreateProcess(appName, | |
20 cmdline, | |
21 procSecurity, | |
22 threadSecurity, | |
23 inheritHandles, | |
24 newEnvironment, | |
25 env, | |
26 workingDir, | |
27 startupInfo): | |
28 """ | |
29 This function mocks the generated pid aspect of the win32.CreateProcess | |
30 function. | |
31 - the true win32process.CreateProcess is called | |
32 - return values are harvested in a tuple. | |
33 - all return values from createProcess are passed back to the calling | |
34 function except for the pid, the returned pid is hardcoded to 42 | |
35 """ | |
36 | |
37 hProcess, hThread, dwPid, dwTid = win32process.CreateProcess( | |
38 appName, | |
39 cmdline, | |
40 procSecurity, | |
41 threadSecurity, | |
42 inheritHandles, | |
43 newEnvironment, | |
44 env, | |
45 workingDir, | |
46 startupInfo) | |
47 dwPid = 42 | |
48 return (hProcess, hThread, dwPid, dwTid) | |
OLD | NEW |