mirror of
git://source.winehq.org/git/wine.git
synced 2024-09-15 03:04:47 +00:00
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 )
|
static WCHAR *get_dos_file_name( LPCSTR str )
|
||||||
{
|
{
|
||||||
WCHAR *buffer;
|
WCHAR *buffer;
|
||||||
SIZE_T len = strlen(str) + 1;
|
ULONG len = strlen(str) + 1;
|
||||||
|
|
||||||
len += 8; /* \??\unix prefix */
|
len += 8; /* \??\unix prefix */
|
||||||
if (!(buffer = RtlAllocateHeap( GetProcessHeap(), 0, len * sizeof(WCHAR) ))) return NULL;
|
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 )
|
static char *get_unix_file_name( LPCWSTR dosW )
|
||||||
{
|
{
|
||||||
UNICODE_STRING nt_name;
|
UNICODE_STRING nt_name;
|
||||||
|
OBJECT_ATTRIBUTES attr;
|
||||||
NTSTATUS status;
|
NTSTATUS status;
|
||||||
SIZE_T size = 256;
|
ULONG size = 256;
|
||||||
char *buffer;
|
char *buffer;
|
||||||
|
|
||||||
if (!RtlDosPathNameToNtPathName_U( dosW, &nt_name, NULL, NULL )) return NULL;
|
if (!RtlDosPathNameToNtPathName_U( dosW, &nt_name, NULL, NULL )) return NULL;
|
||||||
|
InitializeObjectAttributes( &attr, &nt_name, 0, 0, NULL );
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
if (!(buffer = RtlAllocateHeap( GetProcessHeap(), 0, size )))
|
if (!(buffer = RtlAllocateHeap( GetProcessHeap(), 0, size )))
|
||||||
|
@ -1386,7 +1388,7 @@ static char *get_unix_file_name( LPCWSTR dosW )
|
||||||
RtlFreeUnicodeString( &nt_name );
|
RtlFreeUnicodeString( &nt_name );
|
||||||
return NULL;
|
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;
|
if (status != STATUS_BUFFER_TOO_SMALL) break;
|
||||||
RtlFreeHeap( GetProcessHeap(), 0, buffer );
|
RtlFreeHeap( GetProcessHeap(), 0, buffer );
|
||||||
}
|
}
|
||||||
|
|
|
@ -275,11 +275,13 @@ DWORD /*BOOLEAN*/ WINAPI KERNEL32_Wow64EnableWow64FsRedirection( BOOLEAN enable
|
||||||
char * CDECL wine_get_unix_file_name( LPCWSTR dosW )
|
char * CDECL wine_get_unix_file_name( LPCWSTR dosW )
|
||||||
{
|
{
|
||||||
UNICODE_STRING nt_name;
|
UNICODE_STRING nt_name;
|
||||||
|
OBJECT_ATTRIBUTES attr;
|
||||||
NTSTATUS status;
|
NTSTATUS status;
|
||||||
SIZE_T size = 256;
|
ULONG size = 256;
|
||||||
char *buffer;
|
char *buffer;
|
||||||
|
|
||||||
if (!RtlDosPathNameToNtPathName_U( dosW, &nt_name, NULL, NULL )) return NULL;
|
if (!RtlDosPathNameToNtPathName_U( dosW, &nt_name, NULL, NULL )) return NULL;
|
||||||
|
InitializeObjectAttributes( &attr, &nt_name, 0, 0, NULL );
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
if (!(buffer = HeapAlloc( GetProcessHeap(), 0, size )))
|
if (!(buffer = HeapAlloc( GetProcessHeap(), 0, size )))
|
||||||
|
@ -287,7 +289,7 @@ char * CDECL wine_get_unix_file_name( LPCWSTR dosW )
|
||||||
RtlFreeUnicodeString( &nt_name );
|
RtlFreeUnicodeString( &nt_name );
|
||||||
return NULL;
|
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;
|
if (status != STATUS_BUFFER_TOO_SMALL) break;
|
||||||
HeapFree( GetProcessHeap(), 0, buffer );
|
HeapFree( GetProcessHeap(), 0, buffer );
|
||||||
}
|
}
|
||||||
|
@ -313,7 +315,7 @@ WCHAR * CDECL wine_get_dos_file_name( LPCSTR str )
|
||||||
UNICODE_STRING nt_name;
|
UNICODE_STRING nt_name;
|
||||||
NTSTATUS status;
|
NTSTATUS status;
|
||||||
WCHAR *buffer;
|
WCHAR *buffer;
|
||||||
SIZE_T len = strlen(str) + 1;
|
ULONG len = strlen(str) + 1;
|
||||||
|
|
||||||
if (str[0] != '/') /* relative path name */
|
if (str[0] != '/') /* relative path name */
|
||||||
{
|
{
|
||||||
|
|
|
@ -1645,5 +1645,5 @@
|
||||||
@ cdecl wine_get_host_version(ptr ptr)
|
@ cdecl wine_get_host_version(ptr ptr)
|
||||||
|
|
||||||
# Filesystem
|
# Filesystem
|
||||||
@ cdecl -syscall wine_nt_to_unix_file_name(ptr ptr ptr long)
|
@ stdcall -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_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;
|
char *unix_name;
|
||||||
WCHAR *nt_str;
|
WCHAR *nt_str;
|
||||||
SIZE_T buflen;
|
ULONG buflen;
|
||||||
NTSTATUS status;
|
NTSTATUS status;
|
||||||
UNICODE_STRING str;
|
UNICODE_STRING str;
|
||||||
|
OBJECT_ATTRIBUTES attr;
|
||||||
|
|
||||||
nt_str = RtlAllocateHeap( GetProcessHeap(), 0, (wcslen(name) + 9) * sizeof(WCHAR) );
|
nt_str = RtlAllocateHeap( GetProcessHeap(), 0, (wcslen(name) + 9) * sizeof(WCHAR) );
|
||||||
wcscpy( nt_str, L"\\??\\unix" );
|
wcscpy( nt_str, L"\\??\\unix" );
|
||||||
wcscat( nt_str, name );
|
wcscat( nt_str, name );
|
||||||
RtlInitUnicodeString( &str, nt_str );
|
RtlInitUnicodeString( &str, nt_str );
|
||||||
|
InitializeObjectAttributes( &attr, &str, 0, 0, NULL );
|
||||||
buflen = 3 * wcslen(name) + 1;
|
buflen = 3 * wcslen(name) + 1;
|
||||||
unix_name = RtlAllocateHeap( GetProcessHeap(), 0, buflen );
|
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)
|
if (!status || status == STATUS_NO_SUCH_FILE)
|
||||||
{
|
{
|
||||||
buflen = wcslen(name) + 9;
|
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
|
* element doesn't have to exist; in that case STATUS_NO_SUCH_FILE is
|
||||||
* returned, but the unix name is still filled in properly.
|
* 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 )
|
UINT disposition )
|
||||||
{
|
{
|
||||||
char *buffer = NULL;
|
char *buffer = NULL;
|
||||||
NTSTATUS status;
|
NTSTATUS status;
|
||||||
UNICODE_STRING redir;
|
UNICODE_STRING redir;
|
||||||
OBJECT_ATTRIBUTES attr;
|
OBJECT_ATTRIBUTES new_attr = *attr;
|
||||||
|
|
||||||
InitializeObjectAttributes( &attr, (UNICODE_STRING *)nameW, OBJ_CASE_INSENSITIVE, 0, NULL );
|
get_redirect( &new_attr, &redir );
|
||||||
get_redirect( &attr, &redir );
|
status = nt_to_unix_file_name( &new_attr, &buffer, disposition );
|
||||||
status = nt_to_unix_file_name( &attr, &buffer, disposition );
|
|
||||||
|
|
||||||
if (buffer)
|
if (buffer)
|
||||||
{
|
{
|
||||||
|
@ -3576,7 +3575,7 @@ NTSTATUS unix_to_nt_file_name( const char *name, WCHAR **nt )
|
||||||
/******************************************************************
|
/******************************************************************
|
||||||
* wine_unix_to_nt_file_name
|
* 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;
|
WCHAR *nt_name = NULL;
|
||||||
NTSTATUS status;
|
NTSTATUS status;
|
||||||
|
|
|
@ -4508,9 +4508,9 @@ NTSYSAPI void WINAPI TpWaitForWork(TP_WORK *,BOOL);
|
||||||
|
|
||||||
/* Wine internal functions */
|
/* 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 );
|
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 a new issue