ntdll: Make wine_nt_to_unix_file_name() and wine_unix_to_nt_file_name() follow NT syscall conventions.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
37ed43a171
commit
9bf46d5ce6
|
@ -1352,7 +1352,7 @@ static int add_unix_face( const char *unix_name, const WCHAR *file, void *data_p
|
|||
static WCHAR *get_dos_file_name( LPCSTR str )
|
||||
{
|
||||
WCHAR *buffer;
|
||||
SIZE_T len = strlen(str) + 1;
|
||||
ULONG len = strlen(str) + 1;
|
||||
|
||||
len += 8; /* \??\unix prefix */
|
||||
if (!(buffer = RtlAllocateHeap( GetProcessHeap(), 0, len * sizeof(WCHAR) ))) return NULL;
|
||||
|
@ -1374,11 +1374,13 @@ static WCHAR *get_dos_file_name( LPCSTR str )
|
|||
static char *get_unix_file_name( LPCWSTR dosW )
|
||||
{
|
||||
UNICODE_STRING nt_name;
|
||||
OBJECT_ATTRIBUTES attr;
|
||||
NTSTATUS status;
|
||||
SIZE_T size = 256;
|
||||
ULONG size = 256;
|
||||
char *buffer;
|
||||
|
||||
if (!RtlDosPathNameToNtPathName_U( dosW, &nt_name, NULL, NULL )) return NULL;
|
||||
InitializeObjectAttributes( &attr, &nt_name, 0, 0, NULL );
|
||||
for (;;)
|
||||
{
|
||||
if (!(buffer = RtlAllocateHeap( GetProcessHeap(), 0, size )))
|
||||
|
@ -1386,7 +1388,7 @@ static char *get_unix_file_name( LPCWSTR dosW )
|
|||
RtlFreeUnicodeString( &nt_name );
|
||||
return NULL;
|
||||
}
|
||||
status = wine_nt_to_unix_file_name( &nt_name, buffer, &size, FILE_OPEN_IF );
|
||||
status = wine_nt_to_unix_file_name( &attr, buffer, &size, FILE_OPEN_IF );
|
||||
if (status != STATUS_BUFFER_TOO_SMALL) break;
|
||||
RtlFreeHeap( GetProcessHeap(), 0, buffer );
|
||||
}
|
||||
|
|
|
@ -275,11 +275,13 @@ DWORD /*BOOLEAN*/ WINAPI KERNEL32_Wow64EnableWow64FsRedirection( BOOLEAN enable
|
|||
char * CDECL wine_get_unix_file_name( LPCWSTR dosW )
|
||||
{
|
||||
UNICODE_STRING nt_name;
|
||||
OBJECT_ATTRIBUTES attr;
|
||||
NTSTATUS status;
|
||||
SIZE_T size = 256;
|
||||
ULONG size = 256;
|
||||
char *buffer;
|
||||
|
||||
if (!RtlDosPathNameToNtPathName_U( dosW, &nt_name, NULL, NULL )) return NULL;
|
||||
InitializeObjectAttributes( &attr, &nt_name, 0, 0, NULL );
|
||||
for (;;)
|
||||
{
|
||||
if (!(buffer = HeapAlloc( GetProcessHeap(), 0, size )))
|
||||
|
@ -287,7 +289,7 @@ char * CDECL wine_get_unix_file_name( LPCWSTR dosW )
|
|||
RtlFreeUnicodeString( &nt_name );
|
||||
return NULL;
|
||||
}
|
||||
status = wine_nt_to_unix_file_name( &nt_name, buffer, &size, FILE_OPEN_IF );
|
||||
status = wine_nt_to_unix_file_name( &attr, buffer, &size, FILE_OPEN_IF );
|
||||
if (status != STATUS_BUFFER_TOO_SMALL) break;
|
||||
HeapFree( GetProcessHeap(), 0, buffer );
|
||||
}
|
||||
|
@ -313,7 +315,7 @@ WCHAR * CDECL wine_get_dos_file_name( LPCSTR str )
|
|||
UNICODE_STRING nt_name;
|
||||
NTSTATUS status;
|
||||
WCHAR *buffer;
|
||||
SIZE_T len = strlen(str) + 1;
|
||||
ULONG len = strlen(str) + 1;
|
||||
|
||||
if (str[0] != '/') /* relative path name */
|
||||
{
|
||||
|
|
|
@ -1645,5 +1645,5 @@
|
|||
@ cdecl wine_get_host_version(ptr ptr)
|
||||
|
||||
# Filesystem
|
||||
@ cdecl -syscall wine_nt_to_unix_file_name(ptr ptr ptr long)
|
||||
@ cdecl -syscall wine_unix_to_nt_file_name(str ptr ptr)
|
||||
@ stdcall -syscall wine_nt_to_unix_file_name(ptr ptr ptr long)
|
||||
@ stdcall -syscall wine_unix_to_nt_file_name(str ptr ptr)
|
||||
|
|
|
@ -606,17 +606,19 @@ static ULONG get_full_path_helper(LPCWSTR name, LPWSTR buffer, ULONG size)
|
|||
{
|
||||
char *unix_name;
|
||||
WCHAR *nt_str;
|
||||
SIZE_T buflen;
|
||||
ULONG buflen;
|
||||
NTSTATUS status;
|
||||
UNICODE_STRING str;
|
||||
OBJECT_ATTRIBUTES attr;
|
||||
|
||||
nt_str = RtlAllocateHeap( GetProcessHeap(), 0, (wcslen(name) + 9) * sizeof(WCHAR) );
|
||||
wcscpy( nt_str, L"\\??\\unix" );
|
||||
wcscat( nt_str, name );
|
||||
RtlInitUnicodeString( &str, nt_str );
|
||||
InitializeObjectAttributes( &attr, &str, 0, 0, NULL );
|
||||
buflen = 3 * wcslen(name) + 1;
|
||||
unix_name = RtlAllocateHeap( GetProcessHeap(), 0, buflen );
|
||||
status = wine_nt_to_unix_file_name( &str, unix_name, &buflen, FILE_OPEN_IF );
|
||||
status = wine_nt_to_unix_file_name( &attr, unix_name, &buflen, FILE_OPEN_IF );
|
||||
if (!status || status == STATUS_NO_SUCH_FILE)
|
||||
{
|
||||
buflen = wcslen(name) + 9;
|
||||
|
|
|
@ -3435,17 +3435,16 @@ NTSTATUS nt_to_unix_file_name( const OBJECT_ATTRIBUTES *attr, char **name_ret, U
|
|||
* element doesn't have to exist; in that case STATUS_NO_SUCH_FILE is
|
||||
* returned, but the unix name is still filled in properly.
|
||||
*/
|
||||
NTSTATUS CDECL wine_nt_to_unix_file_name( const UNICODE_STRING *nameW, char *nameA, SIZE_T *size,
|
||||
NTSTATUS WINAPI wine_nt_to_unix_file_name( const OBJECT_ATTRIBUTES *attr, char *nameA, ULONG *size,
|
||||
UINT disposition )
|
||||
{
|
||||
char *buffer = NULL;
|
||||
NTSTATUS status;
|
||||
UNICODE_STRING redir;
|
||||
OBJECT_ATTRIBUTES attr;
|
||||
OBJECT_ATTRIBUTES new_attr = *attr;
|
||||
|
||||
InitializeObjectAttributes( &attr, (UNICODE_STRING *)nameW, OBJ_CASE_INSENSITIVE, 0, NULL );
|
||||
get_redirect( &attr, &redir );
|
||||
status = nt_to_unix_file_name( &attr, &buffer, disposition );
|
||||
get_redirect( &new_attr, &redir );
|
||||
status = nt_to_unix_file_name( &new_attr, &buffer, disposition );
|
||||
|
||||
if (buffer)
|
||||
{
|
||||
|
@ -3576,7 +3575,7 @@ NTSTATUS unix_to_nt_file_name( const char *name, WCHAR **nt )
|
|||
/******************************************************************
|
||||
* wine_unix_to_nt_file_name
|
||||
*/
|
||||
NTSTATUS CDECL wine_unix_to_nt_file_name( const char *name, WCHAR *buffer, SIZE_T *size )
|
||||
NTSTATUS WINAPI wine_unix_to_nt_file_name( const char *name, WCHAR *buffer, ULONG *size )
|
||||
{
|
||||
WCHAR *nt_name = NULL;
|
||||
NTSTATUS status;
|
||||
|
|
|
@ -4508,9 +4508,9 @@ NTSYSAPI void WINAPI TpWaitForWork(TP_WORK *,BOOL);
|
|||
|
||||
/* Wine internal functions */
|
||||
|
||||
NTSYSAPI NTSTATUS CDECL wine_nt_to_unix_file_name( const UNICODE_STRING *nameW, char *nameA, SIZE_T *size,
|
||||
NTSYSAPI NTSTATUS WINAPI wine_nt_to_unix_file_name( const OBJECT_ATTRIBUTES *attr, char *nameA, ULONG *size,
|
||||
UINT disposition );
|
||||
NTSYSAPI NTSTATUS CDECL wine_unix_to_nt_file_name( const char *name, WCHAR *buffer, SIZE_T *size );
|
||||
NTSYSAPI NTSTATUS WINAPI wine_unix_to_nt_file_name( const char *name, WCHAR *buffer, ULONG *size );
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
|
|
Loading…
Reference in New Issue