https://git.reactos.org/?p=reactos.git;a=commitdiff;h=a265dc9ce1ba3349c7d70…
commit a265dc9ce1ba3349c7d701f61452ba6f32e5487a
Author: Timo Kreuzer <timo.kreuzer(a)reactos.org>
AuthorDate: Mon Mar 5 12:07:15 2018 +0100
Commit: Timo Kreuzer <timo.kreuzer(a)reactos.org>
CommitDate: Sat Aug 4 14:39:13 2018 +0200
[KMTESTS] Fix 64 bit issues
---
modules/rostests/kmtests/ntos_ex/ExDoubleList.c | 2 +-
modules/rostests/kmtests/ntos_ex/ExSingleList.c | 2 +-
.../kmtests/ntos_mm/NtCreateSection_user.c | 2 +-
.../kmtests/ntos_mm/ZwAllocateVirtualMemory.c | 2 +-
.../rostests/kmtests/ntos_mm/ZwMapViewOfSection.c | 16 +++++-----
modules/rostests/kmtests/ntos_ob/ObHandle.c | 36 +++++++++++-----------
modules/rostests/kmtests/tcpip/connect.c | 2 +-
7 files changed, 31 insertions(+), 31 deletions(-)
diff --git a/modules/rostests/kmtests/ntos_ex/ExDoubleList.c
b/modules/rostests/kmtests/ntos_ex/ExDoubleList.c
index c33059c093..177e72ba26 100644
--- a/modules/rostests/kmtests/ntos_ex/ExDoubleList.c
+++ b/modules/rostests/kmtests/ntos_ex/ExDoubleList.c
@@ -27,7 +27,7 @@ LIST_ENTRY Entries[5];
#define ok_eq_free2(Value, Expected) do \
{ \
if (KmtIsCheckedBuild) \
- ok_eq_pointer(Value, (PVOID)0xBADDD0FF); \
+ ok_eq_pointer(Value, (PVOID)(ULONG_PTR)0xBADDD0FFBADDD0FFULL); \
else \
ok_eq_pointer(Value, Expected); \
} while (0)
diff --git a/modules/rostests/kmtests/ntos_ex/ExSingleList.c
b/modules/rostests/kmtests/ntos_ex/ExSingleList.c
index 95671ef60a..91a165325d 100644
--- a/modules/rostests/kmtests/ntos_ex/ExSingleList.c
+++ b/modules/rostests/kmtests/ntos_ex/ExSingleList.c
@@ -16,7 +16,7 @@ struct _SINGLE_LIST_ENTRY *__stdcall ExInterlockedPopEntryList(struct
_SINGLE_LI
#define ok_eq_free2(Value, Expected) do \
{ \
if (KmtIsCheckedBuild) \
- ok_eq_pointer(Value, (PVOID)0xBADDD0FF); \
+ ok_eq_pointer(Value, (PVOID)(ULONG_PTR)0xBADDD0FFBADDD0FFULL); \
else \
ok_eq_pointer(Value, Expected); \
} while (0)
diff --git a/modules/rostests/kmtests/ntos_mm/NtCreateSection_user.c
b/modules/rostests/kmtests/ntos_mm/NtCreateSection_user.c
index 6c68c451bd..39cdcd6149 100644
--- a/modules/rostests/kmtests/ntos_mm/NtCreateSection_user.c
+++ b/modules/rostests/kmtests/ntos_mm/NtCreateSection_user.c
@@ -10,7 +10,7 @@
START_TEST(NtCreateSection)
{
PVOID Buffer;
- ULONG FileSize;
+ SIZE_T FileSize;
NTSTATUS Status;
LARGE_INTEGER MaxFileSize;
HANDLE Handle, SectionHandle;
diff --git a/modules/rostests/kmtests/ntos_mm/ZwAllocateVirtualMemory.c
b/modules/rostests/kmtests/ntos_mm/ZwAllocateVirtualMemory.c
index 52e973d754..e8188dedfe 100644
--- a/modules/rostests/kmtests/ntos_mm/ZwAllocateVirtualMemory.c
+++ b/modules/rostests/kmtests/ntos_mm/ZwAllocateVirtualMemory.c
@@ -105,7 +105,7 @@ SimpleErrorChecks(VOID)
//HANDLE TESTS
ALLOC_MEMORY_WITH_FREE(NtCurrentProcess(), Base, 0, RegionSize, (MEM_COMMIT |
MEM_RESERVE), PAGE_READWRITE, STATUS_SUCCESS, STATUS_SUCCESS);
ALLOC_MEMORY_WITH_FREE(NULL, Base, 0, RegionSize, (MEM_COMMIT | MEM_RESERVE),
PAGE_READWRITE, STATUS_INVALID_HANDLE, STATUS_INVALID_HANDLE);
- ALLOC_MEMORY_WITH_FREE((HANDLE)0xdeadbeef, Base, 0, RegionSize, (MEM_COMMIT |
MEM_RESERVE), PAGE_READWRITE, STATUS_INVALID_HANDLE, STATUS_INVALID_HANDLE);
+ ALLOC_MEMORY_WITH_FREE((HANDLE)(ULONG_PTR)0xDEADBEEFDEADBEEFull, Base, 0, RegionSize,
(MEM_COMMIT | MEM_RESERVE), PAGE_READWRITE, STATUS_INVALID_HANDLE,
STATUS_INVALID_HANDLE);
//BASE ADDRESS TESTS
Base = (PVOID)0x00567A20;
diff --git a/modules/rostests/kmtests/ntos_mm/ZwMapViewOfSection.c
b/modules/rostests/kmtests/ntos_mm/ZwMapViewOfSection.c
index ee8b494f40..b6e6146536 100644
--- a/modules/rostests/kmtests/ntos_mm/ZwMapViewOfSection.c
+++ b/modules/rostests/kmtests/ntos_mm/ZwMapViewOfSection.c
@@ -124,31 +124,31 @@ SimpleErrorChecks(HANDLE FileHandleReadOnly, HANDLE
FileHandleWriteOnly, HANDLE
//section handle
TestMapView(WriteSectionHandle, NtCurrentProcess(), &BaseAddress, 0, 0, NULL,
&ViewSize, ViewUnmap, 0, PAGE_READWRITE, STATUS_SUCCESS, STATUS_SUCCESS);
- TestMapView((HANDLE)0xDEADBEEF, NtCurrentProcess(), &BaseAddress, 0, 0, NULL,
&ViewSize, ViewUnmap, 0, PAGE_READWRITE, STATUS_INVALID_HANDLE, IGNORE);
+ TestMapView((HANDLE)(ULONG_PTR)0xDEADBEEFDEADBEEFull, NtCurrentProcess(),
&BaseAddress, 0, 0, NULL, &ViewSize, ViewUnmap, 0, PAGE_READWRITE,
STATUS_INVALID_HANDLE, IGNORE);
TestMapView(INVALID_HANDLE_VALUE, NtCurrentProcess(), &BaseAddress, 0, 0, NULL,
&ViewSize, ViewUnmap, 0, PAGE_READWRITE, STATUS_OBJECT_TYPE_MISMATCH, IGNORE);
TestMapView(NULL, NtCurrentProcess(), &BaseAddress, 0, 0, NULL, &ViewSize,
ViewUnmap, 0, PAGE_READWRITE, STATUS_INVALID_HANDLE, IGNORE);
//process handle
- TestMapView(WriteSectionHandle, (HANDLE)0xDEADBEEF, &BaseAddress, 0, 0, NULL,
&ViewSize, ViewUnmap, 0, PAGE_READWRITE, STATUS_INVALID_HANDLE, IGNORE);
+ TestMapView(WriteSectionHandle, (HANDLE)(ULONG_PTR)0xDEADBEEFDEADBEEFull,
&BaseAddress, 0, 0, NULL, &ViewSize, ViewUnmap, 0, PAGE_READWRITE,
STATUS_INVALID_HANDLE, IGNORE);
TestMapView(WriteSectionHandle, (HANDLE)NULL, &BaseAddress, 0, 0, NULL,
&ViewSize, ViewUnmap, 0, PAGE_READWRITE, STATUS_INVALID_HANDLE, IGNORE);
//base address
- BaseAddress = (PVOID)0x00567A20;
+ BaseAddress = (PVOID)(ULONG_PTR)0x00567A20;
TestMapView(WriteSectionHandle, NtCurrentProcess(), &BaseAddress, 0, 0, NULL,
&ViewSize, ViewUnmap, 0, PAGE_READWRITE, STATUS_MAPPED_ALIGNMENT, IGNORE);
- BaseAddress = (PVOID) 0x60000000;
+ BaseAddress = (PVOID)(ULONG_PTR)0x60000000;
TestMapView(WriteSectionHandle, NtCurrentProcess(), &BaseAddress, 0, 0, NULL,
&ViewSize, ViewUnmap, 0, PAGE_READWRITE, STATUS_SUCCESS, STATUS_SUCCESS);
BaseAddress = (PVOID)((char *)MmSystemRangeStart + 200);
TestMapView(WriteSectionHandle, NtCurrentProcess(), &BaseAddress, 0, 0, NULL,
&ViewSize, ViewUnmap, 0, PAGE_READWRITE, STATUS_INVALID_PARAMETER_3, IGNORE);
//invalid section handle AND unaligned base address
- BaseAddress = (PVOID)0x00567A20;
- TestMapView((HANDLE)0xDEADBEEF, NtCurrentProcess(), &BaseAddress, 0, 0, NULL,
&ViewSize, ViewUnmap, 0, PAGE_READWRITE, STATUS_INVALID_HANDLE, IGNORE);
+ BaseAddress = (PVOID)(ULONG_PTR)0x00567A20;
+ TestMapView((HANDLE)(ULONG_PTR)0xDEADBEEFDEADBEEFull, NtCurrentProcess(),
&BaseAddress, 0, 0, NULL, &ViewSize, ViewUnmap, 0, PAGE_READWRITE,
STATUS_INVALID_HANDLE, IGNORE);
//invalid process handle AND unaligned base address
- BaseAddress = (PVOID)0x00567A20;
- TestMapView(WriteSectionHandle, (HANDLE)0xDEADBEEF, &BaseAddress, 0, 0, NULL,
&ViewSize, ViewUnmap, 0, PAGE_READWRITE, STATUS_INVALID_HANDLE, IGNORE);
+ BaseAddress = (PVOID)(ULONG_PTR)0x00567A20;
+ TestMapView(WriteSectionHandle, (HANDLE)(ULONG_PTR)0xDEADBEEFDEADBEEFull,
&BaseAddress, 0, 0, NULL, &ViewSize, ViewUnmap, 0, PAGE_READWRITE,
STATUS_INVALID_HANDLE, IGNORE);
//try mapping section to an already mapped address
Status = ZwAllocateVirtualMemory(NtCurrentProcess(), &AllocBase, 0,
&AllocSize, MEM_COMMIT, PAGE_READWRITE);
diff --git a/modules/rostests/kmtests/ntos_ob/ObHandle.c
b/modules/rostests/kmtests/ntos_ob/ObHandle.c
index 2b659dfc4f..bd1dd51763 100644
--- a/modules/rostests/kmtests/ntos_ob/ObHandle.c
+++ b/modules/rostests/kmtests/ntos_ob/ObHandle.c
@@ -184,19 +184,19 @@ START_TEST(ObHandle)
Status = NtClose(NULL);
ok_eq_hex(Status, STATUS_INVALID_HANDLE);
DPRINT("Closing null kernel handle (NtClose)\n");
- Status = NtClose((HANDLE)0x80000000);
+ Status = NtClose(LongToHandle(0x80000000));
ok_eq_hex(Status, STATUS_INVALID_HANDLE);
DPRINT("Closing -1 handle (NtClose)\n");
- Status = NtClose((HANDLE)0x7FFFFFFF);
+ Status = NtClose(LongToHandle(0x7FFFFFFF));
ok_eq_hex(Status, STATUS_INVALID_HANDLE);
DPRINT("Closing -1 kernel handle (NtClose)\n");
- Status = NtClose((HANDLE)0xFFFFFFFF);
+ Status = NtClose(LongToHandle(0xFFFFFFFF));
ok_eq_hex(Status, STATUS_INVALID_HANDLE);
DPRINT("Closing 123 handle (NtClose)\n");
- Status = NtClose((HANDLE)123);
+ Status = NtClose(LongToHandle(123));
ok_eq_hex(Status, STATUS_INVALID_HANDLE);
DPRINT("Closing 123 kernel handle (NtClose)\n");
- Status = NtClose((HANDLE)(123 | 0x80000000));
+ Status = NtClose(LongToHandle(123 | 0x80000000));
ok_eq_hex(Status, STATUS_INVALID_HANDLE);
/* ObCloseHandle with UserMode accepts everything */
@@ -204,19 +204,19 @@ START_TEST(ObHandle)
Status = ObCloseHandle(NULL, UserMode);
ok_eq_hex(Status, STATUS_INVALID_HANDLE);
DPRINT("Closing null kernel handle (ObCloseHandle, UserMode)\n");
- Status = ObCloseHandle((HANDLE)0x80000000, UserMode);
+ Status = ObCloseHandle(LongToHandle(0x80000000), UserMode);
ok_eq_hex(Status, STATUS_INVALID_HANDLE);
DPRINT("Closing -1 handle (ObCloseHandle, UserMode)\n");
- Status = ObCloseHandle((HANDLE)0x7FFFFFFF, UserMode);
+ Status = ObCloseHandle(LongToHandle(0x7FFFFFFF), UserMode);
ok_eq_hex(Status, STATUS_INVALID_HANDLE);
DPRINT("Closing -1 kernel handle (ObCloseHandle, UserMode)\n");
- Status = ObCloseHandle((HANDLE)0xFFFFFFFF, UserMode);
+ Status = ObCloseHandle(LongToHandle(0xFFFFFFFF), UserMode);
ok_eq_hex(Status, STATUS_INVALID_HANDLE);
DPRINT("Closing 123 handle (ObCloseHandle, UserMode)\n");
- Status = ObCloseHandle((HANDLE)123, UserMode);
+ Status = ObCloseHandle(LongToHandle(123), UserMode);
ok_eq_hex(Status, STATUS_INVALID_HANDLE);
DPRINT("Closing 123 kernel handle (ObCloseHandle, UserMode)\n");
- Status = ObCloseHandle((HANDLE)(123 | 0x80000000), UserMode);
+ Status = ObCloseHandle(LongToHandle(123 | 0x80000000), UserMode);
ok_eq_hex(Status, STATUS_INVALID_HANDLE);
/* ZwClose only accepts 0 and -1 */
@@ -224,32 +224,32 @@ START_TEST(ObHandle)
Status = ZwClose(NULL);
ok_eq_hex(Status, STATUS_INVALID_HANDLE);
DPRINT("Closing null kernel handle (ZwClose)\n");
- Status = ZwClose((HANDLE)0x80000000);
+ Status = ZwClose(LongToHandle(0x80000000));
ok_eq_hex(Status, STATUS_INVALID_HANDLE);
/* INVALID_KERNEL_HANDLE, 0x7FFFFFFF
Status = ZwClose((HANDLE)0x7FFFFFFF);*/
DPRINT("Closing -1 kernel handle (ZwClose)\n");
- Status = ZwClose((HANDLE)0xFFFFFFFF);
+ Status = ZwClose(LongToHandle(0xFFFFFFFF));
ok_eq_hex(Status, STATUS_INVALID_HANDLE);
/* INVALID_KERNEL_HANDLE, 0x7B, 1, 0, 0
- Status = ZwClose((HANDLE)123);
- Status = ZwClose((HANDLE)(123 | 0x80000000));*/
+ Status = ZwClose(LongToHandle(123));
+ Status = ZwClose(LongToHandle(123 | 0x80000000));*/
/* ObCloseHandle with KernelMode accepts only 0 and -1 */
DPRINT("Closing null handle (ObCloseHandle, KernelMode)\n");
Status = ObCloseHandle(NULL, KernelMode);
ok_eq_hex(Status, STATUS_INVALID_HANDLE);
DPRINT("Closing null kernel handle (ObCloseHandle, KernelMode)\n");
- Status = ObCloseHandle((HANDLE)0x80000000, KernelMode);
+ Status = ObCloseHandle(LongToHandle(0x80000000), KernelMode);
ok_eq_hex(Status, STATUS_INVALID_HANDLE);
/* INVALID_KERNEL_HANDLE, 0x7FFFFFFF, 1, 0, 0
Status = ObCloseHandle((HANDLE)0x7FFFFFFF, KernelMode);*/
DPRINT("Closing -1 kernel handle (ObCloseHandle, KernelMode)\n");
- Status = ObCloseHandle((HANDLE)0xFFFFFFFF, KernelMode);
+ Status = ObCloseHandle(LongToHandle(0xFFFFFFFF), KernelMode);
ok_eq_hex(Status, STATUS_INVALID_HANDLE);
/* INVALID_KERNEL_HANDLE, 0x7B, 1, 0, 0
- Status = ObCloseHandle((HANDLE)123, KernelMode);
- Status = ObCloseHandle((HANDLE)(123 | 0x80000000), KernelMode);*/
+ Status = ObCloseHandle(LongToHandle(123), KernelMode);
+ Status = ObCloseHandle(LongToHandle(123 | 0x80000000), KernelMode);*/
KmtEndSeh(STATUS_SUCCESS);
if (SystemProcessHandle)
diff --git a/modules/rostests/kmtests/tcpip/connect.c
b/modules/rostests/kmtests/tcpip/connect.c
index d548a636c2..89fc75849a 100644
--- a/modules/rostests/kmtests/tcpip/connect.c
+++ b/modules/rostests/kmtests/tcpip/connect.c
@@ -59,7 +59,7 @@ TestTcpConnect(void)
ULONG FileInfoSize;
IN_ADDR InAddr;
LPCWSTR AddressTerminator;
- CONNECTION_CONTEXT ConnectionContext = (CONNECTION_CONTEXT)0xC0CAC01A;
+ CONNECTION_CONTEXT ConnectionContext =
(CONNECTION_CONTEXT)(ULONG_PTR)0xC0CAC01AC0CAC01AULL;
KEVENT Event;
TDI_CONNECTION_INFORMATION RequestInfo, ReturnInfo;