ReactOS  0.4.14-dev-1256-g2125fec
ACPPage.cpp File Reference
#include "precomp.h"
#include <shellutils.h>
Include dependency graph for ACPPage.cpp:

Go to the source code of this file.

Classes

class  CLayerUIPropPageModule
 
struct  CCoInit
 

Functions

EXTERN_C BOOL WINAPI DllMain (HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
 
STDAPI DllCanUnloadNow ()
 
STDAPI DllGetClassObject (REFCLSID rclsid, REFIID riid, LPVOID *ppv)
 
STDAPI DllRegisterServer ()
 
STDAPI DllUnregisterServer ()
 
EXTERN_C BOOL WINAPI GetExeFromLnk (PCWSTR pszLnk, PWSTR pszExe, size_t cchSize)
 

Variables

HMODULE g_hModule = NULL
 
LONG g_ModuleRefCnt = 0
 
CLayerUIPropPageModule gModule
 

Function Documentation

◆ DllCanUnloadNow()

STDAPI DllCanUnloadNow ( void  )

Definition at line 44 of file ACPPage.cpp.

45 {
46  if (g_ModuleRefCnt)
47  return S_FALSE;
48  return gModule.DllCanUnloadNow();
49 }
HRESULT DllCanUnloadNow()
Definition: atlbase.h:928
LONG g_ModuleRefCnt
Definition: ACPPage.cpp:13
#define S_FALSE
Definition: winerror.h:2357
CLayerUIPropPageModule gModule
Definition: ACPPage.cpp:24

◆ DllGetClassObject()

STDAPI DllGetClassObject ( REFCLSID  rclsid,
REFIID  riid,
LPVOID ppv 
)

Definition at line 51 of file ACPPage.cpp.

52 {
53  return gModule.DllGetClassObject(rclsid, riid, ppv);
54 }
REFIID riid
Definition: precomp.h:44
REFIID LPVOID * ppv
Definition: atlbase.h:39
HRESULT DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)
Definition: atlbase.h:935
CLayerUIPropPageModule gModule
Definition: ACPPage.cpp:24

◆ DllMain()

EXTERN_C BOOL WINAPI DllMain ( HINSTANCE  hInstance,
DWORD  dwReason,
LPVOID  lpReserved 
)

Definition at line 27 of file ACPPage.cpp.

28 {
29  switch (dwReason)
30  {
31  case DLL_PROCESS_ATTACH:
34  gModule.Init(ObjectMap, hInstance, NULL);
35  break;
36  case DLL_PROCESS_DETACH:
37  gModule.Term();
38  break;
39  }
40 
41  return(TRUE);
42 }
#define TRUE
Definition: types.h:120
HMODULE g_hModule
Definition: ACPPage.cpp:12
BOOL WINAPI DisableThreadLibraryCalls(IN HMODULE hLibModule)
Definition: loader.c:85
#define DLL_PROCESS_ATTACH
Definition: compat.h:120
void Term()
Definition: atlbase.h:820
DWORD dwReason
Definition: misc.cpp:154
HRESULT Init(_ATL_OBJMAP_ENTRY *p, HINSTANCE, const GUID *plibid)
Definition: atlbase.h:797
HINSTANCE hInstance
Definition: charmap.c:20
smooth NULL
Definition: ftsmooth.c:416
#define DLL_PROCESS_DETACH
Definition: compat.h:119
CLayerUIPropPageModule gModule
Definition: ACPPage.cpp:24

◆ DllRegisterServer()

STDAPI DllRegisterServer ( void  )

Definition at line 56 of file ACPPage.cpp.

57 {
58  HRESULT hr;
59 
61  if (FAILED(hr))
62  return hr;
63 
64  return S_OK;
65 }
HRESULT DllRegisterServer(BOOL bRegTypeLib=TRUE)
Definition: atlbase.h:940
HRESULT hr
Definition: shlfolder.c:183
CLayerUIPropPageModule gModule
Definition: ACPPage.cpp:24
LONG HRESULT
Definition: typedefs.h:78
#define S_OK
Definition: intsafe.h:59

◆ DllUnregisterServer()

STDAPI DllUnregisterServer ( void  )

Definition at line 67 of file ACPPage.cpp.

68 {
69  HRESULT hr;
70 
72  if (FAILED(hr))
73  return hr;
74 
75  return S_OK;
76 }
HRESULT hr
Definition: shlfolder.c:183
CLayerUIPropPageModule gModule
Definition: ACPPage.cpp:24
LONG HRESULT
Definition: typedefs.h:78
#define S_OK
Definition: intsafe.h:59
HRESULT DllUnregisterServer(BOOL bUnRegTypeLib=TRUE)
Definition: atlbase.h:945

◆ GetExeFromLnk()

EXTERN_C BOOL WINAPI GetExeFromLnk ( PCWSTR  pszLnk,
PWSTR  pszExe,
size_t  cchSize 
)

Definition at line 86 of file ACPPage.cpp.

87 {
88  CCoInit init;
89  if (FAILED_UNEXPECTEDLY(init.hres))
90  return FALSE;
91 
92  CComPtr<IShellLinkW> spShellLink;
93  if (FAILED_UNEXPECTEDLY(CoCreateInstance(CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, IID_PPV_ARG(IShellLinkW, &spShellLink))))
94  return FALSE;
95 
96  CComPtr<IPersistFile> spPersistFile;
97  if (FAILED_UNEXPECTEDLY(spShellLink->QueryInterface(IID_PPV_ARG(IPersistFile, &spPersistFile))))
98  return FALSE;
99 
100  if (FAILED_UNEXPECTEDLY(spPersistFile->Load(pszLnk, STGM_READ)) || FAILED_UNEXPECTEDLY(spShellLink->Resolve(NULL, SLR_NO_UI | SLR_NOUPDATE | SLR_NOSEARCH)))
101  return FALSE;
102 
103  return !FAILED_UNEXPECTEDLY(spShellLink->GetPath(pszExe, cchSize, NULL, SLGP_RAWPATH));
104 }
#define IID_PPV_ARG(Itype, ppType)
static int init
Definition: wintirpc.c:33
smooth NULL
Definition: ftsmooth.c:416
#define STGM_READ
Definition: objbase.h:916
#define FAILED_UNEXPECTEDLY(hr)
Definition: shellutils.h:71
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv)
Definition: compobj.c:3325

Referenced by CLayerUIPropPage::InitFile().

Variable Documentation

◆ g_hModule

◆ g_ModuleRefCnt

◆ gModule