Thanks for your help anonytmouse.
That thread doesn't really shed any light - I've done a good amount of googling.
I'm actaully calling pscp (Putty Secure Copy) to send a file via ssh to a unix box. I guess that 16bit?????
I call getlasterror directly after successfully calling getexitcodeprocess:
Code:
/* CreateProcess API initialization */
STARTUPINFO siStartupInfo;
PROCESS_INFORMATION piProcessInfo;
memset(&siStartupInfo, 0, sizeof(siStartupInfo));
memset(&piProcessInfo, 0, sizeof(piProcessInfo));
siStartupInfo.cb = sizeof(siStartupInfo);
siStartupInfo.dwFlags = STARTF_USESHOWWINDOW;
siStartupInfo.wShowWindow = SW_HIDE;
if(CreateProcess(fullPath,args,NULL,NULL, false,
CREATE_DEFAULT_ERROR_MODE, NULL, NULL, &siStartupInfo,
&piProcessInfo) != false)
{
if (WAIT_OBJECT_0 == WaitForSingleObject(piProcessInfo.hProcess,timeout * 1000))
{
if(GetExitCodeProcess(piProcessInfo.hProcess, &dwExitCode))
{
printf("exited - %d - %d\n",dwExitCode,GetLastError());
}
else
{
dwExitCode = GetLastError();
}
}
else
{
//timeout or error
dwExitCode = GetLastError();
}
CloseHandle(piProcessInfo.hProcess);
CloseHandle(piProcessInfo.hThread);
}
else
{
dwExitCode = GetLastError();
}