阅读:1055回复:1
请教彭礼孝的HELLO WORLD的调试
本人很菜,在调试彭礼孝的hello world时已经生成了VXD,与VXD通讯的控制台程序也已经编译通过,但是执行控制台程序时总出现 OPEN VXD ERROR,不知道什么原因,请各位大侠不吝赐教。在DEBUG MONITOR中也看不到输出。急死我啦。debug monitor中出现的提示为error(11 )an expected error occoured 另打开vxd时提示为
selet file statrt driver to start the drivrer 源代码如下哪位侠义的古道热肠的大侠费点时间给看看小弟先谢啦 WIN32的控制台程序HELLO.CPP #include<iostream.h> #include<windows.h> #include<winioctl.h> #define DIOC_MY_IO CTL_CODE(FILE_DEVICE_UNKNOWN,1,METHOD_NEITHER,FILE_ANY_ACCESS) void main() { HANDLE hDevice; hDevice=CreateFile(\"\\\\\\.\\\\w32io.vxd\",0,0,0,OPEN_EXISTING,FILE_FLAG_DELETE_ON_CLOSE,0); if(hDevice==INVALID_HANDLE_VALUE) { cout<<\"open vxd error\"<<endl; exit(1); } DeviceIoControl(hDevice,DIOC_MY_IO,NULL,0,NULL,0,NULL,NULL); CloseHandle(hDevice); } vxd的源代码 // W32IO.cpp - main module for VxD W32IO #define DEVICE_MAIN #include \"w32io.h\" Declare_Virtual_Device(W32IO) #undef DEVICE_MAIN W32ioVM::W32ioVM(VMHANDLE hVM) : VVirtualMachine(hVM) {} W32ioThread::W32ioThread(THREADHANDLE hThread) : VThread(hThread) {} DWORD W32ioDevice::OnW32DeviceIoControl(PIOCTLPARAMS p) { switch (p->dioc_IOCtlCode) { case DIOC_OPEN:break; case DIOC_CLOSEHANDLE:break; case DIOC_MY_IO:dout<<\"hello world\"<<endl; } return 0; } vxd的头文件 // W32IO.h - include file for VxD W32IO #include <vtoolscp.h> #define DEVICE_CLASS W32ioDevice #define W32IO_DeviceID UNDEFINED_DEVICE_ID #define W32IO_Init_Order UNDEFINED_INIT_ORDER #define W32IO_Major 1 #define W32IO_Minor 0 #define DIOC_MY_IO CTL_CODE(FILE_DEVICE_UNKNOWN,1,METHOD_NEITHER,FILE_ANY_ACCESS) class W32ioDevice : public VDevice { public: virtual DWORD OnW32DeviceIoControl(PIOCTLPARAMS pDIOCParams); }; class W32ioVM : public VVirtualMachine { public: W32ioVM(VMHANDLE hVM); }; class W32ioThread : public VThread { public: W32ioThread(THREADHANDLE hThread); }; 制造文件 # W32IO.mak - makefile for VxD W32IO DEVICENAME = W32IO FRAMEWORK = CPP DEBUG = 1 OBJECTS = w32io.OBJ !include $(VTOOLSD)\\include\\vtoolsd.mak !include $(VTOOLSD)\\include\\vxdtarg.mak w32io.OBJ: w32io.cpp w32io.h |
|
|
沙发#
发布于:2002-04-23 20:49
mak文件中加入
DYNAMIC = 1 |
|
|