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
7abcc312
Commit
7abcc312
authored
Aug 16, 2023
by
Alex Henrie
Committed by
Alexandre Julliard
Aug 17, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
advapi32: Use CRT allocation functions.
parent
fd67d678
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
107 additions
and
108 deletions
+107
-108
advapi.c
dlls/advapi32/advapi.c
+3
-3
advapi32_misc.h
dlls/advapi32/advapi32_misc.h
+1
-2
cred.c
dlls/advapi32/cred.c
+0
-0
eventlog.c
dlls/advapi32/eventlog.c
+9
-9
lsa.c
dlls/advapi32/lsa.c
+30
-30
security.c
dlls/advapi32/security.c
+48
-48
service.c
dlls/advapi32/service.c
+16
-16
No files found.
dlls/advapi32/advapi.c
View file @
7abcc312
...
@@ -252,9 +252,9 @@ BOOL WINAPI LogonUserA( LPCSTR lpszUsername, LPCSTR lpszDomain, LPCSTR lpszPassw
...
@@ -252,9 +252,9 @@ BOOL WINAPI LogonUserA( LPCSTR lpszUsername, LPCSTR lpszDomain, LPCSTR lpszPassw
ret
=
LogonUserW
(
usernameW
,
domainW
,
passwordW
,
dwLogonType
,
dwLogonProvider
,
phToken
);
ret
=
LogonUserW
(
usernameW
,
domainW
,
passwordW
,
dwLogonType
,
dwLogonProvider
,
phToken
);
done:
done:
heap_
free
(
usernameW
);
free
(
usernameW
);
heap_
free
(
domainW
);
free
(
domainW
);
heap_
free
(
passwordW
);
free
(
passwordW
);
return
ret
;
return
ret
;
}
}
...
...
dlls/advapi32/advapi32_misc.h
View file @
7abcc312
...
@@ -23,7 +23,6 @@
...
@@ -23,7 +23,6 @@
#include "ntsecapi.h"
#include "ntsecapi.h"
#include "winsvc.h"
#include "winsvc.h"
#include "winnls.h"
#include "winnls.h"
#include "wine/heap.h"
const
char
*
debugstr_sid
(
PSID
sid
);
const
char
*
debugstr_sid
(
PSID
sid
);
BOOL
ADVAPI_IsLocalComputer
(
LPCWSTR
ServerName
);
BOOL
ADVAPI_IsLocalComputer
(
LPCWSTR
ServerName
);
...
@@ -41,7 +40,7 @@ static inline WCHAR *strdupAW( const char *src )
...
@@ -41,7 +40,7 @@ static inline WCHAR *strdupAW( const char *src )
if
(
src
)
if
(
src
)
{
{
DWORD
len
=
MultiByteToWideChar
(
CP_ACP
,
0
,
src
,
-
1
,
NULL
,
0
);
DWORD
len
=
MultiByteToWideChar
(
CP_ACP
,
0
,
src
,
-
1
,
NULL
,
0
);
if
((
dst
=
heap_
alloc
(
len
*
sizeof
(
WCHAR
)
)))
MultiByteToWideChar
(
CP_ACP
,
0
,
src
,
-
1
,
dst
,
len
);
if
((
dst
=
m
alloc
(
len
*
sizeof
(
WCHAR
)
)))
MultiByteToWideChar
(
CP_ACP
,
0
,
src
,
-
1
,
dst
,
len
);
}
}
return
dst
;
return
dst
;
}
}
...
...
dlls/advapi32/cred.c
View file @
7abcc312
This diff is collapsed.
Click to expand it.
dlls/advapi32/eventlog.c
View file @
7abcc312
...
@@ -58,7 +58,7 @@ BOOL WINAPI BackupEventLogA( HANDLE hEventLog, LPCSTR lpBackupFileName )
...
@@ -58,7 +58,7 @@ BOOL WINAPI BackupEventLogA( HANDLE hEventLog, LPCSTR lpBackupFileName )
backupW
=
strdupAW
(
lpBackupFileName
);
backupW
=
strdupAW
(
lpBackupFileName
);
ret
=
BackupEventLogW
(
hEventLog
,
backupW
);
ret
=
BackupEventLogW
(
hEventLog
,
backupW
);
heap_
free
(
backupW
);
free
(
backupW
);
return
ret
;
return
ret
;
}
}
...
@@ -115,7 +115,7 @@ BOOL WINAPI ClearEventLogA( HANDLE hEventLog, LPCSTR lpBackupFileName )
...
@@ -115,7 +115,7 @@ BOOL WINAPI ClearEventLogA( HANDLE hEventLog, LPCSTR lpBackupFileName )
backupW
=
strdupAW
(
lpBackupFileName
);
backupW
=
strdupAW
(
lpBackupFileName
);
ret
=
ClearEventLogW
(
hEventLog
,
backupW
);
ret
=
ClearEventLogW
(
hEventLog
,
backupW
);
heap_
free
(
backupW
);
free
(
backupW
);
return
ret
;
return
ret
;
}
}
...
@@ -394,8 +394,8 @@ HANDLE WINAPI OpenBackupEventLogA( LPCSTR lpUNCServerName, LPCSTR lpFileName )
...
@@ -394,8 +394,8 @@ HANDLE WINAPI OpenBackupEventLogA( LPCSTR lpUNCServerName, LPCSTR lpFileName )
uncnameW
=
strdupAW
(
lpUNCServerName
);
uncnameW
=
strdupAW
(
lpUNCServerName
);
filenameW
=
strdupAW
(
lpFileName
);
filenameW
=
strdupAW
(
lpFileName
);
handle
=
OpenBackupEventLogW
(
uncnameW
,
filenameW
);
handle
=
OpenBackupEventLogW
(
uncnameW
,
filenameW
);
heap_
free
(
uncnameW
);
free
(
uncnameW
);
heap_
free
(
filenameW
);
free
(
filenameW
);
return
handle
;
return
handle
;
}
}
...
@@ -453,8 +453,8 @@ HANDLE WINAPI OpenEventLogA( LPCSTR uncname, LPCSTR source )
...
@@ -453,8 +453,8 @@ HANDLE WINAPI OpenEventLogA( LPCSTR uncname, LPCSTR source )
uncnameW
=
strdupAW
(
uncname
);
uncnameW
=
strdupAW
(
uncname
);
sourceW
=
strdupAW
(
source
);
sourceW
=
strdupAW
(
source
);
handle
=
OpenEventLogW
(
uncnameW
,
sourceW
);
handle
=
OpenEventLogW
(
uncnameW
,
sourceW
);
heap_
free
(
uncnameW
);
free
(
uncnameW
);
heap_
free
(
sourceW
);
free
(
sourceW
);
return
handle
;
return
handle
;
}
}
...
@@ -608,7 +608,7 @@ BOOL WINAPI ReportEventA ( HANDLE hEventLog, WORD wType, WORD wCategory, DWORD d
...
@@ -608,7 +608,7 @@ BOOL WINAPI ReportEventA ( HANDLE hEventLog, WORD wType, WORD wCategory, DWORD d
if
(
wNumStrings
==
0
)
return
TRUE
;
if
(
wNumStrings
==
0
)
return
TRUE
;
if
(
!
lpStrings
)
return
TRUE
;
if
(
!
lpStrings
)
return
TRUE
;
wideStrArray
=
heap_alloc
(
sizeof
(
LPWSTR
)
*
wNumStrings
);
wideStrArray
=
malloc
(
sizeof
(
WCHAR
*
)
*
wNumStrings
);
for
(
i
=
0
;
i
<
wNumStrings
;
i
++
)
for
(
i
=
0
;
i
<
wNumStrings
;
i
++
)
{
{
RtlCreateUnicodeStringFromAsciiz
(
&
str
,
lpStrings
[
i
]);
RtlCreateUnicodeStringFromAsciiz
(
&
str
,
lpStrings
[
i
]);
...
@@ -617,8 +617,8 @@ BOOL WINAPI ReportEventA ( HANDLE hEventLog, WORD wType, WORD wCategory, DWORD d
...
@@ -617,8 +617,8 @@ BOOL WINAPI ReportEventA ( HANDLE hEventLog, WORD wType, WORD wCategory, DWORD d
ret
=
ReportEventW
(
hEventLog
,
wType
,
wCategory
,
dwEventID
,
lpUserSid
,
ret
=
ReportEventW
(
hEventLog
,
wType
,
wCategory
,
dwEventID
,
lpUserSid
,
wNumStrings
,
dwDataSize
,
(
LPCWSTR
*
)
wideStrArray
,
lpRawData
);
wNumStrings
,
dwDataSize
,
(
LPCWSTR
*
)
wideStrArray
,
lpRawData
);
for
(
i
=
0
;
i
<
wNumStrings
;
i
++
)
for
(
i
=
0
;
i
<
wNumStrings
;
i
++
)
heap_free
(
wideStrArray
[
i
]
);
free
(
wideStrArray
[
i
]
);
heap_
free
(
wideStrArray
);
free
(
wideStrArray
);
return
ret
;
return
ret
;
}
}
...
...
dlls/advapi32/lsa.c
View file @
7abcc312
...
@@ -103,7 +103,7 @@ static void* ADVAPI_GetDomainName(unsigned sz, unsigned ofs)
...
@@ -103,7 +103,7 @@ static void* ADVAPI_GetDomainName(unsigned sz, unsigned ofs)
ret
=
RegQueryValueExW
(
key
,
L"Workgroup"
,
NULL
,
NULL
,
NULL
,
&
size
);
ret
=
RegQueryValueExW
(
key
,
L"Workgroup"
,
NULL
,
NULL
,
NULL
,
&
size
);
if
(
ret
==
ERROR_MORE_DATA
||
ret
==
ERROR_SUCCESS
)
if
(
ret
==
ERROR_MORE_DATA
||
ret
==
ERROR_SUCCESS
)
{
{
ptr
=
heap_alloc_zero
(
sz
+
size
);
ptr
=
calloc
(
1
,
sz
+
size
);
if
(
!
ptr
)
return
NULL
;
if
(
!
ptr
)
return
NULL
;
ustr
=
(
UNICODE_STRING
*
)(
ptr
+
ofs
);
ustr
=
(
UNICODE_STRING
*
)(
ptr
+
ofs
);
ustr
->
MaximumLength
=
size
;
ustr
->
MaximumLength
=
size
;
...
@@ -111,16 +111,16 @@ static void* ADVAPI_GetDomainName(unsigned sz, unsigned ofs)
...
@@ -111,16 +111,16 @@ static void* ADVAPI_GetDomainName(unsigned sz, unsigned ofs)
ret
=
RegQueryValueExW
(
key
,
L"Workgroup"
,
NULL
,
NULL
,
(
LPBYTE
)
ustr
->
Buffer
,
&
size
);
ret
=
RegQueryValueExW
(
key
,
L"Workgroup"
,
NULL
,
NULL
,
(
LPBYTE
)
ustr
->
Buffer
,
&
size
);
if
(
ret
!=
ERROR_SUCCESS
)
if
(
ret
!=
ERROR_SUCCESS
)
{
{
heap_
free
(
ptr
);
free
(
ptr
);
ptr
=
NULL
;
ptr
=
NULL
;
}
}
else
ustr
->
Length
=
size
-
sizeof
(
WCHAR
);
else
ustr
->
Length
=
size
-
sizeof
(
WCHAR
);
}
}
RegCloseKey
(
key
);
RegCloseKey
(
key
);
}
}
if
(
!
ptr
)
if
(
!
ptr
)
{
{
ptr
=
heap_alloc_zero
(
sz
+
sizeof
(
L"DOMAIN"
));
ptr
=
calloc
(
1
,
sz
+
sizeof
(
L"DOMAIN"
));
if
(
!
ptr
)
return
NULL
;
if
(
!
ptr
)
return
NULL
;
ustr
=
(
UNICODE_STRING
*
)(
ptr
+
ofs
);
ustr
=
(
UNICODE_STRING
*
)(
ptr
+
ofs
);
ustr
->
MaximumLength
=
sizeof
(
L"DOMAIN"
);
ustr
->
MaximumLength
=
sizeof
(
L"DOMAIN"
);
...
@@ -144,7 +144,7 @@ NTSTATUS WINAPI LsaGetUserName(PUNICODE_STRING *user_name, PUNICODE_STRING *doma
...
@@ -144,7 +144,7 @@ NTSTATUS WINAPI LsaGetUserName(PUNICODE_STRING *user_name, PUNICODE_STRING *doma
if
(
GetUserNameW
(
NULL
,
&
user_size
)
||
GetLastError
()
!=
ERROR_INSUFFICIENT_BUFFER
)
if
(
GetUserNameW
(
NULL
,
&
user_size
)
||
GetLastError
()
!=
ERROR_INSUFFICIENT_BUFFER
)
return
STATUS_UNSUCCESSFUL
;
return
STATUS_UNSUCCESSFUL
;
user
=
heap_
alloc
(
sizeof
(
*
user
)
+
user_size
*
sizeof
(
WCHAR
));
user
=
m
alloc
(
sizeof
(
*
user
)
+
user_size
*
sizeof
(
WCHAR
));
if
(
!
user
)
return
STATUS_NO_MEMORY
;
if
(
!
user
)
return
STATUS_NO_MEMORY
;
user
->
Buffer
=
(
WCHAR
*
)(
user
+
1
);
user
->
Buffer
=
(
WCHAR
*
)(
user
+
1
);
...
@@ -152,7 +152,7 @@ NTSTATUS WINAPI LsaGetUserName(PUNICODE_STRING *user_name, PUNICODE_STRING *doma
...
@@ -152,7 +152,7 @@ NTSTATUS WINAPI LsaGetUserName(PUNICODE_STRING *user_name, PUNICODE_STRING *doma
user
->
Length
=
user
->
MaximumLength
-
sizeof
(
WCHAR
);
user
->
Length
=
user
->
MaximumLength
-
sizeof
(
WCHAR
);
if
(
!
GetUserNameW
(
user
->
Buffer
,
&
user_size
))
if
(
!
GetUserNameW
(
user
->
Buffer
,
&
user_size
))
{
{
heap_
free
(
user
);
free
(
user
);
return
STATUS_UNSUCCESSFUL
;
return
STATUS_UNSUCCESSFUL
;
}
}
...
@@ -165,14 +165,14 @@ NTSTATUS WINAPI LsaGetUserName(PUNICODE_STRING *user_name, PUNICODE_STRING *doma
...
@@ -165,14 +165,14 @@ NTSTATUS WINAPI LsaGetUserName(PUNICODE_STRING *user_name, PUNICODE_STRING *doma
domain_size
=
ARRAY_SIZE
(
computer
);
domain_size
=
ARRAY_SIZE
(
computer
);
if
(
!
GetComputerNameW
(
computer
,
&
domain_size
))
if
(
!
GetComputerNameW
(
computer
,
&
domain_size
))
{
{
heap_
free
(
user
);
free
(
user
);
return
STATUS_UNSUCCESSFUL
;
return
STATUS_UNSUCCESSFUL
;
}
}
domain
=
heap_
alloc
(
sizeof
(
*
domain
)
+
(
domain_size
+
1
)
*
sizeof
(
WCHAR
));
domain
=
m
alloc
(
sizeof
(
*
domain
)
+
(
domain_size
+
1
)
*
sizeof
(
WCHAR
));
if
(
!
domain
)
if
(
!
domain
)
{
{
heap_
free
(
user
);
free
(
user
);
return
STATUS_NO_MEMORY
;
return
STATUS_NO_MEMORY
;
}
}
...
@@ -362,7 +362,7 @@ NTSTATUS WINAPI LsaFreeMemory(IN PVOID Buffer)
...
@@ -362,7 +362,7 @@ NTSTATUS WINAPI LsaFreeMemory(IN PVOID Buffer)
{
{
TRACE
(
"(%p)
\n
"
,
Buffer
);
TRACE
(
"(%p)
\n
"
,
Buffer
);
heap_
free
(
Buffer
);
free
(
Buffer
);
return
STATUS_SUCCESS
;
return
STATUS_SUCCESS
;
}
}
...
@@ -497,22 +497,22 @@ NTSTATUS WINAPI LsaLookupNames2( LSA_HANDLE policy, ULONG flags, ULONG count,
...
@@ -497,22 +497,22 @@ NTSTATUS WINAPI LsaLookupNames2( LSA_HANDLE policy, ULONG flags, ULONG count,
TRACE
(
"mapped %lu out of %lu
\n
"
,
mapped
,
count
);
TRACE
(
"mapped %lu out of %lu
\n
"
,
mapped
,
count
);
size
=
sizeof
(
LSA_TRANSLATED_SID2
)
*
count
+
sid_size_total
;
size
=
sizeof
(
LSA_TRANSLATED_SID2
)
*
count
+
sid_size_total
;
if
(
!
(
*
sids
=
heap_
alloc
(
size
)))
return
STATUS_NO_MEMORY
;
if
(
!
(
*
sids
=
m
alloc
(
size
)))
return
STATUS_NO_MEMORY
;
sid
=
(
SID
*
)(
*
sids
+
count
);
sid
=
(
SID
*
)(
*
sids
+
count
);
/* use maximum domain count */
/* use maximum domain count */
if
(
!
(
*
domains
=
heap_alloc
(
sizeof
(
LSA_REFERENCED_DOMAIN_LIST
)
+
sizeof
(
LSA_TRUST_INFORMATION
)
*
count
+
if
(
!
(
*
domains
=
malloc
(
sizeof
(
LSA_REFERENCED_DOMAIN_LIST
)
+
sizeof
(
LSA_TRUST_INFORMATION
)
*
count
+
sid_size_total
+
domainname_size_total
*
sizeof
(
WCHAR
))))
sid_size_total
+
domainname_size_total
*
sizeof
(
WCHAR
))))
{
{
heap_
free
(
*
sids
);
free
(
*
sids
);
return
STATUS_NO_MEMORY
;
return
STATUS_NO_MEMORY
;
}
}
(
*
domains
)
->
Entries
=
0
;
(
*
domains
)
->
Entries
=
0
;
(
*
domains
)
->
Domains
=
(
LSA_TRUST_INFORMATION
*
)((
char
*
)
*
domains
+
sizeof
(
LSA_REFERENCED_DOMAIN_LIST
));
(
*
domains
)
->
Domains
=
(
LSA_TRUST_INFORMATION
*
)((
char
*
)
*
domains
+
sizeof
(
LSA_REFERENCED_DOMAIN_LIST
));
domain_data
=
(
char
*
)(
*
domains
)
->
Domains
+
sizeof
(
LSA_TRUST_INFORMATION
)
*
count
;
domain_data
=
(
char
*
)(
*
domains
)
->
Domains
+
sizeof
(
LSA_TRUST_INFORMATION
)
*
count
;
domain
.
Buffer
=
heap_alloc
(
domain_size_max
*
sizeof
(
WCHAR
));
domain
.
Buffer
=
malloc
(
domain_size_max
*
sizeof
(
WCHAR
));
for
(
i
=
0
;
i
<
count
;
i
++
)
for
(
i
=
0
;
i
<
count
;
i
++
)
{
{
domain
.
Length
=
domain_size_max
*
sizeof
(
WCHAR
);
domain
.
Length
=
domain_size_max
*
sizeof
(
WCHAR
);
...
@@ -541,7 +541,7 @@ NTSTATUS WINAPI LsaLookupNames2( LSA_HANDLE policy, ULONG flags, ULONG count,
...
@@ -541,7 +541,7 @@ NTSTATUS WINAPI LsaLookupNames2( LSA_HANDLE policy, ULONG flags, ULONG count,
}
}
}
}
}
}
heap_
free
(
domain
.
Buffer
);
free
(
domain
.
Buffer
);
if
(
mapped
==
count
)
return
STATUS_SUCCESS
;
if
(
mapped
==
count
)
return
STATUS_SUCCESS
;
if
(
mapped
>
0
&&
mapped
<
count
)
return
STATUS_SOME_NOT_MAPPED
;
if
(
mapped
>
0
&&
mapped
<
count
)
return
STATUS_SOME_NOT_MAPPED
;
...
@@ -584,13 +584,13 @@ NTSTATUS WINAPI LsaLookupSids(
...
@@ -584,13 +584,13 @@ NTSTATUS WINAPI LsaLookupSids(
/* this length does not include actual string length yet */
/* this length does not include actual string length yet */
name_fullsize
=
sizeof
(
LSA_TRANSLATED_NAME
)
*
Count
;
name_fullsize
=
sizeof
(
LSA_TRANSLATED_NAME
)
*
Count
;
if
(
!
(
*
Names
=
heap_
alloc
(
name_fullsize
)))
return
STATUS_NO_MEMORY
;
if
(
!
(
*
Names
=
m
alloc
(
name_fullsize
)))
return
STATUS_NO_MEMORY
;
/* maximum count of stored domain infos is Count, allocate it like that cause really needed
/* maximum count of stored domain infos is Count, allocate it like that cause really needed
count could only be computed after sid data is retrieved */
count could only be computed after sid data is retrieved */
domain_fullsize
=
sizeof
(
LSA_REFERENCED_DOMAIN_LIST
)
+
sizeof
(
LSA_TRUST_INFORMATION
)
*
Count
;
domain_fullsize
=
sizeof
(
LSA_REFERENCED_DOMAIN_LIST
)
+
sizeof
(
LSA_TRUST_INFORMATION
)
*
Count
;
if
(
!
(
*
ReferencedDomains
=
heap_
alloc
(
domain_fullsize
)))
if
(
!
(
*
ReferencedDomains
=
m
alloc
(
domain_fullsize
)))
{
{
heap_
free
(
*
Names
);
free
(
*
Names
);
return
STATUS_NO_MEMORY
;
return
STATUS_NO_MEMORY
;
}
}
(
*
ReferencedDomains
)
->
Entries
=
0
;
(
*
ReferencedDomains
)
->
Entries
=
0
;
...
@@ -633,7 +633,7 @@ NTSTATUS WINAPI LsaLookupSids(
...
@@ -633,7 +633,7 @@ NTSTATUS WINAPI LsaLookupSids(
domain_fullsize
+=
domain_size
*
sizeof
(
WCHAR
);
domain_fullsize
+=
domain_size
*
sizeof
(
WCHAR
);
/* get domain SID size too */
/* get domain SID size too */
name
=
heap_
alloc
(
domain_size
*
sizeof
(
WCHAR
));
name
=
m
alloc
(
domain_size
*
sizeof
(
WCHAR
));
*
name
=
0
;
*
name
=
0
;
LookupAccountSidW
(
NULL
,
Sids
[
i
],
NULL
,
&
name_size
,
name
,
&
domain_size
,
&
use
);
LookupAccountSidW
(
NULL
,
Sids
[
i
],
NULL
,
&
name_size
,
name
,
&
domain_size
,
&
use
);
...
@@ -644,7 +644,7 @@ NTSTATUS WINAPI LsaLookupSids(
...
@@ -644,7 +644,7 @@ NTSTATUS WINAPI LsaLookupSids(
lookup_name
(
&
domain
,
NULL
,
&
sid_size
,
NULL
,
&
domain_size
,
&
use
,
&
handled
);
lookup_name
(
&
domain
,
NULL
,
&
sid_size
,
NULL
,
&
domain_size
,
&
use
,
&
handled
);
domain_fullsize
+=
sid_size
;
domain_fullsize
+=
sid_size
;
heap_
free
(
name
);
free
(
name
);
}
}
else
else
{
{
...
@@ -665,10 +665,10 @@ NTSTATUS WINAPI LsaLookupSids(
...
@@ -665,10 +665,10 @@ NTSTATUS WINAPI LsaLookupSids(
}
}
/* now we have full length needed for both */
/* now we have full length needed for both */
*
Names
=
heap_
realloc
(
*
Names
,
name_fullsize
);
*
Names
=
realloc
(
*
Names
,
name_fullsize
);
name_buffer
=
(
WCHAR
*
)((
char
*
)
*
Names
+
sizeof
(
LSA_TRANSLATED_NAME
)
*
Count
);
name_buffer
=
(
WCHAR
*
)((
char
*
)
*
Names
+
sizeof
(
LSA_TRANSLATED_NAME
)
*
Count
);
*
ReferencedDomains
=
heap_
realloc
(
*
ReferencedDomains
,
domain_fullsize
);
*
ReferencedDomains
=
realloc
(
*
ReferencedDomains
,
domain_fullsize
);
/* fix pointer after reallocation */
/* fix pointer after reallocation */
(
*
ReferencedDomains
)
->
Domains
=
(
LSA_TRUST_INFORMATION
*
)((
char
*
)
*
ReferencedDomains
+
sizeof
(
LSA_REFERENCED_DOMAIN_LIST
));
(
*
ReferencedDomains
)
->
Domains
=
(
LSA_TRUST_INFORMATION
*
)((
char
*
)
*
ReferencedDomains
+
sizeof
(
LSA_REFERENCED_DOMAIN_LIST
));
domain_data
=
(
char
*
)(
*
ReferencedDomains
)
->
Domains
+
sizeof
(
LSA_TRUST_INFORMATION
)
*
Count
;
domain_data
=
(
char
*
)(
*
ReferencedDomains
)
->
Domains
+
sizeof
(
LSA_TRUST_INFORMATION
)
*
Count
;
...
@@ -697,13 +697,13 @@ NTSTATUS WINAPI LsaLookupSids(
...
@@ -697,13 +697,13 @@ NTSTATUS WINAPI LsaLookupSids(
domain
.
MaximumLength
=
sizeof
(
WCHAR
);
domain
.
MaximumLength
=
sizeof
(
WCHAR
);
}
}
domain
.
Buffer
=
heap_
alloc
(
domain
.
MaximumLength
);
domain
.
Buffer
=
m
alloc
(
domain
.
MaximumLength
);
LookupAccountSidW
(
NULL
,
Sids
[
i
],
(
*
Names
)[
i
].
Name
.
Buffer
,
&
name_size
,
domain
.
Buffer
,
&
domain_size
,
&
use
);
LookupAccountSidW
(
NULL
,
Sids
[
i
],
(
*
Names
)[
i
].
Name
.
Buffer
,
&
name_size
,
domain
.
Buffer
,
&
domain_size
,
&
use
);
(
*
Names
)[
i
].
Use
=
use
;
(
*
Names
)[
i
].
Use
=
use
;
(
*
Names
)[
i
].
DomainIndex
=
lsa_reflist_add_domain
(
*
ReferencedDomains
,
&
domain
,
&
domain_data
);
(
*
Names
)[
i
].
DomainIndex
=
lsa_reflist_add_domain
(
*
ReferencedDomains
,
&
domain
,
&
domain_data
);
heap_
free
(
domain
.
Buffer
);
free
(
domain
.
Buffer
);
}
}
else
if
(
ConvertSidToStringSidW
(
Sids
[
i
],
&
strsid
))
else
if
(
ConvertSidToStringSidW
(
Sids
[
i
],
&
strsid
))
{
{
...
@@ -813,7 +813,7 @@ NTSTATUS WINAPI LsaQueryInformationPolicy(
...
@@ -813,7 +813,7 @@ NTSTATUS WINAPI LsaQueryInformationPolicy(
{
{
case
PolicyAuditEventsInformation
:
/* 2 */
case
PolicyAuditEventsInformation
:
/* 2 */
{
{
PPOLICY_AUDIT_EVENTS_INFO
p
=
heap_alloc_zero
(
sizeof
(
POLICY_AUDIT_EVENTS_INFO
));
PPOLICY_AUDIT_EVENTS_INFO
p
=
calloc
(
1
,
sizeof
(
POLICY_AUDIT_EVENTS_INFO
));
p
->
AuditingMode
=
FALSE
;
/* no auditing */
p
->
AuditingMode
=
FALSE
;
/* no auditing */
*
Buffer
=
p
;
*
Buffer
=
p
;
}
}
...
@@ -843,7 +843,7 @@ NTSTATUS WINAPI LsaQueryInformationPolicy(
...
@@ -843,7 +843,7 @@ NTSTATUS WINAPI LsaQueryInformationPolicy(
};
};
DWORD
dwSize
=
MAX_COMPUTERNAME_LENGTH
+
1
;
DWORD
dwSize
=
MAX_COMPUTERNAME_LENGTH
+
1
;
struct
di
*
xdi
=
heap_alloc_zero
(
sizeof
(
*
xdi
));
struct
di
*
xdi
=
calloc
(
1
,
sizeof
(
*
xdi
));
xdi
->
info
.
DomainName
.
MaximumLength
=
dwSize
*
sizeof
(
WCHAR
);
xdi
->
info
.
DomainName
.
MaximumLength
=
dwSize
*
sizeof
(
WCHAR
);
xdi
->
info
.
DomainName
.
Buffer
=
xdi
->
domain
;
xdi
->
info
.
DomainName
.
Buffer
=
xdi
->
domain
;
...
@@ -856,7 +856,7 @@ NTSTATUS WINAPI LsaQueryInformationPolicy(
...
@@ -856,7 +856,7 @@ NTSTATUS WINAPI LsaQueryInformationPolicy(
if
(
!
ADVAPI_GetComputerSid
(
&
xdi
->
sid
))
if
(
!
ADVAPI_GetComputerSid
(
&
xdi
->
sid
))
{
{
heap_
free
(
xdi
);
free
(
xdi
);
WARN
(
"Computer SID not found
\n
"
);
WARN
(
"Computer SID not found
\n
"
);
...
@@ -889,7 +889,7 @@ NTSTATUS WINAPI LsaQueryInformationPolicy(
...
@@ -889,7 +889,7 @@ NTSTATUS WINAPI LsaQueryInformationPolicy(
}
computer_sid
;
}
computer_sid
;
DWORD
dwSize
;
DWORD
dwSize
;
xdi
=
heap_alloc_zero
(
sizeof
(
*
xdi
));
xdi
=
calloc
(
1
,
sizeof
(
*
xdi
));
if
(
!
xdi
)
return
STATUS_NO_MEMORY
;
if
(
!
xdi
)
return
STATUS_NO_MEMORY
;
dwSize
=
256
;
dwSize
=
256
;
...
@@ -1156,7 +1156,7 @@ NTSTATUS WINAPI LsaLookupPrivilegeName(LSA_HANDLE handle, LUID *luid, LSA_UNICOD
...
@@ -1156,7 +1156,7 @@ NTSTATUS WINAPI LsaLookupPrivilegeName(LSA_HANDLE handle, LUID *luid, LSA_UNICOD
return
STATUS_NO_SUCH_PRIVILEGE
;
return
STATUS_NO_SUCH_PRIVILEGE
;
length
=
lstrlenW
(
privnameW
);
length
=
lstrlenW
(
privnameW
);
*
name
=
heap_
alloc
(
sizeof
(
**
name
)
+
(
length
+
1
)
*
sizeof
(
WCHAR
));
*
name
=
m
alloc
(
sizeof
(
**
name
)
+
(
length
+
1
)
*
sizeof
(
WCHAR
));
if
(
!*
name
)
if
(
!*
name
)
return
STATUS_NO_MEMORY
;
return
STATUS_NO_MEMORY
;
...
...
dlls/advapi32/security.c
View file @
7abcc312
This diff is collapsed.
Click to expand it.
dlls/advapi32/service.c
View file @
7abcc312
...
@@ -79,7 +79,7 @@ EnumServicesStatusA( SC_HANDLE hmngr, DWORD type, DWORD state, LPENUM_SERVICE_ST
...
@@ -79,7 +79,7 @@ EnumServicesStatusA( SC_HANDLE hmngr, DWORD type, DWORD state, LPENUM_SERVICE_ST
}
}
sz
=
max
(
2
*
size
,
sizeof
(
*
servicesW
)
);
sz
=
max
(
2
*
size
,
sizeof
(
*
servicesW
)
);
if
(
!
(
servicesW
=
heap_
alloc
(
sz
)))
if
(
!
(
servicesW
=
m
alloc
(
sz
)))
{
{
SetLastError
(
ERROR_NOT_ENOUGH_MEMORY
);
SetLastError
(
ERROR_NOT_ENOUGH_MEMORY
);
return
FALSE
;
return
FALSE
;
...
@@ -113,7 +113,7 @@ EnumServicesStatusA( SC_HANDLE hmngr, DWORD type, DWORD state, LPENUM_SERVICE_ST
...
@@ -113,7 +113,7 @@ EnumServicesStatusA( SC_HANDLE hmngr, DWORD type, DWORD state, LPENUM_SERVICE_ST
ret
=
TRUE
;
ret
=
TRUE
;
done:
done:
heap_
free
(
servicesW
);
free
(
servicesW
);
return
ret
;
return
ret
;
}
}
...
@@ -150,7 +150,7 @@ EnumServicesStatusW( SC_HANDLE manager, DWORD type, DWORD state, ENUM_SERVICE_ST
...
@@ -150,7 +150,7 @@ EnumServicesStatusW( SC_HANDLE manager, DWORD type, DWORD state, ENUM_SERVICE_ST
&&
GetLastError
()
!=
ERROR_MORE_DATA
)
&&
GetLastError
()
!=
ERROR_MORE_DATA
)
return
FALSE
;
return
FALSE
;
if
(
!
(
status_ex
=
heap_
alloc
(
alloc_size
)))
if
(
!
(
status_ex
=
m
alloc
(
alloc_size
)))
{
{
SetLastError
(
ERROR_NOT_ENOUGH_MEMORY
);
SetLastError
(
ERROR_NOT_ENOUGH_MEMORY
);
return
FALSE
;
return
FALSE
;
...
@@ -160,7 +160,7 @@ EnumServicesStatusW( SC_HANDLE manager, DWORD type, DWORD state, ENUM_SERVICE_ST
...
@@ -160,7 +160,7 @@ EnumServicesStatusW( SC_HANDLE manager, DWORD type, DWORD state, ENUM_SERVICE_ST
alloc_size
,
&
alloc_size
,
&
count
,
resume_handle
,
NULL
)
alloc_size
,
&
alloc_size
,
&
count
,
resume_handle
,
NULL
)
&&
GetLastError
()
!=
ERROR_MORE_DATA
)
&&
GetLastError
()
!=
ERROR_MORE_DATA
)
{
{
heap_
free
(
status_ex
);
free
(
status_ex
);
return
FALSE
;
return
FALSE
;
}
}
...
@@ -198,7 +198,7 @@ EnumServicesStatusW( SC_HANDLE manager, DWORD type, DWORD state, ENUM_SERVICE_ST
...
@@ -198,7 +198,7 @@ EnumServicesStatusW( SC_HANDLE manager, DWORD type, DWORD state, ENUM_SERVICE_ST
status
[
i
].
ServiceStatus
.
dwWaitHint
=
status_ex
[
i
].
ServiceStatusProcess
.
dwWaitHint
;
status
[
i
].
ServiceStatus
.
dwWaitHint
=
status_ex
[
i
].
ServiceStatusProcess
.
dwWaitHint
;
}
}
heap_
free
(
status_ex
);
free
(
status_ex
);
if
(
*
ret_size
>
size
)
if
(
*
ret_size
>
size
)
{
{
SetLastError
(
ERROR_MORE_DATA
);
SetLastError
(
ERROR_MORE_DATA
);
...
@@ -229,7 +229,7 @@ EnumServicesStatusExA( SC_HANDLE hmngr, SC_ENUM_TYPE level, DWORD type, DWORD st
...
@@ -229,7 +229,7 @@ EnumServicesStatusExA( SC_HANDLE hmngr, SC_ENUM_TYPE level, DWORD type, DWORD st
size
,
needed
,
returned
,
resume_handle
,
debugstr_a
(
group
));
size
,
needed
,
returned
,
resume_handle
,
debugstr_a
(
group
));
sz
=
max
(
2
*
size
,
sizeof
(
*
servicesW
)
);
sz
=
max
(
2
*
size
,
sizeof
(
*
servicesW
)
);
if
(
!
(
servicesW
=
heap_
alloc
(
sz
)))
if
(
!
(
servicesW
=
m
alloc
(
sz
)))
{
{
SetLastError
(
ERROR_NOT_ENOUGH_MEMORY
);
SetLastError
(
ERROR_NOT_ENOUGH_MEMORY
);
return
FALSE
;
return
FALSE
;
...
@@ -237,10 +237,10 @@ EnumServicesStatusExA( SC_HANDLE hmngr, SC_ENUM_TYPE level, DWORD type, DWORD st
...
@@ -237,10 +237,10 @@ EnumServicesStatusExA( SC_HANDLE hmngr, SC_ENUM_TYPE level, DWORD type, DWORD st
if
(
group
)
if
(
group
)
{
{
int
len
=
MultiByteToWideChar
(
CP_ACP
,
0
,
group
,
-
1
,
NULL
,
0
);
int
len
=
MultiByteToWideChar
(
CP_ACP
,
0
,
group
,
-
1
,
NULL
,
0
);
if
(
!
(
groupW
=
heap_
alloc
(
len
*
sizeof
(
WCHAR
)
)))
if
(
!
(
groupW
=
m
alloc
(
len
*
sizeof
(
WCHAR
)
)))
{
{
SetLastError
(
ERROR_NOT_ENOUGH_MEMORY
);
SetLastError
(
ERROR_NOT_ENOUGH_MEMORY
);
heap_
free
(
servicesW
);
free
(
servicesW
);
return
FALSE
;
return
FALSE
;
}
}
MultiByteToWideChar
(
CP_ACP
,
0
,
group
,
-
1
,
groupW
,
len
*
sizeof
(
WCHAR
)
);
MultiByteToWideChar
(
CP_ACP
,
0
,
group
,
-
1
,
groupW
,
len
*
sizeof
(
WCHAR
)
);
...
@@ -275,8 +275,8 @@ EnumServicesStatusExA( SC_HANDLE hmngr, SC_ENUM_TYPE level, DWORD type, DWORD st
...
@@ -275,8 +275,8 @@ EnumServicesStatusExA( SC_HANDLE hmngr, SC_ENUM_TYPE level, DWORD type, DWORD st
ret
=
TRUE
;
ret
=
TRUE
;
done:
done:
heap_
free
(
servicesW
);
free
(
servicesW
);
heap_
free
(
groupW
);
free
(
groupW
);
return
ret
;
return
ret
;
}
}
...
@@ -295,7 +295,7 @@ BOOL WINAPI GetServiceKeyNameA( SC_HANDLE hSCManager, LPCSTR lpDisplayName,
...
@@ -295,7 +295,7 @@ BOOL WINAPI GetServiceKeyNameA( SC_HANDLE hSCManager, LPCSTR lpDisplayName,
lpDisplayNameW
=
strdupAW
(
lpDisplayName
);
lpDisplayNameW
=
strdupAW
(
lpDisplayName
);
if
(
lpServiceName
)
if
(
lpServiceName
)
lpServiceNameW
=
heap_
alloc
(
*
lpcchBuffer
*
sizeof
(
WCHAR
));
lpServiceNameW
=
m
alloc
(
*
lpcchBuffer
*
sizeof
(
WCHAR
));
else
else
lpServiceNameW
=
NULL
;
lpServiceNameW
=
NULL
;
...
@@ -321,8 +321,8 @@ BOOL WINAPI GetServiceKeyNameA( SC_HANDLE hSCManager, LPCSTR lpDisplayName,
...
@@ -321,8 +321,8 @@ BOOL WINAPI GetServiceKeyNameA( SC_HANDLE hSCManager, LPCSTR lpDisplayName,
ret
=
TRUE
;
ret
=
TRUE
;
cleanup:
cleanup:
heap_
free
(
lpServiceNameW
);
free
(
lpServiceNameW
);
heap_
free
(
lpDisplayNameW
);
free
(
lpDisplayNameW
);
return
ret
;
return
ret
;
}
}
...
@@ -365,7 +365,7 @@ BOOL WINAPI GetServiceDisplayNameA( SC_HANDLE hSCManager, LPCSTR lpServiceName,
...
@@ -365,7 +365,7 @@ BOOL WINAPI GetServiceDisplayNameA( SC_HANDLE hSCManager, LPCSTR lpServiceName,
lpServiceNameW
=
strdupAW
(
lpServiceName
);
lpServiceNameW
=
strdupAW
(
lpServiceName
);
if
(
lpDisplayName
)
if
(
lpDisplayName
)
lpDisplayNameW
=
heap_
alloc
(
*
lpcchBuffer
*
sizeof
(
WCHAR
));
lpDisplayNameW
=
m
alloc
(
*
lpcchBuffer
*
sizeof
(
WCHAR
));
else
else
lpDisplayNameW
=
NULL
;
lpDisplayNameW
=
NULL
;
...
@@ -392,8 +392,8 @@ BOOL WINAPI GetServiceDisplayNameA( SC_HANDLE hSCManager, LPCSTR lpServiceName,
...
@@ -392,8 +392,8 @@ BOOL WINAPI GetServiceDisplayNameA( SC_HANDLE hSCManager, LPCSTR lpServiceName,
ret
=
TRUE
;
ret
=
TRUE
;
cleanup:
cleanup:
heap_
free
(
lpDisplayNameW
);
free
(
lpDisplayNameW
);
heap_
free
(
lpServiceNameW
);
free
(
lpServiceNameW
);
return
ret
;
return
ret
;
}
}
...
...
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