Declaring the APIs for DPAPI in C#
- From: "Kalvin" <ktuel@xxxxxxxxxx>
- Date: 18 Apr 2005 11:26:07 -0700
I am using the article on Microsoft's site to create a DPAPI library
at:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/secmod/html/secmod21.asp
On the API declarations I am getting on error on the bool right before
the API name. The error is "Expected class, delegate, enum, interface,
or struct"
I'm not a C# wiz and I don't understand how to correct this, or why I
am getting it. Please help. I am getting the same error on all 3
declarations.
Thank you
Kalvin
/* BEGIN CODE */
[DllImport("Crypt32.dll", SetLastError=true,
CharSet=System.Runtime.InteropServices.CharSet.Auto)]
private static extern bool CryptProtectData(
ref DATA_BLOB pDataIn,
String szDataDescr,
ref DATA_BLOB pOptionalEntropy,
IntPtr pvReserved,
ref CRYPTPROTECT_PROMPTSTRUCT pPromptStruct,
int dwFlags,
ref DATA_BLOB pDataOut);
[DllImport("Crypt32.dll", SetLastError=true,
CharSet=System.Runtime.InteropServices.CharSet.Auto)]
private static extern bool CryptUnprotectData(
ref DATA_BLOB pDataIn,
String szDataDescr,
ref DATA_BLOB pOptionalEntropy,
IntPtr pvReserved,
ref CRYPTPROTECT_PROMPTSTRUCT pPromptStruct,
int dwFlags,
ref DATA_BLOB pDataOut);
[DllImport("kernel32.dll",
CharSet=System.Runtime.InteropServices.CharSet.Auto)]
private unsafe static extern int FormatMessage(int dwFlags,
ref IntPtr lpSource,
int dwMessageId,
int dwLanguageId,
ref String lpBuffer, int nSize,
IntPtr *Arguments);
.
- Prev by Date: RE: VS 2005 Beta 1 and SQL Server 2005
- Next by Date: Re: Windows Service File Listener
- Previous by thread: Grid on designer
- Next by thread: How can I determine the name of a new object or variable at run-ti
- Index(es):
Loading