- Timestamp:
- Aug 22, 2016 9:01:51 PM (8 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/k/kLdrFmts/pe.h
r31 r82 375 375 { 376 376 KU16 Hint; 377 KU8 Name[1];377 KU8 Name[1]; 378 378 } IMAGE_IMPORT_BY_NAME; 379 379 typedef IMAGE_IMPORT_BY_NAME *PIMAGE_IMPORT_BY_NAME; -
trunk/kHlp/Bare/kHlpBareAssert.c
r29 r82 82 82 cbWritten = pszNl - pszMsg; 83 83 84 # if K_OS == K_OS_OS284 # if K_OS == K_OS_OS2 85 85 if (cbWritten) 86 86 DosWrite((HFILE)2, pszMsg, cbWritten, &cbWritten); 87 87 DosWrite((HFILE)2, "\r\n", 2, &cbWritten); 88 # else /* K_OS == K_OS_WINDOWS */88 # else /* K_OS == K_OS_WINDOWS */ 89 89 if (cbWritten) 90 90 WriteFile((HANDLE)STD_ERROR_HANDLE, pszMsg, cbWritten, &cbWritten, NULL); 91 91 WriteFile((HANDLE)STD_ERROR_HANDLE, "\r\n", 2, &cbWritten, NULL); 92 # endif92 # endif 93 93 94 94 /* next */ … … 103 103 { 104 104 cbWritten = kHlpStrLen(pszMsg); 105 # if K_OS == K_OS_OS2105 # if K_OS == K_OS_OS2 106 106 DosWrite((HFILE)2, pszMsg, cbWritten, &cbWritten); 107 # else /* K_OS == K_OS_WINDOWS */107 # else /* K_OS == K_OS_WINDOWS */ 108 108 WriteFile((HANDLE)STD_ERROR_HANDLE, pszMsg, cbWritten, &cbWritten, NULL); 109 # endif109 # endif 110 110 } 111 111 -
trunk/kLdr/kLdrModNative.c
r81 r82 239 239 { 240 240 KSIZE cb; 241 K SIZEcchFilename;241 KU32 cchFilename; 242 242 KU32 cSegments; 243 243 PKLDRMOD pMod; … … 309 309 * Calc the instance size, allocate and initialize it. 310 310 */ 311 cchFilename = kHlpStrLen(szFilename);311 cchFilename = (KU32)kHlpStrLen(szFilename); 312 312 cb = K_ALIGN_Z(sizeof(KLDRMODNATIVE), 16) 313 313 + K_OFFSETOF(KLDRMOD, aSegments[cSegments]) … … 327 327 kHlpMemCopy((char *)pMod->pszFilename, szFilename, cchFilename + 1); 328 328 pMod->pszName = kHlpGetFilename(pMod->pszFilename); /** @todo get soname */ 329 pMod->cchName = cchFilename - ( pMod->pszName - pMod->pszFilename);329 pMod->cchName = cchFilename - (KU32)(pMod->pszName - pMod->pszFilename); 330 330 pMod->fFlags = 0; 331 331 #if defined(__i386__) || defined(__X86__) || defined(_M_IX86) … … 398 398 else 399 399 pMod->aSegments[0].cbMapped = pNtHdrs->OptionalHeader.SizeOfHeaders; 400 pMod->aSegments[0].MapAddress = 0;400 pMod->aSegments[0].MapAddress = uHandle; 401 401 402 402 /* The section headers. */ … … 404 404 { 405 405 const char *pch; 406 KU32 cchSegName; 406 407 407 408 /* unused */ 408 409 pMod->aSegments[i + 1].pvUser = NULL; 409 pMod->aSegments[i + 1].MapAddress = 0;410 410 411 411 /* name */ 412 412 pMod->aSegments[i + 1].pchName = pch = &paShdrs[i].Name[0]; 413 c b= IMAGE_SIZEOF_SHORT_NAME;414 while ( cb> 0415 && (pch[cb - 1] == ' ' || pch[cb- 1] == '\0'))416 c b--;417 pMod->aSegments[i + 1].cchName = c b;413 cchSegName = IMAGE_SIZEOF_SHORT_NAME; 414 while ( cchSegName > 0 415 && (pch[cchSegName - 1] == ' ' || pch[cchSegName - 1] == '\0')) 416 cchSegName--; 417 pMod->aSegments[i + 1].cchName = cchSegName; 418 418 419 419 /* size and addresses */ … … 421 421 { 422 422 pMod->aSegments[i + 1].cb = paShdrs[i].Misc.VirtualSize; 423 pMod->aSegments[i + 1].LinkAddress = paShdrs[i].VirtualAddress424 + pNtHdrs->OptionalHeader.ImageBase;425 423 pMod->aSegments[i + 1].RVA = paShdrs[i].VirtualAddress; 424 pMod->aSegments[i + 1].LinkAddress = paShdrs[i].VirtualAddress + pNtHdrs->OptionalHeader.ImageBase; 425 pMod->aSegments[i + 1].MapAddress = paShdrs[i].VirtualAddress + uHandle; 426 426 pMod->aSegments[i + 1].cbMapped = paShdrs[i].Misc.VirtualSize; 427 427 if (i + 2 < pMod->cSegments) 428 pMod->aSegments[i + 1].cbMapped = paShdrs[i + 1].VirtualAddress429 - paShdrs[i].VirtualAddress;428 pMod->aSegments[i + 1].cbMapped = paShdrs[i + 1].VirtualAddress 429 - paShdrs[i].VirtualAddress; 430 430 } 431 431 else … … 435 435 pMod->aSegments[i + 1].LinkAddress = NIL_KLDRADDR; 436 436 pMod->aSegments[i + 1].RVA = 0; 437 pMod->aSegments[i + 1].MapAddress = 0; 437 438 } 438 439 439 440 /* file location */ 440 441 pMod->aSegments[i + 1].offFile = paShdrs[i].PointerToRawData; 441 pMod->aSegments[i + 1].cbFile = paShdrs[i].SizeOfRawData;442 pMod->aSegments[i + 1].cbFile = paShdrs[i].SizeOfRawData; 442 443 if ( pMod->aSegments[i + 1].cbMapped > 0 /* if mapped */ 443 444 && (KLDRSIZE)pMod->aSegments[i + 1].cbFile > pMod->aSegments[i + 1].cbMapped) 444 pMod->aSegments[i + 1].cbFile = pMod->aSegments[i + 1].cbMapped;445 pMod->aSegments[i + 1].cbFile = (KLDRFOFF)pMod->aSegments[i + 1].cbMapped; 445 446 446 447 /* protection */
Note:
See TracChangeset
for help on using the changeset viewer.