I am currently trying to make a call to this function call. Here's the declaration:
const void* WINAPI CertCreateContext(
__in DWORD dwContextType,
__in DWORD dwEncodingType,
__in const BYTE *pbEncoded,
__in DWORD cbEncoded,
__in DWORD dwFlags,
__in_opt PCERT_CREATE_CONTEXT_PARA pCreatePara
);
As you can see, the third input param calls for a const BYTE * which represents the encoded certificate you are trying to create. How do I define such a variable in c++?
You don't need to. The function parameter is a pointer to a const BYTE, which means the function will not change the byte it points to. A simple example:
void f( const BYTE * p ) {
// stuff
}
BYTE b = 42;
BYTE a[] = { 1, 2, 3 };
f( & b );
f( a );
You will of course need to #include the header that declares the type BYTE.
你只需要声明一个BYTE*
,编译器会自动施放的非const
s到const
秒。
According to the documentation :
pbEncoded is a pointer to a buffer that contains the existing encoded context content to be copied.
Pass in a regular pointer to BYTE. The const
there indicates that the pointed-to object will not be modified inside the function.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.