mirror of
https://github.com/reactos/reactos.git
synced 2024-08-21 02:43:48 +00:00
Add some unit tests for setupapi
svn path=/trunk/; revision=22358
This commit is contained in:
parent
c1cdbae22d
commit
78fce8752c
346
reactos/regtests/winetests/setupapi/devclass.c
Normal file
346
reactos/regtests/winetests/setupapi/devclass.c
Normal file
|
@ -0,0 +1,346 @@
|
|||
/*
|
||||
* SetupAPI device class-related functions tests
|
||||
*
|
||||
* Copyright 2006 Hervé Poussineau
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public Licence as
|
||||
* published by the Free Software Foundation; either version 2 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
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU 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 <assert.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "windef.h"
|
||||
#include "winbase.h"
|
||||
#include "wingdi.h"
|
||||
#include "winuser.h"
|
||||
#include "winreg.h"
|
||||
#include "cfgmgr32.h"
|
||||
#include "setupapi.h"
|
||||
|
||||
#include "wine/test.h"
|
||||
|
||||
static GUID test_class_guid = { 0x4d36e967, 0xe325, 0x11ce, { 0xbf, 0xc1, 0x08, 0x00, 0x2b, 0xe1, 0x03, 0x18 } };
|
||||
static char test_class_name[MAX_CLASS_NAME_LEN] = "DiskDrive";
|
||||
|
||||
static const char *debugstr_guid(const GUID *guid)
|
||||
{
|
||||
static char guidSTR1[39];
|
||||
static char guidSTR2[39];
|
||||
char* guidSTR;
|
||||
static BOOL index;
|
||||
|
||||
if (!guid) return NULL;
|
||||
|
||||
index = !index;
|
||||
guidSTR = index ? guidSTR1 : guidSTR2;
|
||||
|
||||
snprintf(guidSTR, sizeof(guidSTR1),
|
||||
"{%08lx-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}",
|
||||
guid->Data1, guid->Data2, guid->Data3,
|
||||
guid->Data4[0], guid->Data4[1], guid->Data4[2], guid->Data4[3],
|
||||
guid->Data4[4], guid->Data4[5], guid->Data4[6], guid->Data4[7]);
|
||||
return guidSTR;
|
||||
}
|
||||
|
||||
static void test_SetupDiBuildClassInfoList(void)
|
||||
{
|
||||
LPGUID guid_list = NULL;
|
||||
DWORD required_size, size;
|
||||
|
||||
SetLastError( 0xdeadbeef );
|
||||
ok( !SetupDiBuildClassInfoList( 0, NULL, 0, NULL ),
|
||||
"Fail expected" );
|
||||
ok( GetLastError() == ERROR_INVALID_PARAMETER,
|
||||
"Expected error %lx, got %lx", ERROR_INVALID_PARAMETER, GetLastError() );
|
||||
|
||||
SetLastError( 0xdeadbeef );
|
||||
ok( !SetupDiBuildClassInfoList( 0, NULL, 0, &required_size ),
|
||||
"Fail expected" );
|
||||
ok( GetLastError() == ERROR_INSUFFICIENT_BUFFER,
|
||||
"Expected error %lx, got %lx", ERROR_INSUFFICIENT_BUFFER, GetLastError() );
|
||||
|
||||
guid_list = HeapAlloc( GetProcessHeap(), 0, ( required_size + 1 ) * sizeof( GUID ) );
|
||||
if ( !guid_list )
|
||||
return;
|
||||
|
||||
SetLastError( 0xdeadbeef );
|
||||
ok( SetupDiBuildClassInfoList( 0, guid_list, required_size, &size ),
|
||||
"Error reported %lx", GetLastError() );
|
||||
ok( size == required_size, "Expected size %lu, got %lu", required_size, size );
|
||||
SetLastError( 0xdeadbeef );
|
||||
ok( SetupDiBuildClassInfoList( 0, guid_list, required_size + 1, &size ),
|
||||
"Error reported %lx", GetLastError() );
|
||||
ok( size == required_size, "Expected size %lu, got %lu", required_size, size );
|
||||
|
||||
if ( size > 0 )
|
||||
{
|
||||
/* That's better to use the first class found, as we know for sure that it exists */
|
||||
memcpy(&test_class_guid, &guid_list[0], sizeof( GUID ) );
|
||||
SetupDiClassNameFromGuidA( &test_class_guid, test_class_name, sizeof( test_class_name ), NULL );
|
||||
}
|
||||
HeapFree( GetProcessHeap(), 0, guid_list );
|
||||
}
|
||||
|
||||
static void test_SetupDiClassGuidsFromNameA(void)
|
||||
{
|
||||
LPGUID guid_list = NULL;
|
||||
DWORD required_size, size;
|
||||
|
||||
SetLastError( 0xdeadbeef );
|
||||
ok( !SetupDiClassGuidsFromNameA( NULL, NULL, 0, NULL ),
|
||||
"Fail expected" );
|
||||
ok( GetLastError() == ERROR_INVALID_PARAMETER,
|
||||
"Expected error %lx, got %lx", ERROR_INVALID_PARAMETER, GetLastError() );
|
||||
|
||||
SetLastError( 0xdeadbeef );
|
||||
ok( !SetupDiClassGuidsFromNameA( NULL, NULL, 0, &required_size ),
|
||||
"Fail expected" );
|
||||
ok( GetLastError() == ERROR_INVALID_PARAMETER,
|
||||
"Expected error %lx, got %lx", ERROR_INVALID_PARAMETER, GetLastError() );
|
||||
|
||||
SetLastError( 0xdeadbeef );
|
||||
ok( SetupDiClassGuidsFromNameA( "", NULL, 0, &required_size ),
|
||||
"Error reported %lx", GetLastError() );
|
||||
ok( required_size == 0, "Expected 0, got %lu", required_size );
|
||||
|
||||
SetLastError( 0xdeadbeef );
|
||||
ok( !SetupDiClassGuidsFromNameA( test_class_name, NULL, 0, &required_size ),
|
||||
"Fail expected" );
|
||||
SetLastError( 0xdeadbeef );
|
||||
ok( GetLastError() == ERROR_INSUFFICIENT_BUFFER,
|
||||
"Expected error %lx, got %lx", ERROR_INSUFFICIENT_BUFFER, GetLastError() );
|
||||
ok( required_size > 0, "Expected > 0, got %lu", required_size );
|
||||
|
||||
guid_list = HeapAlloc( GetProcessHeap(), 0, ( required_size + 1 ) * sizeof( GUID ) );
|
||||
if ( !guid_list )
|
||||
return;
|
||||
|
||||
SetLastError( 0xdeadbeef );
|
||||
ok( SetupDiClassGuidsFromNameA( test_class_name, guid_list, required_size, &size ),
|
||||
"Error reported %lx", GetLastError() );
|
||||
ok( size == required_size, "Expected size %lu, got %lu", required_size, size );
|
||||
ok( IsEqualIID( &guid_list[0], &test_class_guid ),
|
||||
"Expected %s, got %s", debugstr_guid( &test_class_guid ), debugstr_guid( &guid_list[0] ) );
|
||||
SetLastError( 0xdeadbeef );
|
||||
ok( SetupDiClassGuidsFromNameA( test_class_name, guid_list, required_size + 1, &size ),
|
||||
"Error reported %lx", GetLastError() );
|
||||
ok( size == required_size, "Expected size %lu, got %lu", required_size, size );
|
||||
ok( IsEqualIID( &guid_list[0], &test_class_guid ),
|
||||
"Expected %s, got %s", debugstr_guid( &test_class_guid ), debugstr_guid( &guid_list[0] ) );
|
||||
|
||||
HeapFree( GetProcessHeap(), 0, guid_list );
|
||||
}
|
||||
|
||||
static void test_SetupDiClassNameFromGuidA(void)
|
||||
{
|
||||
CHAR* class_name = NULL;
|
||||
DWORD required_size, size;
|
||||
|
||||
SetLastError( 0xdeadbeef );
|
||||
ok( !SetupDiClassNameFromGuidA( NULL, NULL, 0, NULL ),
|
||||
"Fail expected" );
|
||||
ok( GetLastError() == ERROR_INVALID_CLASS,
|
||||
"Expected error %x, got %lx", ERROR_INVALID_CLASS, GetLastError() );
|
||||
|
||||
SetLastError( 0xdeadbeef );
|
||||
ok( !SetupDiClassNameFromGuidA( NULL, NULL, 0, &required_size ),
|
||||
"Fail expected" );
|
||||
ok( GetLastError() == ERROR_INVALID_CLASS,
|
||||
"Expected error %x, got %lx", ERROR_INVALID_CLASS, GetLastError() );
|
||||
|
||||
SetLastError( 0xdeadbeef );
|
||||
ok( !SetupDiClassNameFromGuidA( &test_class_guid, NULL, 0, &required_size ),
|
||||
"Fail expected" );
|
||||
ok( GetLastError() == ERROR_INSUFFICIENT_BUFFER,
|
||||
"Expected error %lx, got %lx", ERROR_INSUFFICIENT_BUFFER, GetLastError() );
|
||||
ok( required_size > 0, "Expected > 0, got %lu", required_size );
|
||||
ok( required_size < MAX_CLASS_NAME_LEN, "Expected < %u, got %lu", MAX_CLASS_NAME_LEN, required_size );
|
||||
|
||||
class_name = HeapAlloc( GetProcessHeap(), 0, required_size );
|
||||
if ( !class_name )
|
||||
return;
|
||||
|
||||
SetLastError( 0xdeadbeef );
|
||||
ok( SetupDiClassNameFromGuidA( &test_class_guid, class_name, required_size, &size ),
|
||||
"Error reported %lx", GetLastError() );
|
||||
ok( size == required_size, "Expected size %lu, got %lu", required_size, size );
|
||||
ok( !strcmp( class_name, test_class_name ),
|
||||
"Expected %s, got %s", test_class_name, class_name );
|
||||
SetLastError( 0xdeadbeef );
|
||||
ok( SetupDiClassNameFromGuidA( &test_class_guid, class_name, required_size + 1, &size ),
|
||||
"Error reported %lx", GetLastError() );
|
||||
ok( size == required_size, "Expected size %lu, got %lu", required_size, size );
|
||||
ok( !strcmp( class_name, test_class_name ),
|
||||
"Expected %s, got %s", test_class_name, class_name );
|
||||
|
||||
HeapFree( GetProcessHeap(), 0, class_name );
|
||||
}
|
||||
|
||||
static void test_SetupDiGetClassDescriptionA(void)
|
||||
{
|
||||
CHAR* class_desc = NULL;
|
||||
DWORD required_size, size;
|
||||
|
||||
SetLastError( 0xdeadbeef );
|
||||
ok( !SetupDiGetClassDescriptionA( NULL, NULL, 0, NULL ),
|
||||
"Fail expected" );
|
||||
ok( GetLastError() == ERROR_INVALID_PARAMETER,
|
||||
"Expected error %lx, got %lx", ERROR_INVALID_PARAMETER, GetLastError() );
|
||||
|
||||
SetLastError( 0xdeadbeef );
|
||||
ok( !SetupDiGetClassDescriptionA( NULL, NULL, 0, &required_size ),
|
||||
"Fail expected" );
|
||||
ok( GetLastError() == ERROR_INVALID_PARAMETER,
|
||||
"Expected error %lx, got %lx", ERROR_INVALID_PARAMETER, GetLastError() );
|
||||
|
||||
SetLastError( 0xdeadbeef );
|
||||
ok( !SetupDiGetClassDescriptionA( &test_class_guid, NULL, 0, &required_size ),
|
||||
"Fail expected" );
|
||||
ok( GetLastError() == ERROR_INSUFFICIENT_BUFFER,
|
||||
"Expected error %lx, got %lx", ERROR_INSUFFICIENT_BUFFER, GetLastError() );
|
||||
ok( required_size > 0, "Expected > 0, got %lu", required_size );
|
||||
ok( required_size < LINE_LEN, "Expected < %u, got %lu", LINE_LEN, required_size );
|
||||
|
||||
class_desc = HeapAlloc( GetProcessHeap(), 0, required_size );
|
||||
if ( !class_desc )
|
||||
return;
|
||||
|
||||
SetLastError( 0xdeadbeef );
|
||||
ok( SetupDiGetClassDescriptionA( &test_class_guid, class_desc, required_size, &size ),
|
||||
"Error reported %lx", GetLastError() );
|
||||
ok( size == required_size, "Expected size %lu, got %lu", required_size, size );
|
||||
SetLastError( 0xdeadbeef );
|
||||
ok( SetupDiGetClassDescriptionA( &test_class_guid, class_desc, required_size + 1, &size ),
|
||||
"Error reported %lx", GetLastError() );
|
||||
ok( size == required_size, "Expected size %lu, got %lu", required_size, size );
|
||||
|
||||
HeapFree( GetProcessHeap(), 0, class_desc );
|
||||
}
|
||||
|
||||
static void test_SetupDiGetClassDevsA(void)
|
||||
{
|
||||
HDEVINFO device_info;
|
||||
|
||||
SetLastError( 0xdeadbeef );
|
||||
device_info = SetupDiGetClassDevs( NULL, NULL, NULL, 0 );
|
||||
ok( device_info == INVALID_HANDLE_VALUE,
|
||||
"Fail expected" );
|
||||
ok( GetLastError() == ERROR_INVALID_PARAMETER,
|
||||
"Expected error %lx, got %lx", ERROR_INVALID_PARAMETER, GetLastError() );
|
||||
|
||||
SetLastError( 0xdeadbeef );
|
||||
device_info = SetupDiGetClassDevs( NULL, NULL, NULL, DIGCF_ALLCLASSES );
|
||||
ok( device_info != INVALID_HANDLE_VALUE,
|
||||
"Error reported %lx", GetLastError() );
|
||||
SetLastError( 0xdeadbeef );
|
||||
ok( SetupDiDestroyDeviceInfoList( device_info ),
|
||||
"Error reported %lx", GetLastError() );
|
||||
|
||||
SetLastError( 0xdeadbeef );
|
||||
device_info = SetupDiGetClassDevs( NULL, NULL, NULL, DIGCF_DEVICEINTERFACE );
|
||||
ok( device_info == INVALID_HANDLE_VALUE,
|
||||
"Fail expected" );
|
||||
ok( GetLastError() == ERROR_INVALID_PARAMETER,
|
||||
"Expected error %lx, got %lx", ERROR_INVALID_PARAMETER, GetLastError() );
|
||||
|
||||
SetLastError( 0xdeadbeef );
|
||||
device_info = SetupDiGetClassDevs( &test_class_guid, NULL, NULL, 0 );
|
||||
ok( device_info != INVALID_HANDLE_VALUE,
|
||||
"Error reported %lx", GetLastError() );
|
||||
SetLastError( 0xdeadbeef );
|
||||
ok( SetupDiDestroyDeviceInfoList( device_info ),
|
||||
"Error reported %lx", GetLastError() );
|
||||
|
||||
SetLastError( 0xdeadbeef );
|
||||
device_info = SetupDiGetClassDevs( NULL, "(invalid enumerator)", NULL, DIGCF_ALLCLASSES );
|
||||
ok( device_info == INVALID_HANDLE_VALUE,
|
||||
"Fail expected" );
|
||||
ok( GetLastError() == ERROR_INVALID_DATA,
|
||||
"Expected error %lx, got %lx", ERROR_INVALID_DATA, GetLastError() );
|
||||
|
||||
SetLastError( 0xdeadbeef );
|
||||
device_info = SetupDiGetClassDevs( NULL, "Root", NULL, DIGCF_ALLCLASSES );
|
||||
ok( device_info != INVALID_HANDLE_VALUE,
|
||||
"Error reported %lx", GetLastError() );
|
||||
SetLastError( 0xdeadbeef );
|
||||
ok( SetupDiDestroyDeviceInfoList( device_info ),
|
||||
"Error reported %lx", GetLastError() );
|
||||
}
|
||||
|
||||
static void test_SetupDiOpenClassRegKeyExA(void)
|
||||
{
|
||||
HKEY hkey;
|
||||
LONG err;
|
||||
|
||||
SetLastError( 0xdeadbeef );
|
||||
hkey = SetupDiOpenClassRegKeyExA( NULL, 0, 0, NULL, NULL );
|
||||
ok( hkey == INVALID_HANDLE_VALUE,
|
||||
"Fail expected" );
|
||||
ok( GetLastError() == ERROR_INVALID_FLAGS,
|
||||
"Expected error %lx, got %lx", ERROR_INVALID_FLAGS, GetLastError() );
|
||||
|
||||
SetLastError( 0xdeadbeef );
|
||||
hkey = SetupDiOpenClassRegKeyExA( NULL, 0, DIOCR_INSTALLER | DIOCR_INTERFACE, NULL, NULL );
|
||||
ok( hkey == INVALID_HANDLE_VALUE,
|
||||
"Fail expected" );
|
||||
ok( GetLastError() == ERROR_INVALID_FLAGS,
|
||||
"Expected error %lx, got %lx", ERROR_INVALID_FLAGS, GetLastError() );
|
||||
|
||||
SetLastError( 0xdeadbeef );
|
||||
hkey = SetupDiOpenClassRegKeyExA( NULL, 0, DIOCR_INSTALLER, NULL, NULL );
|
||||
ok( hkey == INVALID_HANDLE_VALUE,
|
||||
"Fail expected" );
|
||||
ok( GetLastError() == ERROR_INVALID_CLASS,
|
||||
"Expected error %x, got %lx", ERROR_INVALID_CLASS, GetLastError() );
|
||||
|
||||
SetLastError( 0xdeadbeef );
|
||||
hkey = SetupDiOpenClassRegKeyExA( NULL, 0, DIOCR_INTERFACE, NULL, NULL );
|
||||
ok( hkey == INVALID_HANDLE_VALUE,
|
||||
"Fail expected" );
|
||||
ok( GetLastError() == ERROR_INVALID_CLASS,
|
||||
"Expected error %x, got %lx", ERROR_INVALID_CLASS, GetLastError() );
|
||||
|
||||
SetLastError( 0xdeadbeef );
|
||||
hkey = SetupDiOpenClassRegKeyExA( NULL, KEY_QUERY_VALUE, DIOCR_INSTALLER, NULL, NULL );
|
||||
ok( hkey != INVALID_HANDLE_VALUE, "Got error %lx", GetLastError() );
|
||||
err = RegCloseKey( hkey );
|
||||
ok( err == ERROR_SUCCESS, "Got error %lx", err );
|
||||
|
||||
SetLastError( 0xdeadbeef );
|
||||
hkey = SetupDiOpenClassRegKeyExA( NULL, KEY_QUERY_VALUE, DIOCR_INTERFACE, NULL, NULL );
|
||||
ok( hkey != INVALID_HANDLE_VALUE, "Got error %lx", GetLastError() );
|
||||
err = RegCloseKey( hkey );
|
||||
ok( err == ERROR_SUCCESS, "Got error %lx", err );
|
||||
|
||||
SetLastError( 0xdeadbeef );
|
||||
hkey = SetupDiOpenClassRegKeyExA( &test_class_guid, KEY_QUERY_VALUE, DIOCR_INSTALLER, NULL, NULL );
|
||||
ok( hkey != INVALID_HANDLE_VALUE, "Got error %lx", GetLastError() );
|
||||
err = RegCloseKey( hkey );
|
||||
ok( err == ERROR_SUCCESS, "Got error %lx", err );
|
||||
|
||||
err = RegOpenKeyExA(HKEY_LOCAL_MACHINE, "System\\CurrentControlSet\\Control\\Class", 0, KEY_SET_VALUE, &hkey);
|
||||
ok( err == ERROR_SUCCESS, "Got error %lx", err );
|
||||
}
|
||||
|
||||
START_TEST(devclass)
|
||||
{
|
||||
test_SetupDiBuildClassInfoList();
|
||||
test_SetupDiClassGuidsFromNameA();
|
||||
test_SetupDiClassNameFromGuidA();
|
||||
test_SetupDiGetClassDescriptionA();
|
||||
test_SetupDiGetClassDevsA();
|
||||
test_SetupDiOpenClassRegKeyExA();
|
||||
}
|
117
reactos/regtests/winetests/setupapi/install.c
Normal file
117
reactos/regtests/winetests/setupapi/install.c
Normal file
|
@ -0,0 +1,117 @@
|
|||
/*
|
||||
* INF file parsing tests
|
||||
*
|
||||
* Copyright 2006 Hervé Poussineau
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public Licence as
|
||||
* published by the Free Software Foundation; either version 2 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
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU 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 <assert.h>
|
||||
#include <stdarg.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "windef.h"
|
||||
#include "winbase.h"
|
||||
#include "wingdi.h"
|
||||
#include "winuser.h"
|
||||
#include "winreg.h"
|
||||
#include "setupapi.h"
|
||||
|
||||
#include "wine/test.h"
|
||||
|
||||
#define TMPFILE ".\\tmp.inf"
|
||||
|
||||
#define STD_HEADER "[Version]\r\nSignature=\"$CHICAGO$\"\r\n"
|
||||
|
||||
/* create a new file with specified contents and open it */
|
||||
static HINF test_file_contents( const char *data, UINT *err_line )
|
||||
{
|
||||
DWORD res;
|
||||
HANDLE handle = CreateFileA( TMPFILE, GENERIC_READ|GENERIC_WRITE,
|
||||
FILE_SHARE_READ|FILE_SHARE_WRITE, NULL, CREATE_ALWAYS, 0, 0 );
|
||||
if (handle == INVALID_HANDLE_VALUE) return 0;
|
||||
if (!WriteFile( handle, data, strlen(data), &res, NULL )) trace( "write error\n" );
|
||||
CloseHandle( handle );
|
||||
return SetupOpenInfFileA( TMPFILE, 0, INF_STYLE_WIN4, err_line );
|
||||
}
|
||||
|
||||
static void test_InstallHinfSectionA(void)
|
||||
{
|
||||
char buffer[MAX_INF_STRING_LENGTH];
|
||||
UINT err_line;
|
||||
HINF hinf;
|
||||
DWORD err;
|
||||
DWORD len;
|
||||
|
||||
SetLastError( 0xdeadbeef );
|
||||
hinf = test_file_contents( STD_HEADER
|
||||
"[s]\r\nAddReg=s.Reg\r\n[s.Reg]\r\nHKCU,,Test,,none\r\n"
|
||||
"[s.Win]\r\nAddReg=sWin.Reg\r\n[sWin.Reg]\r\nHKCU,,Test,,win\r\n"
|
||||
"[s.NT]\r\nAddReg=sNT.Reg\r\n[sNT.Reg]\r\nHKCU,,Test,,nt\r\n"
|
||||
, &err_line );
|
||||
ok( hinf != INVALID_HANDLE_VALUE, "open failed err %lx", GetLastError() );
|
||||
if ( hinf == INVALID_HANDLE_VALUE ) return;
|
||||
|
||||
system( "rundll32.exe setupapi,InstallHinfSection s 128 " TMPFILE );
|
||||
|
||||
len = sizeof( buffer );
|
||||
err = RegQueryValueExA( HKEY_CURRENT_USER, "Test", NULL, NULL, (LPBYTE)buffer, &len );
|
||||
ok( err == ERROR_SUCCESS, "error %lx", err);
|
||||
|
||||
if (GetVersion() & 0x80000000)
|
||||
ok( !strcmp( buffer, "win" ), "bad section %s/win\n", buffer );
|
||||
else
|
||||
ok( !strcmp( buffer, "nt" ), "bad section %s/nt\n", buffer );
|
||||
|
||||
err = RegDeleteValue( HKEY_CURRENT_USER, "Test" );
|
||||
ok( err == ERROR_SUCCESS, "error %lx", err);
|
||||
}
|
||||
|
||||
static void test_SetupInstallFromInfSectionA(void)
|
||||
{
|
||||
char buffer[MAX_INF_STRING_LENGTH];
|
||||
UINT err_line;
|
||||
HINF hinf;
|
||||
DWORD err;
|
||||
DWORD len;
|
||||
|
||||
SetLastError( 0xdeadbeef );
|
||||
hinf = test_file_contents( STD_HEADER
|
||||
"[s]\r\nAddReg=s.Reg\r\n[s.Reg]\r\nHKR,,Test,,none\r\n"
|
||||
"[s.Win]\r\nAddReg=sWin.Reg\r\n[sWin.Reg]\r\nHKR,,Test,,win\r\n"
|
||||
"[s.NT]\r\nAddReg=sNT.Reg\r\n[sNT.Reg]\r\nHKR,,Test,,nt\r\n"
|
||||
, &err_line );
|
||||
ok( hinf != INVALID_HANDLE_VALUE, "open failed err %lx", GetLastError() );
|
||||
if (hinf == INVALID_HANDLE_VALUE) return;
|
||||
|
||||
SetLastError( 0xdeadbeef );
|
||||
ok ( SetupInstallFromInfSectionA( NULL, hinf, "s", SPINST_REGISTRY, HKEY_CURRENT_USER, NULL, 0, NULL, NULL, NULL, NULL ),
|
||||
"Error code set to %lx", GetLastError() );
|
||||
|
||||
len = sizeof( buffer );
|
||||
err = RegQueryValueExA( HKEY_CURRENT_USER, "Test", NULL, NULL, (LPBYTE)buffer, &len );
|
||||
ok( err == ERROR_SUCCESS, "error %lx", err);
|
||||
ok( !strcmp( buffer, "none" ), "bad value %s/none", buffer );
|
||||
|
||||
err = RegDeleteValue( HKEY_CURRENT_USER, "Test" );
|
||||
ok( err == ERROR_SUCCESS, "error %lx", err);
|
||||
}
|
||||
|
||||
START_TEST(install)
|
||||
{
|
||||
test_InstallHinfSectionA();
|
||||
test_SetupInstallFromInfSectionA();
|
||||
DeleteFileA( TMPFILE );
|
||||
}
|
|
@ -387,10 +387,18 @@ static void test_key_names(void)
|
|||
|
||||
}
|
||||
|
||||
static void test_SetupCloseInfFile(void)
|
||||
{
|
||||
/* try to close with invalid handles */
|
||||
SetupCloseInfFile( NULL );
|
||||
SetupCloseInfFile( INVALID_HANDLE_VALUE );
|
||||
}
|
||||
|
||||
START_TEST(parser)
|
||||
{
|
||||
test_invalid_files();
|
||||
test_section_names();
|
||||
test_key_names();
|
||||
test_SetupCloseInfFile();
|
||||
DeleteFileA( tmpfile );
|
||||
}
|
||||
|
|
|
@ -3,6 +3,8 @@
|
|||
<define name="__USE_W32API" />
|
||||
<library>ntdll</library>
|
||||
<library>setupapi</library>
|
||||
<file>devclass.c</file>
|
||||
<file>install.c</file>
|
||||
<file>parser.c</file>
|
||||
<file>query.c</file>
|
||||
<file>stringtable.c</file>
|
||||
|
|
|
@ -6,12 +6,16 @@
|
|||
#define STANDALONE
|
||||
#include "wine/test.h"
|
||||
|
||||
extern void func_devclass(void);
|
||||
extern void func_install(void);
|
||||
extern void func_parser(void);
|
||||
extern void func_query(void);
|
||||
extern void func_stringtable(void);
|
||||
|
||||
const struct test winetest_testlist[] =
|
||||
{
|
||||
{ "devclass", func_devclass },
|
||||
{ "install", func_install },
|
||||
{ "parser", func_parser },
|
||||
{ "query", func_query },
|
||||
{ "stringtable", func_stringtable },
|
||||
|
|
Loading…
Reference in a new issue