Source code of Windows XP (NT5)
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.

72 lines
1.1 KiB

  1. #include "TsunamiP.Hxx"
  2. #pragma hdrstop
  3. #if DBG
  4. PVOID DbgAllocateHeap
  5. (
  6. IN PCHAR File,
  7. IN int Line,
  8. IN ULONG Flags,
  9. IN ULONG Size
  10. )
  11. {
  12. PVOID pv;
  13. ASSERT( Flags == 0 );
  14. pv= LocalAlloc( LPTR, Size + sizeof( PCHAR ) + sizeof( int ));
  15. if ( pv )
  16. {
  17. *((PCHAR *)pv)=File;
  18. pv= (( PCHAR *)pv)+1;
  19. *((int *)pv)=Line;
  20. pv= (( int *)pv)+1;
  21. }
  22. return( pv );
  23. }
  24. PVOID DbgReAllocateHeap
  25. (
  26. IN PCHAR File,
  27. IN int Line,
  28. IN ULONG Flags,
  29. IN PVOID pvOld,
  30. IN ULONG Size
  31. )
  32. {
  33. PVOID pv;
  34. ASSERT( Flags == 0 );
  35. pvOld = (PVOID)( ((PCHAR)pvOld) - (sizeof( PCHAR ) + sizeof( int )) );
  36. pv=LocalReAlloc( pvOld, Size + sizeof( PCHAR ) + sizeof( int ), 0 );
  37. if ( pv )
  38. {
  39. pv = (PVOID)( ((PCHAR)pv) + sizeof( PCHAR ) + sizeof( int ) );
  40. }
  41. return( pv );
  42. }
  43. BOOL DbgFreeHeap
  44. (
  45. IN PCHAR File,
  46. IN int Line,
  47. IN ULONG Flags,
  48. IN PVOID pvOld
  49. )
  50. {
  51. ASSERT( Flags == 0 );
  52. pvOld = (PVOID)( ((PCHAR)pvOld) - (sizeof( PCHAR ) + sizeof( int )) );
  53. return LocalFree( pvOld ) == NULL;
  54. }
  55. #endif // DBG