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
ce6e298a
Commit
ce6e298a
authored
Feb 17, 2024
by
Alex Henrie
Committed by
Alexandre Julliard
Feb 23, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
advapi32/tests: Use CRT allocation functions.
parent
74bf784b
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
39 additions
and
39 deletions
+39
-39
crypt.c
dlls/advapi32/tests/crypt.c
+2
-2
eventlog.c
dlls/advapi32/tests/eventlog.c
+21
-21
lsa.c
dlls/advapi32/tests/lsa.c
+6
-6
registry.c
dlls/advapi32/tests/registry.c
+10
-10
security.c
dlls/advapi32/tests/security.c
+0
-0
service.c
dlls/advapi32/tests/service.c
+0
-0
No files found.
dlls/advapi32/tests/crypt.c
View file @
ce6e298a
...
...
@@ -1260,10 +1260,10 @@ static void test_container_sd(void)
ok
(
err
==
ERROR_INSUFFICIENT_BUFFER
||
broken
(
err
==
ERROR_INVALID_PARAMETER
),
"got %lu
\n
"
,
err
);
ok
(
len
,
"expected len > 0
\n
"
);
sd
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len
);
sd
=
malloc
(
len
);
ret
=
CryptGetProvParam
(
prov
,
PP_KEYSET_SEC_DESCR
,
(
BYTE
*
)
sd
,
&
len
,
OWNER_SECURITY_INFORMATION
);
ok
(
ret
,
"got %lu
\n
"
,
GetLastError
());
HeapFree
(
GetProcessHeap
(),
0
,
sd
);
free
(
sd
);
ret
=
CryptReleaseContext
(
prov
,
0
);
ok
(
ret
,
"got %lu
\n
"
,
GetLastError
());
...
...
dlls/advapi32/tests/eventlog.c
View file @
ce6e298a
...
...
@@ -445,14 +445,14 @@ static void test_read(void)
todo_wine
ok
(
GetLastError
()
==
ERROR_INVALID_PARAMETER
,
"Expected ERROR_INVALID_PARAMETER, got %ld
\n
"
,
GetLastError
());
buf
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
EVENTLOGRECORD
));
buf
=
malloc
(
sizeof
(
EVENTLOGRECORD
));
SetLastError
(
0xdeadbeef
);
ret
=
ReadEventLogA
(
NULL
,
EVENTLOG_SEQUENTIAL_READ
|
EVENTLOG_FORWARDS_READ
,
0
,
buf
,
sizeof
(
EVENTLOGRECORD
),
&
read
,
&
needed
);
ok
(
!
ret
,
"Expected failure
\n
"
);
todo_wine
ok
(
GetLastError
()
==
ERROR_INVALID_HANDLE
,
"Expected ERROR_INVALID_HANDLE, got %ld
\n
"
,
GetLastError
());
HeapFree
(
GetProcessHeap
(),
0
,
buf
);
free
(
buf
);
handle
=
OpenEventLogA
(
NULL
,
"Application"
);
if
(
!
handle
&&
(
GetLastError
()
==
ERROR_ACCESS_DENIED
||
GetLastError
()
==
RPC_S_SERVER_UNAVAILABLE
))
...
...
@@ -463,7 +463,7 @@ static void test_read(void)
ok
(
handle
!=
NULL
,
"OpenEventLogA(Application) failed : %ld
\n
"
,
GetLastError
());
/* Show that we need the proper dwFlags with a (for the rest) proper call */
buf
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
EVENTLOGRECORD
));
buf
=
malloc
(
sizeof
(
EVENTLOGRECORD
));
SetLastError
(
0xdeadbeef
);
ret
=
ReadEventLogA
(
handle
,
0
,
0
,
buf
,
sizeof
(
EVENTLOGRECORD
),
&
read
,
&
needed
);
...
...
@@ -504,7 +504,7 @@ static void test_read(void)
todo_wine
ok
(
GetLastError
()
==
ERROR_INVALID_PARAMETER
,
"Expected ERROR_INVALID_PARAMETER, got %ld
\n
"
,
GetLastError
());
HeapFree
(
GetProcessHeap
(),
0
,
buf
);
free
(
buf
);
/* First check if there are any records (in practice only on Wine: FIXME) */
count
=
0
;
...
...
@@ -517,7 +517,7 @@ static void test_read(void)
}
/* Get the buffer size for the first record */
buf
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
EVENTLOGRECORD
));
buf
=
malloc
(
sizeof
(
EVENTLOGRECORD
));
read
=
needed
=
0xdeadbeef
;
SetLastError
(
0xdeadbeef
);
ret
=
ReadEventLogA
(
handle
,
EVENTLOG_SEQUENTIAL_READ
|
EVENTLOG_FORWARDS_READ
,
...
...
@@ -529,7 +529,7 @@ static void test_read(void)
/* Read the first record */
toread
=
needed
;
buf
=
HeapReAlloc
(
GetProcessHeap
(),
0
,
buf
,
toread
);
buf
=
realloc
(
buf
,
toread
);
read
=
needed
=
0xdeadbeef
;
SetLastError
(
0xdeadbeef
);
ret
=
ReadEventLogA
(
handle
,
EVENTLOG_SEQUENTIAL_READ
|
EVENTLOG_FORWARDS_READ
,
0
,
buf
,
toread
,
&
read
,
&
needed
);
...
...
@@ -538,7 +538,7 @@ static void test_read(void)
broken
(
read
<
toread
),
/* NT4 wants a buffer size way bigger than just 1 record */
"Expected the requested size to be read
\n
"
);
ok
(
needed
==
0
,
"Expected no extra bytes to be read
\n
"
);
HeapFree
(
GetProcessHeap
(),
0
,
buf
);
free
(
buf
);
CloseEventLog
(
handle
);
}
...
...
@@ -785,7 +785,7 @@ static void test_readwrite(void)
if
(
pCreateWellKnownSid
)
{
sidsize
=
SECURITY_MAX_SID_SIZE
;
user
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sidsize
);
user
=
malloc
(
sidsize
);
SetLastError
(
0xdeadbeef
);
pCreateWellKnownSid
(
WinInteractiveSid
,
NULL
,
user
,
&
sidsize
);
sidavailable
=
TRUE
;
...
...
@@ -846,12 +846,12 @@ static void test_readwrite(void)
ok
(
ret
,
"Expected success : %ld
\n
"
,
GetLastError
());
/* Needed to catch earlier Vista (with no ServicePack for example) */
buf
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
EVENTLOGRECORD
));
buf
=
malloc
(
sizeof
(
EVENTLOGRECORD
));
if
(
!
(
ret
=
ReadEventLogA
(
handle
,
EVENTLOG_SEQUENTIAL_READ
|
EVENTLOG_FORWARDS_READ
,
0
,
buf
,
sizeof
(
EVENTLOGRECORD
),
&
read
,
&
needed
))
&&
GetLastError
()
==
ERROR_INSUFFICIENT_BUFFER
)
{
buf
=
HeapReAlloc
(
GetProcessHeap
(),
0
,
buf
,
needed
);
buf
=
realloc
(
buf
,
needed
);
ret
=
ReadEventLogA
(
handle
,
EVENTLOG_SEQUENTIAL_READ
|
EVENTLOG_FORWARDS_READ
,
0
,
buf
,
needed
,
&
read
,
&
needed
);
}
...
...
@@ -865,7 +865,7 @@ static void test_readwrite(void)
if
(
record
->
EventType
==
EVENTLOG_SUCCESS
)
on_vista
=
TRUE
;
}
HeapFree
(
GetProcessHeap
(),
0
,
buf
);
free
(
buf
);
}
/* This will clear the eventlog. The record numbering for new
...
...
@@ -949,13 +949,13 @@ static void test_readwrite(void)
size
=
0
;
SetLastError
(
0xdeadbeef
);
pGetComputerNameExA
(
ComputerNameDnsFullyQualified
,
NULL
,
&
size
);
localcomputer
=
HeapAlloc
(
GetProcessHeap
(),
0
,
size
);
localcomputer
=
malloc
(
size
);
pGetComputerNameExA
(
ComputerNameDnsFullyQualified
,
localcomputer
,
&
size
);
}
else
{
size
=
MAX_COMPUTERNAME_LENGTH
+
1
;
localcomputer
=
HeapAlloc
(
GetProcessHeap
(),
0
,
size
);
localcomputer
=
malloc
(
size
);
GetComputerNameA
(
localcomputer
,
&
size
);
}
...
...
@@ -964,7 +964,7 @@ static void test_readwrite(void)
ok
(
handle
!=
NULL
,
"OpenEventLogA(%s) failed : %ld
\n
"
,
eventlogname
,
GetLastError
());
i
=
0
;
size
=
sizeof
(
EVENTLOGRECORD
)
+
128
;
buf
=
HeapAlloc
(
GetProcessHeap
(),
0
,
size
);
buf
=
malloc
(
size
);
for
(;;)
{
DWORD
read
,
needed
;
...
...
@@ -989,9 +989,9 @@ static void test_readwrite(void)
if
(
needed
>
size
)
{
HeapFree
(
GetProcessHeap
(),
0
,
buf
);
free
(
buf
);
size
=
needed
;
buf
=
HeapAlloc
(
GetProcessHeap
(),
0
,
size
);
buf
=
malloc
(
size
);
}
ret
=
ReadEventLogA
(
handle
,
EVENTLOG_SEQUENTIAL_READ
|
EVENTLOG_FORWARDS_READ
,
0
,
buf
,
needed
,
&
read
,
&
needed
);
...
...
@@ -1069,7 +1069,7 @@ static void test_readwrite(void)
winetest_pop_context
();
i
++
;
}
HeapFree
(
GetProcessHeap
(),
0
,
buf
);
free
(
buf
);
CloseEventLog
(
handle
);
/* Test clearing a real eventlog */
...
...
@@ -1088,8 +1088,8 @@ static void test_readwrite(void)
CloseEventLog
(
handle
);
cleanup:
HeapFree
(
GetProcessHeap
(),
0
,
localcomputer
);
HeapFree
(
GetProcessHeap
(),
0
,
user
);
free
(
localcomputer
);
free
(
user
);
}
/* Before Vista:
...
...
@@ -1240,7 +1240,7 @@ static void test_start_trace(void)
LONG
ret
;
buffersize
=
sizeof
(
EVENT_TRACE_PROPERTIES
)
+
sizeof
(
sessionname
)
+
sizeof
(
filepath
);
properties
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
buffersize
);
properties
=
calloc
(
1
,
buffersize
);
properties
->
Wnode
.
BufferSize
=
buffersize
;
properties
->
Wnode
.
Flags
=
WNODE_FLAG_TRACED_GUID
;
properties
->
LogFileMode
=
EVENT_TRACE_FILE_MODE_NONE
;
...
...
@@ -1317,7 +1317,7 @@ static void test_start_trace(void)
/* clean up */
ControlTraceA
(
handle
,
sessionname
,
properties
,
EVENT_TRACE_CONTROL_STOP
);
done:
HeapFree
(
GetProcessHeap
(),
0
,
properties
);
free
(
properties
);
DeleteFileA
(
filepath
);
}
...
...
dlls/advapi32/tests/lsa.c
View file @
ce6e298a
...
...
@@ -243,15 +243,15 @@ static void test_LsaLookupNames2(void)
return
;
}
name
[
0
].
Buffer
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
n1
));
name
[
0
].
Buffer
=
malloc
(
sizeof
(
n1
));
name
[
0
].
Length
=
name
[
0
].
MaximumLength
=
sizeof
(
n1
);
memcpy
(
name
[
0
].
Buffer
,
n1
,
sizeof
(
n1
));
name
[
1
].
Buffer
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
n1
));
name
[
1
].
Buffer
=
malloc
(
sizeof
(
n1
));
name
[
1
].
Length
=
name
[
1
].
MaximumLength
=
sizeof
(
n1
)
-
sizeof
(
WCHAR
);
memcpy
(
name
[
1
].
Buffer
,
n1
,
sizeof
(
n1
)
-
sizeof
(
WCHAR
));
name
[
2
].
Buffer
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
n2
));
name
[
2
].
Buffer
=
malloc
(
sizeof
(
n2
));
name
[
2
].
Length
=
name
[
2
].
MaximumLength
=
sizeof
(
n2
);
memcpy
(
name
[
2
].
Buffer
,
n2
,
sizeof
(
n2
));
...
...
@@ -307,9 +307,9 @@ static void test_LsaLookupNames2(void)
LsaFreeMemory
(
sids
);
LsaFreeMemory
(
domains
);
HeapFree
(
GetProcessHeap
(),
0
,
name
[
0
].
Buffer
);
HeapFree
(
GetProcessHeap
(),
0
,
name
[
1
].
Buffer
);
HeapFree
(
GetProcessHeap
(),
0
,
name
[
2
].
Buffer
);
free
(
name
[
0
].
Buffer
);
free
(
name
[
1
].
Buffer
);
free
(
name
[
2
].
Buffer
);
status
=
LsaClose
(
handle
);
ok
(
status
==
STATUS_SUCCESS
,
"LsaClose() failed, returned 0x%08lx
\n
"
,
status
);
...
...
dlls/advapi32/tests/registry.c
View file @
ce6e298a
...
...
@@ -195,7 +195,7 @@ static void _test_hkey_main_Value_A(int line, LPCSTR name, LPCSTR string,
lok
(
type
==
REG_SZ
,
"RegQueryValueExA/1 returned type %ld
\n
"
,
type
);
lok
(
cbData
==
full_byte_len
,
"cbData=%ld instead of %ld or %ld
\n
"
,
cbData
,
full_byte_len
,
str_byte_len
);
value
=
HeapAlloc
(
GetProcessHeap
(),
0
,
cbData
+
1
);
value
=
malloc
(
cbData
+
1
);
memset
(
value
,
0xbd
,
cbData
+
1
);
type
=
0xdeadbeef
;
ret
=
RegQueryValueExA
(
hkey_main
,
name
,
NULL
,
&
type
,
value
,
&
cbData
);
...
...
@@ -213,7 +213,7 @@ static void _test_hkey_main_Value_A(int line, LPCSTR name, LPCSTR string,
debugstr_an
(
string
,
full_byte_len
),
full_byte_len
);
lok
(
*
(
value
+
cbData
)
==
0xbd
,
"RegQueryValueExA/2 overflowed at offset %lu: %02x != bd
\n
"
,
cbData
,
*
(
value
+
cbData
));
}
HeapFree
(
GetProcessHeap
(),
0
,
value
);
free
(
value
);
}
#define test_hkey_main_Value_W(name, string, full_byte_len) _test_hkey_main_Value_W(__LINE__, name, string, full_byte_len)
...
...
@@ -243,7 +243,7 @@ static void _test_hkey_main_Value_W(int line, LPCWSTR name, LPCWSTR string,
"cbData=%ld instead of %ld
\n
"
,
cbData
,
full_byte_len
);
/* Give enough space to overflow by one WCHAR */
value
=
HeapAlloc
(
GetProcessHeap
(),
0
,
cbData
+
2
);
value
=
malloc
(
cbData
+
2
);
memset
(
value
,
0xbd
,
cbData
+
2
);
type
=
0xdeadbeef
;
ret
=
RegQueryValueExW
(
hkey_main
,
name
,
NULL
,
&
type
,
value
,
&
cbData
);
...
...
@@ -258,7 +258,7 @@ static void _test_hkey_main_Value_W(int line, LPCWSTR name, LPCWSTR string,
/* This implies that when cbData == 0, RegQueryValueExW() should not modify the buffer */
lok
(
*
(
value
+
cbData
)
==
0xbd
,
"RegQueryValueExW/2 overflowed at %lu: %02x != bd
\n
"
,
cbData
,
*
(
value
+
cbData
));
lok
(
*
(
value
+
cbData
+
1
)
==
0xbd
,
"RegQueryValueExW/2 overflowed at %lu+1: %02x != bd
\n
"
,
cbData
,
*
(
value
+
cbData
+
1
));
HeapFree
(
GetProcessHeap
(),
0
,
value
);
free
(
value
);
}
static
void
test_set_value
(
void
)
...
...
@@ -1218,7 +1218,7 @@ static void test_reg_open_key(void)
ok
(
ret
==
ERROR_SUCCESS
,
"Expected SetEntriesInAclA to return ERROR_SUCCESS, got %lu, last error %lu
\n
"
,
ret
,
GetLastError
());
sd
=
HeapAlloc
(
GetProcessHeap
(),
0
,
SECURITY_DESCRIPTOR_MIN_LENGTH
);
sd
=
malloc
(
SECURITY_DESCRIPTOR_MIN_LENGTH
);
bRet
=
InitializeSecurityDescriptor
(
sd
,
SECURITY_DESCRIPTOR_REVISION
);
ok
(
bRet
==
TRUE
,
"Expected InitializeSecurityDescriptor to return TRUE, got %d, last error %lu
\n
"
,
bRet
,
GetLastError
());
...
...
@@ -1256,7 +1256,7 @@ static void test_reg_open_key(void)
RegCloseKey
(
hkResult
);
}
HeapFree
(
GetProcessHeap
(),
0
,
sd
);
free
(
sd
);
LocalFree
(
key_acl
);
FreeSid
(
world_sid
);
RegDeleteKeyA
(
hkRoot64
,
""
);
...
...
@@ -1380,7 +1380,7 @@ static void test_reg_create_key(void)
ok
(
dwRet
==
ERROR_SUCCESS
,
"Expected SetEntriesInAclA to return ERROR_SUCCESS, got %lu, last error %lu
\n
"
,
dwRet
,
GetLastError
());
sd
=
HeapAlloc
(
GetProcessHeap
(),
0
,
SECURITY_DESCRIPTOR_MIN_LENGTH
);
sd
=
malloc
(
SECURITY_DESCRIPTOR_MIN_LENGTH
);
bRet
=
InitializeSecurityDescriptor
(
sd
,
SECURITY_DESCRIPTOR_REVISION
);
ok
(
bRet
==
TRUE
,
"Expected InitializeSecurityDescriptor to return TRUE, got %d, last error %lu
\n
"
,
bRet
,
GetLastError
());
...
...
@@ -1418,7 +1418,7 @@ static void test_reg_create_key(void)
RegCloseKey
(
hkey1
);
}
HeapFree
(
GetProcessHeap
(),
0
,
sd
);
free
(
sd
);
LocalFree
(
key_acl
);
FreeSid
(
world_sid
);
RegDeleteKeyA
(
hkRoot64
,
""
);
...
...
@@ -2425,7 +2425,7 @@ static void test_symlinks(void)
pRtlFormatCurrentUserKeyPath
(
&
target_str
);
target_len
=
target_str
.
Length
+
sizeof
(
targetW
);
target
=
HeapAlloc
(
GetProcessHeap
(),
0
,
target_len
);
target
=
malloc
(
target_len
);
memcpy
(
target
,
target_str
.
Buffer
,
target_str
.
Length
);
memcpy
(
target
+
target_str
.
Length
/
sizeof
(
WCHAR
),
targetW
,
sizeof
(
targetW
)
);
...
...
@@ -2530,7 +2530,7 @@ static void test_symlinks(void)
ok
(
!
status
,
"NtDeleteKey failed: 0x%08lx
\n
"
,
status
);
RegCloseKey
(
link
);
HeapFree
(
GetProcessHeap
(),
0
,
target
);
free
(
target
);
pRtlFreeUnicodeString
(
&
target_str
);
}
...
...
dlls/advapi32/tests/security.c
View file @
ce6e298a
This diff is collapsed.
Click to expand it.
dlls/advapi32/tests/service.c
View file @
ce6e298a
This diff is collapsed.
Click to expand it.
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