Sync to Wine-20050830:
Michael Jung <mjung@iss.tu-darmstadt.de>
- Initialize all members in UnixFolder constructor.
  Support NULL value pidls in GetDisplayNameOf method.
- Implemented IPersist::GetClassID.
- Use wine_get_dos_file_name instead of GetFullPathName.
- Implemented 'My Documents' folder.
- Added stubbed implementation of IPersistPropertyBag interface.
  Register unixfs as CLSID_FolderShortcut.
- Clone pidlLast before free'ing pidl after call to SHBindToParent.
- Use FIXME's in stubs instead of TRACE's.
  Infer pathmode from CLSID in UnixFolderConstructor.
  Fail in IShellFolder::BindToObject, if folder does not initialize.
- Use StringFromGUID2 instead of StringFromCLSID in
  UNIXFS_is_rooted_at_desktop.
Michael Jung <mjung@iss.tu-darmstadt.de>
Ge van Geldorp <gvg@reactos.com>
- Prepend Desktop folder path for files/directories stored in the
  filesystem Desktop folder when GetDisplayNameOf is called with the
  SHGDN_FORPARSING flags.
- Add testcases.
Ge van Geldorp <gvg@reactos.com>
- Fix resource leak on error paths.
- Do not load all shell32 icons during initialization, it wastes a lot of
  memory
Alexandre Julliard <julliard@winehq.org>
- Replace the _ICOM_THIS_From macros by inline functions the way it's
  already done in shelllink.c.
- Use ERR instead of DPRINTF in dump_pidl_hex.
- Don't prefix the functions DllCanUnloadNow, DllGetClassObject and
  Dll(Un)RegisterServer with the dll name so that the compiler can check
  the prototypes.
- Uncomment the typedef in the DECLARE_INTERFACE macro, and get rid of
  duplicate typedefs.
- Get rid of the _ICOM_THIS macros and call the inline function
  directly instead.
- Removed the broken mmap64 configure check, and moved the
  _FILE_OFFSET_BITS define to wine/port.h. Made sure that all files that
  need the define include it.
- Added missing ntdll imports.
Francois Gouget <fgouget@codeweavers.com>
- Fix ShellExecute("\"foo.doc\"") for Internet Explorer 6.
- Update the conformance tests accordingly.
- Tweak a trace because it's very confusing to see the path with no
  escaped quotes in ShellExecuteA() and then with escaped quotes in
  ShellExecuteExW32() (due to debugstr_w()).
- Fix the return value of SHELL_Argify() so it once again returns true
  if a '%1' or equivalent placeholder was found. This fixes
  ShellExecuteEx(lpFile="foo.txt", lpClass="txtfile").
- Fix handling of SEE_MASK_CLASSNAME and SEE_MASK_CLASSKEY. They are not
  disjoint flags.
Mike McCormack <mike@codeweavers.com>
- Warning fixes for gcc 4.0.
- Fix some gcc 4.0 warnings.
Jozef Stefanka <jstefanka@codeweavers.com>
- Fixed browsing to other directories in Word 2003 file open
  dialog. Double clicking on a folder in the File->Open dialog works
  now.
Steven Edwards <steven_ed4153@yahoo.com>
- Correct definition of SFGAO_STORAGEANCESTOR.
Jason Edmeades <us@edmeades.me.uk>
- Add the time to the file display dialog modified column.
- Handle context menu->refresh, and F5 to initiate a refresh of the file
  dialog.
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/cpanelfolder.c
Modified: trunk/reactos/lib/shell32/debughlp.c
Modified: trunk/reactos/lib/shell32/folders.c
Modified: trunk/reactos/lib/shell32/iconcache.c
Modified: trunk/reactos/lib/shell32/pidl.c
Modified: trunk/reactos/lib/shell32/regsvr.c
Modified: trunk/reactos/lib/shell32/shell.c
Modified: trunk/reactos/lib/shell32/shell32.spec
Modified: trunk/reactos/lib/shell32/shell32_main.c
Modified: trunk/reactos/lib/shell32/shell32_main.h
Modified: trunk/reactos/lib/shell32/shelllink.c
Modified: trunk/reactos/lib/shell32/shellole.c
Modified: trunk/reactos/lib/shell32/shellreg.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/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/w32api/include/shlguid.h

Modified: trunk/reactos/include/wine/shlguid.h
--- trunk/reactos/include/wine/shlguid.h	2005-09-07 07:53:31 UTC (rev 17713)
+++ trunk/reactos/include/wine/shlguid.h	2005-09-07 08:43:45 UTC (rev 17714)
@@ -46,7 +46,9 @@
 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(CLSID_FolderShortcut, 0x0AFACED1, 0xE828, 0x11D1, 0x91, 0x87, 0xB5, 0x32, 0xF1, 0xE9, 0x57, 0x5D);
 
+
 DEFINE_GUID(IID_IQueryAssociations, 0xc46ca590, 0x3c3f, 0x11d2, 0xbe, 0xe6, 0x00, 0x00, 0xf8, 0x05, 0xca, 0x57);
 
 DEFINE_GUID(CLSID_DragDropHelper, 0x4657278a, 0x411b, 0x11d2, 0x83, 0x9a, 0x0, 0xc0, 0x4f, 0xd9, 0x18, 0xd0);

Modified: trunk/reactos/lib/shell32/Makefile.in
--- trunk/reactos/lib/shell32/Makefile.in	2005-09-07 07:53:31 UTC (rev 17713)
+++ trunk/reactos/lib/shell32/Makefile.in	2005-09-07 08:43:45 UTC (rev 17714)
@@ -5,7 +5,7 @@
 VPATH     = @srcdir@
 MODULE    = shell32.dll
 IMPORTLIB = libshell32.$(IMPLIBEXT)
-IMPORTS   = shlwapi comctl32 user32 gdi32 advapi32 kernel32
+IMPORTS   = shlwapi comctl32 user32 gdi32 advapi32 kernel32 ntdll
 DELAYIMPORTS = ole32
 EXTRALIBS = -luuid $(LIBUNICODE)
 
@@ -61,6 +61,7 @@
 	folder.ico \
 	folder_open.ico \
 	mycomputer.ico \
+	mydocs.ico \
 	netdrive.ico \
 	netdrive2.ico \
 	printer.ico \

Modified: trunk/reactos/lib/shell32/autocomplete.c
--- trunk/reactos/lib/shell32/autocomplete.c	2005-09-07 07:53:31 UTC (rev 17713)
+++ trunk/reactos/lib/shell32/autocomplete.c	2005-09-07 08:43:45 UTC (rev 17714)
@@ -79,9 +79,12 @@
 static const IAutoCompleteVtbl acvt;
 static const IAutoComplete2Vtbl ac2vt;
 
-#define _IAutoComplete2_Offset ((int)(&(((IAutoCompleteImpl*)0)->lpvtblAutoComplete2)))
-#define _ICOM_THIS_From_IAutoComplete2(class, name) class* This = (class*)(((char*)name)-_IAutoComplete2_Offset);
+static inline IAutoCompleteImpl *impl_from_IAutoComplete2( IAutoComplete2 *iface )
+{
+    return (IAutoCompleteImpl *)((char*)iface - FIELD_OFFSET(IAutoCompleteImpl, lpvtblAutoComplete2));
+}
 
+
 /*
   converts This to an interface pointer
 */
@@ -329,7 +332,7 @@
     REFIID riid,
     LPVOID *ppvObj)
 {
-    _ICOM_THIS_From_IAutoComplete2(IAutoCompleteImpl, iface);
+    IAutoCompleteImpl *This = impl_from_IAutoComplete2(iface);
 
     TRACE ("(%p)->(%s,%p)\n", This, shdebugstr_guid (riid), ppvObj);
 
@@ -342,7 +345,7 @@
 static ULONG WINAPI IAutoComplete2_fnAddRef(
 	IAutoComplete2 * iface)
 {
-    _ICOM_THIS_From_IAutoComplete2(IAutoCompleteImpl,iface);
+    IAutoCompleteImpl *This = impl_from_IAutoComplete2(iface);
 
     TRACE ("(%p)->(count=%lu)\n", This, This->ref);
 
@@ -355,7 +358,7 @@
 static ULONG WINAPI IAutoComplete2_fnRelease(
 	IAutoComplete2 * iface)
 {
-    _ICOM_THIS_From_IAutoComplete2(IAutoCompleteImpl,iface);
+    IAutoCompleteImpl *This = impl_from_IAutoComplete2(iface);
 
     TRACE ("(%p)->(count=%lu)\n", This, This->ref);
 
@@ -369,7 +372,7 @@
     IAutoComplete2 * iface,
     BOOL fEnable)
 {
-    _ICOM_THIS_From_IAutoComplete2(IAutoCompleteImpl, iface);
+    IAutoCompleteImpl *This = impl_from_IAutoComplete2(iface);
 
     TRACE ("(%p)->(%s)\n", This, (fEnable)?"true":"false");
 
@@ -386,7 +389,7 @@
     LPCOLESTR pwzsRegKeyPath,
     LPCOLESTR pwszQuickComplete)
 {
-    _ICOM_THIS_From_IAutoComplete2(IAutoCompleteImpl, iface);
+    IAutoCompleteImpl *This = impl_from_IAutoComplete2(iface);
 
     TRACE("(%p)\n", This);
 
@@ -402,7 +405,7 @@
 {
     HRESULT hr = S_OK;
 
-    _ICOM_THIS_From_IAutoComplete2(IAutoCompleteImpl, iface);
+    IAutoCompleteImpl *This = impl_from_IAutoComplete2(iface);
 
     TRACE("(%p) -> (%p)\n", This, pdwFlag);
 
@@ -420,7 +423,7 @@
 {
     HRESULT hr = S_OK;
 
-    _ICOM_THIS_From_IAutoComplete2(IAutoCompleteImpl, iface);
+    IAutoCompleteImpl *This = impl_from_IAutoComplete2(iface);
 
     TRACE("(%p) -> (0x%lx)\n", This, dwFlag);
 

Modified: trunk/reactos/lib/shell32/cpanelfolder.c
--- trunk/reactos/lib/shell32/cpanelfolder.c	2005-09-07 07:53:31 UTC (rev 17713)
+++ trunk/reactos/lib/shell32/cpanelfolder.c	2005-09-07 08:43:45 UTC (rev 17714)
@@ -76,14 +76,20 @@
 static const IShellExecuteHookWVtbl vt_ShellExecuteHookW;
 static const IShellExecuteHookAVtbl vt_ShellExecuteHookA;
 
-#define _IPersistFolder2_Offset	    ((int)(&(((ICPanelImpl*)0)->lpVtblPersistFolder2)))
-#define _ICOM_THIS_From_IPersistFolder2(class, name) class* This = (class*)(((char*)name)-_IPersistFolder2_Offset);
+static inline ICPanelImpl *impl_from_IPersistFolder2( IPersistFolder2 *iface )
+{
+    return (ICPanelImpl *)((char*)iface - FIELD_OFFSET(ICPanelImpl, lpVtblPersistFolder2));
+}
 
-#define IShellExecuteHookW_Offset   ((int)(&(((ICPanelImpl*)0)->lpVtblShellExecuteHookW)))
-#define _ICOM_THIS_From_IShellExecuteHookW(class, name) class* This = (class*)(((char*)name)-IShellExecuteHookW_Offset);
+static inline ICPanelImpl *impl_from_IShellExecuteHookW( IShellExecuteHookW *iface )
+{
+    return (ICPanelImpl *)((char*)iface - FIELD_OFFSET(ICPanelImpl, lpVtblShellExecuteHookW));
+}
 
-#define IShellExecuteHookA_Offset   ((int)(&(((ICPanelImpl*)0)->lpVtblShellExecuteHookA)))
-#define _ICOM_THIS_From_IShellExecuteHookA(class, name) class* This = (class*)(((char*)name)-IShellExecuteHookA_Offset);
+static inline ICPanelImpl *impl_from_IShellExecuteHookA( IShellExecuteHookA *iface )
+{
+    return (ICPanelImpl *)((char*)iface - FIELD_OFFSET(ICPanelImpl, lpVtblShellExecuteHookA));
+}
 
 
 /*
@@ -824,7 +830,7 @@
  */
 static HRESULT WINAPI ICPanel_PersistFolder2_QueryInterface(IPersistFolder2 * iface, REFIID iid, LPVOID * ppvObject)
 {
-    _ICOM_THIS_From_IPersistFolder2(ICPanelImpl, iface);
+    ICPanelImpl *This = impl_from_IPersistFolder2(iface);
 
     TRACE("(%p)\n", This);
 
@@ -836,7 +842,7 @@
  */
 static ULONG WINAPI ICPanel_PersistFolder2_AddRef(IPersistFolder2 * iface)
 {
-    _ICOM_THIS_From_IPersistFolder2(ICPanelImpl, iface);
+    ICPanelImpl *This = impl_from_IPersistFolder2(iface);
 
     TRACE("(%p)->(count=%lu)\n", This, This->ref);
 
@@ -848,7 +854,7 @@
  */
 static ULONG WINAPI ICPanel_PersistFolder2_Release(IPersistFolder2 * iface)
 {
-    _ICOM_THIS_From_IPersistFolder2(ICPanelImpl, iface);
+    ICPanelImpl *This = impl_from_IPersistFolder2(iface);
 
     TRACE("(%p)->(count=%lu)\n", This, This->ref);
 
@@ -860,7 +866,7 @@
  */
 static HRESULT WINAPI ICPanel_PersistFolder2_GetClassID(IPersistFolder2 * iface, CLSID * lpClassId)
 {
-    _ICOM_THIS_From_IPersistFolder2(ICPanelImpl, iface);
+    ICPanelImpl *This = impl_from_IPersistFolder2(iface);
 
     TRACE("(%p)\n", This);
 
@@ -878,7 +884,7 @@
  */
 static HRESULT WINAPI ICPanel_PersistFolder2_Initialize(IPersistFolder2 * iface, LPCITEMIDLIST pidl)
 {
-    _ICOM_THIS_From_IPersistFolder2(ICPanelImpl, iface);
+    ICPanelImpl *This = impl_from_IPersistFolder2(iface);
     TRACE("(%p)->(%p)\n", This, pidl);
     return E_NOTIMPL;
 }
@@ -888,7 +894,7 @@
  */
 static HRESULT WINAPI ICPanel_PersistFolder2_GetCurFolder(IPersistFolder2 * iface, LPITEMIDLIST * pidl)
 {
-    _ICOM_THIS_From_IPersistFolder2(ICPanelImpl, iface);
+    ICPanelImpl *This = impl_from_IPersistFolder2(iface);
 
     TRACE("(%p)->(%p)\n", This, pidl);
 
@@ -931,7 +937,7 @@
 static HRESULT WINAPI IShellExecuteHookW_fnQueryInterface(
                IShellExecuteHookW* iface, REFIID riid, void** ppvObject)
 {
-    _ICOM_THIS_From_IShellExecuteHookW(ICPanelImpl, iface);
+    ICPanelImpl *This = impl_from_IShellExecuteHookW(iface);
 
     TRACE("(%p)->(count=%lu)\n", This, This->ref);
 
@@ -940,7 +946,7 @@
 
 static ULONG STDMETHODCALLTYPE IShellExecuteHookW_fnAddRef(IShellExecuteHookW* iface)
 {
-    _ICOM_THIS_From_IShellExecuteHookW(ICPanelImpl, iface);
+    ICPanelImpl *This = impl_from_IShellExecuteHookW(iface);
 
     TRACE("(%p)->(count=%lu)\n", This, This->ref);
 
@@ -949,7 +955,7 @@
 
 static ULONG STDMETHODCALLTYPE IShellExecuteHookW_fnRelease(IShellExecuteHookW* iface)
 {
-    _ICOM_THIS_From_IShellExecuteHookW(ICPanelImpl, iface);
+    ICPanelImpl *This = impl_from_IShellExecuteHookW(iface);
 
     TRACE("(%p)\n", This);
 
@@ -1017,7 +1023,7 @@
 
 static HRESULT WINAPI IShellExecuteHookA_fnQueryInterface(IShellExecuteHookA* iface, REFIID riid, void** ppvObject)
 {
-    _ICOM_THIS_From_IShellExecuteHookA(ICPanelImpl, iface);
+    ICPanelImpl *This = impl_from_IShellExecuteHookA(iface);
 
     TRACE("(%p)->(count=%lu)\n", This, This->ref);
 
@@ -1026,7 +1032,7 @@
 
 static ULONG STDMETHODCALLTYPE IShellExecuteHookA_fnAddRef(IShellExecuteHookA* iface)
 {
-    _ICOM_THIS_From_IShellExecuteHookA(ICPanelImpl, iface);
+    ICPanelImpl *This = impl_from_IShellExecuteHookA(iface);
 
     TRACE("(%p)->(count=%lu)\n", This, This->ref);
 
@@ -1035,7 +1041,7 @@
 
 static ULONG STDMETHODCALLTYPE IShellExecuteHookA_fnRelease(IShellExecuteHookA* iface)
 {
-    _ICOM_THIS_From_IShellExecuteHookA(ICPanelImpl, iface);
+    ICPanelImpl *This = impl_from_IShellExecuteHookA(iface);
 
     TRACE("(%p)\n", This);
 

Modified: trunk/reactos/lib/shell32/debughlp.c
--- trunk/reactos/lib/shell32/debughlp.c	2005-09-07 07:53:31 UTC (rev 17713)
+++ trunk/reactos/lib/shell32/debughlp.c	2005-09-07 08:43:45 UTC (rev 17714)
@@ -245,7 +245,7 @@
         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 );
+        ERR("%-*s   %s\n", max_line*3, szHex, szAscii );
     }
 }
 

Modified: trunk/reactos/lib/shell32/folders.c
--- trunk/reactos/lib/shell32/folders.c	2005-09-07 07:53:31 UTC (rev 17713)
+++ trunk/reactos/lib/shell32/folders.c	2005-09-07 08:43:45 UTC (rev 17714)
@@ -60,12 +60,17 @@
 static const IExtractIconWVtbl eivt;
 static const IPersistFileVtbl pfvt;
 
-#define _IPersistFile_Offset ((int)(&(((IExtractIconWImpl*)0)->lpvtblPersistFile)))
-#define _ICOM_THIS_From_IPersistFile(class, name) class* This = (class*)(((char*)name)-_IPersistFile_Offset);
+static inline IExtractIconW *impl_from_IPersistFile( IPersistFile *iface )
+{
+    return (IExtractIconW *)((char*)iface - FIELD_OFFSET(IExtractIconWImpl, lpvtblPersistFile));
+}
 
-#define _IExtractIconA_Offset ((int)(&(((IExtractIconWImpl*)0)->lpvtblExtractIconA)))
-#define _ICOM_THIS_From_IExtractIconA(class, name) class* This = (class*)(((char*)name)-_IExtractIconA_Offset);
+static inline IExtractIconW *impl_from_IExtractIconA( IExtractIconA *iface )
+{
+    return (IExtractIconW *)((char*)iface - FIELD_OFFSET(IExtractIconWImpl, lpvtblExtractIconA));
+}
 
+
 /**************************************************************************
 *  IExtractIconW_Constructor
 */
@@ -261,7 +266,7 @@
             if(IsEqualGUID(riid, &CLSID_MyComputer))
                 *piIndex = -IDI_SHELL_MY_COMPUTER;
             else if(IsEqualGUID(riid, &CLSID_MyDocuments))
-                *piIndex = -IDI_SHELL_FOLDER;
+                *piIndex = -IDI_SHELL_MY_DOCUMENTS;
             else if(IsEqualGUID(riid, &CLSID_NetworkPlaces))
                 *piIndex = -IDI_SHELL_MY_NETWORK_PLACES;
             else
@@ -419,7 +424,7 @@
  */
 static HRESULT WINAPI IExtractIconA_fnQueryInterface(IExtractIconA * iface, REFIID riid, LPVOID *ppvObj)
 {
-	_ICOM_THIS_From_IExtractIconA(IExtractIconW, iface);
+	IExtractIconW *This = impl_from_IExtractIconA(iface);
 
 	return IExtractIconW_QueryInterface(This, riid, ppvObj);
 }
@@ -429,7 +434,7 @@
 */
 static ULONG WINAPI IExtractIconA_fnAddRef(IExtractIconA * iface)
 {
-	_ICOM_THIS_From_IExtractIconA(IExtractIconW, iface);
+	IExtractIconW *This = impl_from_IExtractIconA(iface);
 
 	return IExtractIconW_AddRef(This);
 }
@@ -438,7 +443,7 @@
 */
 static ULONG WINAPI IExtractIconA_fnRelease(IExtractIconA * iface)
 {
-	_ICOM_THIS_From_IExtractIconA(IExtractIconW, iface);
+	IExtractIconW *This = impl_from_IExtractIconA(iface);
 
 	return IExtractIconW_AddRef(This);
 }
@@ -457,7 +462,7 @@
 {
 	HRESULT ret;
 	LPWSTR lpwstrFile = HeapAlloc(GetProcessHeap(), 0, cchMax * sizeof(WCHAR));
-	_ICOM_THIS_From_IExtractIconA(IExtractIconW, iface);
+	IExtractIconW *This = impl_from_IExtractIconA(iface);
 	
 	TRACE("(%p) (flags=%u %p %u %p %p)\n", This, uFlags, szIconFile, cchMax, piIndex, pwFlags);
 
@@ -476,7 +481,7 @@
 	HRESULT ret;
 	INT len = MultiByteToWideChar(CP_ACP, 0, pszFile, -1, NULL, 0);
 	LPWSTR lpwstrFile = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
-	_ICOM_THIS_From_IExtractIconA(IExtractIconW, iface);
+	IExtractIconW *This = impl_from_IExtractIconA(iface);
 
 	TRACE("(%p) (file=%p index=%u %p %p size=%u)\n", This, pszFile, nIconIndex, phiconLarge, phiconSmall, nIconSize);
 
@@ -503,7 +508,7 @@
 	REFIID		iid,
 	LPVOID		*ppvObj)
 {
-	_ICOM_THIS_From_IPersistFile(IExtractIconW, iface);
+	IExtractIconW *This = impl_from_IPersistFile(iface);
 
 	return IExtractIconW_QueryInterface(This, iid, ppvObj);
 }
@@ -514,7 +519,7 @@
 static ULONG WINAPI IEIPersistFile_fnAddRef(
 	IPersistFile	*iface)
 {
-	_ICOM_THIS_From_IPersistFile(IExtractIconW, iface);
+	IExtractIconW *This = impl_from_IPersistFile(iface);
 
 	return IExtractIconW_AddRef(This);
 }
@@ -525,7 +530,7 @@
 static ULONG WINAPI IEIPersistFile_fnRelease(
 	IPersistFile	*iface)
 {
-	_ICOM_THIS_From_IPersistFile(IExtractIconW, iface);
+	IExtractIconW *This = impl_from_IPersistFile(iface);
 
 	return IExtractIconW_Release(This);
 }
@@ -552,7 +557,7 @@
  */
 static HRESULT WINAPI IEIPersistFile_fnLoad(IPersistFile* iface, LPCOLESTR pszFileName, DWORD dwMode)
 {
-	_ICOM_THIS_From_IPersistFile(IExtractIconW, iface);
+	IExtractIconW *This = impl_from_IPersistFile(iface);
 	FIXME("%p\n", This);
 	return E_NOTIMPL;
 

Modified: trunk/reactos/lib/shell32/iconcache.c
--- trunk/reactos/lib/shell32/iconcache.c	2005-09-07 07:53:31 UTC (rev 17713)
+++ trunk/reactos/lib/shell32/iconcache.c	2005-09-07 08:43:45 UTC (rev 17714)
@@ -407,24 +407,27 @@
 	  return(FALSE);
 	}
 
-       ShellSmallIconList = ImageList_Create(16,16,ILC_COLOR32|ILC_MASK,0,0x20);
-       ShellBigIconList = ImageList_Create(32,32,ILC_COLOR32|ILC_MASK,0,0x20);
+	ShellSmallIconList = ImageList_Create(16,16,ILC_COLOR32|ILC_MASK,0,0x20);
+	ShellBigIconList = ImageList_Create(32,32,ILC_COLOR32|ILC_MASK,0,0x20);
 
-       ImageList_SetBkColor(ShellSmallIconList, CLR_NONE);
-       ImageList_SetBkColor(ShellBigIconList, CLR_NONE);
+	ImageList_SetBkColor(ShellSmallIconList, CLR_NONE);
+	ImageList_SetBkColor(ShellBigIconList, CLR_NONE);
 
-	for (index=1; index<39; index++)
+	/*
+	 * Wine will extract and cache all shell32 icons here. That's because
+	 * they are unable to extract resources from their built-in DLLs.
+	 * We don't need that, but we still want to make sure that the very
+	 * first icon in the image lists is icon 1 from shell32.dll, since
+	 * that's the default icon.
+	 */
+	index = 1;
+	hSm = (HICON)LoadImageA(shell32_hInstance, MAKEINTRESOURCEA(index), IMAGE_ICON, cx_small, cy_small, LR_SHARED);
+	hLg = (HICON)LoadImageA(shell32_hInstance, MAKEINTRESOURCEA(index), IMAGE_ICON, cx_large, cy_large, LR_SHARED);
+
+	if(hSm)
 	{
-	  hSm = (HICON)LoadImageA(shell32_hInstance, MAKEINTRESOURCEA(index), IMAGE_ICON, cx_small, cy_small, LR_SHARED);
-	  hLg = (HICON)LoadImageA(shell32_hInstance, MAKEINTRESOURCEA(index), IMAGE_ICON, cx_large, cy_large, LR_SHARED);
-
-	  if(!hSm)
-	  {
-	    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 - 1, hSm, hLg, 0);
-         SIC_IconAppend (swShell32Name, -index, hSm, hLg, 0);
+          SIC_IconAppend (swShell32Name, index - 1, hSm, hLg, 0);
+          SIC_IconAppend (swShell32Name, -index, hSm, hLg, 0);
 	}
 
 	TRACE("hIconSmall=%p hIconBig=%p\n",ShellSmallIconList, ShellBigIconList);

Modified: trunk/reactos/lib/shell32/pidl.c
--- trunk/reactos/lib/shell32/pidl.c	2005-09-07 07:53:31 UTC (rev 17713)
+++ trunk/reactos/lib/shell32/pidl.c	2005-09-07 08:43:45 UTC (rev 17714)
@@ -1210,87 +1210,6 @@
 }
 
 /*************************************************************************
- * SHELL_GetPathFromIDListA
- */
-HRESULT SHELL_GetPathFromIDListA(LPCITEMIDLIST pidl, LPSTR pszPath, UINT uOutSize)
-{
-    HRESULT hr = S_OK;
-
-    pszPath[0]=0;
-
-    /* One case is a PIDL rooted at desktop level */
-    if (_ILIsDesktop(pidl) || _ILIsValue(pidl) || _ILIsFolder(pidl))
-    {
-        hr = SHGetSpecialFolderPathA(0, pszPath, CSIDL_DESKTOP, FALSE);
-
-        if (SUCCEEDED(hr))
-            PathAddBackslashA(pszPath);
-    }
-    /* The only other valid case is an item ID list beginning at "My Computer" */
-    else if (_ILIsMyComputer(pidl))
-        pidl = ILGetNext(pidl);
-
-    if (SUCCEEDED(hr))
-    {
-        LPSTR txt;
-
-        while(pidl && pidl->mkid.cb)
-        {
-            if (_ILIsSpecialFolder(pidl))
-            {
-                hr = E_INVALIDARG;
-                break;
-            }
-
-            txt = _ILGetTextPointer(pidl);
-            if (!txt)
-            {
-                hr = E_INVALIDARG;
-                break;
-            }
-
-            if (lstrlenA(txt) > pidl->mkid.cb)
-                ERR("pidl %p is borked\n",pidl);
-
-            /* make sure there's enough space for the next segment */
-            if ((lstrlenA(txt) + lstrlenA(pszPath)) > uOutSize)
-            {
-                hr = E_INVALIDARG;
-                break;
-            }
-            lstrcatA( pszPath, txt );
-
-            pidl = ILGetNext(pidl);
-            if (!pidl)
-            {
-                hr = E_INVALIDARG;
-                break;
-            }
-
-            /* Are we at the end and successfully converted the complete PIDL? */
-            if (!pidl->mkid.cb)
-                break;
-
-            if ((lstrlenA(pszPath) + 1) > uOutSize)
-            {
-                hr = E_INVALIDARG;
-                break;
-            }
-            if (!PathAddBackslashA(pszPath))
-            {
-                hr = E_INVALIDARG;
-                break;
-            }
-        }
-    }
-    else
-        hr = E_INVALIDARG;
-
-    TRACE_(shell)("-- %s, 0x%08lx\n", pszPath, hr);
-    return hr;
-}
-
-/*************************************************************************
  * SHGetPathFromIDListA        [SHELL32.@][NT 4.0: SHELL32.220]
  *
  * PARAMETERS
@@ -1307,108 +1226,26 @@
  */
 BOOL WINAPI SHGetPathFromIDListA(LPCITEMIDLIST pidl, LPSTR pszPath)
 {
-    HRESULT hr;
+    WCHAR wszPath[MAX_PATH];
+    BOOL bSuccess;
 
-    TRACE_(shell)("(pidl=%p,%p)\n",pidl,pszPath);
-    pdump(pidl);
+    bSuccess = SHGetPathFromIDListW(pidl, wszPath);
+    if (bSuccess) 
+        WideCharToMultiByte(CP_ACP, 0, wszPath, -1, pszPath, MAX_PATH, NULL, NULL);
 
-    if (!pidl)
-        return FALSE;
-
-    hr = SHELL_GetPathFromIDListA(pidl, pszPath, MAX_PATH);
-
-    return SUCCEEDED(hr);
+    return bSuccess;
 }
 
 /*************************************************************************
- * SHELL_GetPathFromIDListW
- */
-HRESULT SHELL_GetPathFromIDListW(LPCITEMIDLIST pidl, LPWSTR pszPath, UINT uOutSize)
-{
-    HRESULT hr = S_OK;
-    UINT len;
-
-    pszPath[0]=0;
-
-    /* One case is a PIDL rooted at desktop level */
-    if (_ILIsDesktop(pidl) ||_ILIsValue(pidl) || _ILIsFolder(pidl))
-    {
-        hr = SHGetSpecialFolderPathW(0, pszPath, CSIDL_DESKTOP, FALSE);
-
-        if (SUCCEEDED(hr))
-            PathAddBackslashW(pszPath);
-    }
-    /* The only other valid case is an item ID list beginning at "My Computer" */
-    else if (_ILIsMyComputer(pidl))
-        pidl = ILGetNext(pidl);
-
-    if (SUCCEEDED(hr))
-    {
-        LPSTR txt;
-
-        while(pidl && pidl->mkid.cb)
-        {
-            if (_ILIsSpecialFolder(pidl))
-            {
-                hr = E_INVALIDARG;
-                break;
-            }
-
-            txt = _ILGetTextPointer(pidl);
-            if (!txt)
-            {
-                hr = E_INVALIDARG;
-                break;
-            }
-
-            if (lstrlenA(txt) > pidl->mkid.cb)
-                ERR("pidl %p is borked\n",pidl);
-            len = MultiByteToWideChar(CP_ACP, 0, txt, -1, NULL, 0);
-            if ( (lstrlenW(pszPath) + len) > uOutSize )
-            {
-                hr = E_INVALIDARG;
-                break;
-            }
-
-            MultiByteToWideChar(CP_ACP, 0, txt, -1,
-                                &pszPath[lstrlenW(pszPath)], len);
-
-            pidl = ILGetNext(pidl);
-            if (!pidl)
-            {
-                hr = E_INVALIDARG;
-                break;
-            }
-
-            /* Are we at the end and successfully converted the complete PIDL? */
-            if (!pidl->mkid.cb)
-                break;
-
-            if ((lstrlenW(pszPath) + 1) > uOutSize )
-            {
-                hr = E_INVALIDARG;
-                break;
-            }
-            if (!PathAddBackslashW(pszPath))
-            {
-                hr = E_INVALIDARG;
-                break;
-            }
-        }
-    }
-    else
-        hr = E_INVALIDARG;
-
-    TRACE_(shell)("-- %s, 0x%08lx\n", debugstr_w(pszPath), hr);
-    return hr;
-}
-
-/*************************************************************************
  * SHGetPathFromIDListW             [SHELL32.@]
  */
 BOOL WINAPI SHGetPathFromIDListW(LPCITEMIDLIST pidl, LPWSTR pszPath)
 {
     HRESULT hr;
+    LPCITEMIDLIST pidlLast;
+    LPSHELLFOLDER psfFolder;
+    DWORD dwAttributes;
+    STRRET strret;
 
     TRACE_(shell)("(pidl=%p,%p)\n", pidl, debugstr_w(pszPath));
     pdump(pidl);
@@ -1416,8 +1253,22 @@
     if (!pidl)
         return FALSE;
 
-    hr = SHELL_GetPathFromIDListW(pidl, pszPath, MAX_PATH);
+    hr = SHBindToParent(pidl, &IID_IShellFolder, (VOID**)&psfFolder, &pidlLast);
+    if (FAILED(hr)) return FALSE;
 
+    dwAttributes = SFGAO_FILESYSTEM;
+    hr = IShellFolder_GetAttributesOf(psfFolder, 1, &pidlLast, &dwAttributes);
+    if (FAILED(hr) || !(dwAttributes & SFGAO_FILESYSTEM)) {
+        IShellFolder_Release(psfFolder);
+        return FALSE;
+    }
+                
+    hr = IShellFolder_GetDisplayNameOf(psfFolder, pidlLast, SHGDN_FORPARSING, &strret);
+    IShellFolder_Release(psfFolder);
+    if (FAILED(hr)) return FALSE;
+
+    hr = StrRetToBufW(&strret, pidlLast, pszPath, MAX_PATH);
+
     TRACE_(shell)("-- %s, 0x%08lx\n",debugstr_w(pszPath), hr);
     return SUCCEEDED(hr);
 }
@@ -2135,7 +1986,14 @@
     {
         FileTimeToLocalFileTime(&ft, &lft);
         FileTimeToSystemTime (&lft, &time);
+
         ret = GetDateFormatA(LOCALE_USER_DEFAULT,DATE_SHORTDATE,&time, NULL,  pOut, uOutSize);
+        if (ret) 
+        {
+            /* Append space + time without seconds */
+            pOut[ret-1] = ' ';
+            GetTimeFormatA(LOCALE_USER_DEFAULT, TIME_NOSECONDS, &time, NULL, &pOut[ret], uOutSize - ret);
+        }
     }
     else
     {

Modified: trunk/reactos/lib/shell32/regsvr.c
--- trunk/reactos/lib/shell32/regsvr.c	2005-09-07 07:53:31 UTC (rev 17713)
+++ trunk/reactos/lib/shell32/regsvr.c	2005-09-07 08:43:45 UTC (rev 17714)
@@ -313,7 +313,7 @@
 				  &shellfolder_key, NULL);
 	    if (res != ERROR_SUCCESS) goto error_close_clsid_key;
 	    if (list->flags & SHELLFOLDER_WANTSFORPARSING)
-		res = RegSetValueExA(shellfolder_key, wfparsing_valuename, 0, REG_SZ, "", 1);
+		res = RegSetValueExA(shellfolder_key, wfparsing_valuename, 0, REG_SZ, (LPBYTE)"", 1);
 	    if (list->flags & SHELLFOLDER_ATTRIBUTES) 
 		res = RegSetValueExA(shellfolder_key, attributes_valuename, 0, REG_DWORD, 
 				     (LPBYTE)&list->dwAttributes, sizeof(DWORD));
@@ -605,6 +605,24 @@
 	"shell32.dll",
 	"Apartment",
     },
+    {	&CLSID_FolderShortcut,
+	"Foldershortcut",
+	NULL,
+	"shell32.dll",
+	"Apartment",
+	SHELLFOLDER_ATTRIBUTES|SHELLFOLDER_CALLFORATTRIBUTES,
+	SFGAO_FILESYSTEM|SFGAO_FOLDER|SFGAO_LINK,
+	SFGAO_HASSUBFOLDER|SFGAO_FILESYSTEM|SFGAO_FOLDER|SFGAO_FILESYSANCESTOR
+    },
+    {	&CLSID_MyDocuments,
+	"My Documents",
+	NULL,
+	"shell32.dll",
+	"Apartment",
+	SHELLFOLDER_WANTSFORPARSING|SHELLFOLDER_ATTRIBUTES|SHELLFOLDER_CALLFORATTRIBUTES,
+	SFGAO_FILESYSANCESTOR|SFGAO_FOLDER|SFGAO_HASSUBFOLDER,
+	SFGAO_FILESYSTEM
+    },
     { NULL }			/* list terminator */
 };
 
@@ -621,15 +639,21 @@
  */
 static const WCHAR wszDesktop[] = { 'D','e','s','k','t','o','p',0 };
 static const WCHAR wszSlash[] = { '/', 0 };
+static const WCHAR wszMyDocuments[] = { 'M','y',' ','D','o','c','u','m','e','n','t','s', 0 };
 
 static struct regsvr_namespace const namespace_extensions_list[] = {
+    {   
+        &CLSID_MyDocuments,
+        wszDesktop,
+        wszMyDocuments
+    },
     { NULL }
 };
 
 /***********************************************************************
  *		DllRegisterServer (SHELL32.@)
  */
-HRESULT WINAPI SHELL32_DllRegisterServer()
+HRESULT WINAPI DllRegisterServer(void)
 {
     HRESULT hr;
 
@@ -648,7 +672,7 @@
 /***********************************************************************
  *		DllUnregisterServer (SHELL32.@)
  */
-HRESULT WINAPI SHELL32_DllUnregisterServer()
+HRESULT WINAPI DllUnregisterServer(void)
 {
     HRESULT hr;
 

Modified: trunk/reactos/lib/shell32/shell.c
--- trunk/reactos/lib/shell32/shell.c	2005-09-07 07:53:31 UTC (rev 17713)
+++ trunk/reactos/lib/shell32/shell.c	2005-09-07 08:43:45 UTC (rev 17714)
@@ -574,7 +574,7 @@
 {
     fix_win16_hkey( &hkey );
     if (count) *count &= 0xffff;
-    return RegQueryValueA( hkey, name, data, count );
+    return RegQueryValueA( hkey, name, data, (LONG*) count );
 }
 
 /******************************************************************************

Modified: trunk/reactos/lib/shell32/shell32.spec
--- trunk/reactos/lib/shell32/shell32.spec	2005-09-07 07:53:31 UTC (rev 17713)
+++ trunk/reactos/lib/shell32/shell32.spec	2005-09-07 08:43:45 UTC (rev 17714)
@@ -260,12 +260,12 @@
 @ stdcall Control_RunDLLA(ptr ptr str long)
 @ stub Control_RunDLLAsUserW
 @ stdcall Control_RunDLLW(ptr ptr wstr long)
-@ stdcall -private DllCanUnloadNow() SHELL32_DllCanUnloadNow
-@ stdcall -private DllGetClassObject(long long ptr) SHELL32_DllGetClassObject
-@ stdcall DllGetVersion(ptr)SHELL32_DllGetVersion
-@ stdcall DllInstall(long wstr)SHELL32_DllInstall
-@ stdcall -private DllRegisterServer() SHELL32_DllRegisterServer
-@ stdcall -private DllUnregisterServer() SHELL32_DllUnregisterServer
+@ stdcall -private DllCanUnloadNow()
+@ stdcall -private DllGetClassObject(ptr ptr ptr)
+@ stdcall -private DllGetVersion(ptr)
+@ stdcall -private DllInstall(long wstr)
+@ stdcall -private DllRegisterServer()
+@ stdcall -private DllUnregisterServer()
 @ stdcall DoEnvironmentSubstA(str str)
 @ stdcall DoEnvironmentSubstW(wstr wstr)
 @ stdcall DragAcceptFiles(long long)

Modified: trunk/reactos/lib/shell32/shell32_main.c
--- trunk/reactos/lib/shell32/shell32_main.c	2005-09-07 07:53:31 UTC (rev 17713)
+++ trunk/reactos/lib/shell32/shell32_main.c	2005-09-07 08:43:45 UTC (rev 17714)
@@ -386,6 +386,8 @@
         {
             hr = SHBindToParent( pidl, &IID_IShellFolder, (LPVOID*)&psfParent,
                                 (LPCITEMIDLIST*)&pidlLast );
+            if (SUCCEEDED(hr))
+                pidlLast = ILClone(pidlLast);
             ILFree(pidl);
         }
         else
@@ -1058,7 +1060,7 @@
  *     Returns version of a shell32.dll from IE4.01 SP1.
  */
 
-HRESULT WINAPI SHELL32_DllGetVersion (DLLVERSIONINFO *pdvi)
+HRESULT WINAPI DllGetVersion (DLLVERSIONINFO *pdvi)
 {
     /* FIXME: shouldn't these values come from the version resource? */
     if (pdvi->cbSize == sizeof(DLLVERSIONINFO) ||
@@ -1144,7 +1146,7 @@
  *    LPCWSTR pszCmdLine - command line (unused by shell32?)
  */
 
-HRESULT WINAPI SHELL32_DllInstall(BOOL bInstall, LPCWSTR cmdline)
+HRESULT WINAPI DllInstall(BOOL bInstall, LPCWSTR cmdline)
 {
     FIXME("%s %s: stub\n", bInstall ? "TRUE":"FALSE", debugstr_w(cmdline));
     return S_OK;        /* indicate success */
@@ -1153,7 +1155,7 @@
 /***********************************************************************
  *              DllCanUnloadNow (SHELL32.@)
  */
-HRESULT WINAPI SHELL32_DllCanUnloadNow(void)
+HRESULT WINAPI DllCanUnloadNow(void)
 {
     FIXME("stub\n");
     return S_FALSE;

Modified: trunk/reactos/lib/shell32/shell32_main.h
--- trunk/reactos/lib/shell32/shell32_main.h	2005-09-07 07:53:31 UTC (rev 17713)
+++ trunk/reactos/lib/shell32/shell32_main.h	2005-09-07 08:43:45 UTC (rev 17714)
@@ -94,6 +94,8 @@
 HRESULT WINAPI IControlPanel_Constructor(IUnknown * pUnkOuter, REFIID riid, LPVOID * ppv);
 HRESULT WINAPI UnixFolder_Constructor(IUnknown * pUnkOuter, REFIID riid, LPVOID * ppv);
 HRESULT WINAPI UnixDosFolder_Constructor(IUnknown * pUnkOuter, REFIID riid, LPVOID *ppv);
+HRESULT WINAPI FolderShortcut_Constructor(IUnknown * pUnkOuter, REFIID riid, LPVOID *ppv);
+HRESULT WINAPI MyDocuments_Constructor(IUnknown * pUnkOuter, REFIID riid, LPVOID *ppv);
 extern HRESULT CPanel_GetIconLocationW(LPITEMIDLIST, LPWSTR, UINT, int*);
 HRESULT WINAPI CPanel_ExtractIconA(LPITEMIDLIST pidl, LPCSTR pszFile, UINT nIconIndex, HICON *phiconLarge, HICON *phiconSmall, UINT nIconSize);
 HRESULT WINAPI CPanel_ExtractIconW(LPITEMIDLIST pidl, LPCWSTR pszFile, UINT nIconIndex, HICON *phiconLarge, HICON *phiconSmall, UINT nIconSize);
@@ -103,11 +105,6 @@
 LPEXTRACTICONA	IExtractIconA_Constructor(LPCITEMIDLIST);
 LPEXTRACTICONW	IExtractIconW_Constructor(LPCITEMIDLIST);
 
-/* FIXME: rename the functions when the shell32.dll has it's own exports namespace */
-HRESULT WINAPI  SHELL32_DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID * ppv);
-HRESULT WINAPI  SHELL32_DllCanUnloadNow(void);
-
-
 /* menu merging */
 #define MM_ADDSEPARATOR         0x00000001L
 #define MM_SUBMENUSHAVEIDS      0x00000002L

Modified: trunk/reactos/lib/shell32/shelllink.c
--- trunk/reactos/lib/shell32/shelllink.c	2005-09-07 07:53:31 UTC (rev 17713)
+++ trunk/reactos/lib/shell32/shelllink.c	2005-09-07 08:43:45 UTC (rev 17714)
@@ -161,43 +161,31 @@
 {
     return (IShellLinkImpl *)((char*)iface - FIELD_OFFSET(IShellLinkImpl, lpvtblw));
 }
-#define _ICOM_THIS_From_IShellLinkW(class, iface) \
-    class* This = impl_from_IShellLinkW( iface )
 
 static inline IShellLinkImpl *impl_from_IPersistFile( IPersistFile *iface )
 {
     return (IShellLinkImpl *)((char*)iface - FIELD_OFFSET(IShellLinkImpl, lpvtblPersistFile));
 }
-#define _ICOM_THIS_From_IPersistFile(class, iface) \
-    class* This = impl_from_IPersistFile( iface )
 
 static inline IShellLinkImpl *impl_from_IPersistStream( IPersistStream *iface )
 {
     return (IShellLinkImpl *)((char*)iface - FIELD_OFFSET(IShellLinkImpl, lpvtblPersistStream));
 }
-#define _ICOM_THIS_From_IPersistStream(class, iface) \
-    class* This = impl_from_IPersistStream( iface )
 
 static inline IShellLinkImpl *impl_from_IShellLinkDataList( IShellLinkDataList *iface )
 {
     return (IShellLinkImpl *)((char*)iface - FIELD_OFFSET(IShellLinkImpl, lpvtblShellLinkDataList));
 }
-#define _ICOM_THIS_From_IShellLinkDataList(class, iface) \
-    class* This = impl_from_IShellLinkDataList( iface )
 
 static inline IShellLinkImpl *impl_from_IShellExtInit( IShellExtInit *iface )
 {
     return (IShellLinkImpl *)((char*)iface - FIELD_OFFSET(IShellLinkImpl, lpvtblShellExtInit));
 }
-#define _ICOM_THIS_From_IShellExtInit(class, iface) \
-    class* This = impl_from_IShellExtInit( iface )
 
 static inline IShellLinkImpl *impl_from_IContextMenu( IContextMenu *iface )
 {
     return (IShellLinkImpl *)((char*)iface - FIELD_OFFSET(IShellLinkImpl, lpvtblContextMenu));
 }
-#define _ICOM_THIS_From_IContextMenu(class, iface) \
-    class* This = impl_from_IContextMenu( iface )
 
 static HRESULT ShellLink_UpdatePath(LPWSTR sPathRel, LPCWSTR path, LPCWSTR sWorkDir, LPWSTR* psPath);
 
@@ -316,7 +304,7 @@
 	REFIID riid,
 	LPVOID *ppvObj)
 {
-    _ICOM_THIS_From_IPersistFile(IShellLinkImpl, iface);
+    IShellLinkImpl *This = impl_from_IPersistFile(iface);
     return ShellLink_QueryInterface( This, riid, ppvObj );
 }
 
@@ -325,7 +313,7 @@
  */
 static ULONG WINAPI IPersistFile_fnAddRef(IPersistFile* iface)
 {
-    _ICOM_THIS_From_IPersistFile(IShellLinkImpl, iface);
+    IShellLinkImpl *This = impl_from_IPersistFile(iface);
     return ShellLink_AddRef( This );
 }
 
@@ -334,19 +322,19 @@
  */
 static ULONG WINAPI IPersistFile_fnRelease(IPersistFile* iface)
 {
-    _ICOM_THIS_From_IPersistFile(IShellLinkImpl, iface);
+    IShellLinkImpl *This = impl_from_IPersistFile(iface);
     return IShellLinkA_Release((IShellLinkA*)This);
 }
 
 static HRESULT WINAPI IPersistFile_fnGetClassID(IPersistFile* iface, CLSID *pClassID)
 {
-    _ICOM_THIS_From_IPersistFile(IShellLinkImpl, iface);
+    IShellLinkImpl *This = impl_from_IPersistFile(iface);
     return ShellLink_GetClassID( This, pClassID );
 }
 
 static HRESULT WINAPI IPersistFile_fnIsDirty(IPersistFile* iface)
 {
-	_ICOM_THIS_From_IPersistFile(IShellLinkImpl, iface);
+	IShellLinkImpl *This = impl_from_IPersistFile(iface);
 
 	TRACE("(%p)\n",This);
 
@@ -358,7 +346,7 @@
 
 static HRESULT WINAPI IPersistFile_fnLoad(IPersistFile* iface, LPCOLESTR pszFileName, DWORD dwMode)
 {
-	_ICOM_THIS_From_IPersistFile(IShellLinkImpl, iface);
+	IShellLinkImpl *This = impl_from_IPersistFile(iface);
 	IPersistStream *StreamThis = (IPersistStream *)&This->lpvtblPersistStream;
         HRESULT r;
         IStream *stm;
@@ -414,7 +402,7 @@
 
 static HRESULT WINAPI IPersistFile_fnSave(IPersistFile* iface, LPCOLESTR pszFileName, BOOL fRemember)
 {
-    _ICOM_THIS_From_IPersistFile(IShellLinkImpl, iface);
+    IShellLinkImpl *This = impl_from_IPersistFile(iface);
     IPersistStream *StreamThis = (IPersistStream *)&This->lpvtblPersistStream;
     HRESULT r;
     IStream *stm;
@@ -448,14 +436,14 @@
 
 static HRESULT WINAPI IPersistFile_fnSaveCompleted(IPersistFile* iface, LPCOLESTR pszFileName)
 {
-	_ICOM_THIS_From_IPersistFile(IShellLinkImpl, iface);
+	IShellLinkImpl *This = impl_from_IPersistFile(iface);
 	FIXME("(%p)->(%s)\n",This,debugstr_w(pszFileName));
 	return NOERROR;
 }
 
 static HRESULT WINAPI IPersistFile_fnGetCurFile(IPersistFile* iface, LPOLESTR *ppszFileName)
 {
-	_ICOM_THIS_From_IPersistFile(IShellLinkImpl, iface);
+	IShellLinkImpl *This = impl_from_IPersistFile(iface);
 	FIXME("(%p)\n",This);
 	return NOERROR;
 }
@@ -481,7 +469,7 @@
 	REFIID     riid,
 	VOID**     ppvObj)
 {
-    _ICOM_THIS_From_IPersistStream(IShellLinkImpl, iface);
+    IShellLinkImpl *This = impl_from_IPersistStream(iface);
     return ShellLink_QueryInterface( This, riid, ppvObj );
 }
 
@@ -491,7 +479,7 @@
 static ULONG WINAPI IPersistStream_fnRelease(
 	IPersistStream* iface)
 {
-    _ICOM_THIS_From_IPersistStream(IShellLinkImpl, iface);
+    IShellLinkImpl *This = impl_from_IPersistStream(iface);
     return IShellLinkA_Release((IShellLinkA*)This);
 }
 
@@ -501,7 +489,7 @@
 static ULONG WINAPI IPersistStream_fnAddRef(
 	IPersistStream* iface)
 {
-    _ICOM_THIS_From_IPersistStream(IShellLinkImpl, iface);
[truncated at 1000 lines; 1432 more skipped]