mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-12-16 11:48:06 +01:00
* Add project
* Cleanup project file and add resource file
* Move common logic to FileLocksmithLib
* Cleanup interop vcxproj
* Implement handler, add assets and appx manifest
* Revert "Cleanup interop vcxproj"
This reverts commit 97bf991f2e.
* Remove package on uninstall
Install package on enable
Fix launching app
Cleanup
* Revert non-related change
* Spellcheck
* Update src/modules/FileLocksmith/FileLocksmithContextMenu/Resources.resx
* Wire Show in extended context menu setting
63 lines
1.2 KiB
C++
63 lines
1.2 KiB
C++
// dllmain.cpp : Defines the entry point for the DLL application.
|
|
#include "pch.h"
|
|
|
|
// Additional libraries to link
|
|
#pragma comment(lib, "shlwapi")
|
|
|
|
#include "ClassFactory.h"
|
|
|
|
#include "FileLocksmithLib/Trace.h"
|
|
|
|
namespace globals
|
|
{
|
|
HMODULE instance;
|
|
std::atomic<ULONG> ref_count;
|
|
}
|
|
|
|
BOOL APIENTRY DllMain( HMODULE hModule,
|
|
DWORD ul_reason_for_call,
|
|
LPVOID lpReserved
|
|
)
|
|
{
|
|
switch (ul_reason_for_call)
|
|
{
|
|
case DLL_PROCESS_ATTACH:
|
|
globals::instance = hModule;
|
|
Trace::RegisterProvider();
|
|
break;
|
|
case DLL_PROCESS_DETACH:
|
|
Trace::UnregisterProvider();
|
|
break;
|
|
}
|
|
return TRUE;
|
|
}
|
|
|
|
STDAPI DllRegisterServer()
|
|
{
|
|
return S_OK;
|
|
}
|
|
|
|
STDAPI DllUnregisterServer()
|
|
{
|
|
return S_OK;
|
|
}
|
|
|
|
STDAPI DllGetClassObject(REFCLSID clsid, REFIID riid, void** ppv)
|
|
{
|
|
HRESULT result = E_FAIL;
|
|
*ppv = NULL;
|
|
ClassFactory* class_factory = new (std::nothrow) ClassFactory(clsid);
|
|
if (class_factory)
|
|
{
|
|
result = class_factory->QueryInterface(riid, ppv);
|
|
class_factory->Release();
|
|
}
|
|
|
|
return result;
|
|
}
|
|
|
|
STDAPI DllCanUnloadNow(void)
|
|
{
|
|
return globals::ref_count == 0 ? S_OK : S_FALSE;
|
|
}
|