Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
b4983177
Commit
b4983177
authored
Dec 04, 2023
by
Alex Henrie
Committed by
Alexandre Julliard
Dec 05, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mscoree: Use CRT allocation functions.
parent
ef07f6bb
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
77 additions
and
82 deletions
+77
-82
config.c
dlls/mscoree/config.c
+12
-15
cordebug.c
dlls/mscoree/cordebug.c
+8
-8
corruntimehost.c
dlls/mscoree/corruntimehost.c
+25
-26
metadata.c
dlls/mscoree/metadata.c
+2
-2
metahost.c
dlls/mscoree/metahost.c
+22
-23
mscoree_main.c
dlls/mscoree/mscoree_main.c
+8
-8
No files found.
dlls/mscoree/config.c
View file @
b4983177
...
...
@@ -111,7 +111,7 @@ static ULONG WINAPI ConfigStream_Release(IStream *iface)
if
(
!
ref
)
{
CloseHandle
(
This
->
file
);
HeapFree
(
GetProcessHeap
(),
0
,
This
);
free
(
This
);
}
return
ref
;
...
...
@@ -231,7 +231,7 @@ HRESULT WINAPI CreateConfigStream(const WCHAR *filename, IStream **stream)
if
(
file
==
INVALID_HANDLE_VALUE
)
return
GetLastError
()
==
ERROR_FILE_NOT_FOUND
?
COR_E_FILENOTFOUND
:
E_FAIL
;
config_stream
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
*
config_stream
));
config_stream
=
malloc
(
sizeof
(
*
config_stream
));
if
(
!
config_stream
)
{
CloseHandle
(
file
);
...
...
@@ -288,7 +288,7 @@ static ULONG WINAPI ConfigFileHandler_Release(ISAXContentHandler *iface)
ULONG
ref
=
InterlockedDecrement
(
&
This
->
ref
);
if
(
ref
==
0
)
HeapFree
(
GetProcessHeap
(),
0
,
This
);
free
(
This
);
return
ref
;
}
...
...
@@ -350,10 +350,8 @@ static HRESULT parse_probing(ConfigFileHandler *This, ISAXAttributes *pAttr)
{
TRACE
(
"%s
\n
"
,
debugstr_wn
(
value
,
value_size
));
This
->
result
->
private_path
=
HeapAlloc
(
GetProcessHeap
(),
0
,
(
value_size
+
1
)
*
sizeof
(
WCHAR
));
if
(
This
->
result
->
private_path
)
wcscpy
(
This
->
result
->
private_path
,
value
);
else
This
->
result
->
private_path
=
wcsdup
(
value
);
if
(
!
This
->
result
->
private_path
)
hr
=
E_OUTOFMEMORY
;
}
...
...
@@ -375,18 +373,17 @@ static HRESULT parse_supported_runtime(ConfigFileHandler *This, ISAXAttributes *
if
(
SUCCEEDED
(
hr
))
{
TRACE
(
"%s
\n
"
,
debugstr_wn
(
value
,
value_size
));
entry
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
supported_runtime
));
entry
=
malloc
(
sizeof
(
supported_runtime
));
if
(
entry
)
{
entry
->
version
=
HeapAlloc
(
GetProcessHeap
(),
0
,
(
value_size
+
1
)
*
sizeof
(
WCHAR
)
);
entry
->
version
=
wcsdup
(
value
);
if
(
entry
->
version
)
{
lstrcpyW
(
entry
->
version
,
value
);
list_add_tail
(
&
This
->
result
->
supported_runtimes
,
&
entry
->
entry
);
}
else
{
HeapFree
(
GetProcessHeap
(),
0
,
entry
);
free
(
entry
);
hr
=
E_OUTOFMEMORY
;
}
}
...
...
@@ -626,7 +623,7 @@ static HRESULT parse_config(VARIANT input, parsed_config_file *result)
ConfigFileHandler
*
handler
;
HRESULT
hr
;
handler
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
ConfigFileHandler
));
handler
=
malloc
(
sizeof
(
ConfigFileHandler
));
if
(
!
handler
)
return
E_OUTOFMEMORY
;
...
...
@@ -702,10 +699,10 @@ void free_parsed_config_file(parsed_config_file *file)
LIST_FOR_EACH_ENTRY_SAFE
(
cursor
,
cursor2
,
&
file
->
supported_runtimes
,
supported_runtime
,
entry
)
{
HeapFree
(
GetProcessHeap
(),
0
,
cursor
->
version
);
free
(
cursor
->
version
);
list_remove
(
&
cursor
->
entry
);
HeapFree
(
GetProcessHeap
(),
0
,
cursor
);
free
(
cursor
);
}
HeapFree
(
GetProcessHeap
(),
0
,
file
->
private_path
);
free
(
file
->
private_path
);
}
dlls/mscoree/cordebug.c
View file @
b4983177
...
...
@@ -121,7 +121,7 @@ static ULONG WINAPI cordebugprocess_Release(ICorDebugProcess *iface)
if
(
This
->
cordebug
)
ICorDebug_Release
(
&
This
->
cordebug
->
ICorDebug_iface
);
HeapFree
(
GetProcessHeap
(),
0
,
This
);
free
(
This
);
}
return
ref
;
...
...
@@ -405,7 +405,7 @@ static HRESULT CorDebugProcess_Create(CorDebug *cordebug, IUnknown** ppUnk, LPPR
{
DebugProcess
*
This
;
This
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
*
This
);
This
=
malloc
(
sizeof
*
This
);
if
(
!
This
)
return
E_OUTOFMEMORY
;
...
...
@@ -413,7 +413,7 @@ static HRESULT CorDebugProcess_Create(CorDebug *cordebug, IUnknown** ppUnk, LPPR
GetCurrentProcess
(),
&
This
->
handle
,
0
,
FALSE
,
DUPLICATE_SAME_ACCESS
))
{
ERR
(
"Failed to duplicate process handle
\n
"
);
HeapFree
(
GetProcessHeap
(),
0
,
This
);
free
(
This
);
return
E_FAIL
;
}
if
(
!
DuplicateHandle
(
GetCurrentProcess
(),
lpProcessInformation
->
hThread
,
...
...
@@ -422,7 +422,7 @@ static HRESULT CorDebugProcess_Create(CorDebug *cordebug, IUnknown** ppUnk, LPPR
CloseHandle
(
This
->
handle
);
ERR
(
"Failed to duplicate thread handle
\n
"
);
HeapFree
(
GetProcessHeap
(),
0
,
This
);
free
(
This
);
return
E_FAIL
;
}
...
...
@@ -587,7 +587,7 @@ static ULONG WINAPI CorDebug_Release(ICorDebug *iface)
if
(
This
->
pCallback
)
ICorDebugManagedCallback_Release
(
This
->
pCallback
);
HeapFree
(
GetProcessHeap
(),
0
,
This
);
free
(
This
);
}
return
ref
;
...
...
@@ -616,7 +616,7 @@ static HRESULT WINAPI CorDebug_Terminate(ICorDebug *iface)
}
list_remove
(
&
cursor
->
entry
);
HeapFree
(
GetProcessHeap
(),
0
,
cursor
);
free
(
cursor
);
}
return
S_OK
;
...
...
@@ -685,7 +685,7 @@ static HRESULT WINAPI CorDebug_CreateProcess(ICorDebug *iface, LPCWSTR lpApplica
hr
=
CorDebugProcess_Create
(
This
,
(
IUnknown
**
)
&
pDebugProcess
,
lpProcessInformation
);
if
(
hr
==
S_OK
)
{
struct
CorProcess
*
new_process
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
CorProcess
)
);
struct
CorProcess
*
new_process
=
malloc
(
sizeof
(
CorProcess
)
);
new_process
->
pProcess
=
pDebugProcess
;
list_add_tail
(
&
This
->
processes
,
&
new_process
->
entry
);
...
...
@@ -764,7 +764,7 @@ HRESULT CorDebug_Create(ICLRRuntimeHost *runtimehost, IUnknown** ppUnk)
{
CorDebug
*
This
;
This
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
*
This
);
This
=
malloc
(
sizeof
*
This
);
if
(
!
This
)
return
E_OUTOFMEMORY
;
...
...
dlls/mscoree/corruntimehost.c
View file @
b4983177
...
...
@@ -40,7 +40,6 @@
#include "mscoree_private.h"
#include "wine/debug.h"
#include "wine/heap.h"
WINE_DEFAULT_DEBUG_CHANNEL
(
mscoree
);
...
...
@@ -168,7 +167,7 @@ static HRESULT RuntimeHost_GetDefaultDomain(RuntimeHost *This, const WCHAR *conf
base_dirA
=
WtoA
(
base_dir
);
if
(
!
base_dirA
)
{
HeapFree
(
GetProcessHeap
(),
0
,
config_pathA
);
free
(
config_pathA
);
res
=
E_OUTOFMEMORY
;
goto
end
;
}
...
...
@@ -180,8 +179,8 @@ static HRESULT RuntimeHost_GetDefaultDomain(RuntimeHost *This, const WCHAR *conf
TRACE
(
"setting base_dir: %s, config_path: %s
\n
"
,
base_dirA
,
config_pathA
);
mono_domain_set_config
(
*
result
,
base_dirA
,
config_pathA
);
HeapFree
(
GetProcessHeap
(),
0
,
config_pathA
);
HeapFree
(
GetProcessHeap
(),
0
,
base_dirA
);
free
(
config_pathA
);
free
(
base_dirA
);
end:
...
...
@@ -388,7 +387,7 @@ static HRESULT RuntimeHost_AddDomain(RuntimeHost *This, const WCHAR *name, IUnkn
}
args
[
0
]
=
mono_string_new
(
domain
,
nameA
);
HeapFree
(
GetProcessHeap
(),
0
,
nameA
);
free
(
nameA
);
if
(
!
args
[
0
])
{
...
...
@@ -943,10 +942,10 @@ static HRESULT WINAPI CLRRuntimeHost_ExecuteInDefaultAppDomain(ICLRRuntimeHost*
domain_restore
(
prev_domain
);
HeapFree
(
GetProcessHeap
(),
0
,
filenameA
);
HeapFree
(
GetProcessHeap
(),
0
,
classA
);
HeapFree
(
GetProcessHeap
(),
0
,
argsA
);
HeapFree
(
GetProcessHeap
(),
0
,
methodA
);
free
(
filenameA
);
free
(
classA
);
free
(
argsA
);
free
(
methodA
);
return
hr
;
}
...
...
@@ -1034,7 +1033,7 @@ HRESULT RuntimeHost_CreateManagedInstance(RuntimeHost *This, LPCWSTR name,
domain_restore
(
prev_domain
);
HeapFree
(
GetProcessHeap
(),
0
,
nameA
);
free
(
nameA
);
return
hr
;
}
...
...
@@ -1082,7 +1081,7 @@ static void get_utf8_args(int *argc, char ***argv)
}
size
+=
sizeof
(
char
*
);
*
argv
=
HeapAlloc
(
GetProcessHeap
(),
0
,
size
);
*
argv
=
malloc
(
size
);
current_arg
=
(
char
*
)(
*
argv
+
*
argc
+
1
);
for
(
i
=
0
;
i
<*
argc
;
i
++
)
...
...
@@ -1325,7 +1324,7 @@ static void CDECL ReallyFixupVTable(struct dll_fixup *fixup)
if
(
info
!=
NULL
)
ICLRRuntimeInfo_Release
(
info
);
HeapFree
(
GetProcessHeap
(),
0
,
filenameA
);
free
(
filenameA
);
if
(
!
fixup
->
done
)
{
...
...
@@ -1346,7 +1345,7 @@ static void FixupVTableEntry(HMODULE hmodule, VTableFixup *vtable_fixup)
* threads are clear. */
struct
dll_fixup
*
fixup
;
fixup
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
*
fixup
));
fixup
=
malloc
(
sizeof
(
*
fixup
));
fixup
->
dll
=
hmodule
;
fixup
->
thunk_code
=
HeapAlloc
(
dll_fixup_heap
,
0
,
sizeof
(
struct
vtable_fixup_thunk
)
*
vtable_fixup
->
count
);
...
...
@@ -1365,7 +1364,7 @@ static void FixupVTableEntry(HMODULE hmodule, VTableFixup *vtable_fixup)
int
i
;
struct
vtable_fixup_thunk
*
thunks
=
fixup
->
thunk_code
;
tokens
=
fixup
->
tokens
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
*
tokens
)
*
vtable_fixup
->
count
);
tokens
=
fixup
->
tokens
=
malloc
(
sizeof
(
*
tokens
)
*
vtable_fixup
->
count
);
memcpy
(
tokens
,
vtable
,
sizeof
(
*
tokens
)
*
vtable_fixup
->
count
);
for
(
i
=
0
;
i
<
vtable_fixup
->
count
;
i
++
)
{
...
...
@@ -1380,7 +1379,7 @@ static void FixupVTableEntry(HMODULE hmodule, VTableFixup *vtable_fixup)
{
ERR
(
"unsupported vtable fixup flags %x
\n
"
,
vtable_fixup
->
type
);
HeapFree
(
dll_fixup_heap
,
0
,
fixup
->
thunk_code
);
HeapFree
(
GetProcessHeap
(),
0
,
fixup
);
free
(
fixup
);
return
;
}
...
...
@@ -1446,7 +1445,7 @@ __int32 WINAPI _CorExeMain(void)
filenameA
=
WtoA
(
filename
);
if
(
!
filenameA
)
{
HeapFree
(
GetProcessHeap
(),
0
,
argv
);
free
(
argv
);
return
-
1
;
}
...
...
@@ -1463,12 +1462,12 @@ __int32 WINAPI _CorExeMain(void)
if
(
parsed_config
.
private_path
[
i
]
==
';'
)
number_of_private_paths
++
;
if
(
parsed_config
.
private_path
[
wcslen
(
parsed_config
.
private_path
)
-
1
]
!=
';'
)
number_of_private_paths
++
;
config_file_dir_size
=
(
wcsrchr
(
config_file
,
'\\'
)
-
config_file
)
+
1
;
priv_path
=
HeapAlloc
(
GetProcessHeap
(),
0
,
(
number_of_private_paths
+
1
)
*
sizeof
(
WCHAR
*
));
priv_path
=
malloc
(
(
number_of_private_paths
+
1
)
*
sizeof
(
WCHAR
*
));
/* wcstok ignores trailing semicolons */
temp
=
wcstok_s
(
parsed_config
.
private_path
,
scW
,
&
save
);
for
(
i
=
0
;
i
<
number_of_private_paths
;
i
++
)
{
priv_path
[
i
]
=
HeapAlloc
(
GetProcessHeap
(),
0
,
(
config_file_dir_size
+
wcslen
(
temp
)
+
1
)
*
sizeof
(
WCHAR
));
priv_path
[
i
]
=
malloc
(
(
config_file_dir_size
+
wcslen
(
temp
)
+
1
)
*
sizeof
(
WCHAR
));
memcpy
(
priv_path
[
i
],
config_file
,
config_file_dir_size
*
sizeof
(
WCHAR
));
wcscpy
(
priv_path
[
i
]
+
config_file_dir_size
,
temp
);
temp
=
wcstok_s
(
NULL
,
scW
,
&
save
);
...
...
@@ -1517,7 +1516,7 @@ __int32 WINAPI _CorExeMain(void)
else
exit_code
=
-
1
;
HeapFree
(
GetProcessHeap
(),
0
,
argv
);
free
(
argv
);
if
(
domain
)
{
...
...
@@ -1575,8 +1574,8 @@ void runtimehost_uninit(void)
HeapDestroy
(
dll_fixup_heap
);
LIST_FOR_EACH_ENTRY_SAFE
(
fixup
,
fixup2
,
&
dll_fixups
,
struct
dll_fixup
,
entry
)
{
HeapFree
(
GetProcessHeap
(),
0
,
fixup
->
tokens
);
HeapFree
(
GetProcessHeap
(),
0
,
fixup
);
free
(
fixup
->
tokens
);
free
(
fixup
);
}
}
...
...
@@ -1584,7 +1583,7 @@ HRESULT RuntimeHost_Construct(CLRRuntimeInfo *runtime_version, RuntimeHost** res
{
RuntimeHost
*
This
;
This
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
*
This
);
This
=
malloc
(
sizeof
*
This
);
if
(
!
This
)
return
E_OUTOFMEMORY
;
...
...
@@ -1668,7 +1667,7 @@ static BOOL try_create_registration_free_com(REFIID clsid, WCHAR *classname, UIN
}
QueryActCtxW
(
0
,
guid_info
.
hActCtx
,
&
guid_info
.
ulAssemblyRosterIndex
,
AssemblyDetailedInformationInActivationContext
,
NULL
,
0
,
&
bytes_assembly_info
);
assembly_info
=
heap_
alloc
(
bytes_assembly_info
);
assembly_info
=
m
alloc
(
bytes_assembly_info
);
if
(
!
QueryActCtxW
(
0
,
guid_info
.
hActCtx
,
&
guid_info
.
ulAssemblyRosterIndex
,
AssemblyDetailedInformationInActivationContext
,
assembly_info
,
bytes_assembly_info
,
&
bytes_assembly_info
))
{
...
...
@@ -1706,7 +1705,7 @@ static BOOL try_create_registration_free_com(REFIID clsid, WCHAR *classname, UIN
ret
=
TRUE
;
end:
heap_
free
(
assembly_info
);
free
(
assembly_info
);
if
(
guid_info
.
hActCtx
)
ReleaseActCtx
(
guid_info
.
hActCtx
);
...
...
@@ -1914,7 +1913,7 @@ HRESULT create_monodata(REFCLSID clsid, LPVOID *ppObj)
filenameA
=
WtoA
(
filename
);
assembly
=
mono_assembly_open
(
filenameA
,
&
status
);
HeapFree
(
GetProcessHeap
(),
0
,
filenameA
);
free
(
filenameA
);
if
(
!
assembly
)
{
ERR
(
"Cannot open assembly %s, status=%i
\n
"
,
debugstr_w
(
filename
),
status
);
...
...
@@ -1935,7 +1934,7 @@ HRESULT create_monodata(REFCLSID clsid, LPVOID *ppObj)
*
ns
=
'\0'
;
klass
=
mono_class_from_name
(
image
,
classA
,
ns
+
1
);
HeapFree
(
GetProcessHeap
(),
0
,
classA
);
free
(
classA
);
if
(
!
klass
)
{
ERR
(
"Couldn't get class from image
\n
"
);
...
...
dlls/mscoree/metadata.c
View file @
b4983177
...
...
@@ -92,7 +92,7 @@ static ULONG WINAPI MetaDataDispenser_Release(IMetaDataDispenserEx* iface)
if
(
ref
==
0
)
{
HeapFree
(
GetProcessHeap
(),
0
,
This
);
free
(
This
);
}
return
ref
;
...
...
@@ -190,7 +190,7 @@ HRESULT MetaDataDispenser_CreateInstance(IUnknown **ppUnk)
{
MetaDataDispenser
*
This
;
This
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
MetaDataDispenser
));
This
=
malloc
(
sizeof
(
MetaDataDispenser
));
if
(
!
This
)
return
E_OUTOFMEMORY
;
...
...
dlls/mscoree/metahost.c
View file @
b4983177
...
...
@@ -39,7 +39,6 @@
#include "metahost.h"
#include "fusion.h"
#include "wine/list.h"
#include "wine/heap.h"
#include "mscoree_private.h"
#include "wine/debug.h"
...
...
@@ -374,7 +373,7 @@ MonoDomain* get_root_domain(void)
root_domain
=
mono_jit_init_version
(
exe_basename
,
"v4.0.30319"
);
HeapFree
(
GetProcessHeap
(),
0
,
exe_basename
);
free
(
exe_basename
);
is_mono_started
=
TRUE
;
}
...
...
@@ -796,7 +795,7 @@ static BOOL get_mono_path_dos(const WCHAR *dir, LPWSTR path)
return
FALSE
;
/* No drive letter for this directory */
len
=
lstrlenW
(
dir
)
+
lstrlenW
(
basedir
)
+
1
;
if
(
!
(
dos_dir
=
heap_
alloc
(
len
*
sizeof
(
WCHAR
)
)))
return
FALSE
;
if
(
!
(
dos_dir
=
m
alloc
(
len
*
sizeof
(
WCHAR
)
)))
return
FALSE
;
lstrcpyW
(
dos_dir
,
dir
);
lstrcatW
(
dos_dir
,
basedir
);
...
...
@@ -804,7 +803,7 @@ static BOOL get_mono_path_dos(const WCHAR *dir, LPWSTR path)
if
(
ret
)
lstrcpyW
(
path
,
dos_dir
);
heap_
free
(
dos_dir
);
free
(
dos_dir
);
return
ret
;
}
...
...
@@ -828,7 +827,7 @@ static BOOL get_mono_path_unix(const char *unix_dir, LPWSTR path)
ret
=
get_mono_path_dos
(
dos_dir
,
path
);
heap_free
(
dos_dir
);
HeapFree
(
GetProcessHeap
(),
0
,
dos_dir
);
return
ret
;
}
...
...
@@ -852,13 +851,13 @@ static BOOL get_mono_path_datadir(LPWSTR path)
if
(
!
wcsncmp
(
data_dir
,
unix_prefix
,
wcslen
(
unix_prefix
)
))
return
FALSE
;
data_dir
+=
4
;
/* skip \??\ prefix */
package_dir
=
heap_alloc
(
(
lstrlenW
(
data_dir
)
+
lstrlenW
(
suffix
)
+
1
)
*
sizeof
(
WCHAR
));
package_dir
=
malloc
((
wcslen
(
data_dir
)
+
wcslen
(
suffix
)
+
1
)
*
sizeof
(
WCHAR
));
lstrcpyW
(
package_dir
,
data_dir
);
lstrcatW
(
package_dir
,
suffix
);
ret
=
get_mono_path_dos
(
package_dir
,
path
);
heap_
free
(
package_dir
);
free
(
package_dir
);
return
ret
;
}
...
...
@@ -928,7 +927,7 @@ static ULONG WINAPI InstalledRuntimeEnum_Release(IEnumUnknown* iface)
if
(
ref
==
0
)
{
HeapFree
(
GetProcessHeap
(),
0
,
This
);
free
(
This
);
}
return
ref
;
...
...
@@ -1004,7 +1003,7 @@ static HRESULT WINAPI InstalledRuntimeEnum_Clone(IEnumUnknown *iface, IEnumUnkno
TRACE
(
"(%p)
\n
"
,
iface
);
new_enum
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
*
new_enum
));
new_enum
=
malloc
(
sizeof
(
*
new_enum
));
if
(
!
new_enum
)
return
E_OUTOFMEMORY
;
...
...
@@ -1182,7 +1181,7 @@ static HRESULT WINAPI CLRMetaHost_EnumerateInstalledRuntimes(ICLRMetaHost* iface
TRACE
(
"%p
\n
"
,
ppEnumerator
);
new_enum
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
*
new_enum
));
new_enum
=
malloc
(
sizeof
(
*
new_enum
));
if
(
!
new_enum
)
return
E_OUTOFMEMORY
;
...
...
@@ -1507,18 +1506,18 @@ static BOOL WINAPI parse_env_overrides(INIT_ONCE *once, void *param, void **cont
continue
;
}
entry
=
heap_alloc_zero
(
sizeof
(
*
entry
));
entry
=
calloc
(
1
,
sizeof
(
*
entry
));
if
(
!
entry
)
{
ERR
(
"out of memory
\n
"
);
break
;
}
entry
->
name
=
heap_alloc_zero
(
basename_end
-
entry_start
+
1
);
entry
->
name
=
calloc
(
1
,
basename_end
-
entry_start
+
1
);
if
(
!
entry
->
name
)
{
ERR
(
"out of memory
\n
"
);
heap_
free
(
entry
);
free
(
entry
);
break
;
}
...
...
@@ -1633,7 +1632,7 @@ static DWORD get_assembly_search_flags(MonoAssemblyName *aname)
return
result
;
}
name_copy
=
heap_
alloc
((
strlen
(
name
)
+
3
)
*
sizeof
(
WCHAR
));
name_copy
=
m
alloc
((
strlen
(
name
)
+
3
)
*
sizeof
(
WCHAR
));
if
(
!
name_copy
)
{
ERR
(
"out of memory
\n
"
);
...
...
@@ -1663,7 +1662,7 @@ static DWORD get_assembly_search_flags(MonoAssemblyName *aname)
result
=
ASSEMBLY_SEARCH_DEFAULT
;
}
heap_
free
(
name_copy
);
free
(
name_copy
);
if
(
appkey
)
RegCloseKey
(
appkey
);
if
(
userkey
)
RegCloseKey
(
userkey
);
...
...
@@ -1718,7 +1717,7 @@ static MonoAssembly* mono_assembly_try_load(WCHAR *path)
if
(
!
(
pathA
=
WtoA
(
path
)))
return
NULL
;
result
=
mono_assembly_open
(
pathA
,
&
stat
);
HeapFree
(
GetProcessHeap
(),
0
,
pathA
);
free
(
pathA
);
if
(
result
)
TRACE
(
"found: %s
\n
"
,
debugstr_w
(
path
));
return
result
;
...
...
@@ -1762,7 +1761,7 @@ static MonoAssembly* CDECL wine_mono_assembly_preload_hook_v2_fn(MonoAssemblyNam
if
(
culture
)
{
cultureW_size
=
MultiByteToWideChar
(
CP_UTF8
,
0
,
culture
,
-
1
,
NULL
,
0
);
cultureW
=
HeapAlloc
(
GetProcessHeap
(),
0
,
cultureW_size
*
sizeof
(
WCHAR
));
cultureW
=
malloc
(
cultureW_size
*
sizeof
(
WCHAR
));
if
(
cultureW
)
MultiByteToWideChar
(
CP_UTF8
,
0
,
culture
,
-
1
,
cultureW
,
cultureW_size
);
}
else
cultureW
=
NULL
;
...
...
@@ -1775,7 +1774,7 @@ static MonoAssembly* CDECL wine_mono_assembly_preload_hook_v2_fn(MonoAssemblyNam
if
(
private_path
&&
(
search_flags
&
ASSEMBLY_SEARCH_PRIVATEPATH
)
!=
0
)
{
stringnameW_size
=
MultiByteToWideChar
(
CP_UTF8
,
0
,
assemblyname
,
-
1
,
NULL
,
0
);
stringnameW
=
HeapAlloc
(
GetProcessHeap
(),
0
,
stringnameW_size
*
sizeof
(
WCHAR
));
stringnameW
=
malloc
(
stringnameW_size
*
sizeof
(
WCHAR
));
if
(
stringnameW
)
{
MultiByteToWideChar
(
CP_UTF8
,
0
,
assemblyname
,
-
1
,
stringnameW
,
stringnameW_size
);
...
...
@@ -1807,7 +1806,7 @@ static MonoAssembly* CDECL wine_mono_assembly_preload_hook_v2_fn(MonoAssemblyNam
result
=
mono_assembly_try_load
(
path
);
if
(
result
)
break
;
}
HeapFree
(
GetProcessHeap
(),
0
,
stringnameW
);
free
(
stringnameW
);
if
(
result
)
goto
done
;
}
}
...
...
@@ -1816,14 +1815,14 @@ static MonoAssembly* CDECL wine_mono_assembly_preload_hook_v2_fn(MonoAssemblyNam
{
stringnameW_size
=
MultiByteToWideChar
(
CP_UTF8
,
0
,
stringname
,
-
1
,
NULL
,
0
);
stringnameW
=
HeapAlloc
(
GetProcessHeap
(),
0
,
stringnameW_size
*
sizeof
(
WCHAR
));
stringnameW
=
malloc
(
stringnameW_size
*
sizeof
(
WCHAR
));
if
(
stringnameW
)
{
MultiByteToWideChar
(
CP_UTF8
,
0
,
stringname
,
-
1
,
stringnameW
,
stringnameW_size
);
hr
=
get_file_from_strongname
(
stringnameW
,
path
,
MAX_PATH
);
HeapFree
(
GetProcessHeap
(),
0
,
stringnameW
);
free
(
stringnameW
);
}
else
hr
=
E_OUTOFMEMORY
;
...
...
@@ -1841,7 +1840,7 @@ static MonoAssembly* CDECL wine_mono_assembly_preload_hook_v2_fn(MonoAssemblyNam
if
(
!
result
)
ERR
(
"Failed to load %s, status=%u
\n
"
,
debugstr_w
(
path
),
stat
);
HeapFree
(
GetProcessHeap
(),
0
,
pathA
);
free
(
pathA
);
if
(
result
)
{
...
...
@@ -1881,7 +1880,7 @@ static MonoAssembly* CDECL wine_mono_assembly_preload_hook_v2_fn(MonoAssemblyNam
}
done:
HeapFree
(
GetProcessHeap
(),
0
,
cultureW
);
free
(
cultureW
);
mono_free
(
stringname
);
return
result
;
...
...
dlls/mscoree/mscoree_main.c
View file @
b4983177
...
...
@@ -67,7 +67,7 @@ char *WtoA(LPCWSTR wstr)
length
=
WideCharToMultiByte
(
CP_UTF8
,
0
,
wstr
,
-
1
,
NULL
,
0
,
NULL
,
NULL
);
result
=
HeapAlloc
(
GetProcessHeap
(),
0
,
length
);
result
=
malloc
(
length
);
if
(
result
)
WideCharToMultiByte
(
CP_UTF8
,
0
,
wstr
,
-
1
,
result
,
length
,
NULL
,
NULL
);
...
...
@@ -147,7 +147,7 @@ static ULONG WINAPI mscorecf_Release(IClassFactory *iface )
if
(
ref
==
0
)
{
HeapFree
(
GetProcessHeap
(),
0
,
This
);
free
(
This
);
}
return
ref
;
...
...
@@ -228,7 +228,7 @@ void CDECL mono_print_handler_fn(const char *string, INT is_stdout)
if
(
!
tls
)
{
tls
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
*
tls
));
tls
=
malloc
(
sizeof
(
*
tls
));
tls
->
length
=
0
;
TlsSetValue
(
print_tls_index
,
tls
);
}
...
...
@@ -279,7 +279,7 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
break
;
case
DLL_THREAD_DETACH
:
if
(
print_tls_index
!=
TLS_OUT_OF_INDEXES
)
HeapFree
(
GetProcessHeap
(),
0
,
TlsGetValue
(
print_tls_index
));
free
(
TlsGetValue
(
print_tls_index
));
break
;
case
DLL_PROCESS_DETACH
:
expect_no_runtimes
();
...
...
@@ -287,7 +287,7 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
runtimehost_uninit
();
if
(
print_tls_index
!=
TLS_OUT_OF_INDEXES
)
{
HeapFree
(
GetProcessHeap
(),
0
,
TlsGetValue
(
print_tls_index
));
free
(
TlsGetValue
(
print_tls_index
));
TlsFree
(
print_tls_index
);
}
break
;
...
...
@@ -701,7 +701,7 @@ HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv)
if
(
!
ppv
)
return
E_INVALIDARG
;
This
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
mscorecf
));
This
=
malloc
(
sizeof
(
mscorecf
));
This
->
IClassFactory_iface
.
lpVtbl
=
&
mscorecf_vtbl
;
This
->
pfnCreateInstance
=
create_monodata
;
...
...
@@ -764,7 +764,7 @@ static BOOL invoke_appwiz(void)
len
=
GetSystemDirectoryW
(
app
,
MAX_PATH
-
ARRAY_SIZE
(
controlW
));
memcpy
(
app
+
len
,
controlW
,
sizeof
(
controlW
));
args
=
HeapAlloc
(
GetProcessHeap
(),
0
,
(
len
*
sizeof
(
WCHAR
)
+
sizeof
(
controlW
)
+
sizeof
(
argsW
)
));
args
=
malloc
(
len
*
sizeof
(
WCHAR
)
+
sizeof
(
controlW
)
+
sizeof
(
argsW
));
if
(
!
args
)
return
FALSE
;
...
...
@@ -776,7 +776,7 @@ static BOOL invoke_appwiz(void)
memset
(
&
si
,
0
,
sizeof
(
si
));
si
.
cb
=
sizeof
(
si
);
ret
=
CreateProcessW
(
app
,
args
,
NULL
,
NULL
,
FALSE
,
0
,
NULL
,
NULL
,
&
si
,
&
pi
);
HeapFree
(
GetProcessHeap
(),
0
,
args
);
free
(
args
);
if
(
ret
)
{
CloseHandle
(
pi
.
hThread
);
WaitForSingleObject
(
pi
.
hProcess
,
INFINITE
);
...
...
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