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
5b8641a5
Commit
5b8641a5
authored
May 30, 2007
by
James Hawkins
Committed by
Alexandre Julliard
May 31, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msi: Implement the WriteEnvironmentStrings standard action.
parent
2854c542
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
125 additions
and
7 deletions
+125
-7
action.c
dlls/msi/action.c
+125
-7
No files found.
dlls/msi/action.c
View file @
5b8641a5
...
...
@@ -4567,6 +4567,131 @@ static UINT ACTION_InstallODBC( MSIPACKAGE *package )
return
rc
;
}
#define ENV_ACT_SETALWAYS 0x1
#define ENV_ACT_SETABSENT 0x2
#define ENV_ACT_REMOVE 0x4
#define ENV_MOD_MACHINE 0x20000000
#define ENV_MOD_APPEND 0x40000000
#define ENV_MOD_PREFIX 0x80000000
static
UINT
ITERATE_WriteEnvironmentString
(
MSIRECORD
*
rec
,
LPVOID
param
)
{
LPCWSTR
var
,
value
;
LPWSTR
val
=
NULL
,
ptr
;
DWORD
flags
,
type
,
size
;
LONG
res
;
HKEY
env
,
root
=
HKEY_CURRENT_USER
;
static
const
WCHAR
environment
[]
=
{
'S'
,
'y'
,
's'
,
't'
,
'e'
,
'm'
,
'\\'
,
'C'
,
'u'
,
'r'
,
'r'
,
'e'
,
'n'
,
't'
,
'C'
,
'o'
,
'n'
,
't'
,
'r'
,
'o'
,
'l'
,
'S'
,
'e'
,
't'
,
'\\'
,
'C'
,
'o'
,
'n'
,
't'
,
'r'
,
'o'
,
'l'
,
'\\'
,
'S'
,
'e'
,
's'
,
's'
,
'i'
,
'o'
,
'n'
,
' '
,
'M'
,
'a'
,
'n'
,
'a'
,
'g'
,
'e'
,
'r'
,
'\\'
,
'E'
,
'n'
,
'v'
,
'i'
,
'r'
,
'o'
,
'n'
,
'm'
,
'e'
,
'n'
,
't'
,
0
};
static
const
WCHAR
semicolon
[]
=
{
';'
,
0
};
var
=
MSI_RecordGetString
(
rec
,
1
);
value
=
MSI_RecordGetString
(
rec
,
2
);
flags
=
MSI_RecordGetInteger
(
rec
,
3
);
TRACE
(
"(%s, %s, %08x)
\n
"
,
debugstr_w
(
var
),
debugstr_w
(
value
),
flags
);
if
(
flags
&
ENV_MOD_MACHINE
)
root
=
HKEY_LOCAL_MACHINE
;
res
=
RegOpenKeyExW
(
root
,
environment
,
0
,
KEY_ALL_ACCESS
,
&
env
);
if
(
res
!=
ERROR_SUCCESS
)
return
res
;
if
(
flags
&
ENV_ACT_REMOVE
)
{
res
=
RegDeleteKeyW
(
env
,
var
);
RegCloseKey
(
env
);
return
res
;
}
size
=
0
;
res
=
RegQueryValueExW
(
env
,
var
,
NULL
,
&
type
,
NULL
,
&
size
);
if
((
res
!=
ERROR_MORE_DATA
&&
res
!=
ERROR_FILE_NOT_FOUND
)
||
type
!=
REG_SZ
)
{
RegCloseKey
(
env
);
return
res
;
}
if
(
res
!=
ERROR_FILE_NOT_FOUND
)
{
if
(
flags
&
ENV_ACT_SETABSENT
)
{
res
=
ERROR_SUCCESS
;
goto
done
;
}
/* oldvals;newval */
size
=
(
lstrlenW
(
value
)
+
1
+
size
)
*
sizeof
(
WCHAR
);
val
=
msi_alloc
(
size
);
ptr
=
val
;
if
(
!
val
)
{
res
=
ERROR_OUTOFMEMORY
;
goto
done
;
}
if
(
flags
&
ENV_MOD_PREFIX
)
{
lstrcpyW
(
val
,
value
);
lstrcatW
(
val
,
semicolon
);
ptr
=
val
+
lstrlenW
(
value
)
+
1
;
}
res
=
RegQueryValueExW
(
env
,
var
,
NULL
,
&
type
,
(
LPVOID
)
ptr
,
&
size
);
if
(
res
!=
ERROR_SUCCESS
)
goto
done
;
if
(
!
flags
||
flags
&
ENV_MOD_APPEND
)
{
lstrcatW
(
val
,
semicolon
);
lstrcatW
(
val
,
value
);
}
}
else
{
size
=
(
lstrlenW
(
value
)
+
1
)
*
sizeof
(
WCHAR
);
val
=
msi_alloc
(
size
);
if
(
!
val
)
{
res
=
ERROR_OUTOFMEMORY
;
goto
done
;
}
lstrcpyW
(
val
,
value
);
}
res
=
RegSetValueExW
(
env
,
var
,
0
,
type
,
(
LPVOID
)
val
,
size
);
done:
RegCloseKey
(
env
);
msi_free
(
val
);
return
res
;
}
static
UINT
ACTION_WriteEnvironmentStrings
(
MSIPACKAGE
*
package
)
{
UINT
rc
;
MSIQUERY
*
view
;
static
const
WCHAR
ExecSeqQuery
[]
=
{
'S'
,
'E'
,
'L'
,
'E'
,
'C'
,
'T'
,
' '
,
'*'
,
' '
,
'F'
,
'R'
,
'O'
,
'M'
,
' '
,
'`'
,
'E'
,
'n'
,
'v'
,
'i'
,
'r'
,
'o'
,
'n'
,
'm'
,
'e'
,
'n'
,
't'
,
'`'
,
0
};
rc
=
MSI_DatabaseOpenViewW
(
package
->
db
,
ExecSeqQuery
,
&
view
);
if
(
rc
!=
ERROR_SUCCESS
)
return
ERROR_SUCCESS
;
rc
=
MSI_IterateRecords
(
view
,
NULL
,
ITERATE_WriteEnvironmentString
,
package
);
msiobj_release
(
&
view
->
hdr
);
return
rc
;
}
static
UINT
msi_unimplemented_action_stub
(
MSIPACKAGE
*
package
,
LPCSTR
action
,
LPCWSTR
table
)
{
...
...
@@ -4661,13 +4786,6 @@ static UINT ACTION_ValidateProductID( MSIPACKAGE *package )
return
msi_unimplemented_action_stub
(
package
,
"ValidateProductID"
,
table
);
}
static
UINT
ACTION_WriteEnvironmentStrings
(
MSIPACKAGE
*
package
)
{
static
const
WCHAR
table
[]
=
{
'E'
,
'n'
,
'v'
,
'i'
,
'r'
,
'o'
,
'n'
,
'm'
,
'e'
,
'n'
,
't'
,
0
};
return
msi_unimplemented_action_stub
(
package
,
"WriteEnvironmentStrings"
,
table
);
}
static
UINT
ACTION_RemoveEnvironmentStrings
(
MSIPACKAGE
*
package
)
{
static
const
WCHAR
table
[]
=
{
...
...
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