kernel32: Don't call from A to W function in Get/SetCurrentDirectory.
This commit is contained in:
parent
e3e1284557
commit
fe64e21e3b
|
@ -1502,10 +1502,9 @@ UINT WINAPI GetCurrentDirectoryA( UINT buflen, LPSTR buf )
|
|||
return 0;
|
||||
}
|
||||
|
||||
ret = GetCurrentDirectoryW(MAX_PATH, bufferW);
|
||||
|
||||
ret = RtlGetCurrentDirectory_U( sizeof(bufferW), bufferW );
|
||||
if (!ret) return 0;
|
||||
if (ret > MAX_PATH)
|
||||
if (ret > sizeof(bufferW))
|
||||
{
|
||||
SetLastError(ERROR_FILENAME_EXCED_RANGE);
|
||||
return 0;
|
||||
|
@ -1524,12 +1523,8 @@ BOOL WINAPI SetCurrentDirectoryW( LPCWSTR dir )
|
|||
|
||||
RtlInitUnicodeString( &dirW, dir );
|
||||
status = RtlSetCurrentDirectory_U( &dirW );
|
||||
if (status != STATUS_SUCCESS)
|
||||
{
|
||||
SetLastError( RtlNtStatusToDosError(status) );
|
||||
return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
if (status != STATUS_SUCCESS) SetLastError( RtlNtStatusToDosError(status) );
|
||||
return !status;
|
||||
}
|
||||
|
||||
|
||||
|
@ -1539,9 +1534,14 @@ BOOL WINAPI SetCurrentDirectoryW( LPCWSTR dir )
|
|||
BOOL WINAPI SetCurrentDirectoryA( LPCSTR dir )
|
||||
{
|
||||
WCHAR *dirW;
|
||||
UNICODE_STRING strW;
|
||||
NTSTATUS status;
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue