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
ee034ba4
Commit
ee034ba4
authored
Sep 20, 2005
by
Mike McCormack
Committed by
Alexandre Julliard
Sep 20, 2005
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added memory allocation inline functions (part 2).
parent
8dc28d53
Show whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
526 additions
and
549 deletions
+526
-549
action.c
dlls/msi/action.c
+93
-94
appsearch.c
dlls/msi/appsearch.c
+19
-24
classes.c
dlls/msi/classes.c
+33
-42
cond.y
dlls/msi/cond.y
+14
-14
custom.c
dlls/msi/custom.c
+30
-30
database.c
dlls/msi/database.c
+8
-8
dialog.c
dlls/msi/dialog.c
+44
-47
files.c
dlls/msi/files.c
+31
-31
format.c
dlls/msi/format.c
+28
-28
helpers.c
dlls/msi/helpers.c
+92
-95
install.c
dlls/msi/install.c
+19
-19
msi.c
dlls/msi/msi.c
+51
-51
msiquery.c
dlls/msi/msiquery.c
+12
-12
table.c
dlls/msi/table.c
+52
-54
No files found.
dlls/msi/action.c
View file @
ee034ba4
...
...
@@ -399,7 +399,7 @@ static void ui_actionstart(MSIPACKAGE *package, LPCWSTR action)
MSI_ProcessMessage
(
package
,
INSTALLMESSAGE_ACTIONSTART
,
row
);
msiobj_release
(
&
row
->
hdr
);
HeapFree
(
GetProcessHeap
(),
0
,
deformated
);
msi_free
(
deformated
);
}
static
void
ui_actioninfo
(
MSIPACKAGE
*
package
,
LPCWSTR
action
,
BOOL
start
,
...
...
@@ -448,7 +448,7 @@ UINT ACTION_DoTopLevelINSTALL(MSIPACKAGE *package, LPCWSTR szPackagePath,
MSI_SetPropertyW
(
package
,
szAction
,
szInstall
);
package
->
script
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
MSISCRIPT
));
package
->
script
=
msi_alloc
(
sizeof
(
MSISCRIPT
));
memset
(
package
->
script
,
0
,
sizeof
(
MSISCRIPT
));
package
->
script
->
InWhatSequence
=
SEQUENCE_INSTALL
;
...
...
@@ -469,8 +469,8 @@ UINT ACTION_DoTopLevelINSTALL(MSIPACKAGE *package, LPCWSTR szPackagePath,
}
else
{
HeapFree
(
GetProcessHeap
(),
0
,
path
);
path
=
HeapAlloc
(
GetProcessHeap
(),
0
,
MAX_PATH
*
sizeof
(
WCHAR
));
msi_free
(
path
);
path
=
msi_alloc
(
MAX_PATH
*
sizeof
(
WCHAR
));
GetCurrentDirectoryW
(
MAX_PATH
,
path
);
strcatW
(
path
,
cszbs
);
}
...
...
@@ -478,8 +478,8 @@ UINT ACTION_DoTopLevelINSTALL(MSIPACKAGE *package, LPCWSTR szPackagePath,
check
=
msi_dup_property
(
package
,
cszSourceDir
);
if
(
!
check
)
MSI_SetPropertyW
(
package
,
cszSourceDir
,
path
);
HeapFree
(
GetProcessHeap
(),
0
,
check
);
HeapFree
(
GetProcessHeap
(),
0
,
path
);
msi_free
(
check
);
msi_free
(
path
);
}
if
(
szCommandLine
)
...
...
@@ -502,7 +502,7 @@ UINT ACTION_DoTopLevelINSTALL(MSIPACKAGE *package, LPCWSTR szPackagePath,
while
(
*
ptr
==
' '
)
ptr
++
;
len
=
ptr2
-
ptr
;
prop
=
HeapAlloc
(
GetProcessHeap
(),
0
,
(
len
+
1
)
*
sizeof
(
WCHAR
));
prop
=
msi_alloc
(
(
len
+
1
)
*
sizeof
(
WCHAR
));
memcpy
(
prop
,
ptr
,
len
*
sizeof
(
WCHAR
));
prop
[
len
]
=
0
;
ptr2
++
;
...
...
@@ -522,7 +522,7 @@ UINT ACTION_DoTopLevelINSTALL(MSIPACKAGE *package, LPCWSTR szPackagePath,
ptr2
++
;
len
-=
2
;
}
val
=
HeapAlloc
(
GetProcessHeap
(),
0
,
(
len
+
1
)
*
sizeof
(
WCHAR
));
val
=
msi_alloc
(
(
len
+
1
)
*
sizeof
(
WCHAR
));
memcpy
(
val
,
ptr2
,
len
*
sizeof
(
WCHAR
));
val
[
len
]
=
0
;
...
...
@@ -532,8 +532,8 @@ UINT ACTION_DoTopLevelINSTALL(MSIPACKAGE *package, LPCWSTR szPackagePath,
debugstr_w
(
prop
),
debugstr_w
(
val
));
MSI_SetPropertyW
(
package
,
prop
,
val
);
}
HeapFree
(
GetProcessHeap
(),
0
,
val
);
HeapFree
(
GetProcessHeap
(),
0
,
prop
);
msi_free
(
val
);
msi_free
(
prop
);
}
ptr
++
;
}
...
...
@@ -937,7 +937,7 @@ static UINT ITERATE_CreateFolders(MSIRECORD *row, LPVOID param)
folder
->
State
=
3
;
HeapFree
(
GetProcessHeap
(),
0
,
full_path
);
msi_free
(
full_path
);
return
ERROR_SUCCESS
;
}
...
...
@@ -970,7 +970,7 @@ static MSICOMPONENT* load_component( MSIRECORD * row )
{
MSICOMPONENT
*
comp
;
comp
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
MSICOMPONENT
)
);
comp
=
msi_alloc_zero
(
sizeof
(
MSICOMPONENT
)
);
if
(
!
comp
)
return
comp
;
...
...
@@ -1003,7 +1003,7 @@ static UINT add_feature_component( MSIFEATURE *feature, MSICOMPONENT *comp )
{
ComponentList
*
cl
;
cl
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
*
cl
)
);
cl
=
msi_alloc
(
sizeof
(
*
cl
)
);
if
(
!
cl
)
return
ERROR_NOT_ENOUGH_MEMORY
;
cl
->
component
=
comp
;
...
...
@@ -1083,7 +1083,7 @@ static UINT load_feature(MSIRECORD * row, LPVOID param)
/* fill in the data */
feature
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
MSIFEATURE
)
);
feature
=
msi_alloc_zero
(
sizeof
(
MSIFEATURE
)
);
if
(
!
feature
)
return
ERROR_NOT_ENOUGH_MEMORY
;
...
...
@@ -1133,7 +1133,7 @@ static UINT load_file(MSIRECORD *row, LPVOID param)
/* fill in the data */
file
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
MSIFILE
)
);
file
=
msi_alloc_zero
(
sizeof
(
MSIFILE
)
);
if
(
!
file
)
return
ERROR_NOT_ENOUGH_MEMORY
;
...
...
@@ -1248,11 +1248,11 @@ static UINT execute_script(MSIPACKAGE *package, UINT script )
ui_actionstart
(
package
,
action
);
TRACE
(
"Executing Action (%s)
\n
"
,
debugstr_w
(
action
));
rc
=
ACTION_PerformAction
(
package
,
action
,
TRUE
);
HeapFree
(
GetProcessHeap
(),
0
,
package
->
script
->
Actions
[
script
][
i
]);
msi_free
(
package
->
script
->
Actions
[
script
][
i
]);
if
(
rc
!=
ERROR_SUCCESS
)
break
;
}
HeapFree
(
GetProcessHeap
(),
0
,
package
->
script
->
Actions
[
script
]);
msi_free
(
package
->
script
->
Actions
[
script
]);
package
->
script
->
ActionCount
[
script
]
=
0
;
package
->
script
->
Actions
[
script
]
=
NULL
;
...
...
@@ -1287,7 +1287,7 @@ static MSIFOLDER *load_folder( MSIPACKAGE *package, LPCWSTR dir )
TRACE
(
"Working to load %s
\n
"
,
debugstr_w
(
dir
));
folder
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
MSIFOLDER
)
);
folder
=
msi_alloc_zero
(
sizeof
(
MSIFOLDER
)
);
if
(
!
folder
)
return
NULL
;
...
...
@@ -1331,7 +1331,7 @@ static MSIFOLDER *load_folder( MSIPACKAGE *package, LPCWSTR dir )
if
(
targetdir
)
{
TRACE
(
" TargetDefault = %s
\n
"
,
debugstr_w
(
targetdir
));
HeapFree
(
GetProcessHeap
(),
0
,
folder
->
TargetDefault
);
msi_free
(
folder
->
TargetDefault
);
folder
->
TargetDefault
=
strdupW
(
targetdir
);
}
...
...
@@ -1341,7 +1341,7 @@ static MSIFOLDER *load_folder( MSIPACKAGE *package, LPCWSTR dir )
folder
->
SourceDefault
=
strdupW
(
shortname
);
else
if
(
targetdir
)
folder
->
SourceDefault
=
strdupW
(
targetdir
);
HeapFree
(
GetProcessHeap
(),
0
,
ptargetdir
);
msi_free
(
ptargetdir
);
TRACE
(
" SourceDefault = %s
\n
"
,
debugstr_w
(
folder
->
SourceDefault
));
parent
=
MSI_RecordGetString
(
row
,
2
);
...
...
@@ -1448,7 +1448,7 @@ static BOOL process_state_property (MSIPACKAGE* package, LPCWSTR property,
}
}
}
HeapFree
(
GetProcessHeap
(),
0
,
override
);
msi_free
(
override
);
return
TRUE
;
}
...
...
@@ -1476,7 +1476,7 @@ static UINT SetFeatureStates(MSIPACKAGE *package)
if
(
level
)
{
install_level
=
atoiW
(
level
);
HeapFree
(
GetProcessHeap
(),
0
,
level
);
msi_free
(
level
);
}
else
install_level
=
1
;
...
...
@@ -1627,7 +1627,7 @@ static UINT ITERATE_CostFinalizeDirectories(MSIRECORD *row, LPVOID param)
load_folder
(
package
,
name
);
path
=
resolve_folder
(
package
,
name
,
FALSE
,
TRUE
,
NULL
);
TRACE
(
"resolves to %s
\n
"
,
debugstr_w
(
path
));
HeapFree
(
GetProcessHeap
(),
0
,
path
);
msi_free
(
path
);
return
ERROR_SUCCESS
;
}
...
...
@@ -1713,14 +1713,14 @@ static UINT ACTION_CostFinalize(MSIPACKAGE *package)
/* calculate target */
p
=
resolve_folder
(
package
,
comp
->
Directory
,
FALSE
,
FALSE
,
NULL
);
HeapFree
(
GetProcessHeap
(),
0
,
file
->
TargetPath
);
msi_free
(
file
->
TargetPath
);
TRACE
(
"file %s is named %s
\n
"
,
debugstr_w
(
file
->
File
),
debugstr_w
(
file
->
FileName
));
file
->
TargetPath
=
build_directory_name
(
2
,
p
,
file
->
FileName
);
HeapFree
(
GetProcessHeap
(),
0
,
p
);
msi_free
(
p
);
TRACE
(
"file %s resolves to %s
\n
"
,
debugstr_w
(
file
->
File
),
debugstr_w
(
file
->
TargetPath
));
...
...
@@ -1747,7 +1747,7 @@ static UINT ACTION_CostFinalize(MSIPACKAGE *package)
TRACE
(
"Version comparison..
\n
"
);
versize
=
GetFileVersionInfoSizeW
(
file
->
TargetPath
,
&
handle
);
version
=
HeapAlloc
(
GetProcessHeap
(),
0
,
versize
);
version
=
msi_alloc
(
versize
);
GetFileVersionInfoW
(
file
->
TargetPath
,
0
,
versize
,
version
);
VerQueryValueW
(
version
,
name
,
(
LPVOID
*
)
&
lpVer
,
&
sz
);
...
...
@@ -1768,7 +1768,7 @@ static UINT ACTION_CostFinalize(MSIPACKAGE *package)
}
else
file
->
State
=
3
;
HeapFree
(
GetProcessHeap
(),
0
,
version
);
msi_free
(
version
);
}
else
file
->
State
=
3
;
...
...
@@ -1803,7 +1803,7 @@ static UINT ACTION_CostFinalize(MSIPACKAGE *package)
level
=
msi_dup_property
(
package
,
szlevel
);
if
(
!
level
)
MSI_SetPropertyW
(
package
,
szlevel
,
szOne
);
HeapFree
(
GetProcessHeap
(),
0
,
level
);
msi_free
(
level
);
ACTION_UpdateInstallStates
(
package
);
...
...
@@ -1835,7 +1835,7 @@ static LPSTR parse_value(MSIPACKAGE *package, LPCWSTR value, DWORD *type,
else
*
size
=
strlenW
(
ptr
)
/
2
;
data
=
HeapAlloc
(
GetProcessHeap
(),
0
,
*
size
);
data
=
msi_alloc
(
*
size
);
byte
[
0
]
=
'0'
;
byte
[
1
]
=
'x'
;
...
...
@@ -1860,7 +1860,7 @@ static LPSTR parse_value(MSIPACKAGE *package, LPCWSTR value, DWORD *type,
data
[
count
]
=
(
BYTE
)
strtol
(
byte
,
NULL
,
0
);
count
++
;
}
HeapFree
(
GetProcessHeap
(),
0
,
deformated
);
msi_free
(
deformated
);
TRACE
(
"Data %li bytes(%i)
\n
"
,
*
size
,
count
);
}
...
...
@@ -1873,7 +1873,7 @@ static LPSTR parse_value(MSIPACKAGE *package, LPCWSTR value, DWORD *type,
*
type
=
REG_DWORD
;
*
size
=
sizeof
(
DWORD
);
data
=
HeapAlloc
(
GetProcessHeap
(),
0
,
*
size
);
data
=
msi_alloc
(
*
size
);
p
=
deformated
;
if
(
*
p
==
'-'
)
p
++
;
...
...
@@ -1890,7 +1890,7 @@ static LPSTR parse_value(MSIPACKAGE *package, LPCWSTR value, DWORD *type,
*
(
LPDWORD
)
data
=
d
;
TRACE
(
"DWORD %li
\n
"
,
*
(
LPDWORD
)
data
);
HeapFree
(
GetProcessHeap
(),
0
,
deformated
);
msi_free
(
deformated
);
}
}
else
...
...
@@ -2003,7 +2003,7 @@ static UINT ITERATE_WriteRegistryValues(MSIRECORD *row, LPVOID param)
root_key
=
HKEY_CURRENT_USER
;
szRoot
=
szHCU
;
}
HeapFree
(
GetProcessHeap
(),
0
,
all_users
);
msi_free
(
all_users
);
}
break
;
case
0
:
root_key
=
HKEY_CLASSES_ROOT
;
...
...
@@ -2029,18 +2029,18 @@ static UINT ITERATE_WriteRegistryValues(MSIRECORD *row, LPVOID param)
deformat_string
(
package
,
key
,
&
deformated
);
size
=
strlenW
(
deformated
)
+
strlenW
(
szRoot
)
+
1
;
uikey
=
HeapAlloc
(
GetProcessHeap
(),
0
,
size
*
sizeof
(
WCHAR
));
uikey
=
msi_alloc
(
size
*
sizeof
(
WCHAR
));
strcpyW
(
uikey
,
szRoot
);
strcatW
(
uikey
,
deformated
);
if
(
RegCreateKeyW
(
root_key
,
deformated
,
&
hkey
))
{
ERR
(
"Could not create key %s
\n
"
,
debugstr_w
(
deformated
));
HeapFree
(
GetProcessHeap
(),
0
,
deformated
);
HeapFree
(
GetProcessHeap
(),
0
,
uikey
);
msi_free
(
deformated
);
msi_free
(
uikey
);
return
ERROR_SUCCESS
;
}
HeapFree
(
GetProcessHeap
(),
0
,
deformated
);
msi_free
(
deformated
);
value
=
MSI_RecordGetString
(
row
,
5
);
if
(
value
)
...
...
@@ -2096,9 +2096,9 @@ static UINT ITERATE_WriteRegistryValues(MSIRECORD *row, LPVOID param)
ui_actiondata
(
package
,
szWriteRegistryValues
,
uirow
);
msiobj_release
(
&
uirow
->
hdr
);
HeapFree
(
GetProcessHeap
(),
0
,
value_data
);
HeapFree
(
GetProcessHeap
(),
0
,
deformated
);
HeapFree
(
GetProcessHeap
(),
0
,
uikey
);
msi_free
(
value_data
);
msi_free
(
deformated
);
msi_free
(
uikey
);
return
ERROR_SUCCESS
;
}
...
...
@@ -2214,7 +2214,7 @@ static UINT ITERATE_LaunchConditions(MSIRECORD *row, LPVOID param)
message
=
MSI_RecordGetString
(
row
,
2
);
deformat_string
(
package
,
message
,
&
deformated
);
MessageBoxW
(
NULL
,
deformated
,
title
,
MB_OK
);
HeapFree
(
GetProcessHeap
(),
0
,
deformated
);
msi_free
(
deformated
);
return
ERROR_FUNCTION_FAILED
;
}
...
...
@@ -2276,15 +2276,15 @@ static LPWSTR resolve_keypath( MSIPACKAGE* package, MSICOMPONENT *cmp )
if
(
deformated_name
)
len
+=
strlenW
(
deformated_name
);
buffer
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len
*
sizeof
(
WCHAR
));
buffer
=
msi_alloc
(
len
*
sizeof
(
WCHAR
));
if
(
deformated_name
)
sprintfW
(
buffer
,
fmt2
,
root
,
deformated
,
deformated_name
);
else
sprintfW
(
buffer
,
fmt
,
root
,
deformated
);
HeapFree
(
GetProcessHeap
(),
0
,
deformated
);
HeapFree
(
GetProcessHeap
(),
0
,
deformated_name
);
msi_free
(
deformated
);
msi_free
(
deformated_name
);
msiobj_release
(
&
row
->
hdr
);
return
buffer
;
...
...
@@ -2567,7 +2567,7 @@ static BOOL CALLBACK Typelib_EnumResNameProc( HMODULE hModule, LPCWSTR lpszType,
tl_struct
->
path
=
strdupW
(
tl_struct
->
source
);
else
{
tl_struct
->
path
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sz
);
tl_struct
->
path
=
msi_alloc
(
sz
);
sprintfW
(
tl_struct
->
path
,
fmt
,
tl_struct
->
source
,
lpszName
);
}
...
...
@@ -2575,7 +2575,7 @@ static BOOL CALLBACK Typelib_EnumResNameProc( HMODULE hModule, LPCWSTR lpszType,
res
=
LoadTypeLib
(
tl_struct
->
path
,
&
tl_struct
->
ptLib
);
if
(
!
SUCCEEDED
(
res
))
{
HeapFree
(
GetProcessHeap
(),
0
,
tl_struct
->
path
);
msi_free
(
tl_struct
->
path
);
tl_struct
->
path
=
NULL
;
return
TRUE
;
...
...
@@ -2588,7 +2588,7 @@ static BOOL CALLBACK Typelib_EnumResNameProc( HMODULE hModule, LPCWSTR lpszType,
return
FALSE
;
}
HeapFree
(
GetProcessHeap
(),
0
,
tl_struct
->
path
);
msi_free
(
tl_struct
->
path
);
tl_struct
->
path
=
NULL
;
ITypeLib_ReleaseTLibAttr
(
tl_struct
->
ptLib
,
attr
);
...
...
@@ -2633,7 +2633,7 @@ static UINT ITERATE_RegisterTypeLibraries(MSIRECORD *row, LPVOID param)
LPWSTR
guid
;
guid
=
load_dynamic_stringW
(
row
,
1
);
CLSIDFromString
(
guid
,
&
tl_struct
.
clsid
);
HeapFree
(
GetProcessHeap
(),
0
,
guid
);
msi_free
(
guid
);
tl_struct
.
source
=
strdupW
(
file
->
TargetPath
);
tl_struct
.
path
=
NULL
;
...
...
@@ -2651,7 +2651,7 @@ static UINT ITERATE_RegisterTypeLibraries(MSIRECORD *row, LPVOID param)
if
(
helpid
)
help
=
resolve_folder
(
package
,
helpid
,
FALSE
,
FALSE
,
NULL
);
res
=
RegisterTypeLib
(
tl_struct
.
ptLib
,
tl_struct
.
path
,
help
);
HeapFree
(
GetProcessHeap
(),
0
,
help
);
msi_free
(
help
);
if
(
!
SUCCEEDED
(
res
))
ERR
(
"Failed to register type library %s
\n
"
,
...
...
@@ -2664,14 +2664,14 @@ static UINT ITERATE_RegisterTypeLibraries(MSIRECORD *row, LPVOID param)
}
ITypeLib_Release
(
tl_struct
.
ptLib
);
HeapFree
(
GetProcessHeap
(),
0
,
tl_struct
.
path
);
msi_free
(
tl_struct
.
path
);
}
else
ERR
(
"Failed to load type library %s
\n
"
,
debugstr_w
(
tl_struct
.
source
));
FreeLibrary
(
module
);
HeapFree
(
GetProcessHeap
(),
0
,
tl_struct
.
source
);
msi_free
(
tl_struct
.
source
);
}
else
ERR
(
"Could not load file! %s
\n
"
,
debugstr_w
(
file
->
TargetPath
));
...
...
@@ -2764,7 +2764,7 @@ static UINT ITERATE_CreateShortcuts(MSIRECORD *row, LPVOID param)
if
(
!
strchrW
(
filename
,
'.'
)
||
strcmpiW
(
strchrW
(
filename
,
'.'
),
szlnk
))
strcatW
(
filename
,
szlnk
);
target_file
=
build_directory_name
(
2
,
target_folder
,
filename
);
HeapFree
(
GetProcessHeap
(),
0
,
target_folder
);
msi_free
(
target_folder
);
buffer
=
MSI_RecordGetString
(
row
,
5
);
if
(
strchrW
(
buffer
,
'['
))
...
...
@@ -2772,7 +2772,7 @@ static UINT ITERATE_CreateShortcuts(MSIRECORD *row, LPVOID param)
LPWSTR
deformated
;
deformat_string
(
package
,
buffer
,
&
deformated
);
IShellLinkW_SetPath
(
sl
,
deformated
);
HeapFree
(
GetProcessHeap
(),
0
,
deformated
);
msi_free
(
deformated
);
}
else
{
...
...
@@ -2780,7 +2780,7 @@ static UINT ITERATE_CreateShortcuts(MSIRECORD *row, LPVOID param)
FIXME
(
"poorly handled shortcut format, advertised shortcut
\n
"
);
keypath
=
strdupW
(
comp
->
FullKeypath
);
IShellLinkW_SetPath
(
sl
,
keypath
);
HeapFree
(
GetProcessHeap
(),
0
,
keypath
);
msi_free
(
keypath
);
}
if
(
!
MSI_RecordIsNull
(
row
,
6
))
...
...
@@ -2789,7 +2789,7 @@ static UINT ITERATE_CreateShortcuts(MSIRECORD *row, LPVOID param)
buffer
=
MSI_RecordGetString
(
row
,
6
);
deformat_string
(
package
,
buffer
,
&
deformated
);
IShellLinkW_SetArguments
(
sl
,
deformated
);
HeapFree
(
GetProcessHeap
(),
0
,
deformated
);
msi_free
(
deformated
);
}
if
(
!
MSI_RecordIsNull
(
row
,
7
))
...
...
@@ -2812,7 +2812,7 @@ static UINT ITERATE_CreateShortcuts(MSIRECORD *row, LPVOID param)
index
=
MSI_RecordGetInteger
(
row
,
10
);
IShellLinkW_SetIconLocation
(
sl
,
Path
,
index
);
HeapFree
(
GetProcessHeap
(),
0
,
Path
);
msi_free
(
Path
);
}
if
(
!
MSI_RecordIsNull
(
row
,
11
))
...
...
@@ -2824,13 +2824,13 @@ static UINT ITERATE_CreateShortcuts(MSIRECORD *row, LPVOID param)
buffer
=
MSI_RecordGetString
(
row
,
12
);
Path
=
resolve_folder
(
package
,
buffer
,
FALSE
,
FALSE
,
NULL
);
IShellLinkW_SetWorkingDirectory
(
sl
,
Path
);
HeapFree
(
GetProcessHeap
(),
0
,
Path
);
msi_free
(
Path
);
}
TRACE
(
"Writing shortcut to %s
\n
"
,
debugstr_w
(
target_file
));
IPersistFile_Save
(
pf
,
target_file
,
FALSE
);
HeapFree
(
GetProcessHeap
(),
0
,
target_file
);
msi_free
(
target_file
);
IPersistFile_Release
(
pf
);
IShellLinkW_Release
(
sl
);
...
...
@@ -2896,7 +2896,7 @@ static UINT ITERATE_PublishProduct(MSIRECORD *row, LPVOID param)
if
(
the_file
==
INVALID_HANDLE_VALUE
)
{
ERR
(
"Unable to create file %s
\n
"
,
debugstr_w
(
FilePath
));
HeapFree
(
GetProcessHeap
(),
0
,
FilePath
);
msi_free
(
FilePath
);
return
ERROR_SUCCESS
;
}
...
...
@@ -2915,7 +2915,7 @@ static UINT ITERATE_PublishProduct(MSIRECORD *row, LPVOID param)
WriteFile
(
the_file
,
buffer
,
sz
,
&
write
,
NULL
);
}
while
(
sz
==
1024
);
HeapFree
(
GetProcessHeap
(),
0
,
FilePath
);
msi_free
(
FilePath
);
CloseHandle
(
the_file
);
return
ERROR_SUCCESS
;
...
...
@@ -2973,12 +2973,12 @@ static UINT ACTION_PublishProduct(MSIPACKAGE *package)
buffer
=
msi_dup_property
(
package
,
INSTALLPROPERTY_PRODUCTNAMEW
);
msi_reg_set_val_str
(
hukey
,
INSTALLPROPERTY_PRODUCTNAMEW
,
buffer
);
HeapFree
(
GetProcessHeap
(),
0
,
buffer
);
msi_free
(
buffer
);
buffer
=
msi_dup_property
(
package
,
szProductLanguage
);
langid
=
atoiW
(
buffer
);
msi_reg_set_val_dword
(
hkey
,
INSTALLPROPERTY_LANGUAGEW
,
langid
);
HeapFree
(
GetProcessHeap
(),
0
,
buffer
);
msi_free
(
buffer
);
buffer
=
msi_dup_property
(
package
,
szARPProductIcon
);
if
(
buffer
)
...
...
@@ -2987,7 +2987,7 @@ static UINT ACTION_PublishProduct(MSIPACKAGE *package)
build_icon_path
(
package
,
buffer
,
&
path
);
msi_reg_set_val_str
(
hukey
,
INSTALLPROPERTY_PRODUCTICONW
,
path
);
}
HeapFree
(
GetProcessHeap
(),
0
,
buffer
);
msi_free
(
buffer
);
buffer
=
msi_dup_property
(
package
,
szProductVersion
);
if
(
buffer
)
...
...
@@ -2995,7 +2995,7 @@ static UINT ACTION_PublishProduct(MSIPACKAGE *package)
DWORD
verdword
=
build_version_dword
(
buffer
);
msi_reg_set_val_dword
(
hkey
,
INSTALLPROPERTY_VERSIONW
,
verdword
);
}
HeapFree
(
GetProcessHeap
(),
0
,
buffer
);
msi_free
(
buffer
);
FIXME
(
"Need to write more keys to the user registry
\n
"
);
...
...
@@ -3128,11 +3128,11 @@ static UINT ITERATE_WriteIniValues(MSIRECORD *row, LPVOID param)
ui_actiondata
(
package
,
szWriteIniValues
,
uirow
);
msiobj_release
(
&
uirow
->
hdr
);
cleanup:
HeapFree
(
GetProcessHeap
(),
0
,
fullname
);
HeapFree
(
GetProcessHeap
(),
0
,
folder
);
HeapFree
(
GetProcessHeap
(),
0
,
deformated_key
);
HeapFree
(
GetProcessHeap
(),
0
,
deformated_value
);
HeapFree
(
GetProcessHeap
(),
0
,
deformated_section
);
msi_free
(
fullname
);
msi_free
(
folder
);
msi_free
(
deformated_key
);
msi_free
(
deformated_value
);
msi_free
(
deformated_section
);
return
ERROR_SUCCESS
;
}
...
...
@@ -3183,7 +3183,7 @@ static UINT ITERATE_SelfRegModules(MSIRECORD *row, LPVOID param)
len
=
strlenW
(
ExeStr
)
+
strlenW
(
file
->
TargetPath
)
+
2
;
FullName
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len
*
sizeof
(
WCHAR
));
FullName
=
msi_alloc
(
len
*
sizeof
(
WCHAR
));
strcpyW
(
FullName
,
ExeStr
);
strcatW
(
FullName
,
file
->
TargetPath
);
strcatW
(
FullName
,
close
);
...
...
@@ -3195,7 +3195,7 @@ static UINT ITERATE_SelfRegModules(MSIRECORD *row, LPVOID param)
if
(
brc
)
msi_dialog_check_messages
(
info
.
hProcess
);
HeapFree
(
GetProcessHeap
(),
0
,
FullName
);
msi_free
(
FullName
);
return
ERROR_SUCCESS
;
}
...
...
@@ -3260,7 +3260,7 @@ static UINT ACTION_PublishFeatures(MSIPACKAGE *package)
if
(
feature
->
Feature_Parent
)
size
+=
strlenW
(
feature
->
Feature_Parent
)
+
2
;
data
=
HeapAlloc
(
GetProcessHeap
(),
0
,
size
*
sizeof
(
WCHAR
));
data
=
msi_alloc
(
size
*
sizeof
(
WCHAR
));
data
[
0
]
=
0
;
LIST_FOR_EACH_ENTRY
(
cl
,
&
feature
->
Components
,
ComponentList
,
entry
)
...
...
@@ -3286,7 +3286,7 @@ static UINT ACTION_PublishFeatures(MSIPACKAGE *package)
}
msi_reg_set_val_str
(
hkey
,
feature
->
Feature
,
data
);
HeapFree
(
GetProcessHeap
(),
0
,
data
);
msi_free
(
data
);
size
=
0
;
if
(
feature
->
Feature_Parent
)
...
...
@@ -3299,14 +3299,14 @@ static UINT ACTION_PublishFeatures(MSIPACKAGE *package)
else
{
size
+=
2
*
sizeof
(
WCHAR
);
data
=
HeapAlloc
(
GetProcessHeap
(),
0
,
size
);
data
=
msi_alloc
(
size
);
data
[
0
]
=
0x6
;
data
[
1
]
=
0
;
if
(
feature
->
Feature_Parent
)
strcpyW
(
&
data
[
1
],
feature
->
Feature_Parent
);
RegSetValueExW
(
hukey
,
feature
->
Feature
,
0
,
REG_SZ
,
(
LPBYTE
)
data
,
size
);
HeapFree
(
GetProcessHeap
(),
0
,
data
);
msi_free
(
data
);
}
}
...
...
@@ -3404,7 +3404,7 @@ static UINT ACTION_RegisterProduct(MSIPACKAGE *package)
{
buffer
=
msi_dup_property
(
package
,
szPropKeys
[
i
]
);
msi_reg_set_val_str
(
hkey
,
szRegKeys
[
i
],
buffer
);
HeapFree
(
GetProcessHeap
(),
0
,
buffer
);
msi_free
(
buffer
);
}
msi_reg_set_val_dword
(
hkey
,
szWindowsInstaller
,
1
);
...
...
@@ -3446,21 +3446,21 @@ static UINT ACTION_RegisterProduct(MSIPACKAGE *package)
size
=
deformat_string
(
package
,
modpath_fmt
,
&
buffer
);
RegSetValueExW
(
hkey
,
szModifyPath
,
0
,
REG_EXPAND_SZ
,(
LPBYTE
)
buffer
,
size
);
RegSetValueExW
(
hkey
,
szUninstallString
,
0
,
REG_EXPAND_SZ
,(
LPBYTE
)
buffer
,
size
);
HeapFree
(
GetProcessHeap
(),
0
,
buffer
);
msi_free
(
buffer
);
FIXME
(
"Write real Estimated Size when we have it
\n
"
);
msi_reg_set_val_dword
(
hkey
,
szEstimatedSize
,
0
);
GetLocalTime
(
&
systime
);
size
=
9
*
sizeof
(
WCHAR
);
buffer
=
HeapAlloc
(
GetProcessHeap
(),
0
,
size
);
buffer
=
msi_alloc
(
size
);
sprintfW
(
buffer
,
date_fmt
,
systime
.
wYear
,
systime
.
wMonth
,
systime
.
wDay
);
msi_reg_set_val_str
(
hkey
,
INSTALLPROPERTY_INSTALLDATEW
,
buffer
);
HeapFree
(
GetProcessHeap
(),
0
,
buffer
);
msi_free
(
buffer
);
buffer
=
msi_dup_property
(
package
,
szProductLanguage
);
msi_reg_set_val_dword
(
hkey
,
INSTALLPROPERTY_LANGUAGEW
,
atoiW
(
buffer
)
);
HeapFree
(
GetProcessHeap
(),
1
,
buffer
);
msi_free
(
buffer
);
buffer
=
msi_dup_property
(
package
,
szProductVersion
);
if
(
buffer
)
...
...
@@ -3471,7 +3471,7 @@ static UINT ACTION_RegisterProduct(MSIPACKAGE *package)
msi_reg_set_val_dword
(
hkey
,
INSTALLPROPERTY_VERSIONMAJORW
,
verdword
>>
24
);
msi_reg_set_val_dword
(
hkey
,
INSTALLPROPERTY_VERSIONMINORW
,
(
verdword
>>
16
)
&
0x00FF
);
}
HeapFree
(
GetProcessHeap
(),
0
,
buffer
);
msi_free
(
buffer
);
/* Handle Upgrade Codes */
upgrade_code
=
msi_dup_property
(
package
,
szUpgradeCode
);
...
...
@@ -3488,7 +3488,7 @@ static UINT ACTION_RegisterProduct(MSIPACKAGE *package)
msi_reg_set_val_str
(
hkey2
,
squashed
,
NULL
);
RegCloseKey
(
hkey2
);
HeapFree
(
GetProcessHeap
(),
0
,
upgrade_code
);
msi_free
(
upgrade_code
);
}
end:
...
...
@@ -3605,7 +3605,7 @@ UINT ACTION_ResolveSource(MSIPACKAGE* package)
INSTALLPROPERTY_DISKPROMPTW
,
NULL
,
&
size
);
if
(
rc
==
ERROR_MORE_DATA
)
{
prompt
=
HeapAlloc
(
GetProcessHeap
(),
0
,
size
*
sizeof
(
WCHAR
));
prompt
=
msi_alloc
(
size
*
sizeof
(
WCHAR
));
MsiSourceListGetInfoW
(
package
->
ProductCode
,
NULL
,
MSIINSTALLCONTEXT_USERMANAGED
,
MSICODE_PRODUCT
,
INSTALLPROPERTY_DISKPROMPTW
,
prompt
,
&
size
);
...
...
@@ -3624,7 +3624,7 @@ UINT ACTION_ResolveSource(MSIPACKAGE* package)
}
attrib
=
GetFileAttributesW
(
package
->
PackagePath
);
}
HeapFree
(
GetProcessHeap
(),
0
,
prompt
);
msi_free
(
prompt
);
rc
=
ERROR_SUCCESS
;
}
else
...
...
@@ -3671,11 +3671,11 @@ static UINT ACTION_RegisterUser(MSIPACKAGE *package)
{
buffer
=
msi_dup_property
(
package
,
szPropKeys
[
i
]
);
msi_reg_set_val_str
(
hkey
,
szRegKeys
[
i
],
buffer
);
HeapFree
(
GetProcessHeap
(),
0
,
buffer
);
msi_free
(
buffer
);
}
end:
HeapFree
(
GetProcessHeap
(),
0
,
productid
);
msi_free
(
productid
);
RegCloseKey
(
hkey
);
return
ERROR_SUCCESS
;
...
...
@@ -3694,7 +3694,7 @@ static UINT ACTION_ExecuteAction(MSIPACKAGE *package)
package
->
script
->
InWhatSequence
|=
SEQUENCE_EXEC
;
rc
=
ACTION_ProcessExecSequence
(
package
,
FALSE
);
MSI_SetPropertyW
(
package
,
szUILevel
,
level
);
HeapFree
(
GetProcessHeap
(),
0
,
level
);
msi_free
(
level
);
return
rc
;
}
...
...
@@ -3805,19 +3805,18 @@ static LPWSTR load_ttfname_from(LPCWSTR filename)
ttRecord
.
uStringOffset
+
ttNTHeader
.
uStorageOffset
,
NULL
,
FILE_BEGIN
);
buf
=
HeapAlloc
(
GetProcessHeap
(),
0
,
ttRecord
.
uStringLength
+
1
+
strlen
(
tt
));
buf
=
msi_alloc
(
ttRecord
.
uStringLength
+
1
+
strlen
(
tt
)
);
memset
(
buf
,
0
,
ttRecord
.
uStringLength
+
1
+
strlen
(
tt
));
ReadFile
(
handle
,
buf
,
ttRecord
.
uStringLength
,
NULL
,
NULL
);
if
(
strlen
(
buf
)
>
0
)
{
strcat
(
buf
,
tt
);
ret
=
strdupAtoW
(
buf
);
HeapFree
(
GetProcessHeap
(),
0
,
buf
);
msi_free
(
buf
);
break
;
}
HeapFree
(
GetProcessHeap
(),
0
,
buf
);
msi_free
(
buf
);
SetFilePointer
(
handle
,
nPos
,
NULL
,
FILE_BEGIN
);
}
}
...
...
@@ -3882,7 +3881,7 @@ static UINT ITERATE_RegisterFonts(MSIRECORD *row, LPVOID param)
msi_reg_set_val_str
(
hkey2
,
name
,
file
->
FileName
);
}
HeapFree
(
GetProcessHeap
(),
0
,
name
);
msi_free
(
name
);
RegCloseKey
(
hkey1
);
RegCloseKey
(
hkey2
);
return
ERROR_SUCCESS
;
...
...
@@ -3957,7 +3956,7 @@ static UINT ITERATE_PublishComponent(MSIRECORD *rec, LPVOID param)
sz
+=
3
;
sz
*=
sizeof
(
WCHAR
);
output
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sz
);
output
=
msi_alloc
(
sz
);
memset
(
output
,
0
,
sz
);
strcpyW
(
output
,
advertise
);
...
...
@@ -3968,7 +3967,7 @@ static UINT ITERATE_PublishComponent(MSIRECORD *rec, LPVOID param)
end:
RegCloseKey
(
hkey
);
HeapFree
(
GetProcessHeap
(),
0
,
output
);
msi_free
(
output
);
return
rc
;
}
...
...
dlls/msi/appsearch.c
View file @
ee034ba4
...
...
@@ -124,14 +124,14 @@ static UINT ACTION_AppSearchGetSignature(MSIPACKAGE *package, MSISIGNATURE *sig,
{
ACTION_VerStrToInteger
(
minVersion
,
&
sig
->
MinVersionMS
,
&
sig
->
MinVersionLS
);
HeapFree
(
GetProcessHeap
(),
0
,
minVersion
);
msi_free
(
minVersion
);
}
maxVersion
=
load_dynamic_stringW
(
row
,
4
);
if
(
maxVersion
)
{
ACTION_VerStrToInteger
(
maxVersion
,
&
sig
->
MaxVersionMS
,
&
sig
->
MaxVersionLS
);
HeapFree
(
GetProcessHeap
(),
0
,
maxVersion
);
msi_free
(
maxVersion
);
}
sig
->
MinSize
=
MSI_RecordGetInteger
(
row
,
5
);
if
(
sig
->
MinSize
==
MSI_NULL_INTEGER
)
...
...
@@ -325,7 +325,7 @@ static UINT ACTION_AppSearchReg(MSIPACKAGE *package, BOOL *appFound,
/* FIXME: sanity-check sz before allocating (is there an upper-limit
* on the value of a property?)
*/
value
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sz
);
value
=
msi_alloc
(
sz
);
rc
=
RegQueryValueExW
(
key
,
valueName
,
NULL
,
&
regType
,
value
,
&
sz
);
if
(
rc
)
{
...
...
@@ -347,14 +347,13 @@ static UINT ACTION_AppSearchReg(MSIPACKAGE *package, BOOL *appFound,
if
(
*
(
LPWSTR
)
value
==
'#'
)
{
/* escape leading pound with another */
propertyValue
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sz
+
sizeof
(
WCHAR
));
propertyValue
=
msi_alloc
(
sz
+
sizeof
(
WCHAR
));
propertyValue
[
0
]
=
'#'
;
strcpyW
(
propertyValue
+
1
,
(
LPWSTR
)
value
);
}
else
{
propertyValue
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sz
);
propertyValue
=
msi_alloc
(
sz
);
strcpyW
(
propertyValue
,
(
LPWSTR
)
value
);
}
break
;
...
...
@@ -362,20 +361,17 @@ static UINT ACTION_AppSearchReg(MSIPACKAGE *package, BOOL *appFound,
/* 7 chars for digits, 1 for NULL, 1 for #, and 1 for sign
* char if needed
*/
propertyValue
=
HeapAlloc
(
GetProcessHeap
(),
0
,
10
*
sizeof
(
WCHAR
));
propertyValue
=
msi_alloc
(
10
*
sizeof
(
WCHAR
));
sprintfW
(
propertyValue
,
dwordFmt
,
*
(
DWORD
*
)
value
);
break
;
case
REG_EXPAND_SZ
:
/* space for extra #% characters in front */
propertyValue
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sz
+
2
*
sizeof
(
WCHAR
));
propertyValue
=
msi_alloc
(
sz
+
2
*
sizeof
(
WCHAR
));
sprintfW
(
propertyValue
,
expandSzFmt
,
(
LPWSTR
)
value
);
break
;
case
REG_BINARY
:
/* 3 == length of "#x<nibble>" */
propertyValue
=
HeapAlloc
(
GetProcessHeap
(),
0
,
(
sz
*
3
+
1
)
*
sizeof
(
WCHAR
));
propertyValue
=
msi_alloc
(
(
sz
*
3
+
1
)
*
sizeof
(
WCHAR
));
for
(
i
=
0
;
i
<
sz
;
i
++
)
sprintfW
(
propertyValue
+
i
*
3
,
binFmt
,
value
[
i
]);
break
;
...
...
@@ -390,12 +386,12 @@ static UINT ACTION_AppSearchReg(MSIPACKAGE *package, BOOL *appFound,
*
appFound
=
TRUE
;
end:
HeapFree
(
GetProcessHeap
(),
0
,
propertyValue
);
HeapFree
(
GetProcessHeap
(),
0
,
value
);
msi_free
(
propertyValue
);
msi_free
(
value
);
RegCloseKey
(
key
);
HeapFree
(
GetProcessHeap
(),
0
,
keyPath
);
HeapFree
(
GetProcessHeap
(),
0
,
valueName
);
msi_free
(
keyPath
);
msi_free
(
valueName
);
msiobj_release
(
&
row
->
hdr
);
MSI_ViewClose
(
view
);
...
...
@@ -449,7 +445,7 @@ static UINT ACTION_AppSearchIni(MSIPACKAGE *package, BOOL *appFound,
fileName
=
load_dynamic_stringW
(
row
,
2
);
FIXME
(
"AppSearch unimplemented for IniLocator (ini file name %s)
\n
"
,
debugstr_w
(
fileName
));
HeapFree
(
GetProcessHeap
(),
0
,
fileName
);
msi_free
(
fileName
);
end:
msiobj_release
(
&
row
->
hdr
);
...
...
@@ -549,7 +545,7 @@ static UINT ACTION_FileVersionMatches(MSISIGNATURE *sig, LPCWSTR filePath,
if
(
size
)
{
LPVOID
buf
=
HeapAlloc
(
GetProcessHeap
(),
0
,
size
);
LPVOID
buf
=
msi_alloc
(
size
);
if
(
buf
)
{
...
...
@@ -592,7 +588,7 @@ static UINT ACTION_FileVersionMatches(MSISIGNATURE *sig, LPCWSTR filePath,
else
*
matches
=
TRUE
;
}
HeapFree
(
GetProcessHeap
(),
0
,
buf
);
msi_free
(
buf
);
}
else
rc
=
ERROR_OUTOFMEMORY
;
...
...
@@ -671,8 +667,7 @@ static UINT ACTION_RecurseSearchDirectory(MSIPACKAGE *package, BOOL *appFound,
* here. Add two because we might need to add a backslash if the dir name
* isn't backslash-terminated.
*/
buf
=
HeapAlloc
(
GetProcessHeap
(),
0
,
(
dirLen
+
max
(
fileLen
,
lstrlenW
(
starDotStarW
))
+
2
)
*
sizeof
(
WCHAR
));
buf
=
msi_alloc
(
(
dirLen
+
max
(
fileLen
,
lstrlenW
(
starDotStarW
))
+
2
)
*
sizeof
(
WCHAR
));
if
(
buf
)
{
/* a depth of 0 implies we should search dir, so go ahead and search */
...
...
@@ -726,7 +721,7 @@ static UINT ACTION_RecurseSearchDirectory(MSIPACKAGE *package, BOOL *appFound,
FindClose
(
hFind
);
}
}
HeapFree
(
GetProcessHeap
(),
0
,
buf
);
msi_free
(
buf
);
}
else
rc
=
ERROR_OUTOFMEMORY
;
...
...
@@ -965,8 +960,8 @@ UINT ACTION_AppSearch(MSIPACKAGE *package)
}
}
}
HeapFree
(
GetProcessHeap
(),
0
,
sig
.
File
);
HeapFree
(
GetProcessHeap
(),
0
,
sig
.
Languages
);
msi_free
(
sig
.
File
);
msi_free
(
sig
.
Languages
);
msiobj_release
(
&
row
->
hdr
);
}
...
...
dlls/msi/classes.c
View file @
ee034ba4
...
...
@@ -61,7 +61,7 @@ static MSIAPPID *load_appid( MSIPACKAGE* package, MSIRECORD *row )
/* fill in the data */
appid
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
MSIAPPID
)
);
appid
=
msi_alloc_zero
(
sizeof
(
MSIAPPID
)
);
if
(
!
appid
)
return
NULL
;
...
...
@@ -125,7 +125,7 @@ static MSIPROGID *load_progid( MSIPACKAGE* package, MSIRECORD *row )
/* fill in the data */
progid
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
MSIPROGID
)
);
progid
=
msi_alloc_zero
(
sizeof
(
MSIPROGID
)
);
if
(
!
progid
)
return
NULL
;
...
...
@@ -155,14 +155,12 @@ static MSIPROGID *load_progid( MSIPACKAGE* package, MSIRECORD *row )
build_icon_path
(
package
,
FileName
,
&
FilePath
);
progid
->
IconPath
=
HeapAlloc
(
GetProcessHeap
(),
0
,(
strlenW
(
FilePath
)
+
10
)
*
sizeof
(
WCHAR
));
progid
->
IconPath
=
msi_alloc
(
(
strlenW
(
FilePath
)
+
10
)
*
sizeof
(
WCHAR
)
);
sprintfW
(
progid
->
IconPath
,
fmt
,
FilePath
,
icon_index
);
HeapFree
(
GetProcessHeap
(),
0
,
FilePath
);
HeapFree
(
GetProcessHeap
(),
0
,
FileName
);
msi_free
(
FilePath
);
msi_free
(
FileName
);
}
else
{
...
...
@@ -231,7 +229,7 @@ static MSICLASS *load_class( MSIPACKAGE* package, MSIRECORD *row )
/* fill in the data */
cls
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
MSICLASS
)
);
cls
=
msi_alloc_zero
(
sizeof
(
MSICLASS
)
);
if
(
!
cls
)
return
NULL
;
...
...
@@ -264,14 +262,12 @@ static MSICLASS *load_class( MSIPACKAGE* package, MSIRECORD *row )
build_icon_path
(
package
,
FileName
,
&
FilePath
);
cls
->
IconPath
=
HeapAlloc
(
GetProcessHeap
(),
0
,(
strlenW
(
FilePath
)
+
5
)
*
sizeof
(
WCHAR
));
cls
->
IconPath
=
msi_alloc
(
(
strlenW
(
FilePath
)
+
5
)
*
sizeof
(
WCHAR
)
);
sprintfW
(
cls
->
IconPath
,
fmt
,
FilePath
,
icon_index
);
HeapFree
(
GetProcessHeap
(),
0
,
FilePath
);
HeapFree
(
GetProcessHeap
(),
0
,
FileName
);
msi_free
(
FilePath
);
msi_free
(
FileName
);
}
else
{
...
...
@@ -367,7 +363,7 @@ static MSIMIME *load_mime( MSIPACKAGE* package, MSIRECORD *row )
/* fill in the data */
mt
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
MSIMIME
)
);
mt
=
msi_alloc_zero
(
sizeof
(
MSIMIME
)
);
if
(
!
mt
)
return
mt
;
...
...
@@ -425,7 +421,7 @@ static MSIEXTENSION *load_extension( MSIPACKAGE* package, MSIRECORD *row )
/* fill in the data */
ext
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
MSIEXTENSION
)
);
ext
=
msi_alloc_zero
(
sizeof
(
MSIEXTENSION
)
);
if
(
!
ext
)
return
NULL
;
...
...
@@ -506,7 +502,7 @@ static UINT iterate_load_verb(MSIRECORD *row, LPVOID param)
/* fill in the data */
verb
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
MSIVERB
)
);
verb
=
msi_alloc_zero
(
sizeof
(
MSIVERB
)
);
if
(
!
verb
)
return
ERROR_OUTOFMEMORY
;
...
...
@@ -919,7 +915,7 @@ UINT ACTION_RegisterClassInfo(MSIPACKAGE *package)
size
+=
sizeof
(
WCHAR
);
}
argument
=
HeapAlloc
(
GetProcessHeap
(),
0
,
size
+
sizeof
(
WCHAR
));
argument
=
msi_alloc
(
size
+
sizeof
(
WCHAR
));
GetShortPathNameW
(
file
->
TargetPath
,
argument
,
sz
);
if
(
cls
->
Argument
)
...
...
@@ -939,7 +935,7 @@ UINT ACTION_RegisterClassInfo(MSIPACKAGE *package)
size
+=
sizeof
(
WCHAR
);
}
argument
=
HeapAlloc
(
GetProcessHeap
(),
0
,
size
+
sizeof
(
WCHAR
));
argument
=
msi_alloc
(
size
+
sizeof
(
WCHAR
));
strcpyW
(
argument
,
file
->
TargetPath
);
if
(
cls
->
Argument
)
...
...
@@ -952,7 +948,7 @@ UINT ACTION_RegisterClassInfo(MSIPACKAGE *package)
if
(
argument
)
{
msi_reg_set_val_str
(
hkey3
,
NULL
,
argument
);
HeapFree
(
GetProcessHeap
(),
0
,
argument
);
msi_free
(
argument
);
}
RegCloseKey
(
hkey3
);
...
...
@@ -1022,12 +1018,11 @@ UINT ACTION_RegisterClassInfo(MSIPACKAGE *package)
ptr2
=
strchrW
(
ptr
,
';'
);
if
(
ptr2
)
*
ptr2
=
0
;
keyname
=
HeapAlloc
(
GetProcessHeap
(),
0
,(
strlenW
(
szFileType_fmt
)
+
strlenW
(
cls
->
clsid
)
+
4
)
*
sizeof
(
WCHAR
));
keyname
=
msi_alloc
(
(
strlenW
(
szFileType_fmt
)
+
strlenW
(
cls
->
clsid
)
+
4
)
*
sizeof
(
WCHAR
));
sprintfW
(
keyname
,
szFileType_fmt
,
cls
->
clsid
,
index
);
msi_reg_set_subkey_val
(
HKEY_CLASSES_ROOT
,
keyname
,
NULL
,
ptr
);
HeapFree
(
GetProcessHeap
(),
0
,
keyname
);
msi_free
(
keyname
);
if
(
ptr2
)
ptr
=
ptr2
+
1
;
...
...
@@ -1188,14 +1183,14 @@ static UINT register_verb(MSIPACKAGE *package, LPCWSTR progid,
size
+=
strlenW
(
verb
->
Argument
);
size
+=
4
;
command
=
HeapAlloc
(
GetProcessHeap
(),
0
,
size
*
sizeof
(
WCHAR
));
command
=
msi_alloc
(
size
*
sizeof
(
WCHAR
));
if
(
verb
->
Argument
)
sprintfW
(
command
,
fmt
,
component
->
FullKeypath
,
verb
->
Argument
);
else
sprintfW
(
command
,
fmt2
,
component
->
FullKeypath
);
msi_reg_set_val_str
(
key
,
NULL
,
command
);
HeapFree
(
GetProcessHeap
(),
0
,
command
);
msi_free
(
command
);
advertise
=
create_component_advertise_string
(
package
,
component
,
extension
->
Feature
->
Feature
);
...
...
@@ -1206,7 +1201,7 @@ static UINT register_verb(MSIPACKAGE *package, LPCWSTR progid,
size
+=
strlenW
(
verb
->
Argument
);
size
+=
4
;
command
=
HeapAlloc
(
GetProcessHeap
(),
0
,
size
*
sizeof
(
WCHAR
));
command
=
msi_alloc
(
size
*
sizeof
(
WCHAR
));
memset
(
command
,
0
,
size
*
sizeof
(
WCHAR
));
strcpyW
(
command
,
advertise
);
...
...
@@ -1220,15 +1215,15 @@ static UINT register_verb(MSIPACKAGE *package, LPCWSTR progid,
msi_reg_set_val_multi_str
(
key
,
szCommand
,
command
);
RegCloseKey
(
key
);
HeapFree
(
GetProcessHeap
(),
0
,
keyname
);
HeapFree
(
GetProcessHeap
(),
0
,
advertise
);
HeapFree
(
GetProcessHeap
(),
0
,
command
);
msi_free
(
keyname
);
msi_free
(
advertise
);
msi_free
(
command
);
if
(
verb
->
Command
)
{
keyname
=
build_directory_name
(
3
,
progid
,
szShell
,
verb
->
Verb
);
msi_reg_set_subkey_val
(
HKEY_CLASSES_ROOT
,
keyname
,
NULL
,
verb
->
Command
);
HeapFree
(
GetProcessHeap
(),
0
,
keyname
);
msi_free
(
keyname
);
}
if
(
verb
->
Sequence
!=
MSI_NULL_INTEGER
)
...
...
@@ -1238,7 +1233,7 @@ static UINT register_verb(MSIPACKAGE *package, LPCWSTR progid,
*
Sequence
=
verb
->
Sequence
;
keyname
=
build_directory_name
(
2
,
progid
,
szShell
);
msi_reg_set_subkey_val
(
HKEY_CLASSES_ROOT
,
keyname
,
NULL
,
verb
->
Verb
);
HeapFree
(
GetProcessHeap
(),
0
,
keyname
);
msi_free
(
keyname
);
}
}
return
ERROR_SUCCESS
;
...
...
@@ -1299,13 +1294,12 @@ UINT ACTION_RegisterExtensionInfo(MSIPACKAGE *package)
mark_mime_for_install
(
ext
->
Mime
);
extension
=
HeapAlloc
(
GetProcessHeap
(),
0
,
(
lstrlenW
(
ext
->
Extension
)
+
2
)
*
sizeof
(
WCHAR
)
);
extension
=
msi_alloc
(
(
lstrlenW
(
ext
->
Extension
)
+
2
)
*
sizeof
(
WCHAR
)
);
extension
[
0
]
=
'.'
;
lstrcpyW
(
extension
+
1
,
ext
->
Extension
);
RegCreateKeyW
(
HKEY_CLASSES_ROOT
,
extension
,
&
hkey
);
HeapFree
(
GetProcessHeap
(),
0
,
extension
);
msi_free
(
extension
);
if
(
ext
->
Mime
)
msi_reg_set_val_str
(
hkey
,
szContentType
,
ext
->
Mime
->
ContentType
);
...
...
@@ -1327,15 +1321,14 @@ UINT ACTION_RegisterExtensionInfo(MSIPACKAGE *package)
msi_reg_set_val_str
(
hkey
,
NULL
,
progid
);
newkey
=
HeapAlloc
(
GetProcessHeap
(),
0
,
(
strlenW
(
progid
)
+
strlenW
(
szSN
)
+
1
)
*
sizeof
(
WCHAR
));
newkey
=
msi_alloc
(
(
strlenW
(
progid
)
+
strlenW
(
szSN
)
+
1
)
*
sizeof
(
WCHAR
));
strcpyW
(
newkey
,
progid
);
strcatW
(
newkey
,
szSN
);
RegCreateKeyW
(
hkey
,
newkey
,
&
hkey2
);
RegCloseKey
(
hkey2
);
HeapFree
(
GetProcessHeap
(),
0
,
newkey
);
msi_free
(
newkey
);
/* do all the verbs */
LIST_FOR_EACH_ENTRY
(
verb
,
&
ext
->
verbs
,
MSIVERB
,
entry
)
...
...
@@ -1396,18 +1389,16 @@ UINT ACTION_RegisterMIMEInfo(MSIPACKAGE *package)
mime
=
mt
->
ContentType
;
exten
=
mt
->
Extension
->
Extension
;
extension
=
HeapAlloc
(
GetProcessHeap
(),
0
,
(
lstrlenW
(
exten
)
+
2
)
*
sizeof
(
WCHAR
)
);
extension
=
msi_alloc
(
(
lstrlenW
(
exten
)
+
2
)
*
sizeof
(
WCHAR
)
);
extension
[
0
]
=
'.'
;
lstrcpyW
(
extension
+
1
,
exten
);
key
=
HeapAlloc
(
GetProcessHeap
(),
0
,(
strlenW
(
mime
)
+
strlenW
(
fmt
)
+
1
)
*
sizeof
(
WCHAR
));
key
=
msi_alloc
(
(
strlenW
(
mime
)
+
strlenW
(
fmt
)
+
1
)
*
sizeof
(
WCHAR
)
);
sprintfW
(
key
,
fmt
,
mime
);
msi_reg_set_subkey_val
(
HKEY_CLASSES_ROOT
,
key
,
szExten
,
extension
);
HeapFree
(
GetProcessHeap
(),
0
,
extension
);
HeapFree
(
GetProcessHeap
(),
0
,
key
);
msi_free
(
extension
);
msi_free
(
key
);
if
(
mt
->
clsid
)
FIXME
(
"Handle non null for field 3
\n
"
);
...
...
dlls/msi/cond.y
View file @
ee034ba4
...
...
@@ -412,7 +412,7 @@ symbol_i:
MSI_GetComponentStateW
(
cond
->
package
,
$
2
,
&
install
,
&
action
);
$$
=
action
;
HeapFree
(
GetProcessHeap
(),
0
,
$
2
);
msi_free
(
$
2
);
}
|
COND_QUESTION
identifier
{
...
...
@@ -421,7 +421,7 @@ symbol_i:
MSI_GetComponentStateW
(
cond
->
package
,
$
2
,
&
install
,
&
action
);
$$
=
install
;
HeapFree
(
GetProcessHeap
(),
0
,
$
2
);
msi_free
(
$
2
);
}
|
COND_AMPER
identifier
{
...
...
@@ -430,7 +430,7 @@ symbol_i:
MSI_GetFeatureStateW
(
cond
->
package
,
$
2
,
&
install
,
&
action
);
$$
=
action
;
HeapFree
(
GetProcessHeap
(),
0
,
$
2
);
msi_free
(
$
2
);
}
|
COND_EXCLAM
identifier
{
...
...
@@ -439,7 +439,7 @@ symbol_i:
MSI_GetFeatureStateW
(
cond
->
package
,
$
2
,
&
install
,
&
action
);
$$
=
install
;
HeapFree
(
GetProcessHeap
(),
0
,
$
2
);
msi_free
(
$
2
);
}
;
...
...
@@ -453,30 +453,30 @@ symbol_s:
MSI_GetPropertyW
(
cond
->
package
,
$
1
,
NULL
,
&
sz
);
if
(
sz
==
0
)
{
$$
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
WCHAR
));
$$
=
msi_alloc
(
sizeof
(
WCHAR
));
$$[
0
]
=
0
;
}
else
{
sz
++;
$$
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sz
*
sizeof
(
WCHAR
)
);
$$
=
msi_alloc
(
sz
*
sizeof
(
WCHAR
)
);
/*
Lookup
the
identifier
*/
MSI_GetPropertyW
(
cond
->
package
,$
1
,$$,&
sz
);
}
HeapFree
(
GetProcessHeap
(),
0
,
$
1
);
msi_free
(
$
1
);
}
|
COND_PERCENT
identifier
{
UINT
len
=
GetEnvironmentVariableW
(
$
2
,
NULL
,
0
);
if
(
len
++
)
{
$$
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len
*
sizeof
(
WCHAR
)
);
$$
=
msi_alloc
(
len
*
sizeof
(
WCHAR
)
);
if
(
$$
)
GetEnvironmentVariableW
(
$
2
,
$$,
len
);
}
HeapFree
(
GetProcessHeap
(),
0
,
$
2
);
msi_free
(
$
2
);
}
;
...
...
@@ -496,7 +496,7 @@ integer:
if
(
!szNum )
YYABORT
;
$$
=
atoiW
(
szNum
);
HeapFree
(
GetProcessHeap
(),
0
,
szNum
);
msi_free
(
szNum
);
}
;
...
...
@@ -698,7 +698,7 @@ static LPWSTR COND_GetString( struct cond_str *str )
{
LPWSTR
ret
;
ret
=
HeapAlloc
(
GetProcessHeap
(),
0
,
(
str
->
len
+
1
)
*
sizeof
(
WCHAR
)
);
ret
=
msi_alloc
(
(
str
->
len
+
1
)
*
sizeof
(
WCHAR
)
);
if
(
ret
)
{
memcpy
(
ret
,
str
->
data
,
str
->
len
*
sizeof
(
WCHAR
));
...
...
@@ -712,7 +712,7 @@ static LPWSTR COND_GetLiteral( struct cond_str *str )
{
LPWSTR
ret
;
ret
=
HeapAlloc
(
GetProcessHeap
(),
0
,
(
str
->
len
-
1
)
*
sizeof
(
WCHAR
)
);
ret
=
msi_alloc
(
(
str
->
len
-
1
)
*
sizeof
(
WCHAR
)
);
if
(
ret
)
{
memcpy
(
ret
,
str
->
data
+
1
,
(
str
->
len
-
2
)
*
sizeof
(
WCHAR
)
);
...
...
@@ -771,13 +771,13 @@ MSICONDITION WINAPI MsiEvaluateConditionA( MSIHANDLE hInstall, LPCSTR szConditio
if
(
szCondition
)
{
UINT
len
=
MultiByteToWideChar
(
CP_ACP
,
0
,
szCondition
,
-
1
,
NULL
,
0
);
szwCond
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len
*
sizeof
(
WCHAR
)
);
szwCond
=
msi_alloc
(
len
*
sizeof
(
WCHAR
)
);
MultiByteToWideChar
(
CP_ACP
,
0
,
szCondition
,
-
1
,
szwCond
,
len
);
}
r
=
MsiEvaluateConditionW
(
hInstall
,
szwCond
);
HeapFree
(
GetProcessHeap
(),
0
,
szwCond
);
msi_free
(
szwCond
);
return
r
;
}
dlls/msi/custom.c
View file @
ee034ba4
...
...
@@ -154,8 +154,8 @@ UINT ACTION_CustomAction(MSIPACKAGE *package,LPCWSTR action, BOOL execute)
{
FIXME
(
"Rollback only action... rollbacks not supported yet
\n
"
);
schedule_action
(
package
,
ROLLBACK_SCRIPT
,
action
);
HeapFree
(
GetProcessHeap
(),
0
,
source
);
HeapFree
(
GetProcessHeap
(),
0
,
target
);
msi_free
(
source
);
msi_free
(
target
);
msiobj_release
(
&
row
->
hdr
);
return
ERROR_SUCCESS
;
}
...
...
@@ -172,8 +172,8 @@ UINT ACTION_CustomAction(MSIPACKAGE *package,LPCWSTR action, BOOL execute)
schedule_action
(
package
,
INSTALL_SCRIPT
,
action
);
}
HeapFree
(
GetProcessHeap
(),
0
,
source
);
HeapFree
(
GetProcessHeap
(),
0
,
target
);
msi_free
(
source
);
msi_free
(
target
);
msiobj_release
(
&
row
->
hdr
);
return
ERROR_SUCCESS
;
}
...
...
@@ -189,7 +189,7 @@ UINT ACTION_CustomAction(MSIPACKAGE *package,LPCWSTR action, BOOL execute)
MSI_SetPropertyW
(
package
,
szActionData
,
actiondata
);
else
MSI_SetPropertyW
(
package
,
szActionData
,
szBlank
);
HeapFree
(
GetProcessHeap
(),
0
,
actiondata
);
msi_free
(
actiondata
);
}
}
else
if
(
!
check_execution_scheduling_options
(
package
,
action
,
type
))
...
...
@@ -218,12 +218,12 @@ UINT ACTION_CustomAction(MSIPACKAGE *package,LPCWSTR action, BOOL execute)
case
35
:
/* Directory set with formatted text. */
deformat_string
(
package
,
target
,
&
deformated
);
MSI_SetTargetPathW
(
package
,
source
,
deformated
);
HeapFree
(
GetProcessHeap
(),
0
,
deformated
);
msi_free
(
deformated
);
break
;
case
51
:
/* Property set with formatted text. */
deformat_string
(
package
,
target
,
&
deformated
);
rc
=
MSI_SetPropertyW
(
package
,
source
,
deformated
);
HeapFree
(
GetProcessHeap
(),
0
,
deformated
);
msi_free
(
deformated
);
break
;
default:
FIXME
(
"UNHANDLED ACTION TYPE %i (%s %s)
\n
"
,
...
...
@@ -231,8 +231,8 @@ UINT ACTION_CustomAction(MSIPACKAGE *package,LPCWSTR action, BOOL execute)
debugstr_w
(
target
));
}
HeapFree
(
GetProcessHeap
(),
0
,
source
);
HeapFree
(
GetProcessHeap
(),
0
,
target
);
msi_free
(
source
);
msi_free
(
target
);
msiobj_release
(
&
row
->
hdr
);
return
rc
;
}
...
...
@@ -304,7 +304,7 @@ static void file_running_action(MSIPACKAGE* package, HANDLE Handle,
{
MSIRUNNINGACTION
*
action
;
action
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
MSIRUNNINGACTION
)
);
action
=
msi_alloc
(
sizeof
(
MSIRUNNINGACTION
)
);
action
->
handle
=
Handle
;
action
->
process
=
process
;
...
...
@@ -443,15 +443,15 @@ static DWORD WINAPI ACTION_CallDllFunction(thread_struct *stuff)
else
ERR
(
"Cannot load functon
\n
"
);
HeapFree
(
GetProcessHeap
(),
0
,
proc
);
msi_free
(
proc
);
FreeLibrary
(
hModule
);
}
else
ERR
(
"Unable to load library
\n
"
);
msiobj_release
(
&
stuff
->
package
->
hdr
);
HeapFree
(
GetProcessHeap
(),
0
,
stuff
->
source
);
HeapFree
(
GetProcessHeap
(),
0
,
stuff
->
target
);
HeapFree
(
GetProcessHeap
(),
0
,
stuff
);
msi_free
(
stuff
->
source
);
msi_free
(
stuff
->
target
);
msi_free
(
stuff
);
return
rc
;
}
...
...
@@ -493,7 +493,7 @@ static UINT HANDLE_CustomType1(MSIPACKAGE *package, LPCWSTR source,
strcatW
(
tmp_file
,
dot
);
}
info
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
*
info
)
);
info
=
msi_alloc
(
sizeof
(
*
info
)
);
msiobj_addref
(
&
package
->
hdr
);
info
->
package
=
package
;
info
->
target
=
strdupW
(
target
);
...
...
@@ -536,7 +536,7 @@ static UINT HANDLE_CustomType2(MSIPACKAGE *package, LPCWSTR source,
if
(
deformated
)
len
+=
strlenW
(
deformated
);
cmd
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
WCHAR
)
*
len
);
cmd
=
msi_alloc
(
sizeof
(
WCHAR
)
*
len
);
strcpyW
(
cmd
,
tmp_file
);
if
(
deformated
)
...
...
@@ -544,7 +544,7 @@ static UINT HANDLE_CustomType2(MSIPACKAGE *package, LPCWSTR source,
strcatW
(
cmd
,
spc
);
strcatW
(
cmd
,
deformated
);
HeapFree
(
GetProcessHeap
(),
0
,
deformated
);
msi_free
(
deformated
);
}
TRACE
(
"executing exe %s
\n
"
,
debugstr_w
(
cmd
));
...
...
@@ -552,7 +552,7 @@ static UINT HANDLE_CustomType2(MSIPACKAGE *package, LPCWSTR source,
rc
=
CreateProcessW
(
NULL
,
cmd
,
NULL
,
NULL
,
FALSE
,
0
,
NULL
,
c_collen
,
&
si
,
&
info
);
HeapFree
(
GetProcessHeap
(),
0
,
cmd
);
msi_free
(
cmd
);
if
(
!
rc
)
{
...
...
@@ -597,7 +597,7 @@ static UINT HANDLE_CustomType18(MSIPACKAGE *package, LPCWSTR source,
len
+=
strlenW
(
deformated
);
len
+=
2
;
cmd
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len
*
sizeof
(
WCHAR
));
cmd
=
msi_alloc
(
len
*
sizeof
(
WCHAR
));
lstrcpyW
(
cmd
,
file
->
TargetPath
);
if
(
deformated
)
...
...
@@ -605,7 +605,7 @@ static UINT HANDLE_CustomType18(MSIPACKAGE *package, LPCWSTR source,
strcatW
(
cmd
,
spc
);
strcatW
(
cmd
,
deformated
);
HeapFree
(
GetProcessHeap
(),
0
,
deformated
);
msi_free
(
deformated
);
}
TRACE
(
"executing exe %s
\n
"
,
debugstr_w
(
cmd
));
...
...
@@ -613,7 +613,7 @@ static UINT HANDLE_CustomType18(MSIPACKAGE *package, LPCWSTR source,
rc
=
CreateProcessW
(
NULL
,
cmd
,
NULL
,
NULL
,
FALSE
,
0
,
NULL
,
c_collen
,
&
si
,
&
info
);
HeapFree
(
GetProcessHeap
(),
0
,
cmd
);
msi_free
(
cmd
);
if
(
!
rc
)
{
...
...
@@ -652,7 +652,7 @@ static UINT HANDLE_CustomType19(MSIPACKAGE *package, LPCWSTR source,
else
MessageBoxW
(
NULL
,
deformated
,
NULL
,
MB_OK
);
HeapFree
(
GetProcessHeap
(),
0
,
deformated
);
msi_free
(
deformated
);
return
ERROR_FUNCTION_FAILED
;
}
...
...
@@ -681,7 +681,7 @@ static UINT HANDLE_CustomType50(MSIPACKAGE *package, LPCWSTR source,
if
(
deformated
)
len
+=
strlenW
(
deformated
);
cmd
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
WCHAR
)
*
len
);
cmd
=
msi_alloc
(
sizeof
(
WCHAR
)
*
len
);
strcpyW
(
cmd
,
prop
);
if
(
deformated
)
...
...
@@ -689,16 +689,16 @@ static UINT HANDLE_CustomType50(MSIPACKAGE *package, LPCWSTR source,
strcatW
(
cmd
,
spc
);
strcatW
(
cmd
,
deformated
);
HeapFree
(
GetProcessHeap
(),
0
,
deformated
);
msi_free
(
deformated
);
}
HeapFree
(
GetProcessHeap
(),
0
,
prop
);
msi_free
(
prop
);
TRACE
(
"executing exe %s
\n
"
,
debugstr_w
(
cmd
));
rc
=
CreateProcessW
(
NULL
,
cmd
,
NULL
,
NULL
,
FALSE
,
0
,
NULL
,
c_collen
,
&
si
,
&
info
);
HeapFree
(
GetProcessHeap
(),
0
,
cmd
);
msi_free
(
cmd
);
if
(
!
rc
)
{
...
...
@@ -726,7 +726,7 @@ static UINT HANDLE_CustomType34(MSIPACKAGE *package, LPCWSTR source,
return
ERROR_FUNCTION_FAILED
;
SetCurrentDirectoryW
(
filename
);
HeapFree
(
GetProcessHeap
(),
0
,
filename
);
msi_free
(
filename
);
deformat_string
(
package
,
target
,
&
deformated
);
...
...
@@ -737,7 +737,7 @@ static UINT HANDLE_CustomType34(MSIPACKAGE *package, LPCWSTR source,
rc
=
CreateProcessW
(
NULL
,
deformated
,
NULL
,
NULL
,
FALSE
,
0
,
NULL
,
c_collen
,
&
si
,
&
info
);
HeapFree
(
GetProcessHeap
(),
0
,
deformated
);
msi_free
(
deformated
);
if
(
!
rc
)
{
...
...
@@ -777,7 +777,7 @@ void ACTION_FinishCustomActions(MSIPACKAGE* package)
}
CloseHandle
(
action
->
handle
);
HeapFree
(
GetProcessHeap
(),
0
,
action
->
name
);
HeapFree
(
GetProcessHeap
(),
0
,
action
);
msi_free
(
action
->
name
);
msi_free
(
action
);
}
}
dlls/msi/database.c
View file @
ee034ba4
...
...
@@ -93,7 +93,7 @@ UINT MSI_OpenDatabaseW(LPCWSTR szDBPath, LPCWSTR szPersist, MSIDATABASE **pdb)
/* UINT len = lstrlenW( szPerist ) + 1; */
FIXME
(
"don't support persist files yet
\b
"
);
return
ERROR_INVALID_PARAMETER
;
/* szMode =
HeapAlloc( GetProcessHeap(), 0,
len * sizeof (DWORD) ); */
/* szMode =
msi_alloc(
len * sizeof (DWORD) ); */
}
else
if
(
szPersist
==
MSIDBOPEN_READONLY
)
{
...
...
@@ -220,8 +220,8 @@ UINT WINAPI MsiOpenDatabaseA(LPCSTR szDBPath, LPCSTR szPersist, MSIHANDLE *phDB)
end:
if
(
HIWORD
(
szPersist
)
)
HeapFree
(
GetProcessHeap
(),
0
,
szwPersist
);
HeapFree
(
GetProcessHeap
(),
0
,
szwDBPath
);
msi_free
(
szwPersist
);
msi_free
(
szwDBPath
);
return
r
;
}
...
...
@@ -276,8 +276,8 @@ UINT WINAPI MsiDatabaseImportA( MSIHANDLE handle,
r
=
MsiDatabaseImportW
(
handle
,
path
,
file
);
end:
HeapFree
(
GetProcessHeap
(),
0
,
path
);
HeapFree
(
GetProcessHeap
(),
0
,
file
);
msi_free
(
path
);
msi_free
(
file
);
return
r
;
}
...
...
@@ -344,9 +344,9 @@ UINT WINAPI MsiDatabaseExportA( MSIHANDLE handle, LPCSTR szTable,
r
=
MsiDatabaseExportW
(
handle
,
table
,
path
,
file
);
end:
HeapFree
(
GetProcessHeap
(),
0
,
table
);
HeapFree
(
GetProcessHeap
(),
0
,
path
);
HeapFree
(
GetProcessHeap
(),
0
,
file
);
msi_free
(
table
);
msi_free
(
path
);
msi_free
(
file
);
return
r
;
}
dlls/msi/dialog.c
View file @
ee034ba4
...
...
@@ -197,7 +197,7 @@ static LPWSTR msi_dialog_get_style( LPWSTR *text )
return
ret
;
len
=
q
-
p
;
ret
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len
*
sizeof
(
WCHAR
)
);
ret
=
msi_alloc
(
len
*
sizeof
(
WCHAR
)
);
if
(
!
ret
)
return
ret
;
memcpy
(
ret
,
p
,
len
*
sizeof
(
WCHAR
)
);
...
...
@@ -216,8 +216,7 @@ static UINT msi_dialog_add_font( MSIRECORD *rec, LPVOID param )
/* create a font and add it to the list */
name
=
MSI_RecordGetString
(
rec
,
1
);
font
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
*
font
+
strlenW
(
name
)
*
sizeof
(
WCHAR
)
);
font
=
msi_alloc
(
sizeof
*
font
+
strlenW
(
name
)
*
sizeof
(
WCHAR
)
);
strcpyW
(
font
->
name
,
name
);
font
->
next
=
dialog
->
font_list
;
dialog
->
font_list
=
font
;
...
...
@@ -305,8 +304,7 @@ static msi_control *msi_dialog_create_window( msi_dialog *dialog,
style
|=
WS_CHILD
;
control
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
*
control
+
strlenW
(
name
)
*
sizeof
(
WCHAR
)
);
control
=
msi_alloc
(
sizeof
*
control
+
strlenW
(
name
)
*
sizeof
(
WCHAR
)
);
strcpyW
(
control
->
name
,
name
);
list_add_head
(
&
dialog
->
controls
,
&
control
->
entry
);
control
->
handler
=
NULL
;
...
...
@@ -342,8 +340,8 @@ static msi_control *msi_dialog_create_window( msi_dialog *dialog,
msi_dialog_set_font
(
dialog
,
control
->
hwnd
,
font
?
font
:
dialog
->
default_font
);
HeapFree
(
GetProcessHeap
(),
0
,
font
);
HeapFree
(
GetProcessHeap
(),
0
,
title
);
msi_free
(
font
);
msi_free
(
title
);
return
control
;
}
...
...
@@ -371,13 +369,13 @@ static LPWSTR msi_create_tmp_path(void)
if
(
!
r
)
return
path
;
len
=
lstrlenW
(
tmp
)
+
20
;
path
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len
*
sizeof
(
WCHAR
)
);
path
=
msi_alloc
(
len
*
sizeof
(
WCHAR
)
);
if
(
path
)
{
r
=
GetTempFileNameW
(
tmp
,
prefix
,
0
,
path
);
if
(
!
r
)
{
HeapFree
(
GetProcessHeap
(),
0
,
path
);
msi_free
(
path
);
path
=
NULL
;
}
}
...
...
@@ -411,7 +409,7 @@ static HANDLE msi_load_image( MSIDATABASE *db, LPCWSTR name, UINT type,
msiobj_release
(
&
rec
->
hdr
);
}
HeapFree
(
GetProcessHeap
(),
0
,
tmp
);
msi_free
(
tmp
);
return
himage
;
}
...
...
@@ -546,7 +544,7 @@ MSIText_WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
msi_text_on_settext
(
hWnd
);
break
;
case
WM_NCDESTROY
:
HeapFree
(
GetProcessHeap
(),
0
,
info
);
msi_free
(
info
);
RemovePropW
(
hWnd
,
szButtonData
);
break
;
}
...
...
@@ -565,7 +563,7 @@ static UINT msi_dialog_text_control( msi_dialog *dialog, MSIRECORD *rec )
if
(
!
control
)
return
ERROR_FUNCTION_FAILED
;
info
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
*
info
);
info
=
msi_alloc
(
sizeof
*
info
);
if
(
!
info
)
return
ERROR_SUCCESS
;
...
...
@@ -604,7 +602,7 @@ static UINT msi_dialog_button_control( msi_dialog *dialog, MSIRECORD *rec )
control
->
hIcon
=
msi_load_icon
(
dialog
->
package
->
db
,
text
,
attributes
);
if
(
attributes
&
msidbControlAttributesIcon
)
SendMessageW
(
control
->
hwnd
,
BM_SETIMAGE
,
IMAGE_ICON
,
(
LPARAM
)
control
->
hIcon
);
HeapFree
(
GetProcessHeap
(),
0
,
text
);
msi_free
(
text
);
return
ERROR_SUCCESS
;
}
...
...
@@ -633,7 +631,7 @@ static LPWSTR msi_get_checkbox_value( msi_dialog *dialog, LPCWSTR prop )
deformat_string
(
dialog
->
package
,
val
,
&
ret
);
if
(
ret
&&
!
ret
[
0
]
)
{
HeapFree
(
GetProcessHeap
(),
0
,
ret
);
msi_free
(
ret
);
ret
=
NULL
;
}
}
...
...
@@ -644,7 +642,7 @@ static LPWSTR msi_get_checkbox_value( msi_dialog *dialog, LPCWSTR prop )
ret
=
msi_dup_property
(
dialog
->
package
,
prop
);
if
(
ret
&&
!
ret
[
0
]
)
{
HeapFree
(
GetProcessHeap
(),
0
,
ret
);
msi_free
(
ret
);
ret
=
NULL
;
}
...
...
@@ -738,7 +736,7 @@ static UINT msi_dialog_scrolltext_control( msi_dialog *dialog, MSIRECORD *rec )
SendMessageW
(
control
->
hwnd
,
EM_STREAMIN
,
SF_RTF
,
(
LPARAM
)
&
es
);
HeapFree
(
GetProcessHeap
(),
0
,
info
.
string
);
msi_free
(
info
.
string
);
return
ERROR_SUCCESS
;
}
...
...
@@ -774,7 +772,7 @@ static UINT msi_dialog_bitmap_control( msi_dialog *dialog, MSIRECORD *rec )
else
ERR
(
"Failed to load bitmap %s
\n
"
,
debugstr_w
(
text
));
HeapFree
(
GetProcessHeap
(),
0
,
text
);
msi_free
(
text
);
return
ERROR_SUCCESS
;
}
...
...
@@ -797,7 +795,7 @@ static UINT msi_dialog_icon_control( msi_dialog *dialog, MSIRECORD *rec )
SendMessageW
(
control
->
hwnd
,
STM_SETICON
,
(
WPARAM
)
control
->
hIcon
,
0
);
else
ERR
(
"Failed to load bitmap %s
\n
"
,
debugstr_w
(
text
));
HeapFree
(
GetProcessHeap
(),
0
,
text
);
msi_free
(
text
);
return
ERROR_SUCCESS
;
}
...
...
@@ -824,7 +822,7 @@ static UINT msi_dialog_edit_control( msi_dialog *dialog, MSIRECORD *rec )
control
->
property
=
strdupW
(
prop
);
val
=
msi_dup_property
(
dialog
->
package
,
control
->
property
);
SetWindowTextW
(
control
->
hwnd
,
val
);
HeapFree
(
GetProcessHeap
(),
0
,
val
);
msi_free
(
val
);
return
ERROR_SUCCESS
;
}
...
...
@@ -856,7 +854,7 @@ static void msi_mask_control_change( struct msi_maskedit_info *info )
LPWSTR
val
;
UINT
i
,
n
,
r
;
val
=
HeapAlloc
(
GetProcessHeap
(),
0
,
(
info
->
num_chars
+
1
)
*
sizeof
(
WCHAR
)
);
val
=
msi_alloc
(
(
info
->
num_chars
+
1
)
*
sizeof
(
WCHAR
)
);
for
(
i
=
0
,
n
=
0
;
i
<
info
->
num_groups
;
i
++
)
{
if
(
(
info
->
group
[
i
].
len
+
n
)
>
info
->
num_chars
)
...
...
@@ -880,7 +878,7 @@ static void msi_mask_control_change( struct msi_maskedit_info *info )
MSI_SetPropertyW
(
info
->
dialog
->
package
,
info
->
prop
,
val
);
msi_dialog_evaluate_control_conditions
(
info
->
dialog
);
}
HeapFree
(
GetProcessHeap
(),
0
,
val
);
msi_free
(
val
);
}
/* now move to the next control if necessary */
...
...
@@ -927,8 +925,8 @@ MSIMaskedEdit_WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
}
break
;
case
WM_NCDESTROY
:
HeapFree
(
GetProcessHeap
(),
0
,
info
->
prop
);
HeapFree
(
GetProcessHeap
(),
0
,
info
);
msi_free
(
info
->
prop
);
msi_free
(
info
);
RemovePropW
(
hWnd
,
szButtonData
);
break
;
}
...
...
@@ -951,7 +949,7 @@ msi_maskedit_set_text( struct msi_maskedit_info *info, LPCWSTR text )
LPWSTR
chunk
=
strdupW
(
p
);
chunk
[
info
->
group
[
i
].
len
]
=
0
;
SetWindowTextW
(
info
->
group
[
i
].
hwnd
,
chunk
);
HeapFree
(
GetProcessHeap
(),
0
,
chunk
);
msi_free
(
chunk
);
}
else
{
...
...
@@ -977,7 +975,7 @@ static struct msi_maskedit_info * msi_dialog_parse_groups( LPCWSTR mask )
if
(
!
p
)
return
info
;
info
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
*
info
);
info
=
msi_alloc_zero
(
sizeof
*
info
);
if
(
!
info
)
return
info
;
...
...
@@ -1112,15 +1110,15 @@ static UINT msi_dialog_maskedit_control( msi_dialog *dialog, MSIRECORD *rec )
if
(
val
)
{
msi_maskedit_set_text
(
info
,
val
);
HeapFree
(
GetProcessHeap
(),
0
,
val
);
msi_free
(
val
);
}
}
end:
if
(
ret
!=
ERROR_SUCCESS
)
HeapFree
(
GetProcessHeap
(),
0
,
info
);
HeapFree
(
GetProcessHeap
(),
0
,
title
);
HeapFree
(
GetProcessHeap
(),
0
,
mask
);
msi_free
(
info
);
msi_free
(
title
);
msi_free
(
mask
);
return
ret
;
}
...
...
@@ -1477,7 +1475,7 @@ static LRESULT msi_dialog_oncreate( HWND hwnd, LPCREATESTRUCTW cs )
title
=
msi_get_deformatted_field
(
dialog
->
package
,
rec
,
7
);
SetWindowTextW
(
hwnd
,
title
);
HeapFree
(
GetProcessHeap
(),
0
,
title
);
msi_free
(
title
);
SetWindowPos
(
hwnd
,
0
,
0
,
0
,
size
.
cx
,
size
.
cy
,
SWP_NOMOVE
|
SWP_NOACTIVATE
|
SWP_NOZORDER
|
SWP_NOREDRAW
);
...
...
@@ -1504,8 +1502,8 @@ static UINT msi_dialog_send_event( msi_dialog *dialog, LPCWSTR event, LPCWSTR ar
dialog
->
event_handler
(
dialog
->
package
,
event_fmt
,
arg_fmt
,
dialog
);
HeapFree
(
GetProcessHeap
(),
0
,
event_fmt
);
HeapFree
(
GetProcessHeap
(),
0
,
arg_fmt
);
msi_free
(
event_fmt
);
msi_free
(
arg_fmt
);
return
ERROR_SUCCESS
;
}
...
...
@@ -1517,7 +1515,7 @@ static UINT msi_dialog_set_property( msi_dialog *dialog, LPCWSTR event, LPCWSTR
UINT
len
;
len
=
strlenW
(
event
);
prop
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len
*
sizeof
(
WCHAR
));
prop
=
msi_alloc
(
len
*
sizeof
(
WCHAR
));
strcpyW
(
prop
,
&
event
[
1
]
);
p
=
strchrW
(
prop
,
']'
);
if
(
p
&&
p
[
1
]
==
0
)
...
...
@@ -1529,7 +1527,7 @@ static UINT msi_dialog_set_property( msi_dialog *dialog, LPCWSTR event, LPCWSTR
}
else
ERR
(
"Badly formatted property string - what happens?
\n
"
);
HeapFree
(
GetProcessHeap
(),
0
,
prop
);
msi_free
(
prop
);
return
ERROR_SUCCESS
;
}
...
...
@@ -1660,19 +1658,19 @@ static UINT msi_dialog_edit_handler( msi_dialog *dialog,
debugstr_w
(
control
->
property
));
sz
=
0x20
;
buf
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sz
*
sizeof
(
WCHAR
)
);
buf
=
msi_alloc
(
sz
*
sizeof
(
WCHAR
)
);
while
(
buf
)
{
r
=
GetWindowTextW
(
control
->
hwnd
,
buf
,
sz
);
if
(
r
<
(
sz
-
1
)
)
break
;
sz
*=
2
;
buf
=
HeapReAlloc
(
GetProcessHeap
(),
0
,
buf
,
sz
*
sizeof
(
WCHAR
)
);
buf
=
msi_realloc
(
buf
,
sz
*
sizeof
(
WCHAR
)
);
}
MSI_SetPropertyW
(
dialog
->
package
,
control
->
property
,
buf
);
HeapFree
(
GetProcessHeap
(),
0
,
buf
);
msi_free
(
buf
);
return
ERROR_SUCCESS
;
}
...
...
@@ -1799,8 +1797,7 @@ msi_dialog *msi_dialog_create( MSIPACKAGE* package, LPCWSTR szDialogName,
TRACE
(
"%p %s
\n
"
,
package
,
debugstr_w
(
szDialogName
));
/* allocate the structure for the dialog to use */
dialog
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
*
dialog
+
sizeof
(
WCHAR
)
*
strlenW
(
szDialogName
)
);
dialog
=
msi_alloc_zero
(
sizeof
*
dialog
+
sizeof
(
WCHAR
)
*
strlenW
(
szDialogName
)
);
if
(
!
dialog
)
return
NULL
;
strcpyW
(
dialog
->
name
,
szDialogName
);
...
...
@@ -1815,7 +1812,7 @@ msi_dialog *msi_dialog_create( MSIPACKAGE* package, LPCWSTR szDialogName,
if
(
!
rec
)
{
msiobj_release
(
&
package
->
hdr
);
HeapFree
(
GetProcessHeap
(),
0
,
dialog
);
msi_free
(
dialog
);
return
NULL
;
}
dialog
->
attributes
=
MSI_RecordGetInteger
(
rec
,
6
);
...
...
@@ -1940,14 +1937,14 @@ void msi_dialog_destroy( msi_dialog *dialog )
msi_control
,
entry
);
list_remove
(
&
t
->
entry
);
/* leave dialog->hwnd - destroying parent destroys child windows */
HeapFree
(
GetProcessHeap
(),
0
,
t
->
property
);
HeapFree
(
GetProcessHeap
(),
0
,
t
->
value
);
msi_free
(
t
->
property
);
msi_free
(
t
->
value
);
if
(
t
->
hBitmap
)
DeleteObject
(
t
->
hBitmap
);
if
(
t
->
hIcon
)
DestroyIcon
(
t
->
hIcon
);
HeapFree
(
GetProcessHeap
(),
0
,
t
->
tabnext
);
HeapFree
(
GetProcessHeap
(),
0
,
t
);
msi_free
(
t
->
tabnext
);
msi_free
(
t
);
if
(
t
->
hDll
)
FreeLibrary
(
t
->
hDll
);
}
...
...
@@ -1958,13 +1955,13 @@ void msi_dialog_destroy( msi_dialog *dialog )
msi_font
*
t
=
dialog
->
font_list
;
dialog
->
font_list
=
t
->
next
;
DeleteObject
(
t
->
hfont
);
HeapFree
(
GetProcessHeap
(),
0
,
t
);
msi_free
(
t
);
}
HeapFree
(
GetProcessHeap
(),
0
,
dialog
->
default_font
);
msi_free
(
dialog
->
default_font
);
msiobj_release
(
&
dialog
->
package
->
hdr
);
dialog
->
package
=
NULL
;
HeapFree
(
GetProcessHeap
(),
0
,
dialog
);
msi_free
(
dialog
);
}
BOOL
msi_dialog_register_class
(
void
)
...
...
dlls/msi/files.c
View file @
ee034ba4
...
...
@@ -72,7 +72,7 @@ static UINT create_component_directory( MSIPACKAGE* package, MSICOMPONENT *comp
create_full_pathW
(
install_path
);
folder
->
State
=
2
;
}
HeapFree
(
GetProcessHeap
(),
0
,
install_path
);
msi_free
(
install_path
);
return
rc
;
}
...
...
@@ -115,7 +115,7 @@ static UINT writeout_cabinet_stream(MSIPACKAGE *package, LPCWSTR stream_name,
CloseHandle
(
the_file
);
TRACE
(
"wrote %li bytes to %s
\n
"
,
write
,
debugstr_w
(
source
));
end:
HeapFree
(
GetProcessHeap
(),
0
,
data
);
msi_free
(
data
);
return
rc
;
}
...
...
@@ -129,12 +129,12 @@ typedef struct
static
void
*
cabinet_alloc
(
ULONG
cb
)
{
return
HeapAlloc
(
GetProcessHeap
(),
0
,
cb
);
return
msi_alloc
(
cb
);
}
static
void
cabinet_free
(
void
*
pv
)
{
HeapFree
(
GetProcessHeap
(),
0
,
pv
);
msi_free
(
pv
);
}
static
INT_PTR
cabinet_open
(
char
*
pszFile
,
int
oflag
,
int
pmode
)
...
...
@@ -218,14 +218,14 @@ static INT_PTR cabinet_notify(FDINOTIFICATIONTYPE fdint, PFDINOTIFICATION pfdin)
if
(
!
f
)
{
ERR
(
"Unknown File in Cabinent (%s)
\n
"
,
debugstr_w
(
given_file
));
HeapFree
(
GetProcessHeap
(),
0
,
given_file
);
msi_free
(
given_file
);
return
0
;
}
if
(
!
((
f
->
State
==
1
||
f
->
State
==
2
)))
{
TRACE
(
"Skipping extraction of %s
\n
"
,
debugstr_w
(
given_file
));
HeapFree
(
GetProcessHeap
(),
0
,
given_file
);
msi_free
(
given_file
);
return
0
;
}
...
...
@@ -238,7 +238,7 @@ static INT_PTR cabinet_notify(FDINOTIFICATIONTYPE fdint, PFDINOTIFICATION pfdin)
/* track this file so it can be deleted if not installed */
trackpath
=
strdupAtoW
(
file
);
tracknametmp
=
strdupAtoW
(
strrchr
(
file
,
'\\'
)
+
1
);
trackname
=
HeapAlloc
(
GetProcessHeap
(),
0
,
(
strlenW
(
tracknametmp
)
+
trackname
=
msi_alloc
(
(
strlenW
(
tracknametmp
)
+
strlenW
(
tmpprefix
)
+
1
)
*
sizeof
(
WCHAR
));
strcpyW
(
trackname
,
tmpprefix
);
...
...
@@ -246,9 +246,9 @@ static INT_PTR cabinet_notify(FDINOTIFICATIONTYPE fdint, PFDINOTIFICATION pfdin)
track_tempfile
(
data
->
package
,
trackname
,
trackpath
);
HeapFree
(
GetProcessHeap
(),
0
,
trackpath
);
HeapFree
(
GetProcessHeap
(),
0
,
trackname
);
HeapFree
(
GetProcessHeap
(),
0
,
tracknametmp
);
msi_free
(
trackpath
);
msi_free
(
trackname
);
msi_free
(
tracknametmp
);
/* the UI chunk */
uirow
=
MSI_CreateRecord
(
9
);
...
...
@@ -259,7 +259,7 @@ static INT_PTR cabinet_notify(FDINOTIFICATIONTYPE fdint, PFDINOTIFICATION pfdin)
MSI_RecordSetInteger
(
uirow
,
6
,
f
->
FileSize
);
ui_actiondata
(
data
->
package
,
szInstallFiles
,
uirow
);
msiobj_release
(
&
uirow
->
hdr
);
HeapFree
(
GetProcessHeap
(),
0
,
uipath
);
msi_free
(
uipath
);
ui_progress
(
data
->
package
,
2
,
f
->
FileSize
,
0
,
0
);
...
...
@@ -324,7 +324,7 @@ static BOOL extract_cabinet_file(MSIPACKAGE* package, LPCWSTR source,
if
(
!
(
cab_path
=
strdupWtoA
(
path
)))
{
FDIDestroy
(
hfdi
);
HeapFree
(
GetProcessHeap
(),
0
,
cabinet
);
msi_free
(
cabinet
);
return
FALSE
;
}
...
...
@@ -338,8 +338,8 @@ static BOOL extract_cabinet_file(MSIPACKAGE* package, LPCWSTR source,
FDIDestroy
(
hfdi
);
HeapFree
(
GetProcessHeap
(),
0
,
cabinet
);
HeapFree
(
GetProcessHeap
(),
0
,
cab_path
);
msi_free
(
cabinet
);
msi_free
(
cab_path
);
return
ret
;
}
...
...
@@ -352,7 +352,7 @@ static VOID set_file_source(MSIPACKAGE* package, MSIFILE* file, MSICOMPONENT*
LPWSTR
p
;
p
=
resolve_folder
(
package
,
comp
->
Directory
,
TRUE
,
FALSE
,
NULL
);
file
->
SourcePath
=
build_directory_name
(
2
,
p
,
file
->
ShortName
);
HeapFree
(
GetProcessHeap
(),
0
,
p
);
msi_free
(
p
);
}
else
file
->
SourcePath
=
build_directory_name
(
2
,
path
,
file
->
File
);
...
...
@@ -419,15 +419,15 @@ static UINT ready_volume(MSIPACKAGE* package, LPCWSTR path, LPWSTR last_volume,
prompt
=
MSI_RecordGetString
(
row
,
3
);
msg
=
generate_error_string
(
package
,
1302
,
1
,
prompt
);
rc
=
MessageBoxW
(
NULL
,
msg
,
NULL
,
MB_OKCANCEL
);
HeapFree
(
GetProcessHeap
(),
0
,
volume
);
HeapFree
(
GetProcessHeap
(),
0
,
msg
);
msi_free
(
volume
);
msi_free
(
msg
);
if
(
rc
==
IDOK
)
ok
=
check_for_sourcefile
(
path
);
else
return
ERROR_INSTALL_USEREXIT
;
}
HeapFree
(
GetProcessHeap
(),
0
,
last_volume
);
msi_free
(
last_volume
);
last_volume
=
strdupW
(
volume
);
return
ERROR_SUCCESS
;
}
...
...
@@ -457,8 +457,8 @@ static UINT ready_media_for_file(MSIPACKAGE *package, MSIFILE *file,
/* cleanup signal */
if
(
!
package
)
{
HeapFree
(
GetProcessHeap
(),
0
,
last_path
);
HeapFree
(
GetProcessHeap
(),
0
,
last_volume
);
msi_free
(
last_path
);
msi_free
(
last_volume
);
last_sequence
=
0
;
last_path
=
NULL
;
last_volume
=
NULL
;
...
...
@@ -488,7 +488,7 @@ static UINT ready_media_for_file(MSIPACKAGE *package, MSIFILE *file,
volume
=
MSI_RecordGetString
(
row
,
5
);
prompt
=
MSI_RecordGetString
(
row
,
3
);
HeapFree
(
GetProcessHeap
(),
0
,
last_path
);
msi_free
(
last_path
);
last_path
=
NULL
;
if
(
file
->
Attributes
&
msidbFileAttributesNoncompressed
)
...
...
@@ -540,12 +540,12 @@ static UINT ready_media_for_file(MSIPACKAGE *package, MSIFILE *file,
MSICODE_PRODUCT
|
MSISOURCETYPE_NETWORK
,
INSTALLPROPERTY_LASTUSEDSOURCEW
,
path
);
HeapFree
(
GetProcessHeap
(),
0
,
path
);
msi_free
(
path
);
}
else
{
sz
=
MAX_PATH
;
last_path
=
HeapAlloc
(
GetProcessHeap
(),
0
,
MAX_PATH
*
sizeof
(
WCHAR
));
last_path
=
msi_alloc
(
MAX_PATH
*
sizeof
(
WCHAR
));
if
(
MSI_GetPropertyW
(
package
,
cszSourceDir
,
source
,
&
sz
))
{
ERR
(
"No Source dir defined
\n
"
);
...
...
@@ -581,7 +581,7 @@ static UINT ready_media_for_file(MSIPACKAGE *package, MSIFILE *file,
else
{
sz
=
MAX_PATH
;
last_path
=
HeapAlloc
(
GetProcessHeap
(),
0
,
MAX_PATH
*
sizeof
(
WCHAR
));
last_path
=
msi_alloc
(
MAX_PATH
*
sizeof
(
WCHAR
));
MSI_GetPropertyW
(
package
,
cszSourceDir
,
source
,
&
sz
);
strcpyW
(
last_path
,
source
);
rc
=
ready_volume
(
package
,
last_path
,
last_volume
,
row
,
&
type
);
...
...
@@ -699,10 +699,10 @@ UINT ACTION_InstallFiles(MSIPACKAGE *package)
}
p
=
resolve_folder
(
package
,
comp
->
Directory
,
FALSE
,
FALSE
,
NULL
);
HeapFree
(
GetProcessHeap
(),
0
,
file
->
TargetPath
);
msi_free
(
file
->
TargetPath
);
file
->
TargetPath
=
build_directory_name
(
2
,
p
,
file
->
FileName
);
HeapFree
(
GetProcessHeap
(),
0
,
p
);
msi_free
(
p
);
}
}
...
...
@@ -808,7 +808,7 @@ static UINT ITERATE_DuplicateFiles(MSIRECORD *row, LPVOID param)
if
(
rc
!=
ERROR_SUCCESS
)
{
ERR
(
"Original file unknown %s
\n
"
,
debugstr_w
(
file_key
));
HeapFree
(
GetProcessHeap
(),
0
,
file_source
);
msi_free
(
file_source
);
return
ERROR_SUCCESS
;
}
...
...
@@ -841,7 +841,7 @@ static UINT ITERATE_DuplicateFiles(MSIRECORD *row, LPVOID param)
if
(
!
dest_path
)
{
FIXME
(
"Unable to get destination folder, try AppSearch properties
\n
"
);
HeapFree
(
GetProcessHeap
(),
0
,
file_source
);
msi_free
(
file_source
);
return
ERROR_SUCCESS
;
}
}
...
...
@@ -862,9 +862,9 @@ static UINT ITERATE_DuplicateFiles(MSIRECORD *row, LPVOID param)
FIXME
(
"We should track these duplicate files as well
\n
"
);
HeapFree
(
GetProcessHeap
(),
0
,
dest_path
);
HeapFree
(
GetProcessHeap
(),
0
,
dest
);
HeapFree
(
GetProcessHeap
(),
0
,
file_source
);
msi_free
(
dest_path
);
msi_free
(
dest
);
msi_free
(
file_source
);
return
ERROR_SUCCESS
;
}
...
...
dlls/msi/format.c
View file @
ee034ba4
...
...
@@ -56,7 +56,7 @@ static LPWSTR build_default_format(MSIRECORD* record)
count
=
MSI_RecordGetFieldCount
(
record
);
rc
=
HeapAlloc
(
GetProcessHeap
(),
0
,
(
11
*
count
)
*
sizeof
(
WCHAR
));
rc
=
msi_alloc
(
(
11
*
count
)
*
sizeof
(
WCHAR
));
rc
[
0
]
=
0
;
for
(
i
=
1
;
i
<=
count
;
i
++
)
{
...
...
@@ -124,7 +124,7 @@ static LPWSTR deformat_file(MSIPACKAGE* package, LPCWSTR key, DWORD* sz,
{
*
sz
=
(
size
-
1
)
*
sizeof
(
WCHAR
);
size
++
;
value
=
HeapAlloc
(
GetProcessHeap
(),
0
,
size
*
sizeof
(
WCHAR
));
value
=
msi_alloc
(
size
*
sizeof
(
WCHAR
));
GetShortPathNameW
(
file
->
TargetPath
,
value
,
size
);
}
else
...
...
@@ -150,7 +150,7 @@ static LPWSTR deformat_environment(MSIPACKAGE* package, LPCWSTR key,
if
(
sz
>
0
)
{
sz
++
;
value
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sz
*
sizeof
(
WCHAR
));
value
=
msi_alloc
(
sz
*
sizeof
(
WCHAR
));
GetEnvironmentVariableW
(
&
key
[
1
],
value
,
sz
);
*
chunk
=
(
strlenW
(
value
))
*
sizeof
(
WCHAR
);
}
...
...
@@ -168,7 +168,7 @@ static LPWSTR deformat_NULL(DWORD* chunk)
{
LPWSTR
value
;
value
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
WCHAR
)
*
2
);
value
=
msi_alloc
(
sizeof
(
WCHAR
)
*
2
);
value
[
0
]
=
0
;
*
chunk
=
sizeof
(
WCHAR
);
return
value
;
...
...
@@ -178,7 +178,7 @@ static LPWSTR deformat_escape(LPCWSTR key, DWORD* chunk)
{
LPWSTR
value
;
value
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
WCHAR
)
*
2
);
value
=
msi_alloc
(
sizeof
(
WCHAR
)
*
2
);
value
[
0
]
=
key
[
0
];
*
chunk
=
sizeof
(
WCHAR
);
...
...
@@ -260,7 +260,7 @@ static BOOL find_next_group(LPCWSTR source, DWORD len_remaining,
*
mark2
=
&
(
*
mark
)[
i
];
i
=
*
mark2
-
*
mark
;
*
group
=
HeapAlloc
(
GetProcessHeap
(),
0
,
i
*
sizeof
(
WCHAR
));
*
group
=
msi_alloc
(
i
*
sizeof
(
WCHAR
));
i
-=
1
;
memcpy
(
*
group
,
&
(
*
mark
)[
1
],
i
*
sizeof
(
WCHAR
));
...
...
@@ -306,7 +306,7 @@ static BOOL find_next_outermost_key(LPCWSTR source, DWORD len_remaining,
*
mark2
=
&
(
*
mark
)[
i
-
1
];
i
=
*
mark2
-
*
mark
;
*
key
=
HeapAlloc
(
GetProcessHeap
(),
0
,
i
*
sizeof
(
WCHAR
));
*
key
=
msi_alloc
(
i
*
sizeof
(
WCHAR
));
/* do not have the [] in the key */
i
-=
1
;
memcpy
(
*
key
,
&
(
*
mark
)[
1
],
i
*
sizeof
(
WCHAR
));
...
...
@@ -319,7 +319,7 @@ static BOOL find_next_outermost_key(LPCWSTR source, DWORD len_remaining,
static
LPWSTR
deformat_group
(
MSIPACKAGE
*
package
,
LPWSTR
group
,
DWORD
len
,
MSIRECORD
*
record
,
DWORD
*
size
)
{
LPWSTR
value
;
LPWSTR
value
=
NULL
;
LPCWSTR
mark
,
mark2
;
LPWSTR
key
;
BOOL
nested
;
...
...
@@ -337,14 +337,14 @@ static LPWSTR deformat_group(MSIPACKAGE* package, LPWSTR group, DWORD len,
if
(
!
find_next_outermost_key
(
group
,
len
,
&
key
,
&
mark
,
&
mark2
,
&
nested
))
{
*
size
=
(
len
+
2
)
*
sizeof
(
WCHAR
);
value
=
HeapAlloc
(
GetProcessHeap
(),
0
,
*
size
);
value
=
msi_alloc
(
*
size
);
sprintfW
(
value
,
fmt
,
group
);
/* do not return size of the null at the end */
*
size
=
(
len
+
1
)
*
sizeof
(
WCHAR
);
return
value
;
}
HeapFree
(
GetProcessHeap
(),
0
,
key
);
msi_free
(
key
);
failcount
=
0
;
sz
=
deformat_string_internal
(
package
,
group
,
&
value
,
strlenW
(
group
),
record
,
&
failcount
);
...
...
@@ -357,11 +357,11 @@ static LPWSTR deformat_group(MSIPACKAGE* package, LPWSTR group, DWORD len,
{
LPWSTR
v2
;
v2
=
HeapAlloc
(
GetProcessHeap
(),
0
,
(
sz
+
2
)
*
sizeof
(
WCHAR
));
v2
=
msi_alloc
(
(
sz
+
2
)
*
sizeof
(
WCHAR
));
v2
[
0
]
=
'{'
;
memcpy
(
&
v2
[
1
],
value
,
sz
*
sizeof
(
WCHAR
));
v2
[
sz
+
1
]
=
'}'
;
HeapFree
(
GetProcessHeap
(),
0
,
value
);
msi_free
(
value
);
*
size
=
(
sz
+
2
)
*
sizeof
(
WCHAR
);
return
v2
;
...
...
@@ -407,7 +407,7 @@ static DWORD deformat_string_internal(MSIPACKAGE *package, LPCWSTR ptr,
(
scanW
(
ptr
,
'{'
,
len
)
&&
!
scanW
(
ptr
,
'}'
,
len
)))
{
/* not formatted */
*
data
=
HeapAlloc
(
GetProcessHeap
(),
0
,
(
len
*
sizeof
(
WCHAR
)));
*
data
=
msi_alloc
(
(
len
*
sizeof
(
WCHAR
)));
memcpy
(
*
data
,
ptr
,
len
*
sizeof
(
WCHAR
));
TRACE
(
"Returning %s
\n
"
,
debugstr_wn
(
*
data
,
len
));
return
len
;
...
...
@@ -437,9 +437,9 @@ static DWORD deformat_string_internal(MSIPACKAGE *package, LPCWSTR ptr,
chunk
=
(
len
-
(
progress
-
ptr
))
*
sizeof
(
WCHAR
);
TRACE
(
"after chunk is %li + %li
\n
"
,
size
,
chunk
);
if
(
size
)
nd2
=
HeapReAlloc
(
GetProcessHeap
(),
0
,
newdata
,(
size
+
chunk
));
nd2
=
msi_realloc
(
newdata
,(
size
+
chunk
));
else
nd2
=
HeapAlloc
(
GetProcessHeap
(),
0
,
chunk
);
nd2
=
msi_alloc
(
chunk
);
newdata
=
nd2
;
memcpy
(
&
newdata
[
size
],
progress
,
chunk
);
...
...
@@ -455,9 +455,9 @@ static DWORD deformat_string_internal(MSIPACKAGE *package, LPCWSTR ptr,
TRACE
(
"%i (%i) characters before marker
\n
"
,
cnt
,(
mark
-
progress
));
size
+=
cnt
*
sizeof
(
WCHAR
);
if
(
!
old_size
)
tgt
=
HeapAlloc
(
GetProcessHeap
(),
0
,
size
);
tgt
=
msi_alloc
(
size
);
else
tgt
=
HeapReAlloc
(
GetProcessHeap
(),
0
,
newdata
,
size
);
tgt
=
msi_realloc
(
newdata
,
size
);
newdata
=
tgt
;
memcpy
(
&
newdata
[
old_size
],
progress
,(
cnt
*
sizeof
(
WCHAR
)));
}
...
...
@@ -470,7 +470,7 @@ static DWORD deformat_string_internal(MSIPACKAGE *package, LPCWSTR ptr,
deformat_string_internal
(
package
,
key
,
&
value
,
strlenW
(
key
)
+
1
,
record
,
failcount
);
HeapFree
(
GetProcessHeap
(),
0
,
key
);
msi_free
(
key
);
key
=
value
;
}
...
...
@@ -494,7 +494,7 @@ static DWORD deformat_string_internal(MSIPACKAGE *package, LPCWSTR ptr,
{
DWORD
keylen
=
strlenW
(
key
);
chunk
=
(
keylen
+
2
)
*
sizeof
(
WCHAR
);
value
=
HeapAlloc
(
GetProcessHeap
(),
0
,
chunk
);
value
=
msi_alloc
(
chunk
);
value
[
0
]
=
'['
;
memcpy
(
&
value
[
1
],
key
,
keylen
*
sizeof
(
WCHAR
));
value
[
1
+
keylen
]
=
']'
;
...
...
@@ -532,7 +532,7 @@ static DWORD deformat_string_internal(MSIPACKAGE *package, LPCWSTR ptr,
else
{
static
const
WCHAR
fmt
[]
=
{
'['
,
'%'
,
's'
,
']'
,
0
};
value
=
HeapAlloc
(
GetProcessHeap
(),
0
,
10
);
value
=
msi_alloc
(
10
);
sprintfW
(
value
,
fmt
,
key
);
chunk
=
strlenW
(
value
)
*
sizeof
(
WCHAR
);
}
...
...
@@ -542,7 +542,7 @@ static DWORD deformat_string_internal(MSIPACKAGE *package, LPCWSTR ptr,
}
}
HeapFree
(
GetProcessHeap
(),
0
,
key
);
msi_free
(
key
);
if
(
value
!=
NULL
)
{
...
...
@@ -550,13 +550,13 @@ static DWORD deformat_string_internal(MSIPACKAGE *package, LPCWSTR ptr,
TRACE
(
"value %s, chunk %li size %li
\n
"
,
debugstr_w
((
LPWSTR
)
value
),
chunk
,
size
);
if
(
size
)
nd2
=
HeapReAlloc
(
GetProcessHeap
(),
0
,
newdata
,(
size
+
chunk
));
nd2
=
msi_realloc
(
newdata
,(
size
+
chunk
));
else
nd2
=
HeapAlloc
(
GetProcessHeap
(),
0
,
chunk
);
nd2
=
msi_alloc
(
chunk
);
newdata
=
nd2
;
memcpy
(
&
newdata
[
size
],
value
,
chunk
);
size
+=
chunk
;
HeapFree
(
GetProcessHeap
(),
0
,
value
);
msi_free
(
value
);
}
else
if
(
failcount
&&
*
failcount
>=
0
)
(
*
failcount
)
++
;
...
...
@@ -614,8 +614,8 @@ UINT MSI_FormatRecordW( MSIPACKAGE* package, MSIRECORD* record, LPWSTR buffer,
*
size
=
len
;
HeapFree
(
GetProcessHeap
(),
0
,
rec
);
HeapFree
(
GetProcessHeap
(),
0
,
deformated
);
msi_free
(
rec
);
msi_free
(
deformated
);
return
rc
;
}
...
...
@@ -658,8 +658,8 @@ UINT MSI_FormatRecordA( MSIPACKAGE* package, MSIRECORD* record, LPSTR buffer,
*
size
=
lenA
;
HeapFree
(
GetProcessHeap
(),
0
,
rec
);
HeapFree
(
GetProcessHeap
(),
0
,
deformated
);
msi_free
(
rec
);
msi_free
(
deformated
);
return
rc
;
}
...
...
dlls/msi/helpers.c
View file @
ee034ba4
...
...
@@ -104,8 +104,8 @@ UINT build_icon_path(MSIPACKAGE *package, LPCWSTR icon_name,
*
FilePath
=
build_directory_name
(
2
,
dest
,
icon_name
);
HeapFree
(
GetProcessHeap
(),
0
,
SystemFolder
);
HeapFree
(
GetProcessHeap
(),
0
,
dest
);
msi_free
(
SystemFolder
);
msi_free
(
dest
);
return
ERROR_SUCCESS
;
}
...
...
@@ -124,18 +124,18 @@ WCHAR *load_dynamic_stringW(MSIRECORD *row, INT index)
/* having an empty string is different than NULL */
if
(
sz
==
0
)
{
ret
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
WCHAR
));
ret
=
msi_alloc
(
sizeof
(
WCHAR
));
ret
[
0
]
=
0
;
return
ret
;
}
sz
++
;
ret
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sz
*
sizeof
(
WCHAR
));
ret
=
msi_alloc
(
sz
*
sizeof
(
WCHAR
));
rc
=
MSI_RecordGetStringW
(
row
,
index
,
ret
,
&
sz
);
if
(
rc
!=
ERROR_SUCCESS
)
{
ERR
(
"Unable to load dynamic string
\n
"
);
HeapFree
(
GetProcessHeap
(),
0
,
ret
);
msi_free
(
ret
);
ret
=
NULL
;
}
return
ret
;
...
...
@@ -152,11 +152,11 @@ LPWSTR msi_dup_property(MSIPACKAGE *package, LPCWSTR prop)
return
NULL
;
sz
++
;
str
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sz
*
sizeof
(
WCHAR
));
str
=
msi_alloc
(
sz
*
sizeof
(
WCHAR
));
r
=
MSI_GetPropertyW
(
package
,
prop
,
str
,
&
sz
);
if
(
r
!=
ERROR_SUCCESS
)
{
HeapFree
(
GetProcessHeap
(),
0
,
str
);
msi_free
(
str
);
str
=
NULL
;
}
return
str
;
...
...
@@ -215,7 +215,7 @@ int track_tempfile( MSIPACKAGE *package, LPCWSTR name, LPCWSTR path )
}
}
temp
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
MSITEMPFILE
)
);
temp
=
msi_alloc_zero
(
sizeof
(
MSITEMPFILE
)
);
if
(
!
temp
)
return
-
1
;
...
...
@@ -271,7 +271,7 @@ LPWSTR resolve_folder(MSIPACKAGE *package, LPCWSTR name, BOOL source,
path
=
build_directory_name
(
2
,
check_path
,
NULL
);
if
(
strcmpiW
(
path
,
check_path
)
!=
0
)
MSI_SetPropertyW
(
package
,
cszTargetDir
,
path
);
HeapFree
(
GetProcessHeap
(),
0
,
check_path
);
msi_free
(
check_path
);
}
else
{
...
...
@@ -347,7 +347,7 @@ LPWSTR resolve_folder(MSIPACKAGE *package, LPCWSTR name, BOOL source,
TRACE
(
" (source)resolved into %s
\n
"
,
debugstr_w
(
path
));
f
->
ResolvedSource
=
strdupW
(
path
);
}
HeapFree
(
GetProcessHeap
(),
0
,
p
);
msi_free
(
p
);
}
return
path
;
}
...
...
@@ -365,7 +365,7 @@ DWORD deformat_string(MSIPACKAGE *package, LPCWSTR ptr, WCHAR** data )
if
(
size
>=
0
)
{
size
++
;
*
data
=
HeapAlloc
(
GetProcessHeap
(),
0
,
size
*
sizeof
(
WCHAR
));
*
data
=
msi_alloc
(
size
*
sizeof
(
WCHAR
));
if
(
size
>
1
)
MSI_FormatRecordW
(
package
,
rec
,
*
data
,
&
size
);
else
...
...
@@ -394,11 +394,10 @@ UINT schedule_action(MSIPACKAGE *package, UINT script, LPCWSTR action)
count
=
package
->
script
->
ActionCount
[
script
];
package
->
script
->
ActionCount
[
script
]
++
;
if
(
count
!=
0
)
newbuf
=
HeapReAlloc
(
GetProcessHeap
(),
0
,
package
->
script
->
Actions
[
script
],
newbuf
=
msi_realloc
(
package
->
script
->
Actions
[
script
],
package
->
script
->
ActionCount
[
script
]
*
sizeof
(
LPWSTR
));
else
newbuf
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
LPWSTR
));
newbuf
=
msi_alloc
(
sizeof
(
LPWSTR
));
newbuf
[
count
]
=
strdupW
(
action
);
package
->
script
->
Actions
[
script
]
=
newbuf
;
...
...
@@ -417,9 +416,9 @@ static void remove_tracked_tempfiles(MSIPACKAGE* package)
list_remove
(
&
temp
->
entry
);
TRACE
(
"deleting temp file %s
\n
"
,
debugstr_w
(
temp
->
Path
));
DeleteFileW
(
temp
->
Path
);
HeapFree
(
GetProcessHeap
(),
0
,
temp
->
File
);
HeapFree
(
GetProcessHeap
(),
0
,
temp
->
Path
);
HeapFree
(
GetProcessHeap
(),
0
,
temp
);
msi_free
(
temp
->
File
);
msi_free
(
temp
->
Path
);
msi_free
(
temp
);
}
}
...
...
@@ -431,14 +430,14 @@ static void free_feature( MSIFEATURE *feature )
{
ComponentList
*
cl
=
LIST_ENTRY
(
item
,
ComponentList
,
entry
);
list_remove
(
&
cl
->
entry
);
HeapFree
(
GetProcessHeap
(),
0
,
cl
);
}
HeapFree
(
GetProcessHeap
(),
0
,
feature
->
Feature
);
HeapFree
(
GetProcessHeap
(),
0
,
feature
->
Feature_Parent
);
HeapFree
(
GetProcessHeap
(),
0
,
feature
->
Directory
);
HeapFree
(
GetProcessHeap
(),
0
,
feature
->
Description
);
HeapFree
(
GetProcessHeap
(),
0
,
feature
->
Title
);
HeapFree
(
GetProcessHeap
(),
0
,
feature
);
msi_free
(
cl
);
}
msi_free
(
feature
->
Feature
);
msi_free
(
feature
->
Feature_Parent
);
msi_free
(
feature
->
Directory
);
msi_free
(
feature
->
Description
);
msi_free
(
feature
->
Title
);
msi_free
(
feature
);
}
void
free_extension
(
MSIEXTENSION
*
ext
)
...
...
@@ -450,15 +449,15 @@ void free_extension( MSIEXTENSION *ext )
MSIVERB
*
verb
=
LIST_ENTRY
(
item
,
MSIVERB
,
entry
);
list_remove
(
&
verb
->
entry
);
HeapFree
(
GetProcessHeap
(),
0
,
verb
->
Verb
);
HeapFree
(
GetProcessHeap
(),
0
,
verb
->
Command
);
HeapFree
(
GetProcessHeap
(),
0
,
verb
->
Argument
);
HeapFree
(
GetProcessHeap
(),
0
,
verb
);
msi_free
(
verb
->
Verb
);
msi_free
(
verb
->
Command
);
msi_free
(
verb
->
Argument
);
msi_free
(
verb
);
}
HeapFree
(
GetProcessHeap
(),
0
,
ext
->
Extension
);
HeapFree
(
GetProcessHeap
(),
0
,
ext
->
ProgIDText
);
HeapFree
(
GetProcessHeap
(),
0
,
ext
);
msi_free
(
ext
->
Extension
);
msi_free
(
ext
->
ProgIDText
);
msi_free
(
ext
);
}
/* Called when the package is being closed */
...
...
@@ -483,12 +482,12 @@ void ACTION_free_package_structures( MSIPACKAGE* package)
MSIFOLDER
*
folder
=
LIST_ENTRY
(
item
,
MSIFOLDER
,
entry
);
list_remove
(
&
folder
->
entry
);
HeapFree
(
GetProcessHeap
(),
0
,
folder
->
Directory
);
HeapFree
(
GetProcessHeap
(),
0
,
folder
->
TargetDefault
);
HeapFree
(
GetProcessHeap
(),
0
,
folder
->
SourceDefault
);
HeapFree
(
GetProcessHeap
(),
0
,
folder
->
ResolvedTarget
);
HeapFree
(
GetProcessHeap
(),
0
,
folder
->
ResolvedSource
);
HeapFree
(
GetProcessHeap
(),
0
,
folder
->
Property
);
msi_free
(
folder
->
Directory
);
msi_free
(
folder
->
TargetDefault
);
msi_free
(
folder
->
SourceDefault
);
msi_free
(
folder
->
ResolvedTarget
);
msi_free
(
folder
->
ResolvedSource
);
msi_free
(
folder
->
Property
);
}
LIST_FOR_EACH_SAFE
(
item
,
cursor
,
&
package
->
components
)
...
...
@@ -496,13 +495,13 @@ void ACTION_free_package_structures( MSIPACKAGE* package)
MSICOMPONENT
*
comp
=
LIST_ENTRY
(
item
,
MSICOMPONENT
,
entry
);
list_remove
(
&
comp
->
entry
);
HeapFree
(
GetProcessHeap
(),
0
,
comp
->
Component
);
HeapFree
(
GetProcessHeap
(),
0
,
comp
->
ComponentId
);
HeapFree
(
GetProcessHeap
(),
0
,
comp
->
Directory
);
HeapFree
(
GetProcessHeap
(),
0
,
comp
->
Condition
);
HeapFree
(
GetProcessHeap
(),
0
,
comp
->
KeyPath
);
HeapFree
(
GetProcessHeap
(),
0
,
comp
->
FullKeypath
);
HeapFree
(
GetProcessHeap
(),
0
,
comp
);
msi_free
(
comp
->
Component
);
msi_free
(
comp
->
ComponentId
);
msi_free
(
comp
->
Directory
);
msi_free
(
comp
->
Condition
);
msi_free
(
comp
->
KeyPath
);
msi_free
(
comp
->
FullKeypath
);
msi_free
(
comp
);
}
LIST_FOR_EACH_SAFE
(
item
,
cursor
,
&
package
->
files
)
...
...
@@ -510,14 +509,14 @@ void ACTION_free_package_structures( MSIPACKAGE* package)
MSIFILE
*
file
=
LIST_ENTRY
(
item
,
MSIFILE
,
entry
);
list_remove
(
&
file
->
entry
);
HeapFree
(
GetProcessHeap
(),
0
,
file
->
File
);
HeapFree
(
GetProcessHeap
(),
0
,
file
->
FileName
);
HeapFree
(
GetProcessHeap
(),
0
,
file
->
ShortName
);
HeapFree
(
GetProcessHeap
(),
0
,
file
->
Version
);
HeapFree
(
GetProcessHeap
(),
0
,
file
->
Language
);
HeapFree
(
GetProcessHeap
(),
0
,
file
->
SourcePath
);
HeapFree
(
GetProcessHeap
(),
0
,
file
->
TargetPath
);
HeapFree
(
GetProcessHeap
(),
0
,
file
);
msi_free
(
file
->
File
);
msi_free
(
file
->
FileName
);
msi_free
(
file
->
ShortName
);
msi_free
(
file
->
Version
);
msi_free
(
file
->
Language
);
msi_free
(
file
->
SourcePath
);
msi_free
(
file
->
TargetPath
);
msi_free
(
file
);
}
/* clean up extension, progid, class and verb structures */
...
...
@@ -526,16 +525,16 @@ void ACTION_free_package_structures( MSIPACKAGE* package)
MSICLASS
*
cls
=
LIST_ENTRY
(
item
,
MSICLASS
,
entry
);
list_remove
(
&
cls
->
entry
);
HeapFree
(
GetProcessHeap
(),
0
,
cls
->
clsid
);
HeapFree
(
GetProcessHeap
(),
0
,
cls
->
Context
);
HeapFree
(
GetProcessHeap
(),
0
,
cls
->
Description
);
HeapFree
(
GetProcessHeap
(),
0
,
cls
->
FileTypeMask
);
HeapFree
(
GetProcessHeap
(),
0
,
cls
->
IconPath
);
HeapFree
(
GetProcessHeap
(),
0
,
cls
->
DefInprocHandler
);
HeapFree
(
GetProcessHeap
(),
0
,
cls
->
DefInprocHandler32
);
HeapFree
(
GetProcessHeap
(),
0
,
cls
->
Argument
);
HeapFree
(
GetProcessHeap
(),
0
,
cls
->
ProgIDText
);
HeapFree
(
GetProcessHeap
(),
0
,
cls
);
msi_free
(
cls
->
clsid
);
msi_free
(
cls
->
Context
);
msi_free
(
cls
->
Description
);
msi_free
(
cls
->
FileTypeMask
);
msi_free
(
cls
->
IconPath
);
msi_free
(
cls
->
DefInprocHandler
);
msi_free
(
cls
->
DefInprocHandler32
);
msi_free
(
cls
->
Argument
);
msi_free
(
cls
->
ProgIDText
);
msi_free
(
cls
);
}
LIST_FOR_EACH_SAFE
(
item
,
cursor
,
&
package
->
extensions
)
...
...
@@ -551,10 +550,10 @@ void ACTION_free_package_structures( MSIPACKAGE* package)
MSIPROGID
*
progid
=
LIST_ENTRY
(
item
,
MSIPROGID
,
entry
);
list_remove
(
&
progid
->
entry
);
HeapFree
(
GetProcessHeap
(),
0
,
progid
->
ProgID
);
HeapFree
(
GetProcessHeap
(),
0
,
progid
->
Description
);
HeapFree
(
GetProcessHeap
(),
0
,
progid
->
IconPath
);
HeapFree
(
GetProcessHeap
(),
0
,
progid
);
msi_free
(
progid
->
ProgID
);
msi_free
(
progid
->
Description
);
msi_free
(
progid
->
IconPath
);
msi_free
(
progid
);
}
LIST_FOR_EACH_SAFE
(
item
,
cursor
,
&
package
->
mimes
)
...
...
@@ -562,9 +561,9 @@ void ACTION_free_package_structures( MSIPACKAGE* package)
MSIMIME
*
mt
=
LIST_ENTRY
(
item
,
MSIMIME
,
entry
);
list_remove
(
&
mt
->
entry
);
HeapFree
(
GetProcessHeap
(),
0
,
mt
->
clsid
);
HeapFree
(
GetProcessHeap
(),
0
,
mt
->
ContentType
);
HeapFree
(
GetProcessHeap
(),
0
,
mt
);
msi_free
(
mt
->
clsid
);
msi_free
(
mt
->
ContentType
);
msi_free
(
mt
);
}
LIST_FOR_EACH_SAFE
(
item
,
cursor
,
&
package
->
appids
)
...
...
@@ -572,12 +571,12 @@ void ACTION_free_package_structures( MSIPACKAGE* package)
MSIAPPID
*
appid
=
LIST_ENTRY
(
item
,
MSIAPPID
,
entry
);
list_remove
(
&
appid
->
entry
);
HeapFree
(
GetProcessHeap
(),
0
,
appid
->
AppID
);
HeapFree
(
GetProcessHeap
(),
0
,
appid
->
RemoteServerName
);
HeapFree
(
GetProcessHeap
(),
0
,
appid
->
LocalServer
);
HeapFree
(
GetProcessHeap
(),
0
,
appid
->
ServiceParameters
);
HeapFree
(
GetProcessHeap
(),
0
,
appid
->
DllSurrogate
);
HeapFree
(
GetProcessHeap
(),
0
,
appid
);
msi_free
(
appid
->
AppID
);
msi_free
(
appid
->
RemoteServerName
);
msi_free
(
appid
->
LocalServer
);
msi_free
(
appid
->
ServiceParameters
);
msi_free
(
appid
->
DllSurrogate
);
msi_free
(
appid
);
}
if
(
package
->
script
)
...
...
@@ -586,21 +585,21 @@ void ACTION_free_package_structures( MSIPACKAGE* package)
{
int
j
;
for
(
j
=
0
;
j
<
package
->
script
->
ActionCount
[
i
];
j
++
)
HeapFree
(
GetProcessHeap
(),
0
,
package
->
script
->
Actions
[
i
][
j
]);
msi_free
(
package
->
script
->
Actions
[
i
][
j
]);
HeapFree
(
GetProcessHeap
(),
0
,
package
->
script
->
Actions
[
i
]);
msi_free
(
package
->
script
->
Actions
[
i
]);
}
for
(
i
=
0
;
i
<
package
->
script
->
UniqueActionsCount
;
i
++
)
HeapFree
(
GetProcessHeap
(),
0
,
package
->
script
->
UniqueActions
[
i
]);
msi_free
(
package
->
script
->
UniqueActions
[
i
]);
HeapFree
(
GetProcessHeap
(),
0
,
package
->
script
->
UniqueActions
);
HeapFree
(
GetProcessHeap
(),
0
,
package
->
script
);
msi_free
(
package
->
script
->
UniqueActions
);
msi_free
(
package
->
script
);
}
HeapFree
(
GetProcessHeap
(),
0
,
package
->
PackagePath
);
HeapFree
(
GetProcessHeap
(),
0
,
package
->
msiFilePath
);
HeapFree
(
GetProcessHeap
(),
0
,
package
->
ProductCode
);
msi_free
(
package
->
PackagePath
);
msi_free
(
package
->
msiFilePath
);
msi_free
(
package
->
ProductCode
);
/* cleanup control event subscriptions */
ControlEvent_CleanupSubscriptions
(
package
);
...
...
@@ -641,7 +640,7 @@ LPWSTR build_directory_name(DWORD count, ...)
}
va_end
(
va
);
dir
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sz
*
sizeof
(
WCHAR
));
dir
=
msi_alloc
(
sz
*
sizeof
(
WCHAR
));
dir
[
0
]
=
0
;
va_start
(
va
,
count
);
...
...
@@ -670,8 +669,7 @@ BOOL create_full_pathW(const WCHAR *path)
int
len
;
WCHAR
*
new_path
;
new_path
=
HeapAlloc
(
GetProcessHeap
(),
0
,
(
strlenW
(
path
)
+
1
)
*
sizeof
(
WCHAR
));
new_path
=
msi_alloc
(
(
strlenW
(
path
)
+
1
)
*
sizeof
(
WCHAR
));
strcpyW
(
new_path
,
path
);
...
...
@@ -707,7 +705,7 @@ BOOL create_full_pathW(const WCHAR *path)
new_path
[
len
]
=
'\\'
;
}
HeapFree
(
GetProcessHeap
(),
0
,
new_path
);
msi_free
(
new_path
);
return
ret
;
}
...
...
@@ -752,10 +750,10 @@ void ui_actiondata(MSIPACKAGE *package, LPCWSTR action, MSIRECORD * record)
}
/* update the cached actionformat */
HeapFree
(
GetProcessHeap
(),
0
,
package
->
ActionFormat
);
msi_free
(
package
->
ActionFormat
);
package
->
ActionFormat
=
load_dynamic_stringW
(
row
,
3
);
HeapFree
(
GetProcessHeap
(),
0
,
package
->
LastAction
);
msi_free
(
package
->
LastAction
);
package
->
LastAction
=
strdupW
(
action
);
msiobj_release
(
&
row
->
hdr
);
...
...
@@ -857,7 +855,7 @@ LPWSTR create_component_advertise_string(MSIPACKAGE* package,
sz
+=
3
;
sz
*=
sizeof
(
WCHAR
);
output
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sz
);
output
=
msi_alloc
(
sz
);
memset
(
output
,
0
,
sz
);
if
(
component
)
...
...
@@ -945,11 +943,10 @@ UINT register_unique_action(MSIPACKAGE *package, LPCWSTR action)
count
=
package
->
script
->
UniqueActionsCount
;
package
->
script
->
UniqueActionsCount
++
;
if
(
count
!=
0
)
newbuf
=
HeapReAlloc
(
GetProcessHeap
(),
0
,
package
->
script
->
UniqueActions
,
newbuf
=
msi_realloc
(
package
->
script
->
UniqueActions
,
package
->
script
->
UniqueActionsCount
*
sizeof
(
LPWSTR
));
else
newbuf
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
LPWSTR
));
newbuf
=
msi_alloc
(
sizeof
(
LPWSTR
));
newbuf
[
count
]
=
strdupW
(
action
);
package
->
script
->
UniqueActions
=
newbuf
;
...
...
@@ -1006,7 +1003,7 @@ WCHAR* generate_error_string(MSIPACKAGE *package, UINT error, DWORD count, ... )
if
(
size
>=
0
)
{
size
++
;
data
=
HeapAlloc
(
GetProcessHeap
(),
0
,
size
*
sizeof
(
WCHAR
));
data
=
msi_alloc
(
size
*
sizeof
(
WCHAR
));
if
(
size
>
1
)
MSI_FormatRecordW
(
package
,
rec
,
data
,
&
size
);
else
...
...
dlls/msi/install.c
View file @
ee034ba4
...
...
@@ -50,7 +50,7 @@ UINT WINAPI MsiDoActionA( MSIHANDLE hInstall, LPCSTR szAction )
return
ERROR_FUNCTION_FAILED
;
ret
=
MsiDoActionW
(
hInstall
,
szwAction
);
HeapFree
(
GetProcessHeap
(),
0
,
szwAction
);
msi_free
(
szwAction
);
return
ret
;
}
...
...
@@ -148,7 +148,7 @@ UINT WINAPI MSI_GetTargetPath( MSIHANDLE hInstall, LPCWSTR szFolder,
return
ERROR_DIRECTORY
;
r
=
msi_strcpy_to_awstring
(
path
,
szPathBuf
,
pcchPathBuf
);
HeapFree
(
GetProcessHeap
(),
0
,
path
);
msi_free
(
path
);
return
r
;
}
...
...
@@ -173,7 +173,7 @@ UINT WINAPI MsiGetTargetPathA( MSIHANDLE hInstall, LPCSTR szFolder,
r
=
MSI_GetTargetPath
(
hInstall
,
szwFolder
,
&
path
,
pcchPathBuf
);
HeapFree
(
GetProcessHeap
(),
0
,
szwFolder
);
msi_free
(
szwFolder
);
return
r
;
}
...
...
@@ -227,7 +227,7 @@ static UINT MSI_GetSourcePath( MSIHANDLE hInstall, LPCWSTR szFolder,
return
ERROR_DIRECTORY
;
r
=
msi_strcpy_to_awstring
(
path
,
szPathBuf
,
pcchPathBuf
);
HeapFree
(
GetProcessHeap
(),
0
,
path
);
msi_free
(
path
);
return
r
;
}
...
...
@@ -248,7 +248,7 @@ UINT WINAPI MsiGetSourcePathA( MSIHANDLE hInstall, LPCSTR szFolder,
folder
=
strdupAtoW
(
szFolder
);
r
=
MSI_GetSourcePath
(
hInstall
,
folder
,
&
str
,
pcchPathBuf
);
HeapFree
(
GetProcessHeap
(),
0
,
folder
);
msi_free
(
folder
);
return
r
;
}
...
...
@@ -291,14 +291,14 @@ UINT WINAPI MsiSetTargetPathA(MSIHANDLE hInstall, LPCSTR szFolder,
szwFolderPath
=
strdupAtoW
(
szFolderPath
);
if
(
!
szwFolderPath
)
{
HeapFree
(
GetProcessHeap
(),
0
,
szwFolder
);
msi_free
(
szwFolder
);
return
ERROR_FUNCTION_FAILED
;
}
rc
=
MsiSetTargetPathW
(
hInstall
,
szwFolder
,
szwFolderPath
);
HeapFree
(
GetProcessHeap
(),
0
,
szwFolder
);
HeapFree
(
GetProcessHeap
(),
0
,
szwFolderPath
);
msi_free
(
szwFolder
);
msi_free
(
szwFolderPath
);
return
rc
;
}
...
...
@@ -343,7 +343,7 @@ UINT MSI_SetTargetPathW(MSIPACKAGE *package, LPCWSTR szFolder,
RemoveDirectoryW
(
szFolderPath
);
}
HeapFree
(
GetProcessHeap
(),
0
,
folder
->
Property
);
msi_free
(
folder
->
Property
);
folder
->
Property
=
build_directory_name
(
2
,
szFolderPath
,
NULL
);
if
(
lstrcmpiW
(
path
,
folder
->
Property
)
==
0
)
...
...
@@ -352,10 +352,10 @@ UINT MSI_SetTargetPathW(MSIPACKAGE *package, LPCWSTR szFolder,
* Resolved Target has not really changed, so just
* set this folder and do not recalculate everything.
*/
HeapFree
(
GetProcessHeap
(),
0
,
folder
->
ResolvedTarget
);
msi_free
(
folder
->
ResolvedTarget
);
folder
->
ResolvedTarget
=
NULL
;
path2
=
resolve_folder
(
package
,
szFolder
,
FALSE
,
TRUE
,
NULL
);
HeapFree
(
GetProcessHeap
(),
0
,
path2
);
msi_free
(
path2
);
}
else
{
...
...
@@ -363,17 +363,17 @@ UINT MSI_SetTargetPathW(MSIPACKAGE *package, LPCWSTR szFolder,
LIST_FOR_EACH_ENTRY
(
f
,
&
package
->
folders
,
MSIFOLDER
,
entry
)
{
HeapFree
(
GetProcessHeap
(),
0
,
f
->
ResolvedTarget
);
msi_free
(
f
->
ResolvedTarget
);
f
->
ResolvedTarget
=
NULL
;
}
LIST_FOR_EACH_ENTRY
(
f
,
&
package
->
folders
,
MSIFOLDER
,
entry
)
{
path2
=
resolve_folder
(
package
,
f
->
Directory
,
FALSE
,
TRUE
,
NULL
);
HeapFree
(
GetProcessHeap
(),
0
,
path2
);
msi_free
(
path2
);
}
}
HeapFree
(
GetProcessHeap
(),
0
,
path
);
msi_free
(
path
);
return
ERROR_SUCCESS
;
}
...
...
@@ -454,7 +454,7 @@ UINT WINAPI MsiSetFeatureStateA(MSIHANDLE hInstall, LPCSTR szFeature,
rc
=
MsiSetFeatureStateW
(
hInstall
,
szwFeature
,
iState
);
HeapFree
(
GetProcessHeap
(),
0
,
szwFeature
);
msi_free
(
szwFeature
);
return
rc
;
}
...
...
@@ -526,7 +526,7 @@ UINT WINAPI MsiGetFeatureStateA(MSIHANDLE hInstall, LPSTR szFeature,
rc
=
MsiGetFeatureStateW
(
hInstall
,
szwFeature
,
piInstalled
,
piAction
);
HeapFree
(
GetProcessHeap
(),
0
,
szwFeature
);
msi_free
(
szwFeature
);
return
rc
;
}
...
...
@@ -582,7 +582,7 @@ UINT WINAPI MsiSetComponentStateA(MSIHANDLE hInstall, LPCSTR szComponent,
rc
=
MsiSetComponentStateW
(
hInstall
,
szwComponent
,
iState
);
HeapFree
(
GetProcessHeap
(),
0
,
szwComponent
);
msi_free
(
szwComponent
);
return
rc
;
}
...
...
@@ -600,7 +600,7 @@ UINT WINAPI MsiGetComponentStateA(MSIHANDLE hInstall, LPSTR szComponent,
rc
=
MsiGetComponentStateW
(
hInstall
,
szwComponent
,
piInstalled
,
piAction
);
HeapFree
(
GetProcessHeap
(),
0
,
szwComponent
);
msi_free
(
szwComponent
);
return
rc
;
}
...
...
@@ -699,7 +699,7 @@ LANGID WINAPI MsiGetLanguage(MSIHANDLE hInstall)
buffer
=
msi_dup_property
(
package
,
szProductLanguage
);
langid
=
atoiW
(
buffer
);
HeapFree
(
GetProcessHeap
(),
0
,
buffer
);
msi_free
(
buffer
);
msiobj_release
(
&
package
->
hdr
);
return
langid
;
}
dlls/msi/msi.c
View file @
ee034ba4
...
...
@@ -76,7 +76,7 @@ UINT WINAPI MsiOpenProductA(LPCSTR szProduct, MSIHANDLE *phProduct)
r
=
MsiOpenProductW
(
szwProd
,
phProduct
);
HeapFree
(
GetProcessHeap
(),
0
,
szwProd
);
msi_free
(
szwProd
);
return
r
;
}
...
...
@@ -108,7 +108,7 @@ UINT WINAPI MsiOpenProductW(LPCWSTR szProduct, MSIHANDLE *phProduct)
}
/* now alloc and fetch the path of the database to open */
path
=
HeapAlloc
(
GetProcessHeap
(),
0
,
count
);
path
=
msi_alloc
(
count
);
if
(
!
path
)
goto
end
;
...
...
@@ -123,7 +123,7 @@ UINT WINAPI MsiOpenProductW(LPCWSTR szProduct, MSIHANDLE *phProduct)
r
=
MsiOpenPackageW
(
path
,
phProduct
);
end:
HeapFree
(
GetProcessHeap
(),
0
,
path
);
msi_free
(
path
);
if
(
hKeyProduct
)
RegCloseKey
(
hKeyProduct
);
...
...
@@ -188,8 +188,8 @@ UINT WINAPI MsiInstallProductA(LPCSTR szPackagePath, LPCSTR szCommandLine)
r
=
MsiInstallProductW
(
szwPath
,
szwCommand
);
end:
HeapFree
(
GetProcessHeap
(),
0
,
szwPath
);
HeapFree
(
GetProcessHeap
(),
0
,
szwCommand
);
msi_free
(
szwPath
);
msi_free
(
szwCommand
);
return
r
;
}
...
...
@@ -322,7 +322,7 @@ UINT WINAPI MsiConfigureProductExW(LPCWSTR szProduct, int iInstallLevel,
if
(
szCommandLine
)
sz
+=
lstrlenW
(
szCommandLine
);
commandline
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sz
*
sizeof
(
WCHAR
));
commandline
=
msi_alloc
(
sz
*
sizeof
(
WCHAR
));
if
(
szCommandLine
)
lstrcpyW
(
commandline
,
szCommandLine
);
...
...
@@ -336,7 +336,7 @@ UINT WINAPI MsiConfigureProductExW(LPCWSTR szProduct, int iInstallLevel,
msiobj_release
(
&
package
->
hdr
);
HeapFree
(
GetProcessHeap
(),
0
,
commandline
);
msi_free
(
commandline
);
end:
if
(
handle
!=
-
1
)
MsiCloseHandle
(
handle
);
...
...
@@ -368,8 +368,8 @@ UINT WINAPI MsiConfigureProductExA(LPCSTR szProduct, int iInstallLevel,
r
=
MsiConfigureProductExW
(
szwProduct
,
iInstallLevel
,
eInstallState
,
szwCommandLine
);
end:
HeapFree
(
GetProcessHeap
(),
0
,
szwProduct
);
HeapFree
(
GetProcessHeap
(),
0
,
szwCommandLine
);
msi_free
(
szwProduct
);
msi_free
(
szwCommandLine
);
return
r
;
}
...
...
@@ -390,7 +390,7 @@ UINT WINAPI MsiConfigureProductA(LPCSTR szProduct, int iInstallLevel,
}
r
=
MsiConfigureProductW
(
szwProduct
,
iInstallLevel
,
eInstallState
);
HeapFree
(
GetProcessHeap
(),
0
,
szwProduct
);
msi_free
(
szwProduct
);
return
r
;
}
...
...
@@ -423,7 +423,7 @@ UINT WINAPI MsiGetProductCodeA(LPCSTR szComponent, LPSTR szBuffer)
if
(
ERROR_SUCCESS
==
r
)
WideCharToMultiByte
(
CP_ACP
,
0
,
szwBuffer
,
-
1
,
szBuffer
,
GUID_SIZE
,
NULL
,
NULL
);
HeapFree
(
GetProcessHeap
(),
0
,
szwComponent
);
msi_free
(
szwComponent
);
return
r
;
}
...
...
@@ -490,7 +490,7 @@ UINT WINAPI MsiGetProductInfoA(LPCSTR szProduct, LPCSTR szAttribute,
if
(
szBuffer
)
{
szwBuffer
=
HeapAlloc
(
GetProcessHeap
(),
0
,
(
*
pcchValueBuf
)
*
sizeof
(
WCHAR
)
);
szwBuffer
=
msi_alloc
(
(
*
pcchValueBuf
)
*
sizeof
(
WCHAR
)
);
pcchwValueBuf
=
*
pcchValueBuf
;
if
(
!
szwBuffer
)
goto
end
;
...
...
@@ -509,9 +509,9 @@ UINT WINAPI MsiGetProductInfoA(LPCSTR szProduct, LPCSTR szAttribute,
}
end:
HeapFree
(
GetProcessHeap
(),
0
,
szwProduct
);
HeapFree
(
GetProcessHeap
(),
0
,
szwAttribute
);
HeapFree
(
GetProcessHeap
(),
0
,
szwBuffer
);
msi_free
(
szwProduct
);
msi_free
(
szwAttribute
);
msi_free
(
szwBuffer
);
return
r
;
}
...
...
@@ -624,7 +624,7 @@ UINT WINAPI MsiEnableLogA(DWORD dwLogMode, LPCSTR szLogFile, DWORD attributes)
return
ERROR_OUTOFMEMORY
;
}
r
=
MsiEnableLogW
(
dwLogMode
,
szwLogFile
,
attributes
);
HeapFree
(
GetProcessHeap
(),
0
,
szwLogFile
);
msi_free
(
szwLogFile
);
return
r
;
}
...
...
@@ -659,7 +659,7 @@ INSTALLSTATE WINAPI MsiQueryProductStateA(LPCSTR szProduct)
return
ERROR_OUTOFMEMORY
;
}
r
=
MsiQueryProductStateW
(
szwProduct
);
HeapFree
(
GetProcessHeap
(),
0
,
szwProduct
);
msi_free
(
szwProduct
);
return
r
;
}
...
...
@@ -821,7 +821,7 @@ LANGID WINAPI MsiLoadStringA( MSIHANDLE handle, UINT id, LPSTR lpBuffer,
LANGID
r
;
DWORD
len
;
bufW
=
HeapAlloc
(
GetProcessHeap
(),
0
,
nBufferMax
*
sizeof
(
WCHAR
));
bufW
=
msi_alloc
(
nBufferMax
*
sizeof
(
WCHAR
));
r
=
MsiLoadStringW
(
handle
,
id
,
bufW
,
nBufferMax
,
lang
);
if
(
r
)
{
...
...
@@ -832,7 +832,7 @@ LANGID WINAPI MsiLoadStringA( MSIHANDLE handle, UINT id, LPSTR lpBuffer,
else
r
=
0
;
}
HeapFree
(
GetProcessHeap
(),
0
,
bufW
);
msi_free
(
bufW
);
return
r
;
}
...
...
@@ -948,7 +948,7 @@ UINT WINAPI MsiVerifyPackageA( LPCSTR szPackage )
r
=
MsiVerifyPackageW
(
szPack
);
HeapFree
(
GetProcessHeap
(),
0
,
szPack
);
msi_free
(
szPack
);
return
r
;
}
...
...
@@ -985,14 +985,14 @@ INSTALLSTATE WINAPI MsiGetComponentPathA(LPCSTR szProduct, LPCSTR szComponent,
szwComponent
=
strdupAtoW
(
szComponent
);
if
(
!
szwComponent
)
{
HeapFree
(
GetProcessHeap
(),
0
,
szwProduct
);
msi_free
(
szwProduct
);
return
ERROR_OUTOFMEMORY
;
}
}
if
(
pcchBuf
&&
*
pcchBuf
>
0
)
{
lpwPathBuf
=
HeapAlloc
(
GetProcessHeap
(),
0
,
*
pcchBuf
*
sizeof
(
WCHAR
));
lpwPathBuf
=
msi_alloc
(
*
pcchBuf
*
sizeof
(
WCHAR
));
incoming_len
=
*
pcchBuf
;
}
else
...
...
@@ -1003,14 +1003,14 @@ INSTALLSTATE WINAPI MsiGetComponentPathA(LPCSTR szProduct, LPCSTR szComponent,
rc
=
MsiGetComponentPathW
(
szwProduct
,
szwComponent
,
lpwPathBuf
,
pcchBuf
);
HeapFree
(
GetProcessHeap
(),
0
,
szwProduct
);
HeapFree
(
GetProcessHeap
(),
0
,
szwComponent
);
msi_free
(
szwProduct
);
msi_free
(
szwComponent
);
if
(
lpwPathBuf
)
{
if
(
rc
!=
INSTALLSTATE_UNKNOWN
)
WideCharToMultiByte
(
CP_ACP
,
0
,
lpwPathBuf
,
incoming_len
,
lpPathBuf
,
incoming_len
,
NULL
,
NULL
);
HeapFree
(
GetProcessHeap
(),
0
,
lpwPathBuf
);
msi_free
(
lpwPathBuf
);
}
return
rc
;
...
...
@@ -1053,7 +1053,7 @@ INSTALLSTATE WINAPI MsiGetComponentPathW(LPCWSTR szProduct, LPCWSTR szComponent,
goto
end
;
sz
+=
sizeof
(
WCHAR
);
path
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sz
);
path
=
msi_alloc
(
sz
);
if
(
!
path
)
goto
end
;
...
...
@@ -1087,7 +1087,7 @@ INSTALLSTATE WINAPI MsiGetComponentPathW(LPCWSTR szProduct, LPCWSTR szComponent,
}
end:
HeapFree
(
GetProcessHeap
(),
0
,
path
);
msi_free
(
path
);
RegCloseKey
(
hkey
);
return
rrc
;
}
...
...
@@ -1113,15 +1113,15 @@ INSTALLSTATE WINAPI MsiQueryFeatureStateA(LPCSTR szProduct, LPCSTR szFeature)
szwFeature
=
strdupAtoW
(
szFeature
);
if
(
!
szwFeature
)
{
HeapFree
(
GetProcessHeap
(),
0
,
szwProduct
);
msi_free
(
szwProduct
);
return
ERROR_OUTOFMEMORY
;
}
}
rc
=
MsiQueryFeatureStateW
(
szwProduct
,
szwFeature
);
HeapFree
(
GetProcessHeap
(),
0
,
szwProduct
);
HeapFree
(
GetProcessHeap
(),
0
,
szwFeature
);
msi_free
(
szwProduct
);
msi_free
(
szwFeature
);
return
rc
;
}
...
...
@@ -1172,14 +1172,14 @@ UINT WINAPI MsiGetFileVersionA(LPCSTR szFilePath, LPSTR lpVersionBuf,
if
(
lpVersionBuf
&&
pcchVersionBuf
&&
*
pcchVersionBuf
)
{
lpwVersionBuff
=
HeapAlloc
(
GetProcessHeap
(),
0
,
*
pcchVersionBuf
*
sizeof
(
WCHAR
));
lpwVersionBuff
=
msi_alloc
(
*
pcchVersionBuf
*
sizeof
(
WCHAR
));
if
(
!
lpwVersionBuff
)
goto
end
;
}
if
(
lpLangBuf
&&
pcchLangBuf
&&
*
pcchLangBuf
)
{
lpwLangBuff
=
HeapAlloc
(
GetProcessHeap
(),
0
,
*
pcchVersionBuf
*
sizeof
(
WCHAR
));
lpwLangBuff
=
msi_alloc
(
*
pcchVersionBuf
*
sizeof
(
WCHAR
));
if
(
!
lpwLangBuff
)
goto
end
;
}
...
...
@@ -1195,9 +1195,9 @@ UINT WINAPI MsiGetFileVersionA(LPCSTR szFilePath, LPSTR lpVersionBuf,
lpLangBuf
,
*
pcchLangBuf
,
NULL
,
NULL
);
end:
HeapFree
(
GetProcessHeap
(),
0
,
szwFilePath
);
HeapFree
(
GetProcessHeap
(),
0
,
lpwVersionBuff
);
HeapFree
(
GetProcessHeap
(),
0
,
lpwLangBuff
);
msi_free
(
szwFilePath
);
msi_free
(
lpwVersionBuff
);
msi_free
(
lpwLangBuff
);
return
ret
;
}
...
...
@@ -1227,7 +1227,7 @@ UINT WINAPI MsiGetFileVersionW(LPCWSTR szFilePath, LPWSTR lpVersionBuf,
if
(
!
dwVerLen
)
return
GetLastError
();
lpVer
=
HeapAlloc
(
GetProcessHeap
(),
0
,
dwVerLen
);
lpVer
=
msi_alloc
(
dwVerLen
);
if
(
!
lpVer
)
{
ret
=
ERROR_OUTOFMEMORY
;
...
...
@@ -1268,7 +1268,7 @@ UINT WINAPI MsiGetFileVersionW(LPCWSTR szFilePath, LPWSTR lpVersionBuf,
}
end:
HeapFree
(
GetProcessHeap
(),
0
,
lpVer
);
msi_free
(
lpVer
);
return
ret
;
}
...
...
@@ -1478,12 +1478,12 @@ UINT WINAPI MsiProvideQualifiedComponentExW(LPCWSTR szComponent,
return
ERROR_INDEX_ABSENT
;
}
info
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sz
);
info
=
msi_alloc
(
sz
);
rc
=
RegQueryValueExW
(
hkey
,
szQualifier
,
NULL
,
NULL
,
(
LPBYTE
)
info
,
&
sz
);
if
(
rc
!=
ERROR_SUCCESS
)
{
RegCloseKey
(
hkey
);
HeapFree
(
GetProcessHeap
(),
0
,
info
);
msi_free
(
info
);
return
ERROR_INDEX_ABSENT
;
}
...
...
@@ -1494,7 +1494,7 @@ UINT WINAPI MsiProvideQualifiedComponentExW(LPCWSTR szComponent,
else
{
RegCloseKey
(
hkey
);
HeapFree
(
GetProcessHeap
(),
0
,
info
);
msi_free
(
info
);
return
ERROR_INDEX_ABSENT
;
}
...
...
@@ -1512,9 +1512,9 @@ UINT WINAPI MsiProvideQualifiedComponentExW(LPCWSTR szComponent,
rc
=
MsiGetComponentPathW
(
szProduct
,
component
,
lpPathBuf
,
pcchPathBuf
);
RegCloseKey
(
hkey
);
HeapFree
(
GetProcessHeap
(),
0
,
info
);
HeapFree
(
GetProcessHeap
(),
0
,
product
);
HeapFree
(
GetProcessHeap
(),
0
,
component
);
msi_free
(
info
);
msi_free
(
product
);
msi_free
(
component
);
if
(
rc
==
INSTALLSTATE_LOCAL
)
return
ERROR_SUCCESS
;
...
...
@@ -1550,19 +1550,19 @@ UINT WINAPI MsiProvideQualifiedComponentA( LPCSTR szComponent,
szwComponent
=
strdupAtoW
(
szComponent
);
szwQualifier
=
strdupAtoW
(
szQualifier
);
lpwPathBuf
=
HeapAlloc
(
GetProcessHeap
(),
0
,
*
pcchPathBuf
*
sizeof
(
WCHAR
));
lpwPathBuf
=
msi_alloc
(
*
pcchPathBuf
*
sizeof
(
WCHAR
));
pcchwPathBuf
=
*
pcchPathBuf
;
rc
=
MsiProvideQualifiedComponentW
(
szwComponent
,
szwQualifier
,
dwInstallMode
,
lpwPathBuf
,
&
pcchwPathBuf
);
HeapFree
(
GetProcessHeap
(),
0
,
szwComponent
);
HeapFree
(
GetProcessHeap
(),
0
,
szwQualifier
);
msi_free
(
szwComponent
);
msi_free
(
szwQualifier
);
*
pcchPathBuf
=
WideCharToMultiByte
(
CP_ACP
,
0
,
lpwPathBuf
,
pcchwPathBuf
,
lpPathBuf
,
*
pcchPathBuf
,
NULL
,
NULL
);
HeapFree
(
GetProcessHeap
(),
0
,
lpwPathBuf
);
msi_free
(
lpwPathBuf
);
return
rc
;
}
...
...
@@ -1828,7 +1828,7 @@ UINT WINAPI MsiReinstallFeatureW( LPCWSTR szProduct, LPCWSTR szFeature,
sz
+=
lstrlenW
(
fmt
);
sz
+=
lstrlenW
(
szFeature
);
commandline
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sz
*
sizeof
(
WCHAR
));
commandline
=
msi_alloc
(
sz
*
sizeof
(
WCHAR
));
sprintfW
(
commandline
,
fmt
,
szFeature
);
lstrcatW
(
commandline
,
szInstalled
);
...
...
@@ -1837,7 +1837,7 @@ UINT WINAPI MsiReinstallFeatureW( LPCWSTR szProduct, LPCWSTR szFeature,
msiobj_release
(
&
package
->
hdr
);
HeapFree
(
GetProcessHeap
(),
0
,
commandline
);
msi_free
(
commandline
);
end:
if
(
handle
!=
-
1
)
MsiCloseHandle
(
handle
);
...
...
@@ -1860,8 +1860,8 @@ UINT WINAPI MsiReinstallFeatureA( LPCSTR szProduct, LPCSTR szFeature,
rc
=
MsiReinstallFeatureW
(
wszProduct
,
wszFeature
,
dwReinstallMode
);
HeapFree
(
GetProcessHeap
(),
0
,
wszProduct
);
HeapFree
(
GetProcessHeap
(),
0
,
wszFeature
);
msi_free
(
wszProduct
);
msi_free
(
wszFeature
);
return
rc
;
}
...
...
dlls/msi/msiquery.c
View file @
ee034ba4
...
...
@@ -49,7 +49,7 @@ static void MSI_CloseView( MSIOBJECTHDR *arg )
LIST_FOR_EACH_SAFE
(
ptr
,
t
,
&
query
->
mem
)
{
HeapFree
(
GetProcessHeap
(),
0
,
ptr
);
msi_free
(
ptr
);
}
}
...
...
@@ -71,7 +71,7 @@ UINT VIEW_find_column( MSIVIEW *table, LPCWSTR name, UINT *n )
if
(
r
!=
ERROR_SUCCESS
)
return
r
;
x
=
lstrcmpW
(
name
,
col_name
);
HeapFree
(
GetProcessHeap
(),
0
,
col_name
);
msi_free
(
col_name
);
if
(
!
x
)
{
*
n
=
i
;
...
...
@@ -101,7 +101,7 @@ UINT WINAPI MsiDatabaseOpenViewA(MSIHANDLE hdb,
r
=
MsiDatabaseOpenViewW
(
hdb
,
szwQuery
,
phView
);
HeapFree
(
GetProcessHeap
(),
0
,
szwQuery
);
msi_free
(
szwQuery
);
return
r
;
}
...
...
@@ -149,18 +149,18 @@ UINT MSI_OpenQuery( MSIDATABASE *db, MSIQUERY **view, LPCWSTR fmt, ... )
for
(;;)
{
va_list
va
;
query
=
HeapAlloc
(
GetProcessHeap
(),
0
,
size
*
sizeof
(
WCHAR
)
);
query
=
msi_alloc
(
size
*
sizeof
(
WCHAR
)
);
va_start
(
va
,
fmt
);
res
=
vsnprintfW
(
query
,
size
,
fmt
,
va
);
va_end
(
va
);
if
(
res
==
-
1
)
size
*=
2
;
else
if
(
res
>=
size
)
size
=
res
+
1
;
else
break
;
HeapFree
(
GetProcessHeap
(),
0
,
query
);
msi_free
(
query
);
}
/* perform the query */
r
=
MSI_DatabaseOpenViewW
(
db
,
query
,
view
);
HeapFree
(
GetProcessHeap
(),
0
,
query
);
msi_free
(
query
);
return
r
;
}
...
...
@@ -213,18 +213,18 @@ MSIRECORD *MSI_QueryGetRecord( MSIDATABASE *db, LPCWSTR fmt, ... )
for
(;;)
{
va_list
va
;
query
=
HeapAlloc
(
GetProcessHeap
(),
0
,
size
*
sizeof
(
WCHAR
)
);
query
=
msi_alloc
(
size
*
sizeof
(
WCHAR
)
);
va_start
(
va
,
fmt
);
res
=
vsnprintfW
(
query
,
size
,
fmt
,
va
);
va_end
(
va
);
if
(
res
==
-
1
)
size
*=
2
;
else
if
(
res
>=
size
)
size
=
res
+
1
;
else
break
;
HeapFree
(
GetProcessHeap
(),
0
,
query
);
msi_free
(
query
);
}
/* perform the query */
r
=
MSI_DatabaseOpenViewW
(
db
,
query
,
&
view
);
HeapFree
(
GetProcessHeap
(),
0
,
query
);
msi_free
(
query
);
if
(
r
==
ERROR_SUCCESS
)
{
...
...
@@ -315,7 +315,7 @@ UINT MSI_ViewFetch(MSIQUERY *query, MSIRECORD **prec)
sval
=
MSI_makestring
(
query
->
db
,
ival
);
MSI_RecordSetStringW
(
rec
,
i
,
sval
);
HeapFree
(
GetProcessHeap
(),
0
,
sval
);
msi_free
(
sval
);
}
else
{
...
...
@@ -492,7 +492,7 @@ UINT WINAPI MsiViewGetColumnInfo(MSIHANDLE hView, MSICOLINFO info, MSIHANDLE *hR
if
(
r
!=
ERROR_SUCCESS
)
continue
;
MSI_RecordSetStringW
(
rec
,
i
+
1
,
name
);
HeapFree
(
GetProcessHeap
(),
0
,
name
);
msi_free
(
name
);
}
*
hRec
=
alloc_msihandle
(
&
rec
->
hdr
);
...
...
@@ -765,7 +765,7 @@ UINT WINAPI MsiDatabaseGetPrimaryKeysA(MSIHANDLE hdb,
return
ERROR_OUTOFMEMORY
;
}
r
=
MsiDatabaseGetPrimaryKeysW
(
hdb
,
szwTable
,
phRec
);
HeapFree
(
GetProcessHeap
(),
0
,
szwTable
);
msi_free
(
szwTable
);
return
r
;
}
...
...
dlls/msi/table.c
View file @
ee034ba4
...
...
@@ -96,7 +96,7 @@ static LPWSTR encode_streamname(BOOL bTable, LPCWSTR in)
if
(
!
bTable
)
count
=
lstrlenW
(
in
)
+
2
;
out
=
HeapAlloc
(
GetProcessHeap
(),
0
,
count
*
sizeof
(
WCHAR
)
);
out
=
msi_alloc
(
count
*
sizeof
(
WCHAR
)
);
p
=
out
;
if
(
bTable
)
...
...
@@ -130,7 +130,7 @@ static LPWSTR encode_streamname(BOOL bTable, LPCWSTR in)
*
p
++
=
ch
;
}
ERR
(
"Failed to encode stream name (%s)
\n
"
,
debugstr_w
(
in
));
HeapFree
(
GetProcessHeap
(),
0
,
out
);
msi_free
(
out
);
return
NULL
;
}
...
...
@@ -218,7 +218,7 @@ static UINT read_stream_data( IStorage *stg, LPCWSTR stname,
r
=
IStorage_OpenStream
(
stg
,
encname
,
NULL
,
STGM_READ
|
STGM_SHARE_EXCLUSIVE
,
0
,
&
stm
);
HeapFree
(
GetProcessHeap
(),
0
,
encname
);
msi_free
(
encname
);
if
(
FAILED
(
r
)
)
{
WARN
(
"open stream failed r = %08lx - empty table?
\n
"
,
r
);
...
...
@@ -239,7 +239,7 @@ static UINT read_stream_data( IStorage *stg, LPCWSTR stname,
}
sz
=
stat
.
cbSize
.
QuadPart
;
data
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sz
);
data
=
msi_alloc
(
sz
);
if
(
!
data
)
{
WARN
(
"couldn't allocate memory r=%08lx!
\n
"
,
r
);
...
...
@@ -250,7 +250,7 @@ static UINT read_stream_data( IStorage *stg, LPCWSTR stname,
r
=
IStream_Read
(
stm
,
data
,
sz
,
&
count
);
if
(
FAILED
(
r
)
||
(
count
!=
sz
)
)
{
HeapFree
(
GetProcessHeap
(),
0
,
data
);
msi_free
(
data
);
WARN
(
"read stream failed r = %08lx!
\n
"
,
r
);
goto
end
;
}
...
...
@@ -276,7 +276,7 @@ UINT db_get_raw_stream( MSIDATABASE *db, LPCWSTR stname, IStream **stm )
r
=
IStorage_OpenStream
(
db
->
storage
,
encname
,
NULL
,
STGM_READ
|
STGM_SHARE_EXCLUSIVE
,
0
,
stm
);
HeapFree
(
GetProcessHeap
(),
0
,
encname
);
msi_free
(
encname
);
if
(
FAILED
(
r
)
)
{
WARN
(
"open stream failed r = %08lx - empty table?
\n
"
,
r
);
...
...
@@ -313,7 +313,7 @@ UINT read_raw_stream_data( MSIDATABASE *db, LPCWSTR stname,
}
sz
=
stat
.
cbSize
.
QuadPart
;
data
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sz
);
data
=
msi_alloc
(
sz
);
if
(
!
data
)
{
WARN
(
"couldn't allocate memory r=%08lx!
\n
"
,
r
);
...
...
@@ -324,7 +324,7 @@ UINT read_raw_stream_data( MSIDATABASE *db, LPCWSTR stname,
r
=
IStream_Read
(
stm
,
data
,
sz
,
&
count
);
if
(
FAILED
(
r
)
||
(
count
!=
sz
)
)
{
HeapFree
(
GetProcessHeap
(),
0
,
data
);
msi_free
(
data
);
WARN
(
"read stream failed r = %08lx!
\n
"
,
r
);
goto
end
;
}
...
...
@@ -358,7 +358,7 @@ static UINT write_stream_data( IStorage *stg, LPCWSTR stname,
r
=
IStorage_CreateStream
(
stg
,
encname
,
STGM_WRITE
|
STGM_SHARE_EXCLUSIVE
,
0
,
0
,
&
stm
);
}
HeapFree
(
GetProcessHeap
(),
0
,
encname
);
msi_free
(
encname
);
if
(
FAILED
(
r
)
)
{
WARN
(
"open stream failed r = %08lx
\n
"
,
r
);
...
...
@@ -400,9 +400,9 @@ static void free_table( MSITABLE *table )
{
int
i
;
for
(
i
=
0
;
i
<
table
->
row_count
;
i
++
)
HeapFree
(
GetProcessHeap
(),
0
,
table
->
data
[
i
]
);
HeapFree
(
GetProcessHeap
(),
0
,
table
->
data
);
HeapFree
(
GetProcessHeap
(),
0
,
table
);
msi_free
(
table
->
data
[
i
]
);
msi_free
(
table
->
data
);
msi_free
(
table
);
}
static
UINT
read_table_from_storage
(
MSIDATABASE
*
db
,
LPCWSTR
name
,
MSITABLE
**
ptable
)
...
...
@@ -415,15 +415,14 @@ static UINT read_table_from_storage( MSIDATABASE *db, LPCWSTR name, MSITABLE **p
TRACE
(
"%s
\n
"
,
debugstr_w
(
name
));
/* nonexistent tables should be interpreted as empty tables */
t
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
MSITABLE
)
+
lstrlenW
(
name
)
*
sizeof
(
WCHAR
)
);
t
=
msi_alloc
(
sizeof
(
MSITABLE
)
+
lstrlenW
(
name
)
*
sizeof
(
WCHAR
)
);
if
(
!
t
)
return
ERROR_NOT_ENOUGH_MEMORY
;
r
=
table_get_column_info
(
db
,
name
,
&
cols
,
&
num_cols
);
if
(
r
!=
ERROR_SUCCESS
)
{
HeapFree
(
GetProcessHeap
(),
0
,
t
);
msi_free
(
t
);
return
r
;
}
last_col
=
&
cols
[
num_cols
-
1
];
...
...
@@ -449,8 +448,7 @@ static UINT read_table_from_storage( MSIDATABASE *db, LPCWSTR name, MSITABLE **p
}
t
->
row_count
=
rawsize
/
row_size
;
t
->
data
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
t
->
row_count
*
sizeof
(
USHORT
*
)
);
t
->
data
=
msi_alloc_zero
(
t
->
row_count
*
sizeof
(
USHORT
*
)
);
if
(
!
t
->
data
)
{
r
=
ERROR_NOT_ENOUGH_MEMORY
;
...
...
@@ -461,7 +459,7 @@ static UINT read_table_from_storage( MSIDATABASE *db, LPCWSTR name, MSITABLE **p
TRACE
(
"Transposing data from %d columns
\n
"
,
t
->
row_count
);
for
(
i
=
0
;
i
<
t
->
row_count
;
i
++
)
{
t
->
data
[
i
]
=
HeapAlloc
(
GetProcessHeap
(),
0
,
row_size
);
t
->
data
[
i
]
=
msi_alloc
(
row_size
);
if
(
!
t
->
data
[
i
]
)
{
r
=
ERROR_NOT_ENOUGH_MEMORY
;
...
...
@@ -489,14 +487,14 @@ static UINT read_table_from_storage( MSIDATABASE *db, LPCWSTR name, MSITABLE **p
}
}
HeapFree
(
GetProcessHeap
(),
0
,
cols
);
HeapFree
(
GetProcessHeap
(),
0
,
rawdata
);
msi_free
(
cols
);
msi_free
(
rawdata
);
return
ERROR_SUCCESS
;
err:
HeapFree
(
GetProcessHeap
(),
0
,
cols
);
HeapFree
(
GetProcessHeap
(),
0
,
rawdata
);
msi_free
(
cols
);
msi_free
(
rawdata
);
free_table
(
t
);
return
r
;
}
...
...
@@ -536,8 +534,8 @@ void free_cached_tables( MSIDATABASE *db )
if
(
--
t
->
ref_count
)
ERR
(
"table ref count not zero for %s
\n
"
,
debugstr_w
(
t
->
name
));
remove_table
(
db
,
t
);
HeapFree
(
GetProcessHeap
(),
0
,
t
->
data
);
HeapFree
(
GetProcessHeap
(),
0
,
t
);
msi_free
(
t
->
data
);
msi_free
(
t
);
}
}
...
...
@@ -574,14 +572,14 @@ static UINT table_get_column_info( MSIDATABASE *db, LPCWSTR name, MSICOLUMNINFO
TRACE
(
"Table %s found
\n
"
,
debugstr_w
(
name
)
);
columns
=
HeapAlloc
(
GetProcessHeap
(),
0
,
column_count
*
sizeof
(
MSICOLUMNINFO
));
columns
=
msi_alloc
(
column_count
*
sizeof
(
MSICOLUMNINFO
));
if
(
!
columns
)
return
ERROR_FUNCTION_FAILED
;
r
=
get_tablecolumns
(
db
,
name
,
columns
,
&
column_count
);
if
(
r
!=
ERROR_SUCCESS
)
{
HeapFree
(
GetProcessHeap
(),
0
,
columns
);
msi_free
(
columns
);
return
ERROR_FUNCTION_FAILED
;
}
...
...
@@ -632,7 +630,7 @@ static UINT save_table( MSIDATABASE *db, MSITABLE *t )
row_size
=
last_col
->
offset
+
bytes_per_column
(
last_col
);
rawsize
=
t
->
row_count
*
row_size
;
rawdata
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
rawsize
);
rawdata
=
msi_alloc_zero
(
rawsize
);
if
(
!
rawdata
)
return
ERROR_NOT_ENOUGH_MEMORY
;
...
...
@@ -652,7 +650,7 @@ static UINT save_table( MSIDATABASE *db, MSITABLE *t )
TRACE
(
"writing %d bytes
\n
"
,
rawsize
);
r
=
write_stream_data
(
db
->
storage
,
t
->
name
,
rawdata
,
rawsize
);
HeapFree
(
GetProcessHeap
(),
0
,
rawdata
);
msi_free
(
rawdata
);
return
r
;
}
...
...
@@ -674,7 +672,7 @@ HRESULT init_string_table( IStorage *stg )
/* create the StringPool stream... add the zero string to it*/
r
=
IStorage_CreateStream
(
stg
,
encname
,
STGM_WRITE
|
STGM_SHARE_EXCLUSIVE
,
0
,
0
,
&
stm
);
HeapFree
(
GetProcessHeap
(),
0
,
encname
);
msi_free
(
encname
);
if
(
r
)
{
TRACE
(
"Failed
\n
"
);
...
...
@@ -694,7 +692,7 @@ HRESULT init_string_table( IStorage *stg )
encname
=
encode_streamname
(
TRUE
,
szStringData
);
r
=
IStorage_CreateStream
(
stg
,
encname
,
STGM_WRITE
|
STGM_SHARE_EXCLUSIVE
,
0
,
0
,
&
stm
);
HeapFree
(
GetProcessHeap
(),
0
,
encname
);
msi_free
(
encname
);
if
(
r
)
{
TRACE
(
"Failed
\n
"
);
...
...
@@ -769,8 +767,8 @@ string_table *load_string_table( IStorage *stg )
TRACE
(
"Loaded %ld strings
\n
"
,
count
);
end:
HeapFree
(
GetProcessHeap
(),
0
,
pool
);
HeapFree
(
GetProcessHeap
(),
0
,
data
);
msi_free
(
pool
);
msi_free
(
data
);
return
st
;
}
...
...
@@ -792,13 +790,13 @@ static UINT save_string_table( MSIDATABASE *db )
datasize
=
msi_string_totalsize
(
db
->
strings
,
&
count
);
poolsize
=
count
*
2
*
sizeof
(
USHORT
);
pool
=
HeapAlloc
(
GetProcessHeap
(),
0
,
poolsize
);
pool
=
msi_alloc
(
poolsize
);
if
(
!
pool
)
{
WARN
(
"Failed to alloc pool %d bytes
\n
"
,
poolsize
);
goto
err
;
}
data
=
HeapAlloc
(
GetProcessHeap
(),
0
,
datasize
);
data
=
msi_alloc
(
datasize
);
if
(
!
data
)
{
WARN
(
"Failed to alloc data %d bytes
\n
"
,
poolsize
);
...
...
@@ -850,8 +848,8 @@ static UINT save_string_table( MSIDATABASE *db )
ret
=
ERROR_SUCCESS
;
err:
HeapFree
(
GetProcessHeap
(),
0
,
data
);
HeapFree
(
GetProcessHeap
(),
0
,
pool
);
msi_free
(
data
);
msi_free
(
pool
);
return
ret
;
}
...
...
@@ -920,13 +918,13 @@ LPWSTR MSI_makestring( MSIDATABASE *db, UINT stringid)
r
=
msi_id2stringW
(
db
->
strings
,
stringid
,
NULL
,
&
sz
);
if
(
r
!=
ERROR_SUCCESS
)
return
NULL
;
str
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sz
*
sizeof
(
WCHAR
));
str
=
msi_alloc
(
sz
*
sizeof
(
WCHAR
));
if
(
!
str
)
return
str
;
r
=
msi_id2stringW
(
db
->
strings
,
stringid
,
str
,
&
sz
);
if
(
r
==
ERROR_SUCCESS
)
return
str
;
HeapFree
(
GetProcessHeap
(),
0
,
str
);
msi_free
(
str
);
return
NULL
;
}
...
...
@@ -1140,7 +1138,7 @@ static UINT TABLE_fetch_stream( struct tagMSIVIEW *view, UINT row, UINT col, ISt
return
ERROR_INVALID_PARAMETER
;
len
=
lstrlenW
(
tv
->
name
)
+
2
+
lstrlenW
(
sval
);
full_name
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len
*
sizeof
(
WCHAR
)
);
full_name
=
msi_alloc
(
len
*
sizeof
(
WCHAR
)
);
lstrcpyW
(
full_name
,
tv
->
name
);
lstrcatW
(
full_name
,
szDot
);
lstrcatW
(
full_name
,
sval
);
...
...
@@ -1148,8 +1146,8 @@ static UINT TABLE_fetch_stream( struct tagMSIVIEW *view, UINT row, UINT col, ISt
r
=
db_get_raw_stream
(
tv
->
db
,
full_name
,
stm
);
if
(
r
)
ERR
(
"fetching stream %s, error = %d
\n
"
,
debugstr_w
(
full_name
),
r
);
HeapFree
(
GetProcessHeap
(),
0
,
full_name
);
HeapFree
(
GetProcessHeap
(),
0
,
sval
);
msi_free
(
full_name
);
msi_free
(
sval
);
return
r
;
}
...
...
@@ -1202,18 +1200,18 @@ static UINT table_create_new_row( struct tagMSIVIEW *view, UINT *num )
if
(
!
tv
->
table
)
return
ERROR_INVALID_PARAMETER
;
row
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
tv
->
row_size
);
row
=
msi_alloc_zero
(
tv
->
row_size
);
if
(
!
row
)
return
ERROR_NOT_ENOUGH_MEMORY
;
sz
=
(
tv
->
table
->
row_count
+
1
)
*
sizeof
(
UINT
*
);
if
(
tv
->
table
->
data
)
p
=
HeapReAlloc
(
GetProcessHeap
(),
0
,
tv
->
table
->
data
,
sz
);
p
=
msi_realloc
(
tv
->
table
->
data
,
sz
);
else
p
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sz
);
p
=
msi_alloc
(
sz
);
if
(
!
p
)
{
HeapFree
(
GetProcessHeap
(),
0
,
row
);
msi_free
(
row
);
return
ERROR_NOT_ENOUGH_MEMORY
;
}
...
...
@@ -1478,14 +1476,14 @@ static UINT TABLE_delete( struct tagMSIVIEW *view )
UINT
i
;
for
(
i
=
0
;
i
<
tv
->
num_cols
;
i
++
)
{
HeapFree
(
GetProcessHeap
(),
0
,
tv
->
columns
[
i
].
colname
);
HeapFree
(
GetProcessHeap
(),
0
,
tv
->
columns
[
i
].
tablename
);
msi_free
(
tv
->
columns
[
i
].
colname
);
msi_free
(
tv
->
columns
[
i
].
tablename
);
}
HeapFree
(
GetProcessHeap
(),
0
,
tv
->
columns
);
msi_free
(
tv
->
columns
);
}
tv
->
columns
=
NULL
;
HeapFree
(
GetProcessHeap
(),
0
,
tv
);
msi_free
(
tv
);
return
ERROR_SUCCESS
;
}
...
...
@@ -1526,22 +1524,22 @@ UINT TABLE_CreateView( MSIDATABASE *db, LPCWSTR name, MSIVIEW **view )
TRACE
(
"Table found
\n
"
);
sz
=
sizeof
*
tv
+
lstrlenW
(
name
)
*
sizeof
name
[
0
]
;
tv
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sz
);
tv
=
msi_alloc_zero
(
sz
);
if
(
!
tv
)
return
ERROR_FUNCTION_FAILED
;
columns
=
HeapAlloc
(
GetProcessHeap
(),
0
,
column_count
*
sizeof
(
MSICOLUMNINFO
));
columns
=
msi_alloc
(
column_count
*
sizeof
(
MSICOLUMNINFO
));
if
(
!
columns
)
{
HeapFree
(
GetProcessHeap
(),
0
,
tv
);
msi_free
(
tv
);
return
ERROR_FUNCTION_FAILED
;
}
r
=
get_tablecolumns
(
db
,
name
,
columns
,
&
column_count
);
if
(
r
!=
ERROR_SUCCESS
)
{
HeapFree
(
GetProcessHeap
(),
0
,
columns
);
HeapFree
(
GetProcessHeap
(),
0
,
tv
);
msi_free
(
columns
);
msi_free
(
tv
);
return
ERROR_FUNCTION_FAILED
;
}
...
...
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