Skip to content

Commit 8683dad

Browse files
committed
Remove /a switch and associated code.
1 parent d349f57 commit 8683dad

File tree

3 files changed

+70
-85
lines changed

3 files changed

+70
-85
lines changed

launcher/CmderLauncher.vcxproj

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,9 @@
188188
<ItemGroup>
189189
<ClCompile Include="src\CmderLauncher.cpp" />
190190
</ItemGroup>
191+
<ItemGroup>
192+
<Image Include="..\icons\cmder.ico" />
193+
</ItemGroup>
191194
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
192195
<ImportGroup Label="ExtensionTargets">
193196
</ImportGroup>

launcher/src/CmderLauncher.cpp

Lines changed: 14 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -105,11 +105,11 @@ bool FileExists(const wchar_t * filePath)
105105
return false;
106106
}
107107

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"")
109109
{
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
113113
wchar_t exeDir[MAX_PATH] = { 0 };
114114
wchar_t icoPath[MAX_PATH] = { 0 };
115115
wchar_t cfgPath[MAX_PATH] = { 0 };
@@ -153,9 +153,9 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr
153153

154154
GetModuleFileName(NULL, exeDir, sizeof(exeDir));
155155

156-
#if USE_TASKBAR_API
157-
wcscpy_s(appId, exeDir);
158-
#endif
156+
#if USE_TASKBAR_API
157+
wcscpy_s(appId, exeDir);
158+
#endif
159159

160160
PathRemoveFileSpec(exeDir);
161161

@@ -651,44 +651,13 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr
651651
STARTUPINFO si = { 0 };
652652

653653
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
658658
PROCESS_INFORMATION pi;
659659

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))
692661
{
693662
if (PathFileExists(windowsTerminalDir))
694663
{
@@ -819,7 +788,6 @@ struct cmderOptions
819788
std::wstring cmderIcon = L"";
820789
std::wstring cmderRegScope = L"USER";
821790
std::wstring cmderTerminalArgs = L"";
822-
bool cmderAdmin = false;
823791
bool cmderSingle = false;
824792
bool cmderUserCfg = true;
825793
bool registerApp = false;
@@ -908,10 +876,6 @@ cmderOptions GetOption()
908876
{
909877
cmderOptions.cmderUserCfg = false;
910878
}
911-
else if (_wcsicmp(L"/a", szArgList[i]) == 0 && !PathFileExists(windowsTerminalDir) && !PathFileExists(conEmuDir))
912-
{
913-
cmderOptions.cmderAdmin = true;
914-
}
915879
else if (_wcsicmp(L"/register", szArgList[i]) == 0)
916880
{
917881
cmderOptions.registerApp = true;
@@ -1048,7 +1012,8 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance,
10481012
}
10491013
else
10501014
{
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+
}
10521017

10531018
return 0;
10541019
}

launcher/src/resource.rc

Lines changed: 53 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,6 @@
1-
/* _
2-
___ _ __ ___ __| | ___ _ __
3-
/ __| '_ ` _ \ / _` |/ _ \ '__|
4-
| (__| | | | | | (_| | __/ |
5-
\___|_| |_| |_|\__,_|\___|_|
6-
=============================================================================
7-
The Cmder Console Emulator Project
8-
*/
9-
1+
// Microsoft Visual C++ generated resource script.
2+
//
103
#include "resource.h"
11-
#include "version.rc2"
12-
#include "strings.rc2"
134

145
#define APSTUDIO_READONLY_SYMBOLS
156
/////////////////////////////////////////////////////////////////////////////
@@ -26,32 +17,34 @@
2617

2718
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
2819
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
20+
#pragma code_page(1252)
2921

3022
#ifdef APSTUDIO_INVOKED
3123
/////////////////////////////////////////////////////////////////////////////
3224
//
3325
// TEXTINCLUDE
3426
//
3527

36-
1 TEXTINCLUDE
28+
1 TEXTINCLUDE
3729
BEGIN
38-
"resource.h\0"
30+
"resource.h\0"
3931
END
4032

41-
2 TEXTINCLUDE
33+
2 TEXTINCLUDE
4234
BEGIN
43-
"#include ""winres.h""\r\n"
44-
"\0"
35+
"#include ""winres.h""\r\n"
36+
"\0"
4537
END
4638

47-
3 TEXTINCLUDE
39+
3 TEXTINCLUDE
4840
BEGIN
49-
"\r\n"
50-
"\0"
41+
"\r\n"
42+
"\0"
5143
END
5244

5345
#endif // APSTUDIO_INVOKED
5446

47+
5548
/////////////////////////////////////////////////////////////////////////////
5649
//
5750
// Icon
@@ -60,35 +53,38 @@ END
6053
// Icon with lowest ID value placed first to ensure application icon
6154
// remains consistent on all systems.
6255
IDI_CMDER ICON "..\\..\\icons\\cmder.ico"
63-
#endif // English (United States) resources
64-
/////////////////////////////////////////////////////////////////////////////
56+
6557

6658
/////////////////////////////////////////////////////////////////////////////
6759
//
6860
// Version
6961
//
7062

7163
VS_VERSION_INFO VERSIONINFO
72-
FILEVERSION CMDER_MAJOR_VERSION,CMDER_MINOR_VERSION,CMDER_REVISION_VERSION,CMDER_BUILD_VERSION
73-
PRODUCTVERSION CMDER_MAJOR_VERSION,CMDER_MINOR_VERSION,CMDER_REVISION_VERSION,CMDER_BUILD_VERSION
74-
FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
75-
FILEFLAGS (CMDER_DEBUGFLAG | CMDER_BUILDFLAGS)
76-
FILEOS VOS_NT_WINDOWS32
77-
FILETYPE VFT_APP
78-
FILESUBTYPE VFT2_UNKNOWN
64+
FILEVERSION 1,3,6,1
65+
PRODUCTVERSION 1,3,6,1
66+
FILEFLAGSMASK 0x3fL
67+
#ifdef _DEBUG
68+
FILEFLAGS 0x1L
69+
#else
70+
FILEFLAGS 0x0L
71+
#endif
72+
FILEOS 0x40004L
73+
FILETYPE 0x1L
74+
FILESUBTYPE 0x0L
7975
BEGIN
8076
BLOCK "StringFileInfo"
8177
BEGIN
8278
BLOCK "100904b0"
8379
BEGIN
84-
VALUE "CompanyName", CMDER_COMPANY_NAME_STR "\0"
85-
VALUE "FileDescription", CMDER_FILE_DESCRIPTION_STR "\0"
86-
VALUE "FileVersion", CMDER_VERSION_STR "\0"
87-
VALUE "InternalName", CMDER_INTERNAL_NAME_STR "\0"
88-
VALUE "LegalCopyright", "Copyright (C) " CMDER_COPYRIGHT_YEAR_STR " " CMDER_COMPANY_NAME_STR "\0"
89-
VALUE "OriginalFilename", CMDER_ORIGINAL_FILENAME_STR "\0"
90-
VALUE "ProductName", CMDER_PRODUCT_NAME_STR "\0"
91-
VALUE "ProductVersion", CMDER_VERSION_STR "\0"
80+
VALUE "CompanyName", "Samuel Vasko"
81+
VALUE "FileDescription", "Cmder: Lovely Console Emulator."
82+
VALUE "FileVersion", "1.3.6-pre1"
83+
VALUE "InternalName", "Cmder"
84+
VALUE "LegalCopyright", "Copyright (C) 2016 Samuel Vasko"
85+
VALUE "OriginalFilename", "Cmder.exe"
86+
VALUE "ProductName", "Cmder"
87+
VALUE "ProductVersion", "1.3.6-pre1"
9288
END
9389
END
9490
BLOCK "VarFileInfo"
@@ -97,13 +93,34 @@ BEGIN
9793
END
9894
END
9995

96+
97+
/////////////////////////////////////////////////////////////////////////////
98+
//
99+
// String Table
100+
//
101+
102+
STRINGTABLE
103+
BEGIN
104+
IDS_TITLE "Cmder Launcher"
105+
END
106+
107+
STRINGTABLE
108+
BEGIN
109+
IDS_SWITCHES "Valid options:\n\n /c [CMDER User Root Path]\n /task [Windows Terminal Profile/ConEmu Task Name]\n /icon [CMDER Icon Path] - ConEmu ONLY!\n [/start [Start in Path] | [Start in Path]]\n /single - ConEmu ONLY!\n /m\n -- [ConEmu/Windows Terminal extra arguments]\n\nNote: '-- [...]' must be the last argument!\n\nor, either:\n /register [USER | ALL]\n /unregister [USER | ALL]"
110+
END
111+
112+
#endif // English (United States) resources
100113
/////////////////////////////////////////////////////////////////////////////
101114

115+
116+
102117
#ifndef APSTUDIO_INVOKED
103118
/////////////////////////////////////////////////////////////////////////////
104119
//
105120
// Generated from the TEXTINCLUDE 3 resource.
106121
//
107122

123+
108124
/////////////////////////////////////////////////////////////////////////////
109125
#endif // not APSTUDIO_INVOKED
126+

0 commit comments

Comments
 (0)