Организация ввода-вывода. Часть 1. Виртуальные драйверы и виртуальное окружение WINDOWS. Рощин А.В. - 73 стр.

UptoLike

Составители: 

73
Листинг 4.1. SKELETON.C (версия DDK)
#include <basedef.h>
#include <vmm.h>
#include <debug.h>
#include "vxdcall.h"
#include <vxdwraps.h>
#include <wrappers.h>
#include "intrinsi.h"
#ifdef DEBUG
#define DPRINTF(buf, fmt, arg1, arg2) _Sprintf(buf, fmt, arg1, arg2 );
Out_Debug_String( buf )
#else
#define DPRINTF(buf, fmt, arg1, arg2)
#endif
typedef struct tcb_s *PTCB;
BOOL OnSysVmInit(VMHANDLE hVM);
VOID OnSysVmTerminate(VMHANDLE hVM);
BOOL OnCreateVm(VMHANDLE hVM);
VOID OnDestroyVm(VMHANDLE hVM);
BOOL OnCreateThread(PTCB hThread);
VOID OnDestroyThread(PTCB hThread);
#pragma VxD_LOCKED_DATA_SEG
DWORD filepos = 0;
HANDLE fh;
char buf[80];
#pragma VxD_LOCKED_CODE_SEG
BOOL OnSysVmInit(VMHANDLE hVM)
{ BYTE action;
WORD err;
int count=0;
PTCB tcb;
_asm mov ax, 3000h
_asm push dword ptr 21h
VxDCall(Exec_VxD_Int);
tcb = Get_Initial_Thread_Handle(hVM);
DPRINTF(buf, "SysVMInit: VM=%x tcb=%x\r\n", hVM, tcb );
fh = IFSMgr_Ring0_OpenCreateFile(FALSE, "vxdskel.log",
0x0002, 0x0000, 0x12, 0x00,
&err, &action);
                                           73



Листинг 4.1. SKELETON.C (версия DDK)

#include     
#include     
#include     
#include     "vxdcall.h"
#include     
#include     
#include     "intrinsi.h"

#ifdef     DEBUG
#define    DPRINTF(buf, fmt, arg1, arg2) _Sprintf(buf, fmt, arg1, arg2 );
           Out_Debug_String( buf )
#else
#define    DPRINTF(buf, fmt, arg1, arg2)
#endif

typedef    struct tcb_s *PTCB;

BOOL       OnSysVmInit(VMHANDLE hVM);
VOID       OnSysVmTerminate(VMHANDLE hVM);
BOOL       OnCreateVm(VMHANDLE hVM);
VOID       OnDestroyVm(VMHANDLE hVM);
BOOL       OnCreateThread(PTCB hThread);
VOID       OnDestroyThread(PTCB hThread);

#pragma VxD_LOCKED_DATA_SEG

DWORD filepos = 0;
HANDLE fh;
char   buf[80];

#pragma VxD_LOCKED_CODE_SEG

BOOL    OnSysVmInit(VMHANDLE hVM)
{ BYTE action;
  WORD err;
  int count=0;
  PTCB tcb;

  _asm mov ax, 3000h
  _asm push dword ptr 21h
  VxDCall(Exec_VxD_Int);

  tcb = Get_Initial_Thread_Handle(hVM);
  DPRINTF(buf, "SysVMInit: VM=%x tcb=%x\r\n", hVM, tcb );

  fh = IFSMgr_Ring0_OpenCreateFile(FALSE, "vxdskel.log",
               0x0002, 0x0000, 0x12, 0x00,
               &err, &action);