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.

161 lines
3.8 KiB

  1. // Copyright (c) Microsoft Corporation
  2. #pragma once
  3. class CUnknown : public IUnknown
  4. {
  5. public:
  6. virtual HRESULT __stdcall QueryInterface(const IID& iid, void** ppv)
  7. {
  8. return E_NOINTERFACE;
  9. }
  10. virtual ULONG __stdcall AddRef()
  11. {
  12. return 1;
  13. }
  14. virtual ULONG __stdcall Release()
  15. {
  16. return 1;
  17. }
  18. };
  19. class CSxsTestGlobals
  20. {
  21. public:
  22. HINSTANCE sxsDll;
  23. USHORT wProcessorArchitecture;
  24. LANGID wLangId;
  25. HANDLE MainThread;
  26. INT NumberOfThreads;
  27. HANDLE Threads[MAXIMUM_WAIT_OBJECTS];
  28. HANDLE ThreadExitEvent;
  29. wchar_t lastOperation[256];
  30. CUnknown unknown;
  31. CSmartRef<IGlobalInterfaceTable> GlobalInterfaceTable;
  32. //
  33. // the start of some automation / record keeping..
  34. //
  35. ULONG Failures;
  36. ULONG Successes;
  37. };
  38. extern CSxsTestGlobals g;
  39. BOOL TestInstallLikeWindowsSetup(PCWSTR szDirectory, PCWSTR szCodebase);
  40. void __cdecl Trace(const char* FormatString, ...);
  41. VOID FusionpSetSystemSetupInProgress(bool f);
  42. BOOLEAN
  43. FusionpStringPrefixI(
  44. PCWSTR str,
  45. PCWSTR prefix
  46. );
  47. BOOLEAN
  48. FusionpProcessArgument(
  49. PCWSTR Arg
  50. );
  51. #if defined(__cplusplus)
  52. extern "C"
  53. #endif
  54. BOOL
  55. WINAPI
  56. SxsDllMain(
  57. HINSTANCE hInst,
  58. DWORD dwReason,
  59. PVOID pvReserved
  60. );
  61. int Main(int argc, wchar_t** argv);
  62. void SetLastOperation(const wchar_t* format, ...);
  63. const wchar_t* GetLastOperation(const wchar_t* format, ...);
  64. template <typename PFN>
  65. inline void GetSxsProc(int name, PFN* ppfn)
  66. {
  67. SetLastOperation(L"GetProcAddress(#%d)", name);
  68. if (!(*ppfn = reinterpret_cast<PFN>(GetProcAddress(g.sxsDll, reinterpret_cast<PCSTR>(IntToPtr(name))))))
  69. {
  70. ThrowLastError();
  71. }
  72. }
  73. template <typename PFN>
  74. inline void GetSxsProc(PCSTR name, PFN* ppfn)
  75. {
  76. SetLastOperation(L"GetProcAddress(%hs)", name);
  77. if (!(*ppfn = reinterpret_cast<PFN>(GetProcAddress(g.sxsDll, name))))
  78. {
  79. ThrowLastError();
  80. }
  81. }
  82. void __stdcall ThrowLastError(DWORD error = ::GetLastError());
  83. extern SXSP_DEBUG_FUNCTION pfnSxspDebug;
  84. #if 0
  85. #elif defined(_AMD64_)
  86. #define SXSP_PROCESSOR_X86_IS_I386_W L"amd64"
  87. #elif defined(_IA64_)
  88. #define SXSP_PROCESSOR_X86_IS_I386_W L"ia64"
  89. #elif defined(_X86_)
  90. #define SXSP_PROCESSOR_X86_IS_I386_W L"i386"
  91. #endif
  92. #if 0
  93. #elif defined(_AMD64_)
  94. #define SXSP_PROCESSOR_I386_IS_X86_W L"amd64"
  95. #elif defined(_IA64_)
  96. #define SXSP_PROCESSOR_I386_IS_X86_W L"ia64"
  97. #elif defined(_X86_)
  98. #define SXSP_PROCESSOR_I386_IS_X86_W L"x86"
  99. #endif
  100. #define SXSP_PROCESSOR_BUILD_OBJ_DIRECTORY_W SXSP_PROCESSOR_X86_IS_I386_W
  101. #define SXSP_PROCESSOR_INSTALL_DIRECTORY_W SXSP_PROCESSOR_X86_IS_I386_W
  102. BOOL
  103. SxspConvertX86ToI386(
  104. CBaseStringBuffer & buffProcessor
  105. );
  106. BOOL
  107. SxspConvertI386ToX86(
  108. CBaseStringBuffer & buffProcessor
  109. );
  110. #define SxspConvertProcessorToProcessorInstallDirectory SxspConvertX86ToI386
  111. #define SxspConvertProcessorToProcessorBuildObjDirectory SxspConvertX86ToI386
  112. extern const UNICODE_STRING x86String;
  113. extern const UNICODE_STRING i386String;
  114. extern const UNICODE_STRING BackslashString;
  115. extern const UNICODE_STRING asms01_dot_cabString;
  116. extern const UNICODE_STRING ProcessorBuildObjString;
  117. extern const UNICODE_STRING ProcessorInstallDirectoryString;
  118. extern const UNICODE_STRING sxs_dot_dll_UnicodeString;
  119. extern const UNICODE_STRING sxs_dot_cap_dot_dll_UnicodeString;
  120. extern const UNICODE_STRING d_UnicodeString;
  121. extern const UNICODE_STRING obj_UnicodeString;
  122. extern const UNICODE_STRING dll_backslash_whistler_UnicodeString;
  123. extern const UNICODE_STRING base_backslash_win32_backslash_fusion_backslash_dll_whistler_UnicodeString;
  124. BOOL
  125. LoadBuiltSxsDll(
  126. VOID
  127. );
  128. BOOL
  129. LoadInstalledSxsDll(
  130. VOID
  131. );
  132. BOOL
  133. UseStaticSxsDll(
  134. VOID
  135. );