
#ifndef __LOGPTM_H_
#define __LOGPTM_H_

/**
 * @file: driver.h
 *
 * Tento hlavickovy soubor obsahuje definice nazvu objektu zarizeni a 
 * symbolickeho odkazu pro ovladac objview.sys. Toto zarizeni slouzi
 * pro komunikaci. Dale v tomto souboru take najdete definice struktur
 * pro jednotlive typy pozadavku, ktere ovladac umi boslouzit. Deklarace
 * se suffixem _IN znaci strukturu vstupniho bufferu, deklarace s priponou
 * _OUT odpovidaji strukture vystupniho bufferu. Nazvy jednotlivych polozek
 * jsou odvozeny z poli ve strukturach spravce objektu a frameworku, ktery
 * ovladac objview.sys pro praci se strukturami teto komponenty pouziva.
 */

#include <ntddk.h>
#include "object_initializer.h"
#include "object_type.h"

// Nazev komunikacniho zarizeni
#define DRIVER_DEVICE          L"\\Device\\Objview"

// Nazev symbolickeho odkazu
#define DRIVER_SYMLINK         L"\\DosDevices\\Objview"

// Tag bloku pameti alokovanych timto ovladacem
#define POOL_TAG               (ULONG)'wVbO'


typedef struct _OBJVIEW_OPEN_IN {
  ULONG32 ObjectNameLength;
  WCHAR ObjectName[1];
} OBJVIEW_OPEN_IN, *POBJVIEW_OPEN_IN;

typedef struct _OBJVIEW_OPEN_OUT {
  PVOID Handle;
} OBJVIEW_OPEN_OUT, *POBJVIEW_OPEN_OUT;

typedef struct _OBJVIEW_CLOSE_IN {
  PVOID Handle;
} OBJVIEW_CLOSE_IN, *POBJVIEW_CLOSE_IN;

typedef struct _OBJVIEW_GET_HEADER_IN {
  PVOID Handle;
} OBJVIEW_GET_HEADER_IN, *POBJVIEW_GET_HEADER_IN;

typedef struct _OBJVIEW_GET_HEADER_OUT {
  ULONG32 NameInfoOffset;
  ULONG32 HandleInfoOffset;
  ULONG32 QuotaInfoOffset;
  ULONG32 CreatorInfoOffset;
  ULONG32 ProcessInfoOffset;
  ULONG32 InfoMask;
  ULONG_PTR HandleCount;
  ULONG_PTR PointerCount;
  ULONG32 Flags;
  HANDLE ExclusiveProcessId;
  HANDLE CreatorProcessId;
} OBJVIEW_GET_HEADER_OUT, *POBJVIEW_GET_HEADER_OUT;

typedef struct _OBJVIEW_GET_NAME_INFO_IN {
  PVOID Handle;
} OBJVIEW_GET_NAME_INFO_IN, *POBJVIEW_GET_NAME_INFO_IN;

typedef struct _OBJVIEW_GET_NAME_INFO_OUT {
  ULONG32 NameLength;
  ULONG32 NameOffset;
  WCHAR FullName [1];
} OBJVIEW_GET_NAME_INFO_OUT, *POBJVIEW_GET_NAME_INFO_OUT;

typedef struct _OBJVIEW_GET_QUOTA_INFO_IN {
  PVOID Handle;
} OBJVIEW_GET_QUOTA_INFO_IN, *POBJVIEW_GET_QUOTA_INFO_IN;

typedef struct _OBJVIEW_GET_QUOTA_INFO_OUT {
  ULONG32 PagedPoolCharge;
  ULONG32 NonPagedPoolCharge;
  ULONG32 SecurityDescriptorCharge;
  HANDLE ExclusiveProcessId;
} OBJVIEW_GET_QUOTA_INFO_OUT, *POBJVIEW_GET_QUOTA_INFO_OUT;

typedef struct _OBJVIEW_GET_HANDLE_INFO_IN {
  PVOID Handle;
} OBJVIEW_GET_HANDLE_INFO_IN, *POBJVIEW_GET_HANDLE_INFO_IN;

typedef struct _OBJVIEW_GET_HANDLE_INFO_OUT {
  ULONG_PTR Count;
  struct {
    HANDLE ProcessId;
	ULONG_PTR HandleCount;
  } Entries[1];
} OBJVIEW_GET_HANDLE_INFO_OUT, *POBJVIEW_GET_HANDLE_INFO_OUT;

typedef struct _OBJVIEW_GET_CREATOR_INFO_IN {
  PVOID Handle;
} OBJVIEW_GET_CREATOR_INFO_IN, *POBJVIEW_GET_CREATOR_INFO_IN;

typedef struct _OJVIEW_GET_CREATOR_INFO_OUT {
  HANDLE CreatorProcessId;
} OBJVIEW_GET_CREATOR_INFO_OUT, *POBJVIEW_GET_CREATOR_INFO_OUT;

typedef struct _OBJVIEW_GET_TYPE_INFO_IN {
  PVOID Handle;
} OBJVIEW_GET_TYPE_INFO_IN, *POBJVIEW_GET_TYPE_INFO_IN;

typedef struct _OBJVIEW_GET_TYPE_INFO_OUT {
  OBJECT_INITIALIZER_FLAGS InitializerFlags;
  OBJECT_INITIALIZER_METHODS InitializerMethods;
  OBJECT_INITIALIZER_OTHER_INFO InitializerOtherInfo;
  OBJECT_TYPE_STATISTICS TpyeStatistics;
  ULONG32 Index;
  ULONG32 Key;
  PVOID DefaultObject;
  ULONG32 NameLength;
  WCHAR Name[1];
} OBJVIEW_GET_TYPE_INFO_OUT, *POBJVIEW_GET_TYPE_INFO_OUT;

typedef struct _OBJVIEW_GET_SPECIFIC_INFO_IN {
  PVOID Handle;
} OBJVIEW_GET_SPECIFIC_INFO_IN, *POBJVIEW_GET_SPECIFIC_INFO_IN;

typedef struct _EVENT_SPECIFIC_INFO_OUT {
  ULONG EventType;
  ULONG Signaled;
} EVENT_SPECIFIC_INFO_OUT, *PEVENT_SPECIFIC_INFO_OUT;

typedef struct _SEMAPHORE_SPECIFIC_INFO_OUT {
  ULONG Counter;
  ULONG Limit;
} SEMAPHORE_SPECIFIC_INFO_OUT, *PSEMAPHORE_SPECIFIC_INFO_OUT;

typedef struct _MUTANT_SPECIFIC_INFO_OUT {
  HANDLE OwnerThreadId;
  ULONG Signaled;
  BOOLEAN Abandoned;
} MUTANT_SPECIFIC_INFO_OUT, *PMUTANT_SPECIFIC_INFO_OUT;

#endif
