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
11ddaf06
Commit
11ddaf06
authored
Feb 01, 2022
by
Hans Leidekker
Committed by
Alexandre Julliard
Feb 01, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msi/tests: Use CRT allocation functions.
Signed-off-by:
Hans Leidekker
<
hans@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
0d5f2845
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
79 additions
and
89 deletions
+79
-89
action.c
dlls/msi/tests/action.c
+10
-10
automation.c
dlls/msi/tests/automation.c
+10
-10
db.c
dlls/msi/tests/db.c
+4
-5
format.c
dlls/msi/tests/format.c
+2
-3
install.c
dlls/msi/tests/install.c
+13
-15
msi.c
dlls/msi/tests/msi.c
+13
-16
package.c
dlls/msi/tests/package.c
+18
-21
patch.c
dlls/msi/tests/patch.c
+4
-4
source.c
dlls/msi/tests/source.c
+5
-5
No files found.
dlls/msi/tests/action.c
View file @
11ddaf06
...
...
@@ -2409,10 +2409,10 @@ static char *get_user_sid(void)
OpenProcessToken
(
GetCurrentProcess
(),
TOKEN_QUERY
,
&
token
);
GetTokenInformation
(
token
,
TokenUser
,
NULL
,
size
,
&
size
);
user
=
HeapAlloc
(
GetProcessHeap
(),
0
,
size
);
user
=
malloc
(
size
);
GetTokenInformation
(
token
,
TokenUser
,
user
,
size
,
&
size
);
ConvertSidToStringSidA
(
user
->
User
.
Sid
,
&
usersid
);
HeapFree
(
GetProcessHeap
(),
0
,
user
);
free
(
user
);
CloseHandle
(
token
);
return
usersid
;
...
...
@@ -3022,7 +3022,7 @@ error:
DeleteFileA
(
msifile
);
DeleteFileA
(
"msitest
\\
maximus"
);
RemoveDirectoryA
(
"msitest"
);
HeapFree
(
GetProcessHeap
(),
0
,
usersid
);
free
(
usersid
);
}
static
void
test_publish_product
(
void
)
...
...
@@ -3259,7 +3259,7 @@ error:
DeleteFileA
(
msifile
);
DeleteFileA
(
"msitest
\\
maximus"
);
RemoveDirectoryA
(
"msitest"
);
HeapFree
(
GetProcessHeap
(),
0
,
usersid
);
free
(
usersid
);
}
static
void
test_publish_features
(
void
)
...
...
@@ -3384,7 +3384,7 @@ error:
DeleteFileA
(
msifile
);
DeleteFileA
(
"msitest
\\
maximus"
);
RemoveDirectoryA
(
"msitest"
);
HeapFree
(
GetProcessHeap
(),
0
,
usersid
);
free
(
usersid
);
}
static
LPSTR
reg_get_val_str
(
HKEY
hkey
,
LPCSTR
name
)
...
...
@@ -3398,7 +3398,7 @@ static LPSTR reg_get_val_str(HKEY hkey, LPCSTR name)
return
NULL
;
len
+=
sizeof
(
WCHAR
);
val
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len
);
val
=
malloc
(
len
);
if
(
!
val
)
return
NULL
;
val
[
0
]
=
0
;
RegQueryValueExA
(
hkey
,
name
,
NULL
,
NULL
,
(
LPBYTE
)
val
,
&
len
);
...
...
@@ -3538,8 +3538,8 @@ static void test_register_user(void)
delete_key
(
HKEY_LOCAL_MACHINE
,
keypath
,
access
);
error:
HeapFree
(
GetProcessHeap
(),
0
,
company
);
HeapFree
(
GetProcessHeap
(),
0
,
owner
);
free
(
company
);
free
(
owner
);
DeleteFileA
(
msifile
);
DeleteFileA
(
"msitest
\\
maximus"
);
...
...
@@ -5781,7 +5781,7 @@ static void test_publish_components(void)
res
=
RegQueryValueExA
(
key
,
"english.txt"
,
NULL
,
NULL
,
NULL
,
&
size
);
ok
(
res
==
ERROR_SUCCESS
,
"value not found %d
\n
"
,
res
);
data
=
HeapAlloc
(
GetProcessHeap
(),
0
,
size
);
data
=
malloc
(
size
);
res
=
RegQueryValueExA
(
key
,
"english.txt"
,
NULL
,
NULL
,
data
,
&
size
);
ok
(
res
==
ERROR_SUCCESS
,
"value not found %d
\n
"
,
res
);
RegCloseKey
(
key
);
...
...
@@ -5812,7 +5812,7 @@ static void test_publish_components(void)
res
=
RegSetValueExA
(
key
,
"english.txt"
,
0
,
REG_MULTI_SZ
,
data
,
size
);
ok
(
res
==
ERROR_SUCCESS
,
"RegSetValueEx failed %d
\n
"
,
res
);
HeapFree
(
GetProcessHeap
(),
0
,
data
);
free
(
data
);
RegCloseKey
(
key
);
r
=
MsiInstallProductA
(
msifile
,
"REMOVE=ALL"
);
...
...
dlls/msi/tests/automation.c
View file @
11ddaf06
...
...
@@ -306,7 +306,7 @@ static void create_database(const CHAR *name, const msi_table *tables, int num_t
int
j
,
len
;
len
=
MultiByteToWideChar
(
CP_ACP
,
0
,
name
,
-
1
,
NULL
,
0
);
if
(
!
(
nameW
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len
*
sizeof
(
WCHAR
)
)))
return
;
if
(
!
(
nameW
=
malloc
(
len
*
sizeof
(
WCHAR
)
)))
return
;
MultiByteToWideChar
(
CP_ACP
,
0
,
name
,
-
1
,
nameW
,
len
);
r
=
MsiOpenDatabaseW
(
nameW
,
MSIDBOPEN_CREATE
,
&
db
);
...
...
@@ -331,7 +331,7 @@ static void create_database(const CHAR *name, const msi_table *tables, int num_t
ok
(
r
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %u
\n
"
,
r
);
MsiCloseHandle
(
db
);
HeapFree
(
GetProcessHeap
(),
0
,
nameW
);
free
(
nameW
);
}
static
BOOL
create_package
(
LPWSTR
path
)
...
...
@@ -502,12 +502,12 @@ static DISPID get_dispid( IDispatch *disp, const char *name )
HRESULT
r
;
len
=
MultiByteToWideChar
(
CP_ACP
,
0
,
name
,
-
1
,
NULL
,
0
);
str
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len
*
sizeof
(
WCHAR
)
);
str
=
malloc
(
len
*
sizeof
(
WCHAR
)
);
if
(
str
)
{
MultiByteToWideChar
(
CP_ACP
,
0
,
name
,
-
1
,
str
,
len
);
r
=
IDispatch_GetIDsOfNames
(
disp
,
&
IID_NULL
,
&
str
,
1
,
0
,
&
id
);
HeapFree
(
GetProcessHeap
(),
0
,
str
);
free
(
str
);
if
(
r
!=
S_OK
)
return
-
1
;
}
...
...
@@ -845,11 +845,11 @@ static HRESULT invoke(IDispatch *pDispatch, LPCSTR szName, WORD wFlags, DISPPARA
VariantInit
(
pVarResult
);
len
=
MultiByteToWideChar
(
CP_ACP
,
0
,
szName
,
-
1
,
NULL
,
0
);
name
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len
*
sizeof
(
WCHAR
)
);
name
=
malloc
(
len
*
sizeof
(
WCHAR
)
);
if
(
!
name
)
return
E_FAIL
;
MultiByteToWideChar
(
CP_ACP
,
0
,
szName
,
-
1
,
name
,
len
);
hr
=
IDispatch_GetIDsOfNames
(
pDispatch
,
&
IID_NULL
,
&
name
,
1
,
LOCALE_USER_DEFAULT
,
&
dispid
);
HeapFree
(
GetProcessHeap
(),
0
,
name
);
free
(
name
);
ok
(
hr
==
S_OK
,
"IDispatch::GetIDsOfNames returned 0x%08x
\n
"
,
hr
);
if
(
hr
!=
S_OK
)
return
hr
;
...
...
@@ -2329,13 +2329,13 @@ static UINT delete_registry_key(HKEY hkeyParent, LPCSTR subkey, REGSAM access)
if
(
ret
!=
ERROR_SUCCESS
)
return
ret
;
ret
=
RegQueryInfoKeyA
(
hkey
,
NULL
,
NULL
,
NULL
,
NULL
,
&
dwSize
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
);
if
(
ret
!=
ERROR_SUCCESS
)
return
ret
;
if
(
!
(
string
=
HeapAlloc
(
GetProcessHeap
(),
0
,
++
dwSize
)))
return
ERROR_NOT_ENOUGH_MEMORY
;
if
(
!
(
string
=
malloc
(
++
dwSize
)))
return
ERROR_NOT_ENOUGH_MEMORY
;
while
(
RegEnumKeyA
(
hkey
,
0
,
string
,
dwSize
)
==
ERROR_SUCCESS
)
delete_registry_key
(
hkey
,
string
,
access
);
RegCloseKey
(
hkey
);
HeapFree
(
GetProcessHeap
(),
0
,
string
);
free
(
string
);
delete_key_portable
(
hkeyParent
,
subkey
,
access
);
return
ERROR_SUCCESS
;
}
...
...
@@ -2356,7 +2356,7 @@ static UINT find_registry_key(HKEY hkeyParent, LPCSTR subkey, LPCSTR findkey, RE
if
(
ret
!=
ERROR_SUCCESS
)
return
ret
;
ret
=
RegQueryInfoKeyA
(
hkey
,
NULL
,
NULL
,
NULL
,
NULL
,
&
dwSize
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
);
if
(
ret
!=
ERROR_SUCCESS
)
return
ret
;
if
(
!
(
string
=
HeapAlloc
(
GetProcessHeap
(),
0
,
++
dwSize
)))
return
ERROR_NOT_ENOUGH_MEMORY
;
if
(
!
(
string
=
malloc
(
++
dwSize
)))
return
ERROR_NOT_ENOUGH_MEMORY
;
while
(
!
found
&&
RegEnumKeyA
(
hkey
,
idx
++
,
string
,
dwSize
)
==
ERROR_SUCCESS
)
...
...
@@ -2370,7 +2370,7 @@ static UINT find_registry_key(HKEY hkeyParent, LPCSTR subkey, LPCSTR findkey, RE
}
if
(
*
phkey
!=
hkey
)
RegCloseKey
(
hkey
);
HeapFree
(
GetProcessHeap
(),
0
,
string
);
free
(
string
);
return
(
found
?
ERROR_SUCCESS
:
ERROR_FILE_NOT_FOUND
);
}
...
...
dlls/msi/tests/db.c
View file @
11ddaf06
...
...
@@ -323,10 +323,10 @@ static inline UINT add_entry(const char *file, int line, const char *type, MSIHA
UINT
sz
,
r
;
sz
=
strlen
(
values
)
+
strlen
(
insert
)
+
1
;
query
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sz
);
query
=
malloc
(
sz
);
sprintf
(
query
,
insert
,
values
);
r
=
run_query
(
hdb
,
0
,
query
);
HeapFree
(
GetProcessHeap
(),
0
,
query
);
free
(
query
);
ok_
(
file
,
line
)(
r
==
ERROR_SUCCESS
,
"failed to insert into %s table: %u
\n
"
,
type
,
r
);
return
r
;
}
...
...
@@ -1465,15 +1465,14 @@ static void test_longstrings(void)
ok
(
r
==
ERROR_SUCCESS
,
"query failed
\n
"
);
/* try to insert a very long string */
str
=
HeapAlloc
(
GetProcessHeap
(),
0
,
STRING_LENGTH
+
sizeof
insert_query
);
str
=
malloc
(
STRING_LENGTH
+
sizeof
insert_query
);
len
=
strchr
(
insert_query
,
'Z'
)
-
insert_query
;
strcpy
(
str
,
insert_query
);
memset
(
str
+
len
,
'Z'
,
STRING_LENGTH
);
strcpy
(
str
+
len
+
STRING_LENGTH
,
insert_query
+
len
+
1
);
r
=
try_query
(
hdb
,
str
);
ok
(
r
==
ERROR_SUCCESS
,
"MsiDatabaseOpenView failed
\n
"
);
HeapFree
(
GetProcessHeap
(),
0
,
str
);
free
(
str
);
r
=
MsiDatabaseCommit
(
hdb
);
ok
(
r
==
ERROR_SUCCESS
,
"MsiDatabaseCommit failed
\n
"
);
...
...
dlls/msi/tests/format.c
View file @
11ddaf06
...
...
@@ -61,13 +61,12 @@ static UINT helper_createpackage( const char *szName, MSIHANDLE *handle )
DeleteFileA
(
szName
);
len
=
MultiByteToWideChar
(
CP_ACP
,
0
,
szName
,
-
1
,
NULL
,
0
);
if
(
!
(
nameW
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len
*
sizeof
(
WCHAR
)
)))
return
ERROR_OUTOFMEMORY
;
if
(
!
(
nameW
=
malloc
(
len
*
sizeof
(
WCHAR
)
)))
return
ERROR_OUTOFMEMORY
;
MultiByteToWideChar
(
CP_ACP
,
0
,
szName
,
-
1
,
nameW
,
len
);
/* create an empty database */
res
=
MsiOpenDatabaseW
(
nameW
,
MSIDBOPEN_CREATEDIRECT
,
&
hdb
);
HeapFree
(
GetProcessHeap
(),
0
,
nameW
);
free
(
nameW
);
ok
(
res
==
ERROR_SUCCESS
,
"Failed to create database %u
\n
"
,
res
);
if
(
res
!=
ERROR_SUCCESS
)
return
res
;
...
...
dlls/msi/tests/install.c
View file @
11ddaf06
...
...
@@ -2125,12 +2125,12 @@ static const msi_table sr_tables[] =
static
void
*
CDECL
mem_alloc
(
ULONG
cb
)
{
return
HeapAlloc
(
GetProcessHeap
(),
0
,
cb
);
return
malloc
(
cb
);
}
static
void
CDECL
mem_free
(
void
*
memory
)
{
HeapFree
(
GetProcessHeap
(),
0
,
memory
);
free
(
memory
);
}
static
BOOL
CDECL
get_next_cabinet
(
PCCAB
pccab
,
ULONG
cbPrevCab
,
void
*
pv
)
...
...
@@ -2302,18 +2302,17 @@ static BOOL CDECL get_temp_file(char *pszTempName, int cbTempName, void *pv)
{
LPSTR
tempname
;
tempname
=
HeapAlloc
(
GetProcessHeap
(),
0
,
MAX_PATH
);
tempname
=
malloc
(
MAX_PATH
);
GetTempFileNameA
(
"."
,
"xx"
,
0
,
tempname
);
if
(
tempname
&&
(
strlen
(
tempname
)
<
(
unsigned
)
cbTempName
))
{
lstrcpyA
(
pszTempName
,
tempname
);
HeapFree
(
GetProcessHeap
(),
0
,
tempname
);
free
(
tempname
);
return
TRUE
;
}
HeapFree
(
GetProcessHeap
(),
0
,
tempname
);
free
(
tempname
);
return
FALSE
;
}
...
...
@@ -2551,12 +2550,11 @@ static BOOL compare_pf_data(const char *filename, const char *data, DWORD size)
lstrcatA
(
path
,
filename
);
handle
=
CreateFileA
(
path
,
GENERIC_READ
,
0
,
NULL
,
OPEN_EXISTING
,
FILE_ATTRIBUTE_NORMAL
,
NULL
);
buffer
=
HeapAlloc
(
GetProcessHeap
(),
0
,
size
);
if
(
buffer
)
if
((
buffer
=
malloc
(
size
)))
{
ReadFile
(
handle
,
buffer
,
size
,
&
read
,
NULL
);
if
(
read
==
size
&&
!
memcmp
(
data
,
buffer
,
size
))
ret
=
TRUE
;
HeapFree
(
GetProcessHeap
(),
0
,
buffer
);
free
(
buffer
);
}
CloseHandle
(
handle
);
return
ret
;
...
...
@@ -2707,7 +2705,7 @@ void create_database_wordcount(const CHAR *name, const msi_table *tables, int nu
int
j
,
len
;
len
=
MultiByteToWideChar
(
CP_ACP
,
0
,
name
,
-
1
,
NULL
,
0
);
if
(
!
(
nameW
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len
*
sizeof
(
WCHAR
)
)))
return
;
if
(
!
(
nameW
=
malloc
(
len
*
sizeof
(
WCHAR
)
)))
return
;
MultiByteToWideChar
(
CP_ACP
,
0
,
name
,
-
1
,
nameW
,
len
);
r
=
MsiOpenDatabaseW
(
nameW
,
MSIDBOPEN_CREATE
,
&
db
);
...
...
@@ -2733,7 +2731,7 @@ void create_database_wordcount(const CHAR *name, const msi_table *tables, int nu
ok
(
r
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %u
\n
"
,
r
);
MsiCloseHandle
(
db
);
HeapFree
(
GetProcessHeap
(),
0
,
nameW
);
free
(
nameW
);
}
static
BOOL
notify_system_change
(
DWORD
event_type
,
STATEMGRSTATUS
*
status
)
...
...
@@ -5266,8 +5264,8 @@ static void process_pending_renames(HKEY hkey)
ret
=
RegQueryValueExA
(
hkey
,
rename_ops
,
NULL
,
NULL
,
NULL
,
&
size
);
ok
(
!
ret
,
"RegQueryValueExA failed %d
\n
"
,
ret
);
buf
=
HeapAlloc
(
GetProcessHeap
(),
0
,
size
+
1
);
buf2ptr
=
buf2
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
size
+
1
);
buf
=
malloc
(
size
+
1
);
buf2ptr
=
buf2
=
calloc
(
1
,
size
+
1
);
ret
=
RegQueryValueExA
(
hkey
,
rename_ops
,
NULL
,
NULL
,
(
LPBYTE
)
buf
,
&
size
);
buf
[
size
]
=
0
;
...
...
@@ -5318,8 +5316,8 @@ static void process_pending_renames(HKEY hkey)
else
RegDeleteValueA
(
hkey
,
rename_ops
);
HeapFree
(
GetProcessHeap
(),
0
,
buf
);
HeapFree
(
GetProcessHeap
(),
0
,
buf2
);
free
(
buf
);
free
(
buf2
);
}
static
BOOL
file_matches_data
(
LPCSTR
file
,
LPCSTR
data
)
...
...
dlls/msi/tests/msi.c
View file @
11ddaf06
...
...
@@ -966,9 +966,7 @@ static void test_null(void)
ok
(
r
==
ERROR_SUCCESS
||
r
==
ERROR_FILE_NOT_FOUND
,
"wrong error %d
\n
"
,
r
);
if
(
r
==
ERROR_SUCCESS
)
{
lpData
=
HeapAlloc
(
GetProcessHeap
(),
0
,
cbData
);
if
(
!
lpData
)
skip
(
"Out of memory
\n
"
);
if
(
!
(
lpData
=
malloc
(
cbData
)))
skip
(
"Out of memory
\n
"
);
else
{
r
=
RegQueryValueExA
(
hkey
,
NULL
,
0
,
&
dwType
,
lpData
,
&
cbData
);
...
...
@@ -980,7 +978,7 @@ static void test_null(void)
if
(
r
==
ERROR_ACCESS_DENIED
)
{
skip
(
"Not enough rights to perform tests
\n
"
);
HeapFree
(
GetProcessHeap
(),
0
,
lpData
);
free
(
lpData
);
RegCloseKey
(
hkey
);
return
;
}
...
...
@@ -993,8 +991,7 @@ static void test_null(void)
{
r
=
RegSetValueExA
(
hkey
,
NULL
,
0
,
dwType
,
lpData
,
cbData
);
ok
(
r
==
ERROR_SUCCESS
,
"wrong error %d
\n
"
,
r
);
HeapFree
(
GetProcessHeap
(),
0
,
lpData
);
free
(
lpData
);
}
else
{
...
...
@@ -1257,10 +1254,10 @@ static char *get_user_sid(void)
OpenProcessToken
(
GetCurrentProcess
(),
TOKEN_QUERY
,
&
token
);
GetTokenInformation
(
token
,
TokenUser
,
NULL
,
size
,
&
size
);
user
=
HeapAlloc
(
GetProcessHeap
(),
0
,
size
);
user
=
malloc
(
size
);
GetTokenInformation
(
token
,
TokenUser
,
user
,
size
,
&
size
);
ConvertSidToStringSidA
(
user
->
User
.
Sid
,
&
usersid
);
HeapFree
(
GetProcessHeap
(),
0
,
user
);
free
(
user
);
CloseHandle
(
token
);
return
usersid
;
...
...
@@ -4087,22 +4084,22 @@ static void get_version_info(LPSTR path, LPSTR *vercheck, LPDWORD verchecksz,
DWORD
size
=
GetFileVersionInfoSizeA
(
path
,
NULL
);
USHORT
*
lang
;
version
=
HeapAlloc
(
GetProcessHeap
(),
0
,
size
);
version
=
malloc
(
size
);
GetFileVersionInfoA
(
path
,
0
,
size
,
version
);
VerQueryValueA
(
version
,
"
\\
"
,
(
LPVOID
*
)
&
ffi
,
&
size
);
*
vercheck
=
HeapAlloc
(
GetProcessHeap
(),
0
,
MAX_PATH
);
*
vercheck
=
malloc
(
MAX_PATH
);
sprintf
(
*
vercheck
,
"%d.%d.%d.%d"
,
HIWORD
(
ffi
->
dwFileVersionMS
),
LOWORD
(
ffi
->
dwFileVersionMS
),
HIWORD
(
ffi
->
dwFileVersionLS
),
LOWORD
(
ffi
->
dwFileVersionLS
));
*
verchecksz
=
lstrlenA
(
*
vercheck
);
VerQueryValueA
(
version
,
"
\\
VarFileInfo
\\
Translation"
,
(
void
**
)
&
lang
,
&
size
);
*
langcheck
=
HeapAlloc
(
GetProcessHeap
(),
0
,
MAX_PATH
);
*
langcheck
=
malloc
(
MAX_PATH
);
sprintf
(
*
langcheck
,
"%d"
,
*
lang
);
*
langchecksz
=
lstrlenA
(
*
langcheck
);
HeapFree
(
GetProcessHeap
(),
0
,
version
);
free
(
version
);
}
static
void
test_MsiGetFileVersion
(
void
)
...
...
@@ -4286,8 +4283,8 @@ static void test_MsiGetFileVersion(void)
if
(
langchecksz
&&
!
langsz
)
{
win_skip
(
"broken MsiGetFileVersionA detected
\n
"
);
HeapFree
(
GetProcessHeap
(),
0
,
vercheck
);
HeapFree
(
GetProcessHeap
(),
0
,
langcheck
);
free
(
vercheck
);
free
(
langcheck
);
return
;
}
ok
(
versz
==
verchecksz
,
"Expected %d, got %d
\n
"
,
verchecksz
,
versz
);
...
...
@@ -4372,8 +4369,8 @@ static void test_MsiGetFileVersion(void)
r
=
MsiGetFileVersionA
(
path
,
NULL
,
NULL
,
NULL
,
NULL
);
ok
(
r
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
r
);
HeapFree
(
GetProcessHeap
(),
0
,
vercheck
);
HeapFree
(
GetProcessHeap
(),
0
,
langcheck
);
free
(
vercheck
);
free
(
langcheck
);
}
static
void
test_MsiGetProductInfo
(
void
)
...
...
dlls/msi/tests/package.c
View file @
11ddaf06
...
...
@@ -133,10 +133,10 @@ static char *get_user_sid(void)
OpenProcessToken
(
GetCurrentProcess
(),
TOKEN_QUERY
,
&
token
);
GetTokenInformation
(
token
,
TokenUser
,
NULL
,
size
,
&
size
);
user
=
HeapAlloc
(
GetProcessHeap
(),
0
,
size
);
user
=
malloc
(
size
);
GetTokenInformation
(
token
,
TokenUser
,
user
,
size
,
&
size
);
ConvertSidToStringSidA
(
user
->
User
.
Sid
,
&
usersid
);
HeapFree
(
GetProcessHeap
(),
0
,
user
);
free
(
user
);
CloseHandle
(
token
);
return
usersid
;
...
...
@@ -167,7 +167,7 @@ static LSTATUS package_RegDeleteTreeW(HKEY hKey, LPCWSTR lpszSubKey, REGSAM acce
if
(
dwMaxLen
>
ARRAY_SIZE
(
szNameBuf
))
{
/* Name too big: alloc a buffer for it */
if
(
!
(
lpszName
=
HeapAlloc
(
GetProcessHeap
(),
0
,
dwMaxLen
*
sizeof
(
WCHAR
))))
if
(
!
(
lpszName
=
malloc
(
dwMaxLen
*
sizeof
(
WCHAR
))))
{
ret
=
ERROR_NOT_ENOUGH_MEMORY
;
goto
cleanup
;
...
...
@@ -204,10 +204,8 @@ static LSTATUS package_RegDeleteTreeW(HKEY hKey, LPCWSTR lpszSubKey, REGSAM acce
}
cleanup:
if
(
lpszName
!=
szNameBuf
)
HeapFree
(
GetProcessHeap
(),
0
,
lpszName
);
if
(
lpszSubKey
)
RegCloseKey
(
hSubKey
);
if
(
lpszName
!=
szNameBuf
)
free
(
lpszName
);
if
(
lpszSubKey
)
RegCloseKey
(
hSubKey
);
return
ret
;
}
...
...
@@ -750,10 +748,10 @@ static inline UINT add_entry(const char *file, int line, const char *type, MSIHA
UINT
sz
,
r
;
sz
=
strlen
(
values
)
+
strlen
(
insert
)
+
1
;
query
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sz
);
query
=
malloc
(
sz
);
sprintf
(
query
,
insert
,
values
);
r
=
run_query
(
hdb
,
query
);
HeapFree
(
GetProcessHeap
(),
0
,
query
);
free
(
query
);
ok_
(
file
,
line
)(
r
==
ERROR_SUCCESS
,
"failed to insert into %s table: %u
\n
"
,
type
,
r
);
return
r
;
}
...
...
@@ -867,10 +865,10 @@ static UINT add_reglocator_entry( MSIHANDLE hdb, const char *sig, UINT root, con
UINT
sz
,
r
;
sz
=
strlen
(
sig
)
+
10
+
strlen
(
path
)
+
strlen
(
name
)
+
10
+
sizeof
(
insert
);
query
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sz
);
query
=
malloc
(
sz
);
sprintf
(
query
,
insert
,
sig
,
root
,
path
,
name
,
type
);
r
=
run_query
(
hdb
,
query
);
HeapFree
(
GetProcessHeap
(),
0
,
query
);
free
(
query
);
ok
(
r
==
ERROR_SUCCESS
,
"failed to insert into reglocator table: %u
\n
"
,
r
);
\
return
r
;
}
...
...
@@ -1028,7 +1026,7 @@ static BOOL create_file_with_version(const CHAR *name, LONG ms, LONG ls)
CopyFileA
(
path
,
name
,
FALSE
);
size
=
GetFileVersionInfoSizeA
(
path
,
&
handle
);
buffer
=
HeapAlloc
(
GetProcessHeap
(),
0
,
size
);
buffer
=
malloc
(
size
);
GetFileVersionInfoA
(
path
,
0
,
size
,
buffer
);
...
...
@@ -1055,7 +1053,7 @@ static BOOL create_file_with_version(const CHAR *name, LONG ms, LONG ls)
ret
=
TRUE
;
done:
HeapFree
(
GetProcessHeap
(),
0
,
buffer
);
free
(
buffer
);
return
ret
;
}
...
...
@@ -4722,21 +4720,21 @@ static void test_appsearch_reglocator(void)
if
(
S
(
U
(
si
)).
wProcessorArchitecture
==
PROCESSOR_ARCHITECTURE_INTEL
)
{
size
=
ExpandEnvironmentStringsA
(
"%PATH%"
,
NULL
,
0
);
pathvar
=
HeapAlloc
(
GetProcessHeap
(),
0
,
size
);
pathvar
=
malloc
(
size
);
ExpandEnvironmentStringsA
(
"%PATH%"
,
pathvar
,
size
);
size
=
0
;
r
=
MsiGetPropertyA
(
hpkg
,
"SIGPROP4"
,
NULL
,
&
size
);
ok
(
r
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
r
);
pathdata
=
HeapAlloc
(
GetProcessHeap
(),
0
,
++
size
);
pathdata
=
malloc
(
++
size
);
r
=
MsiGetPropertyA
(
hpkg
,
"SIGPROP4"
,
pathdata
,
&
size
);
ok
(
r
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
r
);
ok
(
!
lstrcmpA
(
pathdata
,
pathvar
),
"Expected
\"
%s
\"
, got
\"
%s
\"\n
"
,
pathvar
,
pathdata
);
HeapFree
(
GetProcessHeap
(),
0
,
pathvar
);
HeapFree
(
GetProcessHeap
(),
0
,
pathdata
);
free
(
pathvar
);
free
(
pathdata
);
}
size
=
MAX_PATH
;
...
...
@@ -8802,22 +8800,21 @@ static void add_message(const struct externalui_message *msg)
if
(
!
sequence
)
{
sequence_size
=
10
;
sequence
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sequence_size
*
sizeof
(
*
sequence
));
sequence
=
malloc
(
sequence_size
*
sizeof
(
*
sequence
));
}
if
(
sequence_count
==
sequence_size
)
{
sequence_size
*=
2
;
sequence
=
HeapReAlloc
(
GetProcessHeap
(),
0
,
sequence
,
sequence_size
*
sizeof
(
*
sequence
));
sequence
=
realloc
(
sequence
,
sequence_size
*
sizeof
(
*
sequence
));
}
assert
(
sequence
);
sequence
[
sequence_count
++
]
=
*
msg
;
}
static
void
flush_sequence
(
void
)
{
HeapFree
(
GetProcessHeap
(),
0
,
sequence
);
free
(
sequence
);
sequence
=
NULL
;
sequence_count
=
sequence_size
=
0
;
}
...
...
dlls/msi/tests/patch.c
View file @
11ddaf06
...
...
@@ -321,7 +321,7 @@ static void create_database( const char *filename, const struct msi_table *table
int
len
;
len
=
MultiByteToWideChar
(
CP_ACP
,
0
,
filename
,
-
1
,
NULL
,
0
);
if
(
!
(
filenameW
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len
*
sizeof
(
WCHAR
)
)))
return
;
if
(
!
(
filenameW
=
malloc
(
len
*
sizeof
(
WCHAR
)
)))
return
;
MultiByteToWideChar
(
CP_ACP
,
0
,
filename
,
-
1
,
filenameW
,
len
);
r
=
MsiOpenDatabaseW
(
filenameW
,
MSIDBOPEN_CREATE
,
&
hdb
);
...
...
@@ -345,7 +345,7 @@ static void create_database( const char *filename, const struct msi_table *table
MsiCloseHandle
(
hdb
);
set_suminfo
(
filenameW
);
HeapFree
(
GetProcessHeap
(),
0
,
filenameW
);
free
(
filenameW
);
}
/* data for generating a patch */
...
...
@@ -704,11 +704,11 @@ static void create_patch( const char *filename )
const
CLSID
CLSID_MsiTransform
=
{
0xc1082
,
0
,
0
,
{
0xc0
,
0
,
0
,
0
,
0
,
0
,
0
,
0x46
}};
len
=
MultiByteToWideChar
(
CP_ACP
,
0
,
filename
,
-
1
,
NULL
,
0
);
filenameW
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len
*
sizeof
(
WCHAR
)
);
filenameW
=
malloc
(
len
*
sizeof
(
WCHAR
)
);
MultiByteToWideChar
(
CP_ACP
,
0
,
filename
,
-
1
,
filenameW
,
len
);
r
=
StgCreateDocfile
(
filenameW
,
mode
,
0
,
&
stg
);
HeapFree
(
GetProcessHeap
(),
0
,
filenameW
);
free
(
filenameW
);
ok
(
r
==
S_OK
,
"failed to create storage 0x%08x
\n
"
,
r
);
if
(
!
stg
)
return
;
...
...
dlls/msi/tests/source.c
View file @
11ddaf06
...
...
@@ -144,10 +144,10 @@ static char *get_user_sid(void)
OpenProcessToken
(
GetCurrentProcess
(),
TOKEN_QUERY
,
&
token
);
GetTokenInformation
(
token
,
TokenUser
,
NULL
,
size
,
&
size
);
user
=
HeapAlloc
(
GetProcessHeap
(),
0
,
size
);
user
=
malloc
(
size
);
GetTokenInformation
(
token
,
TokenUser
,
user
,
size
,
&
size
);
ConvertSidToStringSidA
(
user
->
User
.
Sid
,
&
usersid
);
HeapFree
(
GetProcessHeap
(),
0
,
user
);
free
(
user
);
CloseHandle
(
token
);
return
usersid
;
...
...
@@ -188,7 +188,7 @@ static inline WCHAR *strdupAW( const char *str )
int
len
;
WCHAR
*
ret
;
len
=
MultiByteToWideChar
(
CP_ACP
,
0
,
str
,
-
1
,
NULL
,
0
);
if
(
!
(
ret
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len
*
sizeof
(
WCHAR
)
)))
return
NULL
;
if
(
!
(
ret
=
malloc
(
len
*
sizeof
(
WCHAR
)
)))
return
NULL
;
MultiByteToWideChar
(
CP_ACP
,
0
,
str
,
-
1
,
ret
,
len
);
return
ret
;
}
...
...
@@ -448,8 +448,8 @@ static void test_MsiSourceListGetInfo(void)
ok
(
r
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
r
);
ok
(
!
valueW
[
0
],
"Expected
\"\"
"
);
ok
(
size
==
0
,
"Expected 0, got %d
\n
"
,
size
);
HeapFree
(
GetProcessHeap
(),
0
,
usersidW
);
HeapFree
(
GetProcessHeap
(),
0
,
prodcodeW
);
free
(
usersidW
);
free
(
prodcodeW
);
data
=
""
;
res
=
RegSetValueExA
(
hkey
,
"LastUsedSource"
,
0
,
REG_SZ
,
...
...
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