ImageResizerExt.cpp
1 #include "pch.h" 2 #include "Generated Files/resource.h" 3 #include "ImageResizerExt_i.h" 4 #include "dllmain.h" 5 6 __control_entrypoint(DllExport) STDAPI DllCanUnloadNow() 7 { 8 return _AtlModule.DllCanUnloadNow(); 9 } 10 11 _Check_return_ STDAPI DllGetClassObject(_In_ REFCLSID rclsid, _In_ REFIID riid, _Outptr_ LPVOID* ppv) 12 { 13 return _AtlModule.DllGetClassObject(rclsid, riid, ppv); 14 } 15 16 STDAPI DllRegisterServer() 17 { 18 return _AtlModule.DllRegisterServer(); 19 } 20 21 STDAPI DllUnregisterServer() 22 { 23 return _AtlModule.DllUnregisterServer(); 24 } 25 26 STDAPI DllInstall(BOOL bInstall, _In_opt_ LPCWSTR pszCmdLine) 27 { 28 HRESULT hr = E_FAIL; 29 static const wchar_t szUserSwitch[] = L"user"; 30 31 if (pszCmdLine != NULL) 32 { 33 if (_wcsnicmp(pszCmdLine, szUserSwitch, _countof(szUserSwitch)) == 0) 34 { 35 ATL::AtlSetPerUserRegistration(true); 36 } 37 } 38 39 if (bInstall) 40 { 41 hr = DllRegisterServer(); 42 43 if (FAILED(hr)) 44 { 45 DllUnregisterServer(); 46 } 47 } 48 else 49 { 50 hr = DllUnregisterServer(); 51 } 52 53 return hr; 54 }