DATA_BLOB (Structures)
Last changed: c.durkin-208.186.175.2

.
Summary

C# Signature:

[StructLayout(LayoutKind.Sequential, CharSet=CharSet.Unicode)]
private struct DATA_BLOB {
    public int cbData;
    public IntPtr pbData;
}

VB .NET Signature:

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)> Structure DATA_BLOB
    Public cbData As Integer
    Public pbData As IntPtr
End Structure

Notes:

None.

Tips & Tricks:

Remember that DATA_BLOB.pbData for the output parameters of the CryptProtectData and CryptUnprotectData functions will point to a block of unmanaged memory that needs to be cleaned up using a call to LocalFree from kernel32. You will of course have to use pinvoke to call LocalFree.

Sample Code:

How To Create a DPAPI Library: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/secmod/html/secmod21.asp

Alternative Managed API:

Do you know one? Please contribute it!

Documentation
DATA_BLOB on MSDN