aboutsummaryrefslogtreecommitdiff
path: root/src/ext/Bal/test/examples/TestEngine/TestEngine.h
blob: 248e979aeeb382943145414d2dfa330169fa3fa5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#pragma once
// 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.


enum WM_TESTENG
{
    WM_TESTENG_FIRST = WM_APP + 0xFFF, // this enum value must always be first.

    WM_TESTENG_DETECT,
    WM_TESTENG_PLAN,
    WM_TESTENG_ELEVATE,
    WM_TESTENG_APPLY,
    WM_TESTENG_LAUNCH_APPROVED_EXE,
    WM_TESTENG_QUIT,

    WM_TESTENG_LAST, // this enum value must always be last.
};

class TestEngine
{
public:
    HRESULT Initialize(
        __in LPCWSTR wzBundleFilePath
        );

    HRESULT LoadBA(
        __in LPCWSTR wzBAFilePath
        );

    HRESULT Log(
        __in BOOTSTRAPPER_LOG_LEVEL level,
        __in LPCWSTR wzMessage
        );

    HRESULT RunApplication();

    HRESULT SendShutdownEvent(
        __in BOOTSTRAPPER_SHUTDOWN_ACTION defaultAction
        );

    HRESULT SendStartupEvent();

    HRESULT SimulateQuit(
        __in DWORD dwExitCode
        );

    void UnloadBA(
        __in BOOL fReload
        );

private:
    HRESULT BAEngineLog(
        __in BAENGINE_LOG_ARGS* pArgs,
        __in BAENGINE_LOG_RESULTS* pResults
        );

    HRESULT BAEngineQuit(
        __in BAENGINE_QUIT_ARGS* pArgs,
        __in BAENGINE_QUIT_RESULTS* pResults
        );

    static HRESULT WINAPI EngineProc(
        __in BOOTSTRAPPER_ENGINE_MESSAGE message,
        __in const LPVOID pvArgs,
        __inout LPVOID pvResults,
        __in_opt LPVOID pvContext
        );

    HRESULT ProcessBAMessage(
        __in const MSG* pmsg
        );

public:
    TestEngine();

    ~TestEngine();

private:
    HMODULE m_hBAModule;
    BOOTSTRAPPER_CREATE_RESULTS* m_pCreateResults;
    DWORD m_dwThreadId;
};