0

I want to use the function CryptProtectData()

the definition is:

[DllImport("Crypt32.dll",SetLastError = true,CharSet = System.Runtime.InteropServices.CharSet.Auto)]
[return: MarshalAs(UnmanagedType.Bool)]
private static extern bool CryptProtectData(
ref DATA_BLOB pDataIn,
String szDataDescr,
ref DATA_BLOB pOptionalEntropy,
IntPtr pvReserved,
ref CRYPTPROTECT_PROMPTSTRUCT pPromptStruct,
CryptProtectFlags dwFlags,
ref DATA_BLOB pDataOut
);

the parameter "CRYPTPROTECT_PROMPTSTRUCT pPromptStruct" requires a ref to structure, but i need to pass null here. the description of the function on msdn says that u can pass null here, but C# doesnot allow this...

Is there any way out... plz help...

2
Contributors
1
Reply
2
Views
5 Years
Discussion Span
Last Post by Momerath
0

Why not just use ProtectedData class from .NET? They do the exact same thing.

Otherwise you can declare in your C# code that CRYPTPROTECT_PROMPTSTRUCT is a class and pass null.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.