From 9154ec784d6893857bef9daadbd7d2b98b99f104 Mon Sep 17 00:00:00 2001 From: Bill Zissimopoulos Date: Sun, 4 Sep 2022 15:55:47 +0100 Subject: [PATCH] installer: CustomActions: InstanceID --- .../installer/CustomActions/CustomActions.cpp | 35 +++++++++++++++++++ .../installer/CustomActions/CustomActions.def | 1 + 2 files changed, 36 insertions(+) diff --git a/build/VStudio/installer/CustomActions/CustomActions.cpp b/build/VStudio/installer/CustomActions/CustomActions.cpp index 75218b5e..6579ef06 100644 --- a/build/VStudio/installer/CustomActions/CustomActions.cpp +++ b/build/VStudio/installer/CustomActions/CustomActions.cpp @@ -25,6 +25,41 @@ #include #include +UINT __stdcall InstanceID(MSIHANDLE MsiHandle) +{ +#if 0 + WCHAR MessageBuf[64]; + wsprintfW(MessageBuf, L"PID=%ld", GetCurrentProcessId()); + MessageBoxW(0, MessageBuf, L"" __FUNCTION__ " Break", MB_OK); +#endif + + HRESULT hr = S_OK; + UINT err = ERROR_SUCCESS; + SYSTEMTIME SystemTime; + WCHAR Result[32+1]; + + hr = WcaInitialize(MsiHandle, __FUNCTION__); + ExitOnFailure(hr, "Failed to initialize"); + + WcaLog(LOGMSG_STANDARD, "Initialized"); + + GetSystemTime(&SystemTime); + wsprintfW(Result, L"%04u%02u%02uT%02u%02u%02uZ", + SystemTime.wYear, + SystemTime.wMonth, + SystemTime.wDay, + SystemTime.wHour, + SystemTime.wMinute, + SystemTime.wSecond); + Sleep(1000); + + WcaSetProperty(L"" __FUNCTION__, Result); + +LExit: + err = SUCCEEDED(hr) ? ERROR_SUCCESS : ERROR_INSTALL_FAILURE; + return WcaFinalize(err); +} + UINT __stdcall ServiceRunning(MSIHANDLE MsiHandle) { #if 0 diff --git a/build/VStudio/installer/CustomActions/CustomActions.def b/build/VStudio/installer/CustomActions/CustomActions.def index 817b3f32..3f892ebf 100644 --- a/build/VStudio/installer/CustomActions/CustomActions.def +++ b/build/VStudio/installer/CustomActions/CustomActions.def @@ -1,2 +1,3 @@ EXPORTS + InstanceID ServiceRunning