Skip to content

Commit 72e76c3

Browse files
committed
Remove EnsureRegistrationOnCurrentUser, since it is no longer needed
1 parent b6c97e9 commit 72e76c3

File tree

3 files changed

+0
-43
lines changed

3 files changed

+0
-43
lines changed

Installer.cpp

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -403,46 +403,6 @@ HRESULT NppShell::Installer::Uninstall()
403403
return S_OK;
404404
}
405405

406-
void EnsureRegistrationOnCurrentUserWorker()
407-
{
408-
// Initialize the WinRT apartment.
409-
winrt::init_apartment();
410-
411-
// Get the package to check if it is already installed for the current user.
412-
Package existingPackage = GetSparsePackage();
413-
414-
if (existingPackage == NULL)
415-
{
416-
// The package is not installed for the current user - but we know that Notepad++ is.
417-
// If it wasn't, this code wouldn't be running, so it is safe to just register the package.
418-
RegisterSparsePackage();
419-
420-
// Finally we notify the shell that we have made changes, so it reloads the right click menu items.
421-
SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_IDLIST, 0, 0);
422-
}
423-
}
424-
425-
void NppShell::Installer::EnsureRegistrationOnCurrentUser()
426-
{
427-
// First we find the name of the process the DLL is being loaded into.
428-
wstring moduleName = GetExecutingModuleName();
429-
430-
if (moduleName == L"explorer.exe")
431-
{
432-
const bool isWindows11 = IsWindows11Installation();
433-
434-
if (isWindows11)
435-
{
436-
// We are being loaded into explorer.exe, so we can continue.
437-
// Explorer.exe only loads the DLL on the first time a user right-clicks a file
438-
// after that it stays in memory for the rest of their session.
439-
// Since we are here, we spawn a thread and call the EnsureRegistrationOnCurrentUserWorker function.
440-
thread ensureRegistrationThread = thread(EnsureRegistrationOnCurrentUserWorker);
441-
ensureRegistrationThread.detach();
442-
}
443-
}
444-
}
445-
446406
STDAPI CleanupDll()
447407
{
448408
// First we get the full path to this DLL.

Installer.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@ namespace NppShell::Installer
1111

1212
HRESULT Install();
1313
HRESULT Uninstall();
14-
15-
void EnsureRegistrationOnCurrentUser();
1614
}
1715

1816
STDAPI CleanupDll();

dllmain.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReser
2121
{
2222
case DLL_PROCESS_ATTACH:
2323
g_module = hModule;
24-
NppShell::Installer::EnsureRegistrationOnCurrentUser();
2524
break;
2625
case DLL_THREAD_ATTACH:
2726
case DLL_THREAD_DETACH:

0 commit comments

Comments
 (0)