我的这段程序为什么总不能编译(用于加载vxd)?关键词:c2065,c2146,c2501,vtoolsd,vxd

元明 2001-07-22 12:05:26
// 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,可是包含后又出现一大堆别的错误.
救救我吧!
...全文
172 7 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
元明 2001-07-22
  • 打赏
  • 举报
回复
要不我把工程发给你们
元明 2001-07-22
  • 打赏
  • 举报
回复
Vethio.h是我写的VXD里的头文件,也就是说Vethio.vxd我已经正常编译,怎么会有毛病?
Chice_wxg 2001-07-22
  • 打赏
  • 举报
回复


Vethio.h

有问题!贴上来看看~~~~~~~

sunyanbiao_12 2001-07-22
  • 打赏
  • 举报
回复
你的某个头文件没定义。
元明 2001-07-22
  • 打赏
  • 举报
回复
你在建立main()的程序是,选第二个选项就出来了 (a simple application),问题应该不在这.
wjyasd 2001-07-22
  • 打赏
  • 举报
回复
#include "stdafx.h" 好象在 main()的程序中不应该出现才对!

屏蔽它试试吧! (我的影象里只出现在 MFC生成的程序中,…… #include "stdafx.h")
元明 2001-07-22
  • 打赏
  • 举报
回复
//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;
};

16,548

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC相关问题讨论
社区管理员
  • 基础类社区
  • AIGC Browser
  • encoderlee
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

        VC/MFC社区版块或许是CSDN最“古老”的版块了,记忆之中,与CSDN的年龄几乎差不多。随着时间的推移,MFC技术渐渐的偏离了开发主流,若干年之后的今天,当我们面对着微软的这个经典之笔,内心充满着敬意,那些曾经的记忆,可以说代表着二十年前曾经的辉煌……
        向经典致敬,或许是老一代程序员内心里面难以释怀的感受。互联网大行其道的今天,我们期待着MFC技术能够恢复其曾经的辉煌,或许这个期待会永远成为一种“梦想”,或许一切皆有可能……
        我们希望这个版块可以很好的适配Web时代,期待更好的互联网技术能够使得MFC技术框架得以重现活力,……

试试用AI创作助手写篇文章吧