Skip to content

Commit 1bcc21b

Browse files
committed
Remove EnsureRegistrationOnCurrentUser, since it is no longer needed
1 parent f78ba3d commit 1bcc21b

File tree

3 files changed

+0
-43
lines changed

3 files changed

+0
-43
lines changed

Installer.cpp

-40
Original file line numberDiff line numberDiff line change
@@ -401,46 +401,6 @@ HRESULT NppShell::Installer::Uninstall()
401401
return S_OK;
402402
}
403403

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

Installer.h

-2
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

-1
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)