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.

60 lines
1.7 KiB

  1. #if !defined(_FUSION_GSGENCTX_H_INCLUDED_)
  2. #define _FUSION_GSGENCTX_H_INCLUDED_
  3. #pragma once
  4. #include "fusionheap.h"
  5. class CGSGenCtx
  6. {
  7. public:
  8. static BOOL Create(
  9. PGUID_SECTION_GENERATION_CONTEXT *GSGenContext,
  10. ULONG DataFormatVersion,
  11. GUID_SECTION_GENERATION_CONTEXT_CALLBACK_FUNCTION CallbackFunction,
  12. PVOID CallbackContext
  13. );
  14. BOOL Add(const GUID &rGuid, PVOID DataContext, ULONG AssemblyRosterIndex, DWORD DuplicateErrorCode);
  15. BOOL Find(const GUID &rGuid, PVOID *DataContext);
  16. BOOL GetSectionSize(PSIZE_T SectionSize);
  17. BOOL GetSectionData(SIZE_T BufferSize, PVOID Buffer, SIZE_T *BytesWritten);
  18. PVOID GetCallbackContext() { return m_CallbackContext; }
  19. VOID DeleteYourself() { FUSION_DELETE_SINGLETON(this); }
  20. ~CGSGenCtx();
  21. protected:
  22. CGSGenCtx();
  23. GUID_SECTION_GENERATION_CONTEXT_CALLBACK_FUNCTION m_CallbackFunction;
  24. PVOID m_CallbackContext;
  25. class Entry
  26. {
  27. public:
  28. Entry() : m_DataContext(NULL), m_Next(NULL) { }
  29. ~Entry() { }
  30. BOOL Initialize(const GUID &Guid, PVOID DataContext, ULONG AssemblyRosterIndex);
  31. BOOL GetEntryDataSize(CGSGenCtx *pSSGenCtx, SIZE_T &rSize);
  32. BOOL GetEntryData(CGSGenCtx *pSSGenCtx, SIZE_T BufferSize, PVOID Buffer, SIZE_T *BytesWritten);
  33. GUID m_Guid;
  34. PVOID m_DataContext;
  35. Entry *m_Next;
  36. ULONG m_AssemblyRosterIndex;
  37. };
  38. friend Entry;
  39. static int __cdecl SortGuidSectionEntries(const void *elem1, const void *elem2);
  40. ULONG m_EntryCount;
  41. ULONG m_HashTableSize;
  42. Entry *m_FirstEntry;
  43. Entry *m_LastEntry;
  44. ULONG m_DataFormatVersion;
  45. };
  46. #endif