ReactOS 0.4.16-dev-340-g0540c21
shellole.c File Reference
#include <wine/config.h>
#include <stdarg.h>
#include <stdlib.h>
#include <string.h>
#include <windef.h>
#include <winbase.h>
#include <shellapi.h>
#include <shlobj.h>
#include <shlwapi.h>
#include <debughlp.h>
#include <wine/debug.h>
#include <wine/unicode.h>
#include "shell32_main.h"
Include dependency graph for shellole.c:

Go to the source code of this file.

Classes

struct  IDefClFImpl
 

Macros

#define WIN32_NO_STATUS
 
#define _INC_WINDOWS
 
#define COBJMACROS
 
#define NONAMELESSUNION
 

Typedefs

typedef HRESULT(CALLBACKLPFNCREATEINSTANCE) (IUnknown *pUnkOuter, REFIID riid, LPVOID *ppvObject)
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (shell)
 
INT WINAPI SHStringFromGUIDW (REFGUID guid, LPWSTR lpszDest, INT cchMax)
 
static IClassFactoryIDefClF_fnConstructor (LPFNCREATEINSTANCE lpfnCI, PLONG pcRefDll, REFIID riidInst)
 
HRESULT WINAPI SHCoCreateInstance (LPCWSTR aclsid, const CLSID *clsid, LPUNKNOWN pUnkOuter, REFIID refiid, LPVOID *ppv)
 
HRESULT WINAPI DllGetClassObject (REFCLSID rclsid, REFIID iid, LPVOID *ppv)
 
DWORD WINAPI SHCLSIDFromStringA (LPCSTR clsid, CLSID *id)
 
DWORD WINAPI SHCLSIDFromStringW (LPCWSTR clsid, CLSID *id)
 
DWORD WINAPI SHCLSIDFromStringAW (LPCVOID clsid, CLSID *id)
 
HRESULT WINAPI SHGetMalloc (LPMALLOC *lpmal)
 
LPVOID WINAPI SHAlloc (SIZE_T len)
 
void WINAPI SHFree (LPVOID pv)
 
HRESULT WINAPI SHGetDesktopFolder (IShellFolder **psf)
 
static IDefClFImplimpl_from_IClassFactory (IClassFactory *iface)
 
static HRESULT WINAPI IDefClF_fnQueryInterface (LPCLASSFACTORY iface, REFIID riid, LPVOID *ppvObj)
 
static ULONG WINAPI IDefClF_fnAddRef (LPCLASSFACTORY iface)
 
static ULONG WINAPI IDefClF_fnRelease (LPCLASSFACTORY iface)
 
static HRESULT WINAPI IDefClF_fnCreateInstance (LPCLASSFACTORY iface, LPUNKNOWN pUnkOuter, REFIID riid, LPVOID *ppvObject)
 
static HRESULT WINAPI IDefClF_fnLockServer (LPCLASSFACTORY iface, BOOL fLock)
 
HRESULT WINAPI SHCreateDefClassObject (REFIID riid, LPVOID *ppv, LPFNCREATEINSTANCE lpfnCI, LPDWORD pcRefDll, REFIID riidInst)
 
void WINAPI DragAcceptFiles (HWND hWnd, BOOL b)
 
void WINAPI DragFinish (HDROP h)
 
BOOL WINAPI DragQueryPoint (HDROP hDrop, POINT *p)
 
UINT WINAPI DragQueryFileA (HDROP hDrop, UINT lFile, LPSTR lpszFile, UINT lLength)
 
UINT WINAPI DragQueryFileW (HDROP hDrop, UINT lFile, LPWSTR lpszwFile, UINT lLength)
 
HRESULT WINAPI SHPropStgCreate (IPropertySetStorage *psstg, REFFMTID fmtid, const CLSID *pclsid, DWORD grfFlags, DWORD grfMode, DWORD dwDisposition, IPropertyStorage **ppstg, UINT *puCodePage)
 
HRESULT WINAPI SHPropStgReadMultiple (IPropertyStorage *pps, UINT uCodePage, ULONG cpspec, const PROPSPEC *rgpspec, PROPVARIANT *rgvar)
 
HRESULT WINAPI SHPropStgWriteMultiple (IPropertyStorage *pps, UINT *uCodePage, ULONG cpspec, const PROPSPEC *rgpspec, PROPVARIANT *rgvar, PROPID propidNameFirst)
 
HRESULT WINAPI SHCreateQueryCancelAutoPlayMoniker (IMoniker **moniker)
 

Variables

struct {
   REFIID   clsid
 
   LPFNCREATEINSTANCE   lpfnCI
 
InterfaceTable []
 
static const IClassFactoryVtbl dclfvt
 

Macro Definition Documentation

◆ _INC_WINDOWS

#define _INC_WINDOWS

Definition at line 29 of file shellole.c.

◆ COBJMACROS

#define COBJMACROS

Definition at line 30 of file shellole.c.

◆ NONAMELESSUNION

#define NONAMELESSUNION

Definition at line 31 of file shellole.c.

◆ WIN32_NO_STATUS

#define WIN32_NO_STATUS

Definition at line 28 of file shellole.c.

Typedef Documentation

◆ LPFNCREATEINSTANCE

typedef HRESULT(CALLBACK * LPFNCREATEINSTANCE) (IUnknown *pUnkOuter, REFIID riid, LPVOID *ppvObject)

Definition at line 52 of file shellole.c.

Function Documentation

◆ DllGetClassObject()

HRESULT WINAPI DllGetClassObject ( REFCLSID  rclsid,
REFIID  iid,
LPVOID ppv 
)

Definition at line 201 of file shellole.c.

202{
203 IClassFactory * pcf = NULL;
205 int i;
206
207 TRACE("CLSID:%s,IID:%s\n",shdebugstr_guid(rclsid),shdebugstr_guid(iid));
208
209 if (!ppv) return E_INVALIDARG;
210 *ppv = NULL;
211
212 /* search our internal interface table */
213 for(i=0;InterfaceTable[i].clsid;i++) {
214 if(IsEqualIID(InterfaceTable[i].clsid, rclsid)) {
215 TRACE("index[%u]\n", i);
217 break;
218 }
219 }
220
221 if (!pcf) {
222 FIXME("failed for CLSID=%s\n", shdebugstr_guid(rclsid));
224 }
225
226 hres = IClassFactory_QueryInterface(pcf, iid, ppv);
227 IClassFactory_Release(pcf);
228
229 TRACE("-- pointer to class factory: %p\n",*ppv);
230 return hres;
231}
#define FIXME(fmt,...)
Definition: precomp.h:53
#define E_INVALIDARG
Definition: ddrawi.h:101
const char * shdebugstr_guid(const struct _GUID *id)
Definition: debughlp.cpp:427
#define NULL
Definition: types.h:112
static IClassFactory * IDefClF_fnConstructor(LPFNCREATEINSTANCE lpfnCI, PLONG pcRefDll, REFIID riidInst)
Definition: shellole.c:386
LPFNCREATEINSTANCE lpfnCI
Definition: shellole.c:61
static const struct @562 InterfaceTable[]
REFIID clsid
Definition: shellole.c:60
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
REFIID LPVOID * ppv
Definition: atlbase.h:39
HRESULT hres
Definition: protocol.c:465
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95
#define TRACE(s)
Definition: solgame.cpp:4
#define CLASS_E_CLASSNOTAVAILABLE
Definition: winerror.h:2663

Referenced by SHCoCreateInstance().

◆ DragAcceptFiles()

void WINAPI DragAcceptFiles ( HWND  hWnd,
BOOL  b 
)

Definition at line 522 of file shellole.c.

523{
524 LONG exstyle;
525
526 if( !IsWindow(hWnd) ) return;
528 if (b)
529 exstyle |= WS_EX_ACCEPTFILES;
530 else
531 exstyle &= ~WS_EX_ACCEPTFILES;
533}
HWND hWnd
Definition: settings.c:17
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
#define WS_EX_ACCEPTFILES
Definition: pedump.c:648
long LONG
Definition: pedump.c:60
#define SetWindowLongPtrA
Definition: winuser.h:5357
BOOL WINAPI IsWindow(_In_opt_ HWND)
#define GetWindowLongPtrA
Definition: winuser.h:4831
#define GWL_EXSTYLE
Definition: winuser.h:854

Referenced by _tWinMain(), drop_window_therad(), MainWndProc(), NOTEPAD_WndProc(), OnCreate(), OnNcCreate(), and Preview_OnCreate().

◆ DragFinish()

void WINAPI DragFinish ( HDROP  h)

Definition at line 538 of file shellole.c.

539{
540 TRACE("\n");
541 GlobalFree(h);
542}
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:7723
HGLOBAL NTAPI GlobalFree(HGLOBAL hMem)
Definition: heapmem.c:611

Referenced by drop_window_proc(), LoadClipboardFromDrop(), MainWndDropFiles(), MainWndProc(), NOTEPAD_WndProc(), OnDropFiles(), CMainWindow::OnDropFiles(), Preview_OnDropFiles(), and WndProc().

◆ DragQueryFileA()

UINT WINAPI DragQueryFileA ( HDROP  hDrop,
UINT  lFile,
LPSTR  lpszFile,
UINT  lLength 
)

Definition at line 567 of file shellole.c.

572{
573 LPSTR lpDrop;
574 UINT i = 0;
575 DROPFILES *lpDropFileStruct = GlobalLock(hDrop);
576
577 TRACE("(%p, %x, %p, %u)\n", hDrop,lFile,lpszFile,lLength);
578
579 if(!lpDropFileStruct) goto end;
580
581 lpDrop = (LPSTR) lpDropFileStruct + lpDropFileStruct->pFiles;
582
583 if(lpDropFileStruct->fWide) {
584 LPWSTR lpszFileW = NULL;
585
586 if(lpszFile && lFile != 0xFFFFFFFF) {
587 lpszFileW = HeapAlloc(GetProcessHeap(), 0, lLength*sizeof(WCHAR));
588 if(lpszFileW == NULL) {
589 goto end;
590 }
591 }
592 i = DragQueryFileW(hDrop, lFile, lpszFileW, lLength);
593
594 if(lpszFileW) {
595 WideCharToMultiByte(CP_ACP, 0, lpszFileW, -1, lpszFile, lLength, 0, NULL);
596 HeapFree(GetProcessHeap(), 0, lpszFileW);
597 }
598 goto end;
599 }
600
601 while (i++ < lFile)
602 {
603 while (*lpDrop++); /* skip filename */
604 if (!*lpDrop)
605 {
606 i = (lFile == 0xFFFFFFFF) ? i : 0;
607 goto end;
608 }
609 }
610
611 i = strlen(lpDrop);
612 if (!lpszFile ) goto end; /* needed buffer size */
613 lstrcpynA (lpszFile, lpDrop, lLength);
614end:
615 GlobalUnlock(hDrop);
616 return i;
617}
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
#define GetProcessHeap()
Definition: compat.h:736
#define CP_ACP
Definition: compat.h:109
#define lstrcpynA
Definition: compat.h:751
#define HeapAlloc
Definition: compat.h:733
#define HeapFree(x, y, z)
Definition: compat.h:735
#define WideCharToMultiByte
Definition: compat.h:111
UINT WINAPI DragQueryFileW(HDROP hDrop, UINT lFile, LPWSTR lpszwFile, UINT lLength)
Definition: shellole.c:622
GLuint GLuint end
Definition: gl.h:1545
LPVOID NTAPI GlobalLock(HGLOBAL hMem)
Definition: heapmem.c:755
BOOL NTAPI GlobalUnlock(HGLOBAL hMem)
Definition: heapmem.c:1190
unsigned int UINT
Definition: ndis.h:50
DWORD pFiles
Definition: shlobj.h:2307
BOOL fWide
Definition: shlobj.h:2310
char * LPSTR
Definition: xmlstorage.h:182
__wchar_t WCHAR
Definition: xmlstorage.h:180
WCHAR * LPWSTR
Definition: xmlstorage.h:184

Referenced by DragQueryFileW(), and drop_window_proc().

◆ DragQueryFileW()

UINT WINAPI DragQueryFileW ( HDROP  hDrop,
UINT  lFile,
LPWSTR  lpszwFile,
UINT  lLength 
)

Definition at line 622 of file shellole.c.

627{
628 LPWSTR lpwDrop;
629 UINT i = 0;
630 DROPFILES *lpDropFileStruct = GlobalLock(hDrop);
631
632 TRACE("(%p, %x, %p, %u)\n", hDrop,lFile,lpszwFile,lLength);
633
634 if(!lpDropFileStruct) goto end;
635
636 lpwDrop = (LPWSTR) ((LPSTR)lpDropFileStruct + lpDropFileStruct->pFiles);
637
638 if(lpDropFileStruct->fWide == FALSE) {
639 LPSTR lpszFileA = NULL;
640
641 if(lpszwFile && lFile != 0xFFFFFFFF) {
642 lpszFileA = HeapAlloc(GetProcessHeap(), 0, lLength);
643 if(lpszFileA == NULL) {
644 goto end;
645 }
646 }
647 i = DragQueryFileA(hDrop, lFile, lpszFileA, lLength);
648
649 if(lpszFileA) {
650 MultiByteToWideChar(CP_ACP, 0, lpszFileA, -1, lpszwFile, lLength);
651 HeapFree(GetProcessHeap(), 0, lpszFileA);
652 }
653 goto end;
654 }
655
656 i = 0;
657 while (i++ < lFile)
658 {
659 while (*lpwDrop++); /* skip filename */
660 if (!*lpwDrop)
661 {
662 i = (lFile == 0xFFFFFFFF) ? i : 0;
663 goto end;
664 }
665 }
666
667 i = strlenW(lpwDrop);
668 if ( !lpszwFile) goto end; /* needed buffer size */
669 lstrcpynW (lpszwFile, lpwDrop, lLength);
670end:
671 GlobalUnlock(hDrop);
672 return i;
673}
#define FALSE
Definition: types.h:117
#define MultiByteToWideChar
Definition: compat.h:110
#define lstrcpynW
Definition: compat.h:738
UINT WINAPI DragQueryFileA(HDROP hDrop, UINT lFile, LPSTR lpszFile, UINT lLength)
Definition: shellole.c:567
#define strlenW(s)
Definition: unicode.h:34

Referenced by BtrfsPropSheet::apply_changes(), CFSDropTarget::DragEnter(), DragQueryFileA(), DragQueryFileWrapW(), CSendToZip::Drop(), HDropFromClipboard(), CDrvDefExt::Initialize(), BtrfsContextMenu::Initialize(), BtrfsVolPropSheet::Initialize(), CShellLink::Initialize(), CFileDefExt::Initialize(), CZipFolder::Initialize(), CLayerUIPropPage::Initialize(), BtrfsContextMenu::InvokeCommand(), BtrfsPropSheet::load_file_list(), LoadClipboardFromDrop(), MainWndDropFiles(), OnDropFiles(), BtrfsPropSheet::open_as_admin(), Preview_OnDropFiles(), show_reflink_paste(), and WndProc().

◆ DragQueryPoint()

BOOL WINAPI DragQueryPoint ( HDROP  hDrop,
POINT p 
)

Definition at line 547 of file shellole.c.

548{
549 DROPFILES *lpDropFileStruct;
550 BOOL bRet;
551
552 TRACE("\n");
553
554 lpDropFileStruct = GlobalLock(hDrop);
555
556 *p = lpDropFileStruct->pt;
557 bRet = lpDropFileStruct->fNC;
558
559 GlobalUnlock(hDrop);
560 return bRet;
561}
unsigned int BOOL
Definition: ntddk_ex.h:94
GLfloat GLfloat p
Definition: glext.h:8902
BOOL fNC
Definition: shlobj.h:2309
POINT pt
Definition: shlobj.h:2308

Referenced by drop_window_proc().

◆ IDefClF_fnAddRef()

static ULONG WINAPI IDefClF_fnAddRef ( LPCLASSFACTORY  iface)
static

Definition at line 426 of file shellole.c.

427{
429 ULONG refCount = InterlockedIncrement(&This->ref);
430
431 TRACE("(%p)->(count=%u)\n", This, refCount - 1);
432
433 return refCount;
434}
#define InterlockedIncrement
Definition: armddk.h:53
static IDefClFImpl * impl_from_IClassFactory(IClassFactory *iface)
Definition: shellole.c:375
uint32_t ULONG
Definition: typedefs.h:59

◆ IDefClF_fnConstructor()

static IClassFactory * IDefClF_fnConstructor ( LPFNCREATEINSTANCE  lpfnCI,
PLONG  pcRefDll,
REFIID  riidInst 
)
static

Definition at line 386 of file shellole.c.

387{
388 IDefClFImpl* lpclf;
389
390 lpclf = HeapAlloc(GetProcessHeap(),0,sizeof(IDefClFImpl));
391 lpclf->ref = 1;
392 lpclf->IClassFactory_iface.lpVtbl = &dclfvt;
393 lpclf->lpfnCI = lpfnCI;
394 lpclf->pcRefDll = pcRefDll;
395
396 if (pcRefDll) InterlockedIncrement(pcRefDll);
397 lpclf->riidInst = riidInst;
398
399 TRACE("(%p)%s\n",lpclf, shdebugstr_guid(riidInst));
400 return (LPCLASSFACTORY)lpclf;
401}
IClassFactory IClassFactory_iface
Definition: shellole.c:367
LONG ref
Definition: shellole.c:368
const IID * riidInst
Definition: shell32.cpp:133
LONG * pcRefDll
Definition: shell32.cpp:134
LPFNCREATEINSTANCE lpfnCI
Definition: shell32.cpp:132
static const IClassFactoryVtbl dclfvt
Definition: shellole.c:380

Referenced by DllGetClassObject(), and SHCreateDefClassObject().

◆ IDefClF_fnCreateInstance()

static HRESULT WINAPI IDefClF_fnCreateInstance ( LPCLASSFACTORY  iface,
LPUNKNOWN  pUnkOuter,
REFIID  riid,
LPVOID ppvObject 
)
static

Definition at line 458 of file shellole.c.

460{
462
463 TRACE("%p->(%p,%s,%p)\n",This,pUnkOuter,shdebugstr_guid(riid),ppvObject);
464
465 *ppvObject = NULL;
466
467 if ( This->riidInst==NULL ||
468 IsEqualCLSID(riid, This->riidInst) ||
470 {
471 return This->lpfnCI(pUnkOuter, riid, ppvObject);
472 }
473
474 ERR("unknown IID requested %s\n",shdebugstr_guid(riid));
475 return E_NOINTERFACE;
476}
#define ERR(fmt,...)
Definition: precomp.h:57
const GUID IID_IUnknown
REFIID riid
Definition: atlbase.h:39
#define IsEqualCLSID(rclsid1, rclsid2)
Definition: guiddef.h:96
_In_ void _In_ PCCERT_CONTEXT _In_opt_ LPFILETIME _In_ DWORD _In_ DWORD _Outptr_opt_ void ** ppvObject
Definition: wincrypt.h:6082
#define E_NOINTERFACE
Definition: winerror.h:2364

◆ IDefClF_fnLockServer()

static HRESULT WINAPI IDefClF_fnLockServer ( LPCLASSFACTORY  iface,
BOOL  fLock 
)
static

Definition at line 480 of file shellole.c.

481{
483 TRACE("%p->(0x%x), not implemented\n",This, fLock);
484 return E_NOTIMPL;
485}
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ IDefClF_fnQueryInterface()

static HRESULT WINAPI IDefClF_fnQueryInterface ( LPCLASSFACTORY  iface,
REFIID  riid,
LPVOID ppvObj 
)
static

Definition at line 405 of file shellole.c.

407{
409
410 TRACE("(%p)->(%s)\n",This,shdebugstr_guid(riid));
411
412 *ppvObj = NULL;
413
415 *ppvObj = This;
417 return S_OK;
418 }
419
420 TRACE("-- E_NOINTERFACE\n");
421 return E_NOINTERFACE;
422}
const GUID IID_IClassFactory
#define S_OK
Definition: intsafe.h:52

◆ IDefClF_fnRelease()

static ULONG WINAPI IDefClF_fnRelease ( LPCLASSFACTORY  iface)
static

Definition at line 438 of file shellole.c.

439{
441 ULONG refCount = InterlockedDecrement(&This->ref);
442
443 TRACE("(%p)->(count=%u)\n", This, refCount + 1);
444
445 if (!refCount)
446 {
447 if (This->pcRefDll) InterlockedDecrement(This->pcRefDll);
448
449 TRACE("-- destroying IClassFactory(%p)\n",This);
451 return 0;
452 }
453 return refCount;
454}
#define InterlockedDecrement
Definition: armddk.h:52

◆ impl_from_IClassFactory()

static IDefClFImpl * impl_from_IClassFactory ( IClassFactory iface)
inlinestatic

Definition at line 375 of file shellole.c.

376{
377 return CONTAINING_RECORD(iface, IDefClFImpl, IClassFactory_iface);
378}
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260

Referenced by IDefClF_fnAddRef(), IDefClF_fnCreateInstance(), IDefClF_fnLockServer(), IDefClF_fnQueryInterface(), and IDefClF_fnRelease().

◆ SHAlloc()

◆ SHCLSIDFromStringA()

DWORD WINAPI SHCLSIDFromStringA ( LPCSTR  clsid,
CLSID id 
)

Definition at line 248 of file shellole.c.

249{
250 WCHAR buffer[40];
251 TRACE("(%p(%s) %p)\n", clsid, clsid, id);
252 if (!MultiByteToWideChar( CP_ACP, 0, clsid, -1, buffer, sizeof(buffer)/sizeof(WCHAR) ))
253 return CO_E_CLASSSTRING;
254 return CLSIDFromString( buffer, id );
255}
HRESULT WINAPI CLSIDFromString(LPCOLESTR idstr, LPCLSID id)
Definition: compobj.c:2338
GLuint buffer
Definition: glext.h:5915
#define CO_E_CLASSSTRING
Definition: winerror.h:2806

Referenced by _ILCreateGuidFromStrA(), and SHCLSIDFromStringAW().

◆ SHCLSIDFromStringAW()

DWORD WINAPI SHCLSIDFromStringAW ( LPCVOID  clsid,
CLSID id 
)

Definition at line 261 of file shellole.c.

262{
263 if (SHELL_OsIsUnicode())
264 return SHCLSIDFromStringW (clsid, id);
265 return SHCLSIDFromStringA (clsid, id);
266}
DWORD WINAPI SHCLSIDFromStringA(LPCSTR clsid, CLSID *id)
Definition: shellole.c:248
DWORD WINAPI SHCLSIDFromStringW(LPCWSTR clsid, CLSID *id)
Definition: shellole.c:256
static __inline BOOL SHELL_OsIsUnicode(void)
Definition: shell32_main.h:145

◆ SHCLSIDFromStringW()

DWORD WINAPI SHCLSIDFromStringW ( LPCWSTR  clsid,
CLSID id 
)

Definition at line 256 of file shellole.c.

257{
258 TRACE("(%p(%s) %p)\n", clsid, debugstr_w(clsid), id);
259 return CLSIDFromString(clsid, id);
260}
#define debugstr_w
Definition: kernel32.h:32

Referenced by _ILCreateGuidFromStrW(), SHCLSIDFromStringAW(), SHCoCreateInstance(), SHCreatePropSheetExtArrayEx(), and SHELL_GetShellExtensionRegCLSID().

◆ SHCoCreateInstance()

HRESULT WINAPI SHCoCreateInstance ( LPCWSTR  aclsid,
const CLSID clsid,
LPUNKNOWN  pUnkOuter,
REFIID  refiid,
LPVOID ppv 
)

Definition at line 105 of file shellole.c.

111{
112 DWORD hres;
113 CLSID iid;
114 const CLSID * myclsid = clsid;
115 WCHAR sKeyName[MAX_PATH];
116 WCHAR sClassID[60];
117 WCHAR sDllPath[MAX_PATH];
118 HKEY hKey = 0;
120 IClassFactory * pcf = NULL;
121
122 if(!ppv) return E_POINTER;
123 *ppv=NULL;
124
125 /* if the clsid is a string, convert it */
126 if (!clsid)
127 {
128 if (!aclsid) return REGDB_E_CLASSNOTREG;
129 SHCLSIDFromStringW(aclsid, &iid);
130 myclsid = &iid;
131 }
132
133 TRACE("(%p,%s,unk:%p,%s,%p)\n",
134 aclsid,shdebugstr_guid(myclsid),pUnkOuter,shdebugstr_guid(refiid),ppv);
135
137 {
138 hres = IClassFactory_CreateInstance(pcf, pUnkOuter, refiid, ppv);
139 IClassFactory_Release(pcf);
140 goto end;
141 }
142
143 /* we look up the dll path in the registry */
144 SHStringFromGUIDW(myclsid, sClassID, ARRAY_SIZE(sClassID));
145 swprintf(sKeyName, L"CLSID\\%s\\InprocServer32", sClassID);
146
147 if (RegOpenKeyExW(HKEY_CLASSES_ROOT, sKeyName, 0, KEY_READ, &hKey))
148 return E_ACCESSDENIED;
149
150 /* if a special registry key is set, we load a shell extension without help of OLE32 */
151 if (!SHQueryValueExW(hKey, L"LoadWithoutCOM", 0, 0, 0, 0))
152 {
153 /* load an external dll without ole32 */
157
158 dwSize = sizeof(sDllPath);
159 SHQueryValueExW(hKey, NULL, 0,0, sDllPath, &dwSize );
160
161 if ((hLibrary = LoadLibraryExW(sDllPath, 0, LOAD_WITH_ALTERED_SEARCH_PATH)) == 0) {
162 ERR("couldn't load InprocServer32 dll %s\n", debugstr_w(sDllPath));
164 goto end;
165 } else if (!(DllGetClassObject = (DllGetClassObjectFunc)GetProcAddress(hLibrary, "DllGetClassObject"))) {
166 ERR("couldn't find function DllGetClassObject in %s\n", debugstr_w(sDllPath));
169 goto end;
170 } else if (FAILED(hres = DllGetClassObject(myclsid, &IID_IClassFactory, (LPVOID*)&pcf))) {
171 TRACE("GetClassObject failed 0x%08x\n", hres);
172 goto end;
173 }
174
175 hres = IClassFactory_CreateInstance(pcf, pUnkOuter, refiid, ppv);
176 IClassFactory_Release(pcf);
177 } else {
178
179 /* load an external dll in the usual way */
180 hres = CoCreateInstance(myclsid, pUnkOuter, CLSCTX_INPROC_SERVER, refiid, ppv);
181 }
182
183end:
184 if (hKey) RegCloseKey(hKey);
185 if(hres!=S_OK)
186 {
187 ERR("failed (0x%08x) to create CLSID:%s IID:%s\n",
188 hres, shdebugstr_guid(myclsid), shdebugstr_guid(refiid));
189 ERR("class not found in registry\n");
190 }
191
192 TRACE("-- instance: %p\n",*ppv);
193 return hres;
194}
#define ARRAY_SIZE(A)
Definition: main.h:20
#define RegCloseKey(hKey)
Definition: registry.h:49
HMODULE hLibrary
Definition: odbccp32.c:12
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3333
#define GetProcAddress(x, y)
Definition: compat.h:753
#define FreeLibrary(x)
Definition: compat.h:748
#define MAX_PATH
Definition: compat.h:34
#define CALLBACK
Definition: compat.h:35
HINSTANCE WINAPI DECLSPEC_HOTPATCH LoadLibraryExW(LPCWSTR lpLibFileName, HANDLE hFile, DWORD dwFlags)
Definition: loader.c:288
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv)
Definition: compobj.c:3325
HRESULT(CALLBACK * DllGetClassObjectFunc)(REFCLSID clsid, REFIID iid, LPVOID *ppv)
Definition: compobj.c:449
INT WINAPI SHStringFromGUIDW(REFGUID guid, LPWSTR lpszDest, INT cchMax)
Definition: ordinal.c:661
HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID iid, LPVOID *ppv)
Definition: shellole.c:201
DWORD WINAPI SHQueryValueExW(HKEY hKey, LPCWSTR lpszValue, LPDWORD lpReserved, LPDWORD pwType, LPVOID pvData, LPDWORD pcbData)
Definition: reg.c:1461
#define swprintf
Definition: precomp.h:40
unsigned long DWORD
Definition: ntddk_ex.h:95
FxAutoRegKey hKey
#define SUCCEEDED(hr)
Definition: intsafe.h:50
#define FAILED(hr)
Definition: intsafe.h:51
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:56
#define KEY_READ
Definition: nt_native.h:1023
#define L(x)
Definition: ntvdm.h:50
#define REFIID
Definition: guiddef.h:118
#define REFCLSID
Definition: guiddef.h:117
#define LOAD_WITH_ALTERED_SEARCH_PATH
Definition: winbase.h:370
#define HRESULT
Definition: msvc.h:7
#define REGDB_E_CLASSNOTREG
Definition: winerror.h:2696
#define E_ACCESSDENIED
Definition: winerror.h:2849
#define E_POINTER
Definition: winerror.h:2365
#define HKEY_CLASSES_ROOT
Definition: winreg.h:10

Referenced by CFSFolder::_CreateShellExtInstance(), AssocCreate(), CFSFolder::CreateViewObject(), CDefaultContextMenu::DoCopyToMoveToFolder(), ExtractFilesThread(), CDefaultContextMenu::LoadDynamicContextMenuHandler(), SHELL32_CoCreateInitSF(), and SHELL_InitializeExtension().

◆ SHCreateDefClassObject()

HRESULT WINAPI SHCreateDefClassObject ( REFIID  riid,
LPVOID ppv,
LPFNCREATEINSTANCE  lpfnCI,
LPDWORD  pcRefDll,
REFIID  riidInst 
)

Definition at line 499 of file shellole.c.

505{
506 IClassFactory * pcf;
507
508 TRACE("%s %p %p %p %s\n",
509 shdebugstr_guid(riid), ppv, lpfnCI, pcRefDll, shdebugstr_guid(riidInst));
510
512 if (! (pcf = IDefClF_fnConstructor(lpfnCI, (PLONG)pcRefDll, riidInst))) return E_OUTOFMEMORY;
513 *ppv = pcf;
514 return S_OK;
515}
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
int32_t * PLONG
Definition: typedefs.h:58

◆ SHCreateQueryCancelAutoPlayMoniker()

HRESULT WINAPI SHCreateQueryCancelAutoPlayMoniker ( IMoniker **  moniker)

Definition at line 806 of file shellole.c.

807{
808 TRACE("%p\n", moniker);
809
810 if (!moniker) return E_INVALIDARG;
811 return CreateClassMoniker(&CLSID_QueryCancelAutoPlay, moniker);
812}
HRESULT WINAPI CreateClassMoniker(REFCLSID rclsid, IMoniker **ppmk)
Definition: classmoniker.c:701
Definition: main.c:40

◆ SHFree()

void WINAPI SHFree ( LPVOID  pv)

Definition at line 326 of file shellole.c.

327{
328 TRACE("%p\n",pv);
329 CoTaskMemFree(pv);
330}
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:442

Referenced by _DestroyCallback(), CFSDropTarget::_DoDrop(), _ILCreateControlPanel(), _ILCreatePrinters(), _ILFreeaPidl(), CFSDropTarget::_RepositionItems(), _tmain(), CRecycleBinEnum::CBEnumRecycleBin(), CBSearchRecycleBin(), CCabFolder::CompareID(), CreateCplAbsoluteParsingPath(), CPrintersEnum::CreatePrintersEnumList(), CreateShellItemFromParse(), CEnumIDListBase::DeleteList(), CChangeNotifyServer::DestroyItem(), CDefaultContextMenu::DoCreateNewFolder(), CEnumIDList::DPADestroyCallback(), DrivesContextMenuCallback(), EnumFillCallback(), CAddressEditBox::Execute(), ExtractFilesCallback(), FileMenu_DeleteAllItems(), FileMenu_Destroy(), CDefView::fill_list(), CDefView::FillList(), FindExecutableA(), FM_SetMenuParameter(), FNFDINOTIFY(), FNFREE(), FolderOptionsFileTypesDlg(), Free(), ShellPropSheetDialog::FreeData(), FreeStrRet(), COpenControlPanel::GetPath(), CDefView::GetSelections(), ILAppendID(), ILFree(), ILLoadFromStream(), CNetworkConnections::Initialize(), CControlPanelFolder::Initialize(), CFSFolder::Initialize(), CMyDocsFolder::Initialize(), CNetFolder::Initialize(), CPrinterFolder::Initialize(), CRecycleBin::Initialize(), CCPLItemMenu::InvokeCommand(), CDefView::LV_RenameItem(), CDefView::OnDestroy(), CDefView::OnNotify(), OpenAs_RunDLLA(), PathResolveA(), r_verify_pidl(), RegFolderContextMenuCallback(), RenderFILENAMEA(), RenderFILENAMEW(), CNewMenu::SelectNewItem(), SHBindToParent(), SHELL32_GetFSItemAttributes(), SHELL_CreatePropSheetStubWindow(), ShellExecCmdLine(), ShellExecuteExA(), SHGetFileInfoW(), SHGFI(), sic_free(), SIC_IconAppend(), CFindFolder::StartSearch(), StartWithCommandLine(), test_printers_folder(), wmain(), WOWShellExecute(), CAdminToolsFolder::~CAdminToolsFolder(), CControlPanelFolder::~CControlPanelFolder(), CDefView::~CDefView(), CDrivesFolder::~CDrivesFolder(), CFontsFolder::~CFontsFolder(), CFSDropTarget::~CFSDropTarget(), CFSFolder::~CFSFolder(), CMyDocsFolder::~CMyDocsFolder(), CNetFolder::~CNetFolder(), CNetworkConnections::~CNetworkConnections(), CPrinterFolder::~CPrinterFolder(), CRecycleBin::~CRecycleBin(), CZZWStr::~CZZWStr(), RecycleBin5Enum::~RecycleBin5Enum(), and RecycleBin5File::~RecycleBin5File().

◆ SHGetDesktopFolder()

HRESULT WINAPI SHGetDesktopFolder ( IShellFolder **  psf)

Definition at line 336 of file shellole.c.

337{
339
340 TRACE("(%p)\n", psf);
341
342 if(!psf) return E_INVALIDARG;
343
344 *psf = NULL;
345 hres = ISF_Desktop_Constructor(NULL, &IID_IShellFolder, (LPVOID*)psf);
346
347 TRACE("-- %p->(%p) 0x%08x\n", psf, *psf, hres);
348 return hres;
349}

◆ SHGetMalloc()

HRESULT WINAPI SHGetMalloc ( LPMALLOC lpmal)

Definition at line 285 of file shellole.c.

286{
287 TRACE("(%p)\n", lpmal);
288 return CoGetMalloc(MEMCTX_TASK, lpmal);
289}
HRESULT WINAPI CoGetMalloc(DWORD context, IMalloc **imalloc)
Definition: ifs.c:403

Referenced by check_lnk_(), CHSourceDlgProc(), create_lnk_(), CommonShellMalloc::init(), init_function_pointers(), loadShell32(), and SHAddToRecentDocs().

◆ SHPropStgCreate()

HRESULT WINAPI SHPropStgCreate ( IPropertySetStorage psstg,
REFFMTID  fmtid,
const CLSID pclsid,
DWORD  grfFlags,
DWORD  grfMode,
DWORD  dwDisposition,
IPropertyStorage **  ppstg,
UINT puCodePage 
)

Definition at line 678 of file shellole.c.

681{
682 PROPSPEC prop;
683 PROPVARIANT ret;
685
686 TRACE("%p %s %s %x %x %x %p %p\n", psstg, debugstr_guid(fmtid), debugstr_guid(pclsid),
687 grfFlags, grfMode, dwDisposition, ppstg, puCodePage);
688
689 hres = IPropertySetStorage_Open(psstg, fmtid, grfMode, ppstg);
690
691 switch(dwDisposition) {
692 case CREATE_ALWAYS:
693 if(SUCCEEDED(hres)) {
694 IPropertyStorage_Release(*ppstg);
695 hres = IPropertySetStorage_Delete(psstg, fmtid);
696 if(FAILED(hres))
697 return hres;
698 hres = E_FAIL;
699 }
700
701 case OPEN_ALWAYS:
702 case CREATE_NEW:
703 if(FAILED(hres))
704 hres = IPropertySetStorage_Create(psstg, fmtid, pclsid,
705 grfFlags, grfMode, ppstg);
706
707 case OPEN_EXISTING:
708 if(FAILED(hres))
709 return hres;
710
711 if(puCodePage) {
712 prop.ulKind = PRSPEC_PROPID;
713 prop.u.propid = PID_CODEPAGE;
714 hres = IPropertyStorage_ReadMultiple(*ppstg, 1, &prop, &ret);
715 if(FAILED(hres) || ret.vt!=VT_I2)
716 *puCodePage = 0;
717 else
718 *puCodePage = ret.u.iVal;
719 }
720 }
721
722 return S_OK;
723}
#define E_FAIL
Definition: ddrawi.h:102
#define OPEN_EXISTING
Definition: compat.h:775
@ VT_I2
Definition: compat.h:2297
#define debugstr_guid
Definition: kernel32.h:35
#define CREATE_ALWAYS
Definition: disk.h:72
#define CREATE_NEW
Definition: disk.h:69
#define OPEN_ALWAYS
Definition: disk.h:70
#define PID_CODEPAGE
Definition: suminfo.c:43

◆ SHPropStgReadMultiple()

HRESULT WINAPI SHPropStgReadMultiple ( IPropertyStorage pps,
UINT  uCodePage,
ULONG  cpspec,
const PROPSPEC *  rgpspec,
PROPVARIANT *  rgvar 
)

Definition at line 728 of file shellole.c.

730{
731 STATPROPSETSTG stat;
733
734 FIXME("%p %u %u %p %p\n", pps, uCodePage, cpspec, rgpspec, rgvar);
735
736 memset(rgvar, 0, cpspec*sizeof(PROPVARIANT));
737 hres = IPropertyStorage_ReadMultiple(pps, cpspec, rgpspec, rgvar);
738 if(FAILED(hres))
739 return hres;
740
741 if(!uCodePage) {
742 PROPSPEC prop;
743 PROPVARIANT ret;
744
745 prop.ulKind = PRSPEC_PROPID;
746 prop.u.propid = PID_CODEPAGE;
747 hres = IPropertyStorage_ReadMultiple(pps, 1, &prop, &ret);
748 if(FAILED(hres) || ret.vt!=VT_I2)
749 return S_OK;
750
751 uCodePage = ret.u.iVal;
752 }
753
754 hres = IPropertyStorage_Stat(pps, &stat);
755 if(FAILED(hres))
756 return S_OK;
757
758 /* TODO: do something with codepage and stat */
759 return S_OK;
760}
#define stat
Definition: acwin.h:99
#define memset(x, y, z)
Definition: compat.h:39
Definition: stat.h:55

◆ SHPropStgWriteMultiple()

HRESULT WINAPI SHPropStgWriteMultiple ( IPropertyStorage pps,
UINT uCodePage,
ULONG  cpspec,
const PROPSPEC *  rgpspec,
PROPVARIANT *  rgvar,
PROPID  propidNameFirst 
)

Definition at line 765 of file shellole.c.

767{
768 STATPROPSETSTG stat;
771
772 FIXME("%p %p %u %p %p %d\n", pps, uCodePage, cpspec, rgpspec, rgvar, propidNameFirst);
773
774 hres = IPropertyStorage_Stat(pps, &stat);
775 if(FAILED(hres))
776 return hres;
777
778 if(uCodePage && *uCodePage)
779 codepage = *uCodePage;
780 else {
781 PROPSPEC prop;
782 PROPVARIANT ret;
783
784 prop.ulKind = PRSPEC_PROPID;
785 prop.u.propid = PID_CODEPAGE;
786 hres = IPropertyStorage_ReadMultiple(pps, 1, &prop, &ret);
787 if(FAILED(hres))
788 return hres;
789 if(ret.vt!=VT_I2 || !ret.u.iVal)
790 return E_FAIL;
791
792 codepage = ret.u.iVal;
793 if(uCodePage)
794 *uCodePage = codepage;
795 }
796
797 /* TODO: do something with codepage and stat */
798
799 hres = IPropertyStorage_WriteMultiple(pps, cpspec, rgpspec, rgvar, propidNameFirst);
800 return hres;
801}
int codepage
Definition: win_iconv.c:156

◆ SHStringFromGUIDW()

INT WINAPI SHStringFromGUIDW ( REFGUID  guid,
LPWSTR  lpszDest,
INT  cchMax 
)

Definition at line 661 of file ordinal.c.

662{
663 WCHAR xguid[40];
664 INT iLen;
665 static const WCHAR wszFormat[] = {'{','%','0','8','l','X','-','%','0','4','X','-','%','0','4','X','-',
666 '%','0','2','X','%','0','2','X','-','%','0','2','X','%','0','2','X','%','0','2','X','%','0','2',
667 'X','%','0','2','X','%','0','2','X','}',0};
668
669 TRACE("(%s,%p,%d)\n", debugstr_guid(guid), lpszDest, cchMax);
670
671 sprintfW(xguid, wszFormat, guid->Data1, guid->Data2, guid->Data3,
672 guid->Data4[0], guid->Data4[1], guid->Data4[2], guid->Data4[3],
673 guid->Data4[4], guid->Data4[5], guid->Data4[6], guid->Data4[7]);
674
675 iLen = strlenW(xguid) + 1;
676
677 if (iLen > cchMax)
678 return 0;
679 memcpy(lpszDest, xguid, iLen*sizeof(WCHAR));
680 return iLen;
681}
UINT cchMax
WCHAR lpszDest[260]
const GUID * guid
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define sprintfW
Definition: unicode.h:64
int32_t INT
Definition: typedefs.h:58

Referenced by SHCoCreateInstance().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( shell  )

Variable Documentation

◆ clsid

◆ dclfvt

static const IClassFactoryVtbl dclfvt
static
Initial value:
=
{
}
static HRESULT WINAPI IDefClF_fnLockServer(LPCLASSFACTORY iface, BOOL fLock)
Definition: shellole.c:480
static ULONG WINAPI IDefClF_fnRelease(LPCLASSFACTORY iface)
Definition: shellole.c:438
static ULONG WINAPI IDefClF_fnAddRef(LPCLASSFACTORY iface)
Definition: shellole.c:426
static HRESULT WINAPI IDefClF_fnQueryInterface(LPCLASSFACTORY iface, REFIID riid, LPVOID *ppvObj)
Definition: shellole.c:405
static HRESULT WINAPI IDefClF_fnCreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pUnkOuter, REFIID riid, LPVOID *ppvObject)
Definition: shellole.c:458

Definition at line 380 of file shellole.c.

Referenced by IDefClF_fnConstructor().

◆ 

const struct { ... } InterfaceTable[]
Initial value:
= {
{&CLSID_ApplicationAssociationRegistration, ApplicationAssociationRegistration_Constructor},
{&CLSID_AutoComplete, IAutoComplete_Constructor},
{&CLSID_ControlPanel, IControlPanel_Constructor},
{&CLSID_DragDropHelper, IDropTargetHelper_Constructor},
{&CLSID_FolderShortcut, FolderShortcut_Constructor},
{&CLSID_MyComputer, ISF_MyComputer_Constructor},
{&CLSID_MyDocuments, MyDocuments_Constructor},
{&CLSID_NetworkPlaces, ISF_NetworkPlaces_Constructor},
{&CLSID_Printers, Printers_Constructor},
{&CLSID_QueryAssociations, QueryAssociations_Constructor},
{&CLSID_RecycleBin, RecycleBin_Constructor},
{&CLSID_ShellDesktop, ISF_Desktop_Constructor},
{&CLSID_ShellFSFolder, IFSFolder_Constructor},
{&CLSID_ShellItem, IShellItem_Constructor},
{&CLSID_ShellLink, IShellLink_Constructor},
{&CLSID_UnixDosFolder, UnixDosFolder_Constructor},
{&CLSID_UnixFolder, UnixFolder_Constructor},
{&CLSID_ExplorerBrowser,ExplorerBrowser_Constructor},
{&CLSID_KnownFolderManager, KnownFolderManager_Constructor},
{&CLSID_Shell, IShellDispatch_Constructor},
}
const GUID CLSID_UnixDosFolder
const GUID CLSID_UnixFolder

Referenced by DllGetClassObject().

◆ lpfnCI