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
d92e738f
Commit
d92e738f
authored
Jan 13, 2009
by
Hans Leidekker
Committed by
Alexandre Julliard
Jan 13, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
setupapi: Fix resolving target path when given a section. Default to the system directory.
parent
c6144893
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
118 additions
and
8 deletions
+118
-8
query.c
dlls/setupapi/query.c
+14
-8
query.c
dlls/setupapi/tests/query.c
+104
-0
No files found.
dlls/setupapi/query.c
View file @
d92e738f
...
...
@@ -579,18 +579,24 @@ BOOL WINAPI SetupGetTargetPathW( HINF hinf, PINFCONTEXT context, PCWSTR section,
{
'D'
,
'e'
,
'f'
,
'a'
,
'u'
,
'l'
,
't'
,
'D'
,
'e'
,
's'
,
't'
,
'D'
,
'i'
,
'r'
,
0
};
INFCONTEXT
ctx
;
WCHAR
*
dir
;
WCHAR
*
dir
,
systemdir
[
MAX_PATH
]
;
unsigned
int
size
;
BOOL
ret
=
FALSE
;
TRACE
(
"%p, %p, %s, %p, 0x%08x, %p
\n
"
,
hinf
,
context
,
debugstr_w
(
section
),
buffer
,
buffer_size
,
required_size
);
if
(
context
&&
!
SetupFindFirstLineW
(
hinf
,
destination_dirs
,
NULL
,
context
))
return
FALSE
;
else
if
(
section
&&
!
SetupFindFirstLineW
(
hinf
,
section
,
NULL
,
&
ctx
))
return
FALSE
;
else
if
(
!
SetupFindFirstLineW
(
hinf
,
destination_dirs
,
default_dest_dir
,
&
ctx
))
return
FALSE
;
if
(
!
(
dir
=
PARSER_get_dest_dir
(
context
?
context
:
&
ctx
)))
return
FALSE
;
if
(
context
)
ret
=
SetupFindFirstLineW
(
hinf
,
destination_dirs
,
NULL
,
context
);
else
if
(
section
)
{
if
(
!
(
ret
=
SetupFindFirstLineW
(
hinf
,
destination_dirs
,
section
,
&
ctx
)))
ret
=
SetupFindFirstLineW
(
hinf
,
destination_dirs
,
default_dest_dir
,
&
ctx
);
}
if
(
!
ret
||
!
(
dir
=
PARSER_get_dest_dir
(
context
?
context
:
&
ctx
)))
{
GetSystemDirectoryW
(
systemdir
,
MAX_PATH
);
dir
=
systemdir
;
}
size
=
strlenW
(
dir
)
+
1
;
if
(
required_size
)
*
required_size
=
size
;
...
...
@@ -605,7 +611,7 @@ BOOL WINAPI SetupGetTargetPathW( HINF hinf, PINFCONTEXT context, PCWSTR section,
return
FALSE
;
}
}
HeapFree
(
GetProcessHeap
(),
0
,
dir
);
if
(
dir
!=
systemdir
)
HeapFree
(
GetProcessHeap
(),
0
,
dir
);
return
TRUE
;
}
...
...
dlls/setupapi/tests/query.c
View file @
d92e738f
...
...
@@ -68,6 +68,37 @@ static const char inf_data2[] =
"sp1qfe
\\
winhttp.dll=3EC6F518114606CA59D4160322077437,000500010A280615,331776,SP1QFE
\n
"
"sp1qfe
\\
xpob2res.dll=DB83156B9F496F20D1EA70E4ABEC0166,000500010A280622,158720,SP1QFE
\n
"
;
static
const
char
inf_data3
[]
=
"[Version]
\n
"
"Signature =
\"
$Windows NT$
\"\n
"
"[DestinationDirs]
\n
"
"CopyAlways.Windir.files = 10
\n
"
"[CopyAlways.Windir.Files]
\n
"
"WindowsCodecs.dll
\n
"
;
static
const
char
inf_data4
[]
=
"[Version]
\n
"
"Signature =
\"
$Windows NT$
\"\n
"
"[CopyAlways.System32.Files]
\n
"
"WindowsCodecs.dll
\n
"
;
static
const
char
inf_data5
[]
=
"[Version]
\n
"
"Signature =
\"
$Windows NT$
\"\n
"
"[DestinationDirs]
\n
"
"DefaultDestDir = 11
\n
"
"CopyAlways.Windir.files = 10
\n
"
"[CopyAlways.Windir.Files]
\n
"
"WindowsCodecs.dll
\n
"
;
static
const
char
inf_data6
[]
=
"[Version]
\n
"
"Signature =
\"
$Windows NT$
\"\n
"
"[DestinationDirs]
\n
"
"DefaultDestDir = 10
\n
"
"[CopyAlways.Windir.Files]
\n
"
"WindowsCodecs.dll
\n
"
;
static
void
create_inf_file
(
LPSTR
filename
,
const
char
*
data
,
DWORD
size
)
{
DWORD
dwNumberOfBytesWritten
;
...
...
@@ -398,6 +429,79 @@ static void test_SetupGetTargetPath(void)
SetupCloseInfFile
(
hinf
);
DeleteFileA
(
inf_filename
);
create_inf_file
(
inf_filename
,
inf_data3
,
sizeof
(
inf_data3
)
-
1
);
hinf
=
SetupOpenInfFileA
(
inf_filename
,
NULL
,
INF_STYLE_WIN4
,
NULL
);
ok
(
hinf
!=
INVALID_HANDLE_VALUE
,
"could not open inf file
\n
"
);
required
=
0
;
ret
=
SetupGetTargetPathA
(
hinf
,
NULL
,
"CopyAlways.Windir.Files"
,
buffer
,
sizeof
(
buffer
),
&
required
);
ok
(
ret
,
"SetupGetTargetPathA failed
\n
"
);
lstrcpyA
(
destfile
,
WIN_DIR
);
ok
(
required
==
lstrlenA
(
destfile
)
+
1
,
"unexpected required size: %d
\n
"
,
required
);
ok
(
!
lstrcmpiA
(
buffer
,
destfile
),
"unexpected path: %s
\n
"
,
buffer
);
SetupCloseInfFile
(
hinf
);
DeleteFileA
(
inf_filename
);
create_inf_file
(
inf_filename
,
inf_data4
,
sizeof
(
inf_data4
)
-
1
);
hinf
=
SetupOpenInfFileA
(
inf_filename
,
NULL
,
INF_STYLE_WIN4
,
NULL
);
ok
(
hinf
!=
INVALID_HANDLE_VALUE
,
"could not open inf file
\n
"
);
required
=
0
;
ret
=
SetupGetTargetPathA
(
hinf
,
NULL
,
"CopyAlways.System32.Files"
,
buffer
,
sizeof
(
buffer
),
&
required
);
ok
(
ret
,
"SetupGetTargetPathA failed
\n
"
);
lstrcpyA
(
destfile
,
WIN_DIR
);
lstrcatA
(
destfile
,
"
\\
system32"
);
ok
(
required
==
lstrlenA
(
destfile
)
+
1
,
"unexpected required size: %d
\n
"
,
required
);
ok
(
!
lstrcmpiA
(
buffer
,
destfile
),
"unexpected path: %s
\n
"
,
buffer
);
SetupCloseInfFile
(
hinf
);
DeleteFileA
(
inf_filename
);
create_inf_file
(
inf_filename
,
inf_data5
,
sizeof
(
inf_data5
)
-
1
);
hinf
=
SetupOpenInfFileA
(
inf_filename
,
NULL
,
INF_STYLE_WIN4
,
NULL
);
ok
(
hinf
!=
INVALID_HANDLE_VALUE
,
"could not open inf file
\n
"
);
required
=
0
;
ret
=
SetupGetTargetPathA
(
hinf
,
NULL
,
"CopyAlways.Windir.Files"
,
buffer
,
sizeof
(
buffer
),
&
required
);
ok
(
ret
,
"SetupGetTargetPathA failed
\n
"
);
lstrcpyA
(
destfile
,
WIN_DIR
);
ok
(
required
==
lstrlenA
(
destfile
)
+
1
,
"unexpected required size: %d
\n
"
,
required
);
ok
(
!
lstrcmpiA
(
buffer
,
destfile
),
"unexpected path: %s
\n
"
,
buffer
);
SetupCloseInfFile
(
hinf
);
DeleteFileA
(
inf_filename
);
create_inf_file
(
inf_filename
,
inf_data6
,
sizeof
(
inf_data6
)
-
1
);
hinf
=
SetupOpenInfFileA
(
inf_filename
,
NULL
,
INF_STYLE_WIN4
,
NULL
);
ok
(
hinf
!=
INVALID_HANDLE_VALUE
,
"could not open inf file
\n
"
);
required
=
0
;
ret
=
SetupGetTargetPathA
(
hinf
,
NULL
,
"CopyAlways.Windir.Files"
,
buffer
,
sizeof
(
buffer
),
&
required
);
ok
(
ret
,
"SetupGetTargetPathA failed
\n
"
);
lstrcpyA
(
destfile
,
WIN_DIR
);
ok
(
required
==
lstrlenA
(
destfile
)
+
1
,
"unexpected required size: %d
\n
"
,
required
);
ok
(
!
lstrcmpiA
(
buffer
,
destfile
),
"unexpected path: %s
\n
"
,
buffer
);
SetupCloseInfFile
(
hinf
);
DeleteFileA
(
inf_filename
);
}
START_TEST
(
query
)
...
...
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