-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add __ObjectType tests for relative call check
- Loading branch information
Showing
7 changed files
with
217 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,39 @@ | ||
#include <xboxkrnl/xboxkrnl.h> | ||
#include <processthreadsapi.h> | ||
#include <synchapi.h> | ||
#include <handleapi.h> | ||
|
||
#include "util/output.h" | ||
#include "assertions/object_type.h" | ||
|
||
DWORD NTAPI dummy_thread( | ||
IN PVOID context | ||
) | ||
{ | ||
return 0; | ||
} | ||
|
||
TEST_FUNC(PsThreadObjectType) | ||
{ | ||
TEST_BEGIN(); | ||
|
||
test_passed &= assert_object_type(&PsThreadObjectType, 'erhT', FALSE, FALSE, FALSE); | ||
HANDLE thread_handle = CreateThread(NULL, 0, dummy_thread, NULL, 0, NULL); | ||
GEN_CHECK(thread_handle != INVALID_HANDLE_VALUE, TRUE, "thread_handle"); | ||
if (thread_handle != INVALID_HANDLE_VALUE) { | ||
test_passed &= assert_object_header_type(&PsThreadObjectType, thread_handle); | ||
do { | ||
DWORD ExitCode = 0; | ||
GetExitCodeThread(thread_handle, &ExitCode); | ||
if (ExitCode != STILL_ACTIVE) { | ||
break; | ||
} | ||
Sleep(10); | ||
} | ||
while(1); | ||
BOOL close = CloseHandle(thread_handle); | ||
GEN_CHECK(close, TRUE, "close handle"); | ||
} | ||
|
||
TEST_END(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#include <xboxkrnl/xboxkrnl.h> | ||
|
||
static void NTAPI dummy_start_io( | ||
IN DEVICE_OBJECT *DeviceObject, | ||
IN IRP *Irp | ||
) | ||
{ | ||
// Don't need to initialize anything | ||
} | ||
|
||
PDEVICE_OBJECT dummy_device_object = NULL; | ||
|
||
DRIVER_OBJECT dummy_driver_object = { | ||
.DriverStartIo = dummy_start_io, | ||
.DriverDeleteDevice = NULL, | ||
.DriverDismountVolume = NULL, | ||
.MajorFunction = { | ||
IoInvalidDeviceRequest, // IRP_MJ_CREATE | ||
IoInvalidDeviceRequest, // IRP_MJ_CLOSE | ||
IoInvalidDeviceRequest, // IRP_MJ_READ | ||
IoInvalidDeviceRequest, // IRP_MJ_WRITE | ||
IoInvalidDeviceRequest, // IRP_MJ_QUERY_INFORMATION | ||
IoInvalidDeviceRequest, // IRP_MJ_SET_INFORMATION | ||
IoInvalidDeviceRequest, // IRP_MJ_FLUSH_BUFFERS | ||
IoInvalidDeviceRequest, // IRP_MJ_QUERY_VOLUME_INFORMATION | ||
IoInvalidDeviceRequest, // IRP_MJ_DIRECTORY_CONTROL | ||
IoInvalidDeviceRequest, // IRP_MJ_FILE_SYSTEM_CONTROL | ||
IoInvalidDeviceRequest, // IRP_MJ_DEVICE_CONTROL | ||
IoInvalidDeviceRequest, // IRP_MJ_INTERNAL_DEVICE_CONTROL | ||
IoInvalidDeviceRequest, // IRP_MJ_SHUTDOWN | ||
IoInvalidDeviceRequest // IRP_MJ_CLEANUP | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#pragma once | ||
|
||
#include <xboxkrnl/xboxkrnl.h> | ||
|
||
#ifndef FILE_DEVICE_CD_ROM | ||
#define FILE_DEVICE_CD_ROM 2 | ||
#endif | ||
|
||
extern PDEVICE_OBJECT dummy_device_object; | ||
extern DRIVER_OBJECT dummy_driver_object; |