si.hStdInput = hStdinRead;
si.hStdOutput = hStdoutWrite;
si.hStdError = hStdoutWrite;
- if((szCurrentDir = _getcwd( NULL, 0 )) == NULL )
+ if((szCurrentDir = (char*)_getcwd( NULL, 0 )) == NULL )
my_fatal("pipex_open(): no current directory: %s\n",
strerror(errno));
if(_chdir(szWorkingDir)){
pipex->bConsole = FALSE;
pipex->bPipe=TRUE;
}else{
- my_fatal("pipex_open(): %s",win32_error());
+ my_fatal("pipex_open(): %s: %s",szProcFile,win32_error());
}
_chdir(szCurrentDir);
}
// pipex_exit()
void pipex_exit(pipex_t *pipex) {
+ DWORD lpexit;
CloseHandle(pipex->hInput);
CloseHandle(pipex->hOutput);
- DWORD lpexit;
if(GetExitCodeProcess(pipex->hProcess,&lpexit)){
if(lpexit==STILL_ACTIVE)
EnterCriticalSection(&(pipex->CriticalSection));
(pipex->state)|=PIPEX_EOF;
LeaveCriticalSection(&(pipex->CriticalSection));
- // not quit the right place
- my_log("%s->Adapter: EOF\n",pipex->name);
-
-}
+ }
// pipex_active()
WaitForSingleObject(pipex->hEvent,INFINITE);
}
}
+ my_log("%s->Adapter: EOF\n",pipex->name);
szLineStr[0]='\0';
return FALSE;
}
// pipex_set_affinit()
+typedef void (WINAPI *SPAM)(HANDLE, int);
void pipex_set_affinity(pipex_t *pipex, int value){
+ SPAM pSPAM;
+
if(pipex->hProcess) return;
if(value==-1) return;
- typedef void (WINAPI *SPAM)(HANDLE, int);
- SPAM pSPAM;
pSPAM = (SPAM) GetProcAddress(
GetModuleHandle(TEXT("kernel32.dll")),
"SetProcessAffinityMask");
void pipex_writeln(pipex_t *pipex, const char *szLineStr) {
DWORD dwBytes;
DWORD dwLengthWriteBuffer;
- my_log("Adapter->%s: %s\n",pipex->name,pipex->szWriteBuffer);
pipex_write(pipex, szLineStr);
+ my_log("Adapter->%s: %s\n",pipex->name,pipex->szWriteBuffer);
if(pipex->bPipe){
dwLengthWriteBuffer = strlen(pipex->szWriteBuffer);
if(dwLengthWriteBuffer>=sizeof(pipex->szWriteBuffer)-3){