2014-04-06 18:31:53 +00:00
|
|
|
/* Benjamin DELPY `gentilkiwi`
|
2020-09-17 01:17:11 +00:00
|
|
|
https://blog.gentilkiwi.com
|
2014-04-06 18:31:53 +00:00
|
|
|
benjamin@gentilkiwi.com
|
2015-08-25 09:19:01 +00:00
|
|
|
Licence : https://creativecommons.org/licenses/by/4.0/
|
2014-04-06 18:31:53 +00:00
|
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <ntifs.h>
|
|
|
|
#include <fltkernel.h>
|
|
|
|
#include <ntddk.h>
|
|
|
|
#include <aux_klib.h>
|
|
|
|
#include <ntstrsafe.h>
|
2014-04-12 19:43:49 +00:00
|
|
|
#include <string.h>
|
2014-04-06 18:31:53 +00:00
|
|
|
#include "ioctl.h"
|
|
|
|
|
|
|
|
#define POOL_TAG 'kiwi'
|
|
|
|
#define MIMIDRV L"mimidrv"
|
|
|
|
|
2014-04-12 19:43:49 +00:00
|
|
|
#define kprintf(KiwiBuffer, Format, ...) (RtlStringCbPrintfExW(*(KiwiBuffer)->Buffer, *(KiwiBuffer)->szBuffer, (KiwiBuffer)->Buffer, (KiwiBuffer)->szBuffer, STRSAFE_NO_TRUNCATION, Format, __VA_ARGS__))
|
2014-04-06 18:31:53 +00:00
|
|
|
|
|
|
|
extern char * PsGetProcessImageFileName(PEPROCESS monProcess);
|
|
|
|
extern NTSYSAPI NTSTATUS NTAPI ZwSetInformationProcess (__in HANDLE ProcessHandle, __in PROCESSINFOCLASS ProcessInformationClass, __in_bcount(ProcessInformationLength) PVOID ProcessInformation, __in ULONG ProcessInformationLength);
|
|
|
|
extern NTSYSAPI NTSTATUS NTAPI ZwUnloadKey(IN POBJECT_ATTRIBUTES DestinationKeyName);
|
|
|
|
|
|
|
|
typedef struct _KIWI_BUFFER {
|
2014-04-12 19:43:49 +00:00
|
|
|
size_t * szBuffer;
|
|
|
|
PWSTR * Buffer;
|
2014-04-06 18:31:53 +00:00
|
|
|
} KIWI_BUFFER, *PKIWI_BUFFER;
|
|
|
|
|
|
|
|
typedef enum _KIWI_OS_INDEX {
|
|
|
|
KiwiOsIndex_UNK = 0,
|
|
|
|
KiwiOsIndex_XP = 1,
|
|
|
|
KiwiOsIndex_2K3 = 2,
|
|
|
|
KiwiOsIndex_VISTA = 3,
|
|
|
|
KiwiOsIndex_7 = 4,
|
|
|
|
KiwiOsIndex_8 = 5,
|
|
|
|
KiwiOsIndex_BLUE = 6,
|
2016-03-27 17:22:36 +00:00
|
|
|
KiwiOsIndex_10_1507 = 7,
|
|
|
|
KiwiOsIndex_10_1511 = 8,
|
2016-10-25 00:25:34 +00:00
|
|
|
KiwiOsIndex_10_1607 = 9,
|
2017-12-03 20:16:28 +00:00
|
|
|
KiwiOsIndex_10_1703 = 10,
|
2017-12-18 02:30:40 +00:00
|
|
|
KiwiOsIndex_10_1709 = 11,
|
2018-03-22 02:56:19 +00:00
|
|
|
KiwiOsIndex_10_1803 = 12,
|
2018-12-03 01:06:10 +00:00
|
|
|
KiwiOsIndex_10_1809 = 13,
|
2019-05-12 23:17:31 +00:00
|
|
|
KiwiOsIndex_10_1903 = 14,
|
2020-05-18 22:56:24 +00:00
|
|
|
KiwiOsIndex_10_1909 = 15,
|
|
|
|
KiwiOsIndex_10_2004 = 16,
|
|
|
|
KiwiOsIndex_MAX = 17,
|
2014-04-06 18:31:53 +00:00
|
|
|
} KIWI_OS_INDEX, *PKIWI_OS_INDEX;
|
|
|
|
|
2019-03-25 00:57:56 +00:00
|
|
|
#if defined(_M_X64) || defined(_M_ARM64) // TODO:ARM64
|
2014-04-06 18:31:53 +00:00
|
|
|
#define EX_FAST_REF_MASK 0x0f
|
2019-03-25 00:57:56 +00:00
|
|
|
#elif defined(_M_IX86)
|
|
|
|
#define EX_FAST_REF_MASK 0x07
|
2014-04-06 18:31:53 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#define KIWI_mask3bits(addr) (((ULONG_PTR) (addr)) & ~7)
|
|
|
|
|
|
|
|
KIWI_OS_INDEX KiwiOsIndex;
|