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.

96 lines
2.0 KiB

  1. // for some reason the compiler is not setting this #def when compiling this file
  2. #define CPLUSPLUS
  3. #include <stdio.h>
  4. #include <windows.h>
  5. #include <objbase.h>
  6. #include <jetwriter.h>
  7. #include "winsdbg.h"
  8. #include "winswriter.hpp"
  9. //{f08c1483-8407-4a26-8c26-6c267a629741}
  10. static const GUID g_GuidWinsWriter =
  11. { 0xf08c1483, 0x8407, 0x4a26, { 0x8c, 0x26, 0x6c, 0x26, 0x7a, 0x62, 0x97, 0x41 } };
  12. /////////////////////////////////////////////////////////////////
  13. // Implementation of the CWinsVssJetWriter starts here
  14. //
  15. HRESULT CWinsVssJetWriter::Initialize()
  16. {
  17. HRESULT hr = S_OK;
  18. hr = CVssJetWriter::Initialize(
  19. g_GuidWinsWriter,
  20. WINSWRITER_NAME,
  21. TRUE,
  22. FALSE,
  23. L"",
  24. L"");
  25. return hr;
  26. }
  27. HRESULT CWinsVssJetWriter::Terminate()
  28. {
  29. CVssJetWriter::Uninitialize();
  30. return S_OK;
  31. }
  32. //
  33. // Implementation of the CWinsVssJetWriter ends here
  34. /////////////////////////////////////////////////////////////////
  35. // writer instance
  36. static CWinsVssJetWriter g_WinsWriter;
  37. extern "C" DWORD _cdecl WinsWriterInit()
  38. {
  39. HRESULT hr = S_OK;
  40. DBGENTER("WinsWriterInit\n");
  41. hr = CoInitializeEx(NULL, COINIT_MULTITHREADED);
  42. if (FAILED(hr))
  43. {
  44. DBGPRINT1(ERR,"CoInitializeEx failed with hr=%x.\n", hr);
  45. return HRESULT_CODE(hr);
  46. }
  47. hr = CoInitializeSecurity(
  48. NULL,
  49. -1,
  50. NULL,
  51. NULL,
  52. RPC_C_AUTHN_LEVEL_CONNECT,
  53. RPC_C_IMP_LEVEL_IDENTIFY,
  54. NULL,
  55. EOAC_NONE,
  56. NULL);
  57. if (FAILED(hr))
  58. {
  59. DBGPRINT1(ERR,"CoInitializeSecurity failed with hr=%x.\n", hr);
  60. return HRESULT_CODE(hr);
  61. }
  62. hr = g_WinsWriter.Initialize();
  63. DBGPRINT1(FLOW,"Vss writer Initialize: code hr=0x%08x\n", hr);
  64. DBGLEAVE("WinsWriterInit\n");
  65. return HRESULT_CODE(hr);
  66. }
  67. extern "C" DWORD _cdecl WinsWriterTerm()
  68. {
  69. DBGENTER("WinsWriterTerm\n");
  70. g_WinsWriter.Terminate();
  71. CoUninitialize();
  72. DBGLEAVE("WinsWriterTerm\n");
  73. return ERROR_SUCCESS;
  74. }