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
2e25e5e2
Commit
2e25e5e2
authored
Jan 04, 2011
by
Nikolay Sivov
Committed by
Alexandre Julliard
Jan 04, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
oleaut32: Use alloc/free helpers for typelib creation part too.
parent
ed749f51
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
70 additions
and
62 deletions
+70
-62
typelib.c
dlls/oleaut32/typelib.c
+8
-3
typelib.h
dlls/oleaut32/typelib.h
+6
-0
typelib2.c
dlls/oleaut32/typelib2.c
+56
-59
No files found.
dlls/oleaut32/typelib.c
View file @
2e25e5e2
...
@@ -1466,21 +1466,26 @@ static void TLB_abort(void)
...
@@ -1466,21 +1466,26 @@ static void TLB_abort(void)
DebugBreak
();
DebugBreak
();
}
}
static
inline
void
*
__WINE_ALLOC_SIZE
(
1
)
heap_alloc_zero
(
unsigned
size
)
void
*
__WINE_ALLOC_SIZE
(
1
)
heap_alloc_zero
(
unsigned
size
)
{
{
void
*
ret
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
size
);
void
*
ret
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
size
);
if
(
!
ret
)
ERR
(
"cannot allocate memory
\n
"
);
if
(
!
ret
)
ERR
(
"cannot allocate memory
\n
"
);
return
ret
;
return
ret
;
}
}
static
inline
void
*
__WINE_ALLOC_SIZE
(
1
)
heap_alloc
(
unsigned
size
)
void
*
__WINE_ALLOC_SIZE
(
1
)
heap_alloc
(
unsigned
size
)
{
{
void
*
ret
=
HeapAlloc
(
GetProcessHeap
(),
0
,
size
);
void
*
ret
=
HeapAlloc
(
GetProcessHeap
(),
0
,
size
);
if
(
!
ret
)
ERR
(
"cannot allocate memory
\n
"
);
if
(
!
ret
)
ERR
(
"cannot allocate memory
\n
"
);
return
ret
;
return
ret
;
}
}
static
inline
void
heap_free
(
void
*
ptr
)
void
*
__WINE_ALLOC_SIZE
(
2
)
heap_realloc
(
void
*
ptr
,
unsigned
size
)
{
return
HeapReAlloc
(
GetProcessHeap
(),
0
,
ptr
,
size
);
}
void
heap_free
(
void
*
ptr
)
{
{
HeapFree
(
GetProcessHeap
(),
0
,
ptr
);
HeapFree
(
GetProcessHeap
(),
0
,
ptr
);
}
}
...
...
dlls/oleaut32/typelib.h
View file @
2e25e5e2
...
@@ -596,6 +596,12 @@ WORD typeofarray
...
@@ -596,6 +596,12 @@ WORD typeofarray
#include "poppack.h"
#include "poppack.h"
/* heap allocation helpers */
extern
void
*
heap_alloc_zero
(
unsigned
size
);
extern
void
*
heap_alloc
(
unsigned
size
);
extern
void
*
heap_realloc
(
void
*
ptr
,
unsigned
size
);
extern
void
heap_free
(
void
*
ptr
);
HRESULT
ITypeInfoImpl_GetInternalFuncDesc
(
ITypeInfo
*
iface
,
UINT
index
,
const
FUNCDESC
**
ppFuncDesc
);
HRESULT
ITypeInfoImpl_GetInternalFuncDesc
(
ITypeInfo
*
iface
,
UINT
index
,
const
FUNCDESC
**
ppFuncDesc
);
extern
DWORD
_invoke
(
FARPROC
func
,
CALLCONV
callconv
,
int
nrargs
,
DWORD
*
args
);
extern
DWORD
_invoke
(
FARPROC
func
,
CALLCONV
callconv
,
int
nrargs
,
DWORD
*
args
);
...
...
dlls/oleaut32/typelib2.c
View file @
2e25e5e2
...
@@ -221,7 +221,7 @@ static ULONG WINAPI ICreateTypeLib2_fnRelease(ICreateTypeLib2 *iface);
...
@@ -221,7 +221,7 @@ static ULONG WINAPI ICreateTypeLib2_fnRelease(ICreateTypeLib2 *iface);
static
CyclicList
*
alloc_cyclic_list_item
(
CyclicListElementType
type
)
static
CyclicList
*
alloc_cyclic_list_item
(
CyclicListElementType
type
)
{
{
CyclicList
*
ret
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
CyclicList
));
CyclicList
*
ret
=
heap_alloc_zero
(
sizeof
(
CyclicList
));
if
(
!
ret
)
if
(
!
ret
)
return
NULL
;
return
NULL
;
ret
->
type
=
type
;
ret
->
type
=
type
;
...
@@ -563,7 +563,7 @@ static int ctl2_alloc_segment(
...
@@ -563,7 +563,7 @@ static int ctl2_alloc_segment(
if
(
!
block_size
)
block_size
=
0x2000
;
if
(
!
block_size
)
block_size
=
0x2000
;
This
->
typelib_segment_block_length
[
segment
]
=
block_size
;
This
->
typelib_segment_block_length
[
segment
]
=
block_size
;
This
->
typelib_segment_data
[
segment
]
=
HeapAlloc
(
GetProcessHeap
(),
0
,
block_size
);
This
->
typelib_segment_data
[
segment
]
=
heap_alloc
(
block_size
);
if
(
!
This
->
typelib_segment_data
[
segment
])
return
-
1
;
if
(
!
This
->
typelib_segment_data
[
segment
])
return
-
1
;
memset
(
This
->
typelib_segment_data
[
segment
],
0x57
,
block_size
);
memset
(
This
->
typelib_segment_data
[
segment
],
0x57
,
block_size
);
}
}
...
@@ -572,7 +572,7 @@ static int ctl2_alloc_segment(
...
@@ -572,7 +572,7 @@ static int ctl2_alloc_segment(
char
*
block
;
char
*
block
;
block_size
=
This
->
typelib_segment_block_length
[
segment
];
block_size
=
This
->
typelib_segment_block_length
[
segment
];
block
=
HeapReAlloc
(
GetProcessHeap
(),
0
,
This
->
typelib_segment_data
[
segment
],
block_size
<<
1
);
block
=
heap_realloc
(
This
->
typelib_segment_data
[
segment
],
block_size
<<
1
);
if
(
!
block
)
return
-
1
;
if
(
!
block
)
return
-
1
;
if
(
segment
==
MSFT_SEG_TYPEINFO
)
{
if
(
segment
==
MSFT_SEG_TYPEINFO
)
{
...
@@ -933,7 +933,7 @@ static HRESULT ctl2_encode_variant(
...
@@ -933,7 +933,7 @@ static HRESULT ctl2_encode_variant(
case
VT_BSTR
:
{
case
VT_BSTR
:
{
/* Construct the data */
/* Construct the data */
int
i
,
len
=
(
6
+
SysStringLen
(
V_BSTR
(
&
v
))
+
3
)
&
~
0x3
;
int
i
,
len
=
(
6
+
SysStringLen
(
V_BSTR
(
&
v
))
+
3
)
&
~
0x3
;
char
*
data
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len
);
char
*
data
=
heap_alloc
(
len
);
if
(
!
data
)
if
(
!
data
)
return
E_OUTOFMEMORY
;
return
E_OUTOFMEMORY
;
...
@@ -953,19 +953,19 @@ static HRESULT ctl2_encode_variant(
...
@@ -953,19 +953,19 @@ static HRESULT ctl2_encode_variant(
/* Check if the data was already allocated */
/* Check if the data was already allocated */
for
(
*
encoded_value
=
0
;
*
encoded_value
<=
This
->
typelib_segdir
[
MSFT_SEG_CUSTDATA
].
length
-
len
;
*
encoded_value
+=
4
)
for
(
*
encoded_value
=
0
;
*
encoded_value
<=
This
->
typelib_segdir
[
MSFT_SEG_CUSTDATA
].
length
-
len
;
*
encoded_value
+=
4
)
if
(
!
memcmp
(
&
This
->
typelib_segment_data
[
MSFT_SEG_CUSTDATA
][
*
encoded_value
],
data
,
len
))
{
if
(
!
memcmp
(
&
This
->
typelib_segment_data
[
MSFT_SEG_CUSTDATA
][
*
encoded_value
],
data
,
len
))
{
HeapFree
(
GetProcessHeap
(),
0
,
data
);
heap_free
(
data
);
return
S_OK
;
return
S_OK
;
}
}
/* Allocate the data */
/* Allocate the data */
*
encoded_value
=
ctl2_alloc_segment
(
This
,
MSFT_SEG_CUSTDATA
,
len
,
0
);
*
encoded_value
=
ctl2_alloc_segment
(
This
,
MSFT_SEG_CUSTDATA
,
len
,
0
);
if
(
*
encoded_value
==
-
1
)
{
if
(
*
encoded_value
==
-
1
)
{
HeapFree
(
GetProcessHeap
(),
0
,
data
);
heap_free
(
data
);
return
E_OUTOFMEMORY
;
return
E_OUTOFMEMORY
;
}
}
memcpy
(
&
This
->
typelib_segment_data
[
MSFT_SEG_CUSTDATA
][
*
encoded_value
],
data
,
len
);
memcpy
(
&
This
->
typelib_segment_data
[
MSFT_SEG_CUSTDATA
][
*
encoded_value
],
data
,
len
);
HeapFree
(
GetProcessHeap
(),
0
,
data
);
heap_free
(
data
);
return
S_OK
;
return
S_OK
;
}
}
default:
default:
...
@@ -1384,13 +1384,13 @@ static HRESULT ctl2_decode_typedesc(
...
@@ -1384,13 +1384,13 @@ static HRESULT ctl2_decode_typedesc(
switch
(
tdesc
->
vt
)
{
switch
(
tdesc
->
vt
)
{
case
VT_PTR
:
case
VT_PTR
:
case
VT_SAFEARRAY
:
case
VT_SAFEARRAY
:
tdesc
->
u
.
lptdesc
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
TYPEDESC
));
tdesc
->
u
.
lptdesc
=
heap_alloc_zero
(
sizeof
(
TYPEDESC
));
if
(
!
tdesc
->
u
.
lptdesc
)
if
(
!
tdesc
->
u
.
lptdesc
)
return
E_OUTOFMEMORY
;
return
E_OUTOFMEMORY
;
hres
=
ctl2_decode_typedesc
(
This
,
typedata
[
1
],
tdesc
->
u
.
lptdesc
);
hres
=
ctl2_decode_typedesc
(
This
,
typedata
[
1
],
tdesc
->
u
.
lptdesc
);
if
(
FAILED
(
hres
))
{
if
(
FAILED
(
hres
))
{
HeapFree
(
GetProcessHeap
(),
0
,
tdesc
->
u
.
lptdesc
);
heap_free
(
tdesc
->
u
.
lptdesc
);
return
hres
;
return
hres
;
}
}
...
@@ -1403,14 +1403,13 @@ static HRESULT ctl2_decode_typedesc(
...
@@ -1403,14 +1403,13 @@ static HRESULT ctl2_decode_typedesc(
arraydata
=
(
void
*
)
&
This
->
typelib_segment_data
[
MSFT_SEG_ARRAYDESC
][
arrayoffset
];
arraydata
=
(
void
*
)
&
This
->
typelib_segment_data
[
MSFT_SEG_ARRAYDESC
][
arrayoffset
];
num_dims
=
arraydata
[
1
]
&
0xFFFF
;
num_dims
=
arraydata
[
1
]
&
0xFFFF
;
tdesc
->
u
.
lpadesc
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
tdesc
->
u
.
lpadesc
=
heap_alloc_zero
(
sizeof
(
ARRAYDESC
)
+
sizeof
(
SAFEARRAYBOUND
)
*
(
num_dims
-
1
));
sizeof
(
ARRAYDESC
)
+
sizeof
(
SAFEARRAYBOUND
)
*
(
num_dims
-
1
));
if
(
!
tdesc
->
u
.
lpadesc
)
if
(
!
tdesc
->
u
.
lpadesc
)
return
E_OUTOFMEMORY
;
return
E_OUTOFMEMORY
;
hres
=
ctl2_decode_typedesc
(
This
,
arraydata
[
0
],
&
tdesc
->
u
.
lpadesc
->
tdescElem
);
hres
=
ctl2_decode_typedesc
(
This
,
arraydata
[
0
],
&
tdesc
->
u
.
lpadesc
->
tdescElem
);
if
(
FAILED
(
hres
))
{
if
(
FAILED
(
hres
))
{
HeapFree
(
GetProcessHeap
(),
0
,
tdesc
->
u
.
lpadesc
);
heap_free
(
tdesc
->
u
.
lpadesc
);
return
E_OUTOFMEMORY
;
return
E_OUTOFMEMORY
;
}
}
...
@@ -1511,7 +1510,7 @@ static INT funcrecord_reallochdr(INT **typedata, int need)
...
@@ -1511,7 +1510,7 @@ static INT funcrecord_reallochdr(INT **typedata, int need)
if
(
hdr
>=
need
)
if
(
hdr
>=
need
)
return
0
;
return
0
;
*
typedata
=
HeapReAlloc
(
GetProcessHeap
(),
0
,
*
typedata
,
need
+
tail
);
*
typedata
=
heap_realloc
(
*
typedata
,
need
+
tail
);
if
(
!*
typedata
)
if
(
!*
typedata
)
return
-
1
;
return
-
1
;
...
@@ -1673,7 +1672,7 @@ static HRESULT WINAPI ICreateTypeInfo2_fnSetTypeFlags(ICreateTypeInfo2 *iface, U
...
@@ -1673,7 +1672,7 @@ static HRESULT WINAPI ICreateTypeInfo2_fnSetTypeFlags(ICreateTypeInfo2 *iface, U
This
->
typeinfo
->
typekind
|=
TKIND_DISPATCH
;
This
->
typeinfo
->
typekind
|=
TKIND_DISPATCH
;
if
(
!
This
->
dual
)
{
if
(
!
This
->
dual
)
{
This
->
dual
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
ICreateTypeInfo2Impl
));
This
->
dual
=
heap_alloc
(
sizeof
(
ICreateTypeInfo2Impl
));
if
(
!
This
->
dual
)
if
(
!
This
->
dual
)
return
E_OUTOFMEMORY
;
return
E_OUTOFMEMORY
;
...
@@ -1976,10 +1975,10 @@ static HRESULT WINAPI ICreateTypeInfo2_fnAddFuncDesc(
...
@@ -1976,10 +1975,10 @@ static HRESULT WINAPI ICreateTypeInfo2_fnAddFuncDesc(
insert
=
alloc_cyclic_list_item
(
CyclicListFunc
);
insert
=
alloc_cyclic_list_item
(
CyclicListFunc
);
if
(
!
insert
)
if
(
!
insert
)
return
E_OUTOFMEMORY
;
return
E_OUTOFMEMORY
;
insert
->
u
.
data
=
HeapAlloc
(
GetProcessHeap
(),
0
,
FIELD_OFFSET
(
MSFT_FuncRecord
,
HelpContext
)
+
insert
->
u
.
data
=
heap_alloc
(
FIELD_OFFSET
(
MSFT_FuncRecord
,
HelpContext
)
+
sizeof
(
int
[(
num_defaults
?
4
:
3
)])
*
pFuncDesc
->
cParams
);
sizeof
(
int
[(
num_defaults
?
4
:
3
)])
*
pFuncDesc
->
cParams
);
if
(
!
insert
->
u
.
data
)
{
if
(
!
insert
->
u
.
data
)
{
HeapFree
(
GetProcessHeap
(),
0
,
insert
);
heap_free
(
insert
);
return
E_OUTOFMEMORY
;
return
E_OUTOFMEMORY
;
}
}
...
@@ -2008,8 +2007,8 @@ static HRESULT WINAPI ICreateTypeInfo2_fnAddFuncDesc(
...
@@ -2008,8 +2007,8 @@ static HRESULT WINAPI ICreateTypeInfo2_fnAddFuncDesc(
pFuncDesc
->
lprgelemdescParam
[
i
].
tdesc
.
vt
);
pFuncDesc
->
lprgelemdescParam
[
i
].
tdesc
.
vt
);
if
(
FAILED
(
hres
))
{
if
(
FAILED
(
hres
))
{
HeapFree
(
GetProcessHeap
(),
0
,
insert
->
u
.
data
);
heap_free
(
insert
->
u
.
data
);
HeapFree
(
GetProcessHeap
(),
0
,
insert
);
heap_free
(
insert
);
return
hres
;
return
hres
;
}
}
}
else
}
else
...
@@ -2247,9 +2246,9 @@ static HRESULT WINAPI ICreateTypeInfo2_fnAddVarDesc(
...
@@ -2247,9 +2246,9 @@ static HRESULT WINAPI ICreateTypeInfo2_fnAddVarDesc(
return
E_OUTOFMEMORY
;
return
E_OUTOFMEMORY
;
/* allocate whole structure, it's fixed size always */
/* allocate whole structure, it's fixed size always */
insert
->
u
.
data
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
MSFT_VarRecord
));
insert
->
u
.
data
=
heap_alloc
(
sizeof
(
MSFT_VarRecord
));
if
(
!
insert
->
u
.
data
)
{
if
(
!
insert
->
u
.
data
)
{
HeapFree
(
GetProcessHeap
(),
0
,
insert
);
heap_free
(
insert
);
return
E_OUTOFMEMORY
;
return
E_OUTOFMEMORY
;
}
}
...
@@ -2727,7 +2726,7 @@ static HRESULT WINAPI ICreateTypeInfo2_fnLayOut(
...
@@ -2727,7 +2726,7 @@ static HRESULT WINAPI ICreateTypeInfo2_fnLayOut(
if
(
!
This
->
typedata
)
if
(
!
This
->
typedata
)
return
S_OK
;
return
S_OK
;
typedata
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
CyclicList
*
)
*
cti2_get_func_count
(
This
->
typeinfo
));
typedata
=
heap_alloc
(
sizeof
(
CyclicList
*
)
*
cti2_get_func_count
(
This
->
typeinfo
));
if
(
!
typedata
)
if
(
!
typedata
)
return
E_OUTOFMEMORY
;
return
E_OUTOFMEMORY
;
...
@@ -2771,7 +2770,7 @@ static HRESULT WINAPI ICreateTypeInfo2_fnLayOut(
...
@@ -2771,7 +2770,7 @@ static HRESULT WINAPI ICreateTypeInfo2_fnLayOut(
iter
->
u
.
data
[
0
]
=
ctl2_get_record_size
(
iter
)
|
(
i
<<
16
);
iter
->
u
.
data
[
0
]
=
ctl2_get_record_size
(
iter
)
|
(
i
<<
16
);
if
((
iter
->
u
.
data
[
3
]
&
1
)
!=
(
user_vft
&
1
))
{
if
((
iter
->
u
.
data
[
3
]
&
1
)
!=
(
user_vft
&
1
))
{
HeapFree
(
GetProcessHeap
(),
0
,
typedata
);
heap_free
(
typedata
);
return
TYPE_E_INVALIDID
;
return
TYPE_E_INVALIDID
;
}
}
...
@@ -2780,7 +2779,7 @@ static HRESULT WINAPI ICreateTypeInfo2_fnLayOut(
...
@@ -2780,7 +2779,7 @@ static HRESULT WINAPI ICreateTypeInfo2_fnLayOut(
user_vft
=
(
iter
->
u
.
data
[
3
]
&
0xffff
);
user_vft
=
(
iter
->
u
.
data
[
3
]
&
0xffff
);
if
((
iter
->
u
.
data
[
3
]
&
0xffff
)
<
This
->
typeinfo
->
cbSizeVft
)
{
if
((
iter
->
u
.
data
[
3
]
&
0xffff
)
<
This
->
typeinfo
->
cbSizeVft
)
{
HeapFree
(
GetProcessHeap
(),
0
,
typedata
);
heap_free
(
typedata
);
return
TYPE_E_INVALIDID
;
return
TYPE_E_INVALIDID
;
}
}
}
else
if
(
This
->
typekind
!=
TKIND_MODULE
)
{
}
else
if
(
This
->
typekind
!=
TKIND_MODULE
)
{
...
@@ -2819,7 +2818,7 @@ static HRESULT WINAPI ICreateTypeInfo2_fnLayOut(
...
@@ -2819,7 +2818,7 @@ static HRESULT WINAPI ICreateTypeInfo2_fnLayOut(
INVOKEKIND
invkind
=
ctl2_get_invokekind
(
typedata
[
i
]);
INVOKEKIND
invkind
=
ctl2_get_invokekind
(
typedata
[
i
]);
if
(
inv
&
invkind
)
{
if
(
inv
&
invkind
)
{
HeapFree
(
GetProcessHeap
(),
0
,
typedata
);
heap_free
(
typedata
);
return
TYPE_E_DUPLICATEID
;
return
TYPE_E_DUPLICATEID
;
}
}
...
@@ -2828,13 +2827,13 @@ static HRESULT WINAPI ICreateTypeInfo2_fnLayOut(
...
@@ -2828,13 +2827,13 @@ static HRESULT WINAPI ICreateTypeInfo2_fnLayOut(
}
}
if
(
inv
&
INVOKE_FUNC
)
{
if
(
inv
&
INVOKE_FUNC
)
{
HeapFree
(
GetProcessHeap
(),
0
,
typedata
);
heap_free
(
typedata
);
return
TYPE_E_INCONSISTENTPROPFUNCS
;
return
TYPE_E_INCONSISTENTPROPFUNCS
;
}
}
}
}
}
}
HeapFree
(
GetProcessHeap
(),
0
,
typedata
);
heap_free
(
typedata
);
return
S_OK
;
return
S_OK
;
}
}
...
@@ -3191,7 +3190,7 @@ static HRESULT WINAPI ITypeInfo2_fnGetTypeAttr(
...
@@ -3191,7 +3190,7 @@ static HRESULT WINAPI ITypeInfo2_fnGetTypeAttr(
if
(
FAILED
(
hres
))
if
(
FAILED
(
hres
))
return
hres
;
return
hres
;
*
ppTypeAttr
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
TYPEATTR
));
*
ppTypeAttr
=
heap_alloc_zero
(
sizeof
(
TYPEATTR
));
if
(
!*
ppTypeAttr
)
if
(
!*
ppTypeAttr
)
return
E_OUTOFMEMORY
;
return
E_OUTOFMEMORY
;
...
@@ -3267,7 +3266,7 @@ static HRESULT WINAPI ITypeInfo2_fnGetFuncDesc(
...
@@ -3267,7 +3266,7 @@ static HRESULT WINAPI ITypeInfo2_fnGetFuncDesc(
typedata
=
desc
->
u
.
data
;
typedata
=
desc
->
u
.
data
;
*
ppFuncDesc
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
FUNCDESC
));
*
ppFuncDesc
=
heap_alloc_zero
(
sizeof
(
FUNCDESC
));
if
(
!*
ppFuncDesc
)
if
(
!*
ppFuncDesc
)
return
E_OUTOFMEMORY
;
return
E_OUTOFMEMORY
;
...
@@ -3285,7 +3284,7 @@ static HRESULT WINAPI ITypeInfo2_fnGetFuncDesc(
...
@@ -3285,7 +3284,7 @@ static HRESULT WINAPI ITypeInfo2_fnGetFuncDesc(
hres
=
ctl2_decode_typedesc
(
This
->
typelib
,
typedata
[
1
],
hres
=
ctl2_decode_typedesc
(
This
->
typelib
,
typedata
[
1
],
&
(
*
ppFuncDesc
)
->
elemdescFunc
.
tdesc
);
&
(
*
ppFuncDesc
)
->
elemdescFunc
.
tdesc
);
if
(
FAILED
(
hres
))
{
if
(
FAILED
(
hres
))
{
HeapFree
(
GetProcessHeap
(),
0
,
*
ppFuncDesc
);
heap_free
(
*
ppFuncDesc
);
return
hres
;
return
hres
;
}
}
(
*
ppFuncDesc
)
->
wFuncFlags
=
typedata
[
2
];
(
*
ppFuncDesc
)
->
wFuncFlags
=
typedata
[
2
];
...
@@ -3295,9 +3294,9 @@ static HRESULT WINAPI ITypeInfo2_fnGetFuncDesc(
...
@@ -3295,9 +3294,9 @@ static HRESULT WINAPI ITypeInfo2_fnGetFuncDesc(
hdr_len
=
(
ctl2_get_record_size
(
desc
)
-
tail
)
/
sizeof
(
int
);
hdr_len
=
(
ctl2_get_record_size
(
desc
)
-
tail
)
/
sizeof
(
int
);
if
((
*
ppFuncDesc
)
->
cParams
>
0
)
{
if
((
*
ppFuncDesc
)
->
cParams
>
0
)
{
(
*
ppFuncDesc
)
->
lprgelemdescParam
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
(
*
ppFuncDesc
)
->
cParams
*
sizeof
(
ELEMDESC
));
(
*
ppFuncDesc
)
->
lprgelemdescParam
=
heap_alloc_zero
(
(
*
ppFuncDesc
)
->
cParams
*
sizeof
(
ELEMDESC
));
if
(
!
(
*
ppFuncDesc
)
->
lprgelemdescParam
)
{
if
(
!
(
*
ppFuncDesc
)
->
lprgelemdescParam
)
{
HeapFree
(
GetProcessHeap
(),
0
,
*
ppFuncDesc
);
heap_free
(
*
ppFuncDesc
);
return
E_OUTOFMEMORY
;
return
E_OUTOFMEMORY
;
}
}
if
(
has_defaults
)
{
if
(
has_defaults
)
{
...
@@ -3307,7 +3306,7 @@ static HRESULT WINAPI ITypeInfo2_fnGetFuncDesc(
...
@@ -3307,7 +3306,7 @@ static HRESULT WINAPI ITypeInfo2_fnGetFuncDesc(
if
(
typedata
[
hdr_len
+
i
]
!=
0xFFFFFFFF
)
{
if
(
typedata
[
hdr_len
+
i
]
!=
0xFFFFFFFF
)
{
(
*
ppFuncDesc
)
->
lprgelemdescParam
[
i
].
u
.
paramdesc
.
wParamFlags
|=
PARAMFLAG_FHASDEFAULT
;
(
*
ppFuncDesc
)
->
lprgelemdescParam
[
i
].
u
.
paramdesc
.
wParamFlags
|=
PARAMFLAG_FHASDEFAULT
;
(
*
ppFuncDesc
)
->
lprgelemdescParam
[
i
].
u
.
paramdesc
.
pparamdescex
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
PARAMDESCEX
));
(
*
ppFuncDesc
)
->
lprgelemdescParam
[
i
].
u
.
paramdesc
.
pparamdescex
=
heap_alloc
(
sizeof
(
PARAMDESCEX
));
if
(
!
(
*
ppFuncDesc
)
->
lprgelemdescParam
[
i
].
u
.
paramdesc
.
pparamdescex
)
{
if
(
!
(
*
ppFuncDesc
)
->
lprgelemdescParam
[
i
].
u
.
paramdesc
.
pparamdescex
)
{
ITypeInfo2_ReleaseFuncDesc
(
iface
,
*
ppFuncDesc
);
ITypeInfo2_ReleaseFuncDesc
(
iface
,
*
ppFuncDesc
);
return
E_OUTOFMEMORY
;
return
E_OUTOFMEMORY
;
...
@@ -3712,7 +3711,7 @@ static void release_typedesc(TYPEDESC *tdesc)
...
@@ -3712,7 +3711,7 @@ static void release_typedesc(TYPEDESC *tdesc)
next
=
NULL
;
next
=
NULL
;
else
else
next
=
tdesc
->
u
.
lptdesc
;
next
=
tdesc
->
u
.
lptdesc
;
HeapFree
(
GetProcessHeap
(),
0
,
tdesc
);
heap_free
(
tdesc
);
tdesc
=
next
;
tdesc
=
next
;
}
}
}
}
...
@@ -3729,7 +3728,7 @@ static void WINAPI ITypeInfo2_fnReleaseTypeAttr(
...
@@ -3729,7 +3728,7 @@ static void WINAPI ITypeInfo2_fnReleaseTypeAttr(
if
(
pTypeAttr
->
tdescAlias
.
vt
!=
VT_USERDEFINED
)
if
(
pTypeAttr
->
tdescAlias
.
vt
!=
VT_USERDEFINED
)
release_typedesc
(
pTypeAttr
->
tdescAlias
.
u
.
lptdesc
);
release_typedesc
(
pTypeAttr
->
tdescAlias
.
u
.
lptdesc
);
HeapFree
(
GetProcessHeap
(),
0
,
pTypeAttr
);
heap_free
(
pTypeAttr
);
}
}
/******************************************************************************
/******************************************************************************
...
@@ -3743,24 +3742,24 @@ static void WINAPI ITypeInfo2_fnReleaseFuncDesc(
...
@@ -3743,24 +3742,24 @@ static void WINAPI ITypeInfo2_fnReleaseFuncDesc(
TRACE
(
"(%p,%p)
\n
"
,
iface
,
pFuncDesc
);
TRACE
(
"(%p,%p)
\n
"
,
iface
,
pFuncDesc
);
HeapFree
(
GetProcessHeap
(),
0
,
pFuncDesc
->
lprgscode
);
heap_free
(
pFuncDesc
->
lprgscode
);
if
(
pFuncDesc
->
lprgelemdescParam
)
{
if
(
pFuncDesc
->
lprgelemdescParam
)
{
for
(
i
=
0
;
i
<
pFuncDesc
->
cParams
;
++
i
)
{
for
(
i
=
0
;
i
<
pFuncDesc
->
cParams
;
++
i
)
{
if
(
pFuncDesc
->
lprgelemdescParam
[
i
].
tdesc
.
vt
!=
VT_USERDEFINED
)
if
(
pFuncDesc
->
lprgelemdescParam
[
i
].
tdesc
.
vt
!=
VT_USERDEFINED
)
release_typedesc
(
pFuncDesc
->
lprgelemdescParam
[
i
].
tdesc
.
u
.
lptdesc
);
release_typedesc
(
pFuncDesc
->
lprgelemdescParam
[
i
].
tdesc
.
u
.
lptdesc
);
HeapFree
(
GetProcessHeap
(),
0
,
pFuncDesc
->
lprgelemdescParam
[
i
].
u
.
paramdesc
.
pparamdescex
);
heap_free
(
pFuncDesc
->
lprgelemdescParam
[
i
].
u
.
paramdesc
.
pparamdescex
);
}
}
HeapFree
(
GetProcessHeap
(),
0
,
pFuncDesc
->
lprgelemdescParam
);
heap_free
(
pFuncDesc
->
lprgelemdescParam
);
}
}
HeapFree
(
GetProcessHeap
(),
0
,
pFuncDesc
->
elemdescFunc
.
u
.
paramdesc
.
pparamdescex
);
heap_free
(
pFuncDesc
->
elemdescFunc
.
u
.
paramdesc
.
pparamdescex
);
if
(
pFuncDesc
->
elemdescFunc
.
tdesc
.
vt
!=
VT_USERDEFINED
)
if
(
pFuncDesc
->
elemdescFunc
.
tdesc
.
vt
!=
VT_USERDEFINED
)
release_typedesc
(
pFuncDesc
->
elemdescFunc
.
tdesc
.
u
.
lptdesc
);
release_typedesc
(
pFuncDesc
->
elemdescFunc
.
tdesc
.
u
.
lptdesc
);
HeapFree
(
GetProcessHeap
(),
0
,
pFuncDesc
);
heap_free
(
pFuncDesc
);
}
}
/******************************************************************************
/******************************************************************************
...
@@ -4185,7 +4184,7 @@ static ICreateTypeInfo2 *ICreateTypeInfo2_Constructor(ICreateTypeLib2Impl *typel
...
@@ -4185,7 +4184,7 @@ static ICreateTypeInfo2 *ICreateTypeInfo2_Constructor(ICreateTypeLib2Impl *typel
TRACE
(
"Constructing ICreateTypeInfo2 for %s with tkind %d
\n
"
,
debugstr_w
(
szName
),
tkind
);
TRACE
(
"Constructing ICreateTypeInfo2 for %s with tkind %d
\n
"
,
debugstr_w
(
szName
),
tkind
);
pCreateTypeInfo2Impl
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
ICreateTypeInfo2Impl
));
pCreateTypeInfo2Impl
=
heap_alloc_zero
(
sizeof
(
ICreateTypeInfo2Impl
));
if
(
!
pCreateTypeInfo2Impl
)
return
NULL
;
if
(
!
pCreateTypeInfo2Impl
)
return
NULL
;
pCreateTypeInfo2Impl
->
lpVtbl
=
&
ctypeinfo2vt
;
pCreateTypeInfo2Impl
->
lpVtbl
=
&
ctypeinfo2vt
;
...
@@ -4307,11 +4306,11 @@ static ULONG WINAPI ICreateTypeLib2_fnRelease(ICreateTypeLib2 *iface)
...
@@ -4307,11 +4306,11 @@ static ULONG WINAPI ICreateTypeLib2_fnRelease(ICreateTypeLib2 *iface)
int
i
;
int
i
;
for
(
i
=
0
;
i
<
MSFT_SEG_MAX
;
i
++
)
{
for
(
i
=
0
;
i
<
MSFT_SEG_MAX
;
i
++
)
{
HeapFree
(
GetProcessHeap
(),
0
,
This
->
typelib_segment_data
[
i
]);
heap_free
(
This
->
typelib_segment_data
[
i
]);
This
->
typelib_segment_data
[
i
]
=
NULL
;
This
->
typelib_segment_data
[
i
]
=
NULL
;
}
}
HeapFree
(
GetProcessHeap
(),
0
,
This
->
filename
);
heap_free
(
This
->
filename
);
This
->
filename
=
NULL
;
This
->
filename
=
NULL
;
while
(
This
->
typeinfos
)
{
while
(
This
->
typeinfos
)
{
...
@@ -4323,22 +4322,21 @@ static ULONG WINAPI ICreateTypeLib2_fnRelease(ICreateTypeLib2 *iface)
...
@@ -4323,22 +4322,21 @@ static ULONG WINAPI ICreateTypeLib2_fnRelease(ICreateTypeLib2 *iface)
rem
=
typeinfo
->
typedata
->
next
;
rem
=
typeinfo
->
typedata
->
next
;
typeinfo
->
typedata
->
next
=
NULL
;
typeinfo
->
typedata
->
next
=
NULL
;
iter
=
rem
->
next
;
iter
=
rem
->
next
;
HeapFree
(
GetProcessHeap
(),
0
,
rem
);
heap_free
(
rem
);
while
(
iter
)
{
while
(
iter
)
{
rem
=
iter
;
rem
=
iter
;
iter
=
iter
->
next
;
iter
=
iter
->
next
;
HeapFree
(
GetProcessHeap
(),
0
,
rem
->
u
.
data
);
heap_free
(
rem
->
u
.
data
);
HeapFree
(
GetProcessHeap
(),
0
,
rem
);
heap_free
(
rem
);
}
}
}
}
HeapFree
(
GetProcessHeap
(),
0
,
typeinfo
->
dual
);
heap_free
(
typeinfo
->
dual
);
HeapFree
(
GetProcessHeap
(),
0
,
typeinfo
);
heap_free
(
typeinfo
);
}
}
HeapFree
(
GetProcessHeap
(),
0
,
This
);
heap_free
(
This
);
return
0
;
}
}
return
ref
;
return
ref
;
...
@@ -4887,7 +4885,7 @@ static HRESULT WINAPI ITypeLib2_fnGetLibAttr(
...
@@ -4887,7 +4885,7 @@ static HRESULT WINAPI ITypeLib2_fnGetLibAttr(
if
(
!
ppTLibAttr
)
if
(
!
ppTLibAttr
)
return
E_INVALIDARG
;
return
E_INVALIDARG
;
*
ppTLibAttr
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
TLIBATTR
));
*
ppTLibAttr
=
heap_alloc_zero
(
sizeof
(
TLIBATTR
));
if
(
!*
ppTLibAttr
)
if
(
!*
ppTLibAttr
)
return
E_OUTOFMEMORY
;
return
E_OUTOFMEMORY
;
...
@@ -5056,11 +5054,10 @@ static HRESULT WINAPI ITypeLib2_fnFindName(
...
@@ -5056,11 +5054,10 @@ static HRESULT WINAPI ITypeLib2_fnFindName(
*/
*/
static
void
WINAPI
ITypeLib2_fnReleaseTLibAttr
(
static
void
WINAPI
ITypeLib2_fnReleaseTLibAttr
(
ITypeLib2
*
iface
,
ITypeLib2
*
iface
,
TLIBATTR
*
pTLibA
ttr
)
TLIBATTR
*
a
ttr
)
{
{
TRACE
(
"(%p,%p)
\n
"
,
iface
,
pTLibAttr
);
TRACE
(
"(%p,%p)
\n
"
,
iface
,
attr
);
heap_free
(
attr
);
HeapFree
(
GetProcessHeap
(),
0
,
pTLibAttr
);
}
}
/******************************************************************************
/******************************************************************************
...
@@ -5212,12 +5209,12 @@ static ICreateTypeLib2 *ICreateTypeLib2_Constructor(SYSKIND syskind, LPCOLESTR s
...
@@ -5212,12 +5209,12 @@ static ICreateTypeLib2 *ICreateTypeLib2_Constructor(SYSKIND syskind, LPCOLESTR s
TRACE
(
"Constructing ICreateTypeLib2 (%d, %s)
\n
"
,
syskind
,
debugstr_w
(
szFile
));
TRACE
(
"Constructing ICreateTypeLib2 (%d, %s)
\n
"
,
syskind
,
debugstr_w
(
szFile
));
pCreateTypeLib2Impl
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
ICreateTypeLib2Impl
));
pCreateTypeLib2Impl
=
heap_alloc_zero
(
sizeof
(
ICreateTypeLib2Impl
));
if
(
!
pCreateTypeLib2Impl
)
return
NULL
;
if
(
!
pCreateTypeLib2Impl
)
return
NULL
;
pCreateTypeLib2Impl
->
filename
=
HeapAlloc
(
GetProcessHeap
(),
0
,
(
strlenW
(
szFile
)
+
1
)
*
sizeof
(
WCHAR
));
pCreateTypeLib2Impl
->
filename
=
heap_alloc
(
(
strlenW
(
szFile
)
+
1
)
*
sizeof
(
WCHAR
));
if
(
!
pCreateTypeLib2Impl
->
filename
)
{
if
(
!
pCreateTypeLib2Impl
->
filename
)
{
HeapFree
(
GetProcessHeap
(),
0
,
pCreateTypeLib2Impl
);
heap_free
(
pCreateTypeLib2Impl
);
return
NULL
;
return
NULL
;
}
}
strcpyW
(
pCreateTypeLib2Impl
->
filename
,
szFile
);
strcpyW
(
pCreateTypeLib2Impl
->
filename
,
szFile
);
...
@@ -5301,7 +5298,7 @@ void WINAPI ClearCustData(LPCUSTDATA lpCust)
...
@@ -5301,7 +5298,7 @@ void WINAPI ClearCustData(LPCUSTDATA lpCust)
VariantClear
(
&
lpCust
->
prgCustData
[
i
].
varValue
);
VariantClear
(
&
lpCust
->
prgCustData
[
i
].
varValue
);
/* FIXME - Should be using a per-thread IMalloc */
/* FIXME - Should be using a per-thread IMalloc */
HeapFree
(
GetProcessHeap
(),
0
,
lpCust
->
prgCustData
);
heap_free
(
lpCust
->
prgCustData
);
lpCust
->
prgCustData
=
NULL
;
lpCust
->
prgCustData
=
NULL
;
}
}
lpCust
->
cCustData
=
0
;
lpCust
->
cCustData
=
0
;
...
...
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