mirror of
https://github.com/cmderdev/cmder.git
synced 2025-03-13 22:24:39 +08:00
Remove /a switch and associated code.
This commit is contained in:
parent
d349f57e78
commit
8683dad111
@ -188,6 +188,9 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="src\CmderLauncher.cpp" />
|
<ClCompile Include="src\CmderLauncher.cpp" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Image Include="..\icons\cmder.ico" />
|
||||||
|
</ItemGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||||
<ImportGroup Label="ExtensionTargets">
|
<ImportGroup Label="ExtensionTargets">
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
|
@ -105,11 +105,11 @@ bool FileExists(const wchar_t * filePath)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
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)
|
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"")
|
||||||
{
|
{
|
||||||
#if USE_TASKBAR_API
|
#if USE_TASKBAR_API
|
||||||
wchar_t appId[MAX_PATH] = { 0 };
|
wchar_t appId[MAX_PATH] = { 0 };
|
||||||
#endif
|
#endif
|
||||||
wchar_t exeDir[MAX_PATH] = { 0 };
|
wchar_t exeDir[MAX_PATH] = { 0 };
|
||||||
wchar_t icoPath[MAX_PATH] = { 0 };
|
wchar_t icoPath[MAX_PATH] = { 0 };
|
||||||
wchar_t cfgPath[MAX_PATH] = { 0 };
|
wchar_t cfgPath[MAX_PATH] = { 0 };
|
||||||
@ -153,9 +153,9 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr
|
|||||||
|
|
||||||
GetModuleFileName(NULL, exeDir, sizeof(exeDir));
|
GetModuleFileName(NULL, exeDir, sizeof(exeDir));
|
||||||
|
|
||||||
#if USE_TASKBAR_API
|
#if USE_TASKBAR_API
|
||||||
wcscpy_s(appId, exeDir);
|
wcscpy_s(appId, exeDir);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
PathRemoveFileSpec(exeDir);
|
PathRemoveFileSpec(exeDir);
|
||||||
|
|
||||||
@ -651,44 +651,13 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr
|
|||||||
STARTUPINFO si = { 0 };
|
STARTUPINFO si = { 0 };
|
||||||
|
|
||||||
si.cb = sizeof(STARTUPINFO);
|
si.cb = sizeof(STARTUPINFO);
|
||||||
#if USE_TASKBAR_API
|
#if USE_TASKBAR_API
|
||||||
si.lpTitle = appId;
|
si.lpTitle = appId;
|
||||||
si.dwFlags = STARTF_TITLEISAPPID;
|
si.dwFlags = STARTF_TITLEISAPPID;
|
||||||
#endif
|
#endif
|
||||||
PROCESS_INFORMATION pi;
|
PROCESS_INFORMATION pi;
|
||||||
|
|
||||||
// MessageBox(NULL, terminalPath, _T("Error"), MB_OK);
|
if (!CreateProcess(terminalPath, args, NULL, NULL, false, 0, NULL, NULL, &si, &pi))
|
||||||
// MessageBox(NULL, args, _T("Error"), MB_OK);
|
|
||||||
// Let's try to rerun as Administrator
|
|
||||||
SHELLEXECUTEINFO sei = { sizeof(sei) };
|
|
||||||
sei.fMask = SEE_MASK_NOASYNC | SEE_MASK_NOCLOSEPROCESS;
|
|
||||||
sei.lpVerb = L"runas";
|
|
||||||
sei.lpFile = terminalPath;
|
|
||||||
sei.lpParameters = args;
|
|
||||||
sei.nShow = SW_SHOWNORMAL;
|
|
||||||
|
|
||||||
if (admin && ShellExecuteEx(&sei))
|
|
||||||
{
|
|
||||||
if (!sei.hProcess)
|
|
||||||
{
|
|
||||||
Sleep(500);
|
|
||||||
_ASSERTE(sei.hProcess != nullptr);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (sei.hProcess)
|
|
||||||
{
|
|
||||||
WaitForSingleObject(sei.hProcess, INFINITE);
|
|
||||||
}
|
|
||||||
|
|
||||||
// int nZone = 0;
|
|
||||||
// if (!HasZoneIdentifier(lsFile, nZone)
|
|
||||||
// || (nZone != 0 /*LocalComputer*/))
|
|
||||||
// {
|
|
||||||
// // Assuming that elevated copy has fixed all zone problems
|
|
||||||
// break;
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
else if (!CreateProcess(terminalPath, args, NULL, NULL, false, 0, NULL, NULL, &si, &pi))
|
|
||||||
{
|
{
|
||||||
if (PathFileExists(windowsTerminalDir))
|
if (PathFileExists(windowsTerminalDir))
|
||||||
{
|
{
|
||||||
@ -819,7 +788,6 @@ struct cmderOptions
|
|||||||
std::wstring cmderIcon = L"";
|
std::wstring cmderIcon = L"";
|
||||||
std::wstring cmderRegScope = L"USER";
|
std::wstring cmderRegScope = L"USER";
|
||||||
std::wstring cmderTerminalArgs = L"";
|
std::wstring cmderTerminalArgs = L"";
|
||||||
bool cmderAdmin = false;
|
|
||||||
bool cmderSingle = false;
|
bool cmderSingle = false;
|
||||||
bool cmderUserCfg = true;
|
bool cmderUserCfg = true;
|
||||||
bool registerApp = false;
|
bool registerApp = false;
|
||||||
@ -908,10 +876,6 @@ cmderOptions GetOption()
|
|||||||
{
|
{
|
||||||
cmderOptions.cmderUserCfg = false;
|
cmderOptions.cmderUserCfg = false;
|
||||||
}
|
}
|
||||||
else if (_wcsicmp(L"/a", szArgList[i]) == 0 && !PathFileExists(windowsTerminalDir) && !PathFileExists(conEmuDir))
|
|
||||||
{
|
|
||||||
cmderOptions.cmderAdmin = true;
|
|
||||||
}
|
|
||||||
else if (_wcsicmp(L"/register", szArgList[i]) == 0)
|
else if (_wcsicmp(L"/register", szArgList[i]) == 0)
|
||||||
{
|
{
|
||||||
cmderOptions.registerApp = true;
|
cmderOptions.registerApp = true;
|
||||||
@ -1048,7 +1012,8 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
StartCmder(cmderOptions.cmderStart, cmderOptions.cmderSingle, cmderOptions.cmderTask, cmderOptions.cmderTitle, cmderOptions.cmderIcon, cmderOptions.cmderCfgRoot, cmderOptions.cmderUserCfg, cmderOptions.cmderTerminalArgs, cmderOptions.cmderAdmin); }
|
StartCmder(cmderOptions.cmderStart, cmderOptions.cmderSingle, cmderOptions.cmderTask, cmderOptions.cmderTitle, cmderOptions.cmderIcon, cmderOptions.cmderCfgRoot, cmderOptions.cmderUserCfg, cmderOptions.cmderTerminalArgs);
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
@ -1,15 +1,6 @@
|
|||||||
/* _
|
// Microsoft Visual C++ generated resource script.
|
||||||
___ _ __ ___ __| | ___ _ __
|
//
|
||||||
/ __| '_ ` _ \ / _` |/ _ \ '__|
|
|
||||||
| (__| | | | | | (_| | __/ |
|
|
||||||
\___|_| |_| |_|\__,_|\___|_|
|
|
||||||
=============================================================================
|
|
||||||
The Cmder Console Emulator Project
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "resource.h"
|
#include "resource.h"
|
||||||
#include "version.rc2"
|
|
||||||
#include "strings.rc2"
|
|
||||||
|
|
||||||
#define APSTUDIO_READONLY_SYMBOLS
|
#define APSTUDIO_READONLY_SYMBOLS
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
@ -26,6 +17,7 @@
|
|||||||
|
|
||||||
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
|
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
|
||||||
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
|
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
|
||||||
|
#pragma code_page(1252)
|
||||||
|
|
||||||
#ifdef APSTUDIO_INVOKED
|
#ifdef APSTUDIO_INVOKED
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
@ -33,25 +25,26 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
|
|||||||
// TEXTINCLUDE
|
// TEXTINCLUDE
|
||||||
//
|
//
|
||||||
|
|
||||||
1 TEXTINCLUDE
|
1 TEXTINCLUDE
|
||||||
BEGIN
|
BEGIN
|
||||||
"resource.h\0"
|
"resource.h\0"
|
||||||
END
|
END
|
||||||
|
|
||||||
2 TEXTINCLUDE
|
2 TEXTINCLUDE
|
||||||
BEGIN
|
BEGIN
|
||||||
"#include ""winres.h""\r\n"
|
"#include ""winres.h""\r\n"
|
||||||
"\0"
|
"\0"
|
||||||
END
|
END
|
||||||
|
|
||||||
3 TEXTINCLUDE
|
3 TEXTINCLUDE
|
||||||
BEGIN
|
BEGIN
|
||||||
"\r\n"
|
"\r\n"
|
||||||
"\0"
|
"\0"
|
||||||
END
|
END
|
||||||
|
|
||||||
#endif // APSTUDIO_INVOKED
|
#endif // APSTUDIO_INVOKED
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// Icon
|
// Icon
|
||||||
@ -60,8 +53,7 @@ END
|
|||||||
// Icon with lowest ID value placed first to ensure application icon
|
// Icon with lowest ID value placed first to ensure application icon
|
||||||
// remains consistent on all systems.
|
// remains consistent on all systems.
|
||||||
IDI_CMDER ICON "..\\..\\icons\\cmder.ico"
|
IDI_CMDER ICON "..\\..\\icons\\cmder.ico"
|
||||||
#endif // English (United States) resources
|
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
@ -69,26 +61,30 @@ IDI_CMDER ICON "..\\..\\icons\\cmder.ico"
|
|||||||
//
|
//
|
||||||
|
|
||||||
VS_VERSION_INFO VERSIONINFO
|
VS_VERSION_INFO VERSIONINFO
|
||||||
FILEVERSION CMDER_MAJOR_VERSION,CMDER_MINOR_VERSION,CMDER_REVISION_VERSION,CMDER_BUILD_VERSION
|
FILEVERSION 1,3,6,1
|
||||||
PRODUCTVERSION CMDER_MAJOR_VERSION,CMDER_MINOR_VERSION,CMDER_REVISION_VERSION,CMDER_BUILD_VERSION
|
PRODUCTVERSION 1,3,6,1
|
||||||
FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
|
FILEFLAGSMASK 0x3fL
|
||||||
FILEFLAGS (CMDER_DEBUGFLAG | CMDER_BUILDFLAGS)
|
#ifdef _DEBUG
|
||||||
FILEOS VOS_NT_WINDOWS32
|
FILEFLAGS 0x1L
|
||||||
FILETYPE VFT_APP
|
#else
|
||||||
FILESUBTYPE VFT2_UNKNOWN
|
FILEFLAGS 0x0L
|
||||||
|
#endif
|
||||||
|
FILEOS 0x40004L
|
||||||
|
FILETYPE 0x1L
|
||||||
|
FILESUBTYPE 0x0L
|
||||||
BEGIN
|
BEGIN
|
||||||
BLOCK "StringFileInfo"
|
BLOCK "StringFileInfo"
|
||||||
BEGIN
|
BEGIN
|
||||||
BLOCK "100904b0"
|
BLOCK "100904b0"
|
||||||
BEGIN
|
BEGIN
|
||||||
VALUE "CompanyName", CMDER_COMPANY_NAME_STR "\0"
|
VALUE "CompanyName", "Samuel Vasko"
|
||||||
VALUE "FileDescription", CMDER_FILE_DESCRIPTION_STR "\0"
|
VALUE "FileDescription", "Cmder: Lovely Console Emulator."
|
||||||
VALUE "FileVersion", CMDER_VERSION_STR "\0"
|
VALUE "FileVersion", "1.3.6-pre1"
|
||||||
VALUE "InternalName", CMDER_INTERNAL_NAME_STR "\0"
|
VALUE "InternalName", "Cmder"
|
||||||
VALUE "LegalCopyright", "Copyright (C) " CMDER_COPYRIGHT_YEAR_STR " " CMDER_COMPANY_NAME_STR "\0"
|
VALUE "LegalCopyright", "Copyright (C) 2016 Samuel Vasko"
|
||||||
VALUE "OriginalFilename", CMDER_ORIGINAL_FILENAME_STR "\0"
|
VALUE "OriginalFilename", "Cmder.exe"
|
||||||
VALUE "ProductName", CMDER_PRODUCT_NAME_STR "\0"
|
VALUE "ProductName", "Cmder"
|
||||||
VALUE "ProductVersion", CMDER_VERSION_STR "\0"
|
VALUE "ProductVersion", "1.3.6-pre1"
|
||||||
END
|
END
|
||||||
END
|
END
|
||||||
BLOCK "VarFileInfo"
|
BLOCK "VarFileInfo"
|
||||||
@ -97,7 +93,26 @@ BEGIN
|
|||||||
END
|
END
|
||||||
END
|
END
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// String Table
|
||||||
|
//
|
||||||
|
|
||||||
|
STRINGTABLE
|
||||||
|
BEGIN
|
||||||
|
IDS_TITLE "Cmder Launcher"
|
||||||
|
END
|
||||||
|
|
||||||
|
STRINGTABLE
|
||||||
|
BEGIN
|
||||||
|
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]"
|
||||||
|
END
|
||||||
|
|
||||||
|
#endif // English (United States) resources
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef APSTUDIO_INVOKED
|
#ifndef APSTUDIO_INVOKED
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
@ -105,5 +120,7 @@ END
|
|||||||
// Generated from the TEXTINCLUDE 3 resource.
|
// Generated from the TEXTINCLUDE 3 resource.
|
||||||
//
|
//
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
#endif // not APSTUDIO_INVOKED
|
#endif // not APSTUDIO_INVOKED
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user