Exported from Bugzilla, issue 4098.
--- Comment added on 11/18/02 11:19:13 AM ---
After installation of Internet Explorer 6 on evidently ANY win32 platform (or
if IE6 is the default for the OS, e.g. for WinXP), the SHFileOperation API
starts throwing an error when copying files:
this is propagated out of TStFileOperation and has caused some customer
distress.
To reproduce using the API:
Customer report:
Actually, I was able to reproduce this using straight calls to
SHFileOperation under Visual C++ with the following code:
int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
SHFILEOPSTRUCT fileOp;
HRESULT res;
fileOp.hwnd = NULL;
fileOp.wFunc = FO_COPY;
fileOp.pFrom = "E:\\testfile.zip\0\0";
fileOp.pTo = "Z:\\testfile.zip\0\0";
fileOp.fFlags = FOF_ALLOWUNDO | FOF_FILESONLY;
fileOp.hNameMappings = 0;
fileOp.lpszProgressTitle = "Title";
res = SHFileOperation(&fileOp);
res = GetLastError(); // At this point "res" = 6 under IE6
printf("res: %d", res);
return 0;
}
"Stephen Posey [TurboPower Software]" <stephenp@turbopower.com> wrote in
message news:3C471611.F29BEED5@turbopower.com...
> rcf2 wrote:
> >
> > Has anyone had any problems with SysTools implementation of shFileOperation?
> > The problem I am having is that I get an error everytime when copying a file
> > with IE6 installed. After systools calls SHFileOperation() it then calls a
> > routine called CheckSystemError(Res).
> >
> > The CheckSystemError routine checks the result of the SHFileOperation (res).
> > Then if it is 0 it checks GetLastError.
> >
> > procedure TStShellComponent.CheckSystemError(ErrCode : Integer);
> > var
> > Buff : array [0..1023] of Char;
> > begin
> > if ErrCode <> 0 then
> > FError := ErrCode
> > else
> > FError := GetLastError;
> > .......
> >
> > The problem arises when IE6 is installed. For me, on two different machines
> > with IE6, GetLastError returns 6 (The handle is Invalid) when called after a
> > successful SHFileOperation (ie, SHFileOperation() = 0)
> >
> > With the same code under IE5 there is no problem. GetLastError returns 0.
>
> Yup, known problem.
>
> Oddly enough, calling SHFileOperation directly doesn't seem to cause the
> problem; so, presumably, it's somewhere in the TStFileOperation.Execute
> method setup.
>
>
> We're still trying to work out exactly where the difference arises.
>
> Thanks for the report.
>
> Stephen Posey [TurboPower Software]
> --
> Please respond to the newsgroups and not via email.
> This way, everyone benefits from knowing what was said.
> Replies to mailsupport@turbopower.com will be copied back
> to the newsgroup.
-------------------->8 cut here 8<--------------------
Customer John Wargo in a phone conversation says that he's seen reports on the
NET that this error can be addressed by properly zeroing the file name buffers
prior to calling the API.
Logged In: YES
user_id=730610
I'm getting the same error on fopDelete. Oddly, I get it only
once, no matter how many files are in the SourceFiles list.