setupapi: Add test to show setupapi does not handle single quotes.

This commit is contained in:
Jason Edmeades 2007-08-09 23:56:16 +01:00 committed by Alexandre Julliard
parent 09969e8de1
commit ac6343cd5a
1 changed files with 6 additions and 4 deletions

View File

@ -41,7 +41,7 @@ static void init_function_pointers(void)
pSetupGetField = (void *)GetProcAddress(hSetupAPI, "pSetupGetField"); pSetupGetField = (void *)GetProcAddress(hSetupAPI, "pSetupGetField");
} }
static const char tmpfile[] = ".\\tmp.inf"; static const char tmpfilename[] = ".\\tmp.inf";
/* some large strings */ /* some large strings */
#define A255 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" \ #define A255 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" \
@ -66,12 +66,12 @@ static const char tmpfile[] = ".\\tmp.inf";
static HINF test_file_contents( const char *data, UINT *err_line ) static HINF test_file_contents( const char *data, UINT *err_line )
{ {
DWORD res; DWORD res;
HANDLE handle = CreateFileA( tmpfile, GENERIC_READ|GENERIC_WRITE, HANDLE handle = CreateFileA( tmpfilename, GENERIC_READ|GENERIC_WRITE,
FILE_SHARE_READ|FILE_SHARE_WRITE, NULL, CREATE_ALWAYS, 0, 0 ); FILE_SHARE_READ|FILE_SHARE_WRITE, NULL, CREATE_ALWAYS, 0, 0 );
if (handle == INVALID_HANDLE_VALUE) return 0; if (handle == INVALID_HANDLE_VALUE) return 0;
if (!WriteFile( handle, data, strlen(data), &res, NULL )) trace( "write error\n" ); if (!WriteFile( handle, data, strlen(data), &res, NULL )) trace( "write error\n" );
CloseHandle( handle ); CloseHandle( handle );
return SetupOpenInfFileA( tmpfile, 0, INF_STYLE_WIN4, err_line ); return SetupOpenInfFileA( tmpfilename, 0, INF_STYLE_WIN4, err_line );
} }
static const char *get_string_field( INFCONTEXT *context, DWORD index ) static const char *get_string_field( INFCONTEXT *context, DWORD index )
@ -284,6 +284,8 @@ static const struct
{ "ab=cd\",\"ef", "ab", { "cd,ef" } }, { "ab=cd\",\"ef", "ab", { "cd,ef" } },
{ "ab=cd\",ef", "ab", { "cd,ef" } }, { "ab=cd\",ef", "ab", { "cd,ef" } },
{ "ab=cd\",ef\\\nab", "ab", { "cd,ef\\" } }, { "ab=cd\",ef\\\nab", "ab", { "cd,ef\\" } },
/* single quotes (unhandled)*/
{ "HKLM,A,B,'C',D", NULL, { "HKLM", "A","B","'C'","D" } },
/* spaces */ /* spaces */
{ " a b = c , d \n", "a b", { "c", "d" } }, { " a b = c , d \n", "a b", { "c", "d" } },
{ " a b = c ,\" d\" \n", "a b", { "c", " d" } }, { " a b = c ,\" d\" \n", "a b", { "c", " d" } },
@ -474,5 +476,5 @@ START_TEST(parser)
test_key_names(); test_key_names();
test_close_inf_file(); test_close_inf_file();
test_pSetupGetField(); test_pSetupGetField();
DeleteFileA( tmpfile ); DeleteFileA( tmpfilename );
} }