BUG: Using Wildcard Extension with SHFileOperation

Last reviewed: March 20, 1998
Article ID: Q182820
The information in this article applies to:
  • Microsoft Win32 Software Development Kit (SDK) on the following platforms:

    - Windows NT version 4.0

    - Windows 95

  • Microsoft Internet Explorer (Programming), versions 4.0, 4.01

SYMPTOMS

When you use the "*" wildcard for the extension in the target file name (pTo member of the SHFILEOPSTRUCT) in SHFileOperaiton, a message box with the following text appears:

   The source and destination filenames are the same.

In addition, no files are moved or copied. This bug is only present when you have Internet Explorer 4.0 or 4.01 with the desktop update installed.

RESOLUTION

The only way to workaround this bug is to build the source and target file name lists without using wildcards.

STATUS

Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. We are researching this bug and will post new information here in the Microsoft Knowledge Base as it becomes available.

MORE INFORMATION

Sample Code

The following code exposes this bug:

   SHFILEOPSTRUCT  sfo;
   char szSource[MAX_PATH];
   char szDest[MAX_PATH];

   lstrcpy(szSource,"c:\\test\\file.*");
   lstrcpy(szDest,"c:\\newfile.*");
   szSource[lstrlen(szSource)+1] = 0;
   szDest[lstrlen(szDest)+1] = 0;

   sfo.hwnd = NULL;
   sfo.wFunc = FO_COPY;
   sfo.pFrom = (LPCSTR)szSource;
   sfo.pTo = (LPCSTR)szDest;
   sfo.fFlags = FOF_NOCONFIRMATION |
                  FOF_SIMPLEPROGRESS |
                  FOF_NOCONFIRMMKDIR |
                  FOF_MULTIDESTFILES;
   sfo.hNameMappings = 0;
   sfo.lpszProgressTitle = "test";
   int res = SHFileOperation(&sfo);
Keywords          : KBShell kbcode
Version           : WINDOWS:4.0,4.01;WINNT:4.0;WIN95;
Platform          : Win95 WINDOWS winnt
Issue type        : kbbug
Solution Type     : kbpending


================================================================================


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: March 20, 1998
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.