Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
wine
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Package registry
Container Registry
Model registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Zsolt Vadász
wine
Commits
2e20bd49
Commit
2e20bd49
authored
16 years ago
by
Alexandre Julliard
Browse files
Options
Downloads
Patches
Plain Diff
setupapi/tests: Added some tests for SetupEnumInfSectionsA/W.
parent
b45cfc12
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
dlls/setupapi/tests/parser.c
+50
-1
50 additions, 1 deletion
dlls/setupapi/tests/parser.c
with
50 additions
and
1 deletion
dlls/setupapi/tests/parser.c
+
50
−
1
View file @
2e20bd49
...
...
@@ -33,12 +33,14 @@
/* function pointers */
static
HMODULE
hSetupAPI
;
static
LPCWSTR
(
WINAPI
*
pSetupGetField
)(
PINFCONTEXT
,
DWORD
);
static
BOOL
(
WINAPI
*
pSetupEnumInfSectionsA
)(
HINF
hinf
,
UINT
index
,
PSTR
buffer
,
DWORD
size
,
UINT
*
need
);
static
void
init_function_pointers
(
void
)
{
hSetupAPI
=
GetModuleHandleA
(
"setupapi.dll"
);
pSetupGetField
=
(
void
*
)
GetProcAddress
(
hSetupAPI
,
"pSetupGetField"
);
pSetupGetField
=
(
void
*
)
GetProcAddress
(
hSetupAPI
,
"pSetupGetField"
);
pSetupEnumInfSectionsA
=
(
void
*
)
GetProcAddress
(
hSetupAPI
,
"SetupEnumInfSectionsA"
);
}
static
const
char
tmpfilename
[]
=
".
\\
tmp.inf"
;
...
...
@@ -246,6 +248,52 @@ static void test_section_names(void)
}
}
static
void
test_enum_sections
(
void
)
{
static
const
char
*
contents
=
STD_HEADER
"[s1]
\n
foo=bar
\n
[s2]
\n
bar=foo
\n
[s3]
\n
[strings]
\n
a=b
\n
"
;
BOOL
ret
;
DWORD
len
;
HINF
hinf
;
UINT
err
,
index
;
char
buffer
[
256
];
if
(
!
pSetupEnumInfSectionsA
)
{
win_skip
(
"SetupEnumInfSectionsA not available
\n
"
);
return
;
}
hinf
=
test_file_contents
(
contents
,
&
err
);
ok
(
hinf
!=
NULL
,
"Expected valid INF file
\n
"
);
for
(
index
=
0
;
;
index
++
)
{
SetLastError
(
0xdeadbeef
);
ret
=
pSetupEnumInfSectionsA
(
hinf
,
index
,
NULL
,
0
,
&
len
);
err
=
GetLastError
();
if
(
!
ret
&&
GetLastError
()
==
ERROR_NO_MORE_ITEMS
)
break
;
ok
(
ret
,
"SetupEnumInfSectionsA failed
\n
"
);
ok
(
len
==
3
||
len
==
8
,
"wrong len %u
\n
"
,
len
);
SetLastError
(
0xdeadbeef
);
ret
=
pSetupEnumInfSectionsA
(
hinf
,
index
,
NULL
,
sizeof
(
buffer
),
&
len
);
err
=
GetLastError
();
ok
(
!
ret
,
"SetupEnumInfSectionsA succeeded
\n
"
);
ok
(
err
==
ERROR_INVALID_USER_BUFFER
,
"wrong error %u
\n
"
,
err
);
ok
(
len
==
3
||
len
==
8
,
"wrong len %u
\n
"
,
len
);
SetLastError
(
0xdeadbeef
);
ret
=
pSetupEnumInfSectionsA
(
hinf
,
index
,
buffer
,
sizeof
(
buffer
),
&
len
);
ok
(
ret
,
"SetupEnumInfSectionsA failed err %u
\n
"
,
GetLastError
()
);
ok
(
len
==
3
||
len
==
8
,
"wrong len %u
\n
"
,
len
);
ok
(
!
lstrcmpi
(
buffer
,
"version"
)
||
!
lstrcmpi
(
buffer
,
"s1"
)
||
!
lstrcmpi
(
buffer
,
"s2"
)
||
!
lstrcmpi
(
buffer
,
"s3"
)
||
!
lstrcmpi
(
buffer
,
"strings"
),
"bad section '%s'
\n
"
,
buffer
);
}
SetupCloseInfFile
(
hinf
);
}
/* Test various key and value names */
...
...
@@ -672,6 +720,7 @@ START_TEST(parser)
init_function_pointers
();
test_invalid_files
();
test_section_names
();
test_enum_sections
();
test_key_names
();
test_close_inf_file
();
test_pSetupGetField
();
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment