ReactOS  0.4.14-dev-593-g1793dcc
shellole.c
Go to the documentation of this file.
1 /*
2  * handling of SHELL32.DLL OLE-Objects
3  *
4  * Copyright 1997 Marcus Meissner
5  * Copyright 1998 Juergen Schmied <juergen.schmied@metronet.de>
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with this library; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
20  */
21 
22 #include <wine/config.h>
23 
24 #include <stdarg.h>
25 #include <stdlib.h>
26 #include <string.h>
27 
28 #define WIN32_NO_STATUS
29 #define _INC_WINDOWS
30 #define COBJMACROS
31 #define NONAMELESSUNION
32 
33 #include <windef.h>
34 #include <winbase.h>
35 #include <shellapi.h>
36 #include <shlobj.h>
37 #include <shlwapi.h>
38 #include <debughlp.h>
39 
40 #include <wine/debug.h>
41 #include <wine/unicode.h>
42 
43 #include "shell32_main.h"
44 
46 
47 extern INT WINAPI SHStringFromGUIDW(REFGUID guid, LPWSTR lpszDest, INT cchMax); /* shlwapi.24 */
48 
49 /**************************************************************************
50  * Default ClassFactory types
51  */
53 
54 #ifndef __REACTOS__
55 
57 
58 /* this table contains all CLSIDs of shell32 objects */
59 static const struct {
62 } InterfaceTable[] = {
63 
64  {&CLSID_ApplicationAssociationRegistration, ApplicationAssociationRegistration_Constructor},
65  {&CLSID_AutoComplete, IAutoComplete_Constructor},
66  {&CLSID_ControlPanel, IControlPanel_Constructor},
67  {&CLSID_DragDropHelper, IDropTargetHelper_Constructor},
68  {&CLSID_FolderShortcut, FolderShortcut_Constructor},
69  {&CLSID_MyComputer, ISF_MyComputer_Constructor},
70  {&CLSID_MyDocuments, MyDocuments_Constructor},
71  {&CLSID_NetworkPlaces, ISF_NetworkPlaces_Constructor},
72  {&CLSID_Printers, Printers_Constructor},
73  {&CLSID_QueryAssociations, QueryAssociations_Constructor},
74  {&CLSID_RecycleBin, RecycleBin_Constructor},
75  {&CLSID_ShellDesktop, ISF_Desktop_Constructor},
76  {&CLSID_ShellFSFolder, IFSFolder_Constructor},
77  {&CLSID_ShellItem, IShellItem_Constructor},
78  {&CLSID_ShellLink, IShellLink_Constructor},
79  {&CLSID_UnixDosFolder, UnixDosFolder_Constructor},
80  {&CLSID_UnixFolder, UnixFolder_Constructor},
81  {&CLSID_ExplorerBrowser,ExplorerBrowser_Constructor},
82  {&CLSID_KnownFolderManager, KnownFolderManager_Constructor},
83  {&CLSID_Shell, IShellDispatch_Constructor},
84  {NULL, NULL}
85 };
86 
87 #endif /* !__REACTOS__ */
88 
89 /*************************************************************************
90  * SHCoCreateInstance [SHELL32.102]
91  *
92  * Equivalent to CoCreateInstance. Under Windows 9x this function could sometimes
93  * use the shell32 built-in "mini-COM" without the need to load ole32.dll - see
94  * SHLoadOLE for details.
95  *
96  * Under wine if a "LoadWithoutCOM" value is present or the object resides in
97  * shell32.dll the function will load the object manually without the help of ole32
98  *
99  * NOTES
100  * exported by ordinal
101  *
102  * SEE ALSO
103  * CoCreateInstance, SHLoadOLE
104  */
106  LPCWSTR aclsid,
107  const CLSID *clsid,
108  LPUNKNOWN pUnkOuter,
109  REFIID refiid,
110  LPVOID *ppv)
111 {
112  DWORD hres;
113  CLSID iid;
114  const CLSID * myclsid = clsid;
115  WCHAR sKeyName[MAX_PATH];
116  static const WCHAR sCLSID[] = {'C','L','S','I','D','\\','\0'};
117  WCHAR sClassID[60];
118  static const WCHAR sInProcServer32[] = {'\\','I','n','p','r','o','c','S','e','r','v','e','r','3','2','\0'};
119  static const WCHAR sLoadWithoutCOM[] = {'L','o','a','d','W','i','t','h','o','u','t','C','O','M','\0'};
120  WCHAR sDllPath[MAX_PATH];
121  HKEY hKey = 0;
122  DWORD dwSize;
123  IClassFactory * pcf = NULL;
124 
125  if(!ppv) return E_POINTER;
126  *ppv=NULL;
127 
128  /* if the clsid is a string, convert it */
129  if (!clsid)
130  {
131  if (!aclsid) return REGDB_E_CLASSNOTREG;
132  SHCLSIDFromStringW(aclsid, &iid);
133  myclsid = &iid;
134  }
135 
136  TRACE("(%p,%s,unk:%p,%s,%p)\n",
137  aclsid,shdebugstr_guid(myclsid),pUnkOuter,shdebugstr_guid(refiid),ppv);
138 
139  if (SUCCEEDED(DllGetClassObject(myclsid, &IID_IClassFactory,(LPVOID*)&pcf)))
140  {
141  hres = IClassFactory_CreateInstance(pcf, pUnkOuter, refiid, ppv);
142  IClassFactory_Release(pcf);
143  goto end;
144  }
145 
146  /* we look up the dll path in the registry */
147  SHStringFromGUIDW(myclsid, sClassID, sizeof(sClassID)/sizeof(WCHAR));
148  lstrcpyW(sKeyName, sCLSID);
149  lstrcatW(sKeyName, sClassID);
150  lstrcatW(sKeyName, sInProcServer32);
151 
152  if (RegOpenKeyExW(HKEY_CLASSES_ROOT, sKeyName, 0, KEY_READ, &hKey))
153  return E_ACCESSDENIED;
154 
155  /* if a special registry key is set, we load a shell extension without help of OLE32 */
156  if (!SHQueryValueExW(hKey, sLoadWithoutCOM, 0, 0, 0, 0))
157  {
158  /* load an external dll without ole32 */
162 
163  dwSize = sizeof(sDllPath);
164  SHQueryValueExW(hKey, NULL, 0,0, sDllPath, &dwSize );
165 
166  if ((hLibrary = LoadLibraryExW(sDllPath, 0, LOAD_WITH_ALTERED_SEARCH_PATH)) == 0) {
167  ERR("couldn't load InprocServer32 dll %s\n", debugstr_w(sDllPath));
169  goto end;
170  } else if (!(DllGetClassObject = (DllGetClassObjectFunc)GetProcAddress(hLibrary, "DllGetClassObject"))) {
171  ERR("couldn't find function DllGetClassObject in %s\n", debugstr_w(sDllPath));
174  goto end;
175  } else if (FAILED(hres = DllGetClassObject(myclsid, &IID_IClassFactory, (LPVOID*)&pcf))) {
176  TRACE("GetClassObject failed 0x%08x\n", hres);
177  goto end;
178  }
179 
180  hres = IClassFactory_CreateInstance(pcf, pUnkOuter, refiid, ppv);
181  IClassFactory_Release(pcf);
182  } else {
183 
184  /* load an external dll in the usual way */
185  hres = CoCreateInstance(myclsid, pUnkOuter, CLSCTX_INPROC_SERVER, refiid, ppv);
186  }
187 
188 end:
189  if (hKey) RegCloseKey(hKey);
190  if(hres!=S_OK)
191  {
192  ERR("failed (0x%08x) to create CLSID:%s IID:%s\n",
193  hres, shdebugstr_guid(myclsid), shdebugstr_guid(refiid));
194  ERR("class not found in registry\n");
195  }
196 
197  TRACE("-- instance: %p\n",*ppv);
198  return hres;
199 }
200 
201 #ifndef __REACTOS__
202 /*************************************************************************
203  * DllGetClassObject [SHELL32.@]
204  * SHDllGetClassObject [SHELL32.128]
205  */
207 {
208  IClassFactory * pcf = NULL;
209  HRESULT hres;
210  int i;
211 
212  TRACE("CLSID:%s,IID:%s\n",shdebugstr_guid(rclsid),shdebugstr_guid(iid));
213 
214  if (!ppv) return E_INVALIDARG;
215  *ppv = NULL;
216 
217  /* search our internal interface table */
218  for(i=0;InterfaceTable[i].clsid;i++) {
219  if(IsEqualIID(InterfaceTable[i].clsid, rclsid)) {
220  TRACE("index[%u]\n", i);
222  break;
223  }
224  }
225 
226  if (!pcf) {
227  FIXME("failed for CLSID=%s\n", shdebugstr_guid(rclsid));
229  }
230 
231  hres = IClassFactory_QueryInterface(pcf, iid, ppv);
232  IClassFactory_Release(pcf);
233 
234  TRACE("-- pointer to class factory: %p\n",*ppv);
235  return hres;
236 }
237 #endif
238 
239 /*************************************************************************
240  * SHCLSIDFromString [SHELL32.147]
241  *
242  * Under Windows 9x this was an ANSI version of CLSIDFromString. It also allowed
243  * to avoid dependency on ole32.dll (see SHLoadOLE for details).
244  *
245  * Under Windows NT/2000/XP this is equivalent to CLSIDFromString
246  *
247  * NOTES
248  * exported by ordinal
249  *
250  * SEE ALSO
251  * CLSIDFromString, SHLoadOLE
252  */
254 {
255  WCHAR buffer[40];
256  TRACE("(%p(%s) %p)\n", clsid, clsid, id);
257  if (!MultiByteToWideChar( CP_ACP, 0, clsid, -1, buffer, sizeof(buffer)/sizeof(WCHAR) ))
258  return CO_E_CLASSSTRING;
259  return CLSIDFromString( buffer, id );
260 }
262 {
263  TRACE("(%p(%s) %p)\n", clsid, debugstr_w(clsid), id);
264  return CLSIDFromString(clsid, id);
265 }
267 {
268  if (SHELL_OsIsUnicode())
269  return SHCLSIDFromStringW (clsid, id);
270  return SHCLSIDFromStringA (clsid, id);
271 }
272 
273 /*************************************************************************
274  * SHGetMalloc [SHELL32.@]
275  *
276  * Equivalent to CoGetMalloc(MEMCTX_TASK, ...). Under Windows 9x this function
277  * could use the shell32 built-in "mini-COM" without the need to load ole32.dll -
278  * see SHLoadOLE for details.
279  *
280  * PARAMS
281  * lpmal [O] Destination for IMalloc interface.
282  *
283  * RETURNS
284  * Success: S_OK. lpmal contains the shells IMalloc interface.
285  * Failure. An HRESULT error code.
286  *
287  * SEE ALSO
288  * CoGetMalloc, SHLoadOLE
289  */
291 {
292  TRACE("(%p)\n", lpmal);
293  return CoGetMalloc(MEMCTX_TASK, lpmal);
294 }
295 
296 /*************************************************************************
297  * SHAlloc [SHELL32.196]
298  *
299  * Equivalent to CoTaskMemAlloc. Under Windows 9x this function could use
300  * the shell32 built-in "mini-COM" without the need to load ole32.dll -
301  * see SHLoadOLE for details.
302  *
303  * NOTES
304  * exported by ordinal
305  *
306  * SEE ALSO
307  * CoTaskMemAlloc, SHLoadOLE
308  */
310 {
311  LPVOID ret;
312 
314  TRACE("%u bytes at %p\n",len, ret);
315  return ret;
316 }
317 
318 /*************************************************************************
319  * SHFree [SHELL32.195]
320  *
321  * Equivalent to CoTaskMemFree. Under Windows 9x this function could use
322  * the shell32 built-in "mini-COM" without the need to load ole32.dll -
323  * see SHLoadOLE for details.
324  *
325  * NOTES
326  * exported by ordinal
327  *
328  * SEE ALSO
329  * CoTaskMemFree, SHLoadOLE
330  */
332 {
333  TRACE("%p\n",pv);
334  CoTaskMemFree(pv);
335 }
336 
337 #ifndef __REACTOS__
338 /*************************************************************************
339  * SHGetDesktopFolder [SHELL32.@]
340  */
342 {
343  HRESULT hres;
344 
345  TRACE("(%p)\n", psf);
346 
347  if(!psf) return E_INVALIDARG;
348 
349  *psf = NULL;
350  hres = ISF_Desktop_Constructor(NULL, &IID_IShellFolder, (LPVOID*)psf);
351 
352  TRACE("-- %p->(%p) 0x%08x\n", psf, *psf, hres);
353  return hres;
354 }
355 #endif
356 
357 /**************************************************************************
358  * Default ClassFactory Implementation
359  *
360  * SHCreateDefClassObject
361  *
362  * NOTES
363  * Helper function for dlls without their own classfactory.
364  * A generic classfactory is returned.
365  * When the CreateInstance of the cf is called the callback is executed.
366  */
367 
368 #ifndef __REACTOS__
369 
370 typedef struct
371 {
374  CLSID *rclsid;
376  const IID * riidInst;
377  LONG * pcRefDll; /* pointer to refcounter in external dll (ugrrr...) */
378 } IDefClFImpl;
379 
381 {
382  return CONTAINING_RECORD(iface, IDefClFImpl, IClassFactory_iface);
383 }
384 
385 static const IClassFactoryVtbl dclfvt;
386 
387 /**************************************************************************
388  * IDefClF_fnConstructor
389  */
390 
392 {
393  IDefClFImpl* lpclf;
394 
395  lpclf = HeapAlloc(GetProcessHeap(),0,sizeof(IDefClFImpl));
396  lpclf->ref = 1;
397  lpclf->IClassFactory_iface.lpVtbl = &dclfvt;
398  lpclf->lpfnCI = lpfnCI;
399  lpclf->pcRefDll = pcRefDll;
400 
401  if (pcRefDll) InterlockedIncrement(pcRefDll);
402  lpclf->riidInst = riidInst;
403 
404  TRACE("(%p)%s\n",lpclf, shdebugstr_guid(riidInst));
405  return (LPCLASSFACTORY)lpclf;
406 }
407 /**************************************************************************
408  * IDefClF_fnQueryInterface
409  */
411  LPCLASSFACTORY iface, REFIID riid, LPVOID *ppvObj)
412 {
414 
415  TRACE("(%p)->(%s)\n",This,shdebugstr_guid(riid));
416 
417  *ppvObj = NULL;
418 
420  *ppvObj = This;
421  InterlockedIncrement(&This->ref);
422  return S_OK;
423  }
424 
425  TRACE("-- E_NOINTERFACE\n");
426  return E_NOINTERFACE;
427 }
428 /******************************************************************************
429  * IDefClF_fnAddRef
430  */
431 static ULONG WINAPI IDefClF_fnAddRef(LPCLASSFACTORY iface)
432 {
434  ULONG refCount = InterlockedIncrement(&This->ref);
435 
436  TRACE("(%p)->(count=%u)\n", This, refCount - 1);
437 
438  return refCount;
439 }
440 /******************************************************************************
441  * IDefClF_fnRelease
442  */
443 static ULONG WINAPI IDefClF_fnRelease(LPCLASSFACTORY iface)
444 {
446  ULONG refCount = InterlockedDecrement(&This->ref);
447 
448  TRACE("(%p)->(count=%u)\n", This, refCount + 1);
449 
450  if (!refCount)
451  {
452  if (This->pcRefDll) InterlockedDecrement(This->pcRefDll);
453 
454  TRACE("-- destroying IClassFactory(%p)\n",This);
456  return 0;
457  }
458  return refCount;
459 }
460 /******************************************************************************
461  * IDefClF_fnCreateInstance
462  */
464  LPCLASSFACTORY iface, LPUNKNOWN pUnkOuter, REFIID riid, LPVOID *ppvObject)
465 {
467 
468  TRACE("%p->(%p,%s,%p)\n",This,pUnkOuter,shdebugstr_guid(riid),ppvObject);
469 
470  *ppvObject = NULL;
471 
472  if ( This->riidInst==NULL ||
473  IsEqualCLSID(riid, This->riidInst) ||
475  {
476  return This->lpfnCI(pUnkOuter, riid, ppvObject);
477  }
478 
479  ERR("unknown IID requested %s\n",shdebugstr_guid(riid));
480  return E_NOINTERFACE;
481 }
482 /******************************************************************************
483  * IDefClF_fnLockServer
484  */
485 static HRESULT WINAPI IDefClF_fnLockServer(LPCLASSFACTORY iface, BOOL fLock)
486 {
488  TRACE("%p->(0x%x), not implemented\n",This, fLock);
489  return E_NOTIMPL;
490 }
491 
492 static const IClassFactoryVtbl dclfvt =
493 {
499 };
500 
501 /******************************************************************************
502  * SHCreateDefClassObject [SHELL32.70]
503  */
505  REFIID riid,
506  LPVOID* ppv,
507  LPFNCREATEINSTANCE lpfnCI, /* [in] create instance callback entry */
508  LPDWORD pcRefDll, /* [in/out] ref count of the dll */
509  REFIID riidInst) /* [in] optional interface to the instance */
510 {
511  IClassFactory * pcf;
512 
513  TRACE("%s %p %p %p %s\n",
514  shdebugstr_guid(riid), ppv, lpfnCI, pcRefDll, shdebugstr_guid(riidInst));
515 
517  if (! (pcf = IDefClF_fnConstructor(lpfnCI, (PLONG)pcRefDll, riidInst))) return E_OUTOFMEMORY;
518  *ppv = pcf;
519  return S_OK;
520 }
521 
522 #endif /* !__REACTOS__ */
523 
524 /*************************************************************************
525  * DragAcceptFiles [SHELL32.@]
526  */
528 {
529  LONG exstyle;
530 
531  if( !IsWindow(hWnd) ) return;
533  if (b)
534  exstyle |= WS_EX_ACCEPTFILES;
535  else
536  exstyle &= ~WS_EX_ACCEPTFILES;
538 }
539 
540 /*************************************************************************
541  * DragFinish [SHELL32.@]
542  */
543 void WINAPI DragFinish(HDROP h)
544 {
545  TRACE("\n");
546  GlobalFree(h);
547 }
548 
549 /*************************************************************************
550  * DragQueryPoint [SHELL32.@]
551  */
553 {
554  DROPFILES *lpDropFileStruct;
555  BOOL bRet;
556 
557  TRACE("\n");
558 
559  lpDropFileStruct = GlobalLock(hDrop);
560 
561  *p = lpDropFileStruct->pt;
562  bRet = lpDropFileStruct->fNC;
563 
564  GlobalUnlock(hDrop);
565  return bRet;
566 }
567 
568 /*************************************************************************
569  * DragQueryFileA [SHELL32.@]
570  * DragQueryFile [SHELL32.@]
571  */
573  HDROP hDrop,
574  UINT lFile,
575  LPSTR lpszFile,
576  UINT lLength)
577 {
578  LPSTR lpDrop;
579  UINT i = 0;
580  DROPFILES *lpDropFileStruct = GlobalLock(hDrop);
581 
582  TRACE("(%p, %x, %p, %u)\n", hDrop,lFile,lpszFile,lLength);
583 
584  if(!lpDropFileStruct) goto end;
585 
586  lpDrop = (LPSTR) lpDropFileStruct + lpDropFileStruct->pFiles;
587 
588  if(lpDropFileStruct->fWide) {
589  LPWSTR lpszFileW = NULL;
590 
591  if(lpszFile && lFile != 0xFFFFFFFF) {
592  lpszFileW = HeapAlloc(GetProcessHeap(), 0, lLength*sizeof(WCHAR));
593  if(lpszFileW == NULL) {
594  goto end;
595  }
596  }
597  i = DragQueryFileW(hDrop, lFile, lpszFileW, lLength);
598 
599  if(lpszFileW) {
600  WideCharToMultiByte(CP_ACP, 0, lpszFileW, -1, lpszFile, lLength, 0, NULL);
601  HeapFree(GetProcessHeap(), 0, lpszFileW);
602  }
603  goto end;
604  }
605 
606  while (i++ < lFile)
607  {
608  while (*lpDrop++); /* skip filename */
609  if (!*lpDrop)
610  {
611  i = (lFile == 0xFFFFFFFF) ? i : 0;
612  goto end;
613  }
614  }
615 
616  i = strlen(lpDrop);
617  if (!lpszFile ) goto end; /* needed buffer size */
618  lstrcpynA (lpszFile, lpDrop, lLength);
619 end:
620  GlobalUnlock(hDrop);
621  return i;
622 }
623 
624 /*************************************************************************
625  * DragQueryFileW [SHELL32.@]
626  */
628  HDROP hDrop,
629  UINT lFile,
630  LPWSTR lpszwFile,
631  UINT lLength)
632 {
633  LPWSTR lpwDrop;
634  UINT i = 0;
635  DROPFILES *lpDropFileStruct = GlobalLock(hDrop);
636 
637  TRACE("(%p, %x, %p, %u)\n", hDrop,lFile,lpszwFile,lLength);
638 
639  if(!lpDropFileStruct) goto end;
640 
641  lpwDrop = (LPWSTR) ((LPSTR)lpDropFileStruct + lpDropFileStruct->pFiles);
642 
643  if(lpDropFileStruct->fWide == FALSE) {
644  LPSTR lpszFileA = NULL;
645 
646  if(lpszwFile && lFile != 0xFFFFFFFF) {
647  lpszFileA = HeapAlloc(GetProcessHeap(), 0, lLength);
648  if(lpszFileA == NULL) {
649  goto end;
650  }
651  }
652  i = DragQueryFileA(hDrop, lFile, lpszFileA, lLength);
653 
654  if(lpszFileA) {
655  MultiByteToWideChar(CP_ACP, 0, lpszFileA, -1, lpszwFile, lLength);
656  HeapFree(GetProcessHeap(), 0, lpszFileA);
657  }
658  goto end;
659  }
660 
661  i = 0;
662  while (i++ < lFile)
663  {
664  while (*lpwDrop++); /* skip filename */
665  if (!*lpwDrop)
666  {
667  i = (lFile == 0xFFFFFFFF) ? i : 0;
668  goto end;
669  }
670  }
671 
672  i = strlenW(lpwDrop);
673  if ( !lpszwFile) goto end; /* needed buffer size */
674  lstrcpynW (lpszwFile, lpwDrop, lLength);
675 end:
676  GlobalUnlock(hDrop);
677  return i;
678 }
679 
680 /*************************************************************************
681  * SHPropStgCreate [SHELL32.685]
682  */
684  const CLSID *pclsid, DWORD grfFlags, DWORD grfMode,
685  DWORD dwDisposition, IPropertyStorage **ppstg, UINT *puCodePage)
686 {
687  PROPSPEC prop;
688  PROPVARIANT ret;
689  HRESULT hres;
690 
691  TRACE("%p %s %s %x %x %x %p %p\n", psstg, debugstr_guid(fmtid), debugstr_guid(pclsid),
692  grfFlags, grfMode, dwDisposition, ppstg, puCodePage);
693 
694  hres = IPropertySetStorage_Open(psstg, fmtid, grfMode, ppstg);
695 
696  switch(dwDisposition) {
697  case CREATE_ALWAYS:
698  if(SUCCEEDED(hres)) {
699  IPropertyStorage_Release(*ppstg);
700  hres = IPropertySetStorage_Delete(psstg, fmtid);
701  if(FAILED(hres))
702  return hres;
703  hres = E_FAIL;
704  }
705 
706  case OPEN_ALWAYS:
707  case CREATE_NEW:
708  if(FAILED(hres))
709  hres = IPropertySetStorage_Create(psstg, fmtid, pclsid,
710  grfFlags, grfMode, ppstg);
711 
712  case OPEN_EXISTING:
713  if(FAILED(hres))
714  return hres;
715 
716  if(puCodePage) {
717  prop.ulKind = PRSPEC_PROPID;
718  prop.u.propid = PID_CODEPAGE;
719  hres = IPropertyStorage_ReadMultiple(*ppstg, 1, &prop, &ret);
720  if(FAILED(hres) || ret.vt!=VT_I2)
721  *puCodePage = 0;
722  else
723  *puCodePage = ret.u.iVal;
724  }
725  }
726 
727  return S_OK;
728 }
729 
730 /*************************************************************************
731  * SHPropStgReadMultiple [SHELL32.688]
732  */
734  ULONG cpspec, const PROPSPEC *rgpspec, PROPVARIANT *rgvar)
735 {
736  STATPROPSETSTG stat;
737  HRESULT hres;
738 
739  FIXME("%p %u %u %p %p\n", pps, uCodePage, cpspec, rgpspec, rgvar);
740 
741  memset(rgvar, 0, cpspec*sizeof(PROPVARIANT));
742  hres = IPropertyStorage_ReadMultiple(pps, cpspec, rgpspec, rgvar);
743  if(FAILED(hres))
744  return hres;
745 
746  if(!uCodePage) {
747  PROPSPEC prop;
748  PROPVARIANT ret;
749 
750  prop.ulKind = PRSPEC_PROPID;
751  prop.u.propid = PID_CODEPAGE;
752  hres = IPropertyStorage_ReadMultiple(pps, 1, &prop, &ret);
753  if(FAILED(hres) || ret.vt!=VT_I2)
754  return S_OK;
755 
756  uCodePage = ret.u.iVal;
757  }
758 
759  hres = IPropertyStorage_Stat(pps, &stat);
760  if(FAILED(hres))
761  return S_OK;
762 
763  /* TODO: do something with codepage and stat */
764  return S_OK;
765 }
766 
767 /*************************************************************************
768  * SHPropStgWriteMultiple [SHELL32.689]
769  */
771  ULONG cpspec, const PROPSPEC *rgpspec, PROPVARIANT *rgvar, PROPID propidNameFirst)
772 {
773  STATPROPSETSTG stat;
774  UINT codepage;
775  HRESULT hres;
776 
777  FIXME("%p %p %u %p %p %d\n", pps, uCodePage, cpspec, rgpspec, rgvar, propidNameFirst);
778 
779  hres = IPropertyStorage_Stat(pps, &stat);
780  if(FAILED(hres))
781  return hres;
782 
783  if(uCodePage && *uCodePage)
784  codepage = *uCodePage;
785  else {
786  PROPSPEC prop;
787  PROPVARIANT ret;
788 
789  prop.ulKind = PRSPEC_PROPID;
790  prop.u.propid = PID_CODEPAGE;
791  hres = IPropertyStorage_ReadMultiple(pps, 1, &prop, &ret);
792  if(FAILED(hres))
793  return hres;
794  if(ret.vt!=VT_I2 || !ret.u.iVal)
795  return E_FAIL;
796 
797  codepage = ret.u.iVal;
798  if(uCodePage)
799  *uCodePage = codepage;
800  }
801 
802  /* TODO: do something with codepage and stat */
803 
804  hres = IPropertyStorage_WriteMultiple(pps, cpspec, rgpspec, rgvar, propidNameFirst);
805  return hres;
806 }
807 
808 /*************************************************************************
809  * SHCreateQueryCancelAutoPlayMoniker [SHELL32.@]
810  */
812 {
813  TRACE("%p\n", moniker);
814 
815  if (!moniker) return E_INVALIDARG;
816  return CreateClassMoniker(&CLSID_QueryCancelAutoPlay, moniker);
817 }
IClassFactory IClassFactory_iface
Definition: shellole.c:372
const GUID CLSID_UnixDosFolder
#define E_ACCESSDENIED
Definition: winerror.h:2849
#define REFIID
Definition: guiddef.h:118
const GUID CLSID_UnixFolder
#define E_NOINTERFACE
Definition: winerror.h:2364
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:420
WINE_UNICODE_INLINE unsigned int strlenW(const WCHAR *str)
Definition: unicode.h:212
#define WideCharToMultiByte
Definition: compat.h:101
Definition: scsiwmi.h:51
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
BOOL WINAPI IsWindow(_In_opt_ HWND)
POINT pt
Definition: shlobj.h:2116
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
static const IClassFactoryVtbl dclfvt
Definition: shellole.c:385
static HRESULT(WINAPI *pSHPropStgCreate)(IPropertySetStorage *
#define KEY_READ
Definition: nt_native.h:1023
interface IMalloc * LPMALLOC
Definition: objfwd.h:12
REFIID riid
Definition: precomp.h:44
WINE_DEFAULT_DEBUG_CHANNEL(shell)
#define REFCLSID
Definition: guiddef.h:117
#define CP_ACP
Definition: compat.h:99
HINSTANCE WINAPI DECLSPEC_HOTPATCH LoadLibraryExW(LPCWSTR lpLibFileName, HANDLE hFile, DWORD dwFlags)
Definition: loader.c:288
HRESULT WINAPI SHCreateQueryCancelAutoPlayMoniker(IMoniker **moniker)
Definition: shellole.c:811
DWORD WINAPI SHCLSIDFromStringA(LPCSTR clsid, CLSID *id)
Definition: shellole.c:253
#define CALLBACK
Definition: compat.h:27
LONG * pcRefDll
Definition: shell32.cpp:134
HWND hWnd
Definition: settings.c:17
REFIID LPVOID * ppv
Definition: atlbase.h:39
void WINAPI DragAcceptFiles(HWND hWnd, BOOL b)
Definition: shellole.c:527
const char * shdebugstr_guid(const struct _GUID *id)
Definition: debughlp.cpp:414
LPFNCREATEINSTANCE lpfnCI
Definition: shellole.c:61
static IDefClFImpl * impl_from_IClassFactory(IClassFactory *iface)
Definition: shellole.c:380
HRESULT WINAPI SHGetMalloc(LPMALLOC *lpmal)
Definition: shellole.c:290
#define GWL_EXSTYLE
Definition: winuser.h:845
GLuint buffer
Definition: glext.h:5915
HRESULT(CALLBACK * DllGetClassObjectFunc)(REFCLSID clsid, REFIID iid, LPVOID *ppv)
Definition: compobj.c:449
GLuint GLuint end
Definition: gl.h:1545
#define LOAD_WITH_ALTERED_SEARCH_PATH
Definition: winbase.h:339
static __inline BOOL SHELL_OsIsUnicode(void)
Definition: shell32_main.h:130
char * LPSTR
Definition: xmlstorage.h:182
static const CLSID IPropertyStorage UINT *static const PROPSPEC PROPVARIANT *static UINT const PROPSPEC PROPVARIANT PROPID
Definition: shellole.c:77
#define E_FAIL
Definition: ddrawi.h:102
#define CLASS_E_CLASSNOTAVAILABLE
Definition: winerror.h:2663
int32_t INT
Definition: typedefs.h:56
#define PID_CODEPAGE
Definition: suminfo.c:43
#define lstrcpynW
Definition: compat.h:405
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:7723
static const struct @541 InterfaceTable[]
HRESULT WINAPI SHCreateDefClassObject(REFIID riid, LPVOID *ppv, LPFNCREATEINSTANCE lpfnCI, LPDWORD pcRefDll, REFIID riidInst)
Definition: shellole.c:504
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
const GUID * guid
HRESULT WINAPI SHGetDesktopFolder(IShellFolder **psf)
Definition: shellole.c:341
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
HRESULT WINAPI CoGetMalloc(DWORD context, IMalloc **imalloc)
Definition: ifs.c:381
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
static ULONG WINAPI IDefClF_fnAddRef(LPCLASSFACTORY iface)
Definition: shellole.c:431
static HRESULT WINAPI IDefClF_fnLockServer(LPCLASSFACTORY iface, BOOL fLock)
Definition: shellole.c:485
unsigned int BOOL
Definition: ntddk_ex.h:94
long LONG
Definition: pedump.c:60
REFIID clsid
Definition: shellole.c:60
static LPUNKNOWN
Definition: ndr_ole.c:49
#define debugstr_w
Definition: kernel32.h:32
#define FIXME(fmt,...)
Definition: debug.h:110
int codepage
Definition: win_iconv.c:156
#define E_INVALIDARG
Definition: ddrawi.h:101
LONG ref
Definition: shellole.c:373
smooth NULL
Definition: ftsmooth.c:416
WCHAR lpszDest[260]
static IClassFactory * IDefClF_fnConstructor(LPFNCREATEINSTANCE lpfnCI, PLONG pcRefDll, REFIID riidInst)
Definition: shellole.c:391
const char * LPCSTR
Definition: xmlstorage.h:183
BOOL fNC
Definition: shlobj.h:2117
#define debugstr_guid
Definition: kernel32.h:35
HRESULT WINAPI SHCoCreateInstance(LPCWSTR aclsid, const CLSID *clsid, LPUNKNOWN pUnkOuter, REFIID refiid, LPVOID *ppv)
Definition: shellole.c:105
#define OPEN_EXISTING
Definition: compat.h:434
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
HRESULT(CALLBACK * LPFNCREATEINSTANCE)(IUnknown *pUnkOuter, REFIID riid, LPVOID *ppvObject)
Definition: shellole.c:52
#define GetWindowLongPtrA
Definition: winuser.h:4803
UINT WINAPI DragQueryFileA(HDROP hDrop, UINT lFile, LPSTR lpszFile, UINT lLength)
Definition: shellole.c:572
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
#define TRACE(s)
Definition: solgame.cpp:4
#define FreeLibrary(x)
Definition: compat.h:413
HRESULT hres
Definition: protocol.c:465
#define GetProcessHeap()
Definition: compat.h:403
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__wchar_t WCHAR
Definition: xmlstorage.h:180
static HRESULT WINAPI IDefClF_fnQueryInterface(LPCLASSFACTORY iface, REFIID riid, LPVOID *ppvObj)
Definition: shellole.c:410
LONG HRESULT
Definition: typedefs.h:77
static REFFMTID
Definition: shellole.c:73
const GUID IID_IUnknown
HRESULT WINAPI SHPropStgWriteMultiple(IPropertyStorage *pps, UINT *uCodePage, ULONG cpspec, const PROPSPEC *rgpspec, PROPVARIANT *rgvar, PROPID propidNameFirst)
Definition: shellole.c:770
#define MAX_PATH
Definition: compat.h:26
#define WINAPI
Definition: msvc.h:6
static HRESULT WINAPI IDefClF_fnCreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pUnkOuter, REFIID riid, LPVOID *ppvObject)
Definition: shellole.c:463
BOOL fWide
Definition: shlobj.h:2118
DWORD WINAPI SHCLSIDFromStringAW(LPCVOID clsid, CLSID *id)
Definition: shellole.c:266
unsigned long DWORD
Definition: ntddk_ex.h:95
HGLOBAL NTAPI GlobalFree(HGLOBAL hMem)
Definition: heapmem.c:611
#define OPEN_ALWAYS
Definition: disk.h:70
DWORD WINAPI SHCLSIDFromStringW(LPCWSTR clsid, CLSID *id)
Definition: shellole.c:261
UINT cchMax
int ret
DWORD WINAPI SHQueryValueExW(HKEY hKey, LPCWSTR lpszValue, LPDWORD lpReserved, LPDWORD pwType, LPVOID pvData, LPDWORD pcbData)
Definition: reg.c:1461
LPVOID NTAPI GlobalLock(HGLOBAL hMem)
Definition: heapmem.c:755
#define InterlockedDecrement
Definition: armddk.h:52
const IID * riidInst
Definition: shell32.cpp:133
Definition: stat.h:55
HMODULE hLibrary
Definition: odbccp32.c:12
GLenum GLsizei len
Definition: glext.h:6722
#define SetWindowLongPtrA
Definition: winuser.h:5320
BOOL WINAPI DragQueryPoint(HDROP hDrop, POINT *p)
Definition: shellole.c:552
REFIID LPVOID * ppvObject
Definition: precomp.h:44
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv)
Definition: compobj.c:3325
#define ERR(fmt,...)
Definition: debug.h:109
ULONG_PTR SIZE_T
Definition: typedefs.h:78
_CRTIMP int __cdecl stat(const char *_Filename, struct stat *_Stat)
Definition: stat.h:345
#define S_OK
Definition: intsafe.h:59
#define CREATE_ALWAYS
Definition: disk.h:72
#define REGDB_E_CLASSNOTREG
Definition: winerror.h:2696
#define InterlockedIncrement
Definition: armddk.h:53
#define lstrcpyW
Definition: compat.h:414
void shell(int argc, const char *argv[])
Definition: cmds.c:1231
HRESULT WINAPI SHPropStgCreate(IPropertySetStorage *psstg, REFFMTID fmtid, const CLSID *pclsid, DWORD grfFlags, DWORD grfMode, DWORD dwDisposition, IPropertyStorage **ppstg, UINT *puCodePage)
Definition: shellole.c:683
#define E_NOTIMPL
Definition: ddrawi.h:99
unsigned int UINT
Definition: ndis.h:50
BOOL NTAPI GlobalUnlock(HGLOBAL hMem)
Definition: heapmem.c:1190
#define lstrcpynA
Definition: compat.h:416
HRESULT WINAPI SHPropStgReadMultiple(IPropertyStorage *pps, UINT uCodePage, ULONG cpspec, const PROPSPEC *rgpspec, PROPVARIANT *rgvar)
Definition: shellole.c:733
Definition: main.c:39
#define MultiByteToWideChar
Definition: compat.h:100
void WINAPI SHFree(LPVOID pv)
Definition: shellole.c:331
CONST void * LPCVOID
Definition: windef.h:191
void WINAPI DragFinish(HDROP h)
Definition: shellole.c:543
uint32_t * LPDWORD
Definition: typedefs.h:57
static ULONG WINAPI IDefClF_fnRelease(LPCLASSFACTORY iface)
Definition: shellole.c:443
HRESULT WINAPI CLSIDFromString(LPCOLESTR idstr, LPCLSID id)
Definition: compobj.c:2338
unsigned int ULONG
Definition: retypes.h:1
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3366
LPFNCREATEINSTANCE lpfnCI
Definition: shell32.cpp:132
#define GetProcAddress(x, y)
Definition: compat.h:418
#define CO_E_CLASSSTRING
Definition: winerror.h:2806
#define CREATE_NEW
Definition: disk.h:69
#define HKEY_CLASSES_ROOT
Definition: winreg.h:10
LPWSTR WINAPI lstrcatW(LPWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:274
GLfloat GLfloat p
Definition: glext.h:8902
WCHAR * LPWSTR
Definition: xmlstorage.h:184
HRESULT WINAPI CreateClassMoniker(REFCLSID rclsid, IMoniker **ppmk)
Definition: classmoniker.c:701
#define WS_EX_ACCEPTFILES
Definition: pedump.c:648
#define E_POINTER
Definition: winerror.h:2365
DWORD pFiles
Definition: shlobj.h:2115
const GUID IID_IClassFactory
#define memset(x, y, z)
Definition: compat.h:39
signed int * PLONG
Definition: retypes.h:5
#define IsEqualCLSID(rclsid1, rclsid2)
Definition: guiddef.h:96
UINT WINAPI DragQueryFileW(HDROP hDrop, UINT lFile, LPWSTR lpszwFile, UINT lLength)
Definition: shellole.c:627
LPVOID WINAPI CoTaskMemAlloc(SIZE_T size)
Definition: ifs.c:404
LPVOID WINAPI SHAlloc(SIZE_T len)
Definition: shellole.c:309
#define HeapFree(x, y, z)
Definition: compat.h:402
INT WINAPI SHStringFromGUIDW(REFGUID guid, LPWSTR lpszDest, INT cchMax)
Definition: ordinal.c:608
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:54
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95
Definition: compat.h:1946
#define SUCCEEDED(hr)
Definition: intsafe.h:57
HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID iid, LPVOID *ppv)
Definition: shellole.c:206