From 7731f1192a826c930dcbe8d419f05ddaa8cba1cd Mon Sep 17 00:00:00 2001 From: bytecode77 Date: Fri, 11 Nov 2022 22:35:12 +0100 Subject: [PATCH] Bugfix: Installation fails when notebook unplugged --- $Examples/ControlPipe.cpp | 2 +- Helper/Helper.c | 2 +- r77api/r77win.c | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/$Examples/ControlPipe.cpp b/$Examples/ControlPipe.cpp index 9c6748a..743cb96 100644 --- a/$Examples/ControlPipe.cpp +++ b/$Examples/ControlPipe.cpp @@ -3,7 +3,7 @@ // This example demonstrates how to make r77 perform a ShellExecute. // All other control codes work similarly. -#define CONTROL_USER_SHELLEXEC 0x3001 // These constants can be found in r77api.h or in the technical documentation +#define CONTROL_USER_SHELLEXEC 0x3001 // These constants can be found in r77def.h or in the technical documentation int main() { diff --git a/Helper/Helper.c b/Helper/Helper.c index 905f996..1217c55 100644 --- a/Helper/Helper.c +++ b/Helper/Helper.c @@ -114,7 +114,7 @@ int ProcessList() { GetProcessIntegrityLevel(process, &integrityLevel); - if (!GetProcessUserName(process, userName, &userNameLength))userName[0] = L'\0'; + if (!GetProcessUserName(process, userName, &userNameLength)) userName[0] = L'\0'; CloseHandle(process); } diff --git a/r77api/r77win.c b/r77api/r77win.c index a6e8234..4b574d3 100644 --- a/r77api/r77win.c +++ b/r77api/r77win.c @@ -452,7 +452,8 @@ BOOL CreateScheduledTask(LPCWSTR name, LPCWSTR directory, LPCWSTR fileName, LPCW ITaskSettings *settings = NULL; if (SUCCEEDED(task->lpVtbl->get_Settings(task, &settings))) { - if (SUCCEEDED(settings->lpVtbl->put_StartWhenAvailable(settings, VARIANT_TRUE))) + if (SUCCEEDED(settings->lpVtbl->put_StartWhenAvailable(settings, VARIANT_TRUE)) && + SUCCEEDED(settings->lpVtbl->put_DisallowStartIfOnBatteries(settings, VARIANT_FALSE))) { ITriggerCollection *triggerCollection = NULL; if (SUCCEEDED(task->lpVtbl->get_Triggers(task, &triggerCollection)))