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
caf39cd1
Commit
caf39cd1
authored
Nov 17, 2022
by
Alex Henrie
Committed by
Alexandre Julliard
Nov 18, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
sapi: Use standard C functions for memory allocation in token.c.
parent
cce78c24
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
37 deletions
+22
-37
sapi_private.h
dlls/sapi/sapi_private.h
+0
-15
token.c
dlls/sapi/token.c
+22
-22
No files found.
dlls/sapi/sapi_private.h
View file @
caf39cd1
...
@@ -28,18 +28,3 @@ HRESULT speech_voice_create( IUnknown *outer, REFIID iid, void **obj ) DECLSPEC_
...
@@ -28,18 +28,3 @@ HRESULT speech_voice_create( IUnknown *outer, REFIID iid, void **obj ) DECLSPEC_
HRESULT
token_category_create
(
IUnknown
*
outer
,
REFIID
iid
,
void
**
obj
)
DECLSPEC_HIDDEN
;
HRESULT
token_category_create
(
IUnknown
*
outer
,
REFIID
iid
,
void
**
obj
)
DECLSPEC_HIDDEN
;
HRESULT
token_enum_create
(
IUnknown
*
outer
,
REFIID
iid
,
void
**
obj
)
DECLSPEC_HIDDEN
;
HRESULT
token_enum_create
(
IUnknown
*
outer
,
REFIID
iid
,
void
**
obj
)
DECLSPEC_HIDDEN
;
HRESULT
token_create
(
IUnknown
*
outer
,
REFIID
iid
,
void
**
obj
)
DECLSPEC_HIDDEN
;
HRESULT
token_create
(
IUnknown
*
outer
,
REFIID
iid
,
void
**
obj
)
DECLSPEC_HIDDEN
;
static
inline
LPWSTR
heap_strdupW
(
LPCWSTR
str
)
{
LPWSTR
ret
=
NULL
;
DWORD
size
;
if
(
str
)
{
size
=
(
lstrlenW
(
str
)
+
1
)
*
sizeof
(
WCHAR
);
ret
=
heap_alloc
(
size
);
if
(
ret
)
memcpy
(
ret
,
str
,
size
);
}
return
ret
;
}
dlls/sapi/token.c
View file @
caf39cd1
...
@@ -101,7 +101,7 @@ static ULONG WINAPI data_key_Release( ISpRegDataKey *iface )
...
@@ -101,7 +101,7 @@ static ULONG WINAPI data_key_Release( ISpRegDataKey *iface )
if
(
!
ref
)
if
(
!
ref
)
{
{
if
(
This
->
key
)
RegCloseKey
(
This
->
key
);
if
(
This
->
key
)
RegCloseKey
(
This
->
key
);
heap_
free
(
This
);
free
(
This
);
}
}
return
ref
;
return
ref
;
...
@@ -270,7 +270,7 @@ const struct ISpRegDataKeyVtbl data_key_vtbl =
...
@@ -270,7 +270,7 @@ const struct ISpRegDataKeyVtbl data_key_vtbl =
HRESULT
data_key_create
(
IUnknown
*
outer
,
REFIID
iid
,
void
**
obj
)
HRESULT
data_key_create
(
IUnknown
*
outer
,
REFIID
iid
,
void
**
obj
)
{
{
struct
data_key
*
This
=
heap_
alloc
(
sizeof
(
*
This
)
);
struct
data_key
*
This
=
m
alloc
(
sizeof
(
*
This
)
);
HRESULT
hr
;
HRESULT
hr
;
if
(
!
This
)
return
E_OUTOFMEMORY
;
if
(
!
This
)
return
E_OUTOFMEMORY
;
...
@@ -338,7 +338,7 @@ static ULONG WINAPI token_category_Release( ISpObjectTokenCategory *iface )
...
@@ -338,7 +338,7 @@ static ULONG WINAPI token_category_Release( ISpObjectTokenCategory *iface )
if
(
!
ref
)
if
(
!
ref
)
{
{
if
(
This
->
data_key
)
ISpRegDataKey_Release
(
This
->
data_key
);
if
(
This
->
data_key
)
ISpRegDataKey_Release
(
This
->
data_key
);
heap_
free
(
This
);
free
(
This
);
}
}
return
ref
;
return
ref
;
}
}
...
@@ -637,7 +637,7 @@ const struct ISpObjectTokenCategoryVtbl token_category_vtbl =
...
@@ -637,7 +637,7 @@ const struct ISpObjectTokenCategoryVtbl token_category_vtbl =
HRESULT
token_category_create
(
IUnknown
*
outer
,
REFIID
iid
,
void
**
obj
)
HRESULT
token_category_create
(
IUnknown
*
outer
,
REFIID
iid
,
void
**
obj
)
{
{
struct
token_category
*
This
=
heap_
alloc
(
sizeof
(
*
This
)
);
struct
token_category
*
This
=
m
alloc
(
sizeof
(
*
This
)
);
HRESULT
hr
;
HRESULT
hr
;
if
(
!
This
)
return
E_OUTOFMEMORY
;
if
(
!
This
)
return
E_OUTOFMEMORY
;
...
@@ -692,9 +692,9 @@ static ULONG WINAPI token_enum_Release( ISpObjectTokenEnumBuilder *iface )
...
@@ -692,9 +692,9 @@ static ULONG WINAPI token_enum_Release( ISpObjectTokenEnumBuilder *iface )
{
{
if
(
This
->
key
)
if
(
This
->
key
)
RegCloseKey
(
This
->
key
);
RegCloseKey
(
This
->
key
);
heap_
free
(
This
->
req
);
free
(
This
->
req
);
heap_
free
(
This
->
opt
);
free
(
This
->
opt
);
heap_
free
(
This
);
free
(
This
);
}
}
return
ref
;
return
ref
;
...
@@ -721,14 +721,14 @@ static HRESULT WINAPI token_enum_Next( ISpObjectTokenEnumBuilder *iface,
...
@@ -721,14 +721,14 @@ static HRESULT WINAPI token_enum_Next( ISpObjectTokenEnumBuilder *iface,
RegQueryInfoKeyW
(
This
->
key
,
NULL
,
NULL
,
NULL
,
NULL
,
&
size
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
);
RegQueryInfoKeyW
(
This
->
key
,
NULL
,
NULL
,
NULL
,
NULL
,
&
size
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
);
size
=
(
size
+
1
)
*
sizeof
(
WCHAR
);
size
=
(
size
+
1
)
*
sizeof
(
WCHAR
);
subkey_name
=
heap_alloc
(
size
);
subkey_name
=
malloc
(
size
);
if
(
!
subkey_name
)
if
(
!
subkey_name
)
return
E_OUTOFMEMORY
;
return
E_OUTOFMEMORY
;
retCode
=
RegEnumKeyExW
(
This
->
key
,
This
->
index
,
subkey_name
,
&
size
,
NULL
,
NULL
,
NULL
,
NULL
);
retCode
=
RegEnumKeyExW
(
This
->
key
,
This
->
index
,
subkey_name
,
&
size
,
NULL
,
NULL
,
NULL
,
NULL
);
if
(
retCode
!=
ERROR_SUCCESS
)
if
(
retCode
!=
ERROR_SUCCESS
)
{
{
heap_free
(
subkey_name
);
free
(
subkey_name
);
return
S_FALSE
;
return
S_FALSE
;
}
}
...
@@ -736,14 +736,14 @@ static HRESULT WINAPI token_enum_Next( ISpObjectTokenEnumBuilder *iface,
...
@@ -736,14 +736,14 @@ static HRESULT WINAPI token_enum_Next( ISpObjectTokenEnumBuilder *iface,
if
(
RegOpenKeyExW
(
This
->
key
,
subkey_name
,
0
,
KEY_READ
,
&
sub_key
)
!=
ERROR_SUCCESS
)
if
(
RegOpenKeyExW
(
This
->
key
,
subkey_name
,
0
,
KEY_READ
,
&
sub_key
)
!=
ERROR_SUCCESS
)
{
{
heap_free
(
subkey_name
);
free
(
subkey_name
);
return
E_FAIL
;
return
E_FAIL
;
}
}
hr
=
token_create
(
NULL
,
&
IID_ISpObjectToken
,
(
void
**
)
tokens
);
hr
=
token_create
(
NULL
,
&
IID_ISpObjectToken
,
(
void
**
)
tokens
);
if
(
FAILED
(
hr
))
if
(
FAILED
(
hr
))
{
{
heap_free
(
subkey_name
);
free
(
subkey_name
);
return
hr
;
return
hr
;
}
}
...
@@ -794,28 +794,28 @@ static HRESULT WINAPI token_enum_Item( ISpObjectTokenEnumBuilder *iface,
...
@@ -794,28 +794,28 @@ static HRESULT WINAPI token_enum_Item( ISpObjectTokenEnumBuilder *iface,
RegQueryInfoKeyW
(
This
->
key
,
NULL
,
NULL
,
NULL
,
NULL
,
&
size
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
);
RegQueryInfoKeyW
(
This
->
key
,
NULL
,
NULL
,
NULL
,
NULL
,
&
size
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
);
size
=
(
size
+
1
)
*
sizeof
(
WCHAR
);
size
=
(
size
+
1
)
*
sizeof
(
WCHAR
);
subkey
=
heap_alloc
(
size
);
subkey
=
malloc
(
size
);
if
(
!
subkey
)
if
(
!
subkey
)
return
E_OUTOFMEMORY
;
return
E_OUTOFMEMORY
;
ret
=
RegEnumKeyExW
(
This
->
key
,
index
,
subkey
,
&
size
,
NULL
,
NULL
,
NULL
,
NULL
);
ret
=
RegEnumKeyExW
(
This
->
key
,
index
,
subkey
,
&
size
,
NULL
,
NULL
,
NULL
,
NULL
);
if
(
ret
!=
ERROR_SUCCESS
)
if
(
ret
!=
ERROR_SUCCESS
)
{
{
heap_free
(
subkey
);
free
(
subkey
);
return
HRESULT_FROM_WIN32
(
ret
);
return
HRESULT_FROM_WIN32
(
ret
);
}
}
ret
=
RegOpenKeyExW
(
This
->
key
,
subkey
,
0
,
KEY_READ
,
&
key
);
ret
=
RegOpenKeyExW
(
This
->
key
,
subkey
,
0
,
KEY_READ
,
&
key
);
if
(
ret
!=
ERROR_SUCCESS
)
if
(
ret
!=
ERROR_SUCCESS
)
{
{
heap_free
(
subkey
);
free
(
subkey
);
return
HRESULT_FROM_WIN32
(
ret
);
return
HRESULT_FROM_WIN32
(
ret
);
}
}
hr
=
token_create
(
NULL
,
&
IID_ISpObjectToken
,
(
void
**
)
&
subtoken
);
hr
=
token_create
(
NULL
,
&
IID_ISpObjectToken
,
(
void
**
)
&
subtoken
);
if
(
FAILED
(
hr
))
if
(
FAILED
(
hr
))
{
{
heap_free
(
subkey
);
free
(
subkey
);
return
hr
;
return
hr
;
}
}
...
@@ -852,13 +852,13 @@ static HRESULT WINAPI token_enum_SetAttribs( ISpObjectTokenEnumBuilder *iface,
...
@@ -852,13 +852,13 @@ static HRESULT WINAPI token_enum_SetAttribs( ISpObjectTokenEnumBuilder *iface,
if
(
req
)
if
(
req
)
{
{
This
->
req
=
heap_strdupW
(
req
);
This
->
req
=
wcsdup
(
req
);
if
(
!
This
->
req
)
goto
out_of_mem
;
if
(
!
This
->
req
)
goto
out_of_mem
;
}
}
if
(
opt
)
if
(
opt
)
{
{
This
->
opt
=
heap_strdupW
(
opt
);
This
->
opt
=
wcsdup
(
opt
);
if
(
!
This
->
opt
)
goto
out_of_mem
;
if
(
!
This
->
opt
)
goto
out_of_mem
;
}
}
...
@@ -866,7 +866,7 @@ static HRESULT WINAPI token_enum_SetAttribs( ISpObjectTokenEnumBuilder *iface,
...
@@ -866,7 +866,7 @@ static HRESULT WINAPI token_enum_SetAttribs( ISpObjectTokenEnumBuilder *iface,
return
S_OK
;
return
S_OK
;
out_of_mem:
out_of_mem:
heap_
free
(
This
->
req
);
free
(
This
->
req
);
return
E_OUTOFMEMORY
;
return
E_OUTOFMEMORY
;
}
}
...
@@ -919,7 +919,7 @@ const struct ISpObjectTokenEnumBuilderVtbl token_enum_vtbl =
...
@@ -919,7 +919,7 @@ const struct ISpObjectTokenEnumBuilderVtbl token_enum_vtbl =
HRESULT
token_enum_create
(
IUnknown
*
outer
,
REFIID
iid
,
void
**
obj
)
HRESULT
token_enum_create
(
IUnknown
*
outer
,
REFIID
iid
,
void
**
obj
)
{
{
struct
token_enum
*
This
=
heap_
alloc
(
sizeof
(
*
This
)
);
struct
token_enum
*
This
=
m
alloc
(
sizeof
(
*
This
)
);
HRESULT
hr
;
HRESULT
hr
;
if
(
!
This
)
return
E_OUTOFMEMORY
;
if
(
!
This
)
return
E_OUTOFMEMORY
;
...
@@ -978,8 +978,8 @@ static ULONG WINAPI token_Release( ISpObjectToken *iface )
...
@@ -978,8 +978,8 @@ static ULONG WINAPI token_Release( ISpObjectToken *iface )
if
(
!
ref
)
if
(
!
ref
)
{
{
if
(
This
->
token_key
)
RegCloseKey
(
This
->
token_key
);
if
(
This
->
token_key
)
RegCloseKey
(
This
->
token_key
);
free
(
This
->
token_id
);
free
(
This
->
token_id
);
heap_
free
(
This
);
free
(
This
);
}
}
return
ref
;
return
ref
;
...
@@ -1265,7 +1265,7 @@ const struct ISpObjectTokenVtbl token_vtbl =
...
@@ -1265,7 +1265,7 @@ const struct ISpObjectTokenVtbl token_vtbl =
HRESULT
token_create
(
IUnknown
*
outer
,
REFIID
iid
,
void
**
obj
)
HRESULT
token_create
(
IUnknown
*
outer
,
REFIID
iid
,
void
**
obj
)
{
{
struct
object_token
*
This
=
heap_
alloc
(
sizeof
(
*
This
)
);
struct
object_token
*
This
=
m
alloc
(
sizeof
(
*
This
)
);
HRESULT
hr
;
HRESULT
hr
;
if
(
!
This
)
return
E_OUTOFMEMORY
;
if
(
!
This
)
return
E_OUTOFMEMORY
;
...
...
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