aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLiam Mitchell <[email protected]>2025-03-26 15:23:27 -0700
committerGitHub Enterprise <[email protected]>2025-03-26 15:23:27 -0700
commitf3c98484387b8818fba8e99394ab0196eccb0876 (patch)
tree10d263522293976f216289d4bb89316fabfe8d35 /src
parentMerge pull request #322 from ue-foundation/lm/zen-service-return-codes (diff)
parentFix command line parsing when running service commands elevated (diff)
downloadzen-f3c98484387b8818fba8e99394ab0196eccb0876.tar.xz
zen-f3c98484387b8818fba8e99394ab0196eccb0876.zip
Merge pull request #321 from ue-foundation/lm/zen-service-elevated-command-line
Fix command line parsing when running service commands elevated
Diffstat (limited to 'src')
-rw-r--r--src/zen/cmds/service_cmd.cpp4
-rw-r--r--src/zen/xmake.lua2
2 files changed, 3 insertions, 3 deletions
diff --git a/src/zen/cmds/service_cmd.cpp b/src/zen/cmds/service_cmd.cpp
index fd4d3895e..91cce3ec1 100644
--- a/src/zen/cmds/service_cmd.cpp
+++ b/src/zen/cmds/service_cmd.cpp
@@ -11,6 +11,7 @@
#if ZEN_PLATFORM_WINDOWS
# include <zencore/windows.h>
# include <shellapi.h>
+# include <Shlwapi.h>
#endif
#if ZEN_PLATFORM_LINUX || ZEN_PLATFORM_MAC
@@ -58,8 +59,7 @@ namespace {
ExtendableWideStringBuilder<256> Parameters;
std::filesystem::path ExecutablePath = GetRunningExecutablePath();
std::wstring CommandLine(GetCommandLine());
- std::string::size_type ExtraLength = CommandLine[0] == '\"' ? 2 : 0;
- std::wstring CommandArguments = CommandLine.substr(ExecutablePath.string().length() + ExtraLength + 1);
+ std::wstring CommandArguments(PathGetArgs(CommandLine.data()));
ZEN_CONSOLE("Attempting to run '{} {}' elevated...", ExecutablePath, WideToUtf8(CommandArguments));
diff --git a/src/zen/xmake.lua b/src/zen/xmake.lua
index 78b2a3c2b..a755df374 100644
--- a/src/zen/xmake.lua
+++ b/src/zen/xmake.lua
@@ -17,7 +17,7 @@ target("zen")
add_files("zen.rc")
add_ldflags("/subsystem:console,5.02")
add_ldflags("/LTCG")
- add_links("crypt32", "wldap32", "Ws2_32")
+ add_links("crypt32", "wldap32", "Ws2_32", "Shlwapi")
end
if is_plat("macosx") then