[PATCH 2/5] dinput/tests: Rename HID driver identifiers and files.

Rémi Bernon rbernon at codeweavers.com
Mon Mar 21 03:54:12 CDT 2022


Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
---
 dlls/dinput/tests/Makefile.in                 |  8 ++--
 dlls/dinput/tests/dinput_test.h               |  4 +-
 dlls/dinput/tests/{driver_hid.c => driver.c}  |  0
 .../tests/{driver_hid.spec => driver.spec}    |  0
 dlls/dinput/tests/force_feedback.c            |  4 +-
 dlls/dinput/tests/hid.c                       | 38 ++++++++++++-------
 dlls/dinput/tests/hotplug.c                   |  4 +-
 dlls/dinput/tests/joystick8.c                 | 10 ++---
 8 files changed, 40 insertions(+), 28 deletions(-)
 rename dlls/dinput/tests/{driver_hid.c => driver.c} (100%)
 rename dlls/dinput/tests/{driver_hid.spec => driver.spec} (100%)

diff --git a/dlls/dinput/tests/Makefile.in b/dlls/dinput/tests/Makefile.in
index 5ba0e5be4d7..c1b887f8dcb 100644
--- a/dlls/dinput/tests/Makefile.in
+++ b/dlls/dinput/tests/Makefile.in
@@ -1,15 +1,15 @@
 TESTDLL   = dinput.dll
 IMPORTS   = dinput dinput8 ole32 version user32 advapi32 hid uuid crypt32 newdev setupapi wintrust winmm
 
-driver_hid_IMPORTS = winecrt0 ntoskrnl hal hidclass
-driver_hid_EXTRADLLFLAGS = -nodefaultlibs -nostartfiles -Wl,--subsystem,native
+driver_IMPORTS = winecrt0 ntoskrnl hal hidclass
+driver_EXTRADLLFLAGS = -nodefaultlibs -nostartfiles -Wl,--subsystem,native
 
 SOURCES = \
 	device.c \
 	device8.c \
 	dinput.c \
-	driver_hid.c \
-	driver_hid.spec \
+	driver.c \
+	driver.spec \
 	force_feedback.c \
 	hid.c \
 	hotplug.c \
diff --git a/dlls/dinput/tests/dinput_test.h b/dlls/dinput/tests/dinput_test.h
index 97eed949a36..c0027c07094 100644
--- a/dlls/dinput/tests/dinput_test.h
+++ b/dlls/dinput/tests/dinput_test.h
@@ -52,8 +52,8 @@ extern const WCHAR expect_path_end[];
 extern HINSTANCE instance;
 extern BOOL localized; /* object names get translated */
 
-BOOL pnp_driver_start( const WCHAR *resource );
-void pnp_driver_stop(void);
+BOOL hid_device_start(void);
+void hid_device_stop(void);
 
 void cleanup_registry_keys(void);
 
diff --git a/dlls/dinput/tests/driver_hid.c b/dlls/dinput/tests/driver.c
similarity index 100%
rename from dlls/dinput/tests/driver_hid.c
rename to dlls/dinput/tests/driver.c
diff --git a/dlls/dinput/tests/driver_hid.spec b/dlls/dinput/tests/driver.spec
similarity index 100%
rename from dlls/dinput/tests/driver_hid.spec
rename to dlls/dinput/tests/driver.spec
diff --git a/dlls/dinput/tests/force_feedback.c b/dlls/dinput/tests/force_feedback.c
index ce460147f9d..ca3f6293304 100644
--- a/dlls/dinput/tests/force_feedback.c
+++ b/dlls/dinput/tests/force_feedback.c
@@ -2999,7 +2999,7 @@ static BOOL test_force_feedback_joystick( DWORD version )
     CloseHandle( file );
 
 done:
-    pnp_driver_stop();
+    hid_device_stop();
     cleanup_registry_keys();
     SetCurrentDirectoryW( cwd );
     winetest_pop_context();
@@ -4317,7 +4317,7 @@ static void test_device_managed_effect(void)
     CloseHandle( file );
 
 done:
-    pnp_driver_stop();
+    hid_device_stop();
     cleanup_registry_keys();
     SetCurrentDirectoryW( cwd );
     winetest_pop_context();
diff --git a/dlls/dinput/tests/hid.c b/dlls/dinput/tests/hid.c
index 83635146324..b5683b18850 100644
--- a/dlls/dinput/tests/hid.c
+++ b/dlls/dinput/tests/hid.c
@@ -415,8 +415,9 @@ static void unload_driver( SC_HANDLE service )
     CloseServiceHandle( service );
 }
 
-void pnp_driver_stop(void)
+static void pnp_driver_stop(void)
 {
+    const WCHAR *service_name = L"winetest";
     SP_DEVINFO_DATA device = {sizeof(SP_DEVINFO_DATA)};
     WCHAR path[MAX_PATH], dest[MAX_PATH], *filepart;
     SC_HANDLE manager, service;
@@ -453,7 +454,7 @@ void pnp_driver_stop(void)
     manager = OpenSCManagerW( NULL, NULL, SC_MANAGER_CONNECT );
     ok( !!manager, "failed to open service manager, error %lu\n", GetLastError() );
 
-    service = OpenServiceW( manager, L"winetest", SERVICE_STOP | DELETE );
+    service = OpenServiceW( manager, service_name, SERVICE_STOP | DELETE );
     if (service) unload_driver( service );
     else ok( GetLastError() == ERROR_SERVICE_DOES_NOT_EXIST, "got error %lu\n", GetLastError() );
 
@@ -488,11 +489,12 @@ void pnp_driver_stop(void)
     ok( ret || GetLastError() == ERROR_FILE_NOT_FOUND, "Failed to delete file, error %lu\n", GetLastError() );
 }
 
-BOOL pnp_driver_start( const WCHAR *resource )
+static BOOL pnp_driver_start(void)
 {
     static const WCHAR hardware_id[] = L"test_hardware_id\0";
     SP_DEVINFO_DATA device = {sizeof(SP_DEVINFO_DATA)};
     WCHAR path[MAX_PATH], filename[MAX_PATH];
+    const WCHAR *service_name = L"winetest";
     SC_HANDLE manager, service;
     const CERT_CONTEXT *cert;
     int old_mute_threshold;
@@ -504,7 +506,7 @@ BOOL pnp_driver_start( const WCHAR *resource )
     old_mute_threshold = winetest_mute_threshold;
     winetest_mute_threshold = 1;
 
-    load_resource( resource, filename );
+    load_resource( L"driver.dll", filename );
     ret = MoveFileExW( filename, L"winetest.sys", MOVEFILE_COPY_ALLOWED | MOVEFILE_REPLACE_EXISTING );
     ok( ret, "failed to move file, error %lu\n", GetLastError() );
 
@@ -570,7 +572,7 @@ BOOL pnp_driver_start( const WCHAR *resource )
     manager = OpenSCManagerW( NULL, NULL, SC_MANAGER_CONNECT );
     ok( !!manager, "failed to open service manager, error %lu\n", GetLastError() );
 
-    service = OpenServiceW( manager, L"winetest", SERVICE_START );
+    service = OpenServiceW( manager, service_name, SERVICE_START );
     ok( !!service, "failed to open service, error %lu\n", GetLastError() );
 
     ret = StartServiceW( service, 0, NULL );
@@ -590,6 +592,16 @@ BOOL pnp_driver_start( const WCHAR *resource )
     return ret || GetLastError() == ERROR_SERVICE_ALREADY_RUNNING;
 }
 
+void hid_device_stop(void)
+{
+    pnp_driver_stop();
+}
+
+BOOL hid_device_start(void)
+{
+    return pnp_driver_start();
+}
+
 #define check_hidp_caps( a, b ) check_hidp_caps_( __LINE__, a, b )
 static inline void check_hidp_caps_( int line, HIDP_CAPS *caps, const HIDP_CAPS *exp )
 {
@@ -2809,9 +2821,9 @@ static void test_hid_driver( DWORD report_id, DWORD polled )
     status = RegSetValueExW( hkey, L"Context", 0, REG_BINARY, (void *)context, sizeof(context) );
     ok( !status, "RegSetValueExW returned %#lx\n", status );
 
-    if (pnp_driver_start( L"driver_hid.dll" )) test_hid_device( report_id, polled, &caps );
+    if (hid_device_start()) test_hid_device( report_id, polled, &caps );
+    hid_device_stop();
 
-    pnp_driver_stop();
     SetCurrentDirectoryW( cwd );
 }
 
@@ -3169,7 +3181,7 @@ static void test_hidp_kdr(void)
     status = RegSetValueExW( hkey, L"Context", 0, REG_BINARY, (void *)context, sizeof(context) );
     ok( !status, "RegSetValueExW returned %#lx\n", status );
 
-    if (!pnp_driver_start( L"driver_hid.dll" )) goto done;
+    if (!hid_device_start()) goto done;
 
     set = SetupDiGetClassDevsW( &GUID_DEVINTERFACE_HID, NULL, NULL, DIGCF_DEVICEINTERFACE | DIGCF_PRESENT );
     ok( set != INVALID_HANDLE_VALUE, "failed to get device list, error %#lx\n", GetLastError() );
@@ -3286,7 +3298,7 @@ static void test_hidp_kdr(void)
     CloseHandle( file );
 
 done:
-    pnp_driver_stop();
+    hid_device_stop();
     SetCurrentDirectoryW( cwd );
 }
 
@@ -3360,7 +3372,7 @@ BOOL dinput_driver_start_( const char *file, int line, const BYTE *desc_buf, ULO
     status = RegSetValueExW( hkey, L"Context", 0, REG_BINARY, (void *)context, sizeof(context) );
     ok_(file, line)( !status, "RegSetValueExW returned %#lx\n", status );
 
-    return pnp_driver_start( L"driver_hid.dll" );
+    return hid_device_start();
 }
 
 BOOL dinput_test_init_( const char *file, int line )
@@ -3395,7 +3407,7 @@ BOOL dinput_test_init_( const char *file, int line )
                           FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, CREATE_ALWAYS, 0, NULL );
     ok( okfile != INVALID_HANDLE_VALUE, "failed to create file, error %lu\n", GetLastError() );
 
-    subtest( "driver_hid" );
+    subtest( "driver" );
     return TRUE;
 }
 
@@ -3555,9 +3567,9 @@ DWORD WINAPI dinput_test_device_thread( void *stop_event )
     status = RegSetValueExW( hkey, L"Context", 0, REG_BINARY, (void *)context, sizeof(context) );
     ok( !status, "RegSetValueExW returned %#lx\n", status );
 
-    pnp_driver_start( L"driver_hid.dll" );
+    hid_device_start();
     WaitForSingleObject( stop_event, INFINITE );
-    pnp_driver_stop();
+    hid_device_stop();
 
     SetCurrentDirectoryW( cwd );
 
diff --git a/dlls/dinput/tests/hotplug.c b/dlls/dinput/tests/hotplug.c
index 3580964e187..e212f874be3 100644
--- a/dlls/dinput/tests/hotplug.c
+++ b/dlls/dinput/tests/hotplug.c
@@ -185,7 +185,7 @@ static BOOL test_input_lost( DWORD version )
     ok( hr == DI_OK, "GetDeviceData returned %#lx\n", hr );
     ok( count == 0, "got %lu expected 0\n", count );
 
-    pnp_driver_stop();
+    hid_device_stop();
 
     hr = IDirectInputDevice8_GetDeviceState( device, sizeof(state), &state );
     ok( hr == DIERR_INPUTLOST, "GetDeviceState returned %#lx\n", hr );
@@ -218,7 +218,7 @@ static BOOL test_input_lost( DWORD version )
     ok( ref == 0, "Release returned %ld\n", ref );
 
 done:
-    pnp_driver_stop();
+    hid_device_stop();
     cleanup_registry_keys();
     SetCurrentDirectoryW( cwd );
 
diff --git a/dlls/dinput/tests/joystick8.c b/dlls/dinput/tests/joystick8.c
index c4cfceeee3e..ca7cc9a1a32 100644
--- a/dlls/dinput/tests/joystick8.c
+++ b/dlls/dinput/tests/joystick8.c
@@ -2084,7 +2084,7 @@ static void test_simple_joystick( DWORD version )
     CloseHandle( file );
 
 done:
-    pnp_driver_stop();
+    hid_device_stop();
     cleanup_registry_keys();
     SetCurrentDirectoryW( cwd );
     winetest_pop_context();
@@ -2616,7 +2616,7 @@ static BOOL test_device_types( DWORD version )
         ok( ref == 0, "Release returned %ld\n", ref );
 
     done:
-        pnp_driver_stop();
+        hid_device_stop();
         cleanup_registry_keys();
         SetCurrentDirectoryW( cwd );
         winetest_pop_context();
@@ -2842,7 +2842,7 @@ static void test_driving_wheel_axes(void)
     ok( ref == 0, "Release returned %ld\n", ref );
 
 done:
-    pnp_driver_stop();
+    hid_device_stop();
     cleanup_registry_keys();
     SetCurrentDirectoryW( cwd );
     winetest_pop_context();
@@ -3200,7 +3200,7 @@ static BOOL test_winmm_joystick(void)
     CloseHandle( file );
 
 done:
-    pnp_driver_stop();
+    hid_device_stop();
     cleanup_registry_keys();
     SetCurrentDirectoryW( cwd );
 
@@ -3395,7 +3395,7 @@ static void test_windows_gaming_input(void)
     IRawGameControllerStatics_Release( controller_statics );
 
 done:
-    pnp_driver_stop();
+    hid_device_stop();
     cleanup_registry_keys();
     SetCurrentDirectoryW( cwd );
 }
-- 
2.35.1




More information about the wine-devel mailing list