
#ifndef __VAD_DEF_W2K3_H_
#define __VAD_DEF_W2K3_H_

/**
 * @file vad-def-w2k3.h
 *
 * Tento soubor obsahuje definice datovych struktur spravce virtualni pameti, ktere
 * maji neco spolecneho s Virtual Address Descriptory. Tyto definice plati na
 * Windows Server 2003 x86 a x64 a take pro Windows XP x64, jejichz kernel je
 * stejny jako u 64bit serveru.
 */


// Prvni skupina priznaku. Vyznam je popsan v souboru vad-def.h
typedef struct _MMVAD_FLAGS_W2K3 {
  ULONG_PTR CommitCharge : COMMIT_SIZE;
  ULONG_PTR NoChange : 1;
  ULONG_PTR VadType : 3;
  ULONG_PTR MemCommit: 1;
  ULONG_PTR Protection : 5;
  ULONG_PTR Spare : 2;
  ULONG_PTR PrivateMemory : 1;
} MMVAD_FLAGS_W2K3;

// Druha skupina priznaku. Jejich najdete v souboru vad-def.h
typedef struct _MMVAD_FLAGS2_W2K3 {
  unsigned FileOffset : 24; 
  unsigned SecNoChange : 1; 
  unsigned OneSecured : 1; 
  unsigned MultipleSecured : 1;  
  unsigned ReadOnly : 1;      
  unsigned LongVad : 1;       
  unsigned ExtendableFile : 1;
  unsigned Inherit : 1;      
  unsigned CopyOnWrite : 1;
} MMVAD_FLAGS2_W2K3;


// Definice stredne velkeho VADu. Urcen prevazne pro pametove mapovane soubory
typedef struct _MMVAD_W2K3 {
  MMADDRESS_NODE Node;
  union {
    ULONG_PTR LongFlags;
    MMVAD_FLAGS_W2K3 VadFlags;
  } u;

  PVOID ControlArea;
  PVOID FirstPrototypePte;
  PVOID LastContiguousPte;
  union {
    ULONG LongFlags2;
    MMVAD_FLAGS2_W2K3 VadFlags2;
  } u2;
} MMVAD_W2K3, *PMMVAD_W2K3;

// Definice "dlouheho" VADu urceneho pro oblasti, na ktere bylo volano
// MmSecureVirtualMemory
typedef struct _MMVAD_LONG_W2K3 {
  MMADDRESS_NODE Node;
  union {
    ULONG_PTR LongFlags;
    MMVAD_FLAGS_W2K3 VadFlags;
  } u;

  PVOID ControlArea;
  PVOID FirstPrototypePte;
  PVOID LastContiguousPte;
  union {
    ULONG LongFlags2;
    MMVAD_FLAGS2_W2K3 VadFlags2;
  } u2;

  union {
    LIST_ENTRY List;
    LIST_ENTRY Secured;
  } u3;

  union {
    PVOID Banked;
    PVOID ExtendedInfo;
  } u4;
} MMVAD_LONG_W2K3, *PMMVAD_LONG_W2K3;



// Definice "kratkeho" VADu. Urcen pro alokovanou a rezervovanou privatni pamet.
typedef struct _MMVAD_SHORT_W2K3 {
  MMADDRESS_NODE Node;
  union {
    ULONG_PTR LongFlags;
    MMVAD_FLAGS_W2K3 VadFlags;
  } u;
} MMVAD_SHORT_W2K3, *PMMVAD_SHORT_W2K3;


#endif
