
#ifndef __SSDTINFO_H_
#define __SSDTINFO_H_

/**
 * @file: ssdtinfo.h
 *
 * Definice struktur a konstant pro ziskavani informaci o tabulkach
 * systemovych volani.
 */


#include <ntddk.h>

// Typy tabulek
#define TABLE_TYPE_NORMAL              1       // Pouze hl. modul jadra
#define TABLE_TYPE_SHADOW              2       // Stinova tabulka

// Nazev exportu tabulky systemovych volani pouze pro hlavni modul jadra
#define SERVICE_TABLE_NAME             L"KeServiceDescriptorTable"

// Definice jedne podtabulky
typedef struct _SERVICE_TABLE_ENTRY
{
  // Adresa tabulky adres systemovych sluzeb
  PULONG ServiceTable;
  // Adresa tabulky citaci poctu volani jednotlivych sys. sluzeb
  PULONG CounterTable;
  // Pocet systemovych sluzeb
  ULONG  NumberOfServices;
  // Adresa tabulky argumentu pro jednotlive systemove sluzby
  PCHAR ArgumentTable;
} SERVICE_TABLE_ENTRY, *PSERVICE_TABLE_ENTRY;


// Definice tabulky systemovych volani
typedef struct _SERVICE_TABLE
{
  // Pole podtabulek (pred 2003 jsou 4, jinak dve)
  SERVICE_TABLE_ENTRY Subtables[4];
} SERVICE_TABLE, *PSERVICE_TABLE;




// Popis jednotlivych rutin naleznete u jejich implementace v souboru
// ssdtinfo.c

NTSTATUS SSDTInfoGetBasicInfo(IN ULONG TableType, OUT PVOID Buffer, IN ULONG BufferLength);
NTSTATUS SSDTInfoGetAddressTable(IN ULONG TableType, IN ULONG Subtable, OUT PVOID Buffer, IN ULONG BufferLength);
NTSTATUS SSDTInfoGetCounterTable(IN ULONG TableType, IN ULONG Subtable, OUT PVOID Buffer, IN ULONG BufferLength);
NTSTATUS SSDTInfoGetArgumentTable(IN ULONG TableType, IN ULONG Subtable, OUT PVOID Buffer, IN ULONG BufferLength);
PSERVICE_TABLE SSDTInfoGetServiceTable(VOID);
PSERVICE_TABLE SSDTInfoGetServiceTableShadow(VOID);

NTSTATUS SSDTInfoInitShadowTable(VOID);
NTSTATUS SSDTInfoInit(VOID);
VOID SSDTInfoFinit(VOID);

#endif
