aboutsummaryrefslogtreecommitdiff
path: root/src/test/WixToolsetTest.MbaHost/EngineForTest.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/WixToolsetTest.MbaHost/EngineForTest.h')
-rw-r--r--src/test/WixToolsetTest.MbaHost/EngineForTest.h63
1 files changed, 63 insertions, 0 deletions
diff --git a/src/test/WixToolsetTest.MbaHost/EngineForTest.h b/src/test/WixToolsetTest.MbaHost/EngineForTest.h
new file mode 100644
index 00000000..6058e67c
--- /dev/null
+++ b/src/test/WixToolsetTest.MbaHost/EngineForTest.h
@@ -0,0 +1,63 @@
1#pragma once
2// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information.
3
4HRESULT WINAPI EngineForTestProc(
5 __in BOOTSTRAPPER_ENGINE_MESSAGE message,
6 __in const LPVOID pvArgs,
7 __inout LPVOID pvResults,
8 __in_opt LPVOID pvContext
9);
10
11typedef void(WINAPI *PFN_TEST_LOG_PROC)(
12 __in LPCWSTR sczMessage
13 );
14
15struct BOOTSTRAPPER_ENGINE_CONTEXT
16{
17 PFN_TEST_LOG_PROC pfnLog;
18};
19
20namespace WixToolsetTest
21{
22namespace MbaHost
23{
24namespace Native
25{
26 using namespace System;
27 using namespace System::Collections::Generic;
28 using namespace System::Runtime::InteropServices;
29
30 public ref class EngineForTest
31 {
32 private:
33 delegate void LogDelegate(LPCWSTR);
34 LogDelegate^ _logDelegate;
35 List<String^>^ _messages;
36
37 void Log(LPCWSTR sczMessage)
38 {
39 String^ message = gcnew String(sczMessage);
40 System::Diagnostics::Debug::WriteLine(message);
41 _messages->Add(message);
42 }
43 public:
44 EngineForTest()
45 {
46 _logDelegate = gcnew LogDelegate(this, &EngineForTest::Log);
47 _messages = gcnew List<String^>();
48 }
49
50 List<String^>^ GetLogMessages()
51 {
52 return _messages;
53 }
54
55 PFN_TEST_LOG_PROC GetTestLogProc()
56 {
57 IntPtr functionPointer = Marshal::GetFunctionPointerForDelegate(_logDelegate);
58 return static_cast<PFN_TEST_LOG_PROC>(functionPointer.ToPointer());
59 }
60 };
61}
62}
63} \ No newline at end of file