- Timestamp:
- Feb 17, 2012, 2:50:41 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/odincrt/dos.cpp
r21658 r21972 18 18 19 19 #include "odincrt.h" 20 21 //#define EXTRALOG 22 23 #undef dprintf 24 #ifdef EXTRALOG 25 26 #include <stdio.h> 27 #include <stdarg.h> 28 29 void dbg(const char *fmt, ...) 30 { 31 static FILE *f = 0; 32 if (!f) 33 { 34 f = fopen ("/odin32_odincrt_dos.log", "w+"); 35 setbuf (f, NULL); 36 } 37 if (f) 38 { 39 va_list args; 40 va_start (args, fmt); 41 vfprintf (f, fmt, args); 42 fprintf (f, "\n"); 43 va_end (args); 44 } 45 } 46 47 #define dprintf(a) do { dbg a; } while(0) 48 49 #else // EXTRALOG 50 #define dprintf(a) do {} while(0) 51 #endif // EXTRALOG 20 52 21 53 static BOOL matchModuleName(PCSZ pszFullModname, PCSZ pszModname) … … 88 120 APIRET WIN32API DosQueryModuleHandleStrict(PCSZ pszModname, PHMODULE pHmod) 89 121 { 122 dprintf(("DosQueryModuleHandleStrict: BEGIN (%s, %p)", pszModname, pHmod)); 123 90 124 PPIB ppib; 91 125 APIRET arc = DosGetInfoBlocks(NULL, &ppib); 92 126 if (arc != NO_ERROR) 127 { 128 dprintf(("DosQueryModuleHandleStrict: DosGetInfoBlocks failed with %d", arc)); 93 129 return arc; 130 } 94 131 95 132 *pHmod = NULLHANDLE; … … 102 139 char *buf = (char *)malloc(64 * 1024); 103 140 if (buf == NULL) 141 { 142 dprintf(("DosQueryModuleHandleStrict: not enough memory")); 104 143 return ERROR_NOT_ENOUGH_MEMORY; 144 } 105 145 106 146 arc = DosQuerySysState(QS_PROCESS | QS_MTE, QS_MTE, … … 108 148 if (arc != NO_ERROR) 109 149 { 150 dprintf(("DosQueryModuleHandleStrict: DosQuerySysState failed with %d", arc)); 110 151 free(buf); 111 152 return arc; … … 126 167 if (walkModules(pPtrRec, hmte, pszModname, pHmod)) 127 168 { 169 dprintf(("DosQueryModuleHandleStrict: found pHmod %x", *pHmod)); 128 170 arc = NO_ERROR; 129 171 break; … … 137 179 } 138 180 181 dprintf(("DosQueryModuleHandleStrict: END (%d)", arc)); 139 182 free(buf); 140 183 return arc;
Note:
See TracChangeset
for help on using the changeset viewer.