Changeset 1763
- Timestamp:
- 08/22/08 11:05:31 (3 months ago)
- Files:
-
- capture-mod/trunk/CaptureSoapServer.cpp (modified) (3 diffs)
- capture-mod/trunk/CaptureSoapServer.h (modified) (1 diff)
- capture-mod/trunk/install/CaptureBAT.exe (modified) (previous)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
capture-mod/trunk/CaptureSoapServer.cpp
r1762 r1763 11 11 #include "Visitor.h" 12 12 #include "b64.h" 13 //#include <winbase.h> //Shouldn't need to include this 13 14 14 15 CaptureSoapServer::CaptureSoapServer(Visitor* v){ … … 196 197 //Create the string for the parameters 197 198 wchar_t * docName = new wchar_t[1024]; 198 wsprintf(docName, L"/D %hs", fileName); 199 wsprintf(docName, L"/K %hs", fileName); 200 201 //Create a job object to bind the processes I launch to 202 HANDLE myJobObj = CreateJobObject(NULL, NULL); 203 if(myJobObj == NULL){ 204 printf("CreateJobObject failed with error %d\n", GetLastError()); 205 } 199 206 200 207 //open with cmd.exe 201 208 STARTUPINFO myStart; 202 209 memset(&myStart, 0, sizeof(STARTUPINFO)); 203 myStart.dwFlags = 0;204 210 PROCESS_INFORMATION procInfo; 205 BOOL b = CreateProcess(L"C:\\WINDOWS\\system32\\cmd.exe", L"", NULL, NULL, FALSE, NORMAL_PRIORITY_CLASS,211 BOOL b = CreateProcess(L"C:\\WINDOWS\\system32\\cmd.exe", docName, NULL, NULL, FALSE, NORMAL_PRIORITY_CLASS, 206 212 NULL, NULL, &myStart, &procInfo); 207 213 if(!b){ … … 209 215 return SOAP_ERR; 210 216 } 217 218 //Add the process to the job object 219 b = AssignProcessToJobObject(myJobObj, procInfo.hProcess); 220 if(!b){ 221 printf("AssignProcessToJobObject failed with error %d\n", GetLastError()); 222 return SOAP_ERR; 223 } 211 224 212 225 if(debug) printf("dwProcessId = %d, dwThreadId = %d\n", procInfo.dwProcessId, procInfo.dwThreadId); 213 226 if(debug) printf("Sleeping for 15 seconds\n"); 227 Sleep(15000); 228 if(debug) printf("\n\nDone sleeping\n\n"); 229 230 //Nt/ZwQuerySystemInformation? 231 232 /* 233 b = TerminateProcess(procInfo.hProcess, 0); 234 if(!b){ 235 printf("TerminateProcess failed with error %d\n", GetLastError()); 236 return SOAP_ERR; 237 } 238 */ 239 b = TerminateJobObject(myJobObj, 0); 240 if(!b){ 241 printf("TerminateProcess failed with error %d\n", GetLastError()); 242 return SOAP_ERR; 243 } 214 244 CloseHandle(procInfo.hProcess); 215 245 CloseHandle(procInfo.hThread); 216 246 247 result = 1; 217 248 return SOAP_OK; 218 249 } capture-mod/trunk/CaptureSoapServer.h
r1729 r1763 4 4 5 5 #pragma once 6 //#include "captureGSOAP.h"6 #include "CaptureGlobal.h" 7 7 #include "Thread.h" 8 9 #include "CaptureGlobal.h"10 8 #include <string> 11 9 #include <queue>
