Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

821 lines
22 KiB

  1. #ifndef _WIN32_WINNT
  2. #define _WIN32_WINNT 0x0400
  3. #endif
  4. #ifndef WIN32
  5. #define WIN32 0x0400
  6. #endif
  7. #pragma warning( disable: 4001 4035 4115 4200 4201 4204 4209 4214 4514 4699 )
  8. #include <windows.h>
  9. #pragma warning( disable: 4001 4035 4115 4200 4201 4204 4209 4214 4514 4699 )
  10. #include <stdlib.h>
  11. #include <stdio.h>
  12. #include "patchapi.h"
  13. #ifdef TRACING
  14. #define FILESIZE (3000000)
  15. long g_OldFilePosition;
  16. unsigned long g_cLiterals = 0;
  17. unsigned long g_cMatches = 0;
  18. unsigned long g_cMatchBytes = 0;
  19. #if 0 /* distance.xls */
  20. unsigned long cDistances[6000000] = { 0 };
  21. #endif
  22. #ifdef COMPOSITION /* composition.xls */
  23. #define BUCKET_SIZE (4096)
  24. #define NBUCKETS (FILESIZE / BUCKET_SIZE)
  25. enum { LITERAL, MATCH_OLD, MATCH_NEW, BUCKET_TYPES };
  26. unsigned long cBuckets[NBUCKETS][BUCKET_TYPES] = { { 0,0,0 } };
  27. #endif
  28. #if 0 /* rifts */
  29. #define NO_DISPLACEMENT (333333333)
  30. long iDisplacement[FILESIZE];
  31. #endif
  32. #if 0 /* slots */
  33. #define MAX_SLOTS 500
  34. unsigned long cSlotUsed[MAX_SLOTS];
  35. #endif
  36. typedef struct
  37. {
  38. unsigned long ulRegionOffset;
  39. unsigned long ulRegionSize;
  40. unsigned long ulRegionAddress;
  41. } FILE_REGION;
  42. #define MAX_REGIONS 50
  43. int cRegionsOld = 0;
  44. FILE_REGION RegionsOld[MAX_REGIONS];
  45. int cRegionsNew = 0;
  46. FILE_REGION RegionsNew[MAX_REGIONS];
  47. typedef struct
  48. {
  49. unsigned long ulNewOffset;
  50. unsigned long ulOldOffset;
  51. unsigned long ulMatchLength;
  52. } MATCH_LOG_ENTRY;
  53. #define MAX_MATCH_LOG_ENTRIES (500000)
  54. int cMatchLogEntries = 0;
  55. MATCH_LOG_ENTRY MatchLog[MAX_MATCH_LOG_ENTRIES];
  56. typedef struct _a_POINTER_REMAP
  57. {
  58. struct _a_POINTER_REMAP *pNext;
  59. unsigned long ulNewPointer;
  60. unsigned long ulOldPointer;
  61. unsigned long ulLength;
  62. } POINTER_REMAP;
  63. POINTER_REMAP *pPointerRemapList;
  64. #ifdef RIFTGEN
  65. static char isRelocEntry[FILESIZE] = { '\0' };
  66. #ifdef RIFTGEN2 /* references */
  67. typedef struct _a_reference
  68. {
  69. struct _a_reference *pNext;
  70. long iDisplacement;
  71. } REFERENCE;
  72. static REFERENCE *pReferences[FILESIZE] = { NULL };
  73. #endif
  74. #endif
  75. static int QueryRelocsInRange(unsigned long ulAddress, unsigned long ulLength)
  76. {
  77. int iRegion;
  78. unsigned long ulFileOffset;
  79. int fRelocsFound = FALSE;
  80. for (iRegion = 0; iRegion < cRegionsOld; iRegion++)
  81. {
  82. if ((ulAddress >= RegionsOld[iRegion].ulRegionAddress) &&
  83. (ulAddress < (RegionsOld[iRegion].ulRegionAddress + RegionsOld[iRegion].ulRegionSize)))
  84. {
  85. break;
  86. }
  87. }
  88. if (iRegion != cRegionsOld)
  89. {
  90. ulFileOffset = RegionsOld[iRegion].ulRegionOffset + (ulAddress - RegionsOld[iRegion].ulRegionAddress);
  91. while (ulLength--)
  92. {
  93. if (isRelocEntry[ulFileOffset])
  94. {
  95. fRelocsFound = TRUE;
  96. break;
  97. }
  98. ulFileOffset++;
  99. ulAddress++;
  100. }
  101. }
  102. return(fRelocsFound);
  103. }
  104. static void DisplayMatchLog(void)
  105. {
  106. int iMatchLogEntry;
  107. unsigned long ulNewOffset;
  108. unsigned long ulOldOffset;
  109. int iNewFileRegion;
  110. int iOldFileRegion;
  111. unsigned long ulMatchLength;
  112. unsigned long ulLocalLength;
  113. unsigned long ulNewDisplacement;
  114. unsigned long ulOldDisplacement;
  115. POINTER_REMAP *pRemap;
  116. POINTER_REMAP **ppBacklink;
  117. unsigned long ulNewPointer;
  118. unsigned long ulOldPointer;
  119. long lLastDisplacement;
  120. if (cMatchLogEntries == 0)
  121. {
  122. return;
  123. }
  124. pPointerRemapList = NULL;
  125. for (iMatchLogEntry = 0; iMatchLogEntry < cMatchLogEntries; iMatchLogEntry++)
  126. {
  127. ulNewOffset = MatchLog[iMatchLogEntry].ulNewOffset;
  128. ulOldOffset = MatchLog[iMatchLogEntry].ulOldOffset;
  129. ulMatchLength = MatchLog[iMatchLogEntry].ulMatchLength;
  130. while (ulMatchLength) /* until all is done */
  131. {
  132. ulLocalLength = ulMatchLength; /* might get clipped */
  133. /* locate corresponding new file region to get it's address */
  134. for (iNewFileRegion = 0; iNewFileRegion < cRegionsNew; iNewFileRegion++)
  135. {
  136. if ((ulNewOffset >= RegionsNew[iNewFileRegion].ulRegionOffset) &&
  137. (ulNewOffset < (RegionsNew[iNewFileRegion].ulRegionOffset + RegionsNew[iNewFileRegion].ulRegionSize)))
  138. {
  139. break;
  140. }
  141. }
  142. if (iNewFileRegion == cRegionsNew)
  143. {
  144. goto dontcare;
  145. }
  146. /* clip if match spans beyond this region */
  147. ulNewDisplacement = ulNewOffset - RegionsNew[iNewFileRegion].ulRegionOffset;
  148. ulNewPointer = RegionsNew[iNewFileRegion].ulRegionAddress + ulNewDisplacement;
  149. if (ulLocalLength > (RegionsNew[iNewFileRegion].ulRegionSize - ulNewDisplacement))
  150. {
  151. ulLocalLength = (RegionsNew[iNewFileRegion].ulRegionSize - ulNewDisplacement);
  152. }
  153. /* locate corresponding old file region to get it's address */
  154. for (iOldFileRegion = 0; iOldFileRegion < cRegionsOld; iOldFileRegion++)
  155. {
  156. if ((ulOldOffset >= RegionsOld[iOldFileRegion].ulRegionOffset) &&
  157. (ulOldOffset < (RegionsOld[iOldFileRegion].ulRegionOffset + RegionsOld[iOldFileRegion].ulRegionSize)))
  158. {
  159. break;
  160. }
  161. }
  162. if (iOldFileRegion == cRegionsOld)
  163. {
  164. goto dontcare;
  165. }
  166. /* clip if match spans beyond this region */
  167. ulOldDisplacement = ulOldOffset - RegionsOld[iOldFileRegion].ulRegionOffset;
  168. ulOldPointer = RegionsOld[iOldFileRegion].ulRegionAddress + ulOldDisplacement;
  169. if (ulLocalLength > (RegionsOld[iOldFileRegion].ulRegionSize - ulOldDisplacement))
  170. {
  171. ulLocalLength = (RegionsOld[iOldFileRegion].ulRegionSize - ulOldDisplacement);
  172. }
  173. /* see if any relocs in the range */
  174. if (QueryRelocsInRange(ulOldPointer, ulLocalLength))
  175. {
  176. /* sorted insertion of this new remap into the list */
  177. ppBacklink = &pPointerRemapList;
  178. while (*ppBacklink != NULL)
  179. {
  180. if ((*ppBacklink)->ulOldPointer > ulOldPointer)
  181. {
  182. break;
  183. }
  184. ppBacklink = &((*ppBacklink)->pNext);
  185. }
  186. pRemap = GlobalAlloc( GMEM_FIXED, sizeof(POINTER_REMAP) );
  187. pRemap->ulNewPointer = ulNewPointer;
  188. pRemap->ulOldPointer = ulOldPointer;
  189. pRemap->ulLength = ulLocalLength;
  190. pRemap->pNext = *ppBacklink;
  191. *ppBacklink = pRemap;
  192. }
  193. /* move on to next match or fragment */
  194. ulNewOffset += ulLocalLength;
  195. ulOldOffset += ulLocalLength;
  196. ulMatchLength -= ulLocalLength;
  197. }
  198. dontcare:
  199. NULL; // entertain compiler req: label must have a statement
  200. }
  201. printf("%08X\n", RegionsOld[ 0 ].ulRegionAddress);
  202. lLastDisplacement = 0;
  203. for (pRemap = pPointerRemapList; pRemap != NULL; pRemap = pRemap->pNext)
  204. {
  205. if (lLastDisplacement != (long) (pRemap->ulNewPointer - pRemap->ulOldPointer))
  206. {
  207. lLastDisplacement = pRemap->ulNewPointer - pRemap->ulOldPointer;
  208. printf("%08X %08X\n", pRemap->ulOldPointer, pRemap->ulNewPointer);
  209. }
  210. }
  211. }
  212. #endif
  213. void CopyRight( void ) {
  214. MessageBox(
  215. NULL,
  216. "\n"
  217. "APATCH 0.15 Patch Application Utility\n"
  218. "Copyright (C) Microsoft, 1997\n"
  219. "\n",
  220. "APATCH Copyright",
  221. MB_OK);
  222. }
  223. void Usage( void ) {
  224. MessageBox(NULL,
  225. "Usage: APATCH PatchFile OldFile TargetNewFile\n\n",
  226. "APATCH Usage",
  227. MB_OK);
  228. }
  229. BOOL
  230. CALLBACK
  231. MyProgressCallback(
  232. PVOID CallbackContext,
  233. ULONG CurrentPosition,
  234. ULONG MaximumPosition
  235. )
  236. {
  237. UNREFERENCED_PARAMETER( CallbackContext );
  238. if ( CurrentPosition & 0xFF000000 ) {
  239. CurrentPosition >>= 8;
  240. MaximumPosition >>= 8;
  241. }
  242. if ( MaximumPosition != 0 ) {
  243. // guigauge: printf( "\r%3d%% complete", ( CurrentPosition * 100 ) / MaximumPosition );
  244. }
  245. return TRUE;
  246. }
  247. int StrChr( char *psz, char c )
  248. {
  249. while (*psz)
  250. {
  251. if (*psz++ == c)
  252. {
  253. return(TRUE);
  254. }
  255. }
  256. return(FALSE);
  257. }
  258. int __cdecl main( int argc, char *argv[] ) {
  259. LPSTR OldFileName = NULL;
  260. LPSTR PatchFileName = NULL;
  261. LPSTR NewFileName = NULL;
  262. BOOL Success;
  263. LPSTR arg;
  264. int i;
  265. SetErrorMode( SEM_FAILCRITICALERRORS );
  266. #ifndef DEBUG
  267. SetErrorMode( SEM_NOALIGNMENTFAULTEXCEPT | SEM_FAILCRITICALERRORS );
  268. #endif
  269. // CopyRight();
  270. for ( i = 1; i < argc; i++ ) {
  271. arg = argv[ i ];
  272. if ( StrChr( arg, '?' )) {
  273. Usage();
  274. goto bail;
  275. }
  276. if ( PatchFileName == NULL ) {
  277. PatchFileName = arg;
  278. }
  279. else if ( OldFileName == NULL ) {
  280. OldFileName = arg;
  281. }
  282. else if ( NewFileName == NULL ) {
  283. NewFileName = arg;
  284. }
  285. else {
  286. Usage();
  287. goto bail;
  288. }
  289. }
  290. if (( OldFileName == NULL ) || ( NewFileName == NULL ) || ( PatchFileName == NULL )) {
  291. Usage();
  292. goto bail;
  293. }
  294. DeleteFile( NewFileName );
  295. #ifdef TRACING
  296. #if 0 /* rifts */
  297. {
  298. long filepos;
  299. for (filepos = 0; filepos < FILESIZE; filepos++)
  300. {
  301. iDisplacement[filepos] = NO_DISPLACEMENT;
  302. }
  303. }
  304. #endif
  305. #endif
  306. Success = ApplyPatchToFileEx(
  307. PatchFileName,
  308. OldFileName,
  309. NewFileName,
  310. 0,
  311. MyProgressCallback,
  312. NULL
  313. );
  314. if ( ! Success ) {
  315. CHAR ErrorText[ 16 ];
  316. ULONG ErrorCode = GetLastError();
  317. CHAR Message[100];
  318. wsprintf( ErrorText, ( ErrorCode < 0x10000000 ) ? "%d" : "%X", ErrorCode );
  319. wsprintf( Message, "Failed to create file from patch (%s)\n", ErrorText );
  320. MessageBox( NULL, Message, "APATCH Failed", MB_OK );
  321. return( 1 );
  322. }
  323. #ifdef TRACING
  324. {
  325. #ifdef COMPOSITION /* composition.xls */
  326. {
  327. int iBucket;
  328. for (iBucket = 0; iBucket < NBUCKETS; iBucket++)
  329. {
  330. if ((cBuckets[iBucket][LITERAL] || cBuckets[iBucket][MATCH_OLD] || cBuckets[iBucket][MATCH_NEW]))
  331. {
  332. printf("%9lu %9lu %9lu %9lu\n",
  333. iBucket * BUCKET_SIZE,
  334. cBuckets[iBucket][LITERAL],
  335. cBuckets[iBucket][MATCH_OLD],
  336. cBuckets[iBucket][MATCH_NEW]);
  337. }
  338. }
  339. }
  340. #endif
  341. #if 0
  342. printf("%9lu bytes from literals\n", g_cLiterals);
  343. printf("%9lu bytes from %lu matches\n", g_cMatchBytes, g_cMatches);
  344. printf("%9lu bytes total\n", g_cLiterals + g_cMatchBytes);
  345. #endif
  346. #if 0 /* distance.xls */
  347. {
  348. int iDistance;
  349. for (iDistance = 0; iDistance < (sizeof(cDistances)/sizeof(cDistances[0])); iDistance++)
  350. {
  351. if (cDistances[iDistance] != 0)
  352. {
  353. printf("%9ld %9ld\n", iDistance, cDistances[iDistance]);
  354. }
  355. }
  356. }
  357. #endif
  358. #if 0 /* rifts */
  359. {
  360. long filepos;
  361. long iLastDisplacement = NO_DISPLACEMENT;
  362. for (filepos = 0; filepos < FILESIZE; filepos++)
  363. {
  364. if (iDisplacement[filepos] != NO_DISPLACEMENT)
  365. {
  366. if (iLastDisplacement != iDisplacement[filepos])
  367. {
  368. iLastDisplacement = iDisplacement[filepos];
  369. printf("%9lu %9ld\n", filepos, iDisplacement[filepos]);
  370. }
  371. }
  372. }
  373. }
  374. #endif
  375. #if 0 /* slots */
  376. {
  377. int slot;
  378. for (slot = 0; slot < MAX_SLOTS; slot++)
  379. {
  380. if (cSlotUsed[slot])
  381. {
  382. printf("%5d %9ld\n", slot, cSlotUsed[slot]);
  383. }
  384. }
  385. }
  386. #endif
  387. #ifdef RIFTGEN2 /* generating faked references for relrifts file */
  388. {
  389. int index;
  390. REFERENCE *pReference, *pKill;
  391. int iLast = 0;
  392. int cEntries = 0;
  393. int cEntriesHit = 0;
  394. int iBest;
  395. for (index = 0; index < FILESIZE; index++)
  396. {
  397. pReference = pReferences[index];
  398. if (isRelocEntry[index])
  399. {
  400. cEntries++;
  401. }
  402. if (pReference != NULL)
  403. {
  404. if (isRelocEntry[index])
  405. {
  406. cEntriesHit++;
  407. }
  408. if (pReference->pNext != NULL) /* multiple values */
  409. {
  410. /* knowing the number of reloc entries interested could help here */
  411. /* see if the last value is one of the choices */
  412. while (pReference)
  413. {
  414. if (pReference->iDisplacement == iLast)
  415. {
  416. goto found;
  417. }
  418. pReference = pReference->pNext;
  419. }
  420. /* choose the value nearest the last value */
  421. pReference = pReferences[index];
  422. while (pReference != NULL)
  423. {
  424. if (abs(pReference->iDisplacement - iLast) < abs(iBest - iLast))
  425. {
  426. iBest = pReference->iDisplacement;
  427. }
  428. pReference = pReference->pNext;
  429. }
  430. iLast = iBest;
  431. printf("%d %d\n", index, iLast);
  432. found:
  433. /* now free the list */
  434. pReference = pReferences[index];
  435. while (pReference != NULL)
  436. {
  437. pKill = pReference;
  438. pReference = pReference->pNext;
  439. GlobalFree(pKill);
  440. }
  441. }
  442. else
  443. {
  444. if (iLast != pReference->iDisplacement) /* a simple rift */
  445. {
  446. iLast = pReference->iDisplacement;
  447. printf("%d %d\n", index, iLast);
  448. }
  449. GlobalFree(pReference);
  450. }
  451. }
  452. }
  453. //fprintf(stderr, "%d hit of %d total relocation targets\n", cEntriesHit, cEntries);
  454. }
  455. #endif
  456. DisplayMatchLog();
  457. }
  458. #endif
  459. // MessageBox( NULL, "OK\n", "APATCH Done", MB_OK );
  460. bail:
  461. return( 0 );
  462. }
  463. #ifdef TRACING
  464. void TracingSetOldFilePosition(long oldpos)
  465. {
  466. g_OldFilePosition = oldpos;
  467. }
  468. void TracingLiteral(long bufpos, byte c)
  469. {
  470. #ifdef COMPOSITION /* composition.xls */
  471. int iBucket = bufpos / BUCKET_SIZE;
  472. cBuckets[iBucket][LITERAL]++;
  473. #endif
  474. g_cLiterals++;
  475. #ifdef DECO_DETAILS /* trace */
  476. printf("%08lX: %02X\n", bufpos, (byte) c);
  477. #endif
  478. }
  479. void TracingMatch(long bufpos,long srcpos,long window,int length,int slot)
  480. {
  481. static long iLastDisplacement = -1;
  482. g_cMatches++;
  483. g_cMatchBytes += length;
  484. #if 0 /* slots */
  485. if (slot < MAX_SLOTS)
  486. {
  487. cSlotUsed[slot]++;
  488. }
  489. else
  490. {
  491. printf("Slot number out of range (%d)\n", slot);
  492. }
  493. #endif
  494. if (srcpos < g_OldFilePosition)
  495. {
  496. #ifdef COMPOSITION /* composition.xls */
  497. int iBucket = bufpos / BUCKET_SIZE;
  498. int eBucket = (bufpos + length - 1) / BUCKET_SIZE;
  499. if (iBucket == eBucket)
  500. {
  501. cBuckets[iBucket][MATCH_NEW] += length;
  502. }
  503. else
  504. {
  505. long length1 = (eBucket * BUCKET_SIZE) - bufpos;
  506. cBuckets[iBucket][MATCH_NEW] += length1;
  507. cBuckets[eBucket][MATCH_NEW] += (length - length1);
  508. }
  509. #endif
  510. #ifdef DECO_DETAILS /* trace */
  511. {
  512. int iDistance = bufpos - srcpos;
  513. printf("%08lX..%08lX: %08lX..%08lX (%d,%u)\n", /* new file refs no [...] */
  514. bufpos,
  515. bufpos + length - 1,
  516. srcpos,
  517. srcpos + length - 1,
  518. -iDistance,
  519. length);
  520. }
  521. #endif
  522. #if 0
  523. if (iLastDisplacement != (srcpos - bufpos))
  524. {
  525. iLastDisplacement = (srcpos - bufpos);
  526. printf("%9ld %9ld %9ld\n",
  527. bufpos,
  528. srcpos,
  529. srcpos - bufpos);
  530. }
  531. #endif
  532. }
  533. else
  534. {
  535. #ifdef COMPOSITION /* composition.xls */
  536. int iBucket = bufpos / BUCKET_SIZE;
  537. int eBucket = (bufpos + length - 1) / BUCKET_SIZE;
  538. if (iBucket == eBucket)
  539. {
  540. cBuckets[iBucket][MATCH_OLD] += length;
  541. }
  542. else
  543. {
  544. long length1 = (eBucket * BUCKET_SIZE) - bufpos;
  545. cBuckets[iBucket][MATCH_OLD] += length1;
  546. cBuckets[eBucket][MATCH_OLD] += (length - length1);
  547. }
  548. #endif
  549. if ((cMatchLogEntries != 0) &&
  550. ((MatchLog[cMatchLogEntries - 1].ulNewOffset + MatchLog[cMatchLogEntries - 1].ulMatchLength) == (unsigned long) bufpos) &&
  551. ((MatchLog[cMatchLogEntries - 1].ulOldOffset + MatchLog[cMatchLogEntries - 1].ulMatchLength) == (unsigned long) (srcpos - g_OldFilePosition)))
  552. {
  553. MatchLog[cMatchLogEntries - 1].ulMatchLength += length;
  554. }
  555. else if (cMatchLogEntries < MAX_MATCH_LOG_ENTRIES)
  556. {
  557. MatchLog[cMatchLogEntries].ulNewOffset = bufpos;
  558. MatchLog[cMatchLogEntries].ulOldOffset = srcpos - g_OldFilePosition;
  559. MatchLog[cMatchLogEntries].ulMatchLength = length;
  560. cMatchLogEntries++;
  561. }
  562. #ifdef DECO_DETAILS /* trace */
  563. {
  564. int iDistance = bufpos - srcpos + window;
  565. printf("%08lX..%08lX: [%08lX..%08lX] (%d,%u)\n", /* old file refs in [...] */
  566. bufpos,
  567. bufpos + length - 1,
  568. srcpos - g_OldFilePosition,
  569. srcpos - g_OldFilePosition + length - 1,
  570. -iDistance,
  571. length);
  572. }
  573. #endif
  574. #if 0 /* rifts */
  575. {
  576. int index;
  577. for (index = 0; index < length; index++)
  578. {
  579. iDisplacement[bufpos + index] = bufpos - srcpos + g_OldFilePosition;
  580. }
  581. }
  582. #endif
  583. #if 0
  584. if (iLastDisplacement != (bufpos - srcpos + g_OldFilePosition))
  585. {
  586. iLastDisplacement = (bufpos - srcpos + g_OldFilePosition);
  587. printf("%9ld %9ld %9ld\n",
  588. bufpos,
  589. srcpos - g_OldFilePosition,
  590. bufpos - srcpos + g_OldFilePosition);
  591. }
  592. #endif
  593. #ifdef RIFTGEN2 /* references */
  594. {
  595. int index;
  596. REFERENCE *pReference;
  597. long iOldFilePosition;
  598. for (index = 0; index < length; index++)
  599. {
  600. iOldFilePosition = srcpos - g_OldFilePosition + index;
  601. if (isRelocEntry[iOldFilePosition])
  602. {
  603. pReference = GlobalAlloc(GMEM_FIXED, sizeof(REFERENCE));
  604. pReference->pNext = pReferences[iOldFilePosition];
  605. pReferences[iOldFilePosition] = pReference;
  606. pReference->iDisplacement = bufpos - srcpos + g_OldFilePosition;
  607. }
  608. }
  609. }
  610. #endif
  611. }
  612. #if 0 /* distance.xls */
  613. {
  614. int iDistance = bufpos - srcpos + window;
  615. if ((iDistance < 1) || (iDistance >= (sizeof(cDistances)/sizeof(cDistances[0]))))
  616. {
  617. printf("That's a strange distance.\n");
  618. }
  619. else
  620. {
  621. cDistances[iDistance]++;
  622. }
  623. }
  624. #endif
  625. }
  626. #ifdef RIFTGEN
  627. void TracingSetIsRelocEntry(ULONG OldFileOffset, ULONG Va)
  628. {
  629. // printf("offset 0x%08X is Va 0x%08X\n", OldFileOffset, Va);
  630. // ie, "offset 0x00000DF9 is Va 0x703B17F9" when base=0x703B0000
  631. isRelocEntry[OldFileOffset] = '\1';
  632. }
  633. #endif
  634. void TracingReportAddresses(int FileNumber, ULONG FileOffset, ULONG Size, ULONG Address)
  635. {
  636. if ( FileNumber )
  637. {
  638. RegionsNew[cRegionsNew].ulRegionOffset = FileOffset;
  639. RegionsNew[cRegionsNew].ulRegionSize = Size;
  640. RegionsNew[cRegionsNew].ulRegionAddress = Address;
  641. cRegionsNew++;
  642. }
  643. else
  644. {
  645. RegionsOld[cRegionsOld].ulRegionOffset = FileOffset;
  646. RegionsOld[cRegionsOld].ulRegionSize = Size;
  647. RegionsOld[cRegionsOld].ulRegionAddress = Address;
  648. cRegionsOld++;
  649. }
  650. }
  651. #endif