PRB: SetCurrentDirectory Fails on a CD-ROM Drive on Win32sLast reviewed: January 20, 1995Article ID: Q125013 |
The information in this articles applies to:
SYMPTOMSIn the following code, assuming that drive E corresponds to a CD-ROM drive, SetCurrentDirectory() always fails to set the current directory to the root directory on the CD-ROM drive. Instead the current directory remains unchanged:
char szCurDir[256]; SetCurrentDirectory("E:\\"); GetCurrentDirectory(sizeof(szCurDir),szCurDir); MessageBox(NULL, szCurDir, "SCD", MB_OK); CAUSESetCurrentDirectory() calls the MS-DOS Interrupt 21h, function 0x4300 to get the file attributes of the specified drive to check whether the specified parameter is a directory. This MS-DOS call always fails if you try to get the attributes of the root directory on a CD-ROM drive, and therefore SetCurrentDirectory() also fails on the root directory of a CD- ROM drive.
STATUSMicrosoft is aware of this problem with SetCurrentDirectory() in Win32s. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.
RESOLUTIONAs a workaround for the problem with SetCurrentDirectory(), thunk to the 16- bit environment and utilize MS-DOS functions from a 16-bit DLL. For example, you can use Interrupt 21h, function 0x0E (Set Default Drive) followed by Interrupt 21h, function 0x3Bh (Change Current Directory).
MORE INFORMATIONNote that SetCurrentDirectory() fails only on the root directory of a CD- ROM drive. If you pass any directory path other than the root directory to SetCurrentDirectory(), it will work properly. This is a problem with MS-DOS and can be reproduced from an MS-DOS application in Windows version 3.1.
|
Additional reference words: 1.00 1.10 1.20 win32s
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |