winedos / Migrate current drive routines and add date conversions

Jukka Heinonen jhei at iki.fi
Mon May 12 13:12:50 CDT 2003


György 'Nog' Jeney wrote:
> Could someone please explain to me why it is not possible to reimplement
> DRIVE_GetCurrentDrive in winedos like this, it looks quite simple and
> straight forward:
>
> int GetCurrentDrive()
> {
>   char root[MAX_PATH];
>   GetCurrentDirectoryA(MAX_PATH, root);
>   return toupper(*root) - 'A';
> }
>
> and the same question for DRIVE_SetCurrentDrive:
>
> void SetCurrentDrive(int drive)
> {
>   char drive[] = "A:";
>   *drive += drive;
>   SetCurrentDirectoryA(drive);
> }

Well, I thought SetCurrentDirectory didn't work like that,
but if it does then there is no reason why that implementation
couldn't be used. GetCurrentDrive ought to verify that second 
character is indeed ':' (preparing for UNC names) but that should 
work, too. Using wide character versions would be preferred, though.

So, I guess those routines should work. Perhaps I should rewrite my
patch in order to make use of this kind of routines instead of exporting
stuff from ntdll.

-- 
Jukka Heinonen <http://www.iki.fi/jhei/>



More information about the wine-devel mailing list