summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYuri Benditovich <yuri.benditovich@daynix.com>2019-03-18 14:51:55 +0200
committerYan Vugenfirer <yan@daynix.com>2019-04-15 11:02:48 +0300
commit4c339641580897be151657ea097739b0d2188e91 (patch)
tree8f3bf8ed5c4ee5d3f50751fc2106bcb9f660f488
parent46c80bad8407917d6509e2795661db9953b08da5 (diff)
InstallHelper: optionally suppress message boxes
Add optional command-line parameter to suppress message box in case the installation requires reboot or aborted. This supports use case when the UsbDk is installed along with other product and restart is required regardless installation status of UsbDk. When installation helper runs with -in or -iN, the message boxes are suppressed. Signed-off-by: Yuri Benditovich <yuri.benditovich@daynix.com>
-rw-r--r--UsbDkInstHelper/UsbDkInstHelper.cpp32
1 files changed, 26 insertions, 6 deletions
diff --git a/UsbDkInstHelper/UsbDkInstHelper.cpp b/UsbDkInstHelper/UsbDkInstHelper.cpp
index 617a26b..4a64466 100644
--- a/UsbDkInstHelper/UsbDkInstHelper.cpp
+++ b/UsbDkInstHelper/UsbDkInstHelper.cpp
@@ -27,6 +27,8 @@
using namespace std;
+static BOOL suppressInstallMessageBox = FALSE;
+
static int Controller_InstallDriver()
{
//Clean up any previous versions before reinstalling
@@ -40,14 +42,28 @@ static int Controller_InstallDriver()
case InstallFailure:
return 1;
case InstallAborted:
- MessageBox(NULL,
- TEXT("Failed to start the driver on the system, installation aborted!\nPlease make sure you are installing a signed version of UsbDk or else try to disable \"driver signature enforcement\" on the system"),
- TEXT("UsbDk Runtime Libraries Installer"), MB_OK | MB_ICONEXCLAMATION | MB_SETFOREGROUND | MB_SYSTEMMODAL);
+ if (!suppressInstallMessageBox)
+ {
+ MessageBox(NULL,
+ TEXT("Failed to start the driver on the system, installation aborted!\nPlease make sure you are installing a signed version of UsbDk or else try to disable \"driver signature enforcement\" on the system"),
+ TEXT("UsbDk Runtime Libraries Installer"), MB_OK | MB_ICONEXCLAMATION | MB_SETFOREGROUND | MB_SYSTEMMODAL);
+ }
+ else
+ {
+ OutputDebugString(TEXT("UsbDkInstHelper: Installation aborted"));
+ }
return 4;
case InstallSuccessNeedReboot:
- MessageBox(NULL,
- TEXT("Please restart your computer to complete the installation"),
- TEXT("UsbDk Runtime Libraries Installer"), MB_OK | MB_ICONEXCLAMATION | MB_SETFOREGROUND | MB_SYSTEMMODAL);
+ if (!suppressInstallMessageBox)
+ {
+ MessageBox(NULL,
+ TEXT("Please restart your computer to complete the installation"),
+ TEXT("UsbDk Runtime Libraries Installer"), MB_OK | MB_ICONEXCLAMATION | MB_SETFOREGROUND | MB_SYSTEMMODAL);
+ }
+ else
+ {
+ OutputDebugString(TEXT("UsbDkInstHelper: reboot required to complete the installation"));
+ }
return 0;
default:
assert(0);
@@ -101,6 +117,10 @@ int CALLBACK WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLi
if (lpCmdLine[0] == 'i')
{
+ if (lpCmdLine[1] == 'n' || lpCmdLine[1] == 'N')
+ {
+ suppressInstallMessageBox = TRUE;
+ }
OutputDebugString(TEXT("UsbDkInstHelper: Install"));
return Controller_InstallDriver();
}