I rather like this idea, the last time I checked the pre-processor output the windows guff made me feel a little ill.
I'd like to do this and removing the C runtime, I just had a quick bash at it but tripped up fairly quickly.
Here's my MiniWin.h
// Bloatless version of windows.h, just including the things from windows.h that I need
typedef struct HINSTANCE__* HINSTANCE;
typedef char* LPSTR;
#define WINAPI __stdcall
typedef const wchar_t* LPCWSTR;
typedef HINSTANCE HMODULE;
HMODULE WINAPI GetModuleHandle(LPCWSTR lpModuleName);
void __stdcall ExitProcess(unsigned int uExitCode);
Then when I try and build a simple (do nothing) program I get the following build errors:
Main_win32.obj : error LNK2019: unresolved external symbol "struct HINSTANCE__ * __cdecl GetModuleHandle(wchar_t const *)" (?GetModuleHandle@@YAPEAUHINSTANCE__@@PEB_W@Z) referenced in function "void __cdecl WinMainCRTStartup(void)" (?WinMainCRTStartup@@YAXXZ)
Main_win32.obj : error LNK2019: unresolved external symbol "void __cdecl ExitProcess(unsigned int)" (?ExitProcess@@YAXI@Z) referenced in function "void __cdecl WinMainCRTStartup(void)" (?WinMainCRTStartup@@YAXXZ)
I'm guessing this is because the code signatures of the functions in my header don't match those in kernel32.lib
I suspect the problem is that I cut some corners grabbing code from windows.h as going into that is like going down the rabbit hole!
Any ideas? (is there a way of checking what the code signatures are in the lib?)