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.

75 lines
2.7 KiB

  1. /*
  2. - MEM.H
  3. -
  4. * Microsoft At Work Fax Messaging Service Configuration
  5. * Memory allocation header file
  6. *
  7. * Revision History:
  8. *
  9. * When Who What
  10. * -------- ------------------ ---------------------------------------
  11. * 7.20.93 Yoram Yaacovi Created. Code moved here from file.h
  12. */
  13. typedef SCODE (STDAPICALLTYPE *LPALLOCATEBUFFER)(
  14. ULONG cbSize,
  15. LPVOID FAR * lppBuffer
  16. );
  17. typedef SCODE (STDAPICALLTYPE *LPALLOCATEMORE)(
  18. ULONG cbSize,
  19. LPVOID lpObject,
  20. LPVOID FAR * lppBuffer
  21. );
  22. typedef ULONG (STDAPICALLTYPE *LPFREEBUFFER)(
  23. LPVOID lpBuffer
  24. );
  25. // Allocation array constants. Use these constants to define your choice of size
  26. #define NUM_OF_ALLOCATIONS 10 // number of allocation chains
  27. #define NUM_OF_CHUNKS 200 // number of allocations per chain
  28. typedef void *MEMALLOCATIONS[NUM_OF_ALLOCATIONS][NUM_OF_CHUNKS];
  29. // A kind-of memory "support" object. Should maintain the same structure as LPPROPSTORAGE
  30. // (at least the same offsets for the memory allocation routines).
  31. // Used to pass the address of the memory allocation routines to the String... functions in mem.c
  32. typedef struct _PROP_MEM
  33. {
  34. LONG lcInit;
  35. HRESULT hLastError;
  36. LPTSTR szLastError;
  37. /*
  38. * memory routines
  39. */
  40. LPALLOCATEBUFFER lpAllocBuff;
  41. LPALLOCATEMORE lpAllocMore;
  42. LPFREEBUFFER lpFreeBuff;
  43. LPMALLOC lpMalloc;
  44. // Pointer to the storage object
  45. DWORD lpStorage;
  46. // Pointer to the profile section
  47. DWORD lpProfileSection;
  48. } PROPMEM, *LPPROPMEM;
  49. #define CBPROPMEM sizeof(PROPMEM)
  50. // Error Codes returned by the memory allocation functions
  51. #define MAWF_SUCCESS 0L // returned on success
  52. #define MAWF_E_NOT_ENOUGH_MEMORY E_OUTOFMEMORY // returned on unsuccssful allocation
  53. #define MAWF_E_INVALID_ARG E_INVALIDARG // returned on an invalid argument
  54. // including on NULL pointer argument to MAWFFreeBuff
  55. // Memory allocation functions
  56. BOOL InitAllocations(void);
  57. BOOL DestroyAllocations(void);
  58. ALLOCATEBUFFER MAWFAllocBuff;
  59. ALLOCATEMORE MAWFAllocMore;
  60. FREEBUFFER MAWFFreeBuff;
  61. BOOL StringAllocBuff(LPPROPMEM, LPTSTR, LPVOID, LPSTR, HWND);
  62. BOOL StringAllocMore(LPPROPMEM, LPTSTR, LPVOID, LPVOID, LPSTR, HWND);