Skip to content

Commit

Permalink
if the JSON has an asadmin field set to true, run the link as admin
Browse files Browse the repository at this point in the history
  • Loading branch information
Nicholas O'Connor committed Jan 2, 2016
1 parent 9928a4f commit f8b68fc
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion Tilandis/linkmgmt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,15 @@ bool Tilandis::Links::LaunchLink(const wchar_t * LinkName) {
std::wstring args;
if (link.HasMember(L"args")) { args = link[L"args"].GetString(); }
else { args = L""; }
bool asadmin = false;
if (link.HasMember(L"asadmin")) { asadmin = link[L"asadmin"].GetBool(); }

ShellExecute(NULL, NULL, path.c_str(), args.c_str(), workdir.c_str(), SW_SHOWDEFAULT);
if (asadmin) {
ShellExecute(NULL, L"runas", path.c_str(), args.c_str(), workdir.c_str(), SW_SHOWDEFAULT);
}
else {
ShellExecute(NULL, NULL, path.c_str(), args.c_str(), workdir.c_str(), SW_SHOWDEFAULT);
}
//Sleep(2000);
return true;
}
Expand Down

0 comments on commit f8b68fc

Please sign in to comment.