diff --git a/.github/workflows/msbuild.yml b/.github/workflows/msbuild.yml
index 0945871..ac3718b 100644
--- a/.github/workflows/msbuild.yml
+++ b/.github/workflows/msbuild.yml
@@ -44,8 +44,8 @@ jobs:
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
- name: artifact-${{matrix.configuration}}-${{matrix.platform}}
- path: D:\a\Shell\Shell\src\bin\release\*
+ name: shell-${{matrix.platform}}
+ path: D:\a\Shell\Shell\src\bin\*
if-no-files-found: warn
retention-days: 0
compression-level: 6
diff --git a/README.md b/README.md
index 31545c9..d971938 100644
--- a/README.md
+++ b/README.md
@@ -1,7 +1,7 @@
[](https://techforpalestine.org/learn-more)
[](../../actions/workflows/msbuild.yml)
-[](https://nightly.link/moudey/Shell/workflows/msbuild/main)
+[](https://nightly.link/moudey/Shell/workflows/msbuild/main)
# [Shell](https://nilesoft.org)
Powerful manager for Windows File Explorer context menu.
diff --git a/src/bin/debug.cmd b/src/bin/debug.cmd
index 3dac5f1..59fb143 100644
--- a/src/bin/debug.cmd
+++ b/src/bin/debug.cmd
@@ -9,7 +9,7 @@ set MM=%date:~4,2%
set DD=%date:~7,2%
set YYYY=%date:~10,4%
-set PLATFORM=release\x64
+set PLATFORM=x64
set dt=%YYYY%%MM%%DD%%TH%%TM%%TS%
set build=%YYYY%%MM%%DD%
@@ -20,7 +20,7 @@ set build=%YYYY%%MM%%DD%
:: Unregistering the Shell Extension.
::echo Proceeding with the Shell Extension unregistration.
echo.
-echo Shell version 1.9 build 18 %date% %time%
+echo Shell version 1.9 build 19 %date% %time%
echo.
cd /d %~dp0
diff --git a/src/dll/Shell.vcxproj b/src/dll/Shell.vcxproj
index 3149dd6..b980feb 100644
--- a/src/dll/Shell.vcxproj
+++ b/src/dll/Shell.vcxproj
@@ -13,18 +13,6 @@
release
ARM64
-
- debug
- ARM64
-
-
- debug
- Win32
-
-
- debug
- x64
-
16.0
@@ -37,7 +25,7 @@
shell
.dll
false
- $(SolutionDir)bin\$(Configuration.ToLower())\$(Platform.ToLower().Replace('win32', 'x86'))\
+ $(SolutionDir)bin\$(Platform.ToLower().Replace('win32', 'x86'))\
$(ProjectDir)obj\$(Configuration.ToLower())\
DynamicLibrary
v143
@@ -45,9 +33,6 @@
NativeRecommendedRules.ruleset
-
- true
-
false
true
@@ -68,9 +53,6 @@
$(SolutionDir)shared\Library;$(LibraryPath)
$(ProjectDir)src;$(ProjectDir)src\include;$(IncludePath)
-
- true
-
false
@@ -118,24 +100,6 @@
$(OutDir)$(TargetName)$(TargetExt).bsc
-
-
- _DEBUG;%(PreprocessorDefinitions)
- MultiThreadedDebug
- EditAndContinue
- Default
-
-
- true
-
-
- _DEBUG;%(PreprocessorDefinitions)
-
-
- PowerShell.exe -NoProfile -NonInteractive -NoLogo -ExecutionPolicy Bypass -FILE "$(SolutionDir)tools\version\version.ps1"
- Generating version number...
-
-
true
diff --git a/src/exe/exe.vcxproj b/src/exe/exe.vcxproj
index 0aa9cd4..512b660 100644
--- a/src/exe/exe.vcxproj
+++ b/src/exe/exe.vcxproj
@@ -1,18 +1,6 @@
-
- debug
- ARM64
-
-
- debug
- Win32
-
-
- debug
- x64
-
release
ARM64
@@ -39,7 +27,7 @@
Application
v143
Unicode
- $(SolutionDir)bin\$(Configuration.ToLower())\$(Platform.ToLower().Replace('win32', 'x86'))\
+ $(SolutionDir)bin\$(Platform.ToLower().Replace('win32', 'x86'))\
$(ProjectDir)obj\$(Configuration.ToLower())\
false
@@ -63,9 +51,6 @@
false
-
- true
-
@@ -107,21 +92,6 @@
6.1
-
-
- _DEBUG;DEBUG;%(PreprocessorDefinitions)
- EditAndContinue
- Disabled
- MultiThreadedDebug
-
-
- true
-
-
- _DEBUG;DEBUG;%(PreprocessorDefinitions)
- false
-
-
NDEBUG;%(PreprocessorDefinitions)
diff --git a/src/setup/build.cmd b/src/setup/build.cmd
index 05657e7..ed4faa5 100644
--- a/src/setup/build.cmd
+++ b/src/setup/build.cmd
@@ -3,6 +3,7 @@
echo build setup...
echo.
+cd wix
set arch=%~1
set bin=..\..\bin
diff --git a/src/setup/ca/ca.vcxproj b/src/setup/ca/ca.vcxproj
index e78c1b4..8c36c71 100644
--- a/src/setup/ca/ca.vcxproj
+++ b/src/setup/ca/ca.vcxproj
@@ -17,12 +17,12 @@
{F72D34CA-48DA-4DFD-91A9-A0C78BEF6981}
DynamicLibrary
- ca_$(Platform.ToLower().Replace('win32', 'x86'))
+ ca
Unicode
ca.def
WiX Toolset CustomAction
10.0
- $(SolutionDir)bin\
+ $(SolutionDir)bin\$(Platform.ToLower().Replace('win32', 'x86'))\
$(ProjectDir)obj\$(Configuration.ToLower())\
diff --git a/src/setup/wix/setup.wxs b/src/setup/wix/setup.wxs
index 286a481..380ab15 100644
--- a/src/setup/wix/setup.wxs
+++ b/src/setup/wix/setup.wxs
@@ -1,15 +1,14 @@
-
+
+
-
-
-
+
+
diff --git a/src/setup/wix/var.wxi b/src/setup/wix/var.wxi
new file mode 100644
index 0000000..4bd2bf5
--- /dev/null
+++ b/src/setup/wix/var.wxi
@@ -0,0 +1,4 @@
+
+
+
+
diff --git a/src/shared/RegistryConfig.h b/src/shared/RegistryConfig.h
index 5eda2a0..19d93cc 100644
--- a/src/shared/RegistryConfig.h
+++ b/src/shared/RegistryConfig.h
@@ -2,14 +2,17 @@
namespace Nilesoft
{
- static const auto REG_REGISTER = 0x01;
- static const auto REG_UNREGISTER = 0x02;
- static const auto REG_TREAT = 0x04;
- static const auto REG_CONTEXTMENU = 0x08;
- static const auto REG_FOLDEREXTENSIONS = 0x16;
- static const auto REG_ICONOVERLAY = 0x32;
- static const auto REG_RESTART = 0x64;
- static const auto REG_SILENT = 0x128;
+ struct REGOP
+ {
+ bool REGISTER;
+ bool UNREGISTER;
+ bool TREAT;
+ bool CONTEXTMENU;
+ bool FOLDEREXTENSIONS;
+ bool ICONOVERLAY;
+ bool RESTART;
+ bool SILENT;
+ };
class RegistryConfig
{
@@ -98,7 +101,7 @@ namespace Nilesoft
}
// Require admininstrator's rights!
- static bool Register(const wchar_t *dllPath, int fReg = REG_REGISTER | REG_CONTEXTMENU)
+ static bool Register(const wchar_t *dllPath, REGOP reg)
{
if(!dllPath || !dllPath[0])
return false;
@@ -108,7 +111,7 @@ namespace Nilesoft
int ret = 0;
- if(fReg & REG_FOLDEREXTENSIONS)
+ if(reg.FOLDEREXTENSIONS)
{
if(RegisterInprocServer(dllPath, CLS_FolderExtensions, APP_COMP_NAME))
{
@@ -128,7 +131,7 @@ namespace Nilesoft
}
}
- if(fReg & REG_ICONOVERLAY)
+ if(reg.ICONOVERLAY)
{
// register COM-object for overlay icon handler
if(RegisterInprocServer(dllPath, CLS_IconOverlay, APP_COMP_NAME))
@@ -138,7 +141,7 @@ namespace Nilesoft
}
}
- if(fReg & REG_CONTEXTMENU)
+ if(reg.CONTEXTMENU)
{
// register COM-object for shortcut menu handler
if(RegisterInprocServer(dllPath, CLS_ContextMenu, APP_COMP_NAME))
diff --git a/src/shared/Resource.h b/src/shared/Resource.h
index dda0541..a159bf6 100644
--- a/src/shared/Resource.h
+++ b/src/shared/Resource.h
@@ -2,7 +2,7 @@
#define VERSION_MAJOR 1
#define VERSION_MINOR 9
-#define VERSION_BUILD 17
+#define VERSION_BUILD 19
#define VERSION_REV 0
#define VERSION_YEAR 2024
@@ -33,8 +33,8 @@ namespace Nilesoft
#define APP_FILENAME_TITLE L"shell"
#define APP_PRODUCT_VERSION L"1.9"
-#define APP_VERSION L"1.9.17"
-//#define APP_VERSION_FULL L"1.9 build 17"
+#define APP_VERSION L"1.9.19"
+//#define APP_VERSION_FULL L"1.9 build 19"
constexpr auto APP_EMAIL = L"support@nilesoft.org";
constexpr auto APP_WEBSITE = L"www.nilesoft.org";
diff --git a/src/shared/Resource/manifest.xml b/src/shared/Resource/manifest.xml
index 035286c..2d15968 100644
--- a/src/shared/Resource/manifest.xml
+++ b/src/shared/Resource/manifest.xml
@@ -1,7 +1,7 @@
hProcess, INFINITE);
+ if(processInfo.hThread)
+ ::CloseHandle(processInfo.hThread);
+ if(processInfo.hProcess)
+ ::CloseHandle(processInfo.hProcess);
- return result != 0;
+ return result;
}
static BOOL Start(const wchar_t* application, const wchar_t* parameters,
- const wchar_t* directory = nullptr, bool wait = false, int showCmd = SW_SHOWNORMAL)
+ const wchar_t* directory, bool wait, int showCmd)
{
- PROCESS_INFORMATION process = { 0 };
- if(!Start(application, parameters, directory, showCmd, wait, &process))
+ PROCESS_INFORMATION processInfo = { };
+ if(!Start(application, parameters, directory, showCmd, &processInfo))
return FALSE;
+ // Wait until child process exits.
+ if(wait && processInfo.hProcess)
+ ::WaitForSingleObject(processInfo.hProcess, INFINITE);
+
// Close process and thread handles.
- if(process.hThread != nullptr)
- ::CloseHandle(process.hThread);
- if(process.hProcess != nullptr)
- ::CloseHandle(process.hProcess);
+ if(processInfo.hThread)
+ ::CloseHandle(processInfo.hThread);
+ if(processInfo.hProcess)
+ ::CloseHandle(processInfo.hProcess);
+
return TRUE;
}
+ static BOOL Start(const wchar_t *application, const wchar_t *parameters,
+ const wchar_t *directory, int showCmd,
+ LPPROCESS_INFORMATION processInfo)
+ {
+
+ STARTUPINFOW startupInfo = { };
+ startupInfo.cb = sizeof(STARTUPINFOW);
+ startupInfo.wShowWindow = (WORD)showCmd;
+ startupInfo.dwFlags = STARTF_USESHOWWINDOW;
+ string commandLine = parameters;
+ /*
+ if(application && parameters)
+ commandLine.format(L"\"%s\" %s", application, parameters);
+ */
+ return ::CreateProcessW(application,
+ commandLine, nullptr, nullptr, FALSE,
+ NORMAL_PRIORITY_CLASS,
+ nullptr, directory,
+ &startupInfo, processInfo);
+ }
+
static uint32_t EnumId(std::vector *lphProcesses)
{
uint32_t count = 0;
diff --git a/src/shared/System/Windows/Windows.h b/src/shared/System/Windows/Windows.h
index d5c6650..c47a91d 100644
--- a/src/shared/System/Windows/Windows.h
+++ b/src/shared/System/Windows/Windows.h
@@ -335,6 +335,13 @@ namespace Nilesoft
::SendInput(1, &ip, sizeof(INPUT));
}
+ // https://stackoverflow.com/questions/5689904/gracefully-exit-explorer-programmatically
+ static BOOL Exit()
+ {
+ auto hWndTray = ::FindWindowExW(nullptr, nullptr, L"Shell_TrayWnd", nullptr);
+ return hWndTray ? ::PostMessageW(hWndTray, 0x5B4, 0, 0) : FALSE;
+ }
+
static void Refresh(bool all_windows = false)
{
//PostMessageW(::GetActiveWindow(), WM_KEYDOWN, VK_F5, NULL);
@@ -366,18 +373,18 @@ namespace Nilesoft
string params, cmd = sys_path;
cmd += L"\\cmd.exe";
params.format(L"/c taskkill /f /im explorer.exe && start %s\\explorer", win_path);
- ::ShellExecute(nullptr, nullptr, cmd, params, nullptr, SW_HIDE);
+ ::ShellExecuteW(nullptr, nullptr, cmd, params, nullptr, SW_HIDE);
//WinExec("taskkill /f /im explorer.exe && start explorer.exe", SW_HIDE);
return res > 0;
}
-
+
for(auto &process : Nilesoft::Diagnostics::Process::EnumInfo())
{
- if(process.th32ProcessID != 0)
+ if(process.th32ProcessID)
{
if(string::Equals(process.szExeFile, L"explorer.exe"))
{
- if(auto hProcess = ::OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_VM_READ | PROCESS_TERMINATE, FALSE,
+ if(auto hProcess = ::OpenProcess(PROCESS_TERMINATE, FALSE,
process.th32ProcessID); hProcess)
{
res += ::TerminateProcess(hProcess, 0);
@@ -389,6 +396,22 @@ namespace Nilesoft
return res > 0;
}
+ static bool Restart0()
+ {
+ if(auto hShell_TrayWnd = Window::FindTaskbar(); hShell_TrayWnd)
+ {
+ DWORD dwProcessId = 0;
+ if(::GetWindowThreadProcessId(hShell_TrayWnd, &dwProcessId) && dwProcessId)
+ {
+ if(auto hProcess = ::OpenProcess(PROCESS_TERMINATE, FALSE, dwProcessId); hProcess)
+ {
+ return ::TerminateProcess(hProcess, 0);
+ }
+ }
+ }
+ return false;
+ }
+
static bool Restart1()
{
if(auto hShell_TrayWnd = Window::FindTaskbar(); hShell_TrayWnd)
@@ -400,7 +423,6 @@ namespace Nilesoft
{
if(::TerminateProcess(hProcess, 0))
{
-
/*::Sleep(2000);
hShell_TrayWnd = Window::FindTaskbar();
if(!hShell_TrayWnd)
diff --git a/src/tools/version/Manifest1.xml b/src/tools/version/Manifest1.xml
deleted file mode 100644
index b7e2d3d..0000000
--- a/src/tools/version/Manifest1.xml
+++ /dev/null
@@ -1,45 +0,0 @@
-
-
-
-Inno Setup
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- true
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/tools/version/var.wxi b/src/tools/version/var.wxi
new file mode 100644
index 0000000..36ea287
--- /dev/null
+++ b/src/tools/version/var.wxi
@@ -0,0 +1,4 @@
+
+
+
+
diff --git a/src/tools/version/version-debug.cmd b/src/tools/version/version-debug.cmd
deleted file mode 100644
index 46b82d4..0000000
--- a/src/tools/version/version-debug.cmd
+++ /dev/null
@@ -1,5 +0,0 @@
-@echo off
-::PowerShell.exe -ExecutionPolicy Unrestricted -FILE version.ps1
-::PowerShell.exe -ExecutionPolicy Bypass -FILE version.ps1
-cd %~dp0
-PowerShell.exe -NoProfile -NonInteractive -NoLogo -ExecutionPolicy Bypass -FILE version.ps1
\ No newline at end of file
diff --git a/src/tools/version/version.ps1 b/src/tools/version/version.ps1
index c607e34..f79923c 100644
--- a/src/tools/version/version.ps1
+++ b/src/tools/version/version.ps1
@@ -75,10 +75,10 @@ function update-regex($content, $key, $val)
try
{
- $ChangeBuild = 1
+ $ChangeBuild = 0
$ChangeRevis = 0
- $___Build__ = 17 # auto increase
+ $___Build__ = 19 # auto increase
$___Revis__ = 0 # auto increase
$AppCompany = "Nilesoft"
@@ -118,6 +118,7 @@ try
#update "Shell.rc" "..\..\shared\Resource\Shell.rc";
update "manifest.xml" "..\..\shared\Resource\manifest.xml";
update "Shell.def" "..\..\dll\src\Shell.def";
+ update "var.wxi" "..\..\setup\wix\var.wxi";
update "debug.cmd" "..\..\bin\debug.cmd";
$content = (Get-Content $ScriptPath)