@@ -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-
444404STDAPI CleanupDll ()
445405{
446406 // First we get the full path to this DLL.
0 commit comments