Platform SDK: Cryptography

VTableProvStruc

The VTableProvStruc structure contains pointers to callback functions that can be used by CSP functions.

typedef struct _VTableProvStruc {
    DWORD    Version;
    FARPROC  FuncVerifyImage;
    FARPROC  FuncReturnhWnd;
    DWORD    dwProvType;
    BYTE     *pbContextInfo;
    DWORD    cbContextInfo;
    LPSTR    pszProvName;
} VTableProvStruc, *PVTableProvStruc;
BOOL FuncVerifyImage(LPCSTR lpszImage, BYTE *pSigData);
BOOL FuncReturnhWnd(DWORD *phWnd);

Members

Version
A DWORD value indicating the version of the structure. Three versions of this structure are used. Microsoft® Windows NT® version 4.0 and Microsoft® Windows® 95 use version 1, which consists of only the first three members: Version, FuncVerifyImage, and FuncReturnhWnd.

Version 2 is available with Windows 98. The first six members are used. Version 3 is available with Windows 2000. It includes all seven members.

FuncVerifyImage
Pointer to a callback function to verify a signature. See Remarks for details.
FuncReturnhWnd
Pointer to a callback function that returns information on a window handle to use when interacting directly with the user using Microsoft® Win32®. CSPs that do not communicate directly with the user and CSPs that use dedicated hardware for this purpose can ignore this entry. This window handle is zero by default, but some applications will set it to a different value by using the CryptSetProvParam function.
dwProvType
A DWORD value that specifies the type of provider to acquire. The following provider types are predefined, and are discussed in detail in CSP Interoperability .
pbContextInfo
Pointer to an array of context information. The pbContextInfo and cbContextInfo members together determine the information set used when a CPSetProvParam is called with PP_CONTEXT_INFO set.
cbContextInfo
DWORD value indicating the number of elements in the pbContextInfo array.
pszProvName
String containing the name of the provider.

Remarks

The pointers in the VTableProvStruc structure are only available within the CPAcquireContext function. If members of the structure are needed after a call to CPAcquireContext is completed, copies of the needed structure elements must be made by the CSP. The function pointers in the structure can be copied and the function pointer can be used until the context is released.

All auxiliary DLLs into which a CSP makes function calls must be signed in the same manner (and with the same key) as the primary CSP DLL. To make this work properly, the auxiliary DLLs must be loaded dynamically, using the LoadLib function. But before LoadLib is called, the signature of the DLL must be verified. The CSP does this verification by calling the FuncVerifyImage function, as illustrated in the following code fragment:

BOOL (FARPROC *ProvVerifyImage)(LPCSTR lpszImage, BYTE *pSigData);
BYTE bSignature[72];

// "ProvVerifyImage" has been set to "pVTable->FuncVerifyImage"
// within the CPAcquireContext function.

// Load the C:\Winnt40\System32\signature.sig file into the 
// bSignature buffer. During development, this file is created 
// with the Sign.exe utility.
...

// Verify the signature on the C:\Winnt40\System32\Signature.dll file.
if(RCRYPT_FAILED(ProvVerifyImage("c:\\winnt40\\system32\\signature.dll",
                                 bSignature)) {
    SetLastError(NTE_BAD_SIGNATURE);
    return CRYPT_FAILED;
}

// Load the DLL with the LoadLib function, then acquire pointers to 
// the member functions with the GetProcAddress function.
...

Requirements

  Windows NT/2000: Requires Windows NT 4.0 or later.
  Windows 95/98: Requires Windows 95 OSR2 or later (or Windows 95 with Internet Explorer 3.02 or later).
  Header: Declared in Wincrypt.h.