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.

94 lines
2.2 KiB

  1. /*
  2. Copyright (c) Microsoft Corporation
  3. */
  4. #include "stdinc.h"
  5. #include <windows.h>
  6. #include "sxsp.h"
  7. #include "gsgenctx.h"
  8. //
  9. // ISSUE: jonwis 3/7/2002 - No parameter checking ANYWHERE??
  10. // ISSUE: jonwis 3/7/2002 - Why the C-style interface to a C++ class? Remove a layer, nuke this and go C++
  11. //
  12. BOOL
  13. SxsInitGuidSectionGenerationContext(
  14. OUT PGUID_SECTION_GENERATION_CONTEXT *GSGenContext,
  15. IN ULONG DataFormatVersion,
  16. IN GUID_SECTION_GENERATION_CONTEXT_CALLBACK_FUNCTION CallbackFunction,
  17. IN LPVOID Context
  18. )
  19. {
  20. return CGSGenCtx::Create(
  21. GSGenContext,
  22. DataFormatVersion,
  23. CallbackFunction,
  24. Context);
  25. }
  26. PVOID
  27. WINAPI
  28. SxsGetGuidSectionGenerationContextCallbackContext(
  29. IN PGUID_SECTION_GENERATION_CONTEXT GSGenContext
  30. )
  31. {
  32. return ((CGSGenCtx *) GSGenContext)->GetCallbackContext();
  33. }
  34. VOID
  35. WINAPI
  36. SxsDestroyGuidSectionGenerationContext(
  37. IN PGUID_SECTION_GENERATION_CONTEXT GSGenContext
  38. )
  39. {
  40. if (GSGenContext != NULL)
  41. {
  42. ((CGSGenCtx *) GSGenContext)->DeleteYourself();
  43. }
  44. }
  45. BOOL
  46. WINAPI
  47. SxsAddGuidToGuidSectionGenerationContext(
  48. IN PGUID_SECTION_GENERATION_CONTEXT GSGenContext,
  49. IN const GUID *Guid,
  50. IN PVOID DataContext,
  51. IN ULONG AssemblyRosterIndex,
  52. IN DWORD DuplicateGuidErrorCode
  53. )
  54. {
  55. return ((CGSGenCtx *) GSGenContext)->Add(*Guid, DataContext, AssemblyRosterIndex, DuplicateGuidErrorCode);
  56. }
  57. BOOL
  58. WINAPI
  59. SxsFindStringInGuidSectionGenerationContext(
  60. IN PGUID_SECTION_GENERATION_CONTEXT GSGenContext,
  61. IN const GUID *Guid,
  62. OUT PVOID *DataContext
  63. )
  64. {
  65. return ((CGSGenCtx *) GSGenContext)->Find(*Guid, DataContext);
  66. }
  67. BOOL
  68. WINAPI
  69. SxsGetGuidSectionGenerationContextSectionSize(
  70. IN PGUID_SECTION_GENERATION_CONTEXT GSGenContext,
  71. OUT PSIZE_T DataSize
  72. )
  73. {
  74. return ((CGSGenCtx *) GSGenContext)->GetSectionSize(DataSize);
  75. }
  76. BOOL
  77. WINAPI
  78. SxsGetGuidSectionGenerationContextSectionData(
  79. IN PGUID_SECTION_GENERATION_CONTEXT GSGenContext,
  80. IN SIZE_T BufferSize,
  81. IN PVOID Buffer,
  82. OUT PSIZE_T BytesWritten OPTIONAL
  83. )
  84. {
  85. return ((CGSGenCtx *) GSGenContext)->GetSectionData(BufferSize, Buffer, BytesWritten);
  86. }