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
659768e2
Commit
659768e2
authored
Sep 15, 2009
by
Hans Leidekker
Committed by
Alexandre Julliard
Sep 16, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msi: Set or override a user environment string when there is no prefix.
parent
d13b2b65
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
98 additions
and
2 deletions
+98
-2
action.c
dlls/msi/action.c
+6
-2
install.c
dlls/msi/tests/install.c
+92
-0
No files found.
dlls/msi/action.c
View file @
659768e2
...
...
@@ -5313,8 +5313,7 @@ static LONG env_set_flags( LPCWSTR *name, LPCWSTR *value, DWORD *flags )
}
}
if
(
!*
flags
||
check_flag_combo
(
*
flags
,
ENV_ACT_SETALWAYS
|
ENV_ACT_SETABSENT
)
||
if
(
check_flag_combo
(
*
flags
,
ENV_ACT_SETALWAYS
|
ENV_ACT_SETABSENT
)
||
check_flag_combo
(
*
flags
,
ENV_ACT_REMOVEMATCH
|
ENV_ACT_SETABSENT
)
||
check_flag_combo
(
*
flags
,
ENV_ACT_REMOVEMATCH
|
ENV_ACT_SETALWAYS
)
||
check_flag_combo
(
*
flags
,
ENV_ACT_SETABSENT
|
ENV_MOD_MASK
))
...
...
@@ -5323,6 +5322,9 @@ static LONG env_set_flags( LPCWSTR *name, LPCWSTR *value, DWORD *flags )
return
ERROR_FUNCTION_FAILED
;
}
if
(
!*
flags
)
*
flags
=
ENV_ACT_SETALWAYS
|
ENV_ACT_REMOVE
;
return
ERROR_SUCCESS
;
}
...
...
@@ -5350,6 +5352,8 @@ static UINT ITERATE_WriteEnvironmentString( MSIRECORD *rec, LPVOID param )
name
=
MSI_RecordGetString
(
rec
,
2
);
value
=
MSI_RecordGetString
(
rec
,
3
);
TRACE
(
"name %s value %s
\n
"
,
debugstr_w
(
name
),
debugstr_w
(
value
));
res
=
env_set_flags
(
&
name
,
&
value
,
&
flags
);
if
(
res
!=
ERROR_SUCCESS
)
goto
done
;
...
...
dlls/msi/tests/install.c
View file @
659768e2
...
...
@@ -124,6 +124,7 @@ static const CHAR install_exec_seq_dat[] = "Action\tCondition\tSequence\n"
"MoveFiles
\t\t
1700
\n
"
"InstallFiles
\t\t
4000
\n
"
"DuplicateFiles
\t\t
4500
\n
"
"WriteEnvironmentStrings
\t\t
4550
\n
"
"CreateShortcuts
\t\t
4600
\n
"
"InstallServices
\t\t
5000
\n
"
"InstallFinalize
\t\t
6600
\n
"
...
...
@@ -165,6 +166,15 @@ static const CHAR shortcut_dat[] = "Shortcut\tDirectory_\tName\tComponent_\tTarg
"Shortcut
\t
Shortcut
\n
"
"Shortcut
\t
MSITESTDIR
\t
Shortcut
\t
component
\t
Shortcut
\t\t
Shortcut
\t\t\t\t\t\n
"
;
static
const
CHAR
environment_dat
[]
=
"Environment
\t
Name
\t
Value
\t
Component_
\n
"
"s72
\t
l255
\t
L255
\t
s72
\n
"
"Environment
\t
Environment
\n
"
"Var1
\t
=-MSITESTVAR1
\t
1
\t
One
\n
"
"Var2
\t
MSITESTVAR2
\t
1
\t
One
\n
"
"Var3
\t
=-MSITESTVAR3
\t
1
\t
One
\n
"
"Var4
\t
MSITESTVAR4
\t
1
\t
One
\n
"
;
static
const
CHAR
up_property_dat
[]
=
"Property
\t
Value
\n
"
"s72
\t
l0
\n
"
"Property
\t
Property
\n
"
...
...
@@ -904,6 +914,19 @@ static const msi_table sc_tables[] =
ADD_TABLE
(
shortcut
)
};
static
const
msi_table
env_tables
[]
=
{
ADD_TABLE
(
component
),
ADD_TABLE
(
directory
),
ADD_TABLE
(
feature
),
ADD_TABLE
(
feature_comp
),
ADD_TABLE
(
file
),
ADD_TABLE
(
install_exec_seq
),
ADD_TABLE
(
media
),
ADD_TABLE
(
property
),
ADD_TABLE
(
environment
)
};
static
const
msi_table
up_tables
[]
=
{
ADD_TABLE
(
component
),
...
...
@@ -6240,6 +6263,74 @@ static void test_shortcut(void)
delete_test_files
();
}
static
void
test_envvar
(
void
)
{
UINT
r
;
HKEY
env
;
LONG
res
;
DWORD
type
,
size
;
char
buffer
[
16
];
create_test_files
();
create_database
(
msifile
,
env_tables
,
sizeof
(
env_tables
)
/
sizeof
(
msi_table
));
res
=
RegCreateKeyExA
(
HKEY_CURRENT_USER
,
"Environment"
,
0
,
NULL
,
0
,
KEY_ALL_ACCESS
,
NULL
,
&
env
,
NULL
);
ok
(
res
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
res
);
res
=
RegSetValueExA
(
env
,
"MSITESTVAR1"
,
0
,
REG_SZ
,
(
const
BYTE
*
)
"0"
,
2
);
ok
(
res
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
res
);
res
=
RegSetValueExA
(
env
,
"MSITESTVAR2"
,
0
,
REG_SZ
,
(
const
BYTE
*
)
"0"
,
2
);
ok
(
res
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
res
);
r
=
MsiInstallProductA
(
msifile
,
NULL
);
ok
(
r
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %u
\n
"
,
r
);
type
=
REG_NONE
;
size
=
sizeof
(
buffer
);
buffer
[
0
]
=
0
;
res
=
RegQueryValueExA
(
env
,
"MSITESTVAR1"
,
NULL
,
&
type
,
(
LPBYTE
)
buffer
,
&
size
);
ok
(
res
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
res
);
ok
(
type
==
REG_SZ
,
"Expected REG_SZ, got %u
\n
"
,
type
);
ok
(
!
lstrcmp
(
buffer
,
"1"
),
"Expected
\"
1
\"
, got %s
\n
"
,
buffer
);
res
=
RegDeleteValueA
(
env
,
"MSITESTVAR1"
);
ok
(
res
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
res
);
type
=
REG_NONE
;
size
=
sizeof
(
buffer
);
buffer
[
0
]
=
0
;
res
=
RegQueryValueExA
(
env
,
"MSITESTVAR2"
,
NULL
,
&
type
,
(
LPBYTE
)
buffer
,
&
size
);
ok
(
res
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
res
);
ok
(
type
==
REG_SZ
,
"Expected REG_SZ, got %u
\n
"
,
type
);
ok
(
!
lstrcmp
(
buffer
,
"1"
),
"Expected
\"
1
\"
, got %s
\n
"
,
buffer
);
res
=
RegDeleteValueA
(
env
,
"MSITESTVAR2"
);
ok
(
res
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
res
);
res
=
RegDeleteValueA
(
env
,
"MSITESTVAR3"
);
ok
(
res
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
res
);
res
=
RegDeleteValueA
(
env
,
"MSITESTVAR4"
);
ok
(
res
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
res
);
RegCloseKey
(
env
);
delete_pf
(
"msitest
\\
cabout
\\
new
\\
five.txt"
,
TRUE
);
delete_pf
(
"msitest
\\
cabout
\\
new"
,
FALSE
);
delete_pf
(
"msitest
\\
cabout
\\
four.txt"
,
TRUE
);
delete_pf
(
"msitest
\\
cabout"
,
FALSE
);
delete_pf
(
"msitest
\\
changed
\\
three.txt"
,
TRUE
);
delete_pf
(
"msitest
\\
changed"
,
FALSE
);
delete_pf
(
"msitest
\\
first
\\
two.txt"
,
TRUE
);
delete_pf
(
"msitest
\\
first"
,
FALSE
);
delete_pf
(
"msitest
\\
filename"
,
TRUE
);
delete_pf
(
"msitest
\\
one.txt"
,
TRUE
);
delete_pf
(
"msitest
\\
service.exe"
,
TRUE
);
delete_pf
(
"msitest"
,
FALSE
);
delete_test_files
();
}
START_TEST
(
install
)
{
DWORD
len
;
...
...
@@ -6322,6 +6413,7 @@ START_TEST(install)
test_propcase
();
test_int_widths
();
test_shortcut
();
test_envvar
();
DeleteFileA
(
log_file
);
...
...
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