ReactOS  0.4.15-dev-1070-ge1a01de
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; \
}
#define FALSE
Definition: types.h:117
#define debugstr_a
Definition: kernel32.h:31
static const char GPA_string[]
Definition: cdlg32.c:63
Definition: name.c:38
static HINSTANCE hinst
Definition: edit.c:551
#define GetProcAddress(x, y)
Definition: compat.h:501
static char * dest
Definition: rtl.c:135

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: precomp.h:44

◆ 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 TRACE(s)
Definition: solgame.cpp:4
#define S_OK
Definition: intsafe.h:51

◆ 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 }
#define E_NOINTERFACE
Definition: winerror.h:2364
REFIID riid
Definition: precomp.h:44
#define WARN(fmt,...)
Definition: debug.h:112
smooth NULL
Definition: ftsmooth.c:416
#define debugstr_guid
Definition: kernel32.h:35
#define TRACE(s)
Definition: solgame.cpp:4
const GUID IID_IUnknown
#define S_OK
Definition: intsafe.h:51
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4112
#define E_POINTER
Definition: winerror.h:2365
const GUID IID_IClassFactory

◆ 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 }
void COMDLG32_SetCommDlgExtendedError(DWORD err)
Definition: cdlg32.c:128
static PVOID ptr
Definition: dispmode.c:27
smooth NULL
Definition: ftsmooth.c:416
GLsizeiptr size
Definition: glext.h:5919
#define CDERR_MEMALLOCFAILURE
Definition: cderr.h:14

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 }
static DWORD COMDLG32_TlsIndex
Definition: cdlg32.c:47
BOOL WINAPI TlsSetValue(IN DWORD Index, IN LPVOID Value)
Definition: thread.c:1264
#define FIXME(fmt,...)
Definition: debug.h:111
#define TRACE(s)
Definition: solgame.cpp:4
DWORD WINAPI TlsAlloc(VOID)
Definition: thread.c:1088
#define TLS_OUT_OF_INDEXES
Definition: winbase.h:530
#define err(...)
uint32_t DWORD_PTR
Definition: typedefs.h:65

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()

DWORD WINAPI CommDlgExtendedError ( void  )

Definition at line 148 of file cdlg32.c.

149 {
152  else
153  return 0; /* we never set an error, so there isn't one */
154 }
static DWORD COMDLG32_TlsIndex
Definition: cdlg32.c:47
#define TLS_OUT_OF_INDEXES
Definition: winbase.h:530
uint32_t DWORD_PTR
Definition: typedefs.h:65
LPVOID WINAPI TlsGetValue(IN DWORD Index)
Definition: thread.c:1228

Referenced by CheckCommDlgError(), choose_font(), DoOpenFile(), DoSaveFile(), ExportFile(), MountFloppy(), test_arrange(), test_create_view_template(), test_create_view_window2(), test_DialogCancel(), test_extension_helper(), test_getfolderpath(), test_mru(), test_null_filename(), test_ok(), test_PageSetupDlgA(), test_PrintDlgA(), test_PrintDlgExW(), test_resizable2(), and test_resize().

◆ 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 }
HRESULT FileOpenDialog_Constructor(IUnknown *pUnkOuter, REFIID riid, void **ppv) DECLSPEC_HIDDEN
Definition: itemdlg.c:4664
REFIID riid
Definition: precomp.h:44
REFIID LPVOID * ppv
Definition: atlbase.h:39
#define CLASS_E_CLASSNOTAVAILABLE
Definition: winerror.h:2663
#define debugstr_guid
Definition: kernel32.h:35
HRESULT FileSaveDialog_Constructor(IUnknown *pUnkOuter, REFIID riid, void **ppv) DECLSPEC_HIDDEN
Definition: itemdlg.c:4669
#define TRACE(s)
Definition: solgame.cpp:4
static const IClassFactoryVtbl CDLGCF_Vtbl
Definition: cdlg32.c:234
IClassFactory IClassFactory_iface
Definition: main.c:58
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4112

◆ 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  {
77  case DLL_PROCESS_ATTACH:
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 
90  case DLL_PROCESS_DETACH:
91  if (Reserved) break;
93 #ifdef __REACTOS__
94  DeleteCriticalSection(&COMDLG32_OpenFileLock);
95 #endif
96  break;
97  }
98  return TRUE;
99 }
static DWORD COMDLG32_TlsIndex
Definition: cdlg32.c:47
DECLSPEC_HIDDEN HINSTANCE COMDLG32_hInstance
Definition: cdlg32.c:42
#define TRUE
Definition: types.h:120
BOOL WINAPI DisableThreadLibraryCalls(IN HMODULE hLibModule)
Definition: loader.c:85
#define DLL_PROCESS_ATTACH
Definition: compat.h:131
HINSTANCE hInstance
Definition: charmap.c:20
VOID WINAPI InitializeCriticalSection(OUT LPCRITICAL_SECTION lpCriticalSection)
Definition: synch.c:751
_Reserved_ PVOID Reserved
Definition: winddi.h:3974
const char * LPCSTR
Definition: xmlstorage.h:183
#define GPA(dest, hinst, name)
Definition: cdlg32.c:64
#define DLL_PROCESS_DETACH
Definition: compat.h:130
#define TRACE(s)
Definition: solgame.cpp:4
BOOL WINAPI TlsFree(IN DWORD Index)
Definition: thread.c:1154
void WINAPI DeleteCriticalSection(PCRITICAL_SECTION)
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:812
#define TLS_OUT_OF_INDEXES
Definition: winbase.h:530
static HINSTANCE SHELL32_hInstance
Definition: cdlg32.c:49
PVOID PVOID PWCHAR PVOID USHORT PULONG Reason
Definition: env.c:45

◆ 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 }
DECLSPEC_HIDDEN HINSTANCE COMDLG32_hInstance
Definition: cdlg32.c:42
HRESULT __wine_register_resources(HMODULE module) DECLSPEC_HIDDEN
Definition: register.c:98
#define E_FAIL
Definition: ddrawi.h:102

◆ 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 }
DECLSPEC_HIDDEN HINSTANCE COMDLG32_hInstance
Definition: cdlg32.c:42
#define E_FAIL
Definition: ddrawi.h:102
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 }
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560

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 HRESULT WINAPI CDLGCF_LockServer(IClassFactory *iface, BOOL dolock)
Definition: cdlg32.c:228
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
static ULONG WINAPI CDLGCF_AddRef(IClassFactory *iface)
Definition: cdlg32.c:202
static HRESULT WINAPI CDLGCF_QueryInterface(IClassFactory *iface, REFIID riid, void **ppobj)
Definition: cdlg32.c:178

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().