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.

88 lines
2.2 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1992 - 1994.
  5. //
  6. // File: mmodel.hxx
  7. //
  8. // Contents: CMemoryModel
  9. //
  10. // History: 29-Sep-94 DrewB Created
  11. //
  12. //----------------------------------------------------------------------------
  13. #ifndef __MMODEL_HXX__
  14. #define __MMODEL_HXX__
  15. //+---------------------------------------------------------------------------
  16. //
  17. // Class: CMemoryModel (mm)
  18. //
  19. // Purpose: Defines an abstract interface to memory allocation
  20. // so that code can be written which uses both 16 and
  21. // 32-bit memory
  22. //
  23. // History: 29-Sep-94 DrewB Created
  24. //
  25. //----------------------------------------------------------------------------
  26. class CMemoryModel
  27. {
  28. public:
  29. virtual DWORD AllocMemory(DWORD cb) = 0;
  30. virtual void FreeMemory(DWORD dwMem) = 0;
  31. virtual LPVOID ResolvePtr(DWORD dwMem, DWORD cb) = 0;
  32. virtual void ReleasePtr(DWORD dwMem) = 0;
  33. };
  34. //+---------------------------------------------------------------------------
  35. //
  36. // Class: CMemoryModel16 (mm16)
  37. //
  38. // Purpose: 16-bit memory model
  39. //
  40. // History: 29-Sep-94 DrewB Created
  41. //
  42. //----------------------------------------------------------------------------
  43. class CMemoryModel16 : public CMemoryModel
  44. {
  45. public:
  46. CMemoryModel16(BOOL fPublic)
  47. {
  48. _fPublic = fPublic;
  49. }
  50. virtual DWORD AllocMemory(DWORD cb);
  51. virtual void FreeMemory(DWORD dwMem);
  52. virtual LPVOID ResolvePtr(DWORD dwMem, DWORD cb);
  53. virtual void ReleasePtr(DWORD dwMem);
  54. private:
  55. BOOL _fPublic;
  56. };
  57. //+---------------------------------------------------------------------------
  58. //
  59. // Class: CMemoryModel32 (mm32)
  60. //
  61. // Purpose: 16-bit memory model
  62. //
  63. // History: 29-Sep-94 DrewB Created
  64. //
  65. //----------------------------------------------------------------------------
  66. class CMemoryModel32 : public CMemoryModel
  67. {
  68. public:
  69. virtual DWORD AllocMemory(DWORD cb);
  70. virtual void FreeMemory(DWORD dwMem);
  71. virtual LPVOID ResolvePtr(DWORD dwMem, DWORD cb);
  72. virtual void ReleasePtr(DWORD dwMem);
  73. };
  74. extern CMemoryModel16 mmodel16Public;
  75. extern CMemoryModel16 mmodel16Owned;
  76. extern CMemoryModel32 mmodel32;
  77. #endif // #ifndef __MMODEL_HXX__