From ba28ba171f253e59a5a71bac3a93447dfda9f698 Mon Sep 17 00:00:00 2001 From: Juergen Schmied Date: Sat, 23 Jan 1999 14:12:48 +0000 Subject: [PATCH] - some fixes, cleaned up includes, fixed leaks - clean DllReferenceCount, better DllMain() - dynamically linking LookupIconIdFromDirectoryEx32 and CreateIconFromResourceEx32 to USER32 - moved guid's instances to new file shellguid.c - implemented ShellExecuteEx32W --- dlls/shell32/Makefile.in | 1 + dlls/shell32/classes.c | 4 +- dlls/shell32/contmenu.c | 20 +++-- dlls/shell32/dataobject.c | 12 +++ dlls/shell32/enumidlist.c | 21 ++--- dlls/shell32/folders.c | 29 +++--- dlls/shell32/iconcache.c | 7 +- dlls/shell32/shell32_main.c | 174 ++++++++++++++++++++++-------------- dlls/shell32/shell32_main.h | 33 +++---- dlls/shell32/shellguid.c | 10 +++ dlls/shell32/shelllink.c | 60 ++++++++----- dlls/shell32/shellole.c | 18 ++-- dlls/shell32/shellord.c | 83 +++++++++-------- dlls/shell32/shellpath.c | 7 +- dlls/shell32/shlfolder.c | 39 ++++---- dlls/shell32/shlview.c | 47 +++++----- include/interfaces.h | 16 +--- include/shlguid.h | 53 +++++++++-- include/shlobj.h | 60 +------------ include/windows.h | 4 +- misc/shell.c | 2 +- 21 files changed, 383 insertions(+), 317 deletions(-) create mode 100644 dlls/shell32/shellguid.c diff --git a/dlls/shell32/Makefile.in b/dlls/shell32/Makefile.in index 6b149c45376..ceb47d6da7e 100644 --- a/dlls/shell32/Makefile.in +++ b/dlls/shell32/Makefile.in @@ -15,6 +15,7 @@ C_SRCS = \ iconcache.c \ pidl.c \ shell32_main.c \ + shellguid.c \ shelllink.c \ shellole.c \ shellord.c \ diff --git a/dlls/shell32/classes.c b/dlls/shell32/classes.c index 32826730aac..b65090e8803 100644 --- a/dlls/shell32/classes.c +++ b/dlls/shell32/classes.c @@ -7,11 +7,9 @@ #include #include #include "debug.h" -#include "shlobj.h" -#include "shell.h" #include "winerror.h" -#include "commctrl.h" +#include "shlobj.h" #include "shell32_main.h" BOOL32 HCR_MapTypeToValue ( LPCSTR szExtension, LPSTR szFileType, DWORD len) diff --git a/dlls/shell32/contmenu.c b/dlls/shell32/contmenu.c index da45f8a8470..91898073156 100644 --- a/dlls/shell32/contmenu.c +++ b/dlls/shell32/contmenu.c @@ -6,12 +6,14 @@ #include "windows.h" #include "winerror.h" #include "debug.h" + #include "pidl.h" -#include "shlobj.h" #include "objbase.h" +#include "if_macros.h" +#include "shlguid.h" +#include "shlobj.h" #include "shell32_main.h" #include "shresdef.h" -#include "if_macros.h" static HRESULT WINAPI IContextMenu_QueryInterface(LPCONTEXTMENU ,REFIID , LPVOID *); static ULONG WINAPI IContextMenu_AddRef(LPCONTEXTMENU); @@ -69,19 +71,23 @@ static HRESULT WINAPI IContextMenu_QueryInterface(LPCONTEXTMENU this,REFIID riid * IContextMenu_AddRef */ static ULONG WINAPI IContextMenu_AddRef(LPCONTEXTMENU this) -{ TRACE(shell,"(%p)->(count=%lu)\n",this,(this->ref)+1); - return ++(this->ref); +{ TRACE(shell,"(%p)->(count=%lu)\n",this,(this->ref)+1); + shell32_ObjCount++; + return ++(this->ref); } /************************************************************************** * IContextMenu_Release */ static ULONG WINAPI IContextMenu_Release(LPCONTEXTMENU this) { TRACE(shell,"(%p)->()\n",this); + + shell32_ObjCount--; + if (!--(this->ref)) { TRACE(shell," destroying IContextMenu(%p)\n",this); if(this->pSFParent) - this->pSFParent->lpvtbl->fnRelease(this->pSFParent); + this->pSFParent->lpvtbl->fnRelease(this->pSFParent); /*make sure the pidl is freed*/ if(this->aPidls) @@ -122,6 +128,7 @@ LPCONTEXTMENU IContextMenu_Constructor(LPSHELLFOLDER pSFParent, LPCITEMIDLIST *a { cm->bAllValues &= (_ILIsValue(aPidls[u]) ? 1 : 0); } TRACE(shell,"(%p)->()\n",cm); + shell32_ObjCount++; return cm; } /************************************************************************** @@ -201,7 +208,7 @@ static HRESULT WINAPI IContextMenu_InvokeCommand(LPCONTEXTMENU this, LPCMINVOKEC if(HIWORD(lpcmi->lpVerb)) { /* get the active IShellView */ lpSB = (LPSHELLBROWSER)SendMessage32A(lpcmi->hwnd, CWM_GETISHELLBROWSER,0,0); - IShellBrowser_QueryActiveShellView(lpSB, &lpSV); + IShellBrowser_QueryActiveShellView(lpSB, &lpSV); /* does AddRef() on lpSV */ lpSV->lpvtbl->fnGetWindow(lpSV, &hWndSV); /* these verbs are used by the filedialogs*/ @@ -219,6 +226,7 @@ static HRESULT WINAPI IContextMenu_InvokeCommand(LPCONTEXTMENU this, LPCMINVOKEC else { FIXME(shell,"please report: unknown verb %s\n",lpcmi->lpVerb); } + lpSV->lpvtbl->fnRelease(lpSV); return NOERROR; } diff --git a/dlls/shell32/dataobject.c b/dlls/shell32/dataobject.c index 849a92d5215..b53f482876e 100644 --- a/dlls/shell32/dataobject.c +++ b/dlls/shell32/dataobject.c @@ -73,6 +73,7 @@ LPENUMFORMATETC IEnumFORMATETC_Constructor(UINT32 cfmt, const FORMATETC32 afmt[] } TRACE(shell,"(%p)->()\n",ef); + shell32_ObjCount++; return (LPENUMFORMATETC)ef; } static HRESULT WINAPI IEnumFORMATETC_fnQueryInterface(LPUNKNOWN iface, REFIID riid, LPVOID* ppvObj) @@ -104,12 +105,16 @@ static ULONG WINAPI IEnumFORMATETC_fnAddRef(LPUNKNOWN iface) { ICOM_THIS(IEnumFORMATETC,iface); TRACE(shell,"(%p)->(count=%lu)\n",this,(this->ref)+1); + shell32_ObjCount++; return ++(this->ref); } static ULONG WINAPI IEnumFORMATETC_fnRelease(LPUNKNOWN iface) { ICOM_THIS(IEnumFORMATETC,iface); TRACE(shell,"(%p)->()\n",this); + + shell32_ObjCount--; + if (!--(this->ref)) { TRACE(shell," destroying IEnumFORMATETC(%p)\n",this); if (this->pFmt) @@ -241,6 +246,7 @@ LPDATAOBJECT IDataObject_Constructor(HWND32 hwndOwner, LPSHELLFOLDER psf, LPITEM dto->lpill->lpvtbl->fnAddItems(dto->lpill, apidl, cidl); TRACE(shell,"(%p)->(sf=%p apidl=%p cidl=%u)\n",dto, psf, apidl, cidl); + shell32_ObjCount++; return (LPDATAOBJECT)dto; } /*************************************************************************** @@ -276,7 +282,10 @@ static HRESULT WINAPI IDataObject_fnQueryInterface (LPUNKNOWN iface, REFIID riid static ULONG WINAPI IDataObject_fnAddRef(LPUNKNOWN iface) { ICOM_THIS(IDataObject,iface); + TRACE(shell,"(%p)->(count=%lu)\n",this,(this->ref)+1); + + shell32_ObjCount++; return ++(this->ref); } /************************************************************************** @@ -286,6 +295,9 @@ static ULONG WINAPI IDataObject_fnRelease(LPUNKNOWN iface) { ICOM_THIS(IDataObject,iface); TRACE(shell,"(%p)->()\n",this); + + shell32_ObjCount--; + if (!--(this->ref)) { TRACE(shell," destroying IDataObject(%p)\n",this); IDLList_Destructor(this->lpill); diff --git a/dlls/shell32/enumidlist.c b/dlls/shell32/enumidlist.c index 118d83940f2..237d288ca1d 100644 --- a/dlls/shell32/enumidlist.c +++ b/dlls/shell32/enumidlist.c @@ -4,20 +4,15 @@ * Copyright 1998 Juergen Schmied */ -#include #include #include -#include "ole.h" -#include "ole2.h" #include "debug.h" -#include "shlobj.h" #include "objbase.h" -#include "shell.h" #include "winerror.h" -#include "winnls.h" -#include "winproc.h" -#include "commctrl.h" + #include "pidl.h" +#include "shlguid.h" +#include "shlobj.h" #include "shell32_main.h" /* IEnumIDList Implementation */ @@ -75,6 +70,7 @@ LPENUMIDLIST IEnumIDList_Constructor( LPCSTR lpszPath, DWORD dwFlags) } TRACE(shell,"-- (%p)->()\n",lpeidl); + shell32_ObjCount++; return lpeidl; } @@ -109,14 +105,19 @@ static HRESULT WINAPI IEnumIDList_QueryInterface( * IEnumIDList_AddRef */ static ULONG WINAPI IEnumIDList_AddRef(LPENUMIDLIST this) -{ TRACE(shell,"(%p)->()\n",this); +{ TRACE(shell,"(%p)->(%u)\n",this,this->ref); + + shell32_ObjCount++; return ++(this->ref); } /****************************************************************************** * IEnumIDList_Release */ static ULONG WINAPI IEnumIDList_Release(LPENUMIDLIST this) -{ TRACE(shell,"(%p)->()\n",this); +{ TRACE(shell,"(%p)->(%u)\n",this,this->ref); + + shell32_ObjCount--; + if (!--(this->ref)) { TRACE(shell," destroying IEnumIDList(%p)\n",this); IEnumIDList_DeleteList(this); diff --git a/dlls/shell32/folders.c b/dlls/shell32/folders.c index a3e86ed950d..4140c990b0c 100644 --- a/dlls/shell32/folders.c +++ b/dlls/shell32/folders.c @@ -4,22 +4,16 @@ * */ -#include #include #include -#include "ole.h" -#include "ole2.h" #include "debug.h" -#include "shlobj.h" #include "objbase.h" -#include "shell.h" #include "winerror.h" -#include "winnls.h" -#include "winproc.h" -#include "commctrl.h" -#include "pidl.h" +#include "pidl.h" #include "shell32_main.h" +#include "shlguid.h" +#include "shlobj.h" /****************************************************************************** @@ -58,8 +52,9 @@ LPEXTRACTICON IExtractIcon_Constructor(LPCITEMIDLIST pidl) pdump(pidl); - TRACE(shell,"(%p)\n",ei); - return ei; + TRACE(shell,"(%p)\n",ei); + shell32_ObjCount++; + return ei; } /************************************************************************** * IExtractIcon_QueryInterface @@ -91,14 +86,20 @@ static HRESULT WINAPI IExtractIcon_QueryInterface( LPEXTRACTICON this, REFIID ri * IExtractIcon_AddRef */ static ULONG WINAPI IExtractIcon_AddRef(LPEXTRACTICON this) -{ TRACE(shell,"(%p)->(count=%lu)\n",this,(this->ref)+1); - return ++(this->ref); +{ TRACE(shell,"(%p)->(count=%lu)\n",this,(this->ref)+1); + + shell32_ObjCount++; + + return ++(this->ref); } /************************************************************************** * IExtractIcon_Release */ static ULONG WINAPI IExtractIcon_Release(LPEXTRACTICON this) -{ TRACE(shell,"(%p)->()\n",this); +{ TRACE(shell,"(%p)->()\n",this); + + shell32_ObjCount--; + if (!--(this->ref)) { TRACE(shell," destroying IExtractIcon(%p)\n",this); SHFree(this->pidl); diff --git a/dlls/shell32/iconcache.c b/dlls/shell32/iconcache.c index 9b46f19ca7c..edea89b2903 100644 --- a/dlls/shell32/iconcache.c +++ b/dlls/shell32/iconcache.c @@ -1,7 +1,8 @@ /* * shell icon cache (SIC) * - * + * FIXME + * since dll geting never unloaded the iconcache will never be freed */ #include #include "windows.h" @@ -374,7 +375,7 @@ HGLOBAL32 WINAPI ICO_ExtractIconEx(LPCSTR lpszExeFileName, HICON32* RetPtr, UINT { WARN(shell,"no matching real address for icongroup!\n"); goto end_4; /* failure */ } - RetPtr[i] = LookupIconIdFromDirectoryEx32(igdata, TRUE, cxDesired, cyDesired, LR_DEFAULTCOLOR); + RetPtr[i] = pLookupIconIdFromDirectoryEx32(igdata, TRUE, cxDesired, cyDesired, LR_DEFAULTCOLOR); } if (!(iconresdir=GetResDirEntryW(rootresdir,RT_ICON32W,(DWORD)rootresdir,FALSE))) @@ -402,7 +403,7 @@ HGLOBAL32 WINAPI ICO_ExtractIconEx(LPCSTR lpszExeFileName, HICON32* RetPtr, UINT RetPtr[i]=0; continue; } - RetPtr[i] = CreateIconFromResourceEx32(idata,idataent->Size,TRUE,0x00030000, cxDesired, cyDesired, LR_DEFAULTCOLOR); + RetPtr[i] = pCreateIconFromResourceEx32(idata,idataent->Size,TRUE,0x00030000, cxDesired, cyDesired, LR_DEFAULTCOLOR); } hRet = RetPtr[0]; /* return first icon */ goto end_3; /* sucess */ diff --git a/dlls/shell32/shell32_main.c b/dlls/shell32/shell32_main.c index 78ca810f129..f1c872f07d4 100644 --- a/dlls/shell32/shell32_main.c +++ b/dlls/shell32/shell32_main.c @@ -4,34 +4,28 @@ * 1998 Marcus Meissner * 1998 Juergen Schmied (jsch) * */ -#include #include #include -#include -#include + #include "windows.h" #include "wine/winuser16.h" #include "winerror.h" -#include "file.h" -#include "shell.h" #include "heap.h" -#include "module.h" -#include "neexe.h" #include "resource.h" #include "dlgs.h" #include "win.h" -#include "cursoricon.h" #include "sysmetrics.h" -#include "shlobj.h" #include "debug.h" #include "winreg.h" -#include "imagelist.h" -#include "sysmetrics.h" -#include "commctrl.h" #include "authors.h" + +#include "shell.h" #include "pidl.h" +#include "shlobj.h" #include "shell32_main.h" +#include "shlguid.h" + /************************************************************************* * CommandLineToArgvW [SHELL32.7] */ @@ -692,8 +686,8 @@ ShellExecute32W( /************************************************************************* * AboutDlgProc32 (not an exported API function) */ -LRESULT WINAPI AboutDlgProc32( HWND32 hWnd, UINT32 msg, WPARAM32 wParam, - LPARAM lParam ) +BOOL32 WINAPI AboutDlgProc32( HWND32 hWnd, UINT32 msg, WPARAM32 wParam, + LPARAM lParam ) { HWND32 hWndCtl; char Template[512], AppTitle[512]; @@ -959,72 +953,114 @@ DWORD WINAPI SHGetPathFromIDList32W (LPCITEMIDLIST pidl,LPWSTR pszPath) return NOERROR; } +/************************************************************************* + * global variables of the shell32.dll + * + */ +void (WINAPI* pDLLInitComctl)(LPVOID); +INT32 (WINAPI* pImageList_AddIcon) (HIMAGELIST himl, HICON32 hIcon); +INT32 (WINAPI* pImageList_ReplaceIcon) (HIMAGELIST, INT32, HICON32); +HIMAGELIST (WINAPI * pImageList_Create) (INT32,INT32,UINT32,INT32,INT32); +HICON32 (WINAPI * pImageList_GetIcon) (HIMAGELIST, INT32, UINT32); +INT32 (WINAPI* pImageList_GetImageCount)(HIMAGELIST); -void (CALLBACK* pDLLInitComctl)(LPVOID); -INT32 (CALLBACK* pImageList_AddIcon) (HIMAGELIST himl, HICON32 hIcon); -INT32 (CALLBACK* pImageList_ReplaceIcon) (HIMAGELIST, INT32, HICON32); -HIMAGELIST (CALLBACK * pImageList_Create) (INT32,INT32,UINT32,INT32,INT32); -HICON32 (CALLBACK * pImageList_GetIcon) (HIMAGELIST, INT32, UINT32); -INT32 (CALLBACK* pImageList_GetImageCount)(HIMAGELIST); +LPVOID (WINAPI* pCOMCTL32_Alloc) (INT32); +BOOL32 (WINAPI* pCOMCTL32_Free) (LPVOID); -LPVOID (CALLBACK* pCOMCTL32_Alloc) (INT32); -BOOL32 (CALLBACK* pCOMCTL32_Free) (LPVOID); +HDPA (WINAPI* pDPA_Create) (INT32); +INT32 (WINAPI* pDPA_InsertPtr) (const HDPA, INT32, LPVOID); +BOOL32 (WINAPI* pDPA_Sort) (const HDPA, PFNDPACOMPARE, LPARAM); +LPVOID (WINAPI* pDPA_GetPtr) (const HDPA, INT32); +BOOL32 (WINAPI* pDPA_Destroy) (const HDPA); +INT32 (WINAPI *pDPA_Search) (const HDPA, LPVOID, INT32, PFNDPACOMPARE, LPARAM, UINT32); -HDPA (CALLBACK* pDPA_Create) (INT32); -INT32 (CALLBACK* pDPA_InsertPtr) (const HDPA, INT32, LPVOID); -BOOL32 (CALLBACK* pDPA_Sort) (const HDPA, PFNDPACOMPARE, LPARAM); -LPVOID (CALLBACK* pDPA_GetPtr) (const HDPA, INT32); -BOOL32 (CALLBACK* pDPA_Destroy) (const HDPA); -INT32 (CALLBACK *pDPA_Search) (const HDPA, LPVOID, INT32, PFNDPACOMPARE, LPARAM, UINT32); -static BOOL32 bShell32IsInitialized=0; +/* user32 */ +HICON32* (WINAPI *pLookupIconIdFromDirectoryEx32)(LPBYTE dir, BOOL32 bIcon, INT32 width, INT32 height, UINT32 cFlag); +HICON32* (WINAPI *pCreateIconFromResourceEx32)(LPBYTE bits,UINT32 cbSize, BOOL32 bIcon, DWORD dwVersion, INT32 width, INT32 height,UINT32 cFlag); + +static BOOL32 bShell32IsInitialized = 0; +static HINSTANCE32 hComctl32; +static INT32 shell32_RefCount = 0; + +INT32 shell32_ObjCount = 0; +HINSTANCE32 shell32_hInstance; /************************************************************************* * SHELL32 LibMain * - * FIXME - * at the moment the icons are extracted from shell32.dll - * free the imagelists */ -HINSTANCE32 shell32_hInstance; -BOOL32 WINAPI Shell32LibMain(HINSTANCE32 hinstDLL, DWORD fdwReason, LPVOID lpvReserved) -{ HINSTANCE32 hComctl32; +BOOL32 WINAPI Shell32LibMain(HINSTANCE32 hinstDLL, DWORD fdwReason, LPVOID fImpLoad) +{ HMODULE32 hUser32; - TRACE(shell,"0x%x 0x%lx %p\n", hinstDLL, fdwReason, lpvReserved); + TRACE(shell,"0x%x 0x%lx %p\n", hinstDLL, fdwReason, fImpLoad); - shell32_hInstance = hinstDLL; + shell32_hInstance = hinstDLL; - if (fdwReason==DLL_PROCESS_ATTACH && !bShell32IsInitialized) - { hComctl32 = LoadLibrary32A("COMCTL32.DLL"); - if (hComctl32) - { pDLLInitComctl=GetProcAddress32(hComctl32,"InitCommonControlsEx"); - if (pDLLInitComctl) - { pDLLInitComctl(NULL); - } - pImageList_Create=GetProcAddress32(hComctl32,"ImageList_Create"); - pImageList_AddIcon=GetProcAddress32(hComctl32,"ImageList_AddIcon"); - pImageList_ReplaceIcon=GetProcAddress32(hComctl32,"ImageList_ReplaceIcon"); - pImageList_GetIcon=GetProcAddress32(hComctl32,"ImageList_GetIcon"); - pImageList_GetImageCount=GetProcAddress32(hComctl32,"ImageList_GetImageCount"); + switch (fdwReason) + { case DLL_PROCESS_ATTACH: + if (!bShell32IsInitialized) + { hComctl32 = LoadLibrary32A("COMCTL32.DLL"); + hUser32 = GetModuleHandle32A("USER32"); + if (hComctl32 && hUser32) + { pDLLInitComctl=GetProcAddress32(hComctl32,"InitCommonControlsEx"); + if (pDLLInitComctl) + { pDLLInitComctl(NULL); + } + pImageList_Create=GetProcAddress32(hComctl32,"ImageList_Create"); + pImageList_AddIcon=GetProcAddress32(hComctl32,"ImageList_AddIcon"); + pImageList_ReplaceIcon=GetProcAddress32(hComctl32,"ImageList_ReplaceIcon"); + pImageList_GetIcon=GetProcAddress32(hComctl32,"ImageList_GetIcon"); + pImageList_GetImageCount=GetProcAddress32(hComctl32,"ImageList_GetImageCount"); - /* imports by ordinal, pray that it works*/ - pCOMCTL32_Alloc=GetProcAddress32(hComctl32, (LPCSTR)71L); - pCOMCTL32_Free=GetProcAddress32(hComctl32, (LPCSTR)73L); - pDPA_Create=GetProcAddress32(hComctl32, (LPCSTR)328L); - pDPA_Destroy=GetProcAddress32(hComctl32, (LPCSTR)329L); - pDPA_GetPtr=GetProcAddress32(hComctl32, (LPCSTR)332L); - pDPA_InsertPtr=GetProcAddress32(hComctl32, (LPCSTR)334L); - pDPA_Sort=GetProcAddress32(hComctl32, (LPCSTR)338L); - pDPA_Search=GetProcAddress32(hComctl32, (LPCSTR)339L); + /* imports by ordinal, pray that it works*/ + pCOMCTL32_Alloc=GetProcAddress32(hComctl32, (LPCSTR)71L); + pCOMCTL32_Free=GetProcAddress32(hComctl32, (LPCSTR)73L); + pDPA_Create=GetProcAddress32(hComctl32, (LPCSTR)328L); + pDPA_Destroy=GetProcAddress32(hComctl32, (LPCSTR)329L); + pDPA_GetPtr=GetProcAddress32(hComctl32, (LPCSTR)332L); + pDPA_InsertPtr=GetProcAddress32(hComctl32, (LPCSTR)334L); + pDPA_Sort=GetProcAddress32(hComctl32, (LPCSTR)338L); + pDPA_Search=GetProcAddress32(hComctl32, (LPCSTR)339L); + /* user32 */ + pLookupIconIdFromDirectoryEx32=GetProcAddress32(hUser32,"LookupIconIdFromDirectoryEx"); + pCreateIconFromResourceEx32=GetProcAddress32(hUser32,"CreateIconFromResourceEx"); + } + else + { ERR(shell,"P A N I C SHELL32 loading failed\n"); + return FALSE; + } + SIC_Initialize(); + bShell32IsInitialized = TRUE; + } + shell32_RefCount++; + break; - FreeLibrary32(hComctl32); - } - else - { /* panic, imediately exit wine*/ - ERR(shell,"P A N I C error getting functionpointers\n"); - exit (1); - } - SIC_Initialize(); - bShell32IsInitialized = TRUE; - } - return TRUE; + case DLL_THREAD_ATTACH: + shell32_RefCount++; + break; + + case DLL_THREAD_DETACH: + shell32_RefCount--; + break; + + case DLL_PROCESS_DETACH: + shell32_RefCount--; + if ( !shell32_RefCount ) + { FreeLibrary32(hComctl32); + bShell32IsInitialized = FALSE; + + if (pdesktopfolder) + { pdesktopfolder->lpvtbl->fnRelease(pdesktopfolder); + } + + /* this one is here ot check if AddRef/Release is balanced */ + if (shell32_ObjCount) + { FIXME(shell,"%u objects left\n", shell32_ObjCount); + } + } + TRACE(shell, "refcount=%u objcount=%u \n", shell32_RefCount, shell32_ObjCount); + break; + } + + return TRUE; } diff --git a/dlls/shell32/shell32_main.h b/dlls/shell32/shell32_main.h index ff64d054900..fa6a56c3125 100644 --- a/dlls/shell32/shell32_main.h +++ b/dlls/shell32/shell32_main.h @@ -9,29 +9,32 @@ * global SHELL32.DLL variables */ extern HINSTANCE32 shell32_hInstance; -extern UINT32 shell32_DllRefCount; +extern INT32 shell32_ObjCount; extern HIMAGELIST ShellSmallIconList; extern HIMAGELIST ShellBigIconList; /******************************************* * pointer to functions dynamically loaded */ -extern void (CALLBACK* pDLLInitComctl)(LPVOID); -extern INT32 (CALLBACK* pImageList_AddIcon) (HIMAGELIST himl, HICON32 hIcon); -extern INT32 (CALLBACK* pImageList_ReplaceIcon) (HIMAGELIST, INT32, HICON32); -extern HIMAGELIST (CALLBACK* pImageList_Create) (INT32,INT32,UINT32,INT32,INT32); -extern HICON32 (CALLBACK* pImageList_GetIcon) (HIMAGELIST, INT32, UINT32); -extern INT32 (CALLBACK* pImageList_GetImageCount)(HIMAGELIST); +extern void (WINAPI* pDLLInitComctl)(LPVOID); +extern INT32 (WINAPI* pImageList_AddIcon) (HIMAGELIST himl, HICON32 hIcon); +extern INT32 (WINAPI* pImageList_ReplaceIcon) (HIMAGELIST, INT32, HICON32); +extern HIMAGELIST (WINAPI* pImageList_Create) (INT32,INT32,UINT32,INT32,INT32); +extern HICON32 (WINAPI* pImageList_GetIcon) (HIMAGELIST, INT32, UINT32); +extern INT32 (WINAPI* pImageList_GetImageCount)(HIMAGELIST); -extern LPVOID (CALLBACK* pCOMCTL32_Alloc) (INT32); -extern BOOL32 (CALLBACK* pCOMCTL32_Free) (LPVOID); +extern LPVOID (WINAPI* pCOMCTL32_Alloc) (INT32); +extern BOOL32 (WINAPI* pCOMCTL32_Free) (LPVOID); -extern HDPA (CALLBACK* pDPA_Create) (INT32); -extern INT32 (CALLBACK* pDPA_InsertPtr) (const HDPA, INT32, LPVOID); -extern BOOL32 (CALLBACK* pDPA_Sort) (const HDPA, PFNDPACOMPARE, LPARAM); -extern LPVOID (CALLBACK* pDPA_GetPtr) (const HDPA, INT32); -extern BOOL32 (CALLBACK* pDPA_Destroy) (const HDPA); -extern INT32 (CALLBACK* pDPA_Search) (const HDPA, LPVOID, INT32, PFNDPACOMPARE, LPARAM, UINT32); +extern HDPA (WINAPI* pDPA_Create) (INT32); +extern INT32 (WINAPI* pDPA_InsertPtr) (const HDPA, INT32, LPVOID); +extern BOOL32 (WINAPI* pDPA_Sort) (const HDPA, PFNDPACOMPARE, LPARAM); +extern LPVOID (WINAPI* pDPA_GetPtr) (const HDPA, INT32); +extern BOOL32 (WINAPI* pDPA_Destroy) (const HDPA); +extern INT32 (WINAPI* pDPA_Search) (const HDPA, LPVOID, INT32, PFNDPACOMPARE, LPARAM, UINT32); + +extern HICON32* (WINAPI *pLookupIconIdFromDirectoryEx32)(LPBYTE dir, BOOL32 bIcon, INT32 width, INT32 height, UINT32 cFlag); +extern HICON32* (WINAPI *pCreateIconFromResourceEx32)(LPBYTE bits,UINT32 cbSize, BOOL32 bIcon, DWORD dwVersion, INT32 width, INT32 height,UINT32 cFlag); LPITEMIDLIST WINAPI ILClone (LPCITEMIDLIST pidl); LPITEMIDLIST WINAPI ILGetNext(LPITEMIDLIST pidl); diff --git a/dlls/shell32/shellguid.c b/dlls/shell32/shellguid.c new file mode 100644 index 00000000000..b633546f900 --- /dev/null +++ b/dlls/shell32/shellguid.c @@ -0,0 +1,10 @@ +/* + * Shell UID + * + * 1998 Juergen Schmied (jsch) * + * + * this in in a single file due to interfering definitions + * + */ +#define INITGUID +#include "shlguid.h" diff --git a/dlls/shell32/shelllink.c b/dlls/shell32/shelllink.c index ddba978660f..bcc626c0130 100644 --- a/dlls/shell32/shelllink.c +++ b/dlls/shell32/shelllink.c @@ -5,23 +5,17 @@ * */ -#include -#include #include -#include "ole.h" -#include "ole2.h" #include "debug.h" +#include "winerror.h" + #include "objbase.h" #include "wine/obj_base.h" #include "wine/obj_storage.h" -#include "shell.h" -#include "winerror.h" -#include "winnls.h" -#include "winproc.h" -#include "commctrl.h" -#include "pidl.h" +#include "pidl.h" #include "shell32_main.h" +#include "shlguid.h" /* IPersistFile Implementation */ typedef struct _IPersistFile { @@ -45,6 +39,7 @@ LPPERSISTFILE IPersistFile_Constructor(void) sl->lpvtbl = &pfvt; TRACE(shell,"(%p)->()\n",sl); + shell32_ObjCount++; return (LPPERSISTFILE)sl; } @@ -83,6 +78,8 @@ static ULONG WINAPI IPersistFile_fnAddRef(LPUNKNOWN iface) { ICOM_THIS(IPersistFile,iface); TRACE(shell,"(%p)->(count=%lu)\n",this,this->ref); + + shell32_ObjCount++; return ++(this->ref); } /****************************************************************************** @@ -92,6 +89,9 @@ static ULONG WINAPI IPersistFile_fnRelease(LPUNKNOWN iface) { ICOM_THIS(IPersistFile,iface); TRACE(shell,"(%p)->(count=%lu)\n",this,this->ref); + + shell32_ObjCount--; + if (!--(this->ref)) { TRACE(shell,"-- destroying IPersistFile(%p)\n",this); HeapFree(GetProcessHeap(),0,this); @@ -173,6 +173,7 @@ LPCLASSFACTORY IShellLink_CF_Constructor(void) lpclf->ref = 1; lpclf->lpvtbl = &slcfvt; TRACE(shell,"(%p)->()\n",lpclf); + shell32_ObjCount++; return (LPCLASSFACTORY)lpclf; } /************************************************************************** @@ -210,6 +211,8 @@ static ULONG WINAPI IShellLink_CF_AddRef(LPUNKNOWN iface) { ICOM_THIS(IClassFactory,iface); TRACE(shell,"(%p)->(count=%lu)\n",this,this->ref); + + shell32_ObjCount++; return ++(this->ref); } /****************************************************************************** @@ -219,6 +222,8 @@ static ULONG WINAPI IShellLink_CF_Release(LPUNKNOWN iface) { ICOM_THIS(IClassFactory,iface); TRACE(shell,"(%p)->(count=%lu)\n",this,this->ref); + + shell32_ObjCount--; if (!--(this->ref)) { TRACE(shell,"-- destroying IClassFactory(%p)\n",this); HeapFree(GetProcessHeap(),0,this); @@ -349,6 +354,7 @@ LPSHELLLINK IShellLink_Constructor(void) sl->lppf = IPersistFile_Constructor(); TRACE(shell,"(%p)->()\n",sl); + shell32_ObjCount++; return sl; } @@ -386,6 +392,8 @@ static HRESULT WINAPI IShellLink_QueryInterface( */ static ULONG WINAPI IShellLink_AddRef(LPSHELLLINK this) { TRACE(shell,"(%p)->(count=%lu)\n",this,this->ref); + + shell32_ObjCount++; return ++(this->ref); } /****************************************************************************** @@ -393,6 +401,8 @@ static ULONG WINAPI IShellLink_AddRef(LPSHELLLINK this) */ static ULONG WINAPI IShellLink_Release(LPSHELLLINK this) { TRACE(shell,"(%p)->(count=%lu)\n",this,this->ref); + + shell32_ObjCount--; if (!--(this->ref)) { TRACE(shell,"-- destroying IShellLink(%p)\n",this); IPersistFile_Release(this->lppf); /* IPersistFile*/ @@ -502,6 +512,7 @@ LPCLASSFACTORY IShellLinkW_CF_Constructor(void) lpclf->ref = 1; lpclf->lpvtbl = &slwcfvt; TRACE(shell,"(%p)->()\n",lpclf); + shell32_ObjCount++; return (LPCLASSFACTORY)lpclf; } /************************************************************************** @@ -539,6 +550,8 @@ static ULONG WINAPI IShellLinkW_CF_AddRef(LPUNKNOWN iface) { ICOM_THIS(IClassFactory,iface); TRACE(shell,"(%p)->(count=%lu)\n",this,this->ref); + + shell32_ObjCount++; return ++(this->ref); } /****************************************************************************** @@ -548,6 +561,8 @@ static ULONG WINAPI IShellLinkW_CF_Release(LPUNKNOWN iface) { ICOM_THIS(IClassFactory,iface); TRACE(shell,"(%p)->(count=%lu)\n",this,this->ref); + + shell32_ObjCount--; if (!--(this->ref)) { TRACE(shell,"-- destroying IClassFactory(%p)\n",this); HeapFree(GetProcessHeap(),0,this); @@ -679,6 +694,7 @@ LPSHELLLINKW IShellLinkW_Constructor(void) sl->lppf = IPersistFile_Constructor(); TRACE(shell,"(%p)->()\n",sl); + shell32_ObjCount++; return sl; } @@ -715,21 +731,25 @@ static HRESULT WINAPI IShellLinkW_QueryInterface( * IShellLinkW_AddRef */ static ULONG WINAPI IShellLinkW_AddRef(LPSHELLLINKW this) -{ TRACE(shell,"(%p)->(count=%lu)\n",this,this->ref); - return ++(this->ref); +{ TRACE(shell,"(%p)->(count=%lu)\n",this,this->ref); + + shell32_ObjCount++; + return ++(this->ref); } /****************************************************************************** * IClassFactory_Release */ static ULONG WINAPI IShellLinkW_Release(LPSHELLLINKW this) -{ TRACE(shell,"(%p)->(count=%lu)\n",this,this->ref); - if (!--(this->ref)) - { TRACE(shell,"-- destroying IShellLinkW(%p)\n",this); - IPersistFile_Release(this->lppf); /* IPersistFile*/ - HeapFree(GetProcessHeap(),0,this); - return 0; - } - return this->ref; +{ TRACE(shell,"(%p)->(count=%lu)\n",this,this->ref); + + shell32_ObjCount--; + if (!--(this->ref)) + { TRACE(shell,"-- destroying IShellLinkW(%p)\n",this); + IPersistFile_Release(this->lppf); /* IPersistFile*/ + HeapFree(GetProcessHeap(),0,this); + return 0; + } + return this->ref; } static HRESULT WINAPI IShellLinkW_GetPath(LPSHELLLINKW this, LPWSTR pszFile,INT32 cchMaxPath, WIN32_FIND_DATA32A *pfd, DWORD fFlags) diff --git a/dlls/shell32/shellole.c b/dlls/shell32/shellole.c index b63f7d8a083..9b4221f9aa8 100644 --- a/dlls/shell32/shellole.c +++ b/dlls/shell32/shellole.c @@ -6,21 +6,15 @@ * */ -#include #include #include -#include "ole.h" -#include "ole2.h" #include "debug.h" -#include "shlobj.h" #include "objbase.h" -#include "shell.h" #include "winerror.h" -#include "winnls.h" -#include "winproc.h" #include "winversion.h" -#include "commctrl.h" +#include "shlguid.h" +#include "shlobj.h" #include "shell32_main.h" /************************************************************************* @@ -229,7 +223,9 @@ LPCLASSFACTORY IClassFactory_Constructor(void) lpclf= (_IClassFactory*)HeapAlloc(GetProcessHeap(),0,sizeof(_IClassFactory)); lpclf->ref = 1; lpclf->lpvtbl = &clfvt; - TRACE(shell,"(%p)->()\n",lpclf); + + TRACE(shell,"(%p)->()\n",lpclf); + shell32_ObjCount++; return (LPCLASSFACTORY)lpclf; } /************************************************************************** @@ -267,6 +263,8 @@ static ULONG WINAPI IClassFactory_fnAddRef(LPUNKNOWN iface) { ICOM_THIS(IClassFactory,iface); TRACE(shell,"(%p)->(count=%lu)\n",this,this->ref); + + shell32_ObjCount++; return ++(this->ref); } /****************************************************************************** @@ -276,6 +274,8 @@ static ULONG WINAPI IClassFactory_fnRelease(LPUNKNOWN iface) { ICOM_THIS(IClassFactory,iface); TRACE(shell,"(%p)->(count=%lu)\n",this,this->ref); + + shell32_ObjCount--; if (!--(this->ref)) { TRACE(shell,"-- destroying IClassFactory(%p)\n",this); HeapFree(GetProcessHeap(),0,this); diff --git a/dlls/shell32/shellord.c b/dlls/shell32/shellord.c index e7e07336e79..39299ffd4d0 100644 --- a/dlls/shell32/shellord.c +++ b/dlls/shell32/shellord.c @@ -1,35 +1,19 @@ /* - * Shell Ordinal Functions - * - * These are completely undocumented. The meaning of the functions changes - * between different OS versions (NT uses Unicode strings, 95 uses ASCII - * strings, etc. etc.) + * The parameters of many functions changes between different OS versions + * (NT uses Unicode strings, 95 uses ASCII strings) * - * They are just here so that explorer.exe and iexplore.exe can be tested. - * * Copyright 1997 Marcus Meissner * 1998 Jürgen Schmied */ -#include #include -#include -#include #include "windows.h" #include "winerror.h" -#include "file.h" -#include "shell.h" -#include "heap.h" -#include "module.h" -#include "neexe.h" -#include "resource.h" -#include "dlgs.h" -#include "win.h" -#include "cursoricon.h" -#include "shlobj.h" #include "debug.h" -#include "winreg.h" #include "winnls.h" #include "winversion.h" +#include "heap.h" + +#include "shlobj.h" #include "shell32_main.h" /************************************************************************* @@ -604,7 +588,7 @@ BOOL32 WINAPI ShellExecuteEx32A (LPSHELLEXECUTEINFO32A sei) STARTUPINFO32A startupinfo; PROCESS_INFORMATION processinformation; - FIXME(shell,"mask=0x%08lx hwnd=0x%04x verb=%s file=%s parm=%s dir=%s show=0x%08x class=%sstub\n", + WARN(shell,"mask=0x%08lx hwnd=0x%04x verb=%s file=%s parm=%s dir=%s show=0x%08x class=%s incomplete\n", sei->fMask, sei->hwnd, sei->lpVerb, sei->lpFile, sei->lpParameters, sei->lpDirectory, sei->nShow, sei->lpClass); @@ -630,7 +614,7 @@ BOOL32 WINAPI ShellExecuteEx32A (LPSHELLEXECUTEINFO32A sei) /* process the IDList */ if ( (sei->fMask & SEE_MASK_INVOKEIDLIST) == SEE_MASK_INVOKEIDLIST) /*0x0c*/ { SHGetPathFromIDList32A (sei->lpIDList,szApplicationName); - FIXME(shell,"-- idlist=%p (%s)\n", sei->lpIDList, szApplicationName); + TRACE(shell,"-- idlist=%p (%s)\n", sei->lpIDList, szApplicationName); } else { if (sei->fMask & SEE_MASK_IDLIST ) @@ -657,43 +641,58 @@ BOOL32 WINAPI ShellExecuteEx32A (LPSHELLEXECUTEINFO32A sei) memmove(pos,pos+3,len); } - FIXME(shell,"-- %s\n",szCommandline); + TRACE(shell,"execute: %s %s\n",szApplicationName, szCommandline); ZeroMemory(&startupinfo,sizeof(STARTUPINFO32A)); startupinfo.cb = sizeof(STARTUPINFO32A); - CreateProcess32A(szApplicationName[0] ? szApplicationName:NULL, + return CreateProcess32A(szApplicationName[0] ? szApplicationName:NULL, szCommandline[0] ? szCommandline : NULL, NULL, NULL, FALSE, 0, NULL, NULL, &startupinfo, &processinformation); - return 0; } /************************************************************************* - * ShellExecuteEx [SHELL32.293] + * ShellExecuteEx32W [SHELL32.293] * */ BOOL32 WINAPI ShellExecuteEx32W (LPSHELLEXECUTEINFO32W sei) -{ WCHAR szTemp[MAX_PATH]; +{ SHELLEXECUTEINFO32A seiA; + DWORD ret; - FIXME(shell,"(%p): stub\n",sei); + TRACE (shell,"%p\n", sei); - if (sei->fMask & SEE_MASK_IDLIST) - { SHGetPathFromIDList32W (sei->lpIDList,szTemp); - TRACE (shell,"-- idlist=%p (%s)\n", sei->lpIDList, debugstr_w(szTemp)); - } - - if (sei->fMask & SEE_MASK_CLASSNAME) - { TRACE (shell,"-- classname= %s\n", debugstr_w(sei->lpClass)); - } - - if (sei->lpVerb) - { TRACE (shell,"-- action=%s\n", debugstr_w(sei->lpVerb)); - } + memcpy(&seiA, sei, sizeof(SHELLEXECUTEINFO32A)); - return 0; + if (sei->lpVerb) + seiA.lpVerb = HEAP_strdupWtoA( GetProcessHeap(), 0, sei->lpVerb); + + if (sei->lpFile) + seiA.lpFile = HEAP_strdupWtoA( GetProcessHeap(), 0, sei->lpFile); + + if (sei->lpParameters) + seiA.lpParameters = HEAP_strdupWtoA( GetProcessHeap(), 0, sei->lpParameters); + + if (sei->lpDirectory) + seiA.lpDirectory = HEAP_strdupWtoA( GetProcessHeap(), 0, sei->lpDirectory); + + if ((sei->fMask & SEE_MASK_CLASSNAME) && sei->lpClass) + seiA.lpClass = HEAP_strdupWtoA( GetProcessHeap(), 0, sei->lpClass); + else + seiA.lpClass = NULL; + + ret = ShellExecuteEx32A(&seiA); + + if (seiA.lpVerb) HeapFree( GetProcessHeap(), 0, (LPSTR) seiA.lpVerb ); + if (seiA.lpFile) HeapFree( GetProcessHeap(), 0, (LPSTR) seiA.lpFile ); + if (seiA.lpParameters) HeapFree( GetProcessHeap(), 0, (LPSTR) seiA.lpParameters ); + if (seiA.lpDirectory) HeapFree( GetProcessHeap(), 0, (LPSTR) seiA.lpDirectory ); + if (seiA.lpClass) HeapFree( GetProcessHeap(), 0, (LPSTR) seiA.lpClass ); + + return ret; } + static LPUNKNOWN SHELL32_IExplorerInterface=0; /************************************************************************* * SHSetInstanceExplorer [SHELL32.176] diff --git a/dlls/shell32/shellpath.c b/dlls/shell32/shellpath.c index 53d948f5532..5d4cfb76c7b 100644 --- a/dlls/shell32/shellpath.c +++ b/dlls/shell32/shellpath.c @@ -4,17 +4,14 @@ * Many of this functions are in SHLWAPI.DLL also * */ -#include #include #include #include "windows.h" -#include "winerror.h" -#include "file.h" -#include "shell.h" -#include "shlobj.h" #include "debug.h" #include "winnls.h" #include "winversion.h" + +#include "shlobj.h" #include "shell32_main.h" /************************************************************************* diff --git a/dlls/shell32/shlfolder.c b/dlls/shell32/shlfolder.c index 30b21e8c53b..9e80108306f 100644 --- a/dlls/shell32/shlfolder.c +++ b/dlls/shell32/shlfolder.c @@ -6,20 +6,18 @@ * */ -#include #include #include -#include "ole.h" -#include "ole2.h" + #include "debug.h" -#include "shlobj.h" -#include "objbase.h" -#include "shell.h" #include "winerror.h" -#include "winnls.h" -#include "winproc.h" -#include "commctrl.h" + +#include "wine/obj_base.h" +#include "shlguid.h" + #include "pidl.h" +#include "objbase.h" +#include "shlobj.h" #include "shell32_main.h" static HRESULT WINAPI IShellFolder_QueryInterface(LPSHELLFOLDER,REFIID,LPVOID*); @@ -104,36 +102,36 @@ LPSHELLFOLDER IShellFolder_Constructor(LPSHELLFOLDER pParent,LPITEMIDLIST pidl) sf->lpvtbl=&sfvt; sf->sMyPath=NULL; /* path of the folder */ sf->pMyPidl=NULL; /* my qualified pidl */ - sf->mpSFParent=pParent; /* parrent shellfolder */ TRACE(shell,"(%p)->(parent=%p, pidl=%p)\n",sf,pParent, pidl); pdump(pidl); /* keep a copy of the pidl in the instance*/ - sf->mpidl = ILClone(pidl); + sf->mpidl = ILClone(pidl); /* my short pidl */ - if(sf->mpidl) /* do we have a pidl? */ + if(sf->mpidl) /* do we have a pidl? */ { dwSize = 0; - if(sf->mpSFParent->sMyPath) /* get the size of the parents path */ - { dwSize += strlen(sf->mpSFParent->sMyPath) ; - TRACE(shell,"-- (%p)->(parent's path=%s)\n",sf, debugstr_a(sf->mpSFParent->sMyPath)); + if(pParent->sMyPath) /* get the size of the parents path */ + { dwSize += strlen(pParent->sMyPath) ; + TRACE(shell,"-- (%p)->(parent's path=%s)\n",sf, debugstr_a(pParent->sMyPath)); } dwSize += _ILGetFolderText(sf->mpidl,NULL,0); /* add the size of the foldername*/ sf->sMyPath = SHAlloc(dwSize+2); /* '\0' and backslash */ if(sf->sMyPath) { int len; *(sf->sMyPath)=0x00; - if(sf->mpSFParent->sMyPath) /* if the parent has a path, get it*/ - { strcpy(sf->sMyPath, sf->mpSFParent->sMyPath); + if(pParent->sMyPath) /* if the parent has a path, get it*/ + { strcpy(sf->sMyPath, pParent->sMyPath); PathAddBackslash32A (sf->sMyPath); } - sf->pMyPidl = ILCombine(sf->mpSFParent->pMyPidl, pidl); + sf->pMyPidl = ILCombine(pParent->pMyPidl, pidl); len = strlen(sf->sMyPath); _ILGetFolderText(sf->mpidl, sf->sMyPath+len, dwSize-len); TRACE(shell,"-- (%p)->(my pidl=%p, my path=%s)\n",sf, sf->pMyPidl,debugstr_a(sf->sMyPath)); pdump (sf->pMyPidl); } } + shell32_ObjCount++; return sf; } /************************************************************************** @@ -171,7 +169,8 @@ static HRESULT WINAPI IShellFolder_QueryInterface( */ static ULONG WINAPI IShellFolder_AddRef(LPSHELLFOLDER this) -{ TRACE(shell,"(%p)->(count=%lu)\n",this,(this->ref)+1); +{ TRACE(shell,"(%p)->(count=%lu)\n",this,this->ref); + shell32_ObjCount++; return ++(this->ref); } @@ -180,6 +179,8 @@ static ULONG WINAPI IShellFolder_AddRef(LPSHELLFOLDER this) */ static ULONG WINAPI IShellFolder_Release(LPSHELLFOLDER this) { TRACE(shell,"(%p)->(count=%lu)\n",this,this->ref); + + shell32_ObjCount--; if (!--(this->ref)) { TRACE(shell,"-- destroying IShellFolder(%p)\n",this); diff --git a/dlls/shell32/shlview.c b/dlls/shell32/shlview.c index 95a60b16d48..a02ef3fa87d 100644 --- a/dlls/shell32/shlview.c +++ b/dlls/shell32/shlview.c @@ -2,27 +2,25 @@ * ShellView * * Copyright 1998 + * + * FIXME: when the ShellView_WndProc gets a WM_NCDESTROY should we do a + * Release() ??? + * */ -#include #include #include -#include "ole.h" -#include "ole2.h" #include "debug.h" -#include "servprov.h" -#include "shlobj.h" -#include "objbase.h" -#include "shell.h" #include "winerror.h" -#include "winnls.h" -#include "winproc.h" -#include "commctrl.h" -#include "shell32_main.h" #include "pidl.h" -#include "shresdef.h" +#include "shlguid.h" +#include "shlobj.h" +#include "servprov.h" +#include "objbase.h" #include "if_macros.h" +#include "shell32_main.h" +#include "shresdef.h" /*********************************************************************** * IShellView implementation @@ -128,6 +126,7 @@ LPSHELLVIEW IShellView_Constructor( LPSHELLFOLDER pFolder, LPCITEMIDLIST pidl) sv->pSFParent->lpvtbl->fnAddRef(sv->pSFParent); TRACE(shell,"(%p)->(%p pidl=%p)\n",sv, pFolder, pidl); + shell32_ObjCount++; return sv; } /************************************************************************** @@ -390,13 +389,13 @@ static HRESULT ShellView_FillList(LPSHELLVIEW this) { ZeroMemory(&lvItem, sizeof(lvItem)); /* create the listviewitem*/ lvItem.mask = LVIF_TEXT | LVIF_IMAGE | LVIF_PARAM; /*set the mask*/ lvItem.iItem = ListView_GetItemCount(this->hWndList); /*add the item to the end of the list*/ - lvItem.lParam = (LPARAM)ILClone(pidl); /*set the item's data*/ + lvItem.lParam = (LPARAM) pidl; /*set the item's data*/ lvItem.pszText = LPSTR_TEXTCALLBACK32A; /*get text on a callback basis*/ lvItem.iImage = I_IMAGECALLBACK; /*get the image on a callback basis*/ ListView_InsertItem32A(this->hWndList, &lvItem); } else - SHFree(pidl); /* the listview has a COPY*/ + SHFree(pidl); /* the listview has the COPY*/ } /*turn the listview's redrawing back on and force it to draw*/ @@ -1316,14 +1315,18 @@ static HRESULT WINAPI IShellView_QueryInterface(LPSHELLVIEW this,REFIID riid, LP * IShellView::AddRef */ static ULONG WINAPI IShellView_AddRef(LPSHELLVIEW this) -{ TRACE(shell,"(%p)->(count=%lu)\n",this,(this->ref)+1); - return ++(this->ref); +{ TRACE(shell,"(%p)->(count=%lu)\n",this,(this->ref)+1); + + shell32_ObjCount++; + return ++(this->ref); } /************************************************************************** * IShellView_Release */ static ULONG WINAPI IShellView_Release(LPSHELLVIEW this) { TRACE(shell,"(%p)->()\n",this); + + shell32_ObjCount--; if (!--(this->ref)) { TRACE(shell," destroying IShellView(%p)\n",this); @@ -1333,6 +1336,9 @@ static ULONG WINAPI IShellView_Release(LPSHELLVIEW this) if (this->aSelectedItems) SHFree(this->aSelectedItems); + if (this->pCommDlgBrowser) + this->pCommDlgBrowser->lpvtbl->fnRelease(this->pCommDlgBrowser); + HeapFree(GetProcessHeap(),0,this); return 0; } @@ -1342,7 +1348,7 @@ static ULONG WINAPI IShellView_Release(LPSHELLVIEW this) * ShellView_GetWindow */ static HRESULT WINAPI IShellView_GetWindow(LPSHELLVIEW this,HWND32 * phWnd) -{ TRACE(shell,"(%p) stub\n",this); +{ TRACE(shell,"(%p)\n",this); *phWnd = this->hWnd; return S_OK; @@ -1439,11 +1445,10 @@ static HRESULT WINAPI IShellView_CreateViewWindow(LPSHELLVIEW this, IShellView * IShellBrowser_AddRef(this->pShellBrowser); IShellBrowser_GetWindow(this->pShellBrowser, &(this->hWndParent)); - /* try to get the ICommDlgBrowserInterface */ + /* try to get the ICommDlgBrowserInterface, adds a reference !!! */ this->pCommDlgBrowser=NULL; - if ( SUCCEEDED (IShellBrowser_QueryInterface( this->pShellBrowser, - (REFIID)&IID_ICommDlgBrowser, - (LPVOID*) &this->pCommDlgBrowser))) + if ( SUCCEEDED (IShellBrowser_QueryInterface( this->pShellBrowser, + (REFIID)&IID_ICommDlgBrowser, (LPVOID*) &this->pCommDlgBrowser))) { TRACE(shell,"-- CommDlgBrowser\n"); } diff --git a/include/interfaces.h b/include/interfaces.h index a7621f6a5ac..c0768d1db87 100644 --- a/include/interfaces.h +++ b/include/interfaces.h @@ -11,21 +11,7 @@ #define FAR #define THIS_ THIS, - -DEFINE_OLEGUID(IID_IUnknown,0,0,0); -DEFINE_OLEGUID(IID_IClassFactory,1,0,0); -DEFINE_OLEGUID(IID_IMalloc,2,0,0); -DEFINE_OLEGUID(IID_IMarshal,3,0,0); -DEFINE_OLEGUID(IID_IStorage,0xb,0,0); -DEFINE_OLEGUID(IID_IStream,0xc,0,0); -DEFINE_OLEGUID(IID_IBindCtx,0xe,0,0); -DEFINE_OLEGUID(IID_IMoniker,0xf,0,0); -DEFINE_OLEGUID(IID_IRunningObject,0x10,0,0); -DEFINE_OLEGUID(IID_IRootStorage,0x12,0,0); -DEFINE_OLEGUID(IID_IMessageFilter,0x16,0,0); -DEFINE_OLEGUID(IID_IStdMarshalInfo,0x18,0,0); - - +/* fixme move to wine/obj_*.h */ DEFINE_OLEGUID(IID_IDispatch, 0x00020400,0,0); DEFINE_OLEGUID(IID_ITypeInfo, 0x00020401,0,0); DEFINE_OLEGUID(IID_ITypeLib, 0x00020402,0,0); diff --git a/include/shlguid.h b/include/shlguid.h index 3f6a85356cc..6ce12a1d63d 100644 --- a/include/shlguid.h +++ b/include/shlguid.h @@ -1,13 +1,56 @@ #ifndef __WINE_SHLGUID_H #define __WINE_SHLGUID_H +#include "initguid.h" -/* This file defines the GUID of the shell objects. In WINE we define - * the GUIDs where the interface is declared so this file just - * includes shlobj.h - */ +DEFINE_SHLGUID(CLSID_ShellDesktop, 0x00021400L, 0, 0); +DEFINE_SHLGUID(CLSID_ShellLink, 0x00021401L, 0, 0); -#include "shlobj.h" +/* shell32 formatids */ +DEFINE_SHLGUID(FMTID_Intshcut, 0x000214A0L, 0, 0); +DEFINE_SHLGUID(FMTID_InternetSite, 0x000214A1L, 0, 0); +/* command group ids */ +DEFINE_SHLGUID(CGID_Explorer, 0x000214D0L, 0, 0); +DEFINE_SHLGUID(CGID_ShellDocView, 0x000214D1L, 0, 0); + /* shell32interface ids */ +DEFINE_SHLGUID(IID_INewShortcutHookA, 0x000214E1L, 0, 0); +DEFINE_SHLGUID(IID_IShellBrowser, 0x000214E2L, 0, 0); +#define SID_SShellBrowser IID_IShellBrowser +DEFINE_SHLGUID(IID_IShellView, 0x000214E3L, 0, 0); +DEFINE_SHLGUID(IID_IContextMenu, 0x000214E4L, 0, 0); +DEFINE_SHLGUID(IID_IShellIcon, 0x000214E5L, 0, 0); +DEFINE_SHLGUID(IID_IShellFolder, 0x000214E6L, 0, 0); +DEFINE_SHLGUID(IID_IShellExtInit, 0x000214E8L, 0, 0); +DEFINE_SHLGUID(IID_IShellPropSheetExt, 0x000214E9L, 0, 0); +DEFINE_SHLGUID(IID_IExtractIcon, 0x000214EBL, 0, 0); +DEFINE_SHLGUID(IID_IShellLink, 0x000214EEL, 0, 0); +DEFINE_SHLGUID(IID_IShellCopyHook, 0x000214EFL, 0, 0); +DEFINE_SHLGUID(IID_IFileViewer, 0x000214F0L, 0, 0); +DEFINE_SHLGUID(IID_ICommDlgBrowser, 0x000214F1L, 0, 0); +DEFINE_SHLGUID(IID_IEnumIDList, 0x000214F2L, 0, 0); +DEFINE_SHLGUID(IID_IFileViewerSite, 0x000214F3L, 0, 0); +DEFINE_SHLGUID(IID_IContextMenu2, 0x000214F4L, 0, 0); +DEFINE_SHLGUID(IID_IShellExecuteHookA, 0x000214F5L, 0, 0); +DEFINE_SHLGUID(IID_IPropSheetPage, 0x000214F6L, 0, 0); +DEFINE_SHLGUID(IID_INewShortcutHookW, 0x000214F7L, 0, 0); +DEFINE_SHLGUID(IID_IFileViewerW, 0x000214F8L, 0, 0); +DEFINE_SHLGUID(IID_IShellLinkW, 0x000214F9L, 0, 0); +DEFINE_SHLGUID(IID_IExtractIconW, 0x000214FAL, 0, 0); +DEFINE_SHLGUID(IID_IShellExecuteHookW, 0x000214FBL, 0, 0); +DEFINE_SHLGUID(IID_IShellCopyHookW, 0x000214FCL, 0, 0); + +DEFINE_GUID (IID_IDockingWindow, 0x012dd920L, 0x7B26, 0x11D0, 0x8C, 0xA9, 0x00, 0xA0, 0xC9, 0x2D, 0xBF, 0xE8); +DEFINE_GUID (IID_IDockingWindowSite, 0x2A342FC2L, 0x7B26, 0x11D0, 0x8C, 0xA9, 0x00, 0xA0, 0xC9, 0x2D, 0xBF, 0xE8); +DEFINE_GUID (IID_IDockingWindowFrame, 0x47D2657AL, 0x7B27, 0x11D0, 0x8C, 0xA9, 0x00, 0xA0, 0xC9, 0x2D, 0xBF, 0xE8); + +/**************************************************************************** +* the following should be moved to the right place +*/ +DEFINE_GUID (IID_MyComputer, 0x20D04FE0L, 0x3AEA, 0x1069, 0xA2, 0xD8, 0x08, 0x00, 0x2B, 0x30, 0x30, 0x9D); +DEFINE_SHLGUID(IID_IEnumOLEVERB, 0x00000104L, 0, 0); +DEFINE_SHLGUID(IID_IViewObject, 0x0000010DL, 0, 0); +DEFINE_SHLGUID(IID_IDropSource, 0x00000121L, 0, 0); +DEFINE_SHLGUID(IID_IDropTarget, 0x00000122L, 0, 0); #endif /* __WINE_SHLGUID_H */ diff --git a/include/shlobj.h b/include/shlobj.h index c741985432f..a87620dc13c 100644 --- a/include/shlobj.h +++ b/include/shlobj.h @@ -33,63 +33,6 @@ typedef struct tagSHELLICON *LPSHELLICON, IShellIcon; typedef struct tagDOCKINGWINDOWFRAME *LPDOCKINGWINDOWFRAME, IDockingWindowFrame; typedef struct tagCOMMDLGBROWSER *LPCOMMDLGBROWSER, ICommDlgBrowser; - - -/**************************************************************************** -* SHELL ID -*/ -/* desktop elements */ -DEFINE_GUID (IID_MyComputer, 0x20D04FE0L, 0x3AEA, 0x1069, 0xA2, 0xD8, 0x08, 0x00, 0x2B, 0x30, 0x30, 0x9D); - -/* strange Objects */ -DEFINE_SHLGUID(IID_IEnumOLEVERB, 0x00000104L, 0, 0); - -DEFINE_SHLGUID(IID_IViewObject, 0x0000010DL, 0, 0); - -DEFINE_SHLGUID(IID_IDropSource, 0x00000121L, 0, 0); -DEFINE_SHLGUID(IID_IDropTarget, 0x00000122L, 0, 0); - -DEFINE_GUID (IID_IDockingWindow, 0x012dd920L, 0x7B26, 0x11D0, 0x8C, 0xA9, 0x00, 0xA0, 0xC9, 0x2D, 0xBF, 0xE8); -DEFINE_GUID (IID_IDockingWindowSite, 0x2A342FC2L, 0x7B26, 0x11D0, 0x8C, 0xA9, 0x00, 0xA0, 0xC9, 0x2D, 0xBF, 0xE8); -DEFINE_GUID (IID_IDockingWindowFrame, 0x47D2657AL, 0x7B27, 0x11D0, 0x8C, 0xA9, 0x00, 0xA0, 0xC9, 0x2D, 0xBF, 0xE8); - -DEFINE_SHLGUID(CLSID_ShellDesktop, 0x00021400L, 0, 0); -DEFINE_SHLGUID(CLSID_ShellLink, 0x00021401L, 0, 0); - -/* shell32 formatids */ -DEFINE_SHLGUID(FMTID_Intshcut, 0x000214A0L, 0, 0); -DEFINE_SHLGUID(FMTID_InternetSite, 0x000214A1L, 0, 0); -/* command group ids */ -DEFINE_SHLGUID(CGID_Explorer, 0x000214D0L, 0, 0); -DEFINE_SHLGUID(CGID_ShellDocView, 0x000214D1L, 0, 0); - - /* shell32interface ids */ -DEFINE_SHLGUID(IID_INewShortcutHookA, 0x000214E1L, 0, 0); -DEFINE_SHLGUID(IID_IShellBrowser, 0x000214E2L, 0, 0); -#define SID_SShellBrowser IID_IShellBrowser -DEFINE_SHLGUID(IID_IShellView, 0x000214E3L, 0, 0); -DEFINE_SHLGUID(IID_IContextMenu, 0x000214E4L, 0, 0); -DEFINE_SHLGUID(IID_IShellIcon, 0x000214E5L, 0, 0); -DEFINE_SHLGUID(IID_IShellFolder, 0x000214E6L, 0, 0); -DEFINE_SHLGUID(IID_IShellExtInit, 0x000214E8L, 0, 0); -DEFINE_SHLGUID(IID_IShellPropSheetExt, 0x000214E9L, 0, 0); -DEFINE_SHLGUID(IID_IExtractIcon, 0x000214EBL, 0, 0); -DEFINE_SHLGUID(IID_IShellLink, 0x000214EEL, 0, 0); -DEFINE_SHLGUID(IID_IShellCopyHook, 0x000214EFL, 0, 0); -DEFINE_SHLGUID(IID_IFileViewer, 0x000214F0L, 0, 0); -DEFINE_SHLGUID(IID_ICommDlgBrowser, 0x000214F1L, 0, 0); -DEFINE_SHLGUID(IID_IEnumIDList, 0x000214F2L, 0, 0); -DEFINE_SHLGUID(IID_IFileViewerSite, 0x000214F3L, 0, 0); -DEFINE_SHLGUID(IID_IContextMenu2, 0x000214F4L, 0, 0); -DEFINE_SHLGUID(IID_IShellExecuteHookA, 0x000214F5L, 0, 0); -DEFINE_SHLGUID(IID_IPropSheetPage, 0x000214F6L, 0, 0); -DEFINE_SHLGUID(IID_INewShortcutHookW, 0x000214F7L, 0, 0); -DEFINE_SHLGUID(IID_IFileViewerW, 0x000214F8L, 0, 0); -DEFINE_SHLGUID(IID_IShellLinkW, 0x000214F9L, 0, 0); -DEFINE_SHLGUID(IID_IExtractIconW, 0x000214FAL, 0, 0); -DEFINE_SHLGUID(IID_IShellExecuteHookW, 0x000214FBL, 0, 0); -DEFINE_SHLGUID(IID_IShellCopyHookW, 0x000214FCL, 0, 0); - /**************************************************************************** * STRRET */ @@ -503,7 +446,6 @@ struct tagSHELLFOLDER { LPSTR sMyPath; LPITEMIDLIST pMyPidl; LPITEMIDLIST mpidl; - LPSHELLFOLDER mpSFParent; }; extern LPSHELLFOLDER pdesktopfolder; @@ -1221,6 +1163,8 @@ typedef struct } SHELLFLAGSTATE, * LPSHELLFLAGSTATE; +DWORD WINAPI SHGetMalloc(LPMALLOC32 *lpmal) ; + #undef PURE #undef FAR #undef THIS diff --git a/include/windows.h b/include/windows.h index 4431430fd7f..31a0e2239cf 100644 --- a/include/windows.h +++ b/include/windows.h @@ -4259,8 +4259,8 @@ VOID WINAPI SetLastError(DWORD); /* Declarations for functions that change between Win16 and Win32 */ -LRESULT WINAPI AboutDlgProc16(HWND16,UINT16,WPARAM16,LPARAM); -LRESULT WINAPI AboutDlgProc32(HWND32,UINT32,WPARAM32,LPARAM); +BOOL16 WINAPI AboutDlgProc16(HWND16,UINT16,WPARAM16,LPARAM); +BOOL32 WINAPI AboutDlgProc32(HWND32,UINT32,WPARAM32,LPARAM); #define AboutDlgProc WINELIB_NAME(AboutDlgProc) INT16 WINAPI AccessResource16(HINSTANCE16,HRSRC16); INT32 WINAPI AccessResource32(HMODULE32,HRSRC32); diff --git a/misc/shell.c b/misc/shell.c index d30603214d8..18090d0adea 100644 --- a/misc/shell.c +++ b/misc/shell.c @@ -451,7 +451,7 @@ HINSTANCE16 WINAPI FindExecutable16( LPCSTR lpFile, LPCSTR lpDirectory, /************************************************************************* * AboutDlgProc16 (SHELL.33) */ -LRESULT WINAPI AboutDlgProc16( HWND16 hWnd, UINT16 msg, WPARAM16 wParam, +BOOL16 WINAPI AboutDlgProc16( HWND16 hWnd, UINT16 msg, WPARAM16 wParam, LPARAM lParam ) { return AboutDlgProc32( hWnd, msg, wParam, lParam ); }