NO

Author Topic: Exception in pocc.exe  (Read 38882 times)

HellOfMice

  • Guest
Re: Exception in pocc.exe
« Reply #15 on: January 16, 2025, 09:26:54 AM »
That seems a better solution than what I proposed. I will try. Thank You Timo


Philippe


HellOfMice

  • Guest
Re: Exception in pocc.exe
« Reply #16 on: January 16, 2025, 10:32:19 AM »
Hi Timo


I have renamed the old pocc.exe to poccx.exe and unzipped yours.
I always have the error



> porc.exe -N "C:\Users\51966\Documents\DocsPhR\Assembleur\Awpe\Awpe.rc" -Fo"C:\Users\51966\Documents\DocsPhR\Assembleur\Awpe\Compile\Awpe.res"
Building Awpe.tag.
> pocc.exe -Tx64-coff -std:C2X -Zi -Ot -Ob1 -fp:precise -W1 -Gr -Ze -Zx -GX -J "C:\Users\51966\Documents\DocsPhR\Assembleur\Awpe\Create Dlg Sections.c" -Fo"C:\Users\51966\Documents\DocsPhR\Assembleur\Awpe\Compile\Create Dlg Sections.obj"
Building Awpe.tag.
> poasm.exe -AAMD64 -Zi -Gz -Fo"C:\Users\51966\Documents\DocsPhR\Assembleur\Awpe\Compile\Display Data Directories.obj" "C:\Users\51966\Documents\DocsPhR\Assembleur\Awpe\Display Data Directories.asm"
warning: Ignored in 64-bit mode: 'STDCALL'.
*** Error code: -1073741819 ***
Done.


HellOfMice

  • Guest
Re: Exception in pocc.exe
« Reply #17 on: January 16, 2025, 10:36:41 AM »
Timo,


When the process exits could you return 0 if No errors found and just 1 if an error, like compiling, has been found.
It is for using ERRORLEVEL in a cmd file


If it is possible. I already ask to Pelle here in this forum.

Offline TimoVJL

  • Global Moderator
  • Member
  • *****
  • Posts: 2234
Re: Exception in pocc.exe
« Reply #18 on: January 16, 2025, 12:05:01 PM »
So you mean if exception don't happen, a real pocc.exe error code returned ?
Isn't it a bit useless thing with 24H2 ?
In working system fake pocc.exe don't even needed.
May the source be with you

HellOfMice

  • Guest
Re: Exception in pocc.exe
« Reply #19 on: January 16, 2025, 12:11:17 PM »
I can simulate a make


POCC Something.c
IF ERRORLEVEL 1 GOTO FINISHED
POASM Another.asm
IF ERRORLEVEL 1 GOTO FINISHED
POLINK ...
IF ERRORLEVEL 1 GOTO ERRORLINKER
MYPROGRAM.EXE
EXIT
:ERRORLINKER
ECHHO You are bad
:FINISHED
EXIT

Offline alderman2

  • Member
  • *
  • Posts: 80
    • Xmag
Re: Exception in pocc.exe
« Reply #20 on: January 16, 2025, 01:04:52 PM »
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
Code: [Select]
// 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
I renamed pocc.exe to poccXX.exe and added fake pocc.exe:
I get no error message and the exe file starts. But, my program does not change. I printed "kkkkk" in the program window before the change. After the change to fake pocc.exe, I changed the text to "xxxxx". When I compile I still get program window with "kkkkk".
I switched back to original pocc.exe and compiles. Now the program window opens with "xxxxx" printed.

Unfortunately, fake pocc.exe does not work correctly, but maybe it can be developed further ;)
I look forward to another test!

Offline TimoVJL

  • Global Moderator
  • Member
  • *****
  • Posts: 2234
Re: Exception in pocc.exe
« Reply #21 on: January 16, 2025, 01:15:26 PM »
Unfortunately, fake pocc.exe does not work correctly, but maybe it can be developed further ;)
I look forward to another test!
rename orginal pocc.exe to poccx.exe

With DbgView.exe might be possible to see, if result of GetModuleFileName() and modification have a problem.
I don't use Program Files folder in testings.

Perhaps it's better, that MS develop 24H2 further  ;D

This code might be a problem with paths with spaces
Code: [Select]
DWORD nLen = GetModuleFileName(NULL, szProg, sizeof(szProg));
nLen -= 4;
lstrcpy(szProg+nLen, "x.exe");
OutputDebugString(szProg);
« Last Edit: January 16, 2025, 01:32:17 PM by TimoVJL »
May the source be with you

HellOfMice

  • Guest
Re: Exception in pocc.exe
« Reply #22 on: January 16, 2025, 02:06:55 PM »
I have a good solution, it runs, no reason too search for other soluce

I made change using a response file for linking


Whatever you do, find or don't find the key to solve the problem, there is a question behind, if Pelle does not come back?
Will us accept to find each time a solution, nice or not?


AMD compiler is free, on Linux and many AMD libraries. There is alsoa profiler like VTune.
Is it a solutiton?
« Last Edit: January 16, 2025, 02:13:42 PM by HellOfMice »

Offline alderman2

  • Member
  • *
  • Posts: 80
    • Xmag
Re: Exception in pocc.exe
« Reply #23 on: January 16, 2025, 09:27:30 PM »
Unfortunately, fake pocc.exe does not work correctly, but maybe it can be developed further ;)
I look forward to another test!
rename orginal pocc.exe to poccx.exe

With DbgView.exe might be possible to see, if result of GetModuleFileName() and modification have a problem.
I don't use Program Files folder in testings.

Perhaps it's better, that MS develop 24H2 further  ;D

This code might be a problem with paths with spaces
Code: [Select]
DWORD nLen = GetModuleFileName(NULL, szProg, sizeof(szProg));
nLen -= 4;
lstrcpy(szProg+nLen, "x.exe");
OutputDebugString(szProg);
Have I understood correctly:
- Rename original pocc.exe to poccx.exe
- Place fake pocc.exe in the bin folder

Offline alderman2

  • Member
  • *
  • Posts: 80
    • Xmag
Re: Exception in pocc.exe
« Reply #24 on: January 16, 2025, 09:33:39 PM »
NOW IT WORKS!!
 ;D ;D ;D
I must have done something wrong last time (maybe spaces or something).

THANKS TimoVJL !!
« Last Edit: January 16, 2025, 09:35:26 PM by alderman2 »

Offline Vortex

  • Member
  • *
  • Posts: 990
    • http://www.vortex.masmcode.com
Re: Exception in pocc.exe
« Reply #25 on: January 20, 2025, 11:27:29 AM »
Hi Timo,

I tested your method on a simple hello world project. I received the following warning messages :

Code: [Select]
POLINK: warning: Invalid machine type in object 'crt64.lib(printf.obj)'.
POLINK: warning: Invalid machine type in object 'crt64.lib(fwrite.obj)'.
POLINK: warning: Invalid machine type in object 'crt64.lib(_files.obj)'.
POLINK: warning: Invalid machine type in object 'crt64.lib(_stbuf.obj)'.
POLINK: warning: Invalid machine type in object 'crt64.lib(_printf.obj)'.
POLINK: warning: Invalid machine type in object 'crt64.lib(_fwrite.obj)'.
POLINK: warning: Invalid machine type in object 'crt64.lib(memchr.obj)'.
POLINK: warning: Invalid machine type in object 'crt64.lib(_fflush.obj)'.
POLINK: warning: Invalid machine type in object 'crt64.lib(fileno.obj)'.
POLINK: warning: Invalid machine type in object 'crt64.lib(isatty.obj)'.
POLINK: warning: Invalid machine type in object 'crt64.lib(_mbcurmax.obj)'.
POLINK: warning: Invalid machine type in object 'crt64.lib(_mbrtowc.obj)'.
POLINK: warning: Invalid machine type in object 'crt64.lib(isdigit.obj)'.
POLINK: warning: Invalid machine type in object 'crt64.lib(_prtfld.obj)'.
POLINK: warning: Invalid machine type in object 'crt64.lib(_prttxt.obj)'.
POLINK: warning: Invalid machine type in object 'crt64.lib(malloc.obj)'.
POLINK: warning: Invalid machine type in object 'crt64.lib(fclose.obj)'.
POLINK: warning: Invalid machine type in object 'crt64.lib(write.obj)'.
POLINK: warning: Invalid machine type in object 'crt64.lib(_ioinit.obj)'.
POLINK: warning: Invalid machine type in object 'crt64.lib(_mbtoc32.obj)'.
POLINK: warning: Invalid machine type in object 'crt64.lib(_ctypetab.obj)'.
POLINK: warning: Invalid machine type in object 'crt64.lib(_prtstr.obj)'.
POLINK: warning: Invalid machine type in object 'crt64.lib(_prtint.obj)'.
POLINK: warning: Invalid machine type in object 'crt64.lib(_prtflt.obj)'.
POLINK: warning: Invalid machine type in object 'crt64.lib(constraint_handler_s.obj)'.
POLINK: warning: Invalid machine type in object 'crt64.lib(_getmem.obj)'.
POLINK: warning: Invalid machine type in object 'crt64.lib(_crt0dat.obj)'.
POLINK: warning: Invalid machine type in object 'crt64.lib(free.obj)'.
POLINK: warning: Invalid machine type in object 'crt64.lib(_crtabort.obj)'.
POLINK: warning: Invalid machine type in object 'crt64.lib(errno.obj)'.
POLINK: warning: Invalid machine type in object 'crt64.lib(_bigheap.obj)'.
POLINK: warning: Invalid machine type in object 'crt64.lib(_atexit.obj)'.
POLINK: warning: Invalid machine type in object 'crt64.lib(close.obj)'.
POLINK: warning: Invalid machine type in object 'crt64.lib(remove.obj)'.
POLINK: warning: Invalid machine type in object 'crt64.lib(_osfinfo.obj)'.
POLINK: warning: Invalid machine type in object 'crt64.lib(_cwrite.obj)'.
POLINK: warning: Invalid machine type in object 'crt64.lib(lseek64.obj)'.
POLINK: warning: Invalid machine type in object 'crt64.lib(_maperr.obj)'.
POLINK: warning: Invalid machine type in object 'crt64.lib(_ioxfer.obj)'.
POLINK: warning: Invalid machine type in object 'crt64.lib(_c32tomb.obj)'.
POLINK: warning: Invalid machine type in object 'crt64.lib(_fpunscalel.obj)'.
POLINK: warning: Invalid machine type in object 'crt64.lib(_values.obj)'.
POLINK: warning: Invalid machine type in object 'crt64.lib(_fpscalel.obj)'.
POLINK: warning: Invalid machine type in object 'crt64.lib(localeconv.obj)'.
POLINK: warning: Invalid machine type in object 'crt64.lib(_strerror.obj)'.
POLINK: warning: Invalid machine type in object 'crt64.lib(fputs.obj)'.
POLINK: warning: Invalid machine type in object 'crt64.lib(_exit.obj)'.
POLINK: warning: Invalid machine type in object 'crt64.lib(memcpy.obj)'.
POLINK: warning: Invalid machine type in object 'crt64.lib(exit.obj)'.
POLINK: warning: Invalid machine type in object 'crt64.lib(unlink.obj)'.
POLINK: warning: Invalid machine type in object 'crt64.lib(calloc.obj)'.
POLINK: warning: Invalid machine type in object 'crt64.lib(_fpunscale.obj)'.
POLINK: warning: Invalid machine type in object 'crt64.lib(_fpscale.obj)'.
POLINK: warning: Invalid machine type in object 'crt64.lib(fputc.obj)'.
POLINK: warning: Invalid machine type in object 'crt64.lib(memset.obj)'.
POLINK: warning: Invalid machine type in object 'crt64.lib(_fpnorm.obj)'.
POLINK: error: Unresolved external symbol '__mainCRTStartup' - referenced from '<common>'.
POLINK: error: Unresolved external symbol '__imp_WriteFile' - referenced from 'crt64.lib(write.obj)'.
POLINK: error: Unresolved external symbol '__imp_GetLastError' - referenced from 'crt64.lib(write.obj)'.
POLINK: error: Unresolved external symbol '__imp_WriteConsoleW' - referenced from 'crt64.lib(write.obj)'.
POLINK: error: Unresolved external symbol '__imp_WideCharToMultiByte' - referenced from 'crt64.lib(write.obj)'.
POLINK: error: Unresolved external symbol '__imp_GetStartupInfoW' - referenced from 'crt64.lib(_ioinit.obj)'.
POLINK: error: Unresolved external symbol '__imp_GetStdHandle' - referenced from 'crt64.lib(_ioinit.obj)'.
POLINK: error: Unresolved external symbol '__imp_GetFileType' - referenced from 'crt64.lib(_ioinit.obj)'.
POLINK: error: Unresolved external symbol '__imp_GetCurrentProcess' - referenced from 'crt64.lib(_ioinit.obj)'.
POLINK: error: Unresolved external symbol '__imp_DuplicateHandle' - referenced from 'crt64.lib(_ioinit.obj)'.
POLINK: error: Unresolved external symbol '__imp_IsDBCSLeadByteEx' - referenced from 'crt64.lib(_mbtoc32.obj)'.
POLINK: error: Unresolved external symbol '__imp_MultiByteToWideChar' - referenced from 'crt64.lib(_mbtoc32.obj)'.
POLINK: error: Unresolved external symbol '__imp_VirtualAlloc' - referenced from 'crt64.lib(_getmem.obj)'.
POLINK: error: Unresolved external symbol '__imp_VirtualQuery' - referenced from 'crt64.lib(_getmem.obj)'.
POLINK: error: Unresolved external symbol '__imp_IsDebuggerPresent' - referenced from 'crt64.lib(_crtabort.obj)'.
POLINK: error: Unresolved external symbol '__imp_OutputDebugStringA' - referenced from 'crt64.lib(_crtabort.obj)'.
POLINK: error: Unresolved external symbol '__imp_HeapCreate' - referenced from 'crt64.lib(_bigheap.obj)'.
POLINK: error: Unresolved external symbol '__imp_HeapDestroy' - referenced from 'crt64.lib(_bigheap.obj)'.
POLINK: error: Unresolved external symbol '__imp_HeapAlloc' - referenced from 'crt64.lib(_bigheap.obj)'.
POLINK: error: Unresolved external symbol '__imp_HeapReAlloc' - referenced from 'crt64.lib(_bigheap.obj)'.
POLINK: error: Unresolved external symbol '__imp_HeapFree' - referenced from 'crt64.lib(_bigheap.obj)'.
POLINK: error: Unresolved external symbol '__imp_HeapSize' - referenced from 'crt64.lib(_bigheap.obj)'.
POLINK: error: Unresolved external symbol '__imp_HeapValidate' - referenced from 'crt64.lib(_bigheap.obj)'.
POLINK: error: Unresolved external symbol '__imp_CloseHandle' - referenced from 'crt64.lib(close.obj)'.
POLINK: error: Unresolved external symbol '__imp_SetStdHandle' - referenced from 'crt64.lib(_osfinfo.obj)'.
POLINK: error: Unresolved external symbol '__imp_GetConsoleMode' - referenced from 'crt64.lib(_osfinfo.obj)'.
POLINK: error: Unresolved external symbol '__imp_WriteConsoleA' - referenced from 'crt64.lib(_cwrite.obj)'.
POLINK: error: Unresolved external symbol '__imp_SetFilePointerEx' - referenced from 'crt64.lib(lseek64.obj)'.
POLINK: error: Unresolved external symbol '__imp_ExitProcess' - referenced from 'crt64.lib(_exit.obj)'.
POLINK: error: Unresolved external symbol '__imp_DeleteFileA' - referenced from 'crt64.lib(unlink.obj)'.
POLINK: fatal error: 30 unresolved external(s).
*** Error code: 1 ***
Done.

32-bit Console project :

Code: [Select]
#include <stdio.h>

int main(void)
{
    printf("Hello, world!\n");
    return 0;
}
Code it... That's all...

Offline TimoVJL

  • Global Moderator
  • Member
  • *****
  • Posts: 2234
Re: Exception in pocc.exe
« Reply #26 on: January 20, 2025, 12:27:36 PM »
Something mixed in project.
You can see with DbgView commandline for pocc.exe.
DebugView v4.90
A fake pocc.exe pass commandline to poccx.exe as it is.
Perhaps in output folder is an older object-file from x64 project.

Zip a your project for analyzing.

May the source be with you

Offline Vortex

  • Member
  • *
  • Posts: 990
    • http://www.vortex.masmcode.com
Re: Exception in pocc.exe
« Reply #27 on: January 20, 2025, 03:21:43 PM »
Hi Timo,

Here is log of DbgView :

Code: [Select]
00000004 38.95228958 [9512] D:\PellesC\Bin\poccx.exe
00000005 38.95232773 [9512] -Tx86-coff -std:C17 -Ot -Ob1 -fp:precise -W1 -Gd -Ze -Zx "C:\test\test.c" -Fo"C:\test\output\test.obj"

Attached is the test project.
Code it... That's all...

Offline TimoVJL

  • Global Moderator
  • Member
  • *****
  • Posts: 2234
Re: Exception in pocc.exe
« Reply #28 on: January 20, 2025, 03:33:08 PM »
test.obj was compiled to x64 even commandline was for x86 ?
Perhaps a leftover from x64 project.

Time to give up?
« Last Edit: January 20, 2025, 05:20:28 PM by TimoVJL »
May the source be with you

HellOfMice

  • Guest
Re: Exception in pocc.exe
« Reply #29 on: January 20, 2025, 05:56:15 PM »
Hi Timo & Vortex


I don't understand, for x86 or x64 the command lines are the same. :-\


Philippe