|
@ -270,26 +270,28 @@ Var nppSubStr
|
|||
|
||||
${MementoSection} "Context Menu Entry" explorerContextMenu
|
||||
|
||||
${If} $WinVer == "11"
|
||||
SetOverwrite try
|
||||
SetOutPath "$INSTDIR\contextmenu\"
|
||||
|
||||
; Clean up the hack of v8.5 installer
|
||||
ReadRegStr $muiVerbStr HKLM "SOFTWARE\Classes\*\shell\pintohome" MUIVerb
|
||||
${StrStr} $nppSubStr $muiVerbStr "Notepad++"
|
||||
; Make sure there's an entry, and the entry belong to Notepad++ before deleting it
|
||||
${If} $muiVerbStr != ""
|
||||
${AndIf} $nppSubStr != "" ; it contains "Notepad++"
|
||||
DeleteRegKey HKLM "SOFTWARE\Classes\*\shell\pintohome"
|
||||
!ifdef ARCH64
|
||||
File /oname=$INSTDIR\contextmenu\NppShell.msix "..\bin64\NppShell.msix"
|
||||
File /oname=$INSTDIR\contextmenu\NppShell.dll "..\bin64\NppShell.x64.dll"
|
||||
!else ifdef ARCHARM64
|
||||
File /oname=$INSTDIR\contextmenu\NppShell.msix "..\binarm64\NppShell.msix"
|
||||
File /oname=$INSTDIR\contextmenu\NppShell.dll "..\binarm64\NppShell.arm64.dll"
|
||||
!else
|
||||
; We need to test which arch we are running on, since 32bit exe can be run on both 32bit and 64bit Windows.
|
||||
${If} ${RunningX64}
|
||||
; We are running on 64bit Windows, so we need the msix as well, since it might be Windows 11.
|
||||
File /oname=$INSTDIR\contextmenu\NppShell.msix "..\bin64\NppShell.msix"
|
||||
File /oname=$INSTDIR\contextmenu\NppShell.dll "..\bin64\NppShell.x64.dll"
|
||||
${Else}
|
||||
; We are running on 32bit Windows, so no need for the msix file, since there is no way this could even be upgraded to Windows 11.
|
||||
File /oname=$INSTDIR\contextmenu\NppShell.dll "..\bin\NppShell.x86.dll"
|
||||
${EndIf}
|
||||
|
||||
; Install the new Windows 11 "Edit with Notepad++" menu entry
|
||||
!ifdef ARCHARM64
|
||||
File /oname=$INSTDIR\NppModernShell.msix "..\binarm64\NppModernShell.msix"
|
||||
File /oname=$INSTDIR\NppModernShell.dll "..\binarm64\NppModernShell.dll"
|
||||
!else ; !ifdef ARCH64
|
||||
File /oname=$INSTDIR\NppModernShell.msix "..\bin64\NppModernShell.msix"
|
||||
File /oname=$INSTDIR\NppModernShell.dll "..\bin64\NppModernShell.dll"
|
||||
!endif
|
||||
Exec 'rundll32.exe "$INSTDIR\NppModernShell.dll",RegisterSparsePackage'
|
||||
Exec 'regsvr32 /s "$INSTDIR\contextmenu\NppShell.dll"'
|
||||
|
||||
; Make sure old NppShell dll's are unregistered and removed
|
||||
Exec 'regsvr32 /u /s "$INSTDIR\NppShell_01.dll"'
|
||||
|
@ -305,30 +307,6 @@ ${MementoSection} "Context Menu Entry" explorerContextMenu
|
|||
Delete "$INSTDIR\NppShell_05.dll"
|
||||
Delete "$INSTDIR\NppShell_06.dll"
|
||||
|
||||
${Else} ; the old "Edit with Notepad++" menu entry still works under Windows 10 and previous OS
|
||||
|
||||
SetOverwrite try
|
||||
SetOutPath "$INSTDIR\"
|
||||
|
||||
; There is no need to keep x86 NppShell_06.dll in 64 bit installer
|
||||
; But in 32bit installer both the Dlls are required
|
||||
; As user can install 32bit npp version on x64 bit machine, that time x64 bit NppShell is required.
|
||||
|
||||
!ifdef ARCH64
|
||||
File /oname=$INSTDIR\NppShell_06.dll "..\bin\NppShell64_06.dll"
|
||||
!else ifdef ARCHARM64
|
||||
File /oname=$INSTDIR\NppShell_06.dll "..\binarm64\NppShell64.dll"
|
||||
!else
|
||||
${If} ${RunningX64}
|
||||
File /oname=$INSTDIR\NppShell_06.dll "..\bin\NppShell64_06.dll"
|
||||
${Else}
|
||||
File "..\bin\NppShell_06.dll"
|
||||
${EndIf}
|
||||
!endif
|
||||
Exec 'regsvr32 /s "$INSTDIR\NppShell_06.dll"'
|
||||
|
||||
${EndIf}
|
||||
|
||||
${MementoSectionEnd}
|
||||
|
||||
${MementoSectionDone}
|
||||
|
|
|
@ -43,11 +43,13 @@ Function un.onUninstSuccess
|
|||
RMDir "$INSTDIR\autoCompletion\"
|
||||
RMDir "$INSTDIR\functionList\"
|
||||
RMDir "$INSTDIR\themes\"
|
||||
RMDir "$INSTDIR\contextmenu\"
|
||||
RMDir "$INSTDIR\"
|
||||
|
||||
RMDir "$APPDATA\${APPNAME}\plugins\"
|
||||
RMDir "$installPath\themes\" ; if files are kept because of $keepUserData, this will not be deleted
|
||||
RMDir "$installPath\userDefineLangs\"
|
||||
RMDir "$installPath\contextmenu\"
|
||||
RMDir "$installPath\"
|
||||
FunctionEnd
|
||||
|
||||
|
@ -72,19 +74,9 @@ Section un.explorerContextMenu
|
|||
Delete "$INSTDIR\NppShell_05.dll"
|
||||
Delete "$INSTDIR\NppShell_06.dll"
|
||||
|
||||
Exec 'rundll32.exe "$INSTDIR\NppModernShell.dll",UnregisterSparsePackage'
|
||||
;Delete "$INSTDIR\NppModernShell.dll"
|
||||
;Delete "$INSTDIR\NppModernShell.msix"
|
||||
|
||||
ReadRegStr $muiVerbStrUn HKLM "SOFTWARE\Classes\*\shell\pintohome" MUIVerb
|
||||
${UnStrStr} $nppSubStrUn $muiVerbStrUn "Notepad++"
|
||||
|
||||
; Make sure there's an entry, and the entry belong to Notepad++ before deleting it
|
||||
${If} $muiVerbStrUn != ""
|
||||
${AndIf} $nppSubStrUn != "" ; it contains "Notepad++"
|
||||
DeleteRegKey HKLM "SOFTWARE\Classes\*\shell\pintohome"
|
||||
|
||||
${EndIf}
|
||||
Exec 'regsvr32 /u /s "$INSTDIR\contextmenu\NppShell.dll"'
|
||||
;Delete "$INSTDIR\contextmenu\NppShell.dll"
|
||||
;Delete "$INSTDIR\contextmenu\NppShell.msix"
|
||||
SectionEnd
|
||||
|
||||
Section un.UnregisterFileExt
|
||||
|
@ -306,9 +298,9 @@ Section Uninstall
|
|||
${endIf}
|
||||
|
||||
; In order to not delete context menu binary before we unregistered it,
|
||||
; we delete them at the end
|
||||
Delete "$INSTDIR\NppModernShell.dll"
|
||||
Delete "$INSTDIR\NppModernShell.msix"
|
||||
; we delete them at the end, using the CleanupDll function, since it can be locked by explorer.
|
||||
Exec 'rundll32.exe "$INSTDIR\contextmenu\NppShell.dll",CleanupDll'
|
||||
Delete "$INSTDIR\contextmenu\NppShell.msix"
|
||||
|
||||
|
||||
; Remove remaining directories
|
||||
|
@ -318,6 +310,7 @@ Section Uninstall
|
|||
RMDir "$INSTDIR\themes\"
|
||||
RMDir "$INSTDIR\localization\"
|
||||
RMDir "$INSTDIR\functionList\"
|
||||
RMDir "$INSTDIR\contextmenu\"
|
||||
RMDir "$INSTDIR\"
|
||||
RMDir "$SMPROGRAMS\${APPNAME}"
|
||||
|
||||
|
|
|
@ -33,20 +33,15 @@ If ErrorLevel 1 goto End
|
|||
%signArmBinary% ..\binarm64\notepad++.exe
|
||||
If ErrorLevel 1 goto End
|
||||
|
||||
%signBinary% ..\bin\NppShell_06.dll
|
||||
%signBinary% ..\bin\NppShell.x86.dll
|
||||
If ErrorLevel 1 goto End
|
||||
%signBinary% ..\bin\NppShell64_06.dll
|
||||
%signBinary% ..\bin64\NppShell.msix
|
||||
If ErrorLevel 1 goto End
|
||||
%signArmBinary% ..\binarm64\NppShell64.dll
|
||||
%signBinary% ..\bin64\NppShell.x64.dll
|
||||
If ErrorLevel 1 goto End
|
||||
|
||||
%signBinary% ..\bin64\NppModernShell.msix
|
||||
%signBinary% ..\binarm64\NppShell.msix
|
||||
If ErrorLevel 1 goto End
|
||||
%signBinary% ..\bin64\NppModernShell.dll
|
||||
If ErrorLevel 1 goto End
|
||||
%signBinary% ..\binarm64\NppModernShell.msix
|
||||
If ErrorLevel 1 goto End
|
||||
%signArmBinary% ..\binarm64\NppModernShell.dll
|
||||
%signArmBinary% ..\binarm64\NppShell.arm64.dll
|
||||
If ErrorLevel 1 goto End
|
||||
|
||||
%signBinary% ..\bin\plugins\Config\nppPluginList.dll
|
||||
|
|
|
@ -1,2 +0,0 @@
|
|||
packages
|
||||
Packaging/NppModernShell.msix
|
|
@ -1,35 +0,0 @@
|
|||
#include "pch.h"
|
||||
#include "CommandHandlerFactory.h"
|
||||
|
||||
#include "EditWithNppExplorerCommandHandler.h"
|
||||
|
||||
using namespace NppModernShell::CommandHandlers;
|
||||
using namespace NppModernShell::Factories;
|
||||
|
||||
IFACEMETHODIMP CommandHandlerFactory::CreateInstance(_In_opt_ IUnknown* pUnkOuter, _In_ REFIID riid, _COM_Outptr_ void** ppvObject) noexcept
|
||||
{
|
||||
UNREFERENCED_PARAMETER(pUnkOuter);
|
||||
|
||||
try
|
||||
{
|
||||
return winrt::make<EditWithNppExplorerCommandHandler>()->QueryInterface(riid, ppvObject);
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
return winrt::to_hresult();
|
||||
}
|
||||
}
|
||||
|
||||
IFACEMETHODIMP CommandHandlerFactory::LockServer(_In_ BOOL fLock) noexcept
|
||||
{
|
||||
if (fLock)
|
||||
{
|
||||
++winrt::get_module_lock();
|
||||
}
|
||||
else
|
||||
{
|
||||
--winrt::get_module_lock();
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
|
@ -1,12 +0,0 @@
|
|||
#pragma once
|
||||
#include "pch.h"
|
||||
|
||||
namespace NppModernShell::Factories
|
||||
{
|
||||
class __declspec(uuid("4EACAA14-3B43-4595-A44C-FBA8F0848620")) CommandHandlerFactory : public winrt::implements<NppModernShell::Factories::CommandHandlerFactory, IClassFactory>
|
||||
{
|
||||
public:
|
||||
IFACEMETHODIMP CreateInstance(_In_opt_ IUnknown* pUnkOuter, _In_ REFIID riid, _COM_Outptr_ void** ppvObject) noexcept override;
|
||||
IFACEMETHODIMP LockServer(_In_ BOOL fLock) noexcept override;
|
||||
};
|
||||
}
|
|
@ -1,78 +0,0 @@
|
|||
#include "pch.h"
|
||||
#include "EditWithNppExplorerCommandHandler.h"
|
||||
|
||||
#include "Helpers.h"
|
||||
|
||||
using namespace NppModernShell::CommandHandlers;
|
||||
using namespace NppModernShell::Helpers;
|
||||
|
||||
const wstring EditWithNppExplorerCommandHandler::GetNppExecutableFullPath()
|
||||
{
|
||||
const wstring path = GetInstallationPath();
|
||||
const wstring fileName = L"\\notepad++.exe";
|
||||
|
||||
return L"\"" + path + fileName + L"\"";
|
||||
}
|
||||
|
||||
const wstring EditWithNppExplorerCommandHandler::Title()
|
||||
{
|
||||
return L"Edit with Notepad++";
|
||||
}
|
||||
|
||||
const wstring EditWithNppExplorerCommandHandler::Icon()
|
||||
{
|
||||
const wstring fileName = GetNppExecutableFullPath();
|
||||
|
||||
return fileName;
|
||||
}
|
||||
|
||||
const wstring EditWithNppExplorerCommandHandler::GetCommandLine()
|
||||
{
|
||||
const wstring fileName = GetNppExecutableFullPath();
|
||||
const wstring parameters = L"\"%1\"";
|
||||
|
||||
return fileName + L" " + parameters;
|
||||
}
|
||||
|
||||
IFACEMETHODIMP EditWithNppExplorerCommandHandler::Invoke(_In_opt_ IShellItemArray* selection, _In_opt_ IBindCtx*) noexcept try
|
||||
{
|
||||
if (!selection)
|
||||
{
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
DWORD count;
|
||||
RETURN_IF_FAILED(selection->GetCount(&count));
|
||||
|
||||
IShellItem* psi;
|
||||
LPWSTR itemName;
|
||||
|
||||
for (DWORD i = 0; i < count; ++i)
|
||||
{
|
||||
selection->GetItemAt(i, &psi);
|
||||
RETURN_IF_FAILED(psi->GetDisplayName(SIGDN_FILESYSPATH, &itemName));
|
||||
|
||||
std::wstring cmdline = this->GetCommandLine();
|
||||
cmdline = cmdline.replace(cmdline.find(L"%1"), 2, itemName);
|
||||
|
||||
STARTUPINFO si;
|
||||
PROCESS_INFORMATION pi;
|
||||
|
||||
ZeroMemory(&si, sizeof(si));
|
||||
si.cb = sizeof(si);
|
||||
ZeroMemory(&pi, sizeof(pi));
|
||||
|
||||
wchar_t* command = (LPWSTR)cmdline.c_str();
|
||||
|
||||
if (!CreateProcess(nullptr, command, nullptr, nullptr, false, CREATE_NEW_PROCESS_GROUP, nullptr, nullptr, &si, &pi))
|
||||
{
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
CloseHandle(pi.hProcess);
|
||||
CloseHandle(pi.hThread);
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
CATCH_RETURN();
|
|
@ -1,20 +0,0 @@
|
|||
#pragma once
|
||||
#include "pch.h"
|
||||
|
||||
#include "ExplorerCommandBase.h"
|
||||
|
||||
namespace NppModernShell::CommandHandlers
|
||||
{
|
||||
class EditWithNppExplorerCommandHandler : public ExplorerCommandBase
|
||||
{
|
||||
public:
|
||||
const wstring Title() override;
|
||||
const wstring Icon() override;
|
||||
|
||||
IFACEMETHODIMP Invoke(_In_opt_ IShellItemArray* selection, _In_opt_ IBindCtx*) noexcept override;
|
||||
|
||||
private:
|
||||
const wstring GetNppExecutableFullPath();
|
||||
const wstring GetCommandLine();
|
||||
};
|
||||
}
|
|
@ -1,68 +0,0 @@
|
|||
#include "pch.h"
|
||||
#include "ExplorerCommandBase.h"
|
||||
|
||||
using namespace NppModernShell::CommandHandlers;
|
||||
|
||||
const EXPCMDFLAGS ExplorerCommandBase::Flags()
|
||||
{
|
||||
return ECF_DEFAULT;
|
||||
}
|
||||
|
||||
const EXPCMDSTATE ExplorerCommandBase::State(_In_opt_ IShellItemArray* selection)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(selection);
|
||||
|
||||
return ECS_ENABLED;
|
||||
}
|
||||
|
||||
IFACEMETHODIMP ExplorerCommandBase::GetTitle(_In_opt_ IShellItemArray* items, _Outptr_result_nullonfailure_ PWSTR* name)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(items);
|
||||
|
||||
*name = nullptr;
|
||||
auto str = wil::make_cotaskmem_string_nothrow(Title().c_str());
|
||||
RETURN_IF_NULL_ALLOC(str);
|
||||
*name = str.release();
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
IFACEMETHODIMP ExplorerCommandBase::GetIcon(_In_opt_ IShellItemArray*, _Outptr_result_nullonfailure_ PWSTR* icon)
|
||||
{
|
||||
*icon = nullptr;
|
||||
auto str = wil::make_cotaskmem_string_nothrow(Icon().c_str());
|
||||
RETURN_IF_NULL_ALLOC(str);
|
||||
*icon = str.release();
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
IFACEMETHODIMP ExplorerCommandBase::GetToolTip(_In_opt_ IShellItemArray*, _Outptr_result_nullonfailure_ PWSTR* infoTip)
|
||||
{
|
||||
*infoTip = nullptr;
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
IFACEMETHODIMP ExplorerCommandBase::GetState(_In_opt_ IShellItemArray* selection, _In_ BOOL okToBeSlow, _Out_ EXPCMDSTATE* cmdState)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(okToBeSlow);
|
||||
|
||||
*cmdState = State(selection);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
IFACEMETHODIMP ExplorerCommandBase::GetFlags(_Out_ EXPCMDFLAGS* flags)
|
||||
{
|
||||
*flags = Flags();
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
IFACEMETHODIMP ExplorerCommandBase::GetCanonicalName(_Out_ GUID* guidCommandName)
|
||||
{
|
||||
*guidCommandName = GUID_NULL;
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
IFACEMETHODIMP ExplorerCommandBase::EnumSubCommands(_COM_Outptr_ IEnumExplorerCommand** enumCommands)
|
||||
{
|
||||
*enumCommands = nullptr;
|
||||
return E_NOTIMPL;
|
||||
}
|
|
@ -1,24 +0,0 @@
|
|||
#pragma once
|
||||
#include "pch.h"
|
||||
|
||||
namespace NppModernShell::CommandHandlers
|
||||
{
|
||||
class ExplorerCommandBase : public winrt::implements<ExplorerCommandBase, IExplorerCommand>
|
||||
{
|
||||
public:
|
||||
virtual const wstring Title() = 0;
|
||||
virtual const wstring Icon() = 0;
|
||||
virtual const EXPCMDFLAGS Flags();
|
||||
virtual const EXPCMDSTATE State(_In_opt_ IShellItemArray* selection);
|
||||
|
||||
IFACEMETHODIMP GetTitle(_In_opt_ IShellItemArray* items, _Outptr_result_nullonfailure_ PWSTR* name);
|
||||
IFACEMETHODIMP GetIcon(_In_opt_ IShellItemArray*, _Outptr_result_nullonfailure_ PWSTR* icon);
|
||||
IFACEMETHODIMP GetToolTip(_In_opt_ IShellItemArray*, _Outptr_result_nullonfailure_ PWSTR* infoTip);
|
||||
IFACEMETHODIMP GetState(_In_opt_ IShellItemArray* selection, _In_ BOOL okToBeSlow, _Out_ EXPCMDSTATE* cmdState);
|
||||
IFACEMETHODIMP GetFlags(_Out_ EXPCMDFLAGS* flags);
|
||||
IFACEMETHODIMP GetCanonicalName(_Out_ GUID* guidCommandName);
|
||||
IFACEMETHODIMP EnumSubCommands(_COM_Outptr_ IEnumExplorerCommand** enumCommands);
|
||||
|
||||
virtual IFACEMETHODIMP Invoke(_In_opt_ IShellItemArray* selection, _In_opt_ IBindCtx*) noexcept = 0;
|
||||
};
|
||||
}
|
|
@ -1,27 +0,0 @@
|
|||
#include "pch.h"
|
||||
#include "Helpers.h"
|
||||
|
||||
using namespace NppModernShell::Helpers;
|
||||
|
||||
const HMODULE GetThisModule()
|
||||
{
|
||||
HMODULE hm = NULL;
|
||||
|
||||
BOOL result = GetModuleHandleEx(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS | GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT, (LPCWSTR)&GetInstallationPath, &hm);
|
||||
|
||||
if (result == FALSE)
|
||||
{
|
||||
throw "Failed to locate current module, unable to proceed";
|
||||
}
|
||||
|
||||
return hm;
|
||||
}
|
||||
|
||||
const wstring NppModernShell::Helpers::GetInstallationPath()
|
||||
{
|
||||
HMODULE thisModule = GetThisModule();
|
||||
|
||||
wchar_t path[FILENAME_MAX] = { 0 };
|
||||
GetModuleFileName(thisModule, path, FILENAME_MAX);
|
||||
return std::filesystem::path(path).parent_path().wstring();
|
||||
}
|
|
@ -1,9 +0,0 @@
|
|||
#pragma once
|
||||
#include "pch.h"
|
||||
|
||||
#include <filesystem>
|
||||
|
||||
namespace NppModernShell::Helpers
|
||||
{
|
||||
const wstring GetInstallationPath();
|
||||
}
|
|
@ -1,72 +0,0 @@
|
|||
#include "pch.h"
|
||||
#include "Installer.h"
|
||||
|
||||
using namespace winrt::Windows::ApplicationModel;
|
||||
using namespace winrt::Windows::Foundation;
|
||||
using namespace winrt::Windows::Foundation::Collections;
|
||||
using namespace winrt::Windows::Management::Deployment;
|
||||
|
||||
using namespace NppModernShell::Helpers;
|
||||
using namespace NppModernShell::Installer;
|
||||
|
||||
const wstring SparsePackageName = L"NotepadPlusPlus";
|
||||
|
||||
STDAPI NppModernShell::Installer::RegisterSparsePackage()
|
||||
{
|
||||
PackageManager packageManager;
|
||||
AddPackageOptions options;
|
||||
|
||||
const wstring externalLocation = GetInstallationPath();
|
||||
const wstring sparsePkgPath = externalLocation + L"\\NppModernShell.msix";
|
||||
|
||||
Uri externalUri(externalLocation);
|
||||
Uri packageUri(sparsePkgPath);
|
||||
|
||||
options.ExternalLocationUri(externalUri);
|
||||
|
||||
auto deploymentOperation = packageManager.AddPackageByUriAsync(packageUri, options);
|
||||
auto deployResult = deploymentOperation.get();
|
||||
|
||||
if (!SUCCEEDED(deployResult.ExtendedErrorCode()))
|
||||
{
|
||||
return deployResult.ExtendedErrorCode();
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDAPI NppModernShell::Installer::UnregisterSparsePackage()
|
||||
{
|
||||
PackageManager packageManager;
|
||||
IIterable<Package> packages;
|
||||
|
||||
try
|
||||
{
|
||||
packages = packageManager.FindPackagesForUser(L"");
|
||||
}
|
||||
catch (winrt::hresult_error const& ex)
|
||||
{
|
||||
return ex.code();
|
||||
}
|
||||
|
||||
for (const Package& package : packages)
|
||||
{
|
||||
if (package.Id().Name() != SparsePackageName)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
winrt::hstring fullName = package.Id().FullName();
|
||||
auto deploymentOperation = packageManager.RemovePackageAsync(fullName, RemovalOptions::None);
|
||||
auto deployResult = deploymentOperation.get();
|
||||
|
||||
if (!SUCCEEDED(deployResult.ExtendedErrorCode()))
|
||||
{
|
||||
return deployResult.ExtendedErrorCode();
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
|
@ -1,10 +0,0 @@
|
|||
#pragma once
|
||||
#include "pch.h"
|
||||
|
||||
#include "Helpers.h"
|
||||
|
||||
namespace NppModernShell::Installer
|
||||
{
|
||||
STDAPI RegisterSparsePackage();
|
||||
STDAPI UnregisterSparsePackage();
|
||||
}
|
|
@ -1,39 +0,0 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.5.33414.496
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "NppModernShell", "NppModernShell.vcxproj", "{E7539F55-2932-47D0-82B8-46ED5AFCA1C0}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Packaging", "Packaging", "{B9E2DBFF-8940-482F-9D07-BA9C4EAE7620}"
|
||||
ProjectSection(SolutionItems) = preProject
|
||||
Packaging\AppxManifest.xml = Packaging\AppxManifest.xml
|
||||
Packaging\Square150x150Logo.png = Packaging\Square150x150Logo.png
|
||||
Packaging\Square44x44Logo.png = Packaging\Square44x44Logo.png
|
||||
Packaging\StoreLogo.png = Packaging\StoreLogo.png
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|ARM64 = Debug|ARM64
|
||||
Debug|x64 = Debug|x64
|
||||
Release|ARM64 = Release|ARM64
|
||||
Release|x64 = Release|x64
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{E7539F55-2932-47D0-82B8-46ED5AFCA1C0}.Debug|ARM64.ActiveCfg = Debug|ARM64
|
||||
{E7539F55-2932-47D0-82B8-46ED5AFCA1C0}.Debug|ARM64.Build.0 = Debug|ARM64
|
||||
{E7539F55-2932-47D0-82B8-46ED5AFCA1C0}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{E7539F55-2932-47D0-82B8-46ED5AFCA1C0}.Debug|x64.Build.0 = Debug|x64
|
||||
{E7539F55-2932-47D0-82B8-46ED5AFCA1C0}.Release|ARM64.ActiveCfg = Release|ARM64
|
||||
{E7539F55-2932-47D0-82B8-46ED5AFCA1C0}.Release|ARM64.Build.0 = Release|ARM64
|
||||
{E7539F55-2932-47D0-82B8-46ED5AFCA1C0}.Release|x64.ActiveCfg = Release|x64
|
||||
{E7539F55-2932-47D0-82B8-46ED5AFCA1C0}.Release|x64.Build.0 = Release|x64
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {EAA0AA08-253D-435A-929E-9214D1E358CB}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
|
@ -1,210 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|ARM64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>ARM64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|ARM64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>ARM64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<VCProjectVersion>16.0</VCProjectVersion>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<ProjectGuid>{e7539f55-2932-47d0-82b8-46ed5afca1c0}</ProjectGuid>
|
||||
<RootNamespace>NppModernShell</RootNamespace>
|
||||
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="Shared">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>_DEBUG;NPPMODERNSHELL_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
|
||||
<LanguageStandard>stdcpp20</LanguageStandard>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableUAC>false</EnableUAC>
|
||||
<AdditionalDependencies>shlwapi.lib;runtimeobject.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<ModuleDefinitionFile>source.def</ModuleDefinitionFile>
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
<Command>makeappx pack /d .\Packaging /p $(OutDir)NppModernShell.msix /nv</Command>
|
||||
</PostBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>_DEBUG;NPPMODERNSHELL_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
|
||||
<LanguageStandard>stdcpp20</LanguageStandard>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableUAC>false</EnableUAC>
|
||||
<AdditionalDependencies>shlwapi.lib;runtimeobject.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<ModuleDefinitionFile>source.def</ModuleDefinitionFile>
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
<Command>makeappx pack /d .\Packaging /p $(OutDir)NppModernShell.msix /nv</Command>
|
||||
</PostBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>NDEBUG;NPPMODERNSHELL_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
|
||||
<LanguageStandard>stdcpp20</LanguageStandard>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableUAC>false</EnableUAC>
|
||||
<AdditionalDependencies>shlwapi.lib;runtimeobject.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<ModuleDefinitionFile>source.def</ModuleDefinitionFile>
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
<Command>makeappx pack /d .\Packaging /p $(OutDir)NppModernShell.msix /nv</Command>
|
||||
</PostBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>NDEBUG;NPPMODERNSHELL_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
|
||||
<LanguageStandard>stdcpp20</LanguageStandard>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableUAC>false</EnableUAC>
|
||||
<AdditionalDependencies>shlwapi.lib;runtimeobject.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<ModuleDefinitionFile>source.def</ModuleDefinitionFile>
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
<Command>makeappx pack /d .\Packaging /p $(OutDir)NppModernShell.msix /nv</Command>
|
||||
</PostBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="EditWithNppExplorerCommandHandler.h" />
|
||||
<ClInclude Include="ExplorerCommandBase.h" />
|
||||
<ClInclude Include="CommandHandlerFactory.h" />
|
||||
<ClInclude Include="framework.h" />
|
||||
<ClInclude Include="Helpers.h" />
|
||||
<ClInclude Include="Installer.h" />
|
||||
<ClInclude Include="pch.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="CommandHandlerFactory.cpp" />
|
||||
<ClCompile Include="dllmain.cpp" />
|
||||
<ClCompile Include="EditWithNppExplorerCommandHandler.cpp" />
|
||||
<ClCompile Include="ExplorerCommandBase.cpp" />
|
||||
<ClCompile Include="Helpers.cpp" />
|
||||
<ClCompile Include="Installer.cpp" />
|
||||
<ClCompile Include="pch.cpp">
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">Create</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="packages.config" />
|
||||
<None Include="source.def" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
<Import Project="packages\Microsoft.Windows.ImplementationLibrary.1.0.230202.1\build\native\Microsoft.Windows.ImplementationLibrary.targets" Condition="Exists('packages\Microsoft.Windows.ImplementationLibrary.1.0.230202.1\build\native\Microsoft.Windows.ImplementationLibrary.targets')" />
|
||||
</ImportGroup>
|
||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||
<PropertyGroup>
|
||||
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
|
||||
</PropertyGroup>
|
||||
<Error Condition="!Exists('packages\Microsoft.Windows.ImplementationLibrary.1.0.230202.1\build\native\Microsoft.Windows.ImplementationLibrary.targets')" Text="$([System.String]::Format('$(ErrorText)', 'packages\Microsoft.Windows.ImplementationLibrary.1.0.230202.1\build\native\Microsoft.Windows.ImplementationLibrary.targets'))" />
|
||||
</Target>
|
||||
</Project>
|
|
@ -1,55 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="CommandHandlers">
|
||||
<UniqueIdentifier>{ff31b0d8-bf03-4a28-945d-cfae6eb365fa}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Factories">
|
||||
<UniqueIdentifier>{3ce00d49-8c93-43bf-8d92-00c9b7087776}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Installer">
|
||||
<UniqueIdentifier>{ca898efe-24d8-4317-99c9-769e8e80c3aa}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="EditWithNppExplorerCommandHandler.h">
|
||||
<Filter>CommandHandlers</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="ExplorerCommandBase.h">
|
||||
<Filter>CommandHandlers</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Installer.h">
|
||||
<Filter>Installer</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="CommandHandlerFactory.h">
|
||||
<Filter>Factories</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="pch.h" />
|
||||
<ClInclude Include="Helpers.h" />
|
||||
<ClInclude Include="framework.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="EditWithNppExplorerCommandHandler.cpp">
|
||||
<Filter>CommandHandlers</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="ExplorerCommandBase.cpp">
|
||||
<Filter>CommandHandlers</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Installer.cpp">
|
||||
<Filter>Installer</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="dllmain.cpp" />
|
||||
<ClCompile Include="Helpers.cpp" />
|
||||
<ClCompile Include="pch.cpp" />
|
||||
<ClCompile Include="CommandHandlerFactory.cpp">
|
||||
<Filter>Factories</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="packages.config" />
|
||||
<None Include="source.def" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Natvis Include="$(MSBuildThisFileDirectory)..\..\natvis\wil.natvis" />
|
||||
</ItemGroup>
|
||||
</Project>
|
|
@ -1,50 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Package
|
||||
xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10"
|
||||
xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10"
|
||||
xmlns:uap2="http://schemas.microsoft.com/appx/manifest/uap/windows10/2"
|
||||
xmlns:uap3="http://schemas.microsoft.com/appx/manifest/uap/windows10/3"
|
||||
xmlns:rescap="http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities"
|
||||
xmlns:desktop="http://schemas.microsoft.com/appx/manifest/desktop/windows10"
|
||||
xmlns:desktop4="http://schemas.microsoft.com/appx/manifest/desktop/windows10/4"
|
||||
xmlns:desktop5="http://schemas.microsoft.com/appx/manifest/desktop/windows10/5"
|
||||
xmlns:uap10="http://schemas.microsoft.com/appx/manifest/uap/windows10/10"
|
||||
xmlns:com="http://schemas.microsoft.com/appx/manifest/com/windows10"
|
||||
IgnorableNamespaces="uap uap2 uap3 rescap desktop desktop4 desktop5 uap10 com">
|
||||
<Identity Name="NotepadPlusPlus" ProcessorArchitecture="neutral" Publisher="CN="Notepad++", O="Notepad++", L=Saint Cloud, S=Ile-de-France, C=FR" Version="1.0.0.0" />
|
||||
<Properties>
|
||||
<DisplayName>Notepad++</DisplayName>
|
||||
<PublisherDisplayName>Notepad++</PublisherDisplayName>
|
||||
<Logo>StoreLogo.png</Logo>
|
||||
<uap10:AllowExternalContent>true</uap10:AllowExternalContent>
|
||||
</Properties>
|
||||
<Dependencies>
|
||||
<TargetDeviceFamily Name="Windows.Desktop" MinVersion="10.0.22000.0" MaxVersionTested="10.0.22621.0" />
|
||||
</Dependencies>
|
||||
<Capabilities>
|
||||
<rescap:Capability Name="runFullTrust" />
|
||||
<rescap:Capability Name="unvirtualizedResources"/>
|
||||
</Capabilities>
|
||||
<Applications>
|
||||
<Application Id="NotepadPlusPlus" Executable="notepad++.exe" uap10:TrustLevel="mediumIL" uap10:RuntimeBehavior="win32App">
|
||||
<uap:VisualElements AppListEntry="none" DisplayName="Notepad++" Description="Notepad++" BackgroundColor="transparent" Square150x150Logo="Square150x150Logo.png" Square44x44Logo="Square44x44Logo.png">
|
||||
</uap:VisualElements>
|
||||
<Extensions>
|
||||
<desktop4:Extension Category="windows.fileExplorerContextMenus">
|
||||
<desktop4:FileExplorerContextMenus>
|
||||
<desktop5:ItemType Type="*">
|
||||
<desktop5:Verb Id="EditWithNotepadPlusPlus" Clsid="4EACAA14-3B43-4595-A44C-FBA8F0848620" />
|
||||
</desktop5:ItemType>
|
||||
</desktop4:FileExplorerContextMenus>
|
||||
</desktop4:Extension>
|
||||
<com:Extension Category="windows.comServer">
|
||||
<com:ComServer>
|
||||
<com:SurrogateServer DisplayName="Notepad++ Shell Extension">
|
||||
<com:Class Id="4EACAA14-3B43-4595-A44C-FBA8F0848620" Path="NppModernShell.dll" ThreadingModel="STA"/>
|
||||
</com:SurrogateServer>
|
||||
</com:ComServer>
|
||||
</com:Extension>
|
||||
</Extensions>
|
||||
</Application>
|
||||
</Applications>
|
||||
</Package>
|
Before Width: | Height: | Size: 38 KiB |
Before Width: | Height: | Size: 4.5 KiB |
Before Width: | Height: | Size: 4.9 KiB |
|
@ -1,68 +0,0 @@
|
|||
# Windows 11 Modern UI Context Menu integration
|
||||
|
||||
The purpose of this project is to allow Notepad++ to integrate into the new Windows 11 right-click context menu.
|
||||
Doing this requires two new things.
|
||||
|
||||
* A dll library with some COM objects that the shell can communicate with.
|
||||
* A Sparse Package containing the metadata for the COM server.
|
||||
|
||||
To build this, the following steps needs to be taken:
|
||||
|
||||
1. Build a Release dll file (NppModernShell.dll)
|
||||
2. Generate a Sparse Package (NppModernShell.msix)
|
||||
3. Sign both of these with signtool.exe
|
||||
4. Make sure they are included in the installer, so they are deployed next to the notepad++.exe program.
|
||||
5. The installer should, upon installation, install the package.
|
||||
6. The installer should, upon uninstallation, uninstall the package.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
To be able to build this project, the following is needed:
|
||||
|
||||
* [Visual Studio 2022](https://visualstudio.microsoft.com/vs)
|
||||
* [Windows 11 SDK](https://developer.microsoft.com/en-us/windows/downloads/windows-sdk)
|
||||
|
||||
## Build a Release dll file (NppModernShell.dll)
|
||||
Just open the NppModernShell.sln Visual Studio solution, select Release as the build type, and do a Rebuild of the solution.
|
||||
|
||||
## Generate a Sparse Package (NppModernShell.msix)
|
||||
To generate a Sparse Package, you need to have the makeappx.exe tool in your PATH, the easiest way to do this is to run the `Developer Command Prompt for VS 2022` command prompt, since it sets up the path.
|
||||
Once inside the NppModernShell folder, run the following command to generate the Sparse Package:
|
||||
```
|
||||
makeappx pack /d .\Packaging /p .\NppModernShell.msix /nv
|
||||
```
|
||||
This takes the content of the Packaging directory, and packages them up into the msix file.
|
||||
|
||||
## Sign both of these with signtool.exe
|
||||
Now we have both the `NppModernShell.dll` and `NppModernShell.msix` files, we need to sign them with a valid certificate.
|
||||
To do this, once again run the `Developer Command Prompt for VS 2022` command prompt and change to the NppModernShell folder.
|
||||
The following command expects the following:
|
||||
* The pfx certificate is called MyCert.pfx
|
||||
* The password for the pfx certificate is: `Test1234`
|
||||
|
||||
Make the needed changes to match the real certificate.
|
||||
```
|
||||
SignTool.exe sign /fd SHA256 /tr http://timestamp.digicert.com /td sha256 /a /f .\MyCert.pfx /p Test1234 /d "Notepad++" /du https://notepad-plus-plus.org/ NppModernShell.msix
|
||||
SignTool.exe sign /fd SHA256 /tr http://timestamp.digicert.com /td sha256 /a /f .\MyCert.pfx /p Test1234 /d "Notepad++" /du https://notepad-plus-plus.org/ x64\Release\NppModernShell.dll
|
||||
```
|
||||
Now both files has been signed, and can be used.
|
||||
|
||||
## Make sure they are included in the installer, so they are deployed next to the notepad++.exe program.
|
||||
The installer needs to deploy the two files into the same directory as notepad++.exe .
|
||||
They need to be there, since the DLL is looking for notepad++.exe in the same directory as it is located itself.
|
||||
|
||||
## The installer should, upon installation, install the package.
|
||||
When the installer is running, after all the files has been copied into the program files directory, the follow command should be be run to run the register function to register the package:
|
||||
```
|
||||
rundll32.exe .\NppModernShell.dll,RegisterSparsePackage
|
||||
```
|
||||
|
||||
Remember to wait for the rundll32 process to exit before continuing.
|
||||
|
||||
## The installer should, upon uninstallation, uninstall the package.
|
||||
When the uninstaller is running, it should run this command to unregister the package:
|
||||
```
|
||||
rundll32.exe .\NppModernShell.dll,UnregisterSparsePackage
|
||||
```
|
||||
|
||||
Here we need to wait for rundll32 to finish, since if it isn't finished, the dll file will be locked by explorer.
|
|
@ -1,62 +0,0 @@
|
|||
#include "pch.h"
|
||||
|
||||
#include "CommandHandlerFactory.h"
|
||||
|
||||
using namespace NppModernShell::Factories;
|
||||
|
||||
BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(hModule);
|
||||
UNREFERENCED_PARAMETER(lpReserved);
|
||||
|
||||
switch (ul_reason_for_call)
|
||||
{
|
||||
case DLL_PROCESS_ATTACH:
|
||||
case DLL_THREAD_ATTACH:
|
||||
case DLL_THREAD_DETACH:
|
||||
case DLL_PROCESS_DETACH:
|
||||
break;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
__control_entrypoint(DllExport)
|
||||
STDAPI DllCanUnloadNow(void)
|
||||
{
|
||||
if (winrt::get_module_lock())
|
||||
{
|
||||
return S_FALSE;
|
||||
}
|
||||
|
||||
winrt::clear_factory_cache();
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
_Check_return_
|
||||
STDAPI DllGetClassObject(_In_ REFCLSID rclsid, _In_ REFIID riid, _Outptr_ LPVOID FAR* ppv)
|
||||
{
|
||||
if (!ppv)
|
||||
{
|
||||
return E_POINTER;
|
||||
}
|
||||
|
||||
if (riid != IID_IClassFactory && riid != IID_IUnknown)
|
||||
{
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
|
||||
if (rclsid != __uuidof(CommandHandlerFactory))
|
||||
{
|
||||
return E_INVALIDARG;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
return winrt::make<CommandHandlerFactory>()->QueryInterface(riid, ppv);
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
return winrt::to_hresult();
|
||||
}
|
||||
}
|
|
@ -1,16 +0,0 @@
|
|||
#pragma once
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
|
||||
// Windows Header Files
|
||||
#include <windows.h>
|
||||
#include <shlwapi.h>
|
||||
#include <shobjidl_core.h>
|
||||
|
||||
// WinRT Header Files
|
||||
#include <winrt/base.h>
|
||||
#include <winrt/Windows.ApplicationModel.h>
|
||||
#include <winrt/Windows.Foundation.Collections.h>
|
||||
#include <winrt/Windows.Management.Deployment.h>
|
||||
|
||||
// Windows Implementation Library Header Files
|
||||
#include "wil\winrt.h"
|
|
@ -1,4 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Microsoft.Windows.ImplementationLibrary" version="1.0.230202.1" targetFramework="native" />
|
||||
</packages>
|
|
@ -1,5 +0,0 @@
|
|||
// pch.cpp: source file corresponding to the pre-compiled header
|
||||
|
||||
#include "pch.h"
|
||||
|
||||
// When you are using pre-compiled headers, this source file is necessary for compilation to succeed.
|
|
@ -1,15 +0,0 @@
|
|||
// pch.h: This is a precompiled header file.
|
||||
// Files listed below are compiled only once, improving build performance for future builds.
|
||||
// This also affects IntelliSense performance, including code completion and many code browsing features.
|
||||
// However, files listed here are ALL re-compiled if any one of them is updated between builds.
|
||||
// Do not add files here that you will be updating frequently as this negates the performance advantage.
|
||||
|
||||
#ifndef PCH_H
|
||||
#define PCH_H
|
||||
|
||||
// add headers that you want to pre-compile here
|
||||
#include "framework.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
#endif //PCH_H
|
|
@ -1,6 +0,0 @@
|
|||
LIBRARY
|
||||
EXPORTS
|
||||
DllCanUnloadNow PRIVATE
|
||||
DllGetClassObject PRIVATE
|
||||
RegisterSparsePackage
|
||||
UnregisterSparsePackage
|
|
@ -1,37 +0,0 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 15
|
||||
VisualStudioVersion = 15.0.28307.779
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "NppShell", "NppShell.vcxproj", "{509B95C6-043E-4389-8351-77BDB042A6F9}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|ARM64 = Debug|ARM64
|
||||
Debug|Win32 = Debug|Win32
|
||||
Debug|x64 = Debug|x64
|
||||
Release|ARM64 = Release|ARM64
|
||||
Release|Win32 = Release|Win32
|
||||
Release|x64 = Release|x64
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{509B95C6-043E-4389-8351-77BDB042A6F9}.Debug|ARM64.ActiveCfg = Debug|ARM64
|
||||
{509B95C6-043E-4389-8351-77BDB042A6F9}.Debug|ARM64.Build.0 = Debug|ARM64
|
||||
{509B95C6-043E-4389-8351-77BDB042A6F9}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{509B95C6-043E-4389-8351-77BDB042A6F9}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{509B95C6-043E-4389-8351-77BDB042A6F9}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{509B95C6-043E-4389-8351-77BDB042A6F9}.Debug|x64.Build.0 = Debug|x64
|
||||
{509B95C6-043E-4389-8351-77BDB042A6F9}.Release|ARM64.ActiveCfg = Release|ARM64
|
||||
{509B95C6-043E-4389-8351-77BDB042A6F9}.Release|ARM64.Build.0 = Release|ARM64
|
||||
{509B95C6-043E-4389-8351-77BDB042A6F9}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{509B95C6-043E-4389-8351-77BDB042A6F9}.Release|Win32.Build.0 = Release|Win32
|
||||
{509B95C6-043E-4389-8351-77BDB042A6F9}.Release|x64.ActiveCfg = Release|x64
|
||||
{509B95C6-043E-4389-8351-77BDB042A6F9}.Release|x64.Build.0 = Release|x64
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {B94274A0-9BB1-48E0-BED3-971CBCAF0052}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
|
@ -1,336 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|ARM64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>ARM64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|ARM64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>ARM64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{509B95C6-043E-4389-8351-77BDB042A6F9}</ProjectGuid>
|
||||
<RootNamespace>NppShell</RootNamespace>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup>
|
||||
<_ProjectFileVersion>15.0.28307.799</_ProjectFileVersion>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<OutDir>.\..\build_$(Platform)\$(Configuration)\</OutDir>
|
||||
<IntDir>.\..\build_$(Platform)\$(Configuration)\</IntDir>
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<OutDir>.\..\build_$(Platform)\$(Configuration)\</OutDir>
|
||||
<IntDir>.\..\build_$(Platform)\$(Configuration)\</IntDir>
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">
|
||||
<OutDir>.\..\build_$(Platform)\$(Configuration)\</OutDir>
|
||||
<IntDir>.\..\build_$(Platform)\$(Configuration)\</IntDir>
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<OutDir>.\..\build_$(Platform)\$(Configuration)\</OutDir>
|
||||
<IntDir>.\..\build_$(Platform)\$(Configuration)\</IntDir>
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<OutDir>.\..\build_$(Platform)\$(Configuration)\</OutDir>
|
||||
<IntDir>.\..\build_$(Platform)\$(Configuration)\</IntDir>
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">
|
||||
<OutDir>.\..\build_$(Platform)\$(Configuration)\</OutDir>
|
||||
<IntDir>.\..\build_$(Platform)\$(Configuration)\</IntDir>
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MinimalRebuild>true</MinimalRebuild>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||
<PrecompiledHeader />
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<TreatWarningAsError>false</TreatWarningAsError>
|
||||
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>shell32.lib;comctl32.lib;shlwapi.lib;msimg32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<OutputFile>$(OutDir)..\$(ProjectName)_D.dll</OutputFile>
|
||||
<ModuleDefinitionFile>..\src\export.def</ModuleDefinitionFile>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<BaseAddress>0x1C000000</BaseAddress>
|
||||
<RandomizedBaseAddress>false</RandomizedBaseAddress>
|
||||
<DataExecutionPrevention />
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<Midl>
|
||||
<TargetEnvironment>X64</TargetEnvironment>
|
||||
</Midl>
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>WIN32;WIN64;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MinimalRebuild>true</MinimalRebuild>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||
<PrecompiledHeader />
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<TreatWarningAsError>false</TreatWarningAsError>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>_VC80_UPGRADE=0x0710;WIN64;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ResourceCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>shell32.lib;comctl32.lib;shlwapi.lib;msimg32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<OutputFile>$(OutDir)..\$(ProjectName)64_D.dll</OutputFile>
|
||||
<ModuleDefinitionFile>..\src\export.def</ModuleDefinitionFile>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<BaseAddress>0x1C000000</BaseAddress>
|
||||
<RandomizedBaseAddress>false</RandomizedBaseAddress>
|
||||
<DataExecutionPrevention />
|
||||
<TargetMachine>MachineX64</TargetMachine>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">
|
||||
<Midl />
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>WIN32;WIN64;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MinimalRebuild>true</MinimalRebuild>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<TreatWarningAsError>false</TreatWarningAsError>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>_VC80_UPGRADE=0x0710;WIN64;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ResourceCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>shell32.lib;comctl32.lib;shlwapi.lib;msimg32.lib;gdi32.lib;advapi32.lib;ole32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<OutputFile>$(OutDir)..\$(ProjectName)64_D.dll</OutputFile>
|
||||
<ModuleDefinitionFile>..\src\export.def</ModuleDefinitionFile>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<BaseAddress>0x1C000000</BaseAddress>
|
||||
<RandomizedBaseAddress>false</RandomizedBaseAddress>
|
||||
<DataExecutionPrevention>
|
||||
</DataExecutionPrevention>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
|
||||
<PreprocessorDefinitions>WIN32;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<StringPooling>true</StringPooling>
|
||||
<ExceptionHandling />
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<BufferSecurityCheck>false</BufferSecurityCheck>
|
||||
<PrecompiledHeader />
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<TreatWarningAsError>false</TreatWarningAsError>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>shell32.lib;comctl32.lib;shlwapi.lib;msimg32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<OutputFile>$(OutDir)..\$(ProjectName).dll</OutputFile>
|
||||
<AdditionalLibraryDirectories>.\..\src\libs;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<ModuleDefinitionFile>..\src\export.def</ModuleDefinitionFile>
|
||||
<GenerateDebugInformation>false</GenerateDebugInformation>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<RandomizedBaseAddress>false</RandomizedBaseAddress>
|
||||
<DataExecutionPrevention />
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<Midl>
|
||||
<TargetEnvironment>X64</TargetEnvironment>
|
||||
</Midl>
|
||||
<ClCompile>
|
||||
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
|
||||
<PreprocessorDefinitions>WIN32;WIN64;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<StringPooling>true</StringPooling>
|
||||
<ExceptionHandling />
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<BufferSecurityCheck>false</BufferSecurityCheck>
|
||||
<PrecompiledHeader />
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<TreatWarningAsError>false</TreatWarningAsError>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>_VC80_UPGRADE=0x0710;WIN64;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ResourceCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>shell32.lib;comctl32.lib;shlwapi.lib;msimg32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<OutputFile>$(OutDir)..\$(ProjectName)64.dll</OutputFile>
|
||||
<AdditionalLibraryDirectories>.\..\src\libs;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
|
||||
<ModuleDefinitionFile>..\src\export.def</ModuleDefinitionFile>
|
||||
<GenerateDebugInformation>false</GenerateDebugInformation>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<RandomizedBaseAddress>false</RandomizedBaseAddress>
|
||||
<DataExecutionPrevention />
|
||||
<TargetMachine>MachineX64</TargetMachine>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">
|
||||
<Midl />
|
||||
<ClCompile>
|
||||
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
|
||||
<PreprocessorDefinitions>WIN32;WIN64;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<StringPooling>true</StringPooling>
|
||||
<ExceptionHandling>
|
||||
</ExceptionHandling>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<BufferSecurityCheck>false</BufferSecurityCheck>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<TreatWarningAsError>false</TreatWarningAsError>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>_VC80_UPGRADE=0x0710;WIN64;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ResourceCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>shell32.lib;comctl32.lib;shlwapi.lib;msimg32.lib;gdi32.lib;advapi32.lib;ole32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<OutputFile>$(OutDir)..\$(ProjectName)64.dll</OutputFile>
|
||||
<AdditionalLibraryDirectories>.\..\src\libs;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
|
||||
<ModuleDefinitionFile>..\src\export.def</ModuleDefinitionFile>
|
||||
<GenerateDebugInformation>false</GenerateDebugInformation>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<RandomizedBaseAddress>true</RandomizedBaseAddress>
|
||||
<DataExecutionPrevention>
|
||||
</DataExecutionPrevention>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\src\Bitmap.cpp" />
|
||||
<ClCompile Include="..\src\NppShell.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="..\src\export.def" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\src\Bitmap.h" />
|
||||
<ClInclude Include="..\src\NppShell.h" />
|
||||
<ClInclude Include="..\src\resource.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Image Include="..\src\bitmap\npp.bmp" />
|
||||
<Image Include="..\src\icon\npp.ico" />
|
||||
<Image Include="..\src\icon\npp_0.ico" />
|
||||
<Image Include="..\src\icon\npp_1.ico" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="..\src\NppShell.rc" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Text Include="..\doc\license.txt" />
|
||||
<Text Include="..\doc\readme.txt" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
|
@ -1,301 +0,0 @@
|
|||
//From: Visual Style Menus in MSDN
|
||||
|
||||
#include "Bitmap.h"
|
||||
|
||||
HMODULE hUxTheme = NULL;
|
||||
FN_GetBufferedPaintBits pfnGetBufferedPaintBits = NULL;
|
||||
FN_BeginBufferedPaint pfnBeginBufferedPaint = NULL;
|
||||
FN_EndBufferedPaint pfnEndBufferedPaint = NULL;
|
||||
|
||||
bool InitTheming() {
|
||||
hUxTheme = ::LoadLibrary(TEXT("UxTheme.dll"));
|
||||
if (hUxTheme == NULL)
|
||||
return false;
|
||||
pfnGetBufferedPaintBits = (FN_GetBufferedPaintBits)::GetProcAddress(hUxTheme, "GetBufferedPaintBits");
|
||||
pfnBeginBufferedPaint = (FN_BeginBufferedPaint)::GetProcAddress(hUxTheme, "BeginBufferedPaint");
|
||||
pfnEndBufferedPaint = (FN_EndBufferedPaint)::GetProcAddress(hUxTheme, "EndBufferedPaint");
|
||||
if ((pfnGetBufferedPaintBits == NULL) || (pfnBeginBufferedPaint == NULL) || (pfnEndBufferedPaint == NULL)) {
|
||||
pfnGetBufferedPaintBits = NULL;
|
||||
pfnBeginBufferedPaint = NULL;
|
||||
pfnEndBufferedPaint = NULL;
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool DeinitTheming() {
|
||||
pfnGetBufferedPaintBits = NULL;
|
||||
pfnBeginBufferedPaint = NULL;
|
||||
pfnEndBufferedPaint = NULL;
|
||||
FreeLibrary(hUxTheme);
|
||||
hUxTheme = NULL;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void InitBitmapInfo(BITMAPINFO *pbmi, ULONG cbInfo, LONG cx, LONG cy, WORD bpp)
|
||||
{
|
||||
ZeroMemory(pbmi, cbInfo);
|
||||
pbmi->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
|
||||
pbmi->bmiHeader.biPlanes = 1;
|
||||
pbmi->bmiHeader.biCompression = BI_RGB;
|
||||
|
||||
pbmi->bmiHeader.biWidth = cx;
|
||||
pbmi->bmiHeader.biHeight = cy;
|
||||
pbmi->bmiHeader.biBitCount = bpp;
|
||||
}
|
||||
|
||||
HRESULT Create32BitHBITMAP(HDC hdc, const SIZE *psize, void **ppvBits, HBITMAP* phBmp)
|
||||
{
|
||||
*phBmp = NULL;
|
||||
|
||||
BITMAPINFO bmi;
|
||||
InitBitmapInfo(&bmi, sizeof(bmi), psize->cx, psize->cy, 32);
|
||||
|
||||
HDC hdcUsed = hdc ? hdc : GetDC(NULL);
|
||||
if (hdcUsed)
|
||||
{
|
||||
*phBmp = CreateDIBSection(hdcUsed, &bmi, DIB_RGB_COLORS, ppvBits, NULL, 0);
|
||||
if (hdc != hdcUsed)
|
||||
{
|
||||
ReleaseDC(NULL, hdcUsed);
|
||||
}
|
||||
}
|
||||
return (NULL == *phBmp) ? E_OUTOFMEMORY : S_OK;
|
||||
}
|
||||
|
||||
HRESULT ConvertToPARGB32(HDC hdc, ARGB *pargb, HBITMAP hbmp, SIZE& sizImage, int cxRow)
|
||||
{
|
||||
BITMAPINFO bmi;
|
||||
InitBitmapInfo(&bmi, sizeof(bmi), sizImage.cx, sizImage.cy, 32);
|
||||
|
||||
HRESULT hr = E_OUTOFMEMORY;
|
||||
HANDLE hHeap = GetProcessHeap();
|
||||
void *pvBits = HeapAlloc(hHeap, 0, bmi.bmiHeader.biWidth * 4 * bmi.bmiHeader.biHeight);
|
||||
if (pvBits)
|
||||
{
|
||||
hr = E_UNEXPECTED;
|
||||
if (GetDIBits(hdc, hbmp, 0, bmi.bmiHeader.biHeight, pvBits, &bmi, DIB_RGB_COLORS) == bmi.bmiHeader.biHeight)
|
||||
{
|
||||
ULONG cxDelta = cxRow - bmi.bmiHeader.biWidth;
|
||||
ARGB *pargbMask = static_cast<ARGB *>(pvBits);
|
||||
|
||||
for (ULONG y = bmi.bmiHeader.biHeight; y; --y)
|
||||
{
|
||||
for (ULONG x = bmi.bmiHeader.biWidth; x; --x)
|
||||
{
|
||||
if (*pargbMask++)
|
||||
{
|
||||
// transparent pixel
|
||||
*pargb++ = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
// opaque pixel
|
||||
*pargb++ |= 0xFF000000;
|
||||
}
|
||||
}
|
||||
|
||||
pargb += cxDelta;
|
||||
}
|
||||
|
||||
hr = S_OK;
|
||||
}
|
||||
|
||||
HeapFree(hHeap, 0, pvBits);
|
||||
}
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
bool HasAlpha(ARGB *pargb, SIZE& sizImage, int cxRow)
|
||||
{
|
||||
ULONG cxDelta = cxRow - sizImage.cx;
|
||||
for (ULONG y = sizImage.cy; y; --y)
|
||||
{
|
||||
for (ULONG x = sizImage.cx; x; --x)
|
||||
{
|
||||
if (*pargb++ & 0xFF000000)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
pargb += cxDelta;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
HRESULT ConvertBufferToPARGB32(HPAINTBUFFER hPaintBuffer, HDC hdc, HICON hicon, SIZE& sizIcon)
|
||||
{
|
||||
RGBQUAD *prgbQuad;
|
||||
int cxRow;
|
||||
HRESULT hr = pfnGetBufferedPaintBits(hPaintBuffer, &prgbQuad, &cxRow);
|
||||
if (SUCCEEDED(hr))
|
||||
{
|
||||
ARGB *pargb = reinterpret_cast<ARGB *>(prgbQuad);
|
||||
if (!HasAlpha(pargb, sizIcon, cxRow))
|
||||
{
|
||||
ICONINFO info;
|
||||
if (GetIconInfo(hicon, &info))
|
||||
{
|
||||
if (info.hbmMask)
|
||||
{
|
||||
hr = ConvertToPARGB32(hdc, pargb, info.hbmMask, sizIcon, cxRow);
|
||||
}
|
||||
|
||||
DeleteObject(info.hbmColor);
|
||||
DeleteObject(info.hbmMask);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
HBITMAP IconToBitmapPARGB32(HICON hIcon, DWORD cx, DWORD cy)
|
||||
{
|
||||
HRESULT hr = E_OUTOFMEMORY;
|
||||
HBITMAP hBmp = NULL;
|
||||
|
||||
if(!hIcon)
|
||||
return NULL;
|
||||
|
||||
SIZE sizIcon;
|
||||
sizIcon.cx = cx;
|
||||
sizIcon.cy = cy;
|
||||
|
||||
RECT rcIcon;
|
||||
SetRect(&rcIcon, 0, 0, sizIcon.cx, sizIcon.cy);
|
||||
|
||||
HDC hdcDest = CreateCompatibleDC(NULL);
|
||||
if(hdcDest) {
|
||||
hr = Create32BitHBITMAP(hdcDest, &sizIcon, NULL, &hBmp);
|
||||
if(SUCCEEDED(hr)) {
|
||||
hr = E_FAIL;
|
||||
|
||||
HBITMAP hbmpOld = (HBITMAP)SelectObject(hdcDest, hBmp);
|
||||
if(hbmpOld) {
|
||||
BLENDFUNCTION bfAlpha = { AC_SRC_OVER, 0, 255, AC_SRC_ALPHA };
|
||||
BP_PAINTPARAMS paintParams = {0, 0, 0, 0};
|
||||
paintParams.cbSize = sizeof(paintParams);
|
||||
paintParams.dwFlags = BPPF_ERASE;
|
||||
paintParams.pBlendFunction = &bfAlpha;
|
||||
|
||||
HDC hdcBuffer;
|
||||
HPAINTBUFFER hPaintBuffer = pfnBeginBufferedPaint(hdcDest, &rcIcon, BPBF_DIB, &paintParams, &hdcBuffer);
|
||||
if(hPaintBuffer) {
|
||||
if(DrawIconEx(hdcBuffer, 0, 0, hIcon, sizIcon.cx, sizIcon.cy, 0, NULL, DI_NORMAL)) {
|
||||
// If icon did not have an alpha channel, we need to convert buffer to PARGB.
|
||||
hr = ConvertBufferToPARGB32(hPaintBuffer, hdcDest, hIcon, sizIcon);
|
||||
}
|
||||
|
||||
// This will write the buffer contents to the destination bitmap.
|
||||
pfnEndBufferedPaint(hPaintBuffer, TRUE);
|
||||
}
|
||||
SelectObject(hdcDest, hbmpOld);
|
||||
}
|
||||
}
|
||||
DeleteDC(hdcDest);
|
||||
}
|
||||
|
||||
DestroyIcon(hIcon);
|
||||
if(SUCCEEDED(hr)) {
|
||||
return hBmp;
|
||||
}
|
||||
DeleteObject(hBmp);
|
||||
return NULL;
|
||||
}
|
||||
/*
|
||||
// LoadIconEx: Loads an icon with a specific size and color depth. This function
|
||||
// will NOT try to strech or take an icon of another color depth if none is
|
||||
// present.
|
||||
HICON LoadIconEx(HINSTANCE hInstance, LPCTSTR lpszName, int cx, int cy, int depth)
|
||||
{
|
||||
HRSRC hRsrcIconGroup;
|
||||
|
||||
// Load the icon group of the desired icon
|
||||
if (!(hRsrcIconGroup=FindResource(hInstance,lpszName,RT_GROUP_ICON)))
|
||||
return NULL;
|
||||
|
||||
// Look for the specified color depth
|
||||
|
||||
// Load the resource
|
||||
|
||||
GRPICONDIR* pGrpIconDir;
|
||||
HRSRC hGlobalIconDir;
|
||||
|
||||
if (!(hGlobalIconDir=(HRSRC)LoadResource(hInstance,hRsrcIconGroup)))
|
||||
return NULL;
|
||||
|
||||
// Lock the resource
|
||||
|
||||
if (!(pGrpIconDir=(GRPICONDIR*) LockResource(hGlobalIconDir)))
|
||||
return NULL;
|
||||
|
||||
// Cycle through all icon images trying to find the one we're looking for
|
||||
|
||||
int i;
|
||||
BOOL bFound=FALSE;
|
||||
|
||||
// In case of 8bpp or higher, the bColorCount of the structure is 0, and we
|
||||
// must find our icon with the wPlanes and wBitCount. So if the requested
|
||||
// number of colors is >=256, we calculate using those fields
|
||||
|
||||
int bestIndex = -1;
|
||||
int bestDepth = -1; //depth of icon either has to be equal (best match) or larger, or no best icon found
|
||||
int bestSize = -1; //Size either has to be equal (best match) or smaller
|
||||
|
||||
int nrColors = 1 << depth;
|
||||
|
||||
for (i=0;i<pGrpIconDir->idCount;i++)
|
||||
{
|
||||
GRPICONDIRENTRY & entry = pGrpIconDir->idEntries[i];
|
||||
int iconColors = (entry.bColorCount==0)?1 << (entry.wPlanes*entry.wBitCount) : entry.bColorCount;
|
||||
if (iconColors < bestDepth);
|
||||
|
||||
if ((entry.bWidth==cx) && (entry.bHeight==cy)) // Do the size match?
|
||||
{
|
||||
bFound = TRUE; // Yes, it matches
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!bFound)
|
||||
return NULL; // No icon was found matching the specs
|
||||
|
||||
// Icon was found! i contains the index to the GRPICONDIR structure in the
|
||||
// icon group. Find the ID of the icon
|
||||
|
||||
int nID;
|
||||
|
||||
nID=pGrpIconDir->idEntries[i].nID;
|
||||
|
||||
// Now, find the actual icon resource
|
||||
|
||||
HRSRC hRsrcIcon;
|
||||
HRSRC hGlobalIcon;
|
||||
void* pIconBits;
|
||||
|
||||
if (!(hRsrcIcon=FindResource(hInstance,MAKEINTRESOURCE(nID),RT_ICON)))
|
||||
return NULL;
|
||||
|
||||
if (!(hGlobalIcon=(HRSRC)LoadResource(hInstance,hRsrcIcon)))
|
||||
return NULL;
|
||||
|
||||
if (!(pIconBits=LockResource(hGlobalIcon)))
|
||||
return NULL;
|
||||
|
||||
// Now, use CreateIconFromResourceEx to create the actual HICON
|
||||
|
||||
return CreateIconFromResourceEx(
|
||||
(unsigned char*) pIconBits, // Pointer to icon data
|
||||
pGrpIconDir->idEntries[i].dwBytesInRes, // Size of icon data
|
||||
TRUE, // TRUE to create an icon, not a cursor
|
||||
0x00030000, // Version number. MSDN says to put that number
|
||||
cx, cy, // Width and height
|
||||
0); // Flags (none)
|
||||
}
|
||||
*/
|
|
@ -1,45 +0,0 @@
|
|||
#include <windows.h>
|
||||
#include <uxtheme.h>
|
||||
|
||||
#ifndef BPPF_ERASE
|
||||
#define BPPF_ERASE 1
|
||||
#endif
|
||||
|
||||
typedef DWORD ARGB;
|
||||
typedef HRESULT (WINAPI *FN_GetBufferedPaintBits) (HPAINTBUFFER hBufferedPaint, RGBQUAD **ppbBuffer, int *pcxRow);
|
||||
typedef HPAINTBUFFER (WINAPI *FN_BeginBufferedPaint) (HDC hdcTarget, const RECT *prcTarget, BP_BUFFERFORMAT dwFormat, BP_PAINTPARAMS *pPaintParams, HDC *phdc);
|
||||
typedef HRESULT (WINAPI *FN_EndBufferedPaint) (HPAINTBUFFER hBufferedPaint, BOOL fUpdateTarget);
|
||||
|
||||
bool InitTheming();
|
||||
bool DeinitTheming();
|
||||
|
||||
void InitBitmapInfo(BITMAPINFO *pbmi, ULONG cbInfo, LONG cx, LONG cy, WORD bpp);
|
||||
HRESULT Create32BitHBITMAP(HDC hdc, const SIZE *psize, void **ppvBits, HBITMAP* phBmp);
|
||||
HRESULT ConvertToPARGB32(HDC hdc, ARGB *pargb, HBITMAP hbmp, SIZE& sizImage, int cxRow);
|
||||
bool HasAlpha(ARGB *pargb, SIZE& sizImage, int cxRow);
|
||||
HRESULT ConvertBufferToPARGB32(HPAINTBUFFER hPaintBuffer, HDC hdc, HICON hicon, SIZE& sizIcon);
|
||||
HBITMAP IconToBitmapPARGB32(HICON hIcon, DWORD cx, DWORD cy);
|
||||
|
||||
typedef struct
|
||||
{
|
||||
BYTE bWidth; // Width, in pixels, of the image
|
||||
BYTE bHeight; // Height, in pixels, of the image
|
||||
BYTE bColorCount; // Number of colors in image (0 if >=8bpp)
|
||||
BYTE bReserved; // Reserved
|
||||
WORD wPlanes; // Color Planes
|
||||
WORD wBitCount; // Bits per pixel
|
||||
DWORD dwBytesInRes; // how many bytes in this resource?
|
||||
WORD nID; // the ID
|
||||
} GRPICONDIRENTRY, *LPGRPICONDIRENTRY;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
WORD idReserved; // Reserved (must be 0)
|
||||
WORD idType; // Resource type (1 for icons)
|
||||
WORD idCount; // How many images?
|
||||
GRPICONDIRENTRY idEntries[1]; // The entries for each image
|
||||
} GRPICONDIR, *LPGRPICONDIR;
|
||||
|
||||
|
||||
|
||||
HICON LoadIconEx(HINSTANCE hInst, LPCTSTR lpszName, int cz, int cy, int depth);
|
|
@ -1,132 +0,0 @@
|
|||
//---------------------------------------------------------------------------
|
||||
// Copyright 2002-2003 by Andre Burgaud <andre@burgaud.com>
|
||||
// Copyright 2009 by Harry <harrybharry@users.sourceforge.net>
|
||||
// See license.txt
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
#ifndef STRICT
|
||||
#define STRICT
|
||||
#endif
|
||||
|
||||
#define INC_OLE2
|
||||
#define NOMINMAX
|
||||
|
||||
#include <windows.h>
|
||||
#include <windowsx.h>
|
||||
#include <shlobj.h>
|
||||
#include <shlwapi.h>
|
||||
|
||||
#define WINVER_VISTA 0x600
|
||||
#define WINVER_XP 0x0501
|
||||
|
||||
//This is not ideal, but missing from current mingw
|
||||
#ifndef ERROR_ELEVATION_REQUIRED
|
||||
#define ERROR_ELEVATION_REQUIRED 740
|
||||
#endif
|
||||
|
||||
#define GIL_DEFAULTICON 0x0040
|
||||
|
||||
#define GUID_SIZE 128
|
||||
#define GUID_STRING_SIZE 40
|
||||
#define TITLE_SIZE 64
|
||||
|
||||
#ifdef ARRAYSIZE
|
||||
#undef ARRAYSIZE
|
||||
#endif
|
||||
#define ARRAYSIZE(a) (sizeof(a)/sizeof(a[0]))
|
||||
|
||||
#define MAX_CMD_LENGTH 32767
|
||||
#define ResultFromShort(i) ResultFromScode(MAKE_SCODE(SEVERITY_SUCCESS, 0, (USHORT)(i)))
|
||||
|
||||
#define INITGUID
|
||||
#include <initguid.h>
|
||||
#include <shlguid.h>
|
||||
|
||||
#ifdef WIN64
|
||||
// {B298D29A-A6ED-11DE-BA8C-A68E55D89593}
|
||||
DEFINE_GUID(CLSID_ShellExtension, 0xB298D29A, 0xA6ED, 0x11DE, 0xBA, 0x8C, 0xA6, 0x8E, 0x55, 0xD8, 0x95, 0x93);
|
||||
TCHAR szGUID[] = TEXT("{B298D29A-A6ED-11DE-BA8C-A68E55D89593}");
|
||||
#else
|
||||
// {00F3C2EC-A6EE-11DE-A03A-EF8F55D89593}
|
||||
DEFINE_GUID(CLSID_ShellExtension, 0x00F3C2EC, 0xA6EE, 0x11DE, 0xA0, 0x3A, 0xEF, 0x8F, 0x55, 0xD8, 0x95, 0x93);
|
||||
TCHAR szGUID[] = TEXT("{00F3C2EC-A6EE-11DE-A03A-EF8F55D89593}");
|
||||
#endif
|
||||
|
||||
class CShellExtClassFactory : public IClassFactory {
|
||||
protected:
|
||||
ULONG m_cRef;
|
||||
|
||||
public:
|
||||
CShellExtClassFactory();
|
||||
virtual ~CShellExtClassFactory();
|
||||
|
||||
// *** IUnknown methods ***
|
||||
STDMETHODIMP QueryInterface(REFIID, LPVOID FAR *);
|
||||
STDMETHODIMP_(ULONG) AddRef();
|
||||
STDMETHODIMP_(ULONG) Release();
|
||||
// *** IClassFactory methods ***
|
||||
STDMETHODIMP CreateInstance(LPUNKNOWN, REFIID, LPVOID FAR *);
|
||||
STDMETHODIMP LockServer(BOOL);
|
||||
};
|
||||
|
||||
class CShellExt : public IContextMenu3, IShellExtInit, IPersistFile, IExtractIcon {
|
||||
private:
|
||||
//
|
||||
ULONG m_cRef;
|
||||
|
||||
// Menu variables
|
||||
UINT m_cbFiles;
|
||||
STGMEDIUM m_stgMedium;
|
||||
LPDATAOBJECT m_pDataObj;
|
||||
TCHAR m_szDllDir[MAX_PATH];
|
||||
TCHAR m_szMenuTitle[TITLE_SIZE];
|
||||
UINT m_menuID;
|
||||
HMENU m_hMenu;
|
||||
bool m_showIcon;
|
||||
// Icon variables
|
||||
TCHAR m_szFilePath[MAX_PATH];
|
||||
TCHAR m_szModule[MAX_PATH];
|
||||
TCHAR m_szCustomPath[MAX_PATH];
|
||||
bool m_useCustom;
|
||||
int m_nameLength;
|
||||
int m_nameMaxLength;
|
||||
bool m_isDynamic;
|
||||
HBITMAP m_hBitmap;
|
||||
|
||||
DWORD m_winVer; //current windows version
|
||||
|
||||
// *** Private methods ***
|
||||
STDMETHODIMP InvokeNPP(HWND hParent, LPCSTR pszWorkingDir, LPCSTR pszCmd, LPCSTR pszParam, int iShowCmd);
|
||||
STDMETHODIMP LoadShellIcon(int cx, int cy, HICON * phicon);
|
||||
|
||||
public:
|
||||
CShellExt();
|
||||
virtual ~CShellExt();
|
||||
|
||||
// *** IUnknown methods ***
|
||||
STDMETHODIMP QueryInterface(REFIID, LPVOID FAR *);
|
||||
STDMETHODIMP_(ULONG) AddRef();
|
||||
STDMETHODIMP_(ULONG) Release();
|
||||
|
||||
// *** IShellExtInit methods ***
|
||||
STDMETHODIMP Initialize(LPCITEMIDLIST pIDFolder, LPDATAOBJECT pDataObj, HKEY hKeyID);
|
||||
|
||||
// *** IContextMenu methods ***
|
||||
STDMETHODIMP QueryContextMenu(HMENU hMenu, UINT indexMenu, UINT idCmdFirst, UINT idCmdLast, UINT uFlags);
|
||||
STDMETHODIMP InvokeCommand(LPCMINVOKECOMMANDINFO lpcmi);
|
||||
STDMETHODIMP GetCommandString(UINT_PTR idCmd, UINT uFlags, UINT FAR *reserved, LPSTR pszName, UINT cchMax);
|
||||
STDMETHODIMP HandleMenuMsg(UINT uMsg, WPARAM wParam, LPARAM lParam) { return HandleMenuMsg2(uMsg, wParam, lParam, NULL); };
|
||||
STDMETHODIMP HandleMenuMsg2(UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT *plResult);
|
||||
|
||||
// *** IPersistFile methods ***
|
||||
STDMETHODIMP GetClassID(CLSID *) { return E_NOTIMPL; };
|
||||
STDMETHODIMP IsDirty(void) { return E_NOTIMPL; };
|
||||
STDMETHODIMP Save(LPCOLESTR, BOOL) { return E_NOTIMPL; };
|
||||
STDMETHODIMP SaveCompleted(LPCOLESTR) { return E_NOTIMPL; };
|
||||
STDMETHODIMP GetCurFile(LPOLESTR *) { return E_NOTIMPL; };
|
||||
STDMETHODIMP Load(LPCOLESTR pszFileName, DWORD dwMode);
|
||||
|
||||
// *** IExtractIcon methods ***
|
||||
STDMETHODIMP GetIconLocation(UINT uFlags, LPTSTR szIconFile, UINT cchMax, int * piIndex, UINT * pwFlags);
|
||||
STDMETHODIMP Extract(LPCTSTR pszFile, UINT nIconIndex, HICON * phiconLarge, HICON * phiconSmall, UINT nIconSize);
|
||||
};
|
|
@ -1,77 +0,0 @@
|
|||
#include "resource.h"
|
||||
#include "winresrc.h"
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Version
|
||||
//
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION 0,1,0,0
|
||||
PRODUCTVERSION 0,1,0,0
|
||||
FILEFLAGSMASK 0x3fL
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS 0x3L
|
||||
#else
|
||||
FILEFLAGS 0x2L
|
||||
#endif
|
||||
FILEOS 0x4L
|
||||
FILETYPE 0x2L
|
||||
FILESUBTYPE 0x0L
|
||||
BEGIN
|
||||
BLOCK "StringFileInfo"
|
||||
BEGIN
|
||||
BLOCK "040904b0"
|
||||
BEGIN
|
||||
#ifdef WIN64
|
||||
VALUE "FileDescription", "ShellHandler for Notepad++ (64 bit)"
|
||||
#else
|
||||
VALUE "FileDescription", "ShellHandler for Notepad++"
|
||||
#endif
|
||||
VALUE "FileVersion", "0.1"
|
||||
VALUE "LegalCopyright", "Copyright © 2010"
|
||||
#ifdef WIN64
|
||||
VALUE "OriginalFilename", "NppShell64.dll"
|
||||
#else
|
||||
VALUE "OriginalFilename", "NppShell.dll"
|
||||
#endif
|
||||
VALUE "ProductVersion", "0.1"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
BEGIN
|
||||
VALUE "Translation", 0x409, 1200
|
||||
END
|
||||
END
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Icon
|
||||
//
|
||||
|
||||
//IDI_ICON_NPP ICON "icon\\npp_1.ico"
|
||||
IDI_ICON_NPP ICON "icon\\nppNewIcon.ico"
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Dialog
|
||||
//
|
||||
|
||||
IDD_DIALOG_SETTINGS DIALOGEX 0, 0, 286, 149
|
||||
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "NppShell Settings"
|
||||
FONT 8, "MS Shell Dlg", 400, 0, 0x1
|
||||
BEGIN
|
||||
GROUPBOX "Context Menu",IDC_STATIC,6,6,132,114
|
||||
CONTROL "Add context menu item",IDC_CHECK_USECONTEXT,"Button",BS_AUTO3STATE | WS_TABSTOP,18,24,90,10
|
||||
CONTROL "Show icon",IDC_CHECK_CONTEXTICON,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,42,48,10
|
||||
LTEXT "Menu text",IDC_STATIC,18,54,34,8
|
||||
EDITTEXT IDC_EDIT_MENU,24,66,102,14,ES_AUTOHSCROLL
|
||||
LTEXT "Command line params",IDC_STATIC,18,84,70,8
|
||||
EDITTEXT IDC_EDIT_COMMAND,24,96,102,14,ES_AUTOHSCROLL
|
||||
GROUPBOX "Dynamic Icon",IDC_STATIC,144,6,132,114
|
||||
CONTROL "Show dynamic icon",IDC_CHECK_USEICON,"Button",BS_AUTO3STATE | WS_TABSTOP,156,24,76,10
|
||||
CONTROL "Show extension",IDC_CHECK_ISDYNAMIC,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,156,42,67,10
|
||||
DEFPUSHBUTTON "OK",IDOK,222,126,50,14
|
||||
END
|
Before Width: | Height: | Size: 824 B |
|
@ -1,6 +0,0 @@
|
|||
EXPORTS
|
||||
DllRegisterServer PRIVATE
|
||||
DllUnregisterServer PRIVATE
|
||||
DllInstall PRIVATE
|
||||
DllGetClassObject PRIVATE
|
||||
DllCanUnloadNow PRIVATE
|
Before Width: | Height: | Size: 182 KiB |
Before Width: | Height: | Size: 7.2 KiB |
Before Width: | Height: | Size: 7.2 KiB |
|
@ -1,12 +0,0 @@
|
|||
#define IDI_ICON_NPP 102
|
||||
|
||||
#define IDD_DIALOG_SETTINGS 101
|
||||
|
||||
#define IDC_CHECK_USECONTEXT 1000
|
||||
#define IDC_CHECK_CONTEXTICON 1001
|
||||
#define IDC_EDIT_MENU 1002
|
||||
#define IDC_EDIT_COMMAND 1003
|
||||
#define IDC_CHECK_USEICON 1004
|
||||
#define IDC_CHECK_ISDYNAMIC 1005
|
||||
|
||||
#define IDC_STATIC -1
|