Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
7588b669
Commit
7588b669
authored
Sep 13, 2006
by
James Hawkins
Committed by
Alexandre Julliard
Sep 14, 2006
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
setupapi: Implement pSetupGetField, with tests.
parent
21fe104d
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
88 additions
and
1 deletion
+88
-1
parser.c
dlls/setupapi/parser.c
+16
-0
setupapi.spec
dlls/setupapi/setupapi.spec
+1
-1
parser.c
dlls/setupapi/tests/parser.c
+71
-0
No files found.
dlls/setupapi/parser.c
View file @
7588b669
...
...
@@ -1875,3 +1875,19 @@ BOOL WINAPI SetupGetMultiSzFieldW( PINFCONTEXT context, DWORD index, PWSTR buffe
*
buffer
=
0
;
/* add final null */
return
TRUE
;
}
/***********************************************************************
* pSetupGetField (SETUPAPI.@)
*/
LPCWSTR
WINAPI
pSetupGetField
(
PINFCONTEXT
context
,
DWORD
index
)
{
struct
inf_file
*
file
=
context
->
CurrentInf
;
struct
field
*
field
=
get_field
(
file
,
context
->
Section
,
context
->
Line
,
index
);
if
(
!
field
)
{
SetLastError
(
ERROR_INVALID_PARAMETER
);
return
NULL
;
}
return
field
->
text
;
}
dlls/setupapi/setupapi.spec
View file @
7588b669
...
...
@@ -539,7 +539,7 @@
@ stub pSetupAppendStringToMultiSz
@ stub pSetupDestroyRunOnceNodeList
@ stub pSetupDirectoryIdToPath
@ st
ub pSetupGetField
@ st
dcall pSetupGetField(ptr long)
@ stdcall pSetupGetGlobalFlags()
@ stub pSetupGetOsLoaderDriveAndPath
@ stub pSetupGetQueueFlags
...
...
dlls/setupapi/tests/parser.c
View file @
7588b669
...
...
@@ -30,6 +30,19 @@
#include "wine/test.h"
/* function pointers */
static
HMODULE
hSetupAPI
;
static
LPCWSTR
(
WINAPI
*
pSetupGetField
)(
PINFCONTEXT
,
DWORD
);
static
void
init_function_pointers
(
void
)
{
hSetupAPI
=
LoadLibraryA
(
"setupapi.dll"
);
if
(
!
hSetupAPI
)
return
;
pSetupGetField
=
(
void
*
)
GetProcAddress
(
hSetupAPI
,
"pSetupGetField"
);
}
static
const
char
tmpfile
[]
=
".
\\
tmp.inf"
;
/* some large strings */
...
...
@@ -394,11 +407,69 @@ static void test_close_inf_file(void)
ok
(
GetLastError
()
==
0xdeadbeef
,
"Expected 0xdeadbeef, got %ld
\n
"
,
GetLastError
());
}
static
const
char
*
contents
=
"[Version]
\n
"
"Signature=
\"
$Windows NT$
\"\n
"
"FileVersion=5.1.1.2
\n
"
"[FileBranchInfo]
\n
"
"RTMQFE=
\"
%RTMGFE_NAME%
\"
,SP1RTM,"
A4097
"
\n
"
"[Strings]
\n
"
"RTMQFE_NAME =
\"
RTMQFE
\"\n
"
;
static
const
WCHAR
getfield_res
[][
20
]
=
{
{
'R'
,
'T'
,
'M'
,
'Q'
,
'F'
,
'E'
,
0
},
{
'%'
,
'R'
,
'T'
,
'M'
,
'G'
,
'F'
,
'E'
,
'_'
,
'N'
,
'A'
,
'M'
,
'E'
,
'%'
,
0
},
{
'S'
,
'P'
,
'1'
,
'R'
,
'T'
,
'M'
,
0
},
};
static
void
test_pSetupGetField
(
void
)
{
UINT
err
;
BOOL
ret
;
HINF
hinf
;
LPCWSTR
field
;
INFCONTEXT
context
;
int
i
;
hinf
=
test_file_contents
(
contents
,
&
err
);
ok
(
hinf
!=
NULL
,
"Expected valid INF file
\n
"
);
ret
=
SetupFindFirstLine
(
hinf
,
"FileBranchInfo"
,
NULL
,
&
context
);
ok
(
ret
,
"Failed to find first line
\n
"
);
/* native Windows crashes if a NULL context is sent in */
for
(
i
=
0
;
i
<
3
;
i
++
)
{
field
=
pSetupGetField
(
&
context
,
i
);
ok
(
field
!=
NULL
,
"Failed to get field %i
\n
"
,
i
);
ok
(
!
lstrcmpW
(
getfield_res
[
i
],
field
),
"Wrong string returned
\n
"
);
ret
=
HeapFree
(
GetProcessHeap
(),
0
,
(
LPVOID
)
field
);
ok
(
!
ret
,
"Expected HeapFree to fail
\n
"
);
ok
(
GetLastError
()
==
ERROR_INVALID_PARAMETER
,
"Expected ERROR_INVALID_PARAMETER, got %ld
\n
"
,
GetLastError
()
);
}
field
=
pSetupGetField
(
&
context
,
3
);
ok
(
field
!=
NULL
,
"Failed to get field 3
\n
"
);
ok
(
lstrlenW
(
field
)
==
511
,
"Expected 511, got %d
\n
"
,
lstrlenW
(
field
)
);
field
=
pSetupGetField
(
&
context
,
4
);
ok
(
field
==
NULL
,
"Expected NULL, got %p
\n
"
,
field
);
ok
(
GetLastError
()
==
ERROR_INVALID_PARAMETER
,
"Expected ERROR_INVALID_PARAMETER, got %ld
\n
"
,
GetLastError
()
);
SetupCloseInfFile
(
hinf
);
}
START_TEST
(
parser
)
{
init_function_pointers
();
test_invalid_files
();
test_section_names
();
test_key_names
();
test_close_inf_file
();
test_pSetupGetField
();
DeleteFileA
(
tmpfile
);
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment