#ifndef _IOCTL_UTILS_H_
#define _IOCTL_UTILS_H_

#include <ntifs.h>

// Code
#define IOCTL_CODE_TEST  CTL_CODE(FILE_DEVICE_UNKNOWN, 0x800, METHOD_BUFFERED, FILE_ANY_ACCESS)
#define IOCTL_CODE_READ  CTL_CODE(FILE_DEVICE_UNKNOWN, 0x801, METHOD_BUFFERED, FILE_ANY_ACCESS)
#define IOCTL_CODE_WRITE  CTL_CODE(FILE_DEVICE_UNKNOWN, 0x802, METHOD_BUFFERED, FILE_ANY_ACCESS)
#define IOCTL_CODE_FORCE_DELETE_FILE  CTL_CODE(FILE_DEVICE_UNKNOWN, 0x803, METHOD_BUFFERED, FILE_ANY_ACCESS)
#define IOCTL_CODE_GET_MODULE_BASE  CTL_CODE(FILE_DEVICE_UNKNOWN, 0x804, METHOD_BUFFERED, FILE_ANY_ACCESS)
#define IOCTL_CODE_KBD CTL_CODE(FILE_DEVICE_UNKNOWN, 0x805, METHOD_BUFFERED, FILE_ANY_ACCESS)
#define IOCTL_CODE_MOU CTL_CODE(FILE_DEVICE_UNKNOWN, 0x806, METHOD_BUFFERED, FILE_ANY_ACCESS)
#define IOCTL_CODE_PROCESS_HIDE CTL_CODE(FILE_DEVICE_UNKNOWN, 0x807, METHOD_BUFFERED, FILE_ANY_ACCESS)
#define IOCTL_CODE_WINDOW_HIDE CTL_CODE(FILE_DEVICE_UNKNOWN, 0x808, METHOD_BUFFERED, FILE_ANY_ACCESS)
#define IOCTL_CODE_GET_PROCESS_ID CTL_CODE(FILE_DEVICE_UNKNOWN, 0x809, METHOD_BUFFERED, FILE_ANY_ACCESS)
#define IOCTL_CODE_INJECT_DLL CTL_CODE(FILE_DEVICE_UNKNOWN, 0x80A, METHOD_BUFFERED, FILE_ANY_ACCESS)

// Trans Struct
struct IOCTL_TRANS_READ
{
	DWORD pid;
	PVOID address;
	DWORD size;
};

struct IOCTL_TRANS_WRITE
{
	DWORD pid;
	PVOID address;
	DWORD size;
	BYTE data[0];
};

struct IOCTL_TRANS_GET_MODULE_BASE
{
	DWORD pid;
	BYTE moduleName[0];
};

// Same as KM::KEYBOARD_INPUT_DATA
struct IOCTL_TRANS_KBD {
	USHORT UnitId;
	USHORT MakeCode;
	USHORT Flags;
	USHORT Reserved;
	ULONG ExtraInformation;
};

// Same as KM::MOUSE_INPUT_DATA
struct IOCTL_TRANS_MOU {
	USHORT UnitId;
	USHORT Flags;
	union {
		ULONG Buttons;
		struct {
			USHORT  ButtonFlags;
			USHORT  ButtonData;
		};
	};
	ULONG RawButtons;
	LONG LastX;
	LONG LastY;
	ULONG ExtraInformation;
};

struct IOCTL_TRANS_INJECT_DLL
{
	DWORD pid;
	BYTE dllPath[0];
};

struct IOCTL_TRANS_PROCESS_HIDE
{
	DWORD pid;
	BOOL hide;
};

#endif // !_IOCTL_UTILS_H_
