Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
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-winehq
Commits
17f66b70
Commit
17f66b70
authored
Nov 17, 2006
by
Hans Leidekker
Committed by
Alexandre Julliard
Nov 17, 2006
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
setupapi: Add tests for SetupGet{SourceFileLocation, SourceInfo, TargetPath}.
parent
7f9a5fac
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
130 additions
and
0 deletions
+130
-0
query.c
dlls/setupapi/tests/query.c
+130
-0
No files found.
dlls/setupapi/tests/query.c
View file @
17f66b70
...
...
@@ -29,6 +29,9 @@ static void (WINAPI *pSetupCloseInfFile)(HINF);
static
BOOL
(
WINAPI
*
pSetupGetInfInformationA
)(
LPCVOID
,
DWORD
,
PSP_INF_INFORMATION
,
DWORD
,
PDWORD
);
static
HINF
(
WINAPI
*
pSetupOpenInfFileA
)(
PCSTR
,
PCSTR
,
DWORD
,
PUINT
);
static
BOOL
(
WINAPI
*
pSetupQueryInfFileInformationA
)(
PSP_INF_INFORMATION
,
UINT
,
PSTR
,
DWORD
,
PDWORD
);
static
BOOL
(
WINAPI
*
pSetupGetSourceFileLocationA
)(
HINF
,
PINFCONTEXT
,
PCSTR
,
PUINT
,
PSTR
,
DWORD
,
PDWORD
);
static
BOOL
(
WINAPI
*
pSetupGetSourceInfoA
)(
HINF
,
UINT
,
UINT
,
PSTR
,
DWORD
,
PDWORD
);
static
BOOL
(
WINAPI
*
pSetupGetTargetPathA
)(
HINF
,
PINFCONTEXT
,
PCSTR
,
PSTR
,
DWORD
,
PDWORD
);
CHAR
CURR_DIR
[
MAX_PATH
];
CHAR
WIN_DIR
[
MAX_PATH
];
...
...
@@ -43,6 +46,9 @@ static void init_function_pointers(void)
pSetupGetInfInformationA
=
(
void
*
)
GetProcAddress
(
hSetupAPI
,
"SetupGetInfInformationA"
);
pSetupOpenInfFileA
=
(
void
*
)
GetProcAddress
(
hSetupAPI
,
"SetupOpenInfFileA"
);
pSetupQueryInfFileInformationA
=
(
void
*
)
GetProcAddress
(
hSetupAPI
,
"SetupQueryInfFileInformationA"
);
pSetupGetSourceFileLocationA
=
(
void
*
)
GetProcAddress
(
hSetupAPI
,
"SetupGetSourceFileLocationA"
);
pSetupGetSourceInfoA
=
(
void
*
)
GetProcAddress
(
hSetupAPI
,
"SetupGetSourceInfoA"
);
pSetupGetTargetPathA
=
(
void
*
)
GetProcAddress
(
hSetupAPI
,
"SetupGetTargetPathA"
);
}
}
...
...
@@ -80,6 +86,16 @@ static void create_inf_file(LPSTR filename)
append_str
(
&
ptr
,
"[Version]
\n
"
);
append_str
(
&
ptr
,
"Signature=
\"
$Chicago$
\"\n
"
);
append_str
(
&
ptr
,
"AdvancedINF=2.5
\n
"
);
append_str
(
&
ptr
,
"[SourceDisksNames]
\n
"
);
append_str
(
&
ptr
,
"2 = %%SrcDiskName%%, LANCOM
\\
LANtools
\\
lanconf.cab
\n
"
);
append_str
(
&
ptr
,
"[SourceDisksFiles]
\n
"
);
append_str
(
&
ptr
,
"lanconf.exe = 2
\n
"
);
append_str
(
&
ptr
,
"[DestinationDirs]
\n
"
);
append_str
(
&
ptr
,
"DefaultDestDir = 24, %%DefaultDest%%
\n
"
);
append_str
(
&
ptr
,
"[Strings]
\n
"
);
append_str
(
&
ptr
,
"LangDir = english
\n
"
);
append_str
(
&
ptr
,
"DefaultDest = LANCOM
\n
"
);
append_str
(
&
ptr
,
"SrcDiskName =
\"
LANCOM Software CD
\"\n
"
);
WriteFile
(
hf
,
data
,
ptr
-
data
,
&
dwNumberOfBytesWritten
,
NULL
);
CloseHandle
(
hf
);
...
...
@@ -251,10 +267,124 @@ static void test_SetupGetInfInformation(void)
DeleteFileA
(
inf_two
);
}
static
void
test_SetupGetSourceFileLocation
(
void
)
{
char
buffer
[
MAX_PATH
]
=
"not empty"
,
inf_filename
[
MAX_PATH
];
UINT
source_id
;
DWORD
required
;
HINF
hinf
;
BOOL
ret
;
lstrcpyA
(
inf_filename
,
CURR_DIR
);
lstrcatA
(
inf_filename
,
"
\\
"
);
lstrcatA
(
inf_filename
,
"test.inf"
);
create_inf_file
(
inf_filename
);
hinf
=
pSetupOpenInfFileA
(
inf_filename
,
NULL
,
INF_STYLE_WIN4
,
NULL
);
ok
(
hinf
!=
INVALID_HANDLE_VALUE
,
"could not open inf file
\n
"
);
required
=
0
;
source_id
=
0
;
ret
=
pSetupGetSourceFileLocationA
(
hinf
,
NULL
,
"lanconf.exe"
,
&
source_id
,
buffer
,
sizeof
(
buffer
),
&
required
);
ok
(
ret
,
"SetupGetSourceFileLocation failed
\n
"
);
ok
(
required
==
1
,
"unexpected required size: %d
\n
"
,
required
);
ok
(
source_id
==
2
,
"unexpected source id: %d
\n
"
,
source_id
);
ok
(
!
lstrcmpA
(
""
,
buffer
),
"unexpected result string: %s
\n
"
,
buffer
);
pSetupCloseInfFile
(
hinf
);
DeleteFileA
(
inf_filename
);
}
static
void
test_SetupGetSourceInfo
(
void
)
{
char
buffer
[
MAX_PATH
],
inf_filename
[
MAX_PATH
];
DWORD
required
;
HINF
hinf
;
BOOL
ret
;
lstrcpyA
(
inf_filename
,
CURR_DIR
);
lstrcatA
(
inf_filename
,
"
\\
"
);
lstrcatA
(
inf_filename
,
"test.inf"
);
create_inf_file
(
inf_filename
);
hinf
=
pSetupOpenInfFileA
(
inf_filename
,
NULL
,
INF_STYLE_WIN4
,
NULL
);
ok
(
hinf
!=
INVALID_HANDLE_VALUE
,
"could not open inf file
\n
"
);
required
=
0
;
ret
=
pSetupGetSourceInfoA
(
hinf
,
2
,
SRCINFO_PATH
,
buffer
,
sizeof
(
buffer
),
&
required
);
ok
(
ret
,
"SetupGetSourceInfoA failed
\n
"
);
ok
(
required
==
1
,
"unexpected required size: %d
\n
"
,
required
);
ok
(
!
lstrcmpA
(
""
,
buffer
),
"unexpected result string: %s
\n
"
,
buffer
);
required
=
0
;
buffer
[
0
]
=
0
;
ret
=
pSetupGetSourceInfoA
(
hinf
,
2
,
SRCINFO_TAGFILE
,
buffer
,
sizeof
(
buffer
),
&
required
);
ok
(
ret
,
"SetupGetSourceInfoA failed
\n
"
);
ok
(
required
==
28
,
"unexpected required size: %d
\n
"
,
required
);
ok
(
!
lstrcmpA
(
"LANCOM
\\
LANtools
\\
lanconf.cab"
,
buffer
),
"unexpected result string: %s
\n
"
,
buffer
);
required
=
0
;
buffer
[
0
]
=
0
;
ret
=
pSetupGetSourceInfoA
(
hinf
,
2
,
SRCINFO_DESCRIPTION
,
buffer
,
sizeof
(
buffer
),
&
required
);
ok
(
ret
,
"SetupGetSourceInfoA failed
\n
"
);
ok
(
required
==
19
,
"unexpected required size: %d
\n
"
,
required
);
ok
(
!
lstrcmpA
(
"LANCOM Software CD"
,
buffer
),
"unexpected result string: %s
\n
"
,
buffer
);
pSetupCloseInfFile
(
hinf
);
DeleteFileA
(
inf_filename
);
}
static
void
test_SetupGetTargetPath
(
void
)
{
char
buffer
[
MAX_PATH
],
inf_filename
[
MAX_PATH
];
DWORD
required
;
HINF
hinf
;
INFCONTEXT
ctx
;
BOOL
ret
;
lstrcpyA
(
inf_filename
,
CURR_DIR
);
lstrcatA
(
inf_filename
,
"
\\
"
);
lstrcatA
(
inf_filename
,
"test.inf"
);
create_inf_file
(
inf_filename
);
hinf
=
pSetupOpenInfFileA
(
inf_filename
,
NULL
,
INF_STYLE_WIN4
,
NULL
);
ok
(
hinf
!=
INVALID_HANDLE_VALUE
,
"could not open inf file
\n
"
);
ctx
.
Inf
=
hinf
;
ctx
.
CurrentInf
=
hinf
;
ctx
.
Section
=
7
;
ctx
.
Line
=
0
;
required
=
0
;
ret
=
pSetupGetTargetPathA
(
hinf
,
&
ctx
,
NULL
,
buffer
,
sizeof
(
buffer
),
&
required
);
ok
(
ret
,
"SetupGetTargetPathA failed
\n
"
);
ok
(
required
==
10
,
"unexpected required size: %d
\n
"
,
required
);
ok
(
!
lstrcmpiA
(
"C:
\\
LANCOM"
,
buffer
),
"unexpected result string: %s
\n
"
,
buffer
);
pSetupCloseInfFile
(
hinf
);
DeleteFileA
(
inf_filename
);
}
START_TEST
(
query
)
{
init_function_pointers
();
get_directories
();
test_SetupGetInfInformation
();
test_SetupGetSourceFileLocation
();
test_SetupGetSourceInfo
();
test_SetupGetTargetPath
();
}
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