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.

63 lines
1.8 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) { }
  29. ~Entry() { }
  30. BOOL Initialize(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. PVOID m_DataContext;
  34. ULONG m_AssemblyRosterIndex;
  35. };
  36. friend Entry;
  37. class EntryGuidTableHelper : public CGuidPtrTableHelper<Entry>
  38. {
  39. public:
  40. static void FinalizeValue(Entry *&rpEntry);
  41. };
  42. CGuidPtrTable<Entry, EntryGuidTableHelper> m_Table;
  43. static int __cdecl SortGuidSectionEntries(const void *elem1, const void *elem2);
  44. ULONG m_HashTableSize;
  45. ULONG m_DataFormatVersion;
  46. };
  47. #endif