@@ -105,11 +105,11 @@ bool FileExists(const wchar_t * filePath)
105
105
return false ;
106
106
}
107
107
108
- void StartCmder (std::wstring path = L" " , bool is_single_mode = false , std::wstring taskName = L" " , std::wstring title = L" " , std::wstring iconPath = L" " , std::wstring cfgRoot = L" " , bool use_user_cfg = true , std::wstring conemu_args = L" " , bool admin = false )
108
+ void StartCmder (std::wstring path = L" " , bool is_single_mode = false , std::wstring taskName = L" " , std::wstring title = L" " , std::wstring iconPath = L" " , std::wstring cfgRoot = L" " , bool use_user_cfg = true , std::wstring conemu_args = L" " )
109
109
{
110
- #if USE_TASKBAR_API
111
- wchar_t appId[MAX_PATH] = { 0 };
112
- #endif
110
+ #if USE_TASKBAR_API
111
+ wchar_t appId[MAX_PATH] = { 0 };
112
+ #endif
113
113
wchar_t exeDir[MAX_PATH] = { 0 };
114
114
wchar_t icoPath[MAX_PATH] = { 0 };
115
115
wchar_t cfgPath[MAX_PATH] = { 0 };
@@ -153,9 +153,9 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr
153
153
154
154
GetModuleFileName (NULL , exeDir, sizeof (exeDir));
155
155
156
- #if USE_TASKBAR_API
157
- wcscpy_s (appId, exeDir);
158
- #endif
156
+ #if USE_TASKBAR_API
157
+ wcscpy_s (appId, exeDir);
158
+ #endif
159
159
160
160
PathRemoveFileSpec (exeDir);
161
161
@@ -651,44 +651,13 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr
651
651
STARTUPINFO si = { 0 };
652
652
653
653
si.cb = sizeof (STARTUPINFO);
654
- #if USE_TASKBAR_API
655
- si.lpTitle = appId;
656
- si.dwFlags = STARTF_TITLEISAPPID;
657
- #endif
654
+ #if USE_TASKBAR_API
655
+ si.lpTitle = appId;
656
+ si.dwFlags = STARTF_TITLEISAPPID;
657
+ #endif
658
658
PROCESS_INFORMATION pi;
659
659
660
- // MessageBox(NULL, terminalPath, _T("Error"), MB_OK);
661
- // MessageBox(NULL, args, _T("Error"), MB_OK);
662
- // Let's try to rerun as Administrator
663
- SHELLEXECUTEINFO sei = { sizeof (sei) };
664
- sei.fMask = SEE_MASK_NOASYNC | SEE_MASK_NOCLOSEPROCESS;
665
- sei.lpVerb = L" runas" ;
666
- sei.lpFile = terminalPath;
667
- sei.lpParameters = args;
668
- sei.nShow = SW_SHOWNORMAL;
669
-
670
- if (admin && ShellExecuteEx (&sei))
671
- {
672
- if (!sei.hProcess )
673
- {
674
- Sleep (500 );
675
- _ASSERTE (sei.hProcess != nullptr );
676
- }
677
-
678
- if (sei.hProcess )
679
- {
680
- WaitForSingleObject (sei.hProcess , INFINITE);
681
- }
682
-
683
- // int nZone = 0;
684
- // if (!HasZoneIdentifier(lsFile, nZone)
685
- // || (nZone != 0 /*LocalComputer*/))
686
- // {
687
- // // Assuming that elevated copy has fixed all zone problems
688
- // break;
689
- // }
690
- }
691
- else if (!CreateProcess (terminalPath, args, NULL , NULL , false , 0 , NULL , NULL , &si, &pi))
660
+ if (!CreateProcess (terminalPath, args, NULL , NULL , false , 0 , NULL , NULL , &si, &pi))
692
661
{
693
662
if (PathFileExists (windowsTerminalDir))
694
663
{
@@ -819,7 +788,6 @@ struct cmderOptions
819
788
std::wstring cmderIcon = L" " ;
820
789
std::wstring cmderRegScope = L" USER" ;
821
790
std::wstring cmderTerminalArgs = L" " ;
822
- bool cmderAdmin = false ;
823
791
bool cmderSingle = false ;
824
792
bool cmderUserCfg = true ;
825
793
bool registerApp = false ;
@@ -908,10 +876,6 @@ cmderOptions GetOption()
908
876
{
909
877
cmderOptions.cmderUserCfg = false ;
910
878
}
911
- else if (_wcsicmp (L" /a" , szArgList[i]) == 0 && !PathFileExists (windowsTerminalDir) && !PathFileExists (conEmuDir))
912
- {
913
- cmderOptions.cmderAdmin = true ;
914
- }
915
879
else if (_wcsicmp (L" /register" , szArgList[i]) == 0 )
916
880
{
917
881
cmderOptions.registerApp = true ;
@@ -1048,7 +1012,8 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance,
1048
1012
}
1049
1013
else
1050
1014
{
1051
- StartCmder (cmderOptions.cmderStart , cmderOptions.cmderSingle , cmderOptions.cmderTask , cmderOptions.cmderTitle , cmderOptions.cmderIcon , cmderOptions.cmderCfgRoot , cmderOptions.cmderUserCfg , cmderOptions.cmderTerminalArgs , cmderOptions.cmderAdmin ); }
1015
+ StartCmder (cmderOptions.cmderStart , cmderOptions.cmderSingle , cmderOptions.cmderTask , cmderOptions.cmderTitle , cmderOptions.cmderIcon , cmderOptions.cmderCfgRoot , cmderOptions.cmderUserCfg , cmderOptions.cmderTerminalArgs );
1016
+ }
1052
1017
1053
1018
return 0 ;
1054
1019
}
0 commit comments