diff options
Diffstat (limited to 'src/ext/Bal/test/examples/TestEngine/ExampleTestEngine.cpp')
-rw-r--r-- | src/ext/Bal/test/examples/TestEngine/ExampleTestEngine.cpp | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/src/ext/Bal/test/examples/TestEngine/ExampleTestEngine.cpp b/src/ext/Bal/test/examples/TestEngine/ExampleTestEngine.cpp new file mode 100644 index 00000000..fc1938fe --- /dev/null +++ b/src/ext/Bal/test/examples/TestEngine/ExampleTestEngine.cpp | |||
@@ -0,0 +1,53 @@ | |||
1 | // 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. | ||
2 | |||
3 | #include "precomp.h" | ||
4 | |||
5 | int __cdecl wmain(int argc, LPWSTR argv[]) | ||
6 | { | ||
7 | HRESULT hr = S_OK; | ||
8 | BOOL fComInitialized = FALSE; | ||
9 | BOOL fShowUsage = FALSE; | ||
10 | |||
11 | // initialize COM | ||
12 | hr = ::CoInitializeEx(NULL, COINIT_MULTITHREADED); | ||
13 | ExitOnFailure(hr, "Failed to initialize COM."); | ||
14 | fComInitialized = TRUE; | ||
15 | |||
16 | ConsoleInitialize(); | ||
17 | |||
18 | if (argc != 4) | ||
19 | { | ||
20 | fShowUsage = TRUE; | ||
21 | } | ||
22 | else if (CSTR_EQUAL == ::CompareString(LOCALE_INVARIANT, NORM_IGNORECASE, argv[1], -1, L"reload", -1)) | ||
23 | { | ||
24 | hr = RunReloadEngine(argv[2], argv[3]); | ||
25 | } | ||
26 | else if (CSTR_EQUAL == ::CompareString(LOCALE_INVARIANT, NORM_IGNORECASE, argv[1], -1, L"shutdown", -1)) | ||
27 | { | ||
28 | hr = RunShutdownEngine(argv[2], argv[3]); | ||
29 | } | ||
30 | else if (CSTR_EQUAL == ::CompareString(LOCALE_INVARIANT, NORM_IGNORECASE, argv[1], -1, L"waitforquit", -1)) | ||
31 | { | ||
32 | hr = RunWaitForQuitEngine(argv[2], argv[3]); | ||
33 | } | ||
34 | else | ||
35 | { | ||
36 | fShowUsage = TRUE; | ||
37 | } | ||
38 | |||
39 | if (fShowUsage) | ||
40 | { | ||
41 | ConsoleWriteError(hr = E_INVALIDARG, CONSOLE_COLOR_RED, "Usage: Example.TestEngine.exe {reload|shutdown|waitforquit} Bundle.exe BA.dll"); | ||
42 | } | ||
43 | |||
44 | ConsoleUninitialize(); | ||
45 | |||
46 | LExit: | ||
47 | if (fComInitialized) | ||
48 | { | ||
49 | ::CoUninitialize(); | ||
50 | } | ||
51 | |||
52 | return hr; | ||
53 | } | ||