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.
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.
Ok, I've had time to check this on win98 and SetCurrentDirectory doesn't work like this. This is doable as its done in wcmd: G:\wine\programs\wcmd>c: C:>cd windows C:\windows>g: G:\wine\programs\wcmd>c: C:\windows>
nog.