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.

57 lines
1.7 KiB

  1. //================================================================================
  2. // Copyright (C) 1997 Microsoft Corporation
  3. // Author: RameshV
  4. // Description: implements the basic structures for options, including class id
  5. // ThreadSafe: no
  6. // Locks: none
  7. // Please read stdinfo.txt for programming style.
  8. //================================================================================
  9. #include <mm.h>
  10. #include <array.h>
  11. #include <opt.h>
  12. #include <optl.h>
  13. #include <optclass.h>
  14. #include <bitmask.h>
  15. #include "range.h"
  16. #include "server\uniqid.h"
  17. //BeginExport(function)
  18. DWORD
  19. MemRangeExtendOrContract(
  20. IN OUT PM_RANGE Range,
  21. IN DWORD nAddresses, // to contract by or expand by
  22. IN BOOL fExtend, // is this extend or contract?
  23. IN BOOL fEnd // to expand/contract at End or ar Start?
  24. ) //EndExport(function)
  25. {
  26. DWORD Error;
  27. AssertRet(Range && nAddresses > 0, ERROR_INVALID_PARAMETER);
  28. Error = MemBitAddOrDelBits(
  29. Range->BitMask,
  30. nAddresses,
  31. fExtend,
  32. fEnd
  33. );
  34. if( ERROR_SUCCESS != Error ) return Error;
  35. if( fExtend ) {
  36. if( fEnd ) Range->End += nAddresses;
  37. else Range->Start -= nAddresses;
  38. } else {
  39. if( fEnd ) Range->End -= nAddresses;
  40. else Range->Start += nAddresses;
  41. }
  42. // Range->UniqId = INVALID_UNIQ_ID;
  43. return ERROR_SUCCESS;
  44. } // MemRangeExtendOrContract()
  45. //================================================================================
  46. // end of file
  47. //================================================================================