// Axel '0vercl0k' Souchet - February 19 2020
#pragma once
#ifdef _KERNEL_MODE
#    include <ntifs.h>
#else
#    include <windows.h>
#endif

#define IOCTL_SIC_INIT_CONTEXT CTL_CODE(FILE_DEVICE_UNKNOWN, 0x800, METHOD_BUFFERED, FILE_READ_DATA | FILE_WRITE_DATA)
#define IOCTL_SIC_GET_SHMS_SIZE CTL_CODE(FILE_DEVICE_UNKNOWN, 0x801, METHOD_BUFFERED, FILE_READ_DATA | FILE_WRITE_DATA)
#define IOCTL_SIC_GET_SHMS CTL_CODE(FILE_DEVICE_UNKNOWN, 0x802, METHOD_BUFFERED, FILE_READ_DATA | FILE_WRITE_DATA)
#define SIC_DEVICE_NAME "SoSIC"

typedef struct _SIC_OFFSETS
{
    DWORD32 EPROCESSToVadRoot;
    DWORD32 MMVAD_SHORTToVadFlags;
    DWORD32 MMVAD_FLAGSPrivateMemoryBitPosition;
} SIC_OFFSETS, *PSIC_OFFSETS;

typedef struct _SIC_SHARED_MEMORY_OWNER_ENTRY
{
    DWORD64 Pid;
    DWORD64 Process;
    DWORD64 StartingVirtualAddress;
    DWORD64 EndingVirtualAddress;
} SIC_SHARED_MEMORY_OWNER_ENTRY, *PSIC_SHARED_MEMORY_OWNER_ENTRY;

typedef struct _SIC_SHARED_MEMORY_ENTRY
{
    DWORD64 PrototypePTE;
    DWORD64 NumberOwners;
    SIC_SHARED_MEMORY_OWNER_ENTRY Owners[1];
} SIC_SHM_ENTRY, *PSIC_SHM_ENTRY;

typedef struct _SIC_SHARED_MEMORY_ENTRIES
{
    DWORD64 NumberSharedMemory;
    SIC_SHM_ENTRY Shms[1];
} SIC_SHMS, *PSIC_SHMS;
