Package native DUO-RDP 2.2.0 with Inno Setup wizard

This commit is contained in:
SoGi committed 2026-11-13 20:44:59 +01:00
1 parent d05253ba84
commit d60c0bb5be
10 files changed
+280 -8

No files matched your search

+10 -7
View File
@@ -282,7 +282,7 @@ bool pipe_health(std::wstring& error) {
return false;
}
int install(const std::wstring& payloadDirectory) {
int install(const std::wstring& payloadDirectory, bool launchAdmin) {
if (!is_elevated()) {
std::fputs("Installer requires an elevated administrator token.\n", stderr);
return 2;
@@ -352,6 +352,7 @@ int install(const std::wstring& payloadDirectory) {
return 1;
}
std::wprintf(L"DUO-RDP native C++ installation complete: %s\n", installDirectory.c_str());
if (!launchAdmin) return 0;
const HINSTANCE launched = ShellExecuteW(nullptr, L"open", (installDirectory + L"\\DuoRdpAdmin.exe").c_str(), nullptr, installDirectory.c_str(), SW_SHOWNORMAL);
if (reinterpret_cast<INT_PTR>(launched) <= 32) {
std::fwprintf(stderr, L"Installation is complete, but open DuoRdpAdmin.exe manually (ShellExecute error=%lld).\n", static_cast<long long>(reinterpret_cast<INT_PTR>(launched)));
@@ -392,7 +393,7 @@ int uninstall(bool purgeData) {
}
void usage() {
std::puts("DuoRdpInstaller.exe --install [--payload <directory>] | --uninstall [--purge-data] | --self-test");
std::puts("DuoRdpInstaller.exe --install [--payload <directory>] [--no-launch] | --uninstall [--purge-data] | --self-test");
}
bool run_self_test() {
@@ -443,12 +444,14 @@ int wmain(int argc, wchar_t** argv) {
const std::wstring_view command = argv[1];
if (command == L"--install") {
std::wstring payload = module_directory() + L"\\payload";
if (argc == 4 && std::wstring_view(argv[2]) == L"--payload") payload = argv[3];
else if (argc != 2) {
usage();
return 2;
bool launchAdmin = true;
for (int i = 2; i < argc; ++i) {
const std::wstring_view option = argv[i];
if (option == L"--no-launch") launchAdmin = false;
else if (option == L"--payload" && i + 1 < argc) payload = argv[++i];
else { usage(); return 2; }
}
return install(payload);
return install(payload, launchAdmin);
}
if (command == L"--uninstall") {
if (argc > 3 || (argc == 3 && std::wstring_view(argv[2]) != L"--purge-data")) {