Type a page name and press Enter. You'll jump to the page if it exists, or you can create it if it doesn't.
To create a page in a module other than advapi32, prefix the name with the module name and a period.
Declare Function CryptAcquireContext Lib "advapi32.dll" (ByRef hProv As IntPtr, _
pszContainer As String, pszProvider As String, dwProvType As Integer, _
dwFlags As Integer) As Boolean
User-Defined Types:
None.
Notes:
None.
Tips & Tricks:
static long CRYPT_NEWKEYSET = 0x8;
static long CRYPT_DELETEKEYSET = 0x10;
static long CRYPT_MACHINE_KEYSET = 0x20;
static long CRYPT_SILENT = 0x40;
static long CRYPT_DEFAULT_CONTAINER_OPTIONAL = 0x80;
static long CRYPT_VERIFYCONTEXT = 0xF0000000;
Please add some!
static int PROV_RSA_FULL = 1;
Sample Code:
public class Crypt32 { [DllImport("advapi32.dll", SetLastError=true)]
public class Crypt32
{
[DllImport("advapi32.dll", SetLastError=true)]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool CryptAcquireContext(
out IntPtr phProv,
string pszContainer,
string pszProvider,
uint dwProvType,
uint dwFlags);}
bool res = Crypt32.CryptAcquireContext(out hProv, "user", null, PROV_RSA_FULL, CRYPT_NEWKEYSET);
Alternative Managed API:
TODO
An IntPtr is a pointer to a memory location (unmanaged) that adapts to the platform it is running on (64-bit, etc.) UNLIKE a standard int/Integer. You should always use this type for unmanaged calls that require it, even though an int will appear to work on your development machine.
1/13/2008 4:00:13 AM - Damon Carr-72.43.165.29
An IntPtr is a pointer to a memory location (unmanaged) that adapts to the platform it is running on (64-bit, etc.) UNLIKE a standard int/Integer. You should always use this type for unmanaged calls that require it, even though an int will appear to work on your development machine.
1/13/2008 4:00:13 AM - Damon Carr-72.43.165.29
Please edit this page!
Do you have...
helpful tips or sample code to share for using this API in managed code?
corrections to the existing content?
variations of the signature you want to share?
additional languages you want to include?
Select "Edit This Page" on the right hand toolbar and edit it! Or add new pages containing supporting types needed for this API (structures, delegates, and more).