Commit 95012151 authored by Mike Hearn's avatar Mike Hearn Committed by Alexandre Julliard

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

VxD on NT, add a test case.
parent 0394eeed
...@@ -637,6 +637,7 @@ static void test_CreateFileW(void) ...@@ -637,6 +637,7 @@ static void test_CreateFileW(void)
WCHAR filename[MAX_PATH]; WCHAR filename[MAX_PATH];
static const WCHAR emptyW[]={'\0'}; static const WCHAR emptyW[]={'\0'};
static const WCHAR prefix[] = {'p','f','x',0}; static const WCHAR prefix[] = {'p','f','x',0};
static const WCHAR bogus[] = { '\\', '\\', '.', '\\', 'B', 'O', 'G', 'U', 'S', 0 };
DWORD ret; DWORD ret;
ret = GetTempPathW(MAX_PATH, temp_path); ret = GetTempPathW(MAX_PATH, temp_path);
...@@ -665,6 +666,12 @@ static void test_CreateFileW(void) ...@@ -665,6 +666,12 @@ static void test_CreateFileW(void)
CREATE_NEW, FILE_FLAG_RANDOM_ACCESS, 0); CREATE_NEW, FILE_FLAG_RANDOM_ACCESS, 0);
ok(hFile == INVALID_HANDLE_VALUE && GetLastError() == ERROR_PATH_NOT_FOUND, ok(hFile == INVALID_HANDLE_VALUE && GetLastError() == ERROR_PATH_NOT_FOUND,
"CreateFileW(\"\") returned ret=%p error=%ld\n",hFile,GetLastError()); "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() static void test_GetTempFileNameA()
......
...@@ -182,7 +182,7 @@ HANDLE VXD_Open( LPCWSTR filenameW, DWORD access, SECURITY_ATTRIBUTES *sa ) ...@@ -182,7 +182,7 @@ HANDLE VXD_Open( LPCWSTR filenameW, DWORD access, SECURITY_ATTRIBUTES *sa )
if (!(GetVersion() & 0x80000000)) /* there are no VxDs on NT */ if (!(GetVersion() & 0x80000000)) /* there are no VxDs on NT */
{ {
SetLastError( ERROR_INVALID_PARAMETER ); SetLastError( ERROR_FILE_NOT_FOUND );
return 0; return 0;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment