#include<windows.h>
#include <wintrust.h>//包含这个头文件会出现很多错误。
#include <stdio.h> : error C2061: syntax error : identifier 'CMSG_SIGNER_INFO'
c:\program files\microsoft visual studio\vc98\include\wintrust.h(142) : error C2143: syntax error : missing '{' before '*'
c:\program files\microsoft visual studio\vc98\include\wintrust.h(144) : error C2059: syntax error : '}'
c:\program files\microsoft visual studio\vc98\include\wintrust.h(158) : error C2061: syntax error : identifier 'CERT_CONTEXT'
c:\program files\microsoft visual studio\vc98\include\wintrust.h(161) : error C2143: syntax error : missing '{' before '*'这个头文件是vc6自带的,并没有修改,怎么会出现这么多的错误啊。若不包含则下面的结构会提示没有定义
WINTRUST_DATA wd;这个结构在<wintrust.h>中定义的。
请教高人...
#include <wintrust.h>//包含这个头文件会出现很多错误。
#include <stdio.h> : error C2061: syntax error : identifier 'CMSG_SIGNER_INFO'
c:\program files\microsoft visual studio\vc98\include\wintrust.h(142) : error C2143: syntax error : missing '{' before '*'
c:\program files\microsoft visual studio\vc98\include\wintrust.h(144) : error C2059: syntax error : '}'
c:\program files\microsoft visual studio\vc98\include\wintrust.h(158) : error C2061: syntax error : identifier 'CERT_CONTEXT'
c:\program files\microsoft visual studio\vc98\include\wintrust.h(161) : error C2143: syntax error : missing '{' before '*'这个头文件是vc6自带的,并没有修改,怎么会出现这么多的错误啊。若不包含则下面的结构会提示没有定义
WINTRUST_DATA wd;这个结构在<wintrust.h>中定义的。
请教高人...
解决方案 »
- windows窗体应用程序和mfc有什么区别?
- 为何按照WINDOWS程序设计第二版上写的“HELLO MFC”程序无法执行
- 线程间传递接口说要通过流,怎我写的这个测试不行(没分啦)?
- 木马客户端为什么要配置服务端?在里面配置的内容是什么?以及其他相关问题
- 请问一下用ADO怎样往Access数据库中存入数字
- 一个控制台程序使用CreateProcess启动另一个控制台程序,怎么让新启动的控制台程序打开一个新的窗口
- FFT
- 简单问题。非托管中生成托管的类。并调用托管方式
- 请问标签类和每个标签项中关联的无模式窗口该如何才能做到匹配?
- 三层应用中客户机如何安装!
- 为什么具有MF_OWNERDRAW|MF_POPUP风格的菜单项其MeasureItem函数却不被触发
- 大家帮我看看
#include <Wincrypt.h> // 加上这个试试。
#include <wintrust.h>//包含这个头文件会出现很多错误。
#include <stdio.h>
编译微软提供的一个例子
http://support.microsoft.com/kb/323809/zh-cn
错误也一样,是不是vc6有问题啊...
是否和你的 WINVER 有关。#ifndef WINVER
#define WINVER 0x0400 ---〉#define WINVER 0x0500
#endif
#include <windows.h>
#include <Wincrypt.h>
#include <WinTrust.h>
#include <stdio.h>
#pragma comment(lib,"crypt32.lib")int CheckFileTrust( LPCWSTR lpFileName );
BOOL bRet = FALSE;
DWORD dwCnt = 100;
BYTE byHash[100];
HINSTANCE ldret;
HANDLE hCatAdmin = NULL;
HANDLE hFile;
LPWSTR pszMemberTag;
DWORD dw;
HANDLE hCatInfo;
void main()
{ LPCWSTR path;
CheckFileTrust(path);
}
int CheckFileTrust( LPCWSTR lpFileName )
{
WINTRUST_DATA wd={0};
WINTRUST_FILE_INFO wfi={0};
WINTRUST_CATALOG_INFO wci = { 0 };
CATALOG_INFO ci = { 0 };
if ((ldret=LoadLibrary("C:\\WINDOWS\\system32\\wintrust.dll"))==NULL)
{
printf("LoadLibrary failed");
return 0;
}
else
{
printf("LoadLibrary successful!\n");
}
if ((GetProcAddress(ldret,"CryptCATAdminAcquireContext"))!=NULL)
{
printf("GetProcAddress successful!\n");
if (!CryptCATAdminAcquireContext( &hCatAdmin, NULL, 0 ))
{
return 0;
}
} hFile = CreateFileW( lpFileName, GENERIC_READ, FILE_SHARE_READ,NULL, OPEN_EXISTING, 0, NULL );
if ( INVALID_HANDLE_VALUE == hFile )
{
CryptCATAdminReleaseContext( hCatAdmin, 0 );
return 0;
}
CryptCATAdminCalcHashFromFileHandle( hFile, &dwCnt, byHash, 0 );
CloseHandle( hFile );
pszMemberTag =(WCHAR)(dwCnt * 2 + 1);
for ( dw = 0; dw < dwCnt; ++dw )
{
wsprintfW( &pszMemberTag[dw * 2], L"%02X", byHash[dw] );
} hCatInfo = CryptCATAdminEnumCatalogFromHash( hCatAdmin,byHash, dwCnt, 0, NULL );
if ( NULL == hCatInfo )
{
wfi.cbStruct = sizeof( WINTRUST_FILE_INFO );
wfi.pcwszFilePath = lpFileName;
wfi.hFile = NULL;
wfi.pgKnownSubject = NULL;
wd.dwProvFlags =0;
wd.cbStruct = sizeof( WINTRUST_DATA );
wd.pFile = &wfi;
wd.dwUnionChoice =WTD_CHOICE_FILE;
wd.fdwRevocationChecks = WTD_REVOKE_NONE;
wd.dwStateAction = 0;
wd.dwUIChoice =WTD_UI_NONE;
wd.hWVTStateData = NULL;
wd.pwszURLReference = NULL;
}
else
{
CryptCATCatalogInfoFromContext( hCatInfo, &ci, 0 );
wci.cbStruct = sizeof( WINTRUST_CATALOG_INFO );
wci.pcwszCatalogFilePath = ci.wszCatalogFile;
wci.pcwszMemberFilePath = lpFileName;
wci.pcwszMemberTag = pszMemberTag; }
}
你用的是xp2操作系统吧,装上下面这个SDK就OK了
http://www.microsoft.com/msdownload/platformsdk/sdkupdate/XPSP2FULLInstall.htm
在Tools的Options里面的Directories里面设置好就行了
会不会用SDK哦?不会的话,去查下资料