ReactOS 0.4.15-dev-7961-gdcf9eb0
ACPPage.cpp
Go to the documentation of this file.
1/*
2 * PROJECT: ReactOS Compatibility Layer Shell Extension
3 * LICENSE: GPL-2.0+ (https://spdx.org/licenses/GPL-2.0+)
4 * PURPOSE: acppage entrypoint
5 * COPYRIGHT: Copyright 2015-2018 Mark Jansen (mark.jansen@reactos.org)
6 */
7
8#include "precomp.h"
9
10#include <shellutils.h>
11
14
16{
17public:
18};
19
20BEGIN_OBJECT_MAP(ObjectMap)
23
25
28{
29 switch (dwReason)
30 {
34 gModule.Init(ObjectMap, hInstance, NULL);
35 break;
37 gModule.Term();
38 break;
39 }
40
41 return(TRUE);
42}
43
45{
47 return S_FALSE;
48 return gModule.DllCanUnloadNow();
49}
50
52{
53 return gModule.DllGetClassObject(rclsid, riid, ppv);
54}
55
57{
58 HRESULT hr;
59
61 if (FAILED(hr))
62 return hr;
63
64 return S_OK;
65}
66
68{
69 HRESULT hr;
70
72 if (FAILED(hr))
73 return hr;
74
75 return S_OK;
76}
77
79BOOL WINAPI GetExeFromLnk(PCWSTR pszLnk, PWSTR pszExe, size_t cchSize)
80{
81 CCoInit init;
83 return FALSE;
84
85 CComPtr<IShellLinkW> spShellLink;
86 if (FAILED_UNEXPECTEDLY(CoCreateInstance(CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, IID_PPV_ARG(IShellLinkW, &spShellLink))))
87 return FALSE;
88
89 CComPtr<IPersistFile> spPersistFile;
90 if (FAILED_UNEXPECTEDLY(spShellLink->QueryInterface(IID_PPV_ARG(IPersistFile, &spPersistFile))))
91 return FALSE;
92
93 if (FAILED_UNEXPECTEDLY(spPersistFile->Load(pszLnk, STGM_READ)) || FAILED_UNEXPECTEDLY(spShellLink->Resolve(NULL, SLR_NO_UI | SLR_NOUPDATE | SLR_NOSEARCH)))
94 return FALSE;
95
96 return !FAILED_UNEXPECTEDLY(spShellLink->GetPath(pszExe, cchSize, NULL, SLGP_RAWPATH));
97}
EXTERN_C BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
Definition: ACPPage.cpp:27
STDAPI DllRegisterServer()
Definition: ACPPage.cpp:56
LONG g_ModuleRefCnt
Definition: ACPPage.cpp:13
STDAPI DllCanUnloadNow()
Definition: ACPPage.cpp:44
EXTERN_C BOOL WINAPI GetExeFromLnk(PCWSTR pszLnk, PWSTR pszExe, size_t cchSize)
Definition: ACPPage.cpp:79
STDAPI DllUnregisterServer()
Definition: ACPPage.cpp:67
STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)
Definition: ACPPage.cpp:51
CLayerUIPropPageModule gModule
Definition: ACPPage.cpp:24
HMODULE g_hModule
Definition: ACPPage.cpp:12
const GUID CLSID_CLayerUIPropPage
DWORD dwReason
Definition: misc.cpp:154
#define STDAPI
Definition: basetyps.h:41
#define EXTERN_C
Definition: basetyps.h:12
HINSTANCE hInstance
Definition: charmap.c:19
void Term()
Definition: atlbase.h:916
HRESULT DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)
Definition: atlbase.h:1037
HRESULT DllUnregisterServer(BOOL bUnRegTypeLib=TRUE)
Definition: atlbase.h:1047
HRESULT Init(_ATL_OBJMAP_ENTRY *p, HINSTANCE, const GUID *plibid)
Definition: atlbase.h:886
HRESULT DllCanUnloadNow()
Definition: atlbase.h:1030
HRESULT DllRegisterServer(BOOL bRegTypeLib=TRUE)
Definition: atlbase.h:1042
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define DLL_PROCESS_ATTACH
Definition: compat.h:131
#define DLL_PROCESS_DETACH
Definition: compat.h:130
#define FAILED_UNEXPECTEDLY(hr)
Definition: precomp.h:121
BOOL WINAPI DisableThreadLibraryCalls(IN HMODULE hLibModule)
Definition: loader.c:85
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv)
Definition: compobj.c:3325
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
REFIID riid
Definition: atlbase.h:39
REFIID LPVOID * ppv
Definition: atlbase.h:39
#define S_OK
Definition: intsafe.h:52
#define FAILED(hr)
Definition: intsafe.h:51
#define END_OBJECT_MAP()
Definition: atlcom.h:691
#define OBJECT_ENTRY(clsid, class)
Definition: atlcom.h:693
#define BEGIN_OBJECT_MAP(x)
Definition: atlcom.h:689
#define STGM_READ
Definition: objbase.h:917
long LONG
Definition: pedump.c:60
#define REFIID
Definition: guiddef.h:118
#define REFCLSID
Definition: guiddef.h:117
HRESULT hr
Definition: shlfolder.c:183
uint16_t * PWSTR
Definition: typedefs.h:56
const uint16_t * PCWSTR
Definition: typedefs.h:57
#define WINAPI
Definition: msvc.h:6
#define S_FALSE
Definition: winerror.h:2357
static int init
Definition: wintirpc.c:33
#define IID_PPV_ARG(Itype, ppType)