Unsupported feature in SHFileOperationW

Phillip.Ezolt at hp.com Phillip.Ezolt at hp.com
Fri May 28 15:24:41 CDT 2004


Hi all,

	Here is patch for the SHFileOperationW problem. (Which I
originally sent out in January. )

It isn't perfect, and it fixes the problem for my application. (which
happens to be the same as Lionel's)

According to Lionel the fix is better than what is there today, but it
falls short of windows behavior in the following manner (for the
record):

> But it's not 100 % correct as, for example, it does not work if one needs to
> create more than one level of directories (which is working fine in Windows,
> I just checked it). Moreover, there should be a message box (if not disabled
> like in RollerCoasterTycoon) asking if the users wants or not to create the
> directory (I checked this on Windows too).

--Phil

    Hewlett-Packard: High Performance Technical Computing/Visualization
---------------------------------------------------------------------------
Phillip.Ezolt at hp.com                                Performance/Development


---------- Forwarded message ----------
Date: Fri, 30 Jan 2004 12:54:48 -0500 (EST)
From: Phillip Ezolt <phillip.ezolt at hp.com>
To: wine-patches at winehq.org
Subject: SHFileOperationW: Create subdir on Copy

Hi All,

	Here's a small fix. Comments/questions are welcomed.

Summary
-------
	This patch allows SHFileOperationW to automatically create
subdirectories if they don't exists.  (The Microsoft documentation
states that this is correct.)

This patch fixes bug #1954.  I have verified that it works with
Today's CVS. (January 30,2004)

I ran into this problem with the Rollercoaster Tycoon demo installer.

It can successfully copy files to this newly created directory, but
coping into any (currently non-existant) directories below it fail.

According to MS:
(http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/shell/reference/structures/shfileopstruct.asp)

        " Copy and Move operations can specify destination directories
that do not exist and the system will attempt to create them. "
(See footnote #1 for more info)

For example, this succeeds:
trace:shell:SHNotifyCopyFileW (L"E:\\WZS21db.tmp\\English\\rct.exe"
L"C:\\Program Files\\Hasbro Interactive\\RollerCoaster Tycoon Demo\\rct.exe" )

But this fails:
trace:shell:SHNotifyCopyFileW (L"E:\\WZS21db.tmp\\Saved Games\\001"
L"C:\\Program Files\\Hasbro Interactive\\RollerCoaster Tycoon Demo\\Saved
Games\\001" )

The directory "Saved Games" should be created before "001" is copied
into it.  Instead, the call fails.

--Phil

    Hewlett-Packard: High Performance Technical Computing/Visualization
---------------------------------------------------------------------------
Phillip.Ezolt at hp.com                                Performance/Development
-------------- next part --------------
Index: shell32/shlfileop.c
===================================================================
RCS file: /home/wine/wine/dlls/shell32/shlfileop.c,v
retrieving revision 1.38
diff -u -r1.38 shlfileop.c
--- shell32/shlfileop.c	20 Apr 2004 01:12:17 -0000	1.38
+++ shell32/shlfileop.c	28 May 2004 20:14:22 -0000
@@ -1176,9 +1176,15 @@
 	    /* singlesource + no mask */
 	    if (-1 == (ToAttr & ToPathAttr))
 	    {
-                /* Target-dir does not exist, and cannot be created */
-                retCode=0x75;
-                goto shfileop_error;
+	      /* The destination directory for the file doesn't exist, create it. */
+                pToFile[0] = '\0';
+		if (SHCreateDirectoryExW(NULL,pTempTo, NULL))
+		  {
+		    /* Target-dir does not exist, and cannot be created */
+		    retCode=0x75;
+		    goto shfileop_error;
+		  }
+                pToFile[0] = '\\';
 	    }
 
 	    switch(FuncSwitch)


More information about the wine-devel mailing list