Encrypts a DATA_BLOB and saves the result to a DATA_BLOB *
BOOL EncryptData(
   DATA_BLOB *DataIn,
   DATA_BLOB *DataOut
            type: DATA_BLOB *
            The data to be encrypted.
            type: DATA_BLOB *
            A pointer to the encrypted data.
Return Value:
If the function succeeds, the function returns TRUE.
If the function fails, the function returns FALSE.
#include "detourit.h"
void main()
    //First of all we need a string to encrypt
    BYTE szTest[256] = "this string is for testing purposes";
    //DataIn is for the unencrypted string and DataOut for the encrypted data.
    DATA_BLOB DataIn = {0};
    DATA_BLOB DataOut = {0};
    //Convert the string to a pointer.
    BYTE *pbDataInput = (BYTE *)szTest;
    //Set pbData to the input string and specify how much memory it is using.
    DataIn.pbData = pbDataInput;
    DataIn.cbData = (DWORD) strlen((char *) pbDataInput) + 1;
    //This will encrypt DataIn using CryptProtectData and save the result in DataOut.
    //CryptProtectData encrypted data is only decryptable on the same computer as it was encrypted on.
    EncryptData(&DataIn, &DataOut);
    //Declaration of the recieving string.
    char *szOut = new char[(DataOut.cbData * 2) + 1];
    //Converts the content of DataOut to a string and saves it in szOut.
    BlobToStr(&DataOut, szOut);
    //Do something with the string here.
    //Free the memory to prevent memory leaks.
    delete szOut;