ntdll: Return STATUS_OBJECT_NAME_INVALID in wine_nt_to_unix_file_name for prefix-only paths.

Signed-off-by: Michael Müller <michael@fds-team.de>
Signed-off-by: Sebastian Lackner <sebastian@fds-team.de>
This commit is contained in:
Michael Müller 2015-09-25 13:35:58 +02:00 committed by Alexandre Julliard
parent 24ea49b6ab
commit 00d966cd3a
3 changed files with 9 additions and 7 deletions

View File

@ -4661,7 +4661,7 @@ static void test_GetFileAttributesExW(void)
SetLastError(0xdeadbeef);
ret = GetFileAttributesExW(path1, GetFileExInfoStandard, &info);
ok(!ret, "GetFileAttributesExW succeeded\n");
todo_wine ok(GetLastError() == ERROR_INVALID_NAME, "Expected error ERROR_INVALID_NAME, got %u\n", GetLastError());
ok(GetLastError() == ERROR_INVALID_NAME, "Expected error ERROR_INVALID_NAME, got %u\n", GetLastError());
SetLastError(0xdeadbeef);
ret = GetFileAttributesExW(path2, GetFileExInfoStandard, &info);

View File

@ -2762,11 +2762,11 @@ static inline int get_dos_prefix_len( const UNICODE_STRING *name )
static const WCHAR nt_prefixW[] = {'\\','?','?','\\'};
static const WCHAR dosdev_prefixW[] = {'\\','D','o','s','D','e','v','i','c','e','s','\\'};
if (name->Length > sizeof(nt_prefixW) &&
if (name->Length >= sizeof(nt_prefixW) &&
!memcmp( name->Buffer, nt_prefixW, sizeof(nt_prefixW) ))
return sizeof(nt_prefixW) / sizeof(WCHAR);
if (name->Length > sizeof(dosdev_prefixW) &&
if (name->Length >= sizeof(dosdev_prefixW) &&
!memicmpW( name->Buffer, dosdev_prefixW, sizeof(dosdev_prefixW)/sizeof(WCHAR) ))
return sizeof(dosdev_prefixW) / sizeof(WCHAR);
@ -3132,6 +3132,8 @@ NTSTATUS CDECL wine_nt_to_unix_file_name( const UNICODE_STRING *nameW, ANSI_STRI
name += pos;
name_len -= pos;
if (!name_len) return STATUS_OBJECT_NAME_INVALID;
/* check for sub-directory */
for (pos = 0; pos < name_len; pos++)
{

View File

@ -318,8 +318,8 @@ static void create_file_test(void)
"open %s failed %x\n", wine_dbgstr_w(nameW.Buffer), status );
status = pNtQueryFullAttributesFile( &attr, &info );
todo_wine ok( status == STATUS_OBJECT_NAME_INVALID,
"query %s failed %x\n", wine_dbgstr_w(nameW.Buffer), status );
ok( status == STATUS_OBJECT_NAME_INVALID,
"query %s failed %x\n", wine_dbgstr_w(nameW.Buffer), status );
pRtlInitUnicodeString( &nameW, pathInvalidDosW );
status = pNtCreateFile( &dir, GENERIC_READ|SYNCHRONIZE, &attr, &io, NULL, 0,
@ -329,8 +329,8 @@ static void create_file_test(void)
"open %s failed %x\n", wine_dbgstr_w(nameW.Buffer), status );
status = pNtQueryFullAttributesFile( &attr, &info );
todo_wine ok( status == STATUS_OBJECT_NAME_INVALID,
"query %s failed %x\n", wine_dbgstr_w(nameW.Buffer), status );
ok( status == STATUS_OBJECT_NAME_INVALID,
"query %s failed %x\n", wine_dbgstr_w(nameW.Buffer), status );
}
static void open_file_test(void)