Changeset 2832 for trunk/src/win32k/dev16/probkrnl.c
- Timestamp:
- Feb 20, 2000, 5:27:24 AM (26 years ago)
- File:
-
- 1 edited
-
trunk/src/win32k/dev16/probkrnl.c (modified) (15 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/win32k/dev16/probkrnl.c
r2831 r2832 1 /* $Id: probkrnl.c,v 1.1 1 2000-02-19 23:51:59bird Exp $1 /* $Id: probkrnl.c,v 1.12 2000-02-20 04:27:23 bird Exp $ 2 2 * 3 3 * Description: Autoprobes the os2krnl file and os2krnl[*].sym files. … … 89 89 */ 90 90 IMPORTKRNLSYM aImportTab[NBR_OF_KRNLIMPORTS] = 91 {/* iFound cchName offObject usSel */92 /* iObject achName ulAddress fType*/93 {FALSE, -1, 8, "_ldrRead", -1, -1, -1, EPT_PROC32}, /* 0 */94 {FALSE, -1, 8, "_ldrOpen", -1, -1, -1, EPT_PROC32}, /* 1 */95 {FALSE, -1, 9, "_ldrClose", -1, -1, -1, EPT_PROC32}, /* 2 */96 {FALSE, -1, 12, "_LDRQAppType", -1, -1, -1, EPT_PROCIMPORT32}, /* 3 */ /* to be removed? */97 {FALSE, -1, 20, "_ldrEnum32bitRelRecs", -1, -1, -1, EPT_PROC32}, /* 4 */98 {FALSE, -1, 10, "_IOSftOpen", -1, -1, -1, EPT_PROCIMPORT32}, /* 5 */99 {FALSE, -1, 11, "_IOSftClose", -1, -1, -1, EPT_PROCIMPORT32}, /* 6 */100 {FALSE, -1, 15, "_IOSftTransPath", -1, -1, -1, EPT_PROCIMPORT32}, /* 7 */101 {FALSE, -1, 12, "_IOSftReadAt", -1, -1, -1, EPT_PROCIMPORT32}, /* 8 */102 {FALSE, -1, 13, "_IOSftWriteAt", -1, -1, -1, EPT_PROCIMPORT32}, /* 9 */103 {FALSE, -1, 12, "_SftFileSize", -1, -1, -1, EPT_PROCIMPORT32}, /* 10 */104 {FALSE, -1, 11, "_VMAllocMem", -1, -1, -1, EPT_PROCIMPORT32}, /* 11 */105 {FALSE, -1, 11, "_VMGetOwner", -1, -1, -1, EPT_PROCIMPORT32}, /* 12 */106 {FALSE, -1, 11, "g_tkExecPgm", -1, -1, -1, EPT_PROC32}, /* 13 */107 {FALSE, -1, 11, "f_FuStrLenZ", -1, -1, -1, EPT_PROCIMPORT16}, /* 14 */108 {FALSE, -1, 8, "f_FuBuff", -1, -1, -1, EPT_PROCIMPORT16} /* 15 */91 {/* iFound cchName offObject usSel fType */ 92 /* iObject achName ulAddress cProlog */ 93 {FALSE, -1, 8, "_ldrRead", -1, -1, -1, -1, EPT_PROC32}, /* 0 */ 94 {FALSE, -1, 8, "_ldrOpen", -1, -1, -1, -1, EPT_PROC32}, /* 1 */ 95 {FALSE, -1, 9, "_ldrClose", -1, -1, -1, -1, EPT_PROC32}, /* 2 */ 96 {FALSE, -1, 12, "_LDRQAppType", -1, -1, -1, -1, EPT_PROCIMPORT32}, /* 3 */ /* to be removed? */ 97 {FALSE, -1, 20, "_ldrEnum32bitRelRecs", -1, -1, -1, -1, EPT_PROC32}, /* 4 */ 98 {FALSE, -1, 10, "_IOSftOpen", -1, -1, -1, -1, EPT_PROCIMPORT32}, /* 5 */ 99 {FALSE, -1, 11, "_IOSftClose", -1, -1, -1, -1, EPT_PROCIMPORT32}, /* 6 */ 100 {FALSE, -1, 15, "_IOSftTransPath", -1, -1, -1, -1, EPT_PROCIMPORT32}, /* 7 */ 101 {FALSE, -1, 12, "_IOSftReadAt", -1, -1, -1, -1, EPT_PROCIMPORT32}, /* 8 */ 102 {FALSE, -1, 13, "_IOSftWriteAt", -1, -1, -1, -1, EPT_PROCIMPORT32}, /* 9 */ 103 {FALSE, -1, 12, "_SftFileSize", -1, -1, -1, -1, EPT_PROCIMPORT32}, /* 10 */ 104 {FALSE, -1, 11, "_VMAllocMem", -1, -1, -1, -1, EPT_PROCIMPORT32}, /* 11 */ 105 {FALSE, -1, 11, "_VMGetOwner", -1, -1, -1, -1, EPT_PROCIMPORT32}, /* 12 */ 106 {FALSE, -1, 11, "g_tkExecPgm", -1, -1, -1, -1, EPT_PROC32}, /* 13 */ 107 {FALSE, -1, 11, "f_FuStrLenZ", -1, -1, -1, -1, EPT_PROCIMPORT16}, /* 14 */ 108 {FALSE, -1, 8, "f_FuBuff", -1, -1, -1, -1, EPT_PROCIMPORT16} /* 15 */ 109 109 /* {FALSE, -1, 11, "", -1, -1, -1, EPT_PROCIMPORT16} */ /* 16 */ 110 110 }; … … 157 157 * Internal Functions * 158 158 *******************************************************************************/ 159 static void kmemcpy(char *p1, const char *p2, int len); 160 static int kstrcmp(const char *p1, const char *p2); 161 static char *kstrstr(const char *psz1, const char *psz2); 162 static int kstrncmp(const char *p1, const char *p2, int len); 163 static int kstrlen(const char *p); 164 static HFILE fopen(char * filename, char * ignored); 165 static int fread(void * pBuffer, USHORT i1, USHORT i2, HFILE hfile); 166 static int fseek(HFILE hfile, signed long off, int org); 159 static HFILE fopen(const char * pszFilename, const char * pszIgnored); 160 static int fread(void * pvBuffer, USHORT cbBlock, USHORT cBlock, HFILE hFile); 161 static int fseek(HFILE hfile, signed long off, int iOrg); 167 162 static unsigned long fsize(HFILE hFile); 168 static void puts(char *psz); 169 static int kargncpy(char *pszTarget, const char *pszArg, unsigned cchMaxlen); 170 171 static int VerifyPrologs(void); 172 static int ProbeSymFile(char *pszFilename); 173 static int VerifyKernelVer(void); 174 static int ReadOS2Krnl(char *filename); 175 static int ReadOS2Krnl2(HFILE krnl, unsigned long cbKrnl); 176 static int GetKernelOTEs(void); 177 178 static void ShowDecNumber(unsigned long n); 179 static void ShowHexNumber(unsigned long int n); 180 static void ShowResult(int rc, int iSym); 163 static void puts(char *psz); 164 165 static void kmemcpy(char *psz1, const char *psz2, int cch); 166 static char * kstrstr(const char *psz1, const char *psz2); 167 static int kstrcmp(const char *psz1, const char *psz2); 168 static int kstrncmp(const char *psz1, const char *psz2, int cch); 169 static int kstrlen(const char *psz); 170 static int kargncpy(char *pszTarget, const char *pszArg, unsigned cchMaxlen); 171 172 static int VerifyPrologs(void); 173 static int ProbeSymFile(char *pszFilename); 174 static int VerifyKernelVer(void); 175 static int ReadOS2Krnl(char *pszFilename); 176 static int ReadOS2Krnl2(HFILE hKrnl, unsigned long cbKrnl); 177 static int GetKernelOTEs(void); 178 179 static void ShowDecNumber(unsigned long ul); 180 static void ShowHexNumber(unsigned long ul); 181 static void ShowResult(int rc, int iSym); 181 182 182 183 … … 189 190 /** 190 191 * Quick implementation of fopen. 191 * @param filename name of file to open (sz)192 * @param ignored whatever - it is ignored192 * @param pszFilename name of file to open (sz) 193 * @param pszIgnored whatever - it is ignored 193 194 * @return Handle to file. (not pointer to a FILE stream as in C-library) 194 195 * @remark binary and readonly is assumed! 195 196 */ 196 static HFILE fopen(c har * filename, char * ignored)197 static HFILE fopen(const char * pszFilename, const char * pszIgnored) 197 198 { 198 199 HFILE hFile = 0; … … 201 202 202 203 rc = DosOpen( 203 filename, 204 &hFile, 205 &Action, 206 0, 207 FILE_NORMAL, 208 OPEN_ACTION_FAIL_IF_NEW | OPEN_ACTION_OPEN_IF_EXISTS, 209 OPEN_SHARE_DENYNONE + OPEN_ACCESS_READONLY, 210 NULL 211 ); 212 213 ignored = ignored; 204 (char*)pszFilename, 205 &hFile, 206 &Action, 207 0, 208 FILE_NORMAL, 209 OPEN_ACTION_FAIL_IF_NEW | OPEN_ACTION_OPEN_IF_EXISTS, 210 OPEN_SHARE_DENYNONE + OPEN_ACCESS_READONLY, 211 NULL); 212 213 pszIgnored = pszIgnored; 214 214 return hFile; 215 215 } … … 219 219 * fread emulation 220 220 * @returns Number of blocks read. 221 * @param p Buffer Buffer to read into222 * @param i1 blocksize223 * @param i2 block count224 * @param hFile Handle to file (HFILE)225 */ 226 static int fread(void * p Buffer, USHORT cbBlock, USHORT cBlock, HFILE hFile)221 * @param pvBuffer Buffer to read into 222 * @param cbBlock Blocksize 223 * @param cBlock Block count 224 * @param hFile Handle to file (HFILE) 225 */ 226 static int fread(void * pvBuffer, USHORT cbBlock, USHORT cBlock, HFILE hFile) 227 227 { 228 228 USHORT ulRead; 229 229 USHORT rc; 230 230 231 rc = DosRead(hFile, p Buffer, (USHORT)(cbBlock*cBlock), &ulRead);231 rc = DosRead(hFile, pvBuffer, (USHORT)(cbBlock*cBlock), &ulRead); 232 232 if (rc == 0) 233 233 rc = (USHORT)cBlock; … … 246 246 * @param org origin 247 247 */ 248 static int fseek(HFILE hFile, signed long off, int org) 249 { 250 USHORT rc; 251 ULONG ole; 252 253 rc = DosChgFilePtr(hFile, off, org, &ole); 254 255 return rc; 248 static int fseek(HFILE hFile, signed long off, int iOrg) 249 { 250 ULONG ul; 251 return (int)DosChgFilePtr(hFile, off, iOrg, &ul); 256 252 } 257 253 … … 285 281 /** 286 282 * kmemcpy - memory copy - slow! 287 * @param p1 target 288 * @param p2 source 289 * @param len length 290 */ 291 static void kmemcpy(char * p1, const char * p2, int len) 292 { 293 while (len != 0) 294 { 295 *p1 = *p2; 296 p1++; 297 p2++; 298 len--; 299 } 300 } 301 302 #if 0 /* not in use */ 303 /** 304 * kstrcmp - String compare 305 * @returns 0 - equal else !0 306 * @param p1 String 1 307 * @param p2 String 2 308 */ 309 static int kstrcmp(const char * p1, const char * p2) 310 { 311 while (*p1 == *p2 && *p1 != '\0' && *p2 != '\0') 312 { 313 p1++; 314 p2++; 315 } 316 return *p1 - *p2; 317 } 318 #endif 319 283 * @param psz1 target 284 * @param psz2 source 285 * @param cch length 286 */ 287 static void kmemcpy(char *psz1, const char *psz2, int cch) 288 { 289 while (cch-- != 0) 290 *psz1++ = *psz2++; 291 } 320 292 321 293 … … 347 319 348 320 321 #if 0 /* not in use */ 322 /** 323 * kstrcmp - String compare 324 * @returns 0 - equal else !0 325 * @param psz1 String 1 326 * @param psz2 String 2 327 */ 328 static int kstrcmp(const char *psz1, const char *psz2); 329 { 330 while (*psz1 == *psz2 && *psz1 != '\0' && *psz2 != '\0') 331 { 332 psz1++; 333 psz2++; 334 } 335 return *psz1 - *psz2; 336 } 337 #endif 338 339 349 340 350 341 /** 351 342 * kstrncmp - String 'n' compare. 352 * @returns353 343 * @returns 0 - equal else !0 354 344 * @param p1 String 1 … … 356 346 * @param len length 357 347 */ 358 static int kstrncmp(const char * p1, const char * p2, int len)348 static int kstrncmp(register const char *psz1, register const char *psz2, int cch) 359 349 { 360 350 int i = 0; 361 while (i < len && *p1 == *p2 && *p1 != '\0' && *p2 != '\0')362 { 363 p 1++;364 p 2++;351 while (i < cch && *psz1 == *psz2 && *psz1 != '\0' && *psz2 != '\0') 352 { 353 psz1++; 354 psz2++; 365 355 i++; 366 356 } 367 357 368 return i - len;358 return i - cch; 369 359 } 370 360 … … 377 367 * @author knut st. osmundsen 378 368 */ 379 static int kstrlen( const char * psz)380 { 381 int cch = 0;382 while ( psz[cch]!= '\0')369 static int kstrlen(register const char * psz) 370 { 371 register int cch = 0; 372 while (*psz++ != '\0') 383 373 cch++; 384 374 return cch; … … 508 498 return -50; 509 499 } 500 dprintf(("\nSuccessfully opened symbolfile: %s\n", pszFilename)); 510 501 511 502 … … 525 516 dprintf(("*Module name: %s\n", achBuffer)); 526 517 dprintf(("*Segments: %d\n*MaxSymbolLength: %d\n", MapDef.cSegs, MapDef.cbMaxSym)); 527 dprintf(("*ppNextMap: 0x%x\n \n", MapDef.ppNextMap ));518 dprintf(("*ppNextMap: 0x%x\n", MapDef.ppNextMap )); 528 519 529 520 … … 765 756 * @returns 0 on success. 766 757 * errorcodes on failure. (-1 >= rc >= -14) 767 * @param hKrnl 768 * @param 769 * @equiv 770 * @time 771 * @sketch 772 * @status 758 * @param hKrnl Handle to the kernel file. 759 * @param cbKrnl Size of the kernel file. 773 760 * @author knut st. osmundsen 774 * @remark775 761 */ 776 762 static int ReadOS2Krnl2(HFILE hKrnl, unsigned long cbKrnl) … … 784 770 785 771 /* find bldlevel string - "@#IBM:14.020#@ IBM OS/2 Kernel - 14.020F" */ 786 cbKrnl = fsize(hKrnl);787 772 if (fseek(hKrnl, 0, SEEK_SET)) 788 773 return -2;
Note:
See TracChangeset
for help on using the changeset viewer.
