Saturday, December 31, 2022

Win32s programming pitfalls

 I think it is worth to write some notes here for people who want to write programs targeting win32s:

- You have to tell your Linker to generate Relocation Table (.reloc) for all of your executables (DLL/EXE), and better setting SUBSYSTEM version to 3.10 for best result.

- You CANNOT use global static function pointers which points to local functions. Win32s uses Relocation Table to relocate functions and value stored in function pointer will become invalid and causes a Page Fault crash. (using GetProcAddress() to get and use function pointer is fine, and it seems that storing in non-static variable is fine)

(more to come...)

No comments:

Post a Comment