Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
0f44b3bd
Commit
0f44b3bd
authored
Nov 06, 2023
by
Alex Henrie
Committed by
Alexandre Julliard
Nov 07, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msiexec: Use CRT allocation functions.
parent
b1bd7234
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
23 deletions
+22
-23
msiexec.c
programs/msiexec/msiexec.c
+22
-23
No files found.
programs/msiexec/msiexec.c
View file @
0f44b3bd
...
@@ -29,7 +29,6 @@
...
@@ -29,7 +29,6 @@
#include <stdio.h>
#include <stdio.h>
#include "wine/debug.h"
#include "wine/debug.h"
#include "wine/heap.h"
#include "initguid.h"
#include "initguid.h"
DEFINE_GUID
(
GUID_NULL
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
);
DEFINE_GUID
(
GUID_NULL
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
);
...
@@ -73,8 +72,8 @@ static void ShowUsage(int ExitCode)
...
@@ -73,8 +72,8 @@ static void ShowUsage(int ExitCode)
No typo: The LPWSTR parameter must be a LPWSTR * for this mode */
No typo: The LPWSTR parameter must be a LPWSTR * for this mode */
len
=
LoadStringW
(
hmsi
,
10
,
(
LPWSTR
)
&
msi_res
,
0
);
len
=
LoadStringW
(
hmsi
,
10
,
(
LPWSTR
)
&
msi_res
,
0
);
msi_res
=
HeapAlloc
(
GetProcessHeap
(),
0
,
(
len
+
1
)
*
sizeof
(
WCHAR
));
msi_res
=
malloc
(
(
len
+
1
)
*
sizeof
(
WCHAR
));
msiexec_help
=
HeapAlloc
(
GetProcessHeap
(),
0
,
(
len
+
1
)
*
sizeof
(
WCHAR
)
+
sizeof
(
msiexec_version
));
msiexec_help
=
malloc
(
(
len
+
1
)
*
sizeof
(
WCHAR
)
+
sizeof
(
msiexec_version
));
if
(
msi_res
&&
msiexec_help
)
{
if
(
msi_res
&&
msiexec_help
)
{
*
msi_res
=
0
;
*
msi_res
=
0
;
LoadStringW
(
hmsi
,
10
,
msi_res
,
len
+
1
);
LoadStringW
(
hmsi
,
10
,
msi_res
,
len
+
1
);
...
@@ -82,8 +81,8 @@ static void ShowUsage(int ExitCode)
...
@@ -82,8 +81,8 @@ static void ShowUsage(int ExitCode)
swprintf
(
msiexec_help
,
len
+
1
+
ARRAY_SIZE
(
msiexec_version
),
msi_res
,
msiexec_version
);
swprintf
(
msiexec_help
,
len
+
1
+
ARRAY_SIZE
(
msiexec_version
),
msi_res
,
msiexec_version
);
MsiMessageBoxW
(
0
,
msiexec_help
,
NULL
,
0
,
GetUserDefaultLangID
(),
0
);
MsiMessageBoxW
(
0
,
msiexec_help
,
NULL
,
0
,
GetUserDefaultLangID
(),
0
);
}
}
HeapFree
(
GetProcessHeap
(),
0
,
msi_res
);
free
(
msi_res
);
HeapFree
(
GetProcessHeap
(),
0
,
msiexec_help
);
free
(
msiexec_help
);
ExitProcess
(
ExitCode
);
ExitProcess
(
ExitCode
);
}
}
...
@@ -101,7 +100,7 @@ static VOID StringListAppend(struct string_list **list, LPCWSTR str)
...
@@ -101,7 +100,7 @@ static VOID StringListAppend(struct string_list **list, LPCWSTR str)
{
{
struct
string_list
*
entry
;
struct
string_list
*
entry
;
entry
=
HeapAlloc
(
GetProcessHeap
(),
0
,
FIELD_OFFSET
(
struct
string_list
,
str
[
lstrlenW
(
str
)
+
1
]));
entry
=
malloc
(
FIELD_OFFSET
(
struct
string_list
,
str
[
wcslen
(
str
)
+
1
]));
if
(
!
entry
)
if
(
!
entry
)
{
{
WINE_ERR
(
"Out of memory!
\n
"
);
WINE_ERR
(
"Out of memory!
\n
"
);
...
@@ -134,7 +133,7 @@ static LPWSTR build_properties(struct string_list *property_list)
...
@@ -134,7 +133,7 @@ static LPWSTR build_properties(struct string_list *property_list)
for
(
list
=
property_list
;
list
;
list
=
list
->
next
)
for
(
list
=
property_list
;
list
;
list
=
list
->
next
)
len
+=
lstrlenW
(
list
->
str
)
+
3
;
len
+=
lstrlenW
(
list
->
str
)
+
3
;
ret
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len
*
sizeof
(
WCHAR
)
);
ret
=
malloc
(
len
*
sizeof
(
WCHAR
)
);
/* add a space before each string, and quote the value */
/* add a space before each string, and quote the value */
p
=
ret
;
p
=
ret
;
...
@@ -178,7 +177,7 @@ static LPWSTR build_transforms(struct string_list *transform_list)
...
@@ -178,7 +177,7 @@ static LPWSTR build_transforms(struct string_list *transform_list)
for
(
list
=
transform_list
;
list
;
list
=
list
->
next
)
for
(
list
=
transform_list
;
list
;
list
=
list
->
next
)
len
+=
lstrlenW
(
list
->
str
)
+
1
;
len
+=
lstrlenW
(
list
->
str
)
+
1
;
ret
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len
*
sizeof
(
WCHAR
)
);
ret
=
malloc
(
len
*
sizeof
(
WCHAR
)
);
/* add all the transforms with a semicolon between each one */
/* add all the transforms with a semicolon between each one */
p
=
ret
;
p
=
ret
;
...
@@ -218,10 +217,10 @@ static BOOL msi_strequal(LPCWSTR str1, LPCSTR str2)
...
@@ -218,10 +217,10 @@ static BOOL msi_strequal(LPCWSTR str1, LPCSTR str2)
return
FALSE
;
return
FALSE
;
if
(
lstrlenW
(
str1
)
!=
(
len
-
1
)
)
if
(
lstrlenW
(
str1
)
!=
(
len
-
1
)
)
return
FALSE
;
return
FALSE
;
strW
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
WCHAR
)
*
len
);
strW
=
malloc
(
sizeof
(
WCHAR
)
*
len
);
MultiByteToWideChar
(
CP_ACP
,
0
,
str2
,
-
1
,
strW
,
len
);
MultiByteToWideChar
(
CP_ACP
,
0
,
str2
,
-
1
,
strW
,
len
);
ret
=
CompareStringW
(
GetThreadLocale
(),
NORM_IGNORECASE
,
str1
,
len
,
strW
,
len
);
ret
=
CompareStringW
(
GetThreadLocale
(),
NORM_IGNORECASE
,
str1
,
len
,
strW
,
len
);
HeapFree
(
GetProcessHeap
(),
0
,
strW
);
free
(
strW
);
return
(
ret
==
CSTR_EQUAL
);
return
(
ret
==
CSTR_EQUAL
);
}
}
...
@@ -246,10 +245,10 @@ static BOOL msi_strprefix(LPCWSTR str1, LPCSTR str2)
...
@@ -246,10 +245,10 @@ static BOOL msi_strprefix(LPCWSTR str1, LPCSTR str2)
return
FALSE
;
return
FALSE
;
if
(
lstrlenW
(
str1
)
<
(
len
-
1
)
)
if
(
lstrlenW
(
str1
)
<
(
len
-
1
)
)
return
FALSE
;
return
FALSE
;
strW
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
WCHAR
)
*
len
);
strW
=
malloc
(
sizeof
(
WCHAR
)
*
len
);
MultiByteToWideChar
(
CP_ACP
,
0
,
str2
,
-
1
,
strW
,
len
);
MultiByteToWideChar
(
CP_ACP
,
0
,
str2
,
-
1
,
strW
,
len
);
ret
=
CompareStringW
(
GetThreadLocale
(),
NORM_IGNORECASE
,
str1
,
len
-
1
,
strW
,
len
-
1
);
ret
=
CompareStringW
(
GetThreadLocale
(),
NORM_IGNORECASE
,
str1
,
len
-
1
,
strW
,
len
-
1
);
HeapFree
(
GetProcessHeap
(),
0
,
strW
);
free
(
strW
);
return
(
ret
==
CSTR_EQUAL
);
return
(
ret
==
CSTR_EQUAL
);
}
}
...
@@ -388,7 +387,7 @@ static DWORD client_pid;
...
@@ -388,7 +387,7 @@ static DWORD client_pid;
static
DWORD
CALLBACK
custom_action_thread
(
void
*
arg
)
static
DWORD
CALLBACK
custom_action_thread
(
void
*
arg
)
{
{
GUID
guid
=
*
(
GUID
*
)
arg
;
GUID
guid
=
*
(
GUID
*
)
arg
;
heap_
free
(
arg
);
free
(
arg
);
return
__wine_msi_call_dll_function
(
client_pid
,
&
guid
);
return
__wine_msi_call_dll_function
(
client_pid
,
&
guid
);
}
}
...
@@ -429,7 +428,7 @@ static int custom_action_server(const WCHAR *arg)
...
@@ -429,7 +428,7 @@ static int custom_action_server(const WCHAR *arg)
return
0
;
return
0
;
}
}
thread_guid
=
heap_
alloc
(
sizeof
(
GUID
));
thread_guid
=
m
alloc
(
sizeof
(
GUID
));
memcpy
(
thread_guid
,
&
guid
,
sizeof
(
GUID
));
memcpy
(
thread_guid
,
&
guid
,
sizeof
(
GUID
));
thread
=
CreateThread
(
NULL
,
0
,
custom_action_thread
,
thread_guid
,
0
,
NULL
);
thread
=
CreateThread
(
NULL
,
0
,
custom_action_thread
,
thread_guid
,
0
,
NULL
);
...
@@ -533,13 +532,13 @@ static void process_args( WCHAR *cmdline, int *pargc, WCHAR ***pargv )
...
@@ -533,13 +532,13 @@ static void process_args( WCHAR *cmdline, int *pargc, WCHAR ***pargv )
*
pargv
=
NULL
;
*
pargv
=
NULL
;
count
=
chomp
(
cmdline
,
NULL
);
count
=
chomp
(
cmdline
,
NULL
);
if
(
!
(
p
=
HeapAlloc
(
GetProcessHeap
(),
0
,
(
lstrlenW
(
cmdline
)
+
count
+
1
)
*
sizeof
(
WCHAR
)
)))
if
(
!
(
p
=
malloc
(
(
wcslen
(
cmdline
)
+
count
+
1
)
*
sizeof
(
WCHAR
)
)))
return
;
return
;
count
=
chomp
(
cmdline
,
p
);
count
=
chomp
(
cmdline
,
p
);
if
(
!
(
argv
=
HeapAlloc
(
GetProcessHeap
(),
0
,
(
count
+
1
)
*
sizeof
(
WCHAR
*
)
)))
if
(
!
(
argv
=
malloc
(
(
count
+
1
)
*
sizeof
(
WCHAR
*
)
)))
{
{
HeapFree
(
GetProcessHeap
(),
0
,
p
);
free
(
p
);
return
;
return
;
}
}
for
(
i
=
0
;
i
<
count
;
i
++
)
for
(
i
=
0
;
i
<
count
;
i
++
)
...
@@ -569,7 +568,7 @@ static BOOL process_args_from_reg( const WCHAR *ident, int *pargc, WCHAR ***parg
...
@@ -569,7 +568,7 @@ static BOOL process_args_from_reg( const WCHAR *ident, int *pargc, WCHAR ***parg
if
(
r
==
ERROR_SUCCESS
&&
type
==
REG_SZ
)
if
(
r
==
ERROR_SUCCESS
&&
type
==
REG_SZ
)
{
{
int
len
=
lstrlenW
(
*
pargv
[
0
]
);
int
len
=
lstrlenW
(
*
pargv
[
0
]
);
if
(
!
(
buf
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sz
+
(
len
+
1
)
*
sizeof
(
WCHAR
)
)))
if
(
!
(
buf
=
malloc
(
(
len
+
1
)
*
sizeof
(
WCHAR
)
)))
{
{
RegCloseKey
(
hkey
);
RegCloseKey
(
hkey
);
return
FALSE
;
return
FALSE
;
...
@@ -582,7 +581,7 @@ static BOOL process_args_from_reg( const WCHAR *ident, int *pargc, WCHAR ***parg
...
@@ -582,7 +581,7 @@ static BOOL process_args_from_reg( const WCHAR *ident, int *pargc, WCHAR ***parg
process_args
(
buf
,
pargc
,
pargv
);
process_args
(
buf
,
pargc
,
pargv
);
ret
=
TRUE
;
ret
=
TRUE
;
}
}
HeapFree
(
GetProcessHeap
(),
0
,
buf
);
free
(
buf
);
}
}
RegCloseKey
(
hkey
);
RegCloseKey
(
hkey
);
return
ret
;
return
ret
;
...
@@ -594,7 +593,7 @@ static WCHAR *get_path_with_extension(const WCHAR *package_name)
...
@@ -594,7 +593,7 @@ static WCHAR *get_path_with_extension(const WCHAR *package_name)
unsigned
int
p
;
unsigned
int
p
;
WCHAR
*
path
;
WCHAR
*
path
;
if
(
!
(
path
=
heap_alloc
(
lstrlenW
(
package_name
)
*
sizeof
(
WCHAR
)
+
sizeof
(
ext
))))
if
(
!
(
path
=
malloc
(
wcslen
(
package_name
)
*
sizeof
(
WCHAR
)
+
sizeof
(
ext
))))
{
{
WINE_ERR
(
"No memory.
\n
"
);
WINE_ERR
(
"No memory.
\n
"
);
return
NULL
;
return
NULL
;
...
@@ -606,7 +605,7 @@ static WCHAR *get_path_with_extension(const WCHAR *package_name)
...
@@ -606,7 +605,7 @@ static WCHAR *get_path_with_extension(const WCHAR *package_name)
--
p
;
--
p
;
if
(
path
[
p
]
==
'.'
)
if
(
path
[
p
]
==
'.'
)
{
{
heap_
free
(
path
);
free
(
path
);
return
NULL
;
return
NULL
;
}
}
lstrcatW
(
path
,
ext
);
lstrcatW
(
path
,
ext
);
...
@@ -1071,7 +1070,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
...
@@ -1071,7 +1070,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
&&
(
path
=
get_path_with_extension
(
PackageName
)))
&&
(
path
=
get_path_with_extension
(
PackageName
)))
{
{
ReturnCode
=
MsiInstallProductW
(
path
,
Properties
);
ReturnCode
=
MsiInstallProductW
(
path
,
Properties
);
heap_
free
(
path
);
free
(
path
);
}
}
}
}
}
}
...
@@ -1085,7 +1084,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
...
@@ -1085,7 +1084,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
&&
(
path
=
get_path_with_extension
(
PackageName
)))
&&
(
path
=
get_path_with_extension
(
PackageName
)))
{
{
ReturnCode
=
MsiReinstallProductW
(
path
,
RepairMode
);
ReturnCode
=
MsiReinstallProductW
(
path
,
RepairMode
);
heap_
free
(
path
);
free
(
path
);
}
}
}
}
}
}
...
...
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