| 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 | |
| 4 | |
| 5 | #if defined(__cplusplus) |
| 6 | extern "C" { |
| 7 | #endif |
| 8 | |
| 9 | struct NetFxDataStructure |
| 10 | { |
| 11 | bool downloadFinished; // download done yet? |
| 12 | bool installFinished; // install done yet? |
| 13 | bool downloadAbort; // set downloader to abort |
| 14 | bool installAbort; // set installer to abort |
| 15 | HRESULT hrDownloadFinished; // resultant HRESULT for download |
| 16 | HRESULT hrInstallFinished; // resultant HRESULT for install |
| 17 | HRESULT hrInternalError; |
| 18 | WCHAR szCurrentItemStep[MAX_PATH]; |
| 19 | BYTE downloadSoFar; // download progress 0 - 255 (0 to 100% done) |
| 20 | BYTE installSoFar; // install progress 0 - 255 (0 to 100% done) |
| 21 | WCHAR szEventName[MAX_PATH]; // event that chainer 'creates' and chainee 'opens'to sync communications |
| 22 | |
| 23 | BYTE version; // version of the data structure, set by chainer. |
| 24 | |
| 25 | DWORD messageCode; // current message being sent by the chainee, 0 if no message is active |
| 26 | DWORD messageResponse; // chainer's response to current message, 0 if not yet handled |
| 27 | DWORD messageDataLength; // length of the m_messageData field in bytes |
| 28 | BYTE messageData[1]; // variable length buffer, content depends on m_messageCode |
| 29 | }; |
| 30 | |
| 31 | struct NetFxChainer |
| 32 | { |
| 33 | HANDLE hSection; |
| 34 | |
| 35 | HANDLE hEventChaineeSend; |
| 36 | HANDLE hEventChainerSend; |
| 37 | HANDLE hMutex; |
| 38 | |
| 39 | NetFxDataStructure* pData; |
| 40 | DWORD dwDataSize; |
| 41 | }; |
| 42 | |
| 43 | #define NETFXDATA_SIZE 65536 |
| 44 | |
| 45 | #define NETFXDATA_VERSION 1 |
| 46 | |
| 47 | #define NETFX_MESSAGE(version, defaultResponse, messageCode) \ |
| 48 | ((((DWORD)version & 0xFF) << 24) | (((DWORD)defaultResponse & 0xFF) << 16) | ((DWORD)messageCode & 0xFFFF)) |
| 49 | #define NETFX_MESSAGE_CODE(messageId) \ |
| 50 | (messageId & 0xFFFF) |
| 51 | #define NETFX_MESSAGE_DEFAULT_RESPONSE(messageId) \ |
| 52 | ((messageId >> 16) & 0xFF) |
| 53 | #define NETFX_MESSAGE_VERSION(messageId) \ |
| 54 | ((messageId >>24) & 0xFF) |
| 55 | |
| 56 | #define NETFX_NO_MESSAGE 0 |
| 57 | |
| 58 | |
| 59 | //------------------------------------------------------------------------------ |
| 60 | // NETFX_CLOSE_APPS |
| 61 | // |
| 62 | // Sent by the chainee when it detects that applications are holding files in |
| 63 | // use. Respond to this message in order to tell the chainee to close the |
| 64 | // applications to prevent a reboot. |
| 65 | // |
| 66 | // pData : NetFxCloseApplications : The list of applications |
| 67 | // Acceptable responses: |
| 68 | // IDYES : Indicates that the chainee should attempt to shutdown the apps. |
| 69 | // If all apps do not successfully close the message may be sent again. |
| 70 | // IDNO : Indicates that the chainee should not attempt to close apps. |
| 71 | // IDRETRY : Indicates that the chainee should refresh the list of apps. |
| 72 | // Another NETFX_CLOSE_APPS message will be sent asynchronously with |
| 73 | // the new list of apps. |
| 74 | //------------------------------------------------------------------------------ |
| 75 | #define NETFX_CLOSE_APPS NETFX_MESSAGE(NETFXDATA_VERSION, IDNO, 1) |
| 76 | |
| 77 | struct NetFxApplication |
| 78 | { |
| 79 | WCHAR szName[MAX_PATH]; |
| 80 | DWORD dwPid; |
| 81 | }; |
| 82 | |
| 83 | struct NetFxCloseApplications |
| 84 | { |
| 85 | DWORD dwApplicationsSize; |
| 86 | NetFxApplication applications[1]; |
| 87 | }; |
| 88 | |
| 89 | HRESULT NetFxRunChainer( |
| 90 | __in_z LPCWSTR wzExecutablePath, |
| 91 | __in_z LPWSTR sczBaseCommand, |
| 92 | __in_z_opt LPCWSTR wzUserArgs, |
| 93 | __in PFN_GENERICMESSAGEHANDLER pfnGenericMessageHandler, |
| 94 | __in LPVOID pvContext, |
| 95 | __out DWORD* pdwExitCode |
| 96 | ); |
| 97 | #if defined(__cplusplus) |
| 98 | } |
| 99 | #endif |