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
dd5ae20d
Commit
dd5ae20d
authored
Feb 20, 2006
by
James Hawkins
Committed by
Alexandre Julliard
Feb 21, 2006
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
advpack: Load the LDIDs of an install section in TranslateInfString.
parent
e3af1227
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
79 additions
and
3 deletions
+79
-3
advpack.c
dlls/advpack/advpack.c
+74
-0
advpack.c
dlls/advpack/tests/advpack.c
+5
-3
No files found.
dlls/advpack/advpack.c
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
;
}
...
...
dlls/advpack/tests/advpack.c
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"
);
...
...
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