This code calls renamed pocc.exe as poccx.exe
An actual pocc.exe error code not even handled.
A poccx.exe have to have a full path to Pelles C bin folder.
Just a temporary solution to 24H2 problem
- rename original pocc.exe to poccx.exe
- copy fake pocc.exe to Pelles c bin folder
// pocc.c
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <stdio.h>
int __cdecl mainCRTStartup(void)
{
HANDLE hRead, hWrite;
SECURITY_ATTRIBUTES sa;
STARTUPINFO si;
PROCESS_INFORMATION pi;
DWORD nRead, nWrite, nErr;
char *lpszCmdLine, *pChar;
char szProg[1024];
char szBuff[1024];
HANDLE hStdOut = GetStdHandle(STD_OUTPUT_HANDLE);
DWORD nLen = GetModuleFileName(NULL, szProg, sizeof(szProg));
nLen -= 4;
lstrcpy(szProg+nLen, "x.exe");
OutputDebugString(szProg);
lpszCmdLine = GetCommandLine();
pChar = lpszCmdLine;
if (*pChar == '"') {
pChar++;
while (*pChar && *pChar != '"')
pChar++;
pChar++;
} else {
while (*pChar && *pChar != ' ')
pChar++;
}
while (*pChar == ' ')
pChar++;
OutputDebugString(pChar);
sa.nLength = sizeof(SECURITY_ATTRIBUTES);
sa.lpSecurityDescriptor = NULL;
sa.bInheritHandle = TRUE;
if (!CreatePipe(&hRead, &hWrite, &sa, 0)) {
// ERROR
} else {
si.cb = sizeof(STARTUPINFO);
GetStartupInfo(&si);
si.dwFlags = STARTF_USESTDHANDLES | STARTF_USESHOWWINDOW;
si.hStdOutput = hWrite;
si.hStdError = hWrite;
si.wShowWindow = SW_SHOW; //SW_HIDE;
si.lpReserved = NULL;
if (!CreateProcess(szProg, pChar, NULL, NULL, TRUE, 0, NULL, NULL, &si, &pi)) {
OutputDebugString("ERROR");
} else {
CloseHandle(hWrite);
WaitForSingleObject(pi.hProcess, 30000);
GetExitCodeProcess(pi.hProcess, &nErr);
//CloseHandle(pi.hProcess);
CloseHandle(pi.hThread);
while (TRUE) {
szBuff[0] = 0;
if (!ReadFile(hRead, szBuff, sizeof(szBuff)-1, &nRead, NULL))
break;
szBuff[nRead] = 0;
WriteFile(hStdOut, szBuff, nRead, &nWrite, NULL);
}
}
CloseHandle(hRead);
}
if (nErr == 0xC0000005) nErr = 0; // exception error
ExitProcess(nErr);
}
EDIT: fake poasm.exe too