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
27ebfdb8
Commit
27ebfdb8
authored
Oct 12, 2009
by
Dmitry Timoshkov
Committed by
Alexandre Julliard
Oct 12, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernel32: Implement HeapQueryInformation, add some basic tests for it.
parent
42f7e4a4
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
89 additions
and
2 deletions
+89
-2
heap.c
dlls/kernel32/heap.c
+8
-0
kernel32.spec
dlls/kernel32/kernel32.spec
+1
-1
heap.c
dlls/kernel32/tests/heap.c
+55
-0
heap.c
dlls/ntdll/heap.c
+23
-0
ntdll.spec
dlls/ntdll/ntdll.spec
+1
-1
winternl.h
include/winternl.h
+1
-0
No files found.
dlls/kernel32/heap.c
View file @
27ebfdb8
...
...
@@ -291,6 +291,14 @@ SIZE_T WINAPI HeapSize( HANDLE heap, DWORD flags, LPCVOID ptr )
return
RtlSizeHeap
(
heap
,
flags
,
ptr
);
}
BOOL
WINAPI
HeapQueryInformation
(
HANDLE
heap
,
HEAP_INFORMATION_CLASS
info_class
,
PVOID
info
,
SIZE_T
size_in
,
PSIZE_T
size_out
)
{
NTSTATUS
ret
=
RtlQueryHeapInformation
(
heap
,
info_class
,
info
,
size_in
,
size_out
);
if
(
ret
)
SetLastError
(
RtlNtStatusToDosError
(
ret
)
);
return
!
ret
;
}
BOOL
WINAPI
HeapSetInformation
(
HANDLE
heap
,
HEAP_INFORMATION_CLASS
infoclass
,
PVOID
info
,
SIZE_T
size
)
{
FIXME
(
"%p %d %p %ld
\n
"
,
heap
,
infoclass
,
info
,
size
);
...
...
dlls/kernel32/kernel32.spec
View file @
27ebfdb8
...
...
@@ -707,7 +707,7 @@
@ stub HeapExtend
@ stdcall HeapFree(long long long) ntdll.RtlFreeHeap
@ stdcall HeapLock(long)
# @ stub HeapQueryInformation
@ stdcall HeapQueryInformation(long long ptr long ptr)
@ stub HeapQueryTagW
@ stdcall HeapReAlloc(long long ptr long) ntdll.RtlReAllocateHeap
@ stub HeapSetFlags
...
...
dlls/kernel32/tests/heap.c
View file @
27ebfdb8
...
...
@@ -28,6 +28,8 @@
#define MAGIC_DEAD 0xdeadbeef
static
BOOL
(
WINAPI
*
pHeapQueryInformation
)(
HANDLE
,
HEAP_INFORMATION_CLASS
,
PVOID
,
SIZE_T
,
PSIZE_T
);
static
SIZE_T
resize_9x
(
SIZE_T
size
)
{
DWORD
dwSizeAligned
=
(
size
+
3
)
&
~
3
;
...
...
@@ -410,6 +412,58 @@ static void test_obsolete_flags(void)
}
}
static
void
test_HeapQueryInformation
(
void
)
{
ULONG
info
;
SIZE_T
size
;
BOOL
ret
;
pHeapQueryInformation
=
(
void
*
)
GetProcAddress
(
GetModuleHandle
(
"kernel32.dll"
),
"HeapQueryInformation"
);
if
(
!
pHeapQueryInformation
)
{
win_skip
(
"HeapQueryInformation is not available
\n
"
);
return
;
}
if
(
0
)
/* crashes under XP */
{
size
=
0
;
ret
=
pHeapQueryInformation
(
0
,
HeapCompatibilityInformation
,
&
info
,
sizeof
(
info
),
&
size
);
size
=
0
;
ret
=
pHeapQueryInformation
(
GetProcessHeap
(),
HeapCompatibilityInformation
,
NULL
,
sizeof
(
info
),
&
size
);
}
size
=
0
;
SetLastError
(
0xdeadbeef
);
ret
=
pHeapQueryInformation
(
GetProcessHeap
(),
HeapCompatibilityInformation
,
NULL
,
0
,
&
size
);
ok
(
!
ret
,
"HeapQueryInformation should fail
\n
"
);
ok
(
GetLastError
()
==
ERROR_INSUFFICIENT_BUFFER
,
"expected ERROR_INSUFFICIENT_BUFFER got %u
\n
"
,
GetLastError
());
ok
(
size
==
sizeof
(
ULONG
),
"expected 4, got %lu
\n
"
,
size
);
SetLastError
(
0xdeadbeef
);
ret
=
pHeapQueryInformation
(
GetProcessHeap
(),
HeapCompatibilityInformation
,
NULL
,
0
,
NULL
);
ok
(
!
ret
,
"HeapQueryInformation should fail
\n
"
);
ok
(
GetLastError
()
==
ERROR_INSUFFICIENT_BUFFER
,
"expected ERROR_INSUFFICIENT_BUFFER got %u
\n
"
,
GetLastError
());
info
=
0xdeadbeaf
;
SetLastError
(
0xdeadbeef
);
ret
=
pHeapQueryInformation
(
GetProcessHeap
(),
HeapCompatibilityInformation
,
&
info
,
sizeof
(
info
)
+
1
,
NULL
);
ok
(
ret
,
"HeapQueryInformation error %u
\n
"
,
GetLastError
());
ok
(
info
==
0
||
info
==
1
||
info
==
2
,
"expected 0, 1 or 2, got %u
\n
"
,
info
);
}
START_TEST
(
heap
)
{
test_heap
();
...
...
@@ -422,4 +476,5 @@ START_TEST(heap)
test_sized_HeapReAlloc
(
1
,
(
1
<<
20
));
test_sized_HeapReAlloc
((
1
<<
20
),
(
2
<<
20
));
test_sized_HeapReAlloc
((
1
<<
20
),
1
);
test_HeapQueryInformation
();
}
dlls/ntdll/heap.c
View file @
27ebfdb8
...
...
@@ -1961,3 +1961,26 @@ ULONG WINAPI RtlGetProcessHeaps( ULONG count, HANDLE *heaps )
RtlLeaveCriticalSection
(
&
processHeap
->
critSection
);
return
total
;
}
/***********************************************************************
* RtlQueryHeapInformation (NTDLL.@)
*/
NTSTATUS
WINAPI
RtlQueryHeapInformation
(
HANDLE
heap
,
HEAP_INFORMATION_CLASS
info_class
,
PVOID
info
,
SIZE_T
size_in
,
PSIZE_T
size_out
)
{
switch
(
info_class
)
{
case
HeapCompatibilityInformation
:
if
(
size_out
)
*
size_out
=
sizeof
(
ULONG
);
if
(
size_in
<
sizeof
(
ULONG
))
return
STATUS_BUFFER_TOO_SMALL
;
*
(
ULONG
*
)
info
=
0
;
/* standard heap */
return
STATUS_SUCCESS
;
default
:
FIXME
(
"Unknown heap information class %u
\n
"
,
info_class
);
return
STATUS_INVALID_INFO_CLASS
;
}
}
dlls/ntdll/ntdll.spec
View file @
27ebfdb8
...
...
@@ -768,7 +768,7 @@
@ stdcall RtlQueryAtomInAtomTable(ptr long ptr ptr ptr ptr)
@ stdcall RtlQueryDepthSList(ptr)
@ stdcall RtlQueryEnvironmentVariable_U(ptr ptr ptr)
@ st
ub RtlQueryHeapInformation
@ st
dcall RtlQueryHeapInformation(long long ptr long ptr)
@ stdcall RtlQueryInformationAcl(ptr ptr long long)
@ stdcall RtlQueryInformationActivationContext(long long ptr long ptr long ptr)
@ stub RtlQueryInformationActiveActivationContext
...
...
include/winternl.h
View file @
27ebfdb8
...
...
@@ -2412,6 +2412,7 @@ NTSYSAPI BOOLEAN WINAPI RtlPrefixString(const STRING*,const STRING*,BOOLEAN);
NTSYSAPI
BOOLEAN
WINAPI
RtlPrefixUnicodeString
(
const
UNICODE_STRING
*
,
const
UNICODE_STRING
*
,
BOOLEAN
);
NTSYSAPI
NTSTATUS
WINAPI
RtlQueryAtomInAtomTable
(
RTL_ATOM_TABLE
,
RTL_ATOM
,
ULONG
*
,
ULONG
*
,
WCHAR
*
,
ULONG
*
);
NTSYSAPI
NTSTATUS
WINAPI
RtlQueryEnvironmentVariable_U
(
PWSTR
,
PUNICODE_STRING
,
PUNICODE_STRING
);
NTSYSAPI
NTSTATUS
WINAPI
RtlQueryHeapInformation
(
HANDLE
,
HEAP_INFORMATION_CLASS
,
PVOID
,
SIZE_T
,
PSIZE_T
);
NTSYSAPI
NTSTATUS
WINAPI
RtlQueryInformationAcl
(
PACL
,
LPVOID
,
DWORD
,
ACL_INFORMATION_CLASS
);
NTSYSAPI
NTSTATUS
WINAPI
RtlQueryInformationActivationContext
(
ULONG
,
HANDLE
,
PVOID
,
ULONG
,
PVOID
,
SIZE_T
,
SIZE_T
*
);
NTSYSAPI
NTSTATUS
WINAPI
RtlQueryProcessDebugInformation
(
ULONG
,
ULONG
,
PDEBUG_BUFFER
);
...
...
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