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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
|
#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.
#if defined(__cplusplus)
extern "C" {
#endif
struct NetFxDataStructure
{
bool downloadFinished; // download done yet?
bool installFinished; // install done yet?
bool downloadAbort; // set downloader to abort
bool installAbort; // set installer to abort
HRESULT hrDownloadFinished; // resultant HRESULT for download
HRESULT hrInstallFinished; // resultant HRESULT for install
HRESULT hrInternalError;
WCHAR szCurrentItemStep[MAX_PATH];
BYTE downloadSoFar; // download progress 0 - 255 (0 to 100% done)
BYTE installSoFar; // install progress 0 - 255 (0 to 100% done)
WCHAR szEventName[MAX_PATH]; // event that chainer 'creates' and chainee 'opens'to sync communications
BYTE version; // version of the data structure, set by chainer.
DWORD messageCode; // current message being sent by the chainee, 0 if no message is active
DWORD messageResponse; // chainer's response to current message, 0 if not yet handled
DWORD messageDataLength; // length of the m_messageData field in bytes
BYTE messageData[1]; // variable length buffer, content depends on m_messageCode
};
struct NetFxChainer
{
HANDLE hSection;
HANDLE hEventChaineeSend;
HANDLE hEventChainerSend;
HANDLE hMutex;
NetFxDataStructure* pData;
DWORD dwDataSize;
};
#define NETFXDATA_SIZE 65536
#define NETFXDATA_VERSION 1
#define NETFX_MESSAGE(version, defaultResponse, messageCode) \
((((DWORD)version & 0xFF) << 24) | (((DWORD)defaultResponse & 0xFF) << 16) | ((DWORD)messageCode & 0xFFFF))
#define NETFX_MESSAGE_CODE(messageId) \
(messageId & 0xFFFF)
#define NETFX_MESSAGE_DEFAULT_RESPONSE(messageId) \
((messageId >> 16) & 0xFF)
#define NETFX_MESSAGE_VERSION(messageId) \
((messageId >>24) & 0xFF)
#define NETFX_NO_MESSAGE 0
//------------------------------------------------------------------------------
// NETFX_CLOSE_APPS
//
// Sent by the chainee when it detects that applications are holding files in
// use. Respond to this message in order to tell the chainee to close the
// applications to prevent a reboot.
//
// pData : NetFxCloseApplications : The list of applications
// Acceptable responses:
// IDYES : Indicates that the chainee should attempt to shutdown the apps.
// If all apps do not successfully close the message may be sent again.
// IDNO : Indicates that the chainee should not attempt to close apps.
// IDRETRY : Indicates that the chainee should refresh the list of apps.
// Another NETFX_CLOSE_APPS message will be sent asynchronously with
// the new list of apps.
//------------------------------------------------------------------------------
#define NETFX_CLOSE_APPS NETFX_MESSAGE(NETFXDATA_VERSION, IDNO, 1)
struct NetFxApplication
{
WCHAR szName[MAX_PATH];
DWORD dwPid;
};
struct NetFxCloseApplications
{
DWORD dwApplicationsSize;
NetFxApplication applications[1];
};
HRESULT NetFxRunChainer(
__in_z LPCWSTR wzExecutablePath,
__in_z LPWSTR sczBaseCommand,
__in_z_opt LPCWSTR wzUserArgs,
__in PFN_GENERICMESSAGEHANDLER pfnGenericMessageHandler,
__in LPVOID pvContext,
__out DWORD* pdwExitCode
);
#if defined(__cplusplus)
}
#endif
|