home *** CD-ROM | disk | FTP | other *** search
- /*
- GP.C -- Lists GP fault handlers
-
- From Chapter 5 of "Undocumented Windows" (Addison-Wesley 1992)
- by Andrew Schulman, Dave Maxey and Matt Pietrek
-
- Build using: WINIOBC GP (for Borland C++ v3.00)
- WINIOMS GP (for Microsoft C/SDK)
- */
-
- #include <windows.h>
- #include "winio.h"
-
- typedef struct {
- WORD seg, low, high, func;
- } GPTAB;
-
- main(int argc, char *argv[])
- {
- GPTAB far *__GP;
- GPTAB far *p;
- char *modname;
-
- winio_about("GP"
- "\nLists GP fault handlers"
- "\nUsage: GP [module name]"
- "\n\nFrom Chapter 5 of"
- "\n\"Undocumented Windows\" (Addison-Wesley, 1992)"
- "\nby Andrew Schulman, David Maxey and Matt Pietrek"
- );
-
- modname = (argc < 2) ? "KERNEL" : argv[1];
-
- // MUST use GetProcAddress, because __GP in more than one module
- if (! (__GP = GetProcAddress(GetModuleHandle(modname), "__GP")))
- fail("Cannot locate __GP in module");
-
- printf("GP fault handling in %s\n", modname);
- for (p=__GP; p->seg; p++)
- printf("GP faults in %04x:%04x-%04x handled by %04x:%04x\n",
- p->seg, p->low, p->high, p->seg, p->func);
- return 0;
- }
-
-