#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>中定义的。
请教高人...

解决方案 »

  1.   

    #include <windows.h> 
    #include <Wincrypt.h> // 加上这个试试。
    #include  <wintrust.h>//包含这个头文件会出现很多错误。 
    #include  <stdio.h> 
      

  2.   

    加上了还是同样的错误...
    编译微软提供的一个例子
    http://support.microsoft.com/kb/323809/zh-cn
    错误也一样,是不是vc6有问题啊...
      

  3.   

    猜测:
    是否和你的 WINVER  有关。#ifndef WINVER
    #define WINVER 0x0400 ---〉#define WINVER 0x0500 
    #endif
      

  4.   

    修改了winver还是不行啊,继续求助ing
    #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; }
    }
      

  5.   

    identifier 'CMSG_SIGNER_INFO' 
      

  6.   

    遇到这种“包含头文件出现未定义”的问题,想都别想,肯定是SDK的问题
    你用的是xp2操作系统吧,装上下面这个SDK就OK了
    http://www.microsoft.com/msdownload/platformsdk/sdkupdate/XPSP2FULLInstall.htm
    在Tools的Options里面的Directories里面设置好就行了
    会不会用SDK哦?不会的话,去查下资料