2999 char *dir = 0; |
2999 char *dir = 0; |
3000 DWORD fdwCreate = 0; |
3000 DWORD fdwCreate = 0; |
3001 STARTUPINFO lpsiStartInfo; |
3001 STARTUPINFO lpsiStartInfo; |
3002 PROCESS_INFORMATION lppiProcInfo; |
3002 PROCESS_INFORMATION lppiProcInfo; |
3003 SECURITY_ATTRIBUTES sa; |
3003 SECURITY_ATTRIBUTES sa; |
|
3004 SECURITY_DESCRIPTOR sd; |
3004 |
3005 |
3005 if (__isString(dirName)) { |
3006 if (__isString(dirName)) { |
3006 dir = __stringVal(dirName); |
3007 dir = __stringVal(dirName); |
3007 } |
3008 } |
3008 if ((__isString(commandPath) || (commandPath == nil)) |
3009 if ((__isString(commandPath) || (commandPath == nil)) |
3056 cmdLine = __stringVal(commandLine); |
3057 cmdLine = __stringVal(commandLine); |
3057 |
3058 |
3058 /* |
3059 /* |
3059 * create descriptors as req'd |
3060 * create descriptors as req'd |
3060 */ |
3061 */ |
|
3062 memset(&sa, 0, sizeof (sa)); |
3061 sa.nLength = sizeof( sa ); |
3063 sa.nLength = sizeof( sa ); |
3062 sa.lpSecurityDescriptor = NULL; |
3064 sa.lpSecurityDescriptor = NULL; |
3063 sa.bInheritHandle = TRUE; |
3065 sa.bInheritHandle = TRUE; |
3064 |
3066 if (__isWinNT) { |
|
3067 InitializeSecurityDescriptor(&sd, SECURITY_DESCRIPTOR_REVISION); |
|
3068 SetSecurityDescriptorDacl(&sd, -1, 0, 0); |
|
3069 |
|
3070 sa.lpSecurityDescriptor = &sd; |
|
3071 } |
3065 memset(&lppiProcInfo, 0, sizeof (lppiProcInfo)); |
3072 memset(&lppiProcInfo, 0, sizeof (lppiProcInfo)); |
3066 |
3073 |
3067 memset(&lpsiStartInfo, 0, sizeof (lpsiStartInfo)); |
3074 memset(&lpsiStartInfo, 0, sizeof (lpsiStartInfo)); |
3068 lpsiStartInfo.cb = sizeof(lpsiStartInfo); |
3075 lpsiStartInfo.cb = sizeof(lpsiStartInfo); |
3069 lpsiStartInfo.lpReserved = NULL; |
3076 lpsiStartInfo.lpReserved = NULL; |
3147 #ifdef PROCESSDEBUGWIN32 |
3154 #ifdef PROCESSDEBUGWIN32 |
3148 fprintf(stderr, "create process cmdPath:<%s> cmdLine:<%s> in <%s>\n", cmdPath, cmdLine, dir); |
3155 fprintf(stderr, "create process cmdPath:<%s> cmdLine:<%s> in <%s>\n", cmdPath, cmdLine, dir); |
3149 #endif |
3156 #endif |
3150 if (CreateProcess( cmdPath, |
3157 if (CreateProcess( cmdPath, |
3151 cmdLine, |
3158 cmdLine, |
3152 &sa, &sa, /* sec-attribs */ |
3159 &sa, NULL /* &sa */, /* sec-attribs */ |
3153 sa.bInheritHandle, /* inherit handles */ |
3160 sa.bInheritHandle, /* inherit handles */ |
3154 fdwCreate, |
3161 fdwCreate, |
3155 NULL, /* env */ |
3162 NULL, /* env */ |
3156 dir, |
3163 dir, |
3157 &lpsiStartInfo, |
3164 &lpsiStartInfo, |
5109 |
5116 |
5110 %{ |
5117 %{ |
5111 HANDLE pipeRead = (HANDLE)0; |
5118 HANDLE pipeRead = (HANDLE)0; |
5112 HANDLE pipeWrite = (HANDLE)0; |
5119 HANDLE pipeWrite = (HANDLE)0; |
5113 |
5120 |
5114 SECURITY_ATTRIBUTES process; |
5121 SECURITY_ATTRIBUTES sa; |
5115 |
5122 |
5116 process.nLength = sizeof( process ); |
5123 ZeroMemory(&sa, sizeof(SECURITY_ATTRIBUTES)); |
5117 process.lpSecurityDescriptor = NULL; |
5124 sa.nLength = sizeof(SECURITY_ATTRIBUTES); |
5118 process.bInheritHandle = TRUE; |
5125 sa.lpSecurityDescriptor = NULL; |
5119 |
5126 sa.bInheritHandle = TRUE; |
5120 if( ! CreatePipe( &pipeRead, &pipeWrite, &process, 0 ) ) { |
5127 |
|
5128 if( ! CreatePipe( &pipeRead, &pipeWrite, &sa, 0 ) ) { |
5121 @global(LastErrorNumber) = __MKSMALLINT( __WIN32_ERR(GetLastError()) ); |
5129 @global(LastErrorNumber) = __MKSMALLINT( __WIN32_ERR(GetLastError()) ); |
5122 RETURN ( nil ); |
5130 RETURN ( nil ); |
5123 } |
5131 } |
5124 |
5132 |
5125 #ifdef USE_HANDLES |
5133 #ifdef USE_HANDLES |
9232 I represent a generic HANDLE, which can be closed via CloseHandle. |
9240 I represent a generic HANDLE, which can be closed via CloseHandle. |
9233 " |
9241 " |
9234 ! |
9242 ! |
9235 |
9243 |
9236 version |
9244 version |
9237 ^ '$Header: /cvs/stx/stx/libbasic/Win32OperatingSystem.st,v 1.169 2004-12-15 10:27:54 penk Exp $' |
9245 ^ '$Header: /cvs/stx/stx/libbasic/Win32OperatingSystem.st,v 1.170 2004-12-17 23:03:05 penk Exp $' |
9238 ! ! |
9246 ! ! |
9239 |
9247 |
9240 !Win32OperatingSystem::Win32Handle methodsFor:'io'! |
9248 !Win32OperatingSystem::Win32Handle methodsFor:'io'! |
9241 |
9249 |
9242 readBytes:count into:aByteBuffer startingAt:firstIndex |
9250 readBytes:count into:aByteBuffer startingAt:firstIndex |