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.

108 lines
2.5 KiB

  1. #pragma once
  2. //
  3. // Per BryanT, either do not use #import, or checkin what it produces.
  4. //
  5. //#pragma warning(disable:4192) // automatically excluding 'IErrorInfo' while importing type library 'msxml3.dll'
  6. //#import "msxml3.dll"
  7. #include "fusion_msxml3.tlh"
  8. #include "fusioncoinitialize.h"
  9. #include "filestream.h"
  10. #include "fusionbuffer.h"
  11. namespace F
  12. {
  13. template <typename T>
  14. void ThrCreateInstance(T& t, PCWSTR s)
  15. {
  16. FN_PROLOG_VOID_THROW
  17. IFCOMFAILED_EXIT(t.CreateInstance(const_cast<PWSTR>(s)));
  18. FN_EPILOG_THROW;
  19. }
  20. class CXmlWriter
  21. // It'd be nice to have a class that provided the union of all the member functions
  22. // and forwarded it to the appropriate vtable..
  23. {
  24. public:
  25. CXmlWriter()
  26. {
  27. ThrCreateInstance(this->IMXWriter, L"Msxml2.MXXMLWriter.3.0");
  28. this->ISAXContentHandler = this->IMXWriter;
  29. }
  30. void Release()
  31. {
  32. this->IMXWriter.Release();
  33. this->ISAXContentHandler.Release();
  34. }
  35. MSXML2::IMXWriterPtr IMXWriter;
  36. MSXML2::ISAXContentHandlerPtr ISAXContentHandler;
  37. };
  38. class CXmlAttributes
  39. {
  40. public:
  41. CXmlAttributes()
  42. {
  43. ThrCreateInstance(this->IMXAttributes, L"Msxml2.SAXAttributes.3.0");
  44. this->ISAXAttributes = this->IMXAttributes;
  45. }
  46. void Release()
  47. {
  48. this->IMXAttributes.Release();
  49. this->ISAXAttributes.Release();
  50. }
  51. MSXML2::IMXAttributesPtr IMXAttributes;
  52. MSXML2::ISAXAttributesPtr ISAXAttributes;
  53. };
  54. class CRegKey2;
  55. class CRegToXml2
  56. {
  57. public:
  58. void ThrRegToXml();
  59. CRegToXml2(int argc, PWSTR* argv);
  60. void Release()
  61. {
  62. this->Writer.Release();
  63. this->Attributes.Release();
  64. }
  65. int argc;
  66. PWSTR* argv;
  67. protected:
  68. void ThrInit(int argc, PWSTR* argv);
  69. void Usage();
  70. F::CThrCoInitialize Coinit;
  71. CXmlWriter Writer;
  72. CXmlAttributes Attributes;
  73. CFileStream OutFileStream;
  74. F::CStringBuffer ValueDataTextBuffer;
  75. _bstr_t Bstr_name;
  76. _bstr_t Bstr_value;
  77. _bstr_t Bstr_CDATA;
  78. _bstr_t Bstr_data;
  79. _bstr_t Bstr_type;
  80. _bstr_t EmptyBstr;
  81. void ThrDumpKey(ULONG Depth, HKEY Key, PCWSTR Name);
  82. void ThrDumpBuiltinRoot(HKEY PseudoHandle, PCWSTR Name);
  83. void ThrDumpBuiltinRoots();
  84. };
  85. }