- Visual C++源码
- Visual Basic源码
- C++ Builder源码
- Java源码
- Delphi源码
- C/C++源码
- PHP源码
- Perl源码
- Python源码
- Asm源码
- Pascal源码
- Borland C++源码
- Others源码
- SQL源码
- VBScript源码
- JavaScript源码
- ASP/ASPX源码
- C#源码
- Flash/ActionScript源码
- matlab源码
- PowerBuilder源码
- LabView源码
- Flex源码
- MathCAD源码
- VBA源码
- IDL源码
- Lisp/Scheme源码
- VHDL源码
- Objective-C源码
- Fortran源码
- tcl/tk源码
- QT源码
SKELETON.C
资源名称:vxdsrc.zip [点击查看]
上传用户:lx1888888
上传日期:2007-01-04
资源大小:136k
文件大小:3k
源码类别:
驱动编程
开发平台:
Visual C++
- #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;
- tcb = Get_Initial_Thread_Handle(hVM);
- DPRINTF(buf, "SysVMInit: VM=%x tcb=%xrn", hVM, tcb );
- fh = IFSMgr_Ring0_OpenCreateFile(FALSE, "vxdskel.log",
- 0x0002, 0x0000, 0x12, 0x00,
- &err, &action);
- if (!fh)
- {
- DPRINTF(buf, "Error %x opening file %sn", err, "vxdskel.log" );
- }
- else
- {
- _Sprintf(buf, "SysVMInit: VM=%x tcb=%xrn", hVM, tcb );
- count = IFSMgr_Ring0_WriteFile(FALSE, fh, buf, strlen(buf), filepos, &err);
- filepos += count;
- }
- return TRUE;
- }
- VOID OnSysVmTerminate(VMHANDLE hVM)
- {
- WORD err;
- int count=0;
- PTCB tcb;
- tcb = Get_Initial_Thread_Handle(hVM);
- DPRINTF( buf, "SysVmTerminate VM=%x tcb=%xrn", hVM, tcb );
- _Sprintf( buf, "SysVmTerminate VM=%x tcb=%xrn", hVM, tcb );
- count = IFSMgr_Ring0_WriteFile(FALSE, fh, buf, strlen(buf), filepos, &err);
- filepos += count;
- IFSMgr_Ring0_CloseFile( fh, &err );
- }
- BOOL OnCreateVm(VMHANDLE hVM)
- {
- PTCB tcb;
- WORD err;
- int count=0;
- tcb = Get_Initial_Thread_Handle(hVM);
- DPRINTF(buf, "Create_VM: VM=%x, tcb=%xrn", hVM, tcb);
- _Sprintf(buf, "Create_VM: VM=%x, tcb=%xrn", hVM, tcb);
- count = IFSMgr_Ring0_WriteFile(FALSE, fh, buf, strlen(buf), filepos, &err);
- filepos += count;
- return TRUE;
- }
- VOID OnDestroyVm(VMHANDLE hVM)
- {
- WORD err;
- int count;
- PTCB tcb;
- tcb = Get_Initial_Thread_Handle(hVM);
- DPRINTF(buf, "Destroy_VM: VM=%x tcb=%xrn", hVM, tcb );
- _Sprintf(buf, "Destroy_VM: VM=%x tcb=%xrn", hVM, tcb );
- count = IFSMgr_Ring0_WriteFile(FALSE, fh, buf, strlen(buf), filepos, &err);
- filepos += count;
- }
- BOOL OnCreateThread(PTCB tcb)
- {
- WORD err;
- int count;
- DPRINTF(buf, "Create_Thread: VM=%x, tcb=%xrn", tcb->TCB_VMHandle, tcb);
- _Sprintf(buf, "Create_Thread: VM=%x, tcb=%xrn", tcb->TCB_VMHandle, tcb);
- count = IFSMgr_Ring0_WriteFile(FALSE, fh, buf, strlen(buf), filepos, &err);
- filepos += count;
- return TRUE;
- }
- VOID OnDestroyThread(PTCB tcb)
- {
- WORD err;
- int count;
- DPRINTF( buf, "Destroy_Thread VM=%x, tcb=%xrn", tcb->TCB_VMHandle, tcb );
- _Sprintf( buf, "Destroy_Thread VM=%x, tcb=%xrn", tcb->TCB_VMHandle, tcb );
- count = IFSMgr_Ring0_WriteFile(FALSE, fh, buf, strlen(buf), filepos, &err);
- filepos += count;
- }