Commit 23b80879 authored by Juergen Schmied's avatar Juergen Schmied Committed by Alexandre Julliard

- changed STRRET definition

- small changes for seperation of shell32 from ole32 - debughelper for printing interface names (shell internal) - changed shell memory allocation to use IMalloc of ole32 when this library is already loaded - fallback IMalloc internally in shell - unified constructor syntax for several objects created by DllGetClassObject - rewrote instance creation for com objects - made the desktop folder parsing paths like ::{CLSID} - Implemented IPersistFolder3 partially
parent 17a2fe0f
...@@ -1046,18 +1046,18 @@ static LRESULT FILEDLG95_InitControls(HWND hwnd) ...@@ -1046,18 +1046,18 @@ static LRESULT FILEDLG95_InitControls(HWND hwnd)
/* Initialise the file name edit control */ /* Initialise the file name edit control */
handledPath = FALSE; handledPath = FALSE;
TRACE("Before manipilation, file = '%s', dir = '%s'\n", fodInfos->ofnInfos->lpstrFile, fodInfos->ofnInfos->lpstrInitialDir); TRACE("Before manipilation, file = '%s', dir = '%s'\n", fodInfos->ofnInfos->lpstrFile, fodInfos->ofnInfos->lpstrInitialDir);
if(fodInfos->ofnInfos->lpstrFile) if(fodInfos->ofnInfos->lpstrFile)
{ {
/* 1. If win2000 or higher and filename contains a path, use it /* 1. If win2000 or higher and filename contains a path, use it
in preference over the lpstrInitialDir */ in preference over the lpstrInitialDir */
if (win2000plus && *fodInfos->ofnInfos->lpstrFile && if (win2000plus && *fodInfos->ofnInfos->lpstrFile &&
strstr(fodInfos->ofnInfos->lpstrFile, "\\")) { strstr(fodInfos->ofnInfos->lpstrFile, "\\")) {
char tmpBuf[MAX_PATH]; char tmpBuf[MAX_PATH];
char *nameBit; char *nameBit;
DWORD result; DWORD result;
result = GetFullPathNameA(fodInfos->ofnInfos->lpstrFile, MAX_PATH, result = GetFullPathNameA(fodInfos->ofnInfos->lpstrFile, MAX_PATH,
tmpBuf, &nameBit); tmpBuf, &nameBit);
if (result) { if (result) {
strcpy(fodInfos->ofnInfos->lpstrFile, (LPSTR)nameBit); strcpy(fodInfos->ofnInfos->lpstrFile, (LPSTR)nameBit);
...@@ -1071,7 +1071,7 @@ static LRESULT FILEDLG95_InitControls(HWND hwnd) ...@@ -1071,7 +1071,7 @@ static LRESULT FILEDLG95_InitControls(HWND hwnd)
strcpy((LPSTR)fodInfos->ofnInfos->lpstrInitialDir, tmpBuf); strcpy((LPSTR)fodInfos->ofnInfos->lpstrInitialDir, tmpBuf);
} }
handledPath = TRUE; handledPath = TRUE;
TRACE("Value in lpstrFile includes path, overriding lpstrInitialDir: %s, %s\n", TRACE("Value in lpstrFile includes path, overriding lpstrInitialDir: %s, %s\n",
fodInfos->ofnInfos->lpstrFile, fodInfos->ofnInfos->lpstrInitialDir); fodInfos->ofnInfos->lpstrFile, fodInfos->ofnInfos->lpstrInitialDir);
} }
SetDlgItemTextA(hwnd, IDC_FILENAME, fodInfos->ofnInfos->lpstrFile); SetDlgItemTextA(hwnd, IDC_FILENAME, fodInfos->ofnInfos->lpstrFile);
...@@ -1113,13 +1113,13 @@ static LRESULT FILEDLG95_InitControls(HWND hwnd) ...@@ -1113,13 +1113,13 @@ static LRESULT FILEDLG95_InitControls(HWND hwnd)
{ {
/* 3. All except w2k+: if filename contains a path use it */ /* 3. All except w2k+: if filename contains a path use it */
if (!win2000plus && fodInfos->ofnInfos->lpstrFile && if (!win2000plus && fodInfos->ofnInfos->lpstrFile &&
*fodInfos->ofnInfos->lpstrFile && *fodInfos->ofnInfos->lpstrFile &&
strstr(fodInfos->ofnInfos->lpstrFile, "\\")) { strstr(fodInfos->ofnInfos->lpstrFile, "\\")) {
char tmpBuf[MAX_PATH]; char tmpBuf[MAX_PATH];
char *nameBit; char *nameBit;
DWORD result; DWORD result;
result = GetFullPathNameA(fodInfos->ofnInfos->lpstrFile, MAX_PATH, result = GetFullPathNameA(fodInfos->ofnInfos->lpstrFile, MAX_PATH,
tmpBuf, &nameBit); tmpBuf, &nameBit);
if (result) { if (result) {
strcpy(fodInfos->ofnInfos->lpstrFile, nameBit); strcpy(fodInfos->ofnInfos->lpstrFile, nameBit);
...@@ -1133,7 +1133,7 @@ static LRESULT FILEDLG95_InitControls(HWND hwnd) ...@@ -1133,7 +1133,7 @@ static LRESULT FILEDLG95_InitControls(HWND hwnd)
strcpy((LPSTR)fodInfos->ofnInfos->lpstrInitialDir, tmpBuf); strcpy((LPSTR)fodInfos->ofnInfos->lpstrInitialDir, tmpBuf);
} }
handledPath = TRUE; handledPath = TRUE;
TRACE("Value in lpstrFile includes path, overriding lpstrInitialDir: %s, %s\n", TRACE("Value in lpstrFile includes path, overriding lpstrInitialDir: %s, %s\n",
fodInfos->ofnInfos->lpstrFile, fodInfos->ofnInfos->lpstrInitialDir); fodInfos->ofnInfos->lpstrFile, fodInfos->ofnInfos->lpstrInitialDir);
} }
SetDlgItemTextA(hwnd, IDC_FILENAME, fodInfos->ofnInfos->lpstrFile); SetDlgItemTextA(hwnd, IDC_FILENAME, fodInfos->ofnInfos->lpstrFile);
...@@ -1141,8 +1141,8 @@ static LRESULT FILEDLG95_InitControls(HWND hwnd) ...@@ -1141,8 +1141,8 @@ static LRESULT FILEDLG95_InitControls(HWND hwnd)
/* 4. win98+ and win2000+ if any files of specified filter types in /* 4. win98+ and win2000+ if any files of specified filter types in
current directory, use it */ current directory, use it */
if ( win98plus && handledPath == FALSE && if ( win98plus && handledPath == FALSE &&
fodInfos->ofnInfos->lpstrFilter && fodInfos->ofnInfos->lpstrFilter &&
*fodInfos->ofnInfos->lpstrFilter) { *fodInfos->ofnInfos->lpstrFilter) {
BOOL searchMore = TRUE; BOOL searchMore = TRUE;
...@@ -1150,7 +1150,7 @@ static LRESULT FILEDLG95_InitControls(HWND hwnd) ...@@ -1150,7 +1150,7 @@ static LRESULT FILEDLG95_InitControls(HWND hwnd)
WIN32_FIND_DATAA FindFileData; WIN32_FIND_DATAA FindFileData;
HANDLE hFind; HANDLE hFind;
while (searchMore) while (searchMore)
{ {
/* filter is a list... title\0ext\0......\0\0 */ /* filter is a list... title\0ext\0......\0\0 */
...@@ -1169,7 +1169,7 @@ static LRESULT FILEDLG95_InitControls(HWND hwnd) ...@@ -1169,7 +1169,7 @@ static LRESULT FILEDLG95_InitControls(HWND hwnd)
} else { } else {
searchMore = FALSE; searchMore = FALSE;
initDir = MemAlloc(MAX_PATH); initDir = MemAlloc(MAX_PATH);
GetCurrentDirectoryA(MAX_PATH, initDir); GetCurrentDirectoryA(MAX_PATH, initDir);
fodInfos->ofnInfos->lpstrInitialDir = initDir; fodInfos->ofnInfos->lpstrInitialDir = initDir;
...@@ -2680,11 +2680,11 @@ static HRESULT COMDLG32_StrRetToStrNA (LPVOID dest, DWORD len, LPSTRRET src, LPI ...@@ -2680,11 +2680,11 @@ static HRESULT COMDLG32_StrRetToStrNA (LPVOID dest, DWORD len, LPSTRRET src, LPI
COMDLG32_SHFree(src->u.pOleStr); COMDLG32_SHFree(src->u.pOleStr);
break; break;
case STRRET_CSTRA: case STRRET_CSTR:
lstrcpynA((LPSTR)dest, src->u.cStr, len); lstrcpynA((LPSTR)dest, src->u.cStr, len);
break; break;
case STRRET_OFFSETA: case STRRET_OFFSET:
lstrcpynA((LPSTR)dest, ((LPCSTR)&pidl->mkid)+src->u.uOffset, len); lstrcpynA((LPSTR)dest, ((LPCSTR)&pidl->mkid)+src->u.uOffset, len);
break; break;
...@@ -2946,9 +2946,9 @@ LPITEMIDLIST GetParentPidl(LPITEMIDLIST pidl) ...@@ -2946,9 +2946,9 @@ LPITEMIDLIST GetParentPidl(LPITEMIDLIST pidl)
* returns the pidl of the file name relative to folder * returns the pidl of the file name relative to folder
* NULL if an error occurred * NULL if an error occurred
*/ */
LPITEMIDLIST GetPidlFromName(IShellFolder *lpsf,LPCSTR lpcstrFileName) LPITEMIDLIST GetPidlFromName(IShellFolder *lpsf, LPCSTR lpcstrFileName)
{ {
LPITEMIDLIST pidl; LPITEMIDLIST pidl = NULL;
ULONG ulEaten; ULONG ulEaten;
WCHAR lpwstrDirName[MAX_PATH]; WCHAR lpwstrDirName[MAX_PATH];
...@@ -2957,16 +2957,16 @@ LPITEMIDLIST GetPidlFromName(IShellFolder *lpsf,LPCSTR lpcstrFileName) ...@@ -2957,16 +2957,16 @@ LPITEMIDLIST GetPidlFromName(IShellFolder *lpsf,LPCSTR lpcstrFileName)
if(!lpcstrFileName) return NULL; if(!lpcstrFileName) return NULL;
if(!*lpcstrFileName) return NULL; if(!*lpcstrFileName) return NULL;
MultiByteToWideChar(CP_ACP,MB_PRECOMPOSED,lpcstrFileName,-1,(LPWSTR)lpwstrDirName,MAX_PATH);
if(!lpsf) if(!lpsf)
{ {
SHGetDesktopFolder(&lpsf); if (SUCCEEDED(SHGetDesktopFolder(&lpsf))) {
pidl = GetPidlFromName(lpsf, lpcstrFileName); pidl = GetPidlFromName(lpsf, lpcstrFileName);
IShellFolder_Release(lpsf); IShellFolder_Release(lpsf);
}
} }
else else
{ {
MultiByteToWideChar(CP_ACP,MB_PRECOMPOSED,lpcstrFileName,-1,(LPWSTR)lpwstrDirName,MAX_PATH);
IShellFolder_ParseDisplayName(lpsf, 0, NULL, (LPWSTR)lpwstrDirName, &ulEaten, &pidl, NULL); IShellFolder_ParseDisplayName(lpsf, 0, NULL, (LPWSTR)lpwstrDirName, &ulEaten, &pidl, NULL);
} }
return pidl; return pidl;
...@@ -3035,4 +3035,3 @@ static void MemFree(void *mem) ...@@ -3035,4 +3035,3 @@ static void MemFree(void *mem)
HeapFree(GetProcessHeap(),0,mem); HeapFree(GetProcessHeap(),0,mem);
} }
} }
...@@ -111,12 +111,12 @@ static HRESULT COMDLG32_StrRetToStrNW (LPVOID dest, DWORD len, LPSTRRET src, LPI ...@@ -111,12 +111,12 @@ static HRESULT COMDLG32_StrRetToStrNW (LPVOID dest, DWORD len, LPSTRRET src, LPI
COMDLG32_SHFree(src->u.pOleStr); COMDLG32_SHFree(src->u.pOleStr);
break; break;
case STRRET_CSTRA: case STRRET_CSTR:
if (len && !MultiByteToWideChar( CP_ACP, 0, src->u.cStr, -1, (LPWSTR)dest, len )) if (len && !MultiByteToWideChar( CP_ACP, 0, src->u.cStr, -1, (LPWSTR)dest, len ))
((LPWSTR)dest)[len-1] = 0; ((LPWSTR)dest)[len-1] = 0;
break; break;
case STRRET_OFFSETA: case STRRET_OFFSET:
if (pidl) if (pidl)
{ {
if (len && !MultiByteToWideChar( CP_ACP, 0, ((LPCSTR)&pidl->mkid)+src->u.uOffset, if (len && !MultiByteToWideChar( CP_ACP, 0, ((LPCSTR)&pidl->mkid)+src->u.uOffset,
...@@ -212,7 +212,7 @@ ULONG WINAPI IShellBrowserImpl_AddRef(IShellBrowser * iface) ...@@ -212,7 +212,7 @@ ULONG WINAPI IShellBrowserImpl_AddRef(IShellBrowser * iface)
{ {
ICOM_THIS(IShellBrowserImpl, iface); ICOM_THIS(IShellBrowserImpl, iface);
TRACE("(%p)\n", This); TRACE("(%p,%lu)\n", This, This->ref);
return ++(This->ref); return ++(This->ref);
} }
...@@ -224,11 +224,12 @@ ULONG WINAPI IShellBrowserImpl_Release(IShellBrowser * iface) ...@@ -224,11 +224,12 @@ ULONG WINAPI IShellBrowserImpl_Release(IShellBrowser * iface)
{ {
ICOM_THIS(IShellBrowserImpl, iface); ICOM_THIS(IShellBrowserImpl, iface);
TRACE("(%p)\n", This); TRACE("(%p,%lu)\n", This, This->ref);
if (!--(This->ref)) if (!--(This->ref))
{ {
HeapFree(GetProcessHeap(),0, This); HeapFree(GetProcessHeap(),0, This);
TRACE("-- destroyed\n");
return 0; return 0;
} }
return This->ref; return This->ref;
...@@ -906,9 +907,8 @@ ULONG WINAPI IShellBrowserImpl_IServiceProvider_Release(IServiceProvider * iface ...@@ -906,9 +907,8 @@ ULONG WINAPI IShellBrowserImpl_IServiceProvider_Release(IServiceProvider * iface
* IShellBrowserImpl_IServiceProvider_Release * IShellBrowserImpl_IServiceProvider_Release
* *
* NOTES * NOTES
* the w2k shellview asks for * the w2k shellview asks for (guidService = SID_STopLevelBrowser,
* guidService = SID_STopLevelBrowser * riid = IShellBrowser) to call SendControlMsg ().
* riid = IShellBrowser
* *
* FIXME * FIXME
* this is a hack! * this is a hack!
......
...@@ -47,40 +47,23 @@ ...@@ -47,40 +47,23 @@
WINE_DEFAULT_DEBUG_CHANNEL(shell); WINE_DEFAULT_DEBUG_CHANNEL(shell);
static int refClipCount = 0; HRESULT (WINAPI *pOleInitialize)(LPVOID reserved);
static HINSTANCE hShellOle32 = 0; void (WINAPI *pOleUninitialize)(void);
HRESULT (WINAPI *pRegisterDragDrop)(HWND hwnd, IDropTarget* pDropTarget);
HRESULT (WINAPI *pRevokeDragDrop)(HWND hwnd);
HRESULT (WINAPI *pDoDragDrop)(LPDATAOBJECT,LPDROPSOURCE,DWORD,DWORD*);
void (WINAPI *pReleaseStgMedium)(STGMEDIUM* pmedium);
HRESULT (WINAPI *pOleSetClipboard)(IDataObject* pDataObj);
HRESULT (WINAPI *pOleGetClipboard)(IDataObject** ppDataObj);
/************************************************************************** /**************************************************************************
* InitShellOle * GetShellOle
*
*
*/
void InitShellOle(void)
{
}
/**************************************************************************
* FreeShellOle
*
* unload OLE32.DLL
*/
void FreeShellOle(void)
{
if (!--refClipCount)
{
pOleUninitialize();
FreeLibrary(hShellOle32);
}
}
/**************************************************************************
* LoadShellOle
* *
* make sure OLE32.DLL is loaded * make sure OLE32.DLL is loaded
*/ */
BOOL GetShellOle(void) BOOL GetShellOle(void)
{ {
if(!refClipCount) if(!hShellOle32)
{ {
hShellOle32 = LoadLibraryA("ole32.dll"); hShellOle32 = LoadLibraryA("ole32.dll");
if(hShellOle32) if(hShellOle32)
...@@ -95,7 +78,6 @@ BOOL GetShellOle(void) ...@@ -95,7 +78,6 @@ BOOL GetShellOle(void)
pOleGetClipboard=(void*)GetProcAddress(hShellOle32,"OleGetClipboard"); pOleGetClipboard=(void*)GetProcAddress(hShellOle32,"OleGetClipboard");
pOleInitialize(NULL); pOleInitialize(NULL);
refClipCount++;
} }
} }
return TRUE; return TRUE;
......
...@@ -26,6 +26,8 @@ ...@@ -26,6 +26,8 @@
#include "shlguid.h" #include "shlguid.h"
#include "wine/debug.h" #include "wine/debug.h"
#include "debughlp.h" #include "debughlp.h"
#include "docobj.h"
#include "shell32_main.h"
WINE_DEFAULT_DEBUG_CHANNEL(pidl); WINE_DEFAULT_DEBUG_CHANNEL(pidl);
...@@ -274,3 +276,54 @@ BOOL pcheck (LPCITEMIDLIST pidl) ...@@ -274,3 +276,54 @@ BOOL pcheck (LPCITEMIDLIST pidl)
} }
return ret; return ret;
} }
static char shdebugstr_buf[100];
static struct {
REFIID riid;
char *name;
} InterfaceDesc[] = {
{&IID_IUnknown, "IID_IUnknown"},
{&IID_IShellView, "IID_IShellView"},
{&IID_IOleCommandTarget, "IID_IOleCommandTarget"},
{&IID_IDropTarget, "IID_IDropTarget"},
{&IID_IDropSource, "IID_IDropSource"},
{&IID_IViewObject, "IID_IViewObject"},
{&IID_IContextMenu, "IID_IContextMenu"},
{&IID_IShellExtInit, "IID_IShellExtInit"},
{&IID_IShellFolder, "IID_IShellFolder"},
{&IID_IShellFolder2, "IID_IShellFolder2"},
{&IID_IPersist, "IID_IPersist"},
{&IID_IPersistFolder, "IID_IPersistFolder"},
{&IID_IPersistFolder2, "IID_IPersistFolder2"},
{&IID_IPersistFolder3, "IID_IPersistFolder3"},
{&IID_IExtractIconA, "IID_IExtractIconA"},
{&IID_IDataObject, "IID_IDataObject"},
{&IID_IDataObject, "IID_IDataObject"},
{NULL,NULL}};
const char * shdebugstr_guid( const struct _GUID *id )
{
int i;
char* name = NULL;
char clsidbuf[100];
if (!id) {
strcpy (shdebugstr_buf, "(null)");
} else {
for (i=0;InterfaceDesc[i].riid && !name;i++) {
if (IsEqualIID(InterfaceDesc[i].riid, id)) name = InterfaceDesc[i].name;
}
if (!name) {
if (HCR_GetClassName(id, clsidbuf, 100))
name = clsidbuf;
}
sprintf( shdebugstr_buf, "\n\t{%08lx-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x} (%s)",
id->Data1, id->Data2, id->Data3,
id->Data4[0], id->Data4[1], id->Data4[2], id->Data4[3],
id->Data4[4], id->Data4[5], id->Data4[6], id->Data4[7], name ? name : "unknown" );
}
return shdebugstr_buf;
}
...@@ -1162,7 +1162,11 @@ LPITEMIDLIST _ILCreateSpecial(LPCSTR szGUID) ...@@ -1162,7 +1162,11 @@ LPITEMIDLIST _ILCreateSpecial(LPCSTR szGUID)
if (!MultiByteToWideChar( CP_ACP, 0, szGUID, -1, buffer, sizeof(buffer)/sizeof(WCHAR) )) if (!MultiByteToWideChar( CP_ACP, 0, szGUID, -1, buffer, sizeof(buffer)/sizeof(WCHAR) ))
return NULL; return NULL;
CLSIDFromString( buffer, &iid );
if (! SUCCEEDED (CLSIDFromString( buffer, &iid ))) {
ERR("%s is not a GUID\n", szGUID);
return NULL;
}
return _ILCreate(PT_MYCOMP, &iid, sizeof(IID)); return _ILCreate(PT_MYCOMP, &iid, sizeof(IID));
} }
...@@ -1219,7 +1223,7 @@ LPITEMIDLIST _ILCreate(PIDLTYPE type, LPCVOID pIn, UINT uInSize) ...@@ -1219,7 +1223,7 @@ LPITEMIDLIST _ILCreate(PIDLTYPE type, LPCVOID pIn, UINT uInSize)
pData =_ILGetDataPointer(pidlOut); pData =_ILGetDataPointer(pidlOut);
pData->type = type; pData->type = type;
memcpy(&(pData->u.mycomp.guid), pIn, uInSize); memcpy(&(pData->u.mycomp.guid), pIn, uInSize);
TRACE("- create GUID-pidl\n"); TRACE("-- create GUID-pidl %s\n", debugstr_guid(&(pData->u.mycomp.guid)));
break; break;
case PT_DRIVE: case PT_DRIVE:
...@@ -1227,7 +1231,7 @@ LPITEMIDLIST _ILCreate(PIDLTYPE type, LPCVOID pIn, UINT uInSize) ...@@ -1227,7 +1231,7 @@ LPITEMIDLIST _ILCreate(PIDLTYPE type, LPCVOID pIn, UINT uInSize)
pData->type = type; pData->type = type;
pszDest = _ILGetTextPointer(pidlOut); pszDest = _ILGetTextPointer(pidlOut);
memcpy(pszDest, pIn, uInSize); memcpy(pszDest, pIn, uInSize);
TRACE("- create Drive: %s\n",debugstr_a(pszDest)); TRACE("-- create Drive: %s\n",debugstr_a(pszDest));
break; break;
case PT_FOLDER: case PT_FOLDER:
...@@ -1236,7 +1240,7 @@ LPITEMIDLIST _ILCreate(PIDLTYPE type, LPCVOID pIn, UINT uInSize) ...@@ -1236,7 +1240,7 @@ LPITEMIDLIST _ILCreate(PIDLTYPE type, LPCVOID pIn, UINT uInSize)
pData->type = type; pData->type = type;
pszDest = _ILGetTextPointer(pidlOut); pszDest = _ILGetTextPointer(pidlOut);
memcpy(pszDest, pIn, uInSize); memcpy(pszDest, pIn, uInSize);
TRACE("- create Value: %s\n",debugstr_a(pszDest)); TRACE("-- create Value: %s\n",debugstr_a(pszDest));
break; break;
} }
......
...@@ -996,12 +996,6 @@ BOOL WINAPI Shell32LibMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID fImpLoad) ...@@ -996,12 +996,6 @@ BOOL WINAPI Shell32LibMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID fImpLoad)
case DLL_PROCESS_DETACH: case DLL_PROCESS_DETACH:
shell32_hInstance = 0; shell32_hInstance = 0;
if (pdesktopfolder)
{
IShellFolder_Release(pdesktopfolder);
pdesktopfolder = NULL;
}
SIC_Destroy(); SIC_Destroy();
FreeChangeNotifications(); FreeChangeNotifications();
......
...@@ -65,14 +65,7 @@ extern INT (WINAPI *pFindMRUData) (HANDLE hList, LPCVOID lpData, DWORD cbDa ...@@ -65,14 +65,7 @@ extern INT (WINAPI *pFindMRUData) (HANDLE hList, LPCVOID lpData, DWORD cbDa
extern INT (WINAPI *pEnumMRUListA) (HANDLE hList, INT nItemPos, LPVOID lpBuffer, DWORD nBufferSize); extern INT (WINAPI *pEnumMRUListA) (HANDLE hList, INT nItemPos, LPVOID lpBuffer, DWORD nBufferSize);
#define pDPA_GetPtrCount(hdpa) (*(INT*)(hdpa)) #define pDPA_GetPtrCount(hdpa) (*(INT*)(hdpa))
/* ole2 */
/*
extern HRESULT (WINAPI *pOleInitialize)(LPVOID reserved);
extern void (WINAPI *pOleUninitialize)(void);
extern HRESULT (WINAPI *pDoDragDrop)(IDataObject* pDataObject, IDropSource * pDropSource, DWORD dwOKEffect, DWORD * pdwEffect);
extern HRESULT (WINAPI *pRegisterDragDrop)(HWND hwnd, IDropTarget* pDropTarget);
extern HRESULT (WINAPI *pRevokeDragDrop)(HWND hwnd);
*/
BOOL WINAPI Shell_GetImageList(HIMAGELIST * lpBigList, HIMAGELIST * lpSmallList); BOOL WINAPI Shell_GetImageList(HIMAGELIST * lpBigList, HIMAGELIST * lpSmallList);
/* Iconcache */ /* Iconcache */
...@@ -101,9 +94,10 @@ LPCLASSFACTORY IClassFactory_Constructor(REFCLSID); ...@@ -101,9 +94,10 @@ LPCLASSFACTORY IClassFactory_Constructor(REFCLSID);
IContextMenu * ISvItemCm_Constructor(LPSHELLFOLDER pSFParent, LPCITEMIDLIST pidl, LPCITEMIDLIST *aPidls, UINT uItemCount); IContextMenu * ISvItemCm_Constructor(LPSHELLFOLDER pSFParent, LPCITEMIDLIST pidl, LPCITEMIDLIST *aPidls, UINT uItemCount);
IContextMenu * ISvBgCm_Constructor(LPSHELLFOLDER pSFParent); IContextMenu * ISvBgCm_Constructor(LPSHELLFOLDER pSFParent);
LPSHELLVIEW IShellView_Constructor(LPSHELLFOLDER); LPSHELLVIEW IShellView_Constructor(LPSHELLFOLDER);
LPSHELLLINK IShellLink_Constructor(BOOL);
IShellFolder * ISF_Desktop_Constructor(void); HRESULT WINAPI IFSFolder_Constructor(IUnknown * pUnkOuter, REFIID riid, LPVOID * ppv);
HRESULT WINAPI IShellLink_Constructor(IUnknown * pUnkOuter, REFIID riid, LPVOID * ppv);
HRESULT WINAPI ISF_Desktop_Constructor(IUnknown * pUnkOuter, REFIID riid, LPVOID * ppv);
/* kind of enumidlist */ /* kind of enumidlist */
#define EIDL_DESK 0 #define EIDL_DESK 0
...@@ -145,19 +139,20 @@ HRESULT WINAPI Shell_MergeMenus (HMENU hmDst, HMENU hmSrc, UINT uInsert, UINT uI ...@@ -145,19 +139,20 @@ HRESULT WINAPI Shell_MergeMenus (HMENU hmDst, HMENU hmSrc, UINT uInsert, UINT uI
/* Systray */ /* Systray */
BOOL SYSTRAY_Init(void); BOOL SYSTRAY_Init(void);
/* Clipboard */ /* OLE32 */
void InitShellOle(void); extern HINSTANCE hShellOle32;
void FreeShellOle(void);
BOOL GetShellOle(void); extern HRESULT (WINAPI *pOleInitialize)(LPVOID reserved);
extern void (WINAPI *pOleUninitialize)(void);
extern HRESULT (WINAPI *pRegisterDragDrop)(HWND hwnd, IDropTarget* pDropTarget);
extern HRESULT (WINAPI *pRevokeDragDrop)(HWND hwnd);
extern HRESULT (WINAPI *pDoDragDrop)(LPDATAOBJECT,LPDROPSOURCE,DWORD,DWORD*);
extern void (WINAPI *pReleaseStgMedium)(STGMEDIUM* pmedium);
extern HRESULT (WINAPI *pOleSetClipboard)(IDataObject* pDataObj);
extern HRESULT (WINAPI *pOleGetClipboard)(IDataObject** ppDataObj);
extern HRESULT (WINAPI *pCoCreateInstance)(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv);
HRESULT (WINAPI *pOleInitialize)(LPVOID reserved); BOOL GetShellOle(void);
void (WINAPI *pOleUninitialize)(void);
HRESULT (WINAPI *pRegisterDragDrop)(HWND hwnd, IDropTarget* pDropTarget);
HRESULT (WINAPI *pRevokeDragDrop)(HWND hwnd);
HRESULT (WINAPI *pDoDragDrop)(LPDATAOBJECT,LPDROPSOURCE,DWORD,DWORD*);
void (WINAPI *pReleaseStgMedium)(STGMEDIUM* pmedium);
HRESULT (WINAPI *pOleSetClipboard)(IDataObject* pDataObj);
HRESULT (WINAPI *pOleGetClipboard)(IDataObject** ppDataObj);
HGLOBAL RenderHDROP(LPITEMIDLIST pidlRoot, LPITEMIDLIST * apidl, UINT cidl); HGLOBAL RenderHDROP(LPITEMIDLIST pidlRoot, LPITEMIDLIST * apidl, UINT cidl);
HGLOBAL RenderSHELLIDLIST (LPITEMIDLIST pidlRoot, LPITEMIDLIST * apidl, UINT cidl); HGLOBAL RenderSHELLIDLIST (LPITEMIDLIST pidlRoot, LPITEMIDLIST * apidl, UINT cidl);
......
...@@ -958,10 +958,21 @@ static ICOM_VTABLE(IPersistStream) psvt = ...@@ -958,10 +958,21 @@ static ICOM_VTABLE(IPersistStream) psvt =
/************************************************************************** /**************************************************************************
* IShellLink_Constructor * IShellLink_Constructor
*/ */
IShellLinkA * IShellLink_Constructor(BOOL bUnicode) HRESULT WINAPI IShellLink_Constructor (
{ IShellLinkImpl * sl; IUnknown * pUnkOuter,
REFIID riid,
LPVOID * ppv)
{
IShellLinkImpl * sl;
TRACE("unkOut=%p riid=%s\n",pUnkOuter, debugstr_guid(riid));
*ppv = NULL;
if(pUnkOuter) return CLASS_E_NOAGGREGATION;
sl = (IShellLinkImpl *) LocalAlloc(GMEM_ZEROINIT,sizeof(IShellLinkImpl));
if (!sl) return E_OUTOFMEMORY;
sl = (IShellLinkImpl *)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IShellLinkImpl));
sl->ref = 1; sl->ref = 1;
ICOM_VTBL(sl) = &slvt; ICOM_VTBL(sl) = &slvt;
sl->lpvtblw = &slvtw; sl->lpvtblw = &slvtw;
...@@ -969,8 +980,19 @@ IShellLinkA * IShellLink_Constructor(BOOL bUnicode) ...@@ -969,8 +980,19 @@ IShellLinkA * IShellLink_Constructor(BOOL bUnicode)
sl->lpvtblPersistStream = &psvt; sl->lpvtblPersistStream = &psvt;
TRACE("(%p)->()\n",sl); TRACE("(%p)->()\n",sl);
if (IsEqualIID(riid, &IID_IShellLinkA))
*ppv = sl;
else if (IsEqualIID(riid, &IID_IShellLinkW))
*ppv = &(sl->lpvtblw);
else {
LocalFree((HLOCAL)sl);
ERR("E_NOINTERFACE\n");
return E_NOINTERFACE;
}
shell32_ObjCount++; shell32_ObjCount++;
return bUnicode ? (IShellLinkA *) &(sl->lpvtblw) : (IShellLinkA *)sl; return S_OK;
} }
/************************************************************************** /**************************************************************************
...@@ -1059,7 +1081,7 @@ static ULONG WINAPI IShellLinkA_fnRelease(IShellLinkA * iface) ...@@ -1059,7 +1081,7 @@ static ULONG WINAPI IShellLinkA_fnRelease(IShellLinkA * iface)
This->iIcoNdx = 0; This->iIcoNdx = 0;
HeapFree(GetProcessHeap(),0,This); LocalFree((HANDLE)This);
return 0; return 0;
} }
return This->ref; return This->ref;
...@@ -1538,4 +1560,3 @@ static ICOM_VTABLE(IShellLinkW) slvtw = ...@@ -1538,4 +1560,3 @@ static ICOM_VTABLE(IShellLinkW) slvtw =
IShellLinkW_fnResolve, IShellLinkW_fnResolve,
IShellLinkW_fnSetPath IShellLinkW_fnSetPath
}; };
...@@ -345,64 +345,6 @@ int WINAPIV ShellMessageBoxA( ...@@ -345,64 +345,6 @@ int WINAPIV ShellMessageBoxA(
} }
/************************************************************************* /*************************************************************************
* SHFree [SHELL32.195]
*
* NOTES
* free_ptr() - frees memory using IMalloc
* exported by ordinal
*/
#define MEM_DEBUG 0
void WINAPI SHFree(LPVOID x)
{
#if MEM_DEBUG
WORD len = *(LPWORD)((LPBYTE)x-2);
if ( *(LPWORD)((LPBYTE)x+len) != 0x7384)
ERR("MAGIC2!\n");
if ( (*(LPWORD)((LPBYTE)x-4)) != 0x8271)
ERR("MAGIC1!\n");
else
memset((LPBYTE)x-4, 0xde, len+6);
TRACE("%p len=%u\n",x, len);
x = (LPBYTE) x - 4;
#else
TRACE("%p\n",x);
#endif
HeapFree(GetProcessHeap(), 0, x);
}
/*************************************************************************
* SHAlloc [SHELL32.196]
*
* NOTES
* void *task_alloc(DWORD len), uses SHMalloc allocator
* exported by ordinal
*/
LPVOID WINAPI SHAlloc(DWORD len)
{
LPBYTE ret;
#if MEM_DEBUG
ret = (LPVOID) HeapAlloc(GetProcessHeap(),0,len+6);
#else
ret = (LPVOID) HeapAlloc(GetProcessHeap(),0,len);
#endif
#if MEM_DEBUG
*(LPWORD)(ret) = 0x8271;
*(LPWORD)(ret+2) = (WORD)len;
*(LPWORD)(ret+4+len) = 0x7384;
ret += 4;
memset(ret, 0xdf, len);
#endif
TRACE("%lu bytes at %p\n",len, ret);
return (LPVOID)ret;
}
/*************************************************************************
* SHRegisterDragDrop [SHELL32.86] * SHRegisterDragDrop [SHELL32.86]
* *
* NOTES * NOTES
......
...@@ -53,14 +53,14 @@ HRESULT WINAPI StrRetToStrNA (LPVOID dest, DWORD len, LPSTRRET src, const ITEMID ...@@ -53,14 +53,14 @@ HRESULT WINAPI StrRetToStrNA (LPVOID dest, DWORD len, LPSTRRET src, const ITEMID
{ {
case STRRET_WSTR: case STRRET_WSTR:
WideCharToMultiByte(CP_ACP, 0, src->u.pOleStr, -1, (LPSTR)dest, len, NULL, NULL); WideCharToMultiByte(CP_ACP, 0, src->u.pOleStr, -1, (LPSTR)dest, len, NULL, NULL);
/* SHFree(src->u.pOleStr); FIXME: is this right? */ CoTaskMemFree(src->u.pOleStr);
break; break;
case STRRET_CSTRA: case STRRET_CSTR:
lstrcpynA((LPSTR)dest, src->u.cStr, len); lstrcpynA((LPSTR)dest, src->u.cStr, len);
break; break;
case STRRET_OFFSETA: case STRRET_OFFSET:
lstrcpynA((LPSTR)dest, ((LPCSTR)&pidl->mkid)+src->u.uOffset, len); lstrcpynA((LPSTR)dest, ((LPCSTR)&pidl->mkid)+src->u.uOffset, len);
break; break;
...@@ -86,15 +86,15 @@ HRESULT WINAPI StrRetToStrNW (LPVOID dest1, DWORD len, LPSTRRET src, const ITEMI ...@@ -86,15 +86,15 @@ HRESULT WINAPI StrRetToStrNW (LPVOID dest1, DWORD len, LPSTRRET src, const ITEMI
{ {
case STRRET_WSTR: case STRRET_WSTR:
lstrcpynW((LPWSTR)dest, src->u.pOleStr, len); lstrcpynW((LPWSTR)dest, src->u.pOleStr, len);
/* SHFree(src->u.pOleStr); FIXME: is this right? */ CoTaskMemFree(src->u.pOleStr);
break; break;
case STRRET_CSTRA: case STRRET_CSTR:
if (!MultiByteToWideChar( CP_ACP, 0, src->u.cStr, -1, dest, len ) && len) if (!MultiByteToWideChar( CP_ACP, 0, src->u.cStr, -1, dest, len ) && len)
dest[len-1] = 0; dest[len-1] = 0;
break; break;
case STRRET_OFFSETA: case STRRET_OFFSET:
if (pidl) if (pidl)
{ {
if (!MultiByteToWideChar( CP_ACP, 0, ((LPCSTR)&pidl->mkid)+src->u.uOffset, -1, if (!MultiByteToWideChar( CP_ACP, 0, ((LPCSTR)&pidl->mkid)+src->u.uOffset, -1,
......
...@@ -858,6 +858,9 @@ HRESULT WINAPI SHCreateDefClassObject( ...@@ -858,6 +858,9 @@ HRESULT WINAPI SHCreateDefClassObject(
LPDWORD lpdwUsage, LPDWORD lpdwUsage,
REFIID riidObject); REFIID riidObject);
DWORD WINAPI SHCLSIDFromStringA (LPCSTR clsid, CLSID *id);
DWORD WINAPI SHCLSIDFromStringW (LPWSTR clsid, CLSID *id);
HRESULT WINAPI SHCoCreateInstance( HRESULT WINAPI SHCoCreateInstance(
LPCSTR lpszClsid, LPCSTR lpszClsid,
REFCLSID rClsid, REFCLSID rClsid,
......
...@@ -31,24 +31,15 @@ extern "C" { ...@@ -31,24 +31,15 @@ extern "C" {
* STRRET * STRRET
*/ */
#define STRRET_WSTR 0x0000 #define STRRET_WSTR 0x0000
#define STRRET_ASTR 0x0003 #define STRRET_OFFSET 0x0001
#define STRRET_CSTR 0x0002
#define STRRET_OFFSETA 0x0001
#define STRRET_OFFSETW 0x0004 typedef struct _STRRET {
#define STRRET_OFFSET WINELIB_NAME_AW(STRRET_OFFSET) UINT uType; /* STRRET_xxx */
union {
#define STRRET_CSTRA 0x0002 LPWSTR pOleStr; /* OLESTR that will be freed */
#define STRRET_CSTRW 0x0005 UINT uOffset; /* Offset into SHITEMID (ANSI) */
#define STRRET_CSTR WINELIB_NAME_AW(STRRET_CSTR) char cStr[MAX_PATH]; /* ANSI Buffer */
typedef struct _STRRET
{ UINT uType; /* STRRET_xxx */
union
{ LPWSTR pOleStr; /* OLESTR that will be freed */
LPSTR pStr;
UINT uOffset; /* OffsetINT32o SHITEMID (ANSI) */
char cStr[MAX_PATH]; /* Buffer to fill in */
WCHAR cStrW[MAX_PATH];
} DUMMYUNIONNAME; } DUMMYUNIONNAME;
} STRRET,*LPSTRRET; } STRRET,*LPSTRRET;
...@@ -62,6 +53,9 @@ typedef struct IPersistFolder IPersistFolder, *LPPERSISTFOLDER; ...@@ -62,6 +53,9 @@ typedef struct IPersistFolder IPersistFolder, *LPPERSISTFOLDER;
DEFINE_GUID(IID_IPersistFolder2, 0x1ac3d9f0L, 0x175C, 0x11D1, 0x95, 0xBE, 0x00, 0x60, 0x97, 0x97, 0xEA, 0x4F); DEFINE_GUID(IID_IPersistFolder2, 0x1ac3d9f0L, 0x175C, 0x11D1, 0x95, 0xBE, 0x00, 0x60, 0x97, 0x97, 0xEA, 0x4F);
typedef struct IPersistFolder2 IPersistFolder2, *LPPERSISTFOLDER2; typedef struct IPersistFolder2 IPersistFolder2, *LPPERSISTFOLDER2;
DEFINE_GUID(IID_IPersistFolder3, 0xcef04fdf, 0xfe72, 0x11d2, 0x87, 0xa5, 0x0, 0xc0, 0x4f, 0x68, 0x37, 0xcf);
typedef struct IPersistFolder3 IPersistFolder3, *LPPERSISTFOLDER3;
DEFINE_GUID(IID_IShellFolder2, 0xB82C5AA8, 0xA41B, 0x11D2, 0xBE, 0x32, 0x0, 0xc0, 0x4F, 0xB9, 0x36, 0x61); DEFINE_GUID(IID_IShellFolder2, 0xB82C5AA8, 0xA41B, 0x11D2, 0xBE, 0x32, 0x0, 0xc0, 0x4F, 0xB9, 0x36, 0x61);
typedef struct IShellFolder2 IShellFolder2, *LPSHELLFOLDER2; typedef struct IShellFolder2 IShellFolder2, *LPSHELLFOLDER2;
...@@ -317,11 +311,6 @@ ICOM_DEFINE(IShellFolder2, IShellFolder) ...@@ -317,11 +311,6 @@ ICOM_DEFINE(IShellFolder2, IShellFolder)
* IPersistFolder interface * IPersistFolder interface
*/ */
/* ClassID's */
DEFINE_GUID (CLSID_SFMyComp,0x20D04FE0,0x3AEA,0x1069,0xA2,0xD8,0x08,0x00,0x2B,0x30,0x30,0x9D);
DEFINE_GUID (CLSID_SFINet, 0x871C5380,0x42A0,0x1069,0xA2,0xEA,0x08,0x00,0x2B,0x30,0x30,0x9D);
DEFINE_GUID (CLSID_SFFile, 0xF3364BA0,0x65B9,0x11CE,0xA9,0xBA,0x00,0xAA,0x00,0x4A,0xE8,0x37);
#define ICOM_INTERFACE IPersistFolder #define ICOM_INTERFACE IPersistFolder
#define IPersistFolder_METHODS \ #define IPersistFolder_METHODS \
ICOM_METHOD1( HRESULT, Initialize, LPCITEMIDLIST, pidl) ICOM_METHOD1( HRESULT, Initialize, LPCITEMIDLIST, pidl)
...@@ -365,6 +354,46 @@ ICOM_DEFINE(IPersistFolder2, IPersistFolder) ...@@ -365,6 +354,46 @@ ICOM_DEFINE(IPersistFolder2, IPersistFolder)
/*** IPersistFolder2 methods ***/ /*** IPersistFolder2 methods ***/
#define IPersistFolder2_GetCurFolder(p,a) ICOM_CALL1(GetCurFolder,p,a) #define IPersistFolder2_GetCurFolder(p,a) ICOM_CALL1(GetCurFolder,p,a)
/*****************************************************************************
* IPersistFolder3 interface
*/
typedef struct {
LPITEMIDLIST pidlTargetFolder;
WCHAR szTargetParsingName[MAX_PATH];
WCHAR szNetworkProvider[MAX_PATH];
DWORD dwAttributes;
int csidl;
} PERSIST_FOLDER_TARGET_INFO;
#define ICOM_INTERFACE IPersistFolder3
#define IPersistFolder3_METHODS \
ICOM_METHOD3( HRESULT, InitializeEx, IBindCtx*, pbc, LPCITEMIDLIST, pidlRoot, const PERSIST_FOLDER_TARGET_INFO*, ppfti)\
ICOM_METHOD1( HRESULT, GetFolderTargetInfo, PERSIST_FOLDER_TARGET_INFO*, ppfti)
#define IPersistFolder3_IMETHODS \
IPersist_IMETHODS \
IPersistFolder_METHODS \
IPersistFolder2_METHODS \
IPersistFolder3_METHODS
ICOM_DEFINE(IPersistFolder3, IPersistFolder2)
#undef ICOM_INTERFACE
/*** IUnknown methods ***/
#define IPersistFolder3_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b)
#define IPersistFolder3_AddRef(p) ICOM_CALL (AddRef,p)
#define IPersistFolder3_Release(p) ICOM_CALL (Release,p)
/*** IPersist methods ***/
#define IPersistFolder3_GetClassID(p,a) ICOM_CALL1(GetClassID,p,a)
/*** IPersistFolder methods ***/
#define IPersistFolder3_Initialize(p,a) ICOM_CALL1(Initialize,p,a)
/*** IPersistFolder2 methods ***/
#define IPersistFolder3_GetCurFolder(p,a) ICOM_CALL1(GetCurFolder,p,a)
/*** IPersistFolder3 methods ***/
#define IPersistFolder3_InitializeEx(p,a,b,c) ICOM_CALL3(InitializeEx,p,a,b,c)
#define IPersistFolder3_GetFolderTargetInfo(p,a) ICOM_CALL1(InitializeEx,p,a)
#ifdef __cplusplus #ifdef __cplusplus
} /* extern "C" */ } /* extern "C" */
#endif /* defined(__cplusplus) */ #endif /* defined(__cplusplus) */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment