ReactOS 0.4.15-dev-5667-ged97270
cdlg32.c File Reference
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "winuser.h"
#include "objbase.h"
#include "rpcproxy.h"
#include "commdlg.h"
#include "cderr.h"
#include "wine/debug.h"
#include "wine/heap.h"
#include "cdlg.h"
Include dependency graph for cdlg32.c:

Go to the source code of this file.

Classes

struct  IClassFactoryImpl
 

Macros

#define COBJMACROS
 
#define GPA(dest, hinst, name)
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (commdlg)
 
 LPITEMIDLIST (WINAPI *COMDLG32_SHSimpleIDListFromPathAW)(LPCVOID) DECLSPEC_HIDDEN
 
BOOL WINAPI DllMain (HINSTANCE hInstance, DWORD Reason, LPVOID Reserved)
 
voidCOMDLG32_AllocMem (int size)
 
void COMDLG32_SetCommDlgExtendedError (DWORD err)
 
DWORD WINAPI CommDlgExtendedError (void)
 
static IClassFactoryImplimpl_from_IClassFactory (IClassFactory *iface)
 
static HRESULT WINAPI CDLGCF_QueryInterface (IClassFactory *iface, REFIID riid, void **ppobj)
 
static ULONG WINAPI CDLGCF_AddRef (IClassFactory *iface)
 
static ULONG WINAPI CDLGCF_Release (IClassFactory *iface)
 
static HRESULT WINAPI CDLGCF_CreateInstance (IClassFactory *iface, IUnknown *pOuter, REFIID riid, void **ppobj)
 
static HRESULT WINAPI CDLGCF_LockServer (IClassFactory *iface, BOOL dolock)
 
HRESULT WINAPI DllGetClassObject (REFCLSID rclsid, REFIID riid, void **ppv)
 
HRESULT WINAPI DllRegisterServer (void)
 
HRESULT WINAPI DllUnregisterServer (void)
 

Variables

DECLSPEC_HIDDEN HINSTANCE COMDLG32_hInstance = 0
 
static DWORD COMDLG32_TlsIndex = TLS_OUT_OF_INDEXES
 
static HINSTANCE SHELL32_hInstance
 
static const char GPA_string [] = "Failed to get entry point %s for hinst = %p\n"
 
static const IClassFactoryVtbl CDLGCF_Vtbl
 

Macro Definition Documentation

◆ COBJMACROS

#define COBJMACROS

Definition at line 24 of file cdlg32.c.

◆ GPA

#define GPA (   dest,
  hinst,
  name 
)
Value:
if(!(dest = (void*)GetProcAddress(hinst,name)))\
{ \
return FALSE; \
}
static const char GPA_string[]
Definition: cdlg32.c:63
#define FALSE
Definition: types.h:117
#define GetProcAddress(x, y)
Definition: compat.h:753
#define debugstr_a
Definition: kernel32.h:31
static HINSTANCE hinst
Definition: edit.c:551
static char * dest
Definition: rtl.c:135
Definition: name.c:39

Definition at line 64 of file cdlg32.c.

Function Documentation

◆ CDLGCF_AddRef()

static ULONG WINAPI CDLGCF_AddRef ( IClassFactory iface)
static

Definition at line 202 of file cdlg32.c.

203{
204 return 2; /* non-heap based object */
205}

◆ CDLGCF_CreateInstance()

static HRESULT WINAPI CDLGCF_CreateInstance ( IClassFactory iface,
IUnknown pOuter,
REFIID  riid,
void **  ppobj 
)
static

Definition at line 218 of file cdlg32.c.

220{
222 return This->cf(pOuter, riid, ppobj);
223}
static IClassFactoryImpl * impl_from_IClassFactory(IClassFactory *iface)
Definition: cdlg32.c:170
REFIID riid
Definition: atlbase.h:39

◆ CDLGCF_LockServer()

static HRESULT WINAPI CDLGCF_LockServer ( IClassFactory iface,
BOOL  dolock 
)
static

Definition at line 228 of file cdlg32.c.

229{
230 TRACE("%p (%d)\n", iface, dolock);
231 return S_OK;
232}
#define S_OK
Definition: intsafe.h:52
#define TRACE(s)
Definition: solgame.cpp:4

◆ CDLGCF_QueryInterface()

static HRESULT WINAPI CDLGCF_QueryInterface ( IClassFactory iface,
REFIID  riid,
void **  ppobj 
)
static

Definition at line 178 of file cdlg32.c.

180{
181 TRACE("%p (%s %p)\n", iface, debugstr_guid(riid), ppobj);
182
183 if(!ppobj)
184 return E_POINTER;
185
187 {
188 *ppobj = iface;
189 IClassFactory_AddRef(iface);
190 return S_OK;
191 }
192
193 WARN("Interface not supported.\n");
194
195 *ppobj = NULL;
196 return E_NOINTERFACE;
197}
const GUID IID_IUnknown
const GUID IID_IClassFactory
#define WARN(fmt,...)
Definition: debug.h:112
#define NULL
Definition: types.h:112
#define debugstr_guid
Definition: kernel32.h:35
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147
#define E_NOINTERFACE
Definition: winerror.h:2364
#define E_POINTER
Definition: winerror.h:2365

◆ CDLGCF_Release()

static ULONG WINAPI CDLGCF_Release ( IClassFactory iface)
static

Definition at line 210 of file cdlg32.c.

211{
212 return 1; /* non-heap based object */
213}

◆ COMDLG32_AllocMem()

void * COMDLG32_AllocMem ( int  size)

Definition at line 109 of file cdlg32.c.

110{
111 void *ptr = heap_alloc_zero(size);
112
113 if (!ptr)
114 {
116 return NULL;
117 }
118
119 return ptr;
120}
#define CDERR_MEMALLOCFAILURE
Definition: cderr.h:14
void COMDLG32_SetCommDlgExtendedError(DWORD err)
Definition: cdlg32.c:128
GLsizeiptr size
Definition: glext.h:5919
static PVOID ptr
Definition: dispmode.c:27

Referenced by FindTextA(), FindTextW(), ReplaceTextA(), and ReplaceTextW().

◆ COMDLG32_SetCommDlgExtendedError()

void COMDLG32_SetCommDlgExtendedError ( DWORD  err)

Definition at line 128 of file cdlg32.c.

129{
130 TRACE("(%08x)\n", err);
135 else
136 FIXME("No Tls Space\n");
137}
#define FIXME(fmt,...)
Definition: debug.h:111
static DWORD COMDLG32_TlsIndex
Definition: cdlg32.c:47
DWORD WINAPI TlsAlloc(VOID)
Definition: thread.c:1100
BOOL WINAPI TlsSetValue(IN DWORD Index, IN LPVOID Value)
Definition: thread.c:1276
#define err(...)
uint32_t DWORD_PTR
Definition: typedefs.h:65
#define TLS_OUT_OF_INDEXES
Definition: winbase.h:549

Referenced by ChooseColorW(), ChooseFontA(), ChooseFontW(), COMDLG32_AllocMem(), COMDLG32_FR_CheckPartial(), COMDLG32_FR_DoFindReplace(), CreateTemplateDialog(), FD31_GetTemplate(), FILEDLG95_OnOpen(), GetFileName95(), GetOpenFileNameA(), GetOpenFileNameW(), GetSaveFileNameA(), GetSaveFileNameW(), init_filedlg_infoW(), pagesetup_common(), PRINTDLG_WMInitDialog(), PRINTDLG_WMInitDialogW(), PrintDlgA(), PrintDlgExA(), PrintDlgExW(), and PrintDlgW().

◆ CommDlgExtendedError()

◆ DllGetClassObject()

HRESULT WINAPI DllGetClassObject ( REFCLSID  rclsid,
REFIID  riid,
void **  ppv 
)

Definition at line 246 of file cdlg32.c.

247{
248 static IClassFactoryImpl FileOpenDlgClassFactory = {{&CDLGCF_Vtbl}, FileOpenDialog_Constructor};
249 static IClassFactoryImpl FileSaveDlgClassFactory = {{&CDLGCF_Vtbl}, FileSaveDialog_Constructor};
250
251 TRACE("%s, %s, %p\n", debugstr_guid(rclsid), debugstr_guid(riid), ppv);
252
253 if(IsEqualGUID(&CLSID_FileOpenDialog, rclsid))
254 return IClassFactory_QueryInterface(&FileOpenDlgClassFactory.IClassFactory_iface, riid, ppv);
255
256 if(IsEqualGUID(&CLSID_FileSaveDialog, rclsid))
257 return IClassFactory_QueryInterface(&FileSaveDlgClassFactory.IClassFactory_iface, riid, ppv);
258
260}
static const IClassFactoryVtbl CDLGCF_Vtbl
Definition: cdlg32.c:234
HRESULT FileOpenDialog_Constructor(IUnknown *pUnkOuter, REFIID riid, void **ppv) DECLSPEC_HIDDEN
Definition: itemdlg.c:4664
HRESULT FileSaveDialog_Constructor(IUnknown *pUnkOuter, REFIID riid, void **ppv) DECLSPEC_HIDDEN
Definition: itemdlg.c:4669
REFIID LPVOID * ppv
Definition: atlbase.h:39
IClassFactory IClassFactory_iface
Definition: main.c:58
#define CLASS_E_CLASSNOTAVAILABLE
Definition: winerror.h:2663

◆ DllMain()

BOOL WINAPI DllMain ( HINSTANCE  hInstance,
DWORD  Reason,
LPVOID  Reserved 
)

Definition at line 71 of file cdlg32.c.

72{
73 TRACE("(%p, %d, %p)\n", hInstance, Reason, Reserved);
74
75 switch(Reason)
76 {
80
81 SHELL32_hInstance = GetModuleHandleA("SHELL32.DLL");
82#ifdef __REACTOS__
83 InitializeCriticalSection(&COMDLG32_OpenFileLock);
84#endif
85
86 /* SHELL */
87 GPA(COMDLG32_SHSimpleIDListFromPathAW, SHELL32_hInstance, (LPCSTR)162);
88 break;
89
91 if (Reserved) break;
93#ifdef __REACTOS__
94 DeleteCriticalSection(&COMDLG32_OpenFileLock);
95#endif
96 break;
97 }
98 return TRUE;
99}
static HINSTANCE SHELL32_hInstance
Definition: cdlg32.c:49
DECLSPEC_HIDDEN HINSTANCE COMDLG32_hInstance
Definition: cdlg32.c:42
#define GPA(dest, hinst, name)
Definition: cdlg32.c:64
HINSTANCE hInstance
Definition: charmap.c:19
#define TRUE
Definition: types.h:120
#define DLL_PROCESS_ATTACH
Definition: compat.h:131
#define DLL_PROCESS_DETACH
Definition: compat.h:130
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:812
BOOL WINAPI DisableThreadLibraryCalls(IN HMODULE hLibModule)
Definition: loader.c:85
BOOL WINAPI TlsFree(IN DWORD Index)
Definition: thread.c:1166
PVOID PVOID PWCHAR PVOID USHORT PULONG Reason
Definition: env.c:47
VOID WINAPI InitializeCriticalSection(OUT LPCRITICAL_SECTION lpCriticalSection)
Definition: synch.c:751
void WINAPI DeleteCriticalSection(PCRITICAL_SECTION)
_Reserved_ PVOID Reserved
Definition: winddi.h:3974
const char * LPCSTR
Definition: xmlstorage.h:183

◆ DllRegisterServer()

HRESULT WINAPI DllRegisterServer ( void  )

Definition at line 265 of file cdlg32.c.

266{
267#ifdef __REACTOS__
268 return E_FAIL; // FIXME: __wine_register_resources(COMDLG32_hInstance);
269#else
271#endif
272}
#define E_FAIL
Definition: ddrawi.h:102
HRESULT __wine_register_resources(HMODULE module) DECLSPEC_HIDDEN
Definition: register.c:98

◆ DllUnregisterServer()

HRESULT WINAPI DllUnregisterServer ( void  )

Definition at line 277 of file cdlg32.c.

278{
279#ifdef __REACTOS__
280 return E_FAIL; // FIXME: __wine_unregister_resources(COMDLG32_hInstance);
281#else
283#endif
284}
HRESULT __wine_unregister_resources(HMODULE module) DECLSPEC_HIDDEN
Definition: register.c:110

◆ impl_from_IClassFactory()

static IClassFactoryImpl * impl_from_IClassFactory ( IClassFactory iface)
inlinestatic

Definition at line 170 of file cdlg32.c.

171{
172 return CONTAINING_RECORD(iface, IClassFactoryImpl, IClassFactory_iface);
173}
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260

Referenced by CDLGCF_CreateInstance().

◆ LPITEMIDLIST()

LPITEMIDLIST ( WINAPI COMDLG32_SHSimpleIDListFromPathAW)

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( commdlg  )

Variable Documentation

◆ CDLGCF_Vtbl

const IClassFactoryVtbl CDLGCF_Vtbl
static
Initial value:
=
{
}
static ULONG WINAPI CDLGCF_AddRef(IClassFactory *iface)
Definition: cdlg32.c:202
static HRESULT WINAPI CDLGCF_LockServer(IClassFactory *iface, BOOL dolock)
Definition: cdlg32.c:228
static HRESULT WINAPI CDLGCF_QueryInterface(IClassFactory *iface, REFIID riid, void **ppobj)
Definition: cdlg32.c:178
static HRESULT WINAPI CDLGCF_CreateInstance(IClassFactory *iface, IUnknown *pOuter, REFIID riid, void **ppobj)
Definition: cdlg32.c:218
static ULONG WINAPI CDLGCF_Release(IClassFactory *iface)
Definition: cdlg32.c:210

Definition at line 234 of file cdlg32.c.

Referenced by DllGetClassObject().

◆ COMDLG32_hInstance

◆ COMDLG32_TlsIndex

DWORD COMDLG32_TlsIndex = TLS_OUT_OF_INDEXES
static

Definition at line 47 of file cdlg32.c.

Referenced by COMDLG32_SetCommDlgExtendedError(), CommDlgExtendedError(), and DllMain().

◆ GPA_string

const char GPA_string[] = "Failed to get entry point %s for hinst = %p\n"
static

Definition at line 63 of file cdlg32.c.

◆ SHELL32_hInstance

HINSTANCE SHELL32_hInstance
static

Definition at line 49 of file cdlg32.c.

Referenced by DllMain().