X Tutup
Skip to content

Commit 7f2fd1b

Browse files
Add '--elevated-install' and '--elevated-uninstall' commands to msiexec mode, cf. itchio/itch#536
1 parent e3cbd66 commit 7f2fd1b

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/elevate.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,18 +114,25 @@ int msiexec(int argc, char** argv) {
114114
SAFE_APPEND("%s%s ", "/l*v");
115115
SAFE_APPEND("%s%s ", logPath);
116116

117+
char *verb = "open";
117118
if (strcmp(command, "--install") == 0) {
118119
SAFE_APPEND("%s%s ", "/i");
119120
} else if (strcmp(command, "--uninstall") == 0) {
120121
SAFE_APPEND("%s%s ", "/x");
122+
} else if (strcmp(command, "--elevated-install") == 0) {
123+
SAFE_APPEND("%s%s ", "/i");
124+
verb = "runas";
125+
} else if (strcmp(command, "--elevated-uninstall") == 0) {
126+
SAFE_APPEND("%s%s ", "/x");
127+
verb = "runas";
121128
} else {
122129
fprintf(stderr, "Command must be --install or --uninstall, got %s\n", command);
123130
msibail();
124131
}
125132

126133
SAFE_APPEND("%s%s ", msiPath);
127134

128-
return exec("open", "msiexec", parameters);
135+
return exec(verb, "msiexec", parameters);
129136
}
130137

131138
/**

0 commit comments

Comments
 (0)
X Tutup