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.

120 lines
2.7 KiB

  1. /*++
  2. Copyright (c) Microsoft Corporation
  3. Module Name:
  4. strsectgen.cpp
  5. Abstract:
  6. C-ish wrapper around CSSGenCtx object used to generate a string section.
  7. Author:
  8. Michael J. Grier (MGrier) 23-Feb-2000
  9. Revision History:
  10. --*/
  11. #include "stdinc.h"
  12. #include <windows.h>
  13. #include "sxsp.h"
  14. #include "ssgenctx.h"
  15. BOOL
  16. SxsInitStringSectionGenerationContext(
  17. OUT PSTRING_SECTION_GENERATION_CONTEXT *SSGenContext,
  18. IN ULONG DataFormatVersion,
  19. IN BOOL CaseInSensitive,
  20. IN STRING_SECTION_GENERATION_CONTEXT_CALLBACK_FUNCTION CallbackFunction,
  21. IN LPVOID Context
  22. )
  23. {
  24. return CSSGenCtx::Create(
  25. SSGenContext,
  26. DataFormatVersion,
  27. CaseInSensitive,
  28. CallbackFunction,
  29. Context);
  30. }
  31. PVOID
  32. WINAPI
  33. SxsGetStringSectionGenerationContextCallbackContext(
  34. IN PSTRING_SECTION_GENERATION_CONTEXT SSGenContext
  35. )
  36. {
  37. return reinterpret_cast<CSSGenCtx *>(SSGenContext)->GetCallbackContext();
  38. }
  39. VOID
  40. WINAPI
  41. SxsDestroyStringSectionGenerationContext(
  42. IN PSTRING_SECTION_GENERATION_CONTEXT SSGenContext
  43. )
  44. {
  45. if (SSGenContext != NULL)
  46. {
  47. reinterpret_cast<CSSGenCtx *>(SSGenContext)->DeleteYourself();
  48. }
  49. }
  50. BOOL
  51. WINAPI
  52. SxsAddStringToStringSectionGenerationContext(
  53. IN PSTRING_SECTION_GENERATION_CONTEXT SSGenContext,
  54. IN PCWSTR String,
  55. IN SIZE_T StringCch,
  56. IN PVOID DataContext,
  57. IN ULONG AssemblyRosterIndex,
  58. IN DWORD DuplicateErrorCode
  59. )
  60. {
  61. return reinterpret_cast<CSSGenCtx *>(SSGenContext)->Add(String, StringCch, DataContext, AssemblyRosterIndex, DuplicateErrorCode);
  62. }
  63. BOOL
  64. WINAPI
  65. SxsFindStringInStringSectionGenerationContext(
  66. IN PSTRING_SECTION_GENERATION_CONTEXT SSGenContext,
  67. IN PCWSTR String,
  68. IN SIZE_T Cch,
  69. OUT PVOID *DataContext,
  70. OUT BOOL *Found
  71. )
  72. {
  73. return reinterpret_cast<CSSGenCtx *>(SSGenContext)->Find(String, Cch, DataContext, Found);
  74. }
  75. BOOL
  76. WINAPI
  77. SxsDoneModifyingStringSectionGenerationContext(
  78. IN PSTRING_SECTION_GENERATION_CONTEXT SSGenContext
  79. )
  80. {
  81. return reinterpret_cast<CSSGenCtx *>(SSGenContext)->DoneAdding();
  82. }
  83. BOOL
  84. WINAPI
  85. SxsGetStringSectionGenerationContextSectionSize(
  86. IN PSTRING_SECTION_GENERATION_CONTEXT SSGenContext,
  87. OUT PSIZE_T DataSize
  88. )
  89. {
  90. return reinterpret_cast<CSSGenCtx *>(SSGenContext)->GetSectionSize(DataSize);
  91. }
  92. BOOL
  93. WINAPI
  94. SxsGetStringSectionGenerationContextSectionData(
  95. IN PSTRING_SECTION_GENERATION_CONTEXT SSGenContext,
  96. IN SIZE_T BufferSize,
  97. IN PVOID Buffer,
  98. OUT PSIZE_T BytesWritten OPTIONAL
  99. )
  100. {
  101. return reinterpret_cast<CSSGenCtx *>(SSGenContext)->GetSectionData(BufferSize, Buffer, BytesWritten);
  102. }