Guest User

Untitled

a guest
May 18th, 2020
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.44 KB | None | 0 0
  1. DWORD  Encoder::Base64Encoding(CONST PBYTE pbBinary, DWORD cbBinary, PTSTR *pszOut) {
  2.     DWORD dwStringLen = 0;
  3.     if (CryptBinaryToString(pbBinary, cbBinary, CRYPT_STRING_BASE64, NULL, &dwStringLen)) {
  4.         *pszOut = (PTSTR)CoTaskMemAlloc(sizeof(TCHAR) * dwStringLen);
  5.         if (*pszOut) {
  6.             if (!CryptBinaryToString(pbBinary, cbBinary, CRYPT_STRING_BASE64, *pszOut, &dwStringLen)) {
  7.                 CoTaskMemFree(*pszOut);
  8.             }
  9.         }
  10.     }
  11.     return dwStringLen;
  12. }
Advertisement
Add Comment
Please, Sign In to add comment