我的这段程序为什么总不能编译(用于加载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,可是包含后又出现一大堆别的错误.
救救我吧!