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
Alexey Alyaev
wine
Commits
dd5ae20d
Commit
dd5ae20d
authored
19 years ago
by
James Hawkins
Committed by
Alexandre Julliard
19 years ago
Browse files
Options
Downloads
Patches
Plain Diff
advpack: Load the LDIDs of an install section in TranslateInfString.
parent
e3af1227
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
dlls/advpack/advpack.c
+74
-0
74 additions, 0 deletions
dlls/advpack/advpack.c
dlls/advpack/tests/advpack.c
+5
-3
5 additions, 3 deletions
dlls/advpack/tests/advpack.c
with
79 additions
and
3 deletions
dlls/advpack/advpack.c
+
74
−
0
View file @
dd5ae20d
...
...
@@ -36,6 +36,77 @@ WINE_DEFAULT_DEBUG_CHANNEL(advpack);
typedef
HRESULT
(
WINAPI
*
DLLREGISTER
)
(
void
);
#define MAX_FIELD_LENGTH 512
#define PREFIX_LEN 5
/* parses the destination directory parameters from pszSection
* the parameters are of the form: root,key,value,unknown,fallback
* we first read the reg value root\\key\\value and if that fails,
* use fallback as the destination directory
*/
static
void
get_dest_dir
(
HINF
hInf
,
PCSTR
pszSection
,
PSTR
pszBuffer
,
DWORD
dwSize
)
{
INFCONTEXT
context
;
CHAR
key
[
MAX_PATH
],
value
[
MAX_PATH
];
CHAR
prefix
[
PREFIX_LEN
];
HKEY
root
,
subkey
;
DWORD
size
;
/* load the destination parameters */
SetupFindFirstLineA
(
hInf
,
pszSection
,
NULL
,
&
context
);
SetupGetStringFieldA
(
&
context
,
1
,
prefix
,
PREFIX_LEN
,
&
size
);
SetupGetStringFieldA
(
&
context
,
2
,
key
,
MAX_PATH
,
&
size
);
SetupGetStringFieldA
(
&
context
,
3
,
value
,
MAX_PATH
,
&
size
);
if
(
!
lstrcmpA
(
prefix
,
"HKLM"
))
root
=
HKEY_LOCAL_MACHINE
;
else
if
(
!
lstrcmpA
(
prefix
,
"HKCU"
))
root
=
HKEY_CURRENT_USER
;
else
root
=
NULL
;
/* preserve the buffer size */
size
=
dwSize
;
/* fallback to the default destination dir if reg fails */
if
(
RegOpenKeyA
(
root
,
key
,
&
subkey
)
||
RegQueryValueExA
(
subkey
,
value
,
NULL
,
NULL
,
(
LPBYTE
)
pszBuffer
,
&
size
))
{
SetupGetStringFieldA
(
&
context
,
6
,
pszBuffer
,
dwSize
,
&
size
);
}
RegCloseKey
(
subkey
);
}
/* loads the LDIDs specified in the install section of an INF */
static
void
set_ldids
(
HINF
hInf
,
PCSTR
pszInstallSection
)
{
CHAR
field
[
MAX_FIELD_LENGTH
];
CHAR
key
[
MAX_FIELD_LENGTH
];
CHAR
dest
[
MAX_PATH
];
INFCONTEXT
context
;
DWORD
size
;
int
ldid
;
if
(
!
SetupGetLineTextA
(
NULL
,
hInf
,
pszInstallSection
,
"CustomDestination"
,
field
,
MAX_FIELD_LENGTH
,
&
size
))
return
;
if
(
!
SetupFindFirstLineA
(
hInf
,
field
,
NULL
,
&
context
))
return
;
do
{
SetupGetIntField
(
&
context
,
0
,
&
ldid
);
SetupGetLineTextA
(
&
context
,
NULL
,
NULL
,
NULL
,
key
,
MAX_FIELD_LENGTH
,
&
size
);
get_dest_dir
(
hInf
,
key
,
dest
,
MAX_PATH
);
SetupSetDirectoryIdA
(
hInf
,
ldid
,
dest
);
}
while
(
SetupFindNextLine
(
&
context
,
&
context
));
}
/***********************************************************************
* CloseINFEngine (ADVPACK.@)
*
...
...
@@ -507,6 +578,8 @@ HRESULT WINAPI TranslateInfString(PCSTR pszInfFilename, PCSTR pszInstallSection,
if
(
hInf
==
INVALID_HANDLE_VALUE
)
return
HRESULT_FROM_WIN32
(
ERROR_FILE_NOT_FOUND
);
set_ldids
(
hInf
,
pszInstallSection
);
if
(
!
SetupGetLineTextA
(
NULL
,
hInf
,
pszTranslateSection
,
pszTranslateKey
,
pszBuffer
,
dwBufferSize
,
pdwRequiredSize
))
{
...
...
@@ -516,6 +589,7 @@ HRESULT WINAPI TranslateInfString(PCSTR pszInfFilename, PCSTR pszInstallSection,
return
SPAPI_E_LINE_NOT_FOUND
;
}
SetupCloseInfFile
(
hInf
);
return
S_OK
;
}
...
...
This diff is collapsed.
Click to expand it.
dlls/advpack/tests/advpack.c
+
5
−
3
View file @
dd5ae20d
...
...
@@ -222,7 +222,6 @@ static void translateinfstring_test()
"Expected ERROR_SUCCESS or E_FAIL, got 0x%08x
\n
"
,
(
UINT
)
hr
);
if
(
hr
==
ERROR_SUCCESS
)
todo_wine
{
HKEY
key
;
DWORD
len
=
MAX_PATH
;
...
...
@@ -245,8 +244,11 @@ static void translateinfstring_test()
hr
=
pTranslateInfString
(
"c:
\\
test.inf"
,
NULL
,
"Options.NTx86"
,
"InstallDir"
,
buffer
,
MAX_PATH
,
&
dwSize
,
NULL
);
ok
(
hr
==
S_OK
,
"Expected S_OK, got 0x%08x
\n
"
,
(
UINT
)
hr
);
ok
(
!
strcmp
(
buffer
,
TEST_STRING2
),
"Expected %s, got %s
\n
"
,
TEST_STRING2
,
buffer
);
ok
(
dwSize
==
25
,
"Expected size 25, got %ld
\n
"
,
dwSize
);
todo_wine
{
ok
(
!
strcmp
(
buffer
,
TEST_STRING2
),
"Expected %s, got %s
\n
"
,
TEST_STRING2
,
buffer
);
ok
(
dwSize
==
25
,
"Expected size 25, got %ld
\n
"
,
dwSize
);
}
DeleteFile
(
"c:
\\
a.inf"
);
DeleteFile
(
"c:
\\
test.inf"
);
...
...
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