Made GetCurrentDirectory return long name of the current directory.

This commit is contained in:
Abey George 1999-09-27 11:39:43 +00:00 committed by Alexandre Julliard
parent 61b15de4ba
commit 70810d97d5
1 changed files with 27 additions and 14 deletions

View File

@ -685,6 +685,27 @@ static int DRIVE_GetFreeSpace( int drive, PULARGE_INTEGER size,
return 1;
}
/*
* DRIVE_GetCurrentDirectory
* Returns "X:\\path\\etc\\".
*
* Despite the API description, return required length including the
* terminating null when buffer too small. This is the real behaviour.
*/
static UINT DRIVE_GetCurrentDirectory( UINT buflen, LPSTR buf )
{
UINT ret;
const char *s = DRIVE_GetDosCwd( DRIVE_GetCurrentDrive() );
assert(s);
ret = strlen(s) + 3; /* length of WHOLE current directory */
if (ret >= buflen) return ret + 1;
lstrcpynA( buf, "A:\\", MIN( 4, buflen ) );
if (buflen) buf[0] += DRIVE_GetCurrentDrive();
if (buflen > 3) lstrcpynA( buf + 3, s, buflen - 3 );
return ret;
}
/***********************************************************************
* GetDiskFreeSpace16 (KERNEL.422)
@ -1000,33 +1021,25 @@ UINT WINAPI GetDriveTypeW( LPCWSTR root )
*/
UINT16 WINAPI GetCurrentDirectory16( UINT16 buflen, LPSTR buf )
{
return (UINT16)GetCurrentDirectoryA( buflen, buf );
return (UINT16)DRIVE_GetCurrentDirectory(buflen, buf);
}
/***********************************************************************
* GetCurrentDirectory32A (KERNEL32.196)
*
* Returns "X:\\path\\etc\\".
*
* Despite the API description, return required length including the
* terminating null when buffer too small. This is the real behaviour.
*/
UINT WINAPI GetCurrentDirectoryA( UINT buflen, LPSTR buf )
{
UINT ret;
const char *s = DRIVE_GetDosCwd( DRIVE_GetCurrentDrive() );
char longname[MAX_PATHNAME_LEN];
ret = DRIVE_GetCurrentDirectory(buflen, buf);
GetLongPathNameA(buf, longname, buflen);
lstrcpyA(buf, longname);
assert(s);
ret = strlen(s) + 3; /* length of WHOLE current directory */
if (ret >= buflen) return ret + 1;
lstrcpynA( buf, "A:\\", MIN( 4, buflen ) );
if (buflen) buf[0] += DRIVE_GetCurrentDrive();
if (buflen > 3) lstrcpynA( buf + 3, s, buflen - 3 );
return ret;
}
/***********************************************************************
* GetCurrentDirectory32W (KERNEL32.197)
*/