阅读:1570回复:0
我的这段程序为什么总不能编译(用于加载vxd)?关键词:c2065,c2146,c2501,vtoolsd,vxd
// testio.cpp : Defines the entry point for the console application.
// #include "stdafx.h" #include <stdlib.h> #include <stdio.h> #include <shellapi.h> #include <windows.h> #include "Vethio.h" struct PortStruct { DWORD dwPort; BYTE val; BOOL bInput; }; #define COUNT 65536 #define DIOC_WRITEBUFFER 111 int main(int argc, char* argv[]) { PortStruct* pBuffer = new PortStruct[COUNT]; DWORD nBytes; HANDLE hVxd; hVxd = CreateFile("\\\\.\\Vethio.vxd", 0, 0, 0, CREATE_NEW, FILE_FLAG_DELETE_ON_CLOSE, 0); if(hVxd == INVALID_HANDLE_VALUE) { printf("occurred error!\n"); return 0; } system("C:\\command.com"); if(DeviceIOControl(hVxd, DIOC_WRITEBUFFER, NULL, 0, (LPVOID)pBuffer, COUNT, &nBytes, 0)) { FILE* fp; fp = fopen("port.log", "wb"); fwrite(&nBytes, sizeof(DWORD), 1, fp); fwrite(pBuffer, sizeof(PortStruct), nBytes, fp); fclose(fp); } CloseHandle(hVxd); delete pBuffer; return 0; } 出错提示: --------------------Configuration: testio - Win32 Debug-------------------- Compiling... testio.cpp c:\program files\microsoft visual studio\vc98\include\shellapi.h(53) : error C2065: 'HDROP' : undeclared identifier c:\program files\microsoft visual studio\vc98\include\shellapi.h(53) : error C2501: 'DECLARE_HANDLE' : missing storage-class or type specifiers c:\program files\microsoft visual studio\vc98\include\shellapi.h(55) : error C2146: syntax error : missing ';' before identifier 'UINT' c:\program files\microsoft visual studio\vc98\include\shellapi.h(55) : error C2501: 'DECLSPEC_IMPORT' : missing storage-class or type specifiers c:\program files\microsoft visual studio\vc98\include\shellapi.h(55) : fatal error C1004: unexpected end of file found Error executing cl.exe. testio.exe - 5 error(s), 0 warning(s) 我已经多次调换头文件的位置,并查询Msdn,好像跟一个symcvt.h,可是包含后又出现一大堆别的错误. 救救我吧! //vtoolsd环境,vc6.0编译通过 // VETHIO.h - include file for VxD VETHIO #include <vtoolscp.h> #define DEVICE_CLASS VethioDevice #define VETHIO_DeviceID UNDEFINED_DEVICE_ID #define VETHIO_Init_Order UNDEFINED_INIT_ORDER #define VETHIO_Major 1 #define VETHIO_Minor 0 #define COUNT 65536 //定义缓冲区长度 //自定义结构,用于保存I/O数据. struct PortStruct { DWORD dwPort; BYTE val; BOOL bInput; }; class EthPort:public VIOPort //继承VIOPort { public: EthPort(WORD port); ~EthPort(); virtual DWORD handler(VMHANDLE hVM, DWORD port, CLIENT_STRUCT* pRegs, DWORD iotype, DWORD outdata); static int nCount; static PortStruct* pBuffer; static int nNum; }; class VethioDevice : public VDevice { public: VethioDevice(); virtual DWORD OnW32DeviceIOControl(PIOCTLPARAMS pDIOCParams); EthPort *p300, *p320, *p321, *p322, *p323, *p324; }; |
|
最新喜欢:![]()
|