kernel32: Don't call from A to W function in Get/SetCurrentDirectory.

This commit is contained in:
Alexandre Julliard 2013-08-18 19:57:05 +02:00
parent e3e1284557
commit fe64e21e3b

View File

@ -1502,10 +1502,9 @@ UINT WINAPI GetCurrentDirectoryA( UINT buflen, LPSTR buf )
return 0; return 0;
} }
ret = GetCurrentDirectoryW(MAX_PATH, bufferW); ret = RtlGetCurrentDirectory_U( sizeof(bufferW), bufferW );
if (!ret) return 0; if (!ret) return 0;
if (ret > MAX_PATH) if (ret > sizeof(bufferW))
{ {
SetLastError(ERROR_FILENAME_EXCED_RANGE); SetLastError(ERROR_FILENAME_EXCED_RANGE);
return 0; return 0;
@ -1524,12 +1523,8 @@ BOOL WINAPI SetCurrentDirectoryW( LPCWSTR dir )
RtlInitUnicodeString( &dirW, dir ); RtlInitUnicodeString( &dirW, dir );
status = RtlSetCurrentDirectory_U( &dirW ); status = RtlSetCurrentDirectory_U( &dirW );
if (status != STATUS_SUCCESS) if (status != STATUS_SUCCESS) SetLastError( RtlNtStatusToDosError(status) );
{ return !status;
SetLastError( RtlNtStatusToDosError(status) );
return FALSE;
}
return TRUE;
} }
@ -1539,9 +1534,14 @@ BOOL WINAPI SetCurrentDirectoryW( LPCWSTR dir )
BOOL WINAPI SetCurrentDirectoryA( LPCSTR dir ) BOOL WINAPI SetCurrentDirectoryA( LPCSTR dir )
{ {
WCHAR *dirW; WCHAR *dirW;
UNICODE_STRING strW;
NTSTATUS status;
if (!(dirW = FILE_name_AtoW( dir, FALSE ))) return FALSE; if (!(dirW = FILE_name_AtoW( dir, FALSE ))) return FALSE;
return SetCurrentDirectoryW( dirW ); RtlInitUnicodeString( &strW, dirW );
status = RtlSetCurrentDirectory_U( &strW );
if (status != STATUS_SUCCESS) SetLastError( RtlNtStatusToDosError(status) );
return !status;
} }