Correct error code returned by CreateFile when given a non-existent

VxD on NT, add a test case.
This commit is contained in:
Mike Hearn 2004-07-06 21:31:24 +00:00 committed by Alexandre Julliard
parent 0394eeed8d
commit 95012151f9
2 changed files with 8 additions and 1 deletions

View File

@ -637,6 +637,7 @@ static void test_CreateFileW(void)
WCHAR filename[MAX_PATH];
static const WCHAR emptyW[]={'\0'};
static const WCHAR prefix[] = {'p','f','x',0};
static const WCHAR bogus[] = { '\\', '\\', '.', '\\', 'B', 'O', 'G', 'U', 'S', 0 };
DWORD ret;
ret = GetTempPathW(MAX_PATH, temp_path);
@ -665,6 +666,12 @@ static void test_CreateFileW(void)
CREATE_NEW, FILE_FLAG_RANDOM_ACCESS, 0);
ok(hFile == INVALID_HANDLE_VALUE && GetLastError() == ERROR_PATH_NOT_FOUND,
"CreateFileW(\"\") returned ret=%p error=%ld\n",hFile,GetLastError());
/* test the result of opening a non-existent driver name */
hFile = CreateFileW(bogus, 0, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL,
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
ok(hFile == INVALID_HANDLE_VALUE && GetLastError() == ERROR_FILE_NOT_FOUND,
"CreateFileW on invalid VxD name returned ret=%p error=%ld\n",hFile,GetLastError());
}
static void test_GetTempFileNameA()

View File

@ -182,7 +182,7 @@ HANDLE VXD_Open( LPCWSTR filenameW, DWORD access, SECURITY_ATTRIBUTES *sa )
if (!(GetVersion() & 0x80000000)) /* there are no VxDs on NT */
{
SetLastError( ERROR_INVALID_PARAMETER );
SetLastError( ERROR_FILE_NOT_FOUND );
return 0;
}