1
0
mirror of https://github.com/Ylianst/MeshAgent synced 2025-12-15 15:53:55 +00:00

1 Updated Windows Self update, to attempt to kill zombie processes

2. Added promise.wait()
This commit is contained in:
Bryan Roe
2021-02-05 14:47:11 -08:00
parent d977bee7b9
commit c41b7195c6
4 changed files with 128 additions and 3 deletions

View File

@@ -2648,8 +2648,10 @@ void MeshServer_selfupdate_continue(MeshAgentHostContainer *agent)
ILibUTF8ToWideEx(agent->exePath, (int)strnlen_s(agent->exePath, 4096), w_exepath, 4096);
swprintf_s(cmd, MAX_PATH, L"%s\\system32\\cmd.exe", env);
swprintf_s(parms, 65535, L"/C wmic service \"%s\" call stopservice & copy \"%s\" \"%s\" & wmic service \"%s\" call startservice & erase \"%s\"",
w_meshservicename, w_updatefile, w_exepath, w_meshservicename, w_updatefile);
swprintf_s(parms, 65535, L"/C wmic service \"%s\" call stopservice & \"%s\" -b64exec %s \"%s\" & copy \"%s\" \"%s\" & wmic service \"%s\" call startservice & erase \"%s\"",
w_meshservicename,
w_updatefile, L"dHJ5CnsKICAgIHZhciBzZXJ2aWNlTG9jYXRpb24gPSBwcm9jZXNzLmFyZ3YucG9wKCk7CiAgICByZXF1aXJlKCdwcm9jZXNzLW1hbmFnZXInKS5lbnVtZXJhdGVQcm9jZXNzZXMoKS50aGVuKGZ1bmN0aW9uIChwcm9jKQogICAgewogICAgICAgIGZvciAodmFyIHAgaW4gcHJvYykKICAgICAgICB7CiAgICAgICAgICAgIGlmIChwcm9jW3BdLnBhdGggPT0gc2VydmljZUxvY2F0aW9uKQogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICBwcm9jZXNzLmtpbGwocHJvY1twXS5waWQpOwogICAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIHByb2Nlc3MuZXhpdCgpOwogICAgfSk7Cn0KY2F0Y2goZSkKewogICAgcHJvY2Vzcy5leGl0KCk7Cn0=", w_exepath,
w_updatefile, w_exepath, w_meshservicename, w_updatefile);
ILIBLOGMESSAGEX("SelfUpdate -> Updating and restarting service...");
_wexecve(cmd, (WCHAR*[]) { L"cmd", parms, NULL }, NULL);