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.

147 lines
4.2 KiB

  1. //========================================================================
  2. // Copyright (C) 1997 Microsoft Corporation
  3. // Author: RameshV
  4. // Description: This file has been generated. Pl look at the .c file
  5. //========================================================================
  6. typedef struct _M_RANGE {
  7. DWORD Start;
  8. DWORD End;
  9. DWORD Mask;
  10. DWORD State;
  11. ULONG BootpAllocated;
  12. ULONG MaxBootpAllowed;
  13. DWORD DirtyOps; // how many unsaved ops done?
  14. M_OPTCLASS Options;
  15. PM_BITMASK BitMask;
  16. // Reservations?
  17. } M_RANGE, *PM_RANGE, *LPM_RANGE;
  18. DWORD _inline
  19. MemRangeInit(
  20. IN OUT PM_RANGE Range,
  21. IN DWORD Start,
  22. IN DWORD End,
  23. IN DWORD Mask,
  24. IN DWORD State,
  25. IN ULONG BootpAllocated,
  26. IN ULONG MaxBootpAllowed
  27. ) {
  28. DWORD Error;
  29. AssertRet(Range, ERROR_INVALID_PARAMETER);
  30. if( Start > End || (Start & Mask) != (End & Mask) )
  31. return ERROR_INVALID_PARAMETER;
  32. Range->Start = Start;
  33. Range->End = End;
  34. Range->Mask = Mask;
  35. Range->State = State;
  36. Range->DirtyOps = 0;
  37. Range->BootpAllocated = BootpAllocated;
  38. Range->MaxBootpAllowed = MaxBootpAllowed;
  39. Error = MemBitInit(&Range->BitMask, End - Start + 1);
  40. if( ERROR_SUCCESS != Error ) return Error;
  41. return MemOptClassInit(&Range->Options);
  42. }
  43. DWORD _inline
  44. MemRangeCleanup(
  45. IN OUT PM_RANGE Range
  46. ) {
  47. DWORD Error;
  48. AssertRet(Range, ERROR_INVALID_PARAMETER);
  49. Error = MemBitCleanup(Range->BitMask);
  50. if( ERROR_SUCCESS != Error ) return Error;
  51. return MemOptClassCleanup(&Range->Options);
  52. }
  53. PM_OPTCLASS _inline
  54. MemRangeGetOptions(
  55. IN PM_RANGE Range
  56. ) {
  57. AssertRet(Range, NULL);
  58. return &Range->Options;
  59. }
  60. enum /* anonymous */ {
  61. X_LESSTHAN_Y,
  62. Y_LESSTHAN_X,
  63. X_IN_Y,
  64. Y_IN_X,
  65. X_LESSTHAN_Y_OVERLAP,
  66. Y_LESSTHAN_X_OVERLAP
  67. };
  68. DWORD _inline
  69. MemRangeCompare(
  70. IN DWORD StartX,
  71. IN DWORD EndX,
  72. IN DWORD StartY,
  73. IN DWORD EndY
  74. ) {
  75. if( EndX < StartY ) return X_LESSTHAN_Y;
  76. if( EndY < StartX ) return Y_LESSTHAN_X;
  77. if( StartX < StartY ) {
  78. if( EndX < EndY ) return X_LESSTHAN_Y_OVERLAP;
  79. return Y_IN_X;
  80. }
  81. if( StartX == StartY ) {
  82. if( EndX <= EndY ) return X_IN_Y;
  83. if( EndY <= EndX ) return Y_IN_X;
  84. }
  85. if( EndX <= EndY ) return X_IN_Y;
  86. return Y_LESSTHAN_X_OVERLAP;
  87. }
  88. DWORD
  89. MemRangeExtendOrContract(
  90. IN OUT PM_RANGE Range,
  91. IN DWORD nAddresses, // to contract by or expand by
  92. IN BOOL fExtend, // is this extend or contract?
  93. IN BOOL fEnd // to expand/contract at End or ar Start?
  94. ) ;
  95. DWORD _inline
  96. MemRangeConvertToClusters(
  97. IN PM_RANGE Range,
  98. OUT LPBYTE *InUseClusters,
  99. OUT DWORD *InUseClustersSize,
  100. OUT LPBYTE *UsedClusters,
  101. OUT DWORD *UsedClustersSize
  102. )
  103. {
  104. AssertRet(Range && InUseClusters && InUseClustersSize, ERROR_INVALID_PARAMETER);
  105. AssertRet(UsedClusters && UsedClustersSize, ERROR_INVALID_PARAMETER);
  106. return MemBitConvertToCluster(
  107. Range->BitMask, Range->Start,
  108. InUseClusters, InUseClustersSize,
  109. UsedClusters, UsedClustersSize
  110. );
  111. }
  112. //================================================================================
  113. // end of file
  114. //================================================================================
  115. //========================================================================
  116. // end of file
  117. //========================================================================