kempyeng
March 25th, 2004, 11:08 PM
Hi all,
I try to make simple program (from msdn sample) to encrypt data using Visual C++ 6, this is the program :
#include // CryptoAPI definitions
#define MS_DEF_PROV "Microsoft Base Cryptographic Provider v1.0"
#define PROV_RSA_FULL 1
BOOL bResult;
HCRYPTPROC hProv;
// Attempt to acquire a handle to the default key container.
bResult = CryptAcquireContext(
&hProv, // Variable to hold returned handle.
NULL, // Use default key container.
MS_DEF_PROV, // Use default CSP.
PROV_RSA_FULL, // Type of provider to acquire.
0); // No special action.
// Release handle to container.
CryptReleaseContext(hProv);
but when I compile those codes, I get error messages like this :
error C2065: 'HCRYPTPROC' : undeclared identifier
error C2146: syntax error : missing ';' before identifier 'hProv'
error C2065: 'hProv' : undeclared identifier
error C2065: 'CryptAcquireContext' : undeclared identifier
error C2065: 'CryptReleaseContext' : undeclared identifier
I don't understand, these codes are very simple and I capture these codes from MSDN (so it must be success). Can anyone help me ?
Thanks
I try to make simple program (from msdn sample) to encrypt data using Visual C++ 6, this is the program :
#include // CryptoAPI definitions
#define MS_DEF_PROV "Microsoft Base Cryptographic Provider v1.0"
#define PROV_RSA_FULL 1
BOOL bResult;
HCRYPTPROC hProv;
// Attempt to acquire a handle to the default key container.
bResult = CryptAcquireContext(
&hProv, // Variable to hold returned handle.
NULL, // Use default key container.
MS_DEF_PROV, // Use default CSP.
PROV_RSA_FULL, // Type of provider to acquire.
0); // No special action.
// Release handle to container.
CryptReleaseContext(hProv);
but when I compile those codes, I get error messages like this :
error C2065: 'HCRYPTPROC' : undeclared identifier
error C2146: syntax error : missing ';' before identifier 'hProv'
error C2065: 'hProv' : undeclared identifier
error C2065: 'CryptAcquireContext' : undeclared identifier
error C2065: 'CryptReleaseContext' : undeclared identifier
I don't understand, these codes are very simple and I capture these codes from MSDN (so it must be success). Can anyone help me ?
Thanks