File browser from CW

Duane Clark dclark at akamail.com
Sat Jan 26 21:37:26 CST 2002


Here is the patch to presumably fix the famous Office filename browser 
problem.

Modified files:
	dlls/shell32		: pidl.c
	dlls/shell32		: shellord.c
	dlls/shell32		: shlfolder.c

Log message:
	Codeweavers
	Some traces added to pidl.c.
	Implementation of GetFileNameFromBrowse.
	Apparently IShellFolder_fnBindToObject can bind to a file.

-------------- next part --------------
Index: dlls/shell32/pidl.c
===================================================================
RCS file: /home/wine/wine/dlls/shell32/pidl.c,v
retrieving revision 1.65
diff -u -r1.65 pidl.c
--- dlls/shell32/pidl.c	2002/01/22 00:54:20	1.65
+++ dlls/shell32/pidl.c	2002/01/27 01:35:30
@@ -1579,13 +1579,20 @@
 {
 	LPPIDLDATA pdata =_ILGetDataPointer(pidl);
 
+	TRACE("%p\n", pidl);
+
 	if (pdata)
 	{
+	  TRACE("pdata->type 0x%04x\n", pdata->type);
 	  switch (pdata->type)
 	  {
 	    case PT_SPECIAL:
 	    case PT_MYCOMP:
 	      return (REFIID) &(pdata->u.mycomp.guid);
+
+	    default:
+		TRACE("Unknown pidl type 0x%04x\n", pdata->type);
+		break;
 	  }
 	}
 	return NULL;
Index: dlls/shell32/shellord.c
===================================================================
RCS file: /home/wine/wine/dlls/shell32/shellord.c,v
retrieving revision 1.92
diff -u -r1.92 shellord.c
--- dlls/shell32/shellord.c	2002/01/22 00:54:20	1.92
+++ dlls/shell32/shellord.c	2002/01/27 01:35:31
@@ -21,6 +21,7 @@
 #include "undocshell.h"
 #include "pidl.h"
 #include "shlwapi.h"
+#include "commdlg.h"
 
 DEFAULT_DEBUG_CHANNEL(shell);
 DECLARE_DEBUG_CHANNEL(pidl);
@@ -96,14 +97,39 @@
 	LPCSTR lpstrFilter,
 	LPCSTR lpstrTitle)
 {
-	FIXME("(%04x,%s,%ld,%s,%s,%s,%s):stub.\n",
+    HMODULE hmodule;
+    FARPROC pGetOpenFileNameA;
+    OPENFILENAMEA ofn;
+    BOOL ret;
+
+    TRACE("%04x, %s, %ld, %s, %s, %s, %s)\n",
 	  hwndOwner, lpstrFile, nMaxFile, lpstrInitialDir, lpstrDefExt,
 	  lpstrFilter, lpstrTitle);
+
+    hmodule = LoadLibraryA("comdlg32.dll");
+    if(!hmodule) return FALSE;
+    pGetOpenFileNameA = GetProcAddress(hmodule, "GetOpenFileNameA");
+    if(!pGetOpenFileNameA)
+    {
+	FreeLibrary(hmodule);
+	return FALSE;
+    }
+
+    memset(&ofn, 0, sizeof(ofn));
 
-    /* puts up a Open Dialog and requests input into targetbuf */
-    /* OFN_HIDEREADONLY|OFN_NOCHANGEDIR|OFN_FILEMUSTEXIST|OFN_unknown */
-    strcpy(lpstrFile,"x:\\dummy.exe");
-    return 1;
+    ofn.lStructSize = sizeof(ofn);
+    ofn.hwndOwner = hwndOwner;
+    ofn.lpstrFilter = lpstrFilter;
+    ofn.lpstrFile = lpstrFile;
+    ofn.nMaxFile = nMaxFile;
+    ofn.lpstrInitialDir = lpstrInitialDir;
+    ofn.lpstrTitle = lpstrTitle;
+    ofn.lpstrDefExt = lpstrDefExt;
+    ofn.Flags = OFN_EXPLORER | OFN_HIDEREADONLY | OFN_FILEMUSTEXIST;
+    ret = pGetOpenFileNameA(&ofn);
+    
+    FreeLibrary(hmodule);
+    return ret;
 }
 
 /*************************************************************************
Index: dlls/shell32/shlfolder.c
===================================================================
RCS file: /home/wine/wine/dlls/shell32/shlfolder.c,v
retrieving revision 1.63
diff -u -r1.63 shlfolder.c
--- dlls/shell32/shlfolder.c	2002/01/14 18:35:44	1.63
+++ dlls/shell32/shlfolder.c	2002/01/27 01:35:33
@@ -760,18 +760,13 @@
 	      return E_FAIL;
 	    }
 	}
-	else if(_ILIsFolder(pidl))
+	else
 	{
 	  LPITEMIDLIST pidltemp = ILCloneFirst(pidl);
 	  pShellFolder = IShellFolder_Constructor(iface, pidltemp);
 	  ILFree(pidltemp);
-	}
-	else
-	{
-	  ERR("can't bind to a file\n");
-	  return E_FAIL;
 	}
-	
+
 	if (_ILIsPidlSimple(pidl))
 	{
 	  if(IsEqualIID(riid, &IID_IShellFolder))


More information about the wine-patches mailing list