/* This code is 32-bit code which calls 16-bit functions defined in * win-e7kpc16.c in order to interface with the memory mapped * physical memory for the Hitachi e7000-pc. */ #include #include "win-e7kpc.h" typedef int (CALLBACK *PROC16_PFN)(int); // Prototype undocumented KERNEL32 functions HINSTANCE WINAPI LoadLibrary16( PSTR ); void WINAPI FreeLibrary16( HINSTANCE ); FARPROC WINAPI GetProcAddress16( HINSTANCE, PSTR ); void __cdecl QT_Thunk(void); PROC16_PFN pfn_set_mem = 0; // We don't want these as locals in PROC16_PFN pfn_get_mem = 0; HINSTANCE hInstUser16; // main(), since QT_THUNK could static long save_sp; static WORD set_mem_rc; // trash them... static WORD mem; static long mem_offset; static long mem_parms; static int i; //============= stand-alone test code ================== #ifdef STAND_ALONE static int len=20; static int offset=10; static char buf[512]; static FILE *fout; #ifdef _WIN32 main() #else int PASCAL WinMain (HINSTANCE hinst, HINSTANCE hinstPrev, LPSTR lpszCmdLine, int cmdShow ) #endif { //============= trash space ================== char buffer[0x40]; buffer[0] = 0; // Make sure to use the local variable so that the // compiler sets up an EBP frame fout=fopen("errs","w"); fprintf(fout,"Testing... i=%d, offset=%d\n", i,offset); if (win_load_e7kpc() != 0) { fprintf(fout,"ERROR! unable to load e7kpc dll\n"); return 1; } //============= do test ============================ for (i=0; i