有没有人知道为什么这段代码不工作?CryptStringToBinary不能使用NULL结尾的字符串。为什么?
#include "stdafx.h"
#include <windows.h>
#include <WinCrypt.h>
int _tmain(int argc, _TCHAR* argv[])
{
wchar_t *bin = TEXT("ProductID:1233===>55555");
BYTE out2[1000];
DWORD olen;
olen = 1000;
if (CryptStringToBinary(bin, 0, 1, out2, &olen, 0, 0) == 0)
{
wprintf(TEXT("Failure\n"));
}
else
{
//wprintf(TEXT("rn%s\n"),out2);
wprintf(TEXT("Success\n"));
}
system("pause");
return 0;
}
非常感谢您提前!
Tom
只是为了澄清,代码工作,但CryptBinaryToString总是返回0. – 2010-07-04 17:54:44