From: Holman, A. <All...@so...> - 2002-11-21 14:03:36
|
Hello, I have a few questions about how SHFileOperation works with mingw. When using it to copy files, you are supposed to set pFrom as follows - shFileOp.pFrom =3D "C:\\test1\0c:\\temp\\test2\0"; Multiple files are supposed to be separated by NULL with an extra NULL at the end. Unfortunately this operation has only functioned properly for me if I do one file at a time. Also, if I use the FOF_SIMPLEPROGRESS flag along with setting lpszProgressTitle the program will crash when run with an Access Violation (the debugger tells me that it happens with MultiByteToWideChar in kernel32.dll) Any idea on what might be causing these problems? Thanks -allen |
From: Andrew S. <ac...@sy...> - 2002-11-22 04:16:57
|
>-----Original Message----- >From: min...@li... >[mailto:min...@li...]On Behalf Of Holman, >Allen >Sent: November 21, 2002 09:03 >To: min...@li... >Subject: [Mingw-users] SHFileOperation & mingw > <snipped> > >Also, if I use the FOF_SIMPLEPROGRESS flag along with setting >lpszProgressTitle the program will crash when run with an Access >Violation (the debugger tells me that it happens with >MultiByteToWideChar in kernel32.dll) > >Any idea on what might be causing these problems? > Turns out to be the alignment of the structures. I don't have a copy of the latest headers from cvs (troubles with my connection) so I haven't checked those, but if you apply the following patch to the 2.0.0-3 supplied headers, it should fix the issue (tested both ansi & unicode versions). --------cut here--------cut here-------- --- shellapi.h.orig Thu Nov 21 23:00:10 2002 +++ shellapi.h Thu Nov 21 23:01:14 2002 @@ -154,6 +154,7 @@ HANDLE hIcon; HANDLE hProcess; } SHELLEXECUTEINFOW,*LPSHELLEXECUTEINFOW; +#include <pshpack2.h> typedef struct _SHFILEOPSTRUCTA { HWND hwnd; UINT wFunc; @@ -174,6 +175,7 @@ PVOID hNameMappings; LPCWSTR lpszProgressTitle; } SHFILEOPSTRUCTW,*LPSHFILEOPSTRUCTW; +#include <poppack.h> typedef struct _SHFILEINFOA { HICON hIcon; int iIcon; --------cut here--------cut here-------- HTH, Andrew. |