ntoskrnl: Add a test for a failing to load driver.

Signed-off-by: Dmitry Timoshkov <dmitry@baikal.ru>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Dmitry Timoshkov 2018-09-06 17:01:28 +08:00 committed by Alexandre Julliard
parent 8a20d6e83d
commit ffbb44b01f
4 changed files with 58 additions and 0 deletions

View File

@ -5,10 +5,14 @@ driver_IMPORTS = winecrt0 ntoskrnl
driver_EXTRADLLFLAGS = -nodefaultlibs -nostartfiles -Wl,--subsystem,native
driver2_IMPORTS = winecrt0 ntoskrnl
driver2_EXTRADLLFLAGS = -nodefaultlibs -nostartfiles -Wl,--subsystem,native
driver3_IMPORTS = winecrt0 ntoskrnl
driver3_EXTRADLLFLAGS = -nodefaultlibs -nostartfiles -Wl,--subsystem,native
SOURCES = \
driver.c \
driver.spec \
driver2.c \
driver2.spec \
driver3.c \
driver3.spec \
ntoskrnl.c

View File

@ -0,0 +1,31 @@
/*
* Copyright 2018 Dmitry Timoshkov
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <stdarg.h>
#include "ntstatus.h"
#define WIN32_NO_STATUS
#include "winternl.h"
#include "ddk/wdm.h"
NTSTATUS WINAPI DriverEntry(DRIVER_OBJECT *obj, UNICODE_STRING *path)
{
DbgPrint("driver3: DriverEntry\n");
return STATUS_NOT_IMPLEMENTED;
}

View File

@ -0,0 +1 @@
# nothing here yet

View File

@ -219,6 +219,26 @@ static void test_load_driver(SC_HANDLE service)
ok(status.dwCurrentState == SERVICE_STOPPED, "got state %#x\n", status.dwCurrentState);
}
static void test_driver3(void)
{
char filename[MAX_PATH];
SC_HANDLE service;
BOOL ret;
service = load_driver(filename, "driver3.dll", "WineTestDriver3");
ok(service != NULL, "driver3 failed to load\n");
ret = StartServiceA(service, 0, NULL);
ok(!ret, "driver3 should fail to start\n");
todo_wine
ok(GetLastError() == ERROR_CALL_NOT_IMPLEMENTED || GetLastError() == ERROR_PROC_NOT_FOUND /* XP */ ||
GetLastError() == ERROR_FILE_NOT_FOUND /* Win7 */, "got %u\n", GetLastError());
DeleteService(service);
CloseServiceHandle(service);
DeleteFileA(filename);
}
START_TEST(ntoskrnl)
{
char filename[MAX_PATH], filename2[MAX_PATH];
@ -247,4 +267,6 @@ START_TEST(ntoskrnl)
unload_driver(service);
ok(DeleteFileA(filename), "DeleteFile failed: %u\n", GetLastError());
ok(DeleteFileA(filename2), "DeleteFile failed: %u\n", GetLastError());
test_driver3();
}