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.

119 lines
2.4 KiB

  1. /**********************************************************************/
  2. /** Microsoft Windows NT **/
  3. /** Copyright(c) Microsoft Corp., 1992 **/
  4. /**********************************************************************/
  5. /*
  6. *
  7. *
  8. *
  9. *
  10. * History
  11. * jonn 01/17/92 Created
  12. * thomaspa 02/22/92 Split int hxx/cxx
  13. * thomaspa 03/03/92 Split off from NTSAM.HXX
  14. * thomaspa 03/30/92 Code review changes
  15. */
  16. #ifndef _UINTMEM_HXX_
  17. #define _UINTMEM_HXX_
  18. #include "uiassert.hxx"
  19. /**********************************************************\
  20. NAME: ::FillUnicodeString
  21. SYNOPSIS: Standalone method for filling in a UNICODE_STRING struct using
  22. an NLS_STR
  23. \**********************************************************/
  24. APIERR FillUnicodeString( UNICODE_STRING * punistr, const NLS_STR & pnls );
  25. /**********************************************************\
  26. NAME: ::FreeUnicodeString
  27. SYNOPSIS: Standalone method for freeing the memory allocated
  28. by FillUnicodeString.
  29. \**********************************************************/
  30. VOID FreeUnicodeString( UNICODE_STRING * puinistr );
  31. /**********************************************************\
  32. NAME: NT_MEMORY
  33. SYNOPSIS: Specialized buffer object for storing data returned
  34. from SAM and LSA APIs.
  35. INTERFACE: NT_MEMORY(): constructor
  36. ~NT_MEMORY(): destructor
  37. QueryBuffer(): query data buffer
  38. QueryCount(): Query number of items
  39. Set(): Replace data buffer and item count
  40. NOTES:
  41. PARENT: BASE
  42. HISTORY:
  43. jonn 01/17/92 Created
  44. \**********************************************************/
  45. DLL_CLASS NT_MEMORY : public BASE
  46. {
  47. private:
  48. VOID * _pvBuffer;
  49. ULONG _cItems;
  50. protected:
  51. NT_MEMORY();
  52. ~NT_MEMORY();
  53. /*
  54. * Check if requested item is in the buffer
  55. */
  56. inline BOOL IsInRange( ULONG i ) const { return ( i < _cItems ); }
  57. /*
  58. * Get the buffer pointer
  59. */
  60. inline VOID * QueryBuffer() const
  61. {
  62. return _pvBuffer;
  63. }
  64. public:
  65. /*
  66. * Set the buffer pointer and count
  67. */
  68. inline virtual VOID Set( VOID * pvBuffer, ULONG cItems = 0L )
  69. {
  70. ASSERT( !(cItems == 0 && pvBuffer != NULL)
  71. || !(pvBuffer == NULL && cItems != 0) );
  72. _pvBuffer = pvBuffer;
  73. _cItems = cItems;
  74. }
  75. /*
  76. * return the count of items in the buffer
  77. */
  78. inline ULONG QueryCount() const { return _cItems; }
  79. } ;
  80. #endif // _UINTMEM_HXX_