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.

88 lines
2.3 KiB

  1. /*++
  2. Copyright (c) Microsoft Corporation
  3. Module Name:
  4. ssgenctx.h
  5. Abstract:
  6. Class definition for the string section generation context object.
  7. Author:
  8. Michael J. Grier (MGrier) 23-Feb-2000
  9. Revision History:
  10. --*/
  11. #if !defined(_FUSION_SSGENCTX_H_INCLUDED_)
  12. #define _FUSION_SSGENCTX_H_INCLUDED_
  13. #pragma once
  14. class CSSGenCtx
  15. {
  16. public:
  17. static BOOL Create(
  18. PSTRING_SECTION_GENERATION_CONTEXT *SSGenContext,
  19. ULONG DataFormatVersion,
  20. BOOL CaseInSensitive,
  21. STRING_SECTION_GENERATION_CONTEXT_CALLBACK_FUNCTION CallbackFunction,
  22. PVOID CallbackContext
  23. );
  24. BOOL Add(PCWSTR String, SIZE_T Cch, PVOID DataContext, ULONG AssemblyRosterIndex, DWORD DuplicateErrorCode);
  25. BOOL Find(PCWSTR String, SIZE_T Cch, PVOID *DataContext, BOOL *Found);
  26. BOOL DoneAdding();
  27. BOOL GetSectionSize(PSIZE_T SectionSize);
  28. BOOL GetSectionData(SIZE_T BufferSize, PVOID Buffer, SIZE_T *BytesWritten);
  29. PVOID GetCallbackContext() { return m_CallbackContext; }
  30. VOID DeleteYourself() { FUSION_DELETE_SINGLETON(this); }
  31. ~CSSGenCtx();
  32. protected:
  33. CSSGenCtx();
  34. static int __cdecl CompareStringSectionEntries(const void *elem1, const void *elem2);
  35. STRING_SECTION_GENERATION_CONTEXT_CALLBACK_FUNCTION m_CallbackFunction;
  36. PVOID m_CallbackContext;
  37. class Entry
  38. {
  39. public:
  40. Entry() : m_PseudoKey(0), m_DataContext(NULL), m_Next(NULL) { }
  41. ~Entry() { }
  42. BOOL Initialize(PCWSTR String, SIZE_T Cch, ULONG PseudoKey, PVOID DataContext, ULONG AssemblyRosterIndex);
  43. BOOL GetEntryDataSize(CSSGenCtx *pSSGenCtx, SIZE_T &rSize);
  44. BOOL GetEntryData(CSSGenCtx *pSSGenCtx, SIZE_T BufferSize, PVOID Buffer, SIZE_T *BytesWritten);
  45. CStringBuffer m_StringBuffer;
  46. ULONG m_PseudoKey;
  47. ULONG m_HashBucketIndex;
  48. LONG m_EntryOffset;
  49. PVOID m_DataContext;
  50. Entry *m_Next;
  51. ULONG m_AssemblyRosterIndex;
  52. private:
  53. Entry(const Entry &);
  54. void operator =(const Entry &);
  55. };
  56. friend Entry;
  57. ULONG m_EntryCount;
  58. Entry *m_FirstEntry;
  59. Entry *m_LastEntry;
  60. ULONG m_DataFormatVersion;
  61. bool m_CaseInSensitive;
  62. ULONG m_HashTableSize;
  63. bool m_DoneAdding;
  64. };
  65. #endif