x64 fehler: The parameter is incorrect.
Kann jemand helfen.
Code: Alles auswählen
; #include <iostream>
; #include <stdio.h>
; #include <windows.h>
; #include <Wincrypt.h>
; using namespace std;
;
; int main()
; {
;
; // Encrypt Data from DATA_BLOB DataIn To DATA_BLOB DataOut.
; //--------------------------------------------------------------------
; // Declare And initialize variables.
;
; DATA_BLOB DataIn;
; DATA_BLOB DataOut;
; BYTE *pbDataInput =(BYTE *)"Hello world of data protection.";
; DWORD cbDataInput = strlen((char *)pbDataInput)+1;
;
; //--------------------------------------------------------------------
; // Initialize the DataIn Structure.
;
; DataIn.pbData = pbDataInput;
; DataIn.cbData = cbDataInput;
;
; //--------------------------------------------------------------------
; // Begin protect phase. Note that the encryption key is created
; // by the function And is Not passed.
;
; If(CryptProtectData(
; &DataIn,
; L"string.", // A description string
; // To be included With the
; // encrypted Data.
; NULL, // Optional entropy Not used.
; NULL, // Reserved.
; NULL, // Pass NULL For the
; // prompt Structure.
; 0,
; &DataOut))
; {
; printf("The encryption phase worked.\n");
; }
; Else
; {
; printf("Encryption error using CryptProtectData.\n");
; exit(1);
; }
;
; cout << DataOut.cbData << endl;
; cout << DataOut.pbData << endl;
;
; Return 0;
; }
;
ImportC ""
strlen(p)
EndImport
Structure DATA_BLOB
cbData.l
*pbData
EndStructure
DataIn.DATA_BLOB
DataOut.DATA_BLOB
*pbDataInput = UTF8("Hello")
cbDataInput.l = strlen(*pbDataInput)+1;
DataIn\pbData = *pbDataInput
DataIn\cbData = cbDataInput
If OpenLibrary(0, "crypt32.dll")
result.b = CallFunction(0, "CryptProtectData", @DataIn, UTF8("Hello"),#NUL,#NUL,#NUL,0, @DataOut)
If result
Debug "ok"
Else
Debug "error: " + GetLastError_()
;https://msdn.microsoft.com/de-de/library/windows/desktop/ms681381(v=vs.85).aspx
EndIf
EndIf
; Debug DataOut\pbData
; Debug DataOut\cbData