Sync to Wine-20050419: Francois Gouget fgouget@free.fr - Assorted spelling fixes. Mike McCormack mike@codeweavers.com - Remove an unused function. - Eliminate casts of the return value of HeapAlloc. - Convert path to unicode, rearrange to remove forward declaration. - Remove forward declarations of interface methods. - Remove some dead code and some ifdefs. - Use api definitions, remove duplicate code. - Fix usage of STGM_ enumerations, remove forward declaration. - Fix up PIDL dumping code. - Fix a regression in the file open dialog. Jon Griffiths jon_p_griffiths@yahoo.com - Use LMEM_ flags for LocalAlloc(), not GMEM_ (GlobalAlloc). Huw Davies huw@codeweavers.com - Fix the icon resource ids (most were off by one). - Fix IExtractIcon_{GetIconLocation,Extract} to use -ve icon resource ids and fix bugs relating to confusion between resource ids and the system imagelist indicies. - Extend the system imagelist initialization hack to load both +ve and -ve resource ids. - Add a printer icon (that'll be used by an upcoming printer folder patch). - When we're hiding file extensions then SetNameOf should append the original extension if SHGDN_FORPARSING isn't set. - The flags passed to SetNameOf refer to the dst string not the src pidl. - If ICommDlgBrowser_OnDefaultCommand returns anything other than S_OK then we should call the default handler. - Directory items should have the SFGOA_FILESYSANCESTOR attribute. Add a test for this and cleanup the shlfolder test a bit. - Better icon handling for some special folders. - Identify and add defines for a bunch of shell icons. - Add a unicode pidl type. - Improve support for PT_YAGUID. - Improve IShellLink debugging. Steven Edwards steven_ed4153@yahoo.com - Register Shell Drag and Drop Helper. Juan Lang juan_lang@yahoo.com - Use Unicode string result from GetDisplayNameOf if it isn't representable using ANSI. - Correct registering shell folders (values in Shell Folders key weren't getting written). Martin Fuchs martin-fuchs@gmx.net - switch to correct shell desktop context menu - launch desk.cpl when activating the desktop context menu entry "properties" - don't send WM_COMMAND if we didn't get a shell view window - Correct comments of some export ordinals. Peter Berg Larsen pebl@math.ku.dk - Replace strncpy with memcpy or lstrcpyn. Troy Rollo wine@troy.rollo.name - Fix SEGV for non-fully-qualified destination paths. - Don't fail ShFileOperationW if FOF_ALLOWUNDO is passed. Filip Navara xnavara@volny.cz - _dbg_ILGetNext returns NULL if pidl->mkid.cb is zero, fix the loops accordingly. Aric Stewart aric@codeweavers.com - For ShellExecuteExA we need to copy out the hProcess value from the W structure. Modified: trunk/reactos/include/wine/shlguid.h Modified: trunk/reactos/lib/shell32/Makefile.in Modified: trunk/reactos/lib/shell32/autocomplete.c Modified: trunk/reactos/lib/shell32/classes.c Modified: trunk/reactos/lib/shell32/cpanelfolder.c Modified: trunk/reactos/lib/shell32/dataobject.c Modified: trunk/reactos/lib/shell32/debughlp.c Modified: trunk/reactos/lib/shell32/dragdrophelper.c Modified: trunk/reactos/lib/shell32/enumidlist.c Modified: trunk/reactos/lib/shell32/folders.c Modified: trunk/reactos/lib/shell32/iconcache.c Modified: trunk/reactos/lib/shell32/memorystream.c Modified: trunk/reactos/lib/shell32/pidl.c Modified: trunk/reactos/lib/shell32/pidl.h Modified: trunk/reactos/lib/shell32/regsvr.c Modified: trunk/reactos/lib/shell32/shell.c Modified: trunk/reactos/lib/shell32/shell32_main.c Modified: trunk/reactos/lib/shell32/shell32_main.h Modified: trunk/reactos/lib/shell32/shellfolder.h Modified: trunk/reactos/lib/shell32/shelllink.c Modified: trunk/reactos/lib/shell32/shellole.c Modified: trunk/reactos/lib/shell32/shellord.c Modified: trunk/reactos/lib/shell32/shellpath.c Modified: trunk/reactos/lib/shell32/shfldr_desktop.c Modified: trunk/reactos/lib/shell32/shfldr_fs.c Modified: trunk/reactos/lib/shell32/shfldr_mycomp.c Modified: trunk/reactos/lib/shell32/shlexec.c Modified: trunk/reactos/lib/shell32/shlfileop.c Modified: trunk/reactos/lib/shell32/shlfolder.c Modified: trunk/reactos/lib/shell32/shlmenu.c Modified: trunk/reactos/lib/shell32/shlview.c Modified: trunk/reactos/lib/shell32/shres.rc Modified: trunk/reactos/lib/shell32/shresdef.h Modified: trunk/reactos/lib/shell32/shv_bg_cmenu.c Modified: trunk/reactos/lib/shell32/shv_item_cmenu.c Modified: trunk/reactos/lib/shell32/systray.c Modified: trunk/reactos/w32api/include/shlguid.h Modified: trunk/reactos/w32api/include/shlobj.h _____
Modified: trunk/reactos/include/wine/shlguid.h --- trunk/reactos/include/wine/shlguid.h 2005-05-05 21:07:02 UTC (rev 15023) +++ trunk/reactos/include/wine/shlguid.h 2005-05-05 22:16:20 UTC (rev 15024) @@ -44,6 +44,7 @@
DEFINE_GUID(CLSID_RecycleBin, 0x645FF040, 0x5081, 0x101B, 0x9F, 0x08, 0x00, 0xAA, 0x00, 0x2F, 0x95, 0x4E); DEFINE_GUID(CLSID_ControlPanel, 0x21EC2020, 0x3AEA, 0x1069, 0xA2, 0xDD, 0x08, 0x00, 0x2B, 0x30, 0x30, 0x9D); DEFINE_GUID(CLSID_Printers, 0x2227A280, 0x3AEA, 0x1069, 0xA2, 0xDE, 0x08, 0x00, 0x2B, 0x30, 0x30, 0x9D); +DEFINE_GUID(CLSID_MyDocuments, 0x450d8fba, 0xad25, 0x11d0, 0x98, 0xa8, 0x08, 0x00, 0x36, 0x1b, 0x11, 0x03);
DEFINE_GUID(IID_IQueryAssociations, 0xc46ca590, 0x3c3f, 0x11d2, 0xbe, 0xe6, 0x00, 0x00, 0xf8, 0x05, 0xca, 0x57);
_____
Modified: trunk/reactos/lib/shell32/Makefile.in --- trunk/reactos/lib/shell32/Makefile.in 2005-05-05 21:07:02 UTC (rev 15023) +++ trunk/reactos/lib/shell32/Makefile.in 2005-05-05 22:16:20 UTC (rev 15024) @@ -62,6 +62,7 @@
mycomputer.ico \ netdrive.ico \ netdrive2.ico \ + printer.ico \ ramdisk.ico
C_SRCS16 = shell.c _____
Modified: trunk/reactos/lib/shell32/autocomplete.c --- trunk/reactos/lib/shell32/autocomplete.c 2005-05-05 21:07:02 UTC (rev 15023) +++ trunk/reactos/lib/shell32/autocomplete.c 2005-05-05 22:16:20 UTC (rev 15024) @@ -83,7 +83,7 @@
#define _ICOM_THIS_From_IAutoComplete2(class, name) class* This = (class*)(((char*)name)-_IAutoComplete2_Offset);
/* - converts This to a interface pointer + converts This to an interface pointer */ #define _IUnknown_(This) (IUnknown*)&(This->lpVtbl) #define _IAutoComplete2_(This) (IAutoComplete2*)&(This->lpvtblAutoComplete2) @@ -101,8 +101,7 @@ if (pUnkOuter && !IsEqualIID (riid, &IID_IUnknown)) return CLASS_E_NOAGGREGATION;
- lpac = (IAutoCompleteImpl*)HeapAlloc(GetProcessHeap(), - HEAP_ZERO_MEMORY, sizeof(IAutoCompleteImpl)); + lpac = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IAutoCompleteImpl)); if (!lpac) return E_OUTOFMEMORY;
@@ -280,7 +279,7 @@ LONG len;
/* pwszRegKeyPath contains the key as well as the value, so we split */ - key = (WCHAR*)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, (lstrlenW(pwzsRegKeyPath)+1)*sizeof(WCHAR)); + key = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, (lstrlenW(pwzsRegKeyPath)+1)*sizeof(WCHAR)); strcpyW(key, pwzsRegKeyPath); value = strrchrW(key, '\'); *value = 0; @@ -294,7 +293,7 @@ if (res == ERROR_SUCCESS) { res = RegQueryValueW(hKey, value, result, &len); if (res == ERROR_SUCCESS) { - This->quickComplete = (WCHAR*)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len*sizeof(WCHAR)); + This->quickComplete = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len*sizeof(WCHAR)); strcpyW(This->quickComplete, result); } RegCloseKey(hKey); @@ -303,7 +302,7 @@ }
if ((pwszQuickComplete) && (!This->quickComplete)) { - This->quickComplete = (WCHAR*)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, (lstrlenW(pwszQuickComplete)+1)*sizeof(WCHAR)); + This->quickComplete = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, (lstrlenW(pwszQuickComplete)+1)*sizeof(WCHAR)); lstrcpyW(This->quickComplete, pwszQuickComplete); }
@@ -482,7 +481,7 @@ /* If quickComplete is set and control is pressed, replace the string */ control = GetKeyState(VK_CONTROL) & 0x8000; if (control && This->quickComplete) { - hwndQCText = (WCHAR*)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, + hwndQCText = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
(lstrlenW(This->quickComplete)+lstrlenW(hwndText))*sizeof(WCHAR)); sel = sprintfW(hwndQCText, This->quickComplete, hwndText); SendMessageW(hwnd, WM_SETTEXT, 0, (LPARAM)hwndQCText); @@ -525,7 +524,7 @@ int len; len = SendMessageW(This->hwndListBox, LB_GETTEXTLEN, sel, (LPARAM)NULL); - msg = (WCHAR*) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, (len+1)*sizeof(WCHAR)); + msg = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, (len+1)*sizeof(WCHAR)); SendMessageW(This->hwndListBox, LB_GETTEXT, sel, (LPARAM)msg); SendMessageW(hwnd, WM_SETTEXT, 0, (LPARAM)msg); SendMessageW(hwnd, EM_SETSEL, lstrlenW(msg), lstrlenW(msg)); @@ -562,7 +561,7 @@ SendMessageW(This->hwndListBox, LB_RESETCONTENT, 0, 0);
HeapFree(GetProcessHeap(), 0, This->txtbackup); - This->txtbackup = (WCHAR*) HeapAlloc(GetProcessHeap(), + This->txtbackup = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, (lstrlenW(hwndText)+1)*sizeof(WCHAR)); lstrcpyW(This->txtbackup, hwndText);
@@ -631,7 +630,7 @@ break; case WM_LBUTTONDOWN: len = SendMessageW(This->hwndListBox, LB_GETTEXTLEN, sel, (LPARAM)NULL); - msg = (WCHAR*) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, (len+1)*sizeof(WCHAR)); + msg = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, (len+1)*sizeof(WCHAR)); sel = (INT)SendMessageW(hwnd, LB_GETCURSEL, 0, 0); SendMessageW(hwnd, LB_GETTEXT, sel, (LPARAM)msg); SendMessageW(This->hwndEdit, WM_SETTEXT, 0, (LPARAM)msg); _____
Modified: trunk/reactos/lib/shell32/classes.c --- trunk/reactos/lib/shell32/classes.c 2005-05-05 21:07:02 UTC (rev 15023) +++ trunk/reactos/lib/shell32/classes.c 2005-05-05 22:16:20 UTC (rev 15024) @@ -223,7 +223,12 @@
ret = HCR_RegGetDefaultIconW(hkey, szDest, len, dwNr); RegCloseKey(hkey); } - TRACE("-- %s %li\n", debugstr_w(szDest), *dwNr ); + + if(ret) + TRACE("-- %s %li\n", debugstr_w(szDest), *dwNr ); + else + TRACE("-- not found\n"); + return ret; }
_____
Modified: trunk/reactos/lib/shell32/cpanelfolder.c --- trunk/reactos/lib/shell32/cpanelfolder.c 2005-05-05 21:07:02 UTC (rev 15023) +++ trunk/reactos/lib/shell32/cpanelfolder.c 2005-05-05 22:16:20 UTC (rev 15024) @@ -87,7 +87,7 @@
/* - converts This to a interface pointer + converts This to an interface pointer */ #define _IUnknown_(This) (IUnknown*)&(This->lpVtbl) #define _IShellFolder_(This) (IShellFolder*)&(This->lpVtbl) @@ -124,7 +124,7 @@ if (pUnkOuter && !IsEqualIID (riid, &IID_IUnknown)) return CLASS_E_NOAGGREGATION;
- sf = (ICPanelImpl *) LocalAlloc(GMEM_ZEROINIT, sizeof(ICPanelImpl)); + sf = (ICPanelImpl *) LocalAlloc(LMEM_ZEROINIT, sizeof(ICPanelImpl)); if (!sf) return E_OUTOFMEMORY;
@@ -904,26 +904,14 @@ ICPanel_PersistFolder2_GetCurFolder };
-HRESULT WINAPI CPanel_GetIconLocationA(LPITEMIDLIST pidl, LPSTR szIconFile, UINT cchMax, int* piIndex) +HRESULT CPanel_GetIconLocationW(LPITEMIDLIST pidl, + LPWSTR szIconFile, UINT cchMax, int* piIndex) { PIDLCPanelStruct* pcpanel = _ILGetCPanelPointer(pidl);
if (!pcpanel) return E_INVALIDARG;
- lstrcpyA(szIconFile, pcpanel->szName); - *piIndex = pcpanel->iconIdx!=-1? pcpanel->iconIdx: 0; - - return S_OK; -} - -HRESULT WINAPI CPanel_GetIconLocationW(LPITEMIDLIST pidl, LPWSTR szIconFile, UINT cchMax, int* piIndex) -{ - PIDLCPanelStruct* pcpanel = _ILGetCPanelPointer(pidl); - - if (!pcpanel) - return E_INVALIDARG; - MultiByteToWideChar(CP_ACP, 0, pcpanel->szName, -1, szIconFile, cchMax); *piIndex = pcpanel->iconIdx!=-1? pcpanel->iconIdx: 0;
@@ -935,7 +923,8 @@ * IShellExecuteHookW Implementation */
-static HRESULT WINAPI IShellExecuteHookW_fnQueryInterface(IShellExecuteHookW* iface, REFIID riid, void** ppvObject) +static HRESULT WINAPI IShellExecuteHookW_fnQueryInterface( + IShellExecuteHookW* iface, REFIID riid, void** ppvObject) { _ICOM_THIS_From_IShellExecuteHookW(ICPanelImpl, iface);
@@ -1087,10 +1076,8 @@
static IShellExecuteHookAVtbl vt_ShellExecuteHookA = { - IShellExecuteHookA_fnQueryInterface, IShellExecuteHookA_fnAddRef, IShellExecuteHookA_fnRelease, - IShellExecuteHookA_fnExecute }; _____
Modified: trunk/reactos/lib/shell32/dataobject.c --- trunk/reactos/lib/shell32/dataobject.c 2005-05-05 21:07:02 UTC (rev 15023) +++ trunk/reactos/lib/shell32/dataobject.c 2005-05-05 22:16:20 UTC (rev 15024) @@ -50,52 +50,9 @@
LPFORMATETC pFmt; } IEnumFORMATETCImpl;
-static HRESULT WINAPI IEnumFORMATETC_fnQueryInterface(LPENUMFORMATETC iface, REFIID riid, LPVOID* ppvObj); -static ULONG WINAPI IEnumFORMATETC_fnAddRef(LPENUMFORMATETC iface); -static ULONG WINAPI IEnumFORMATETC_fnRelease(LPENUMFORMATETC iface); -static HRESULT WINAPI IEnumFORMATETC_fnNext(LPENUMFORMATETC iface, ULONG celt, FORMATETC* rgelt, ULONG* pceltFethed); -static HRESULT WINAPI IEnumFORMATETC_fnSkip(LPENUMFORMATETC iface, ULONG celt); -static HRESULT WINAPI IEnumFORMATETC_fnReset(LPENUMFORMATETC iface); -static HRESULT WINAPI IEnumFORMATETC_fnClone(LPENUMFORMATETC iface, LPENUMFORMATETC* ppenum); - -static struct IEnumFORMATETCVtbl efvt = +static HRESULT WINAPI IEnumFORMATETC_fnQueryInterface( + LPENUMFORMATETC iface, REFIID riid, LPVOID* ppvObj) { - IEnumFORMATETC_fnQueryInterface, - IEnumFORMATETC_fnAddRef, - IEnumFORMATETC_fnRelease, - IEnumFORMATETC_fnNext, - IEnumFORMATETC_fnSkip, - IEnumFORMATETC_fnReset, - IEnumFORMATETC_fnClone -}; - -LPENUMFORMATETC IEnumFORMATETC_Constructor(UINT cfmt, const FORMATETC afmt[]) -{ - IEnumFORMATETCImpl* ef; - DWORD size=cfmt * sizeof(FORMATETC); - - ef=(IEnumFORMATETCImpl*)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IEnumFORMATETCImpl)); - - if(ef) - { - ef->ref=1; - ef->lpVtbl=&efvt; - - ef->countFmt = cfmt; - ef->pFmt = SHAlloc (size); - - if (ef->pFmt) - { - memcpy(ef->pFmt, afmt, size); - } - } - - TRACE("(%p)->(%u,%p)\n",ef, cfmt, afmt); - return (LPENUMFORMATETC)ef; -} - -static HRESULT WINAPI IEnumFORMATETC_fnQueryInterface(LPENUMFORMATETC iface, REFIID riid, LPVOID* ppvObj) -{ IEnumFORMATETCImpl *This = (IEnumFORMATETCImpl *)iface;
TRACE("(%p)->(\n\tIID:\t%s,%p)\n",This,debugstr_guid(riid),ppvObj);
@@ -118,7 +75,6 @@ } TRACE("-- Interface: E_NOINTERFACE\n"); return E_NOINTERFACE; - }
static ULONG WINAPI IEnumFORMATETC_fnAddRef(LPENUMFORMATETC iface) @@ -203,7 +159,41 @@ return S_OK; }
+static struct IEnumFORMATETCVtbl efvt = +{ + IEnumFORMATETC_fnQueryInterface, + IEnumFORMATETC_fnAddRef, + IEnumFORMATETC_fnRelease, + IEnumFORMATETC_fnNext, + IEnumFORMATETC_fnSkip, + IEnumFORMATETC_fnReset, + IEnumFORMATETC_fnClone +};
+LPENUMFORMATETC IEnumFORMATETC_Constructor(UINT cfmt, const FORMATETC afmt[]) +{ + IEnumFORMATETCImpl* ef; + DWORD size=cfmt * sizeof(FORMATETC); + + ef = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IEnumFORMATETCImpl)); + + if(ef) + { + ef->ref=1; + ef->lpVtbl=&efvt; + + ef->countFmt = cfmt; + ef->pFmt = SHAlloc (size); + + if (ef->pFmt) + memcpy(ef->pFmt, afmt, size); + } + + TRACE("(%p)->(%u,%p)\n",ef, cfmt, afmt); + return (LPENUMFORMATETC)ef; +} + +
/*********************************************************************** * IDataObject implementation */ @@ -229,38 +219,6 @@
} IDataObjectImpl;
-static struct IDataObjectVtbl dtovt; - -/********************************************************************** **** -* IDataObject_Constructor -*/ -LPDATAOBJECT IDataObject_Constructor(HWND hwndOwner, LPCITEMIDLIST pMyPidl, LPCITEMIDLIST * apidl, UINT cidl) -{ - IDataObjectImpl* dto; - - dto = (IDataObjectImpl*)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDataObjectImpl)); - - if (dto) - { - dto->ref = 1; - dto->lpVtbl = &dtovt; - dto->pidl = ILClone(pMyPidl); - dto->apidl = _ILCopyaPidl(apidl, cidl); - dto->cidl = cidl; - - dto->cfShellIDList = RegisterClipboardFormatA(CFSTR_SHELLIDLIST); - dto->cfFileNameA = RegisterClipboardFormatA(CFSTR_FILENAMEA); - dto->cfFileNameW = RegisterClipboardFormatA(CFSTR_FILENAMEW); - InitFormatEtc(dto->pFormatEtc[0], dto->cfShellIDList, TYMED_HGLOBAL); - InitFormatEtc(dto->pFormatEtc[1], CF_HDROP, TYMED_HGLOBAL); - InitFormatEtc(dto->pFormatEtc[2], dto->cfFileNameA, TYMED_HGLOBAL); - InitFormatEtc(dto->pFormatEtc[3], dto->cfFileNameW, TYMED_HGLOBAL); - } - - TRACE("(%p)->(apidl=%p cidl=%u)\n",dto, apidl, cidl); - return (LPDATAOBJECT)dto; -} -
/*********************************************************************** **** * IDataObject_QueryInterface */ @@ -465,3 +423,34 @@ IDataObject_fnDUnadvise, IDataObject_fnEnumDAdvise }; + +/********************************************************************** **** +* IDataObject_Constructor +*/ +LPDATAOBJECT IDataObject_Constructor(HWND hwndOwner, + LPCITEMIDLIST pMyPidl, LPCITEMIDLIST * apidl, UINT cidl) +{ + IDataObjectImpl* dto; + + dto = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDataObjectImpl)); + + if (dto) + { + dto->ref = 1; + dto->lpVtbl = &dtovt; + dto->pidl = ILClone(pMyPidl); + dto->apidl = _ILCopyaPidl(apidl, cidl); + dto->cidl = cidl; + + dto->cfShellIDList = RegisterClipboardFormatA(CFSTR_SHELLIDLIST); + dto->cfFileNameA = RegisterClipboardFormatA(CFSTR_FILENAMEA); + dto->cfFileNameW = RegisterClipboardFormatA(CFSTR_FILENAMEW); + InitFormatEtc(dto->pFormatEtc[0], dto->cfShellIDList, TYMED_HGLOBAL); + InitFormatEtc(dto->pFormatEtc[1], CF_HDROP, TYMED_HGLOBAL); + InitFormatEtc(dto->pFormatEtc[2], dto->cfFileNameA, TYMED_HGLOBAL); + InitFormatEtc(dto->pFormatEtc[3], dto->cfFileNameW, TYMED_HGLOBAL); + } + + TRACE("(%p)->(apidl=%p cidl=%u)\n",dto, apidl, cidl); + return (LPDATAOBJECT)dto; +} _____
Modified: trunk/reactos/lib/shell32/debughlp.c --- trunk/reactos/lib/shell32/debughlp.c 2005-05-05 21:07:02 UTC (rev 15023) +++ trunk/reactos/lib/shell32/debughlp.c 2005-05-05 22:16:20 UTC (rev 15024) @@ -136,6 +136,7 @@
{ case PT_SHELLEXT: case PT_GUID: + case PT_YAGUID: return &(pdata->u.guid.guid); } } @@ -158,13 +159,13 @@ if (_dbg_ILIsDesktop(pidl)) { /* desktop */ - if (szOut) strncpy(szOut, "Desktop", uOutSize); + if (szOut) lstrcpynA(szOut, "Desktop", uOutSize); dwReturn = strlen ("Desktop"); } else if (( szSrc = _dbg_ILGetTextPointer(pidl) )) { /* filesystem */ - if (szOut) strncpy(szOut, szSrc, uOutSize); + if (szOut) lstrcpynA(szOut, szSrc, uOutSize); dwReturn = strlen(szSrc); } else if (( riid = _dbg_ILGetGUIDPointer(pidl) )) @@ -215,7 +216,7 @@
pidltemp = _dbg_ILGetNext(pidltemp);
- } while (pidltemp->mkid.cb); + } while (pidltemp && pidltemp->mkid.cb); } else { @@ -224,60 +225,69 @@ pcheck(pidl); } } -#define BYTES_PRINTED 32 -BOOL pcheck (LPCITEMIDLIST pidl) + +static void dump_pidl_hex( LPCITEMIDLIST pidl ) { - DWORD type, ret=TRUE; - LPCITEMIDLIST pidltemp = pidl; + const unsigned char *p = (const unsigned char *)pidl; + const int max_bytes = 0x80, max_line = 0x10; + char szHex[max_line*3+1], szAscii[max_line+1]; + int i, n;
- if (pidltemp && pidltemp->mkid.cb) - { do - { type = _dbg_ILGetDataPointer(pidltemp)->type; - switch (type) - { case PT_CPLAPPLET: - case PT_GUID: - case PT_SHELLEXT: - case PT_DRIVE: - case PT_DRIVE1: - case PT_DRIVE2: - case PT_DRIVE3: - case PT_FOLDER: - case PT_VALUE: - case PT_FOLDER1: - case PT_WORKGRP: - case PT_COMP: - case PT_NETPROVIDER: - case PT_NETWORK: - case PT_IESPECIAL1: - case PT_YAGUID: - case PT_IESPECIAL2: - case PT_SHARE: - break; - default: - { - char szTemp[BYTES_PRINTED*4 + 1]; - int i; - unsigned char c; + n = pidl->mkid.cb; + if( n>max_bytes ) + n = max_bytes; + for( i=0; i<n; i++ ) + { + sprintf( &szHex[ (i%max_line)*3 ], "%02X ", p[i] ); + szAscii[ (i%max_line) ] = isprint( p[i] ) ? p[i] : '.';
- memset(szTemp, ' ', BYTES_PRINTED*4 + 1); - for ( i = 0; (i<pidltemp->mkid.cb) && (i<BYTES_PRINTED); i++) - { - c = ((const unsigned char *)pidltemp)[i]; + /* print out at the end of each line and when we're finished */ + if( i!=(n-1) && (i%max_line) != (max_line-1) ) + continue; + szAscii[ (i%max_line)+1 ] = 0; + DPRINTF("%-*s %s\n", max_line*3, szHex, szAscii ); + } +}
- szTemp[i*3+0] = ((c>>4)>9)? (c>>4)+55 : (c>>4)+48; - szTemp[i*3+1] = ((0x0F&c)>9)? (0x0F&c)+55 : (0x0F&c)+48; - szTemp[i*3+2] = ' '; - szTemp[i+BYTES_PRINTED*3] = (c>=0x20 && c <=0x80) ? c : '.'; - } - szTemp[BYTES_PRINTED*4] = 0x00; - ERR("unknown IDLIST %p [%p] size=%u type=%lx\n%s\n",pidl, pidltemp, pidltemp->mkid.cb,type, szTemp); - ret = FALSE; - } - } - pidltemp = _dbg_ILGetNext(pidltemp); - } while (pidltemp->mkid.cb); - } - return ret; +BOOL pcheck( LPCITEMIDLIST pidl ) +{ + DWORD type; + LPCITEMIDLIST pidltemp = pidl; + + while( pidltemp && pidltemp->mkid.cb ) + { + type = _dbg_ILGetDataPointer(pidltemp)->type; + switch( type ) + { + case PT_CPLAPPLET: + case PT_GUID: + case PT_SHELLEXT: + case PT_DRIVE: + case PT_DRIVE1: + case PT_DRIVE2: + case PT_DRIVE3: + case PT_FOLDER: + case PT_VALUE: + case PT_VALUEW: + case PT_FOLDER1: + case PT_WORKGRP: + case PT_COMP: + case PT_NETPROVIDER: + case PT_NETWORK: + case PT_IESPECIAL1: + case PT_YAGUID: + case PT_IESPECIAL2: + case PT_SHARE: + break; + default: + ERR("unknown IDLIST %p [%p] size=%u type=%lx\n", + pidl, pidltemp, pidltemp->mkid.cb,type ); + dump_pidl_hex( pidltemp ); + return FALSE; + } + pidltemp = _dbg_ILGetNext(pidltemp); + } + return TRUE; }
static char shdebugstr_buf1[100]; @@ -308,6 +318,8 @@ {&IID_IDataObject, "IID_IDataObject"}, {&IID_IAutoComplete, "IID_IAutoComplete"}, {&IID_IAutoComplete2, "IID_IAutoComplete2"}, + {&IID_IShellLinkA, "IID_IShellLinkA"}, + {&IID_IShellLinkW, "IID_IShellLinkW"}, {NULL,NULL}};
const char * shdebugstr_guid( const struct _GUID *id ) _____
Modified: trunk/reactos/lib/shell32/dragdrophelper.c --- trunk/reactos/lib/shell32/dragdrophelper.c 2005-05-05 21:07:02 UTC (rev 15023) +++ trunk/reactos/lib/shell32/dragdrophelper.c 2005-05-05 22:16:20 UTC (rev 15024) @@ -71,7 +71,7 @@
if (pUnkOuter) return CLASS_E_NOAGGREGATION;
- dth = (IDropTargetHelperImpl *) LocalAlloc (GMEM_ZEROINIT, sizeof (IDropTargetHelperImpl)); + dth = (IDropTargetHelperImpl *) LocalAlloc (LMEM_ZEROINIT, sizeof (IDropTargetHelperImpl)); if (!dth) return E_OUTOFMEMORY;
dth->ref = 0; _____
Modified: trunk/reactos/lib/shell32/enumidlist.c --- trunk/reactos/lib/shell32/enumidlist.c 2005-05-05 21:07:02 UTC (rev 15023) +++ trunk/reactos/lib/shell32/enumidlist.c 2005-05-05 22:16:20 UTC (rev 15024) @@ -193,7 +193,7 @@
IEnumIDList * IEnumIDList_Constructor(void) { - IEnumIDListImpl *lpeidl = (IEnumIDListImpl*)HeapAlloc(GetProcessHeap(), + IEnumIDListImpl *lpeidl = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IEnumIDListImpl));
if (lpeidl) _____
Modified: trunk/reactos/lib/shell32/folders.c --- trunk/reactos/lib/shell32/folders.c 2005-05-05 21:07:02 UTC (rev 15023) +++ trunk/reactos/lib/shell32/folders.c 2005-05-05 22:16:20 UTC (rev 15024) @@ -40,6 +40,7 @@
#include "pidl.h" #include "shell32_main.h" #include "shfldr.h" +#include "shresdef.h"
WINE_DEFAULT_DEBUG_CHANNEL(shell);
@@ -74,7 +75,7 @@ TRACE("%p\n", pidl);
- ei = (IExtractIconWImpl*)HeapAlloc(GetProcessHeap(),0,sizeof(IExtractIconWImp l)); + ei = HeapAlloc(GetProcessHeap(),0,sizeof(IExtractIconWImpl)); ei->ref=1; ei->lpVtbl = &eivt; ei->lpvtblPersistFile = &pfvt; @@ -196,9 +197,9 @@ if (!HCR_GetDefaultIconW(folder, szIconFile, cchMax, &dwNr)) { lstrcpynW(szIconFile, swShell32Name, cchMax); - dwNr = 3; + dwNr = IDI_SHELL_FOLDER; } - *piIndex = (uFlags & GIL_OPENICON) ? dwNr + 1 : dwNr; + *piIndex = -((uFlags & GIL_OPENICON) ? dwNr + 1 : dwNr); } return S_OK; } @@ -233,7 +234,7 @@ if (_ILIsDesktop(pSimplePidl)) { lstrcpynW(szIconFile, swShell32Name, cchMax); - *piIndex = 34; + *piIndex = -IDI_SHELL_DESKTOP; }
/* my computer and other shell extensions */ @@ -257,7 +258,14 @@ else { lstrcpynW(szIconFile, swShell32Name, cchMax); - *piIndex = 15; + if(IsEqualGUID(riid, &CLSID_MyComputer)) + *piIndex = -IDI_SHELL_MY_COMPUTER; + else if(IsEqualGUID(riid, &CLSID_MyDocuments)) + *piIndex = -IDI_SHELL_FOLDER; + else if(IsEqualGUID(riid, &CLSID_NetworkPlaces)) + *piIndex = -IDI_SHELL_MY_NETWORK_PLACES; + else + *piIndex = -IDI_SHELL_FOLDER; } }
@@ -271,17 +279,17 @@ { switch(GetDriveTypeA(sTemp)) { - case DRIVE_REMOVABLE: icon_idx = 5; break; - case DRIVE_CDROM: icon_idx = 11; break; - case DRIVE_REMOTE: icon_idx = 9; break; - case DRIVE_RAMDISK: icon_idx = 12; break; + case DRIVE_REMOVABLE: icon_idx = IDI_SHELL_FLOPPY; break; + case DRIVE_CDROM: icon_idx = IDI_SHELL_CDROM; break; + case DRIVE_REMOTE: icon_idx = IDI_SHELL_NETDRIVE; break; + case DRIVE_RAMDISK: icon_idx = IDI_SHELL_RAMDISK; break; } }
if (icon_idx != -1) { lstrcpynW(szIconFile, swShell32Name, cchMax); - *piIndex = icon_idx; + *piIndex = -icon_idx; } else { @@ -292,14 +300,14 @@ else { lstrcpynW(szIconFile, swShell32Name, cchMax); - *piIndex = 8; + *piIndex = -IDI_SHELL_DRIVE; } } } else if (_ILIsFolder (pSimplePidl)) { - getIconLocationForFolder(iface, uFlags, szIconFile, cchMax, piIndex, - pwFlags); + getIconLocationForFolder(iface, uFlags, szIconFile, cchMax, piIndex, + pwFlags); } else { @@ -370,14 +378,18 @@ static HRESULT WINAPI IExtractIconW_fnExtract(IExtractIconW * iface, LPCWSTR pszFile, UINT nIconIndex, HICON *phiconLarge, HICON *phiconSmall, UINT nIconSize) { IExtractIconWImpl *This = (IExtractIconWImpl *)iface; + int index;
- FIXME("(%p) (file=%p index=%u %p %p size=%u) semi-stub\n", This, debugstr_w(pszFile), nIconIndex, phiconLarge, phiconSmall, nIconSize); + FIXME("(%p) (file=%p index=%d %p %p size=%08x) semi-stub\n", This, debugstr_w(pszFile), (signed)nIconIndex, + phiconLarge, phiconSmall, nIconSize);
+ index = SIC_GetIconIndex(pszFile, nIconIndex); + if (phiconLarge) - *phiconLarge = ImageList_GetIcon(ShellBigIconList, nIconIndex, ILD_TRANSPARENT); + *phiconLarge = ImageList_GetIcon(ShellBigIconList, index, ILD_TRANSPARENT);
if (phiconSmall) - *phiconSmall = ImageList_GetIcon(ShellSmallIconList, nIconIndex, ILD_TRANSPARENT); + *phiconSmall = ImageList_GetIcon(ShellSmallIconList, index, ILD_TRANSPARENT);
return S_OK; } _____
Modified: trunk/reactos/lib/shell32/iconcache.c --- trunk/reactos/lib/shell32/iconcache.c 2005-05-05 21:07:02 UTC (rev 15023) +++ trunk/reactos/lib/shell32/iconcache.c 2005-05-05 22:16:20 UTC (rev 15024) @@ -257,7 +257,8 @@
hSm = LoadImageA(shell32_hInstance, MAKEINTRESOURCEA(1), IMAGE_ICON, cx_small, cy_small, LR_SHARED); hLg = LoadImageA(shell32_hInstance, MAKEINTRESOURCEA(1), IMAGE_ICON, cx_large, cy_large, LR_SHARED); } - SIC_IconAppend (swShell32Name, index, hSm, hLg); + SIC_IconAppend (swShell32Name, index - 1, hSm, hLg); + SIC_IconAppend (swShell32Name, -index, hSm, hLg); }
TRACE("hIconSmall=%p hIconBig=%p\n",ShellSmallIconList, ShellBigIconList); _____
Modified: trunk/reactos/lib/shell32/memorystream.c --- trunk/reactos/lib/shell32/memorystream.c 2005-05-05 21:07:02 UTC (rev 15023) +++ trunk/reactos/lib/shell32/memorystream.c 2005-05-05 22:16:20 UTC (rev 15024) @@ -1,12 +1,12 @@
/* - * this class implements a pure IStream object - * and can be used for many purposes + * This class implements a pure IStream object + * and can be used for many purposes. * - * the main reason for implementing this was + * The main reason for implementing this was * a cleaner implementation of IShellLink which - * needs to be able to load lnk's from a IStream + * needs to be able to load lnks from an IStream * interface so it was obvious to capsule the file - * access in a IStream to. + * access in an IStream to. * * Copyright 1999 Juergen Schmied * Copyright 2003 Mike McCormack for CodeWeavers @@ -42,59 +42,18 @@
WINE_DEFAULT_DEBUG_CHANNEL(shell);
-static const IStreamVtbl stvt; +#define STGM_ACCESS_MODE(stgm) ((stgm)&0x0000f) +#define STGM_SHARE_MODE(stgm) ((stgm)&0x000f0) +#define STGM_CREATE_MODE(stgm) ((stgm)&0x0f000)
typedef struct { const IStreamVtbl *lpvtst; - DWORD ref; - HANDLE handle; + DWORD ref; + HANDLE handle; } ISHFileStream;
/*********************************************************************** *** - * CreateStreamOnFile() - * - * similar to CreateStreamOnHGlobal - */ -HRESULT CreateStreamOnFile (LPCWSTR pszFilename, DWORD grfMode, IStream ** ppstm) -{ - ISHFileStream* fstr; - HANDLE handle; - DWORD access = GENERIC_READ, creat; - - if( grfMode & STGM_TRANSACTED ) - return E_INVALIDARG; - - if( grfMode & STGM_WRITE ) - access |= GENERIC_WRITE; - if( grfMode & STGM_READWRITE ) - access = GENERIC_WRITE | GENERIC_READ; - - if( grfMode & STGM_CREATE ) - creat = CREATE_ALWAYS; - else - creat = OPEN_EXISTING; - - TRACE("Opening %s\n", debugstr_w(pszFilename) ); - - handle = CreateFileW( pszFilename, access, FILE_SHARE_READ, NULL, creat, 0, NULL ); - if( handle == INVALID_HANDLE_VALUE ) - return HRESULT_FROM_WIN32(GetLastError()); - - fstr = (ISHFileStream*)HeapAlloc(GetProcessHeap(), - HEAP_ZERO_MEMORY,sizeof(ISHFileStream)); - if( !fstr ) - return E_OUTOFMEMORY; - fstr->lpvtst=&stvt; - fstr->ref = 1; - fstr->handle = handle; - - (*ppstm) = (IStream*)fstr; - - return S_OK; -} - -/********************************************************************** **** * IStream_fnQueryInterface */ static HRESULT WINAPI IStream_fnQueryInterface(IStream *iface, REFIID riid, LPVOID *ppvObj) @@ -105,17 +64,14 @@
*ppvObj = NULL;
- if(IsEqualIID(riid, &IID_IUnknown) || - IsEqualIID(riid, &IID_IStream)) - { - *ppvObj = This; - } + if(IsEqualIID(riid, &IID_IUnknown) || IsEqualIID(riid, &IID_IStream)) + *ppvObj = This;
if(*ppvObj) { - IStream_AddRef((IStream*)*ppvObj); - TRACE("-- Interface: (%p)->(%p)\n",ppvObj,*ppvObj); - return S_OK; + IStream_AddRef((IStream*)*ppvObj); + TRACE("-- Interface: (%p)->(%p)\n",ppvObj,*ppvObj); + return S_OK; } TRACE("-- Interface: E_NOINTERFACE\n"); return E_NOINTERFACE; @@ -294,5 +250,60 @@ IStream_fnUnlockRegion, IStream_fnStat, IStream_fnClone +};
-}; +/********************************************************************** **** + * CreateStreamOnFile() + * + * similar to CreateStreamOnHGlobal + */ +HRESULT CreateStreamOnFile (LPCWSTR pszFilename, DWORD grfMode, IStream ** ppstm) +{ + ISHFileStream* fstr; + HANDLE handle; + DWORD access = GENERIC_READ, creat; + + if( grfMode & STGM_TRANSACTED ) + return E_INVALIDARG; + + switch( STGM_ACCESS_MODE( grfMode ) ) + { + case STGM_READ: + access = GENERIC_READ; + break; + case STGM_WRITE: + case STGM_READWRITE: + access = GENERIC_WRITE | GENERIC_READ; + break; + default: + return STG_E_INVALIDFLAG; + } + + switch( STGM_CREATE_MODE( grfMode ) ) + { + case STGM_CREATE: + creat = CREATE_ALWAYS; + break; + case STGM_FAILIFTHERE: + creat = OPEN_EXISTING; + break; + default: + return STG_E_INVALIDFLAG; + } + + handle = CreateFileW( pszFilename, access, + FILE_SHARE_READ, NULL, creat, 0, NULL ); + if( handle == INVALID_HANDLE_VALUE ) + return HRESULT_FROM_WIN32(GetLastError()); + + fstr = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(ISHFileStream)); + if( !fstr ) + return E_OUTOFMEMORY; + fstr->lpvtst = &stvt; + fstr->ref = 1; + fstr->handle = handle; + + (*ppstm) = (IStream*)fstr; + + return S_OK; +} _____
Modified: trunk/reactos/lib/shell32/pidl.c --- trunk/reactos/lib/shell32/pidl.c 2005-05-05 21:07:02 UTC (rev 15023) +++ trunk/reactos/lib/shell32/pidl.c 2005-05-05 22:16:20 UTC (rev 15024) @@ -1226,7 +1226,7 @@
if (SUCCEEDED(hr)) PathAddBackslashA(pszPath); } - /* The only other valid case is a item ID list beginning at "My Computer" */ + /* The only other valid case is an item ID list beginning at "My Computer" */ else if (_ILIsMyComputer(pidl)) pidl = ILGetNext(pidl);
@@ -1338,7 +1338,7 @@ if (SUCCEEDED(hr)) PathAddBackslashW(pszPath); } - /* The only other valid case is a item ID list beginning at "My Computer" */ + /* The only other valid case is an item ID list beginning at "My Computer" */ else if (_ILIsMyComputer(pidl)) pidl = ILGetNext(pidl);
@@ -1825,7 +1825,7 @@
TRACE("(%p)\n",pidl);
- return (pidl && ( (lpPData && (PT_GUID== lpPData->type || PT_SHELLEXT== lpPData->type)) || + return (pidl && ( (lpPData && (PT_GUID== lpPData->type || PT_SHELLEXT== lpPData->type || PT_YAGUID == lpPData->type)) || (pidl && pidl->mkid.cb == 0x00) )); } @@ -2081,6 +2081,7 @@ { case PT_SHELLEXT: case PT_GUID: + case PT_YAGUID: return &(pdata->u.guid.guid);
default: _____
Modified: trunk/reactos/lib/shell32/pidl.h --- trunk/reactos/lib/shell32/pidl.h 2005-05-05 21:07:02 UTC (rev 15023) +++ trunk/reactos/lib/shell32/pidl.h 2005-05-05 22:16:20 UTC (rev 15024) @@ -97,6 +97,7 @@
#define PT_FOLDER1 0x30 #define PT_FOLDER 0x31 #define PT_VALUE 0x32 +#define PT_VALUEW 0x34 #define PT_WORKGRP 0x41 #define PT_COMP 0x42 #define PT_NETPROVIDER 0x46 @@ -142,6 +143,11 @@ The second the dos name when needed or just 0x00 */ } FileStruct;
+typedef struct tagValueW +{ + WCHAR name[1]; +} ValueWStruct; + typedef struct tagPIDLDATA { PIDLTYPE type; /*00*/ union @@ -159,6 +165,7 @@ CHAR szName[1]; /*06*/ /* terminated by 0x00 0x00 */ } htmlhelp; struct tagPIDLCPanelStruct cpanel; + struct tagValueW valueW; }u; } PIDLDATA, *LPPIDLDATA; #include "poppack.h" _____
Modified: trunk/reactos/lib/shell32/regsvr.c --- trunk/reactos/lib/shell32/regsvr.c 2005-05-05 21:07:02 UTC (rev 15023) +++ trunk/reactos/lib/shell32/regsvr.c 2005-05-05 22:16:20 UTC (rev 15024) @@ -477,6 +477,12 @@
"shell32.dll", "Apartment" }, + { &CLSID_DragDropHelper, + "Shell Drag and Drop Helper", + NULL, + "shell32.dll", + "Apartment" + }, { &CLSID_MyComputer, "My Computer", NULL, _____
Modified: trunk/reactos/lib/shell32/shell.c --- trunk/reactos/lib/shell32/shell.c 2005-05-05 21:07:02 UTC (rev 15023) +++ trunk/reactos/lib/shell32/shell.c 2005-05-05 22:16:20 UTC (rev 15024) @@ -287,11 +287,11 @@
int i;
if (phiconLarge) - ilarge = (HICON*)HeapAlloc(GetProcessHeap(),0,nIcons*sizeof(HICON)); + ilarge = HeapAlloc(GetProcessHeap(),0,nIcons*sizeof(HICON)); else ilarge = NULL; if (phiconSmall) - ismall = (HICON*)HeapAlloc(GetProcessHeap(),0,nIcons*sizeof(HICON)); + ismall = HeapAlloc(GetProcessHeap(),0,nIcons*sizeof(HICON)); else ismall = NULL; ret = HICON_16(ExtractIconExA(lpszFile,nIconIndex,ilarge,ismall,nIcons)); @@ -368,7 +368,7 @@ DWORD WINAPI DoEnvironmentSubst16(LPSTR str,WORD length) { LPSTR lpEnv = MapSL(GetDOSEnvironment16()); - LPSTR lpBuffer = (LPSTR)HeapAlloc( GetProcessHeap(), 0, length); + LPSTR lpBuffer = HeapAlloc( GetProcessHeap(), 0, length); LPSTR lpstr = str; LPSTR lpbstr = lpBuffer;
_____
Modified: trunk/reactos/lib/shell32/shell32_main.c --- trunk/reactos/lib/shell32/shell32_main.c 2005-05-05 21:07:02 UTC (rev 15023)
[truncated at 1000 lines; 1859 more skipped]