Search
Module:
Directory

   Desktop Functions:

   Smart Device Functions:


Show Recent Changes
Subscribe (RSS)
Misc. Pages
Comments
FAQ
Helpful Tools
Playground
Suggested Reading
Website TODO List
Download Visual Studio Add-In

Search Results for "32" in [All]

advapi32

.

[DllImport("advapi32.dll", SetLastError=true)]

.

Declare Function AccessCheckAndAuditAlarm Lib "advapi32.dll" (TODO) As TODO

.

[DllImport("advapi32.dll", SetLastError=true)]

.

Declare Function AccessCheckAndAuditAlarm Lib "advapi32.dll" (TODO) As TODO

.

[DllImport("advapi32.dll", SetLastError = true)]

.

<DllImport("advapi32.dll", SetLastError:=true)> _

.

Public Declare Function AddAccessAllowedAce Lib "advapi32.dll" _

.

[DllImport("advapi32.dll", SetLastError = true)]

.

<DllImport("advapi32.dll", SetLastError:=true)> _

.

<DllImport("advapi32.dll", SetLastError:=true)> _

.

Public Declare Function AddAce Lib "advapi32.dll" _

.

[DllImport("advapi32.dll", SetLastError=true)]

.

   UInt32 BufferLengthInBytes,

.

   out UInt32 ReturnLengthInBytes);

.

[DllImport("advapi32.dll", SetLastError=true)]

.

   UInt32 Zero,

.

<DllImport("advapi32.dll", SetLastError:=True)> _

.

<DllImport("advapi32.dll", SetLastError:=True)> _

.

Declare Function AdjustTokenPrivileges Lib "advapi32.dll" (

.

        int lastError = System.Runtime.InteropServices.Marshal.GetLastWin32Error();

.

    [DllImport("advapi32.dll", ExactSpelling = true, SetLastError = true)]

.

    [DllImport("kernel32.dll", ExactSpelling = true)]

.

    [DllImport("advapi32.dll", ExactSpelling = true, SetLastError = true)]

.

    [DllImport("advapi32.dll", SetLastError = true)]

.

            var lastError = Marshal.GetLastWin32Error();

.

               var win32Exception = new Win32Exception();

.

               throw new InvalidOperationException("AdjustTokenPrivileges failed.", win32Exception);

.

            var win32Exception = new Win32Exception();

.

            throw new InvalidOperationException("AdjustTokenPrivileges failed.", win32Exception);

.

             var win32Exception = new Win32Exception();

.

                                 currentProcess.ToInt32());

.

             throw new InvalidOperationException(exceptionMessage, win32Exception);

.

           var win32Exception = new Win32Exception();

.

           throw new InvalidOperationException(exceptionMessage, win32Exception);

.

      [DllImport("advapi32.dll", CharSet = CharSet.Unicode, SetLastError = true)]

.

      [DllImport("advapi32.dll", CharSet = CharSet.Unicode, SetLastError = true)]

.

      internal const UInt32 STANDARD_RIGHTS_REQUIRED = 0x000F0000;

.

      internal const UInt32 STANDARD_RIGHTS_READ = 0x00020000;

.

      internal const UInt32 TOKEN_ASSIGN_PRIMARY = 0x0001;

.

      internal const UInt32 TOKEN_DUPLICATE = 0x0002;

.

      internal const UInt32 TOKEN_IMPERSONATE = 0x0004;

.

      internal const UInt32 TOKEN_QUERY = 0x0008;

.

      internal const UInt32 TOKEN_QUERY_SOURCE = 0x0010;

.

      internal const UInt32 TOKEN_ADJUST_PRIVILEGES = 0x0020;

.

      internal const UInt32 TOKEN_ADJUST_GROUPS = 0x0040;

.

      internal const UInt32 TOKEN_ADJUST_DEFAULT = 0x0080;

.

      internal const UInt32 TOKEN_ADJUST_SESSIONID = 0x0100;

.

      internal const UInt32 TOKEN_READ = (STANDARD_RIGHTS_READ | TOKEN_QUERY);

.

      internal const UInt32 TOKEN_ALL_ACCESS = (STANDARD_RIGHTS_REQUIRED |

.

      [DllImport("kernel32.dll", CharSet = CharSet.Auto, SetLastError = true)]

.

      [DllImport("Advapi32.dll", CharSet = CharSet.Auto, SetLastError = true)]

.

      [DllImport("kernel32.dll", CharSet = CharSet.Auto, SetLastError = true)]

.

     internal Int32 LowPart;

.

     internal UInt32 HighPart;

.

     internal Int32 PrivilegeCount;

.

     internal Int32 Attributes;

.

        Public LowPart As UInt32

.

        Public HighPart As UInt32

.

        Public Attributes As UInt32

.

        Public PrivilegeCount As UInt32

.

    <DllImport("advapi32.dll", SetLastError:=True)> _

.

    <DllImport("advapi32.dll", SetLastError:=True)> _

.

    <DllImport("kernel32.dll", SetLastError:=True)> _

.

    <DllImport("advapi32.dll", SetLastError:=True)> _

.

        Dim lastWin32Error As Integer = 0

.

            lastWin32Error = Marshal.GetLastWin32Error()

.

            Throw New System.ComponentModel.Win32Exception(lastWin32Error, _

.

             "LookupPrivilegeValue failed with error " & lastWin32Error.ToString & ".")

.

            lastWin32Error = Marshal.GetLastWin32Error()

.

            Throw New System.ComponentModel.Win32Exception(lastWin32Error, _

.

             "OpenProcessToken failed with error " & lastWin32Error.ToString & ".")

.

                lastWin32Error = Marshal.GetLastWin32Error()

.

                Throw New System.ComponentModel.Win32Exception(lastWin32Error, _

.

                 "AdjustTokenPrivileges failed with error " & lastWin32Error.ToString & ".")

.

[DllImport("advapi32.dll", SetLastError=true)]

.

Declare Function AllocateAndInitializeSid Lib "advapi32.dll" ( _

.

    Const SECURITY_BUILTIN_DOMAIN_RID As Integer = 32

.

[DllImport("advapi32.dll", SetLastError=true)]

.

Declare Function AuditEnumerateCategories Lib "advapi32.dll" (TODO) As TODO

.

[DllImport("advapi32.dll", CharSet = CharSet.Unicode, SetLastError = true)]

.

Declare Function BackupEventLog Lib "advapi32.dll" (TODO) As TODO

.

    [DllImport("advapi32.dll", CharSet = CharSet.Unicode, SetLastError = true)]

.

    [DllImport("advapi32.dll", CharSet = CharSet.Unicode, SetLastError = true)]

.

    [DllImport("advapi32.dll", SetLastError = true)]

.

[DllImport("advapi32.dll", SetLastError=true, CharSet=CharSet.Auto)]

.

Declare Function BuildExplicitAccessWithName Lib "advapi32.dll" ( _

.

    Dim Win32Error As Win32Exception

.

        Win32Error = New Win32Exception(ret)

.

        Throw New Exception(Win32Error.Message)

.

[DllImport("advapi32.dll", SetLastError = true)]

.

    Private Declare Auto Sub BuildTrusteeWithSid Lib "advapi32.dll" ( _

.

        Dim Win32Error As Win32Exception

.

        LastError = Marshal.GetLastWin32Error()

.

        Win32Error = New Win32Exception(LastError)

.

        Throw New Exception(Win32Error.Message)

.

Declare Function CertSrvIsServerOnline Lib "advapi32.dll" (TODO) As TODO

.

    [DllImport("advapi32.dll", SetLastError=true, CharSet=CharSet.Auto)]

.

Declare Function ChangeServiceConfig2 Lib "advapi32.dll" (TODO) As TODO

.

            throw new Exception(String.Format("Error connecting to Service Control Manager. Error provided was: 0x{0:X}", Marshal.GetLastWin32Error()));

.

            throw new Exception(String.Format("Error opening service for modifying. Error returned was: 0x{0:X}", Marshal.GetLastWin32Error()));

.

            throw new Exception(String.Format("Unable to allocate memory for service action, error was: 0x{0:X}", Marshal.GetLastWin32Error()));

.

            throw new Exception(String.Format("Unable to allocate memory, error was: 0x{0:X}", Marshal.GetLastWin32Error()));

.

            throw new Exception(String.Format("Error setting service config, error was: 0x{0:X}", Marshal.GetLastWin32Error()));

.

    [DllImport("advapi32.dll", SetLastError=true, CharSet=CharSet.Auto)]

.

Declare Function ChangeServiceConfig2 Lib "advapi32.dll" (TODO) As TODO

.

            throw new Exception(String.Format("Error connecting to Service Control Manager. Error provided was: 0x{0:X}", Marshal.GetLastWin32Error()));

.

            throw new Exception(String.Format("Error opening service for modifying. Error returned was: 0x{0:X}", Marshal.GetLastWin32Error()));

.

            throw new Exception(String.Format("Unable to allocate memory for service action, error was: 0x{0:X}", Marshal.GetLastWin32Error()));

.

            throw new Exception(String.Format("Unable to allocate memory, error was: 0x{0:X}", Marshal.GetLastWin32Error()));

.

            throw new Exception(String.Format("Error setting service config, error was: 0x{0:X}", Marshal.GetLastWin32Error()));

.

[DllImport("advapi32.dll", SetLastError=true)]

.

    Declare Function CheckTokenMembership Lib "advapi32.dll" ( _

.

    LogonType = LOGON32_LOGON_INTERACTIVE

.

    LogonProvider = LOGON32_PROVIDER_DEFAULT

.

    [DllImport("advapi32.dll", SetLastError=true, EntryPoint="ClearEventLog")]

.

Declare Function ClearEventLog Lib "advapi32.dll" (TODO) As TODO

.

            throw new Win32Exception(Marshal.GetLastWin32Error());

.

            throw new Win32Exception(Marshal.GetLastWin32Error());

.

        catch (Win32Exception ex)

.

[DllImport("advapi32.dll", SetLastError = true)]

.

Declare Function CloseEventLog Lib "advapi32.dll" (TODO) As TODO

.

[DllImport("advapi32.dll", SetLastError=true)]

.

    <DllImport("advapi32.dll", SetLastError:=True)> _

.

    Declare Function CloseServiceHandle Lib "advapi32.dll" (ByVal hSCObject As IntPtr) As Boolean

.

[DllImport("advapi32.dll", SetLastError=true)]

.

<DllImport("advapi32.dll", SetLastError:=True)> _

.

Declare Function ControlService Lib "advapi32.dll" (ByVal hService As Long, ByVal lControlCode As Long, ByVal lpServiceStatus As SERVICE_STATUS) As Boolean

.

     [DllImport ("advapi32.dll", SetLastError = true)]

.

     [DllImport ("advapi32.dll", EntryPoint = "OpenSCManagerW", ExactSpelling = true, CharSet = CharSet.Unicode, SetLastError = true)]

.

     [DllImport ("advapi32.dll", SetLastError = true, CharSet = CharSet.Auto)]

.

     [DllImport ("advapi32.dll", SetLastError = true)]

.

     [DllImport ("advapi32.dll", EntryPoint = "QueryServiceStatus", CharSet = CharSet.Auto)]

.

     [DllImport ("advapi32.dll")]

.

[DllImport("advapi32.dll", SetLastError=true)]

.

Declare Unicode Function ConvertSecurityDescriptorToStringSecurityDescriptor Lib "advapi32.dll" Alias "ConvertSecurityDescriptorToStringSecurityDescriptorW" (SD As IntPtr, SDRevision As Integer, SecurityInfo As SECURITY_INFORMATION, ByRef StringSD As IntPtr, StringSDLength As IntPtr) As Boolean

.

[DllImport("advapi32", CharSet=CharSet.Auto, SetLastError=true)]

.

[DllImport("advapi32", CharSet = CharSet.Auto, SetLastError = true)]

.

Declare Auto Function ConvertSidToStringSid Lib "advapi32.dll" (ByVal pSID() As Byte, _

.

     throw new System.ComponentModel.Win32Exception();

.

            UInt32 iSubAuth = BitConverter.ToUInt32(sidBytes, idxAuth);

.

[DllImport("advapi32.dll", SetLastError=true)]

.

Declare Function ConvertStringSecurityDescriptorToSecurityDescriptor Lib "advapi32.dll" (TODO) As TODO

.

[DllImport("advapi32.dll", SetLastError=true)]

.

    Private Declare Auto Function ConvertSidToStringSid Lib "advapi32.dll" ( _

.

    ManagementObjectCollection UserSearch = new ManagementObjectSearcher("Select * From Win32_LogicalFileSecuritySetting Where Path='" + FromPath + "'").Get();

.

    ManagementObject Share = new ManagementObject("Win32_Directory='" + ToPath + "'");

.

internal class Win32_Ace

.

    [DllImport("advapi32.dll", SetLastError=true)]

.

    [DllImport("advapi32.dll", EntryPoint = "GetLengthSid", CharSet = CharSet.Auto)]

.

            System.Management.ManagementClass("Win32_Ace").CreateInstance();

.

        Ace["Trustee"] = Win32_Trustee(Account);

.

    private static ManagementObject Win32_Trustee(string Account)

.

            new ManagementObjectSearcher("Select * From Win32_Account Where Name = '" + Account + "'").Get();

.

        ManagementObject Trustee = new System.Management.ManagementClass("Win32_Trustee").CreateInstance();

.

[DllImport("advapi32.dll", SetLastError=true)]

.

[DllImport("advapi32.dll", SetLastError=true)]

.

Declare Function CopySid Lib "advapi32.dll" (ByVal nDestinationSidLength As Integer, _

.

[DllImport("advapi32.dll", SetLastError=true, CharSet=CharSet.Auto)]

.

Private Declare Auto Function CreateProcessAsUser Lib "advapi32" ( _

.

<DllImport("Advapi32.dll", ExactSpelling:=False, SetLastError:=True, CharSet:=CharSet.Unicode)> _

.

if (LogonUser(userPart, domainPart, password, LOGON_TYPE.LOGON32_LOGON_BATCH, LOGON_PROVIDER.LOGON32_PROVIDER_DEFAULT, hToken))

.

If LogonUser(userPart, domainPart, password, LOGON_TYPE.LOGON32_LOGON_BATCH, _

.

          LOGON_PROVIDER.LOGON32_PROVIDER_DEFAULT, hToken) Then

.

  [DllImport("advapi32.dll", SetLastError=true, CharSet=CharSet.Unicode)]

.

     UInt32             environment,

.

<DllImport("advapi32.dll", SetLastError:=True, CharSet:=CharSet.Unicode)> _

.

    Public Function CreateProcessWithLogonW(ByVal userName As String, ByVal domain As String, ByVal password As String, ByVal logonFlags As UInt32, ByVal applicationName As String, ByVal commandLine As String, ByVal creationFlags As UInt32, ByVal environment As UInt32, ByVal currentDirectory As String, ByRef startupInfo As StartupInfo, ByRef processInformation As ProcessInformation) As Boolean

.

    Public Infinite As System.UInt32 = Convert.ToUInt32(&HFFFFFFF)

.

    Public Startf_UseStdHandles As Int32 = &H100

.

    Public StdOutputHandle As Int32 = -11

.

    Public StdErrorHandle As Int32 = -12

.

    <DllImport("advapi32.dll", SetLastError:=True, CharSet:=CharSet.Unicode)> _

.

    Public Function CreateProcessWithLogonW(ByVal userName As String, ByVal domain As String, ByVal password As String, ByVal logonFlags As UInt32, ByVal applicationName As String, ByVal commandLine As String, ByVal creationFlags As UInt32, ByVal environment As UInt32, ByVal currentDirectory As String, ByRef startupInfo As StartupInfo, ByRef processInformation As ProcessInformation) As Boolean

.

    <DllImport("kernel32.dll", SetLastError:=True)> _

.

    Public Function GetExitCodeProcess(ByVal process As IntPtr, ByRef exitCode As UInt32) As Boolean

.

    <DllImport("Kernel32.dll", SetLastError:=True)> _

.

    Public Function WaitForSingleObject(ByVal handle As IntPtr, ByVal milliseconds As UInt32) As UInt32

.

    <DllImport("Kernel32.dll", SetLastError:=True)> _

.

    <DllImport("Kernel32.dll", SetLastError:=True)> _

.

    Marshal.WriteInt32(MyPointer, StdOutputHandle)

.

    Marshal.WriteInt32(MyErrorPointer, StdErrorHandle)

.

    Dim exitCode As System.UInt32 = Convert.ToUInt32(123456)

.

        CreateProcessWithLogonW(user, domain, password, Convert.ToUInt32(1), _

.

        command, command, Convert.ToUInt32(0), Convert.ToUInt32(0), _

.

        public const UInt32 Infinite = 0xffffffff;

.

        public const Int32      Startf_UseStdHandles = 0x00000100;

.

        public const Int32      StdOutputHandle = -11;

.

        public const Int32      StdErrorHandle = -12;

.

        [DllImport("advapi32.dll", SetLastError=true, CharSet=CharSet.Unicode)]

.

            UInt32 logonFlags,

.

            UInt32 creationFlags,

.

            UInt32 environment,

.

        [DllImport("kernel32.dll", SetLastError=true)]

.

        public static extern bool GetExitCodeProcess(IntPtr process, ref UInt32 exitCode);

.

        [DllImport("Kernel32.dll", SetLastError=true)]

.

        public static extern UInt32 WaitForSingleObject(IntPtr handle, UInt32 milliseconds);

.

        [DllImport("Kernel32.dll", SetLastError=true)]

.

        [DllImport("Kernel32.dll", SetLastError=true)]

.

            UInt32 exitCode = 123456;

.

                    (UInt32) 1,

.

                    (UInt32) 0,

.

                    (UInt32) 0,

.

[DllImport("advapi32.dll", SetLastError=true, CharSet=CharSet.Auto)]

.

    <DllImport("advapi32.dll", SetLastError:=True, CharSet:=CharSet.Auto)> _

.

                ByVal displayName As String, ByVal desiredAccess As Int32, ByVal serviceType As Int32, _

.

                ByVal startType As Int32, ByVal errorcontrol As Int32, ByVal binaryPathName As String, _

.

                ByVal loadOrderGroup As String, ByVal TagBY As Int32, ByVal dependencides As String, _

.

    SERVICE_WIN32_OWN_PROCESS = 0x00000010,

.

    SERVICE_WIN32_SHARE_PROCESS = 0x00000020,

.

    SERVICE_WIN32_OWN_PROCESS = &H10

.

    SERVICE_WIN32_SHARE_PROCESS = &H20

.

    Dim serviceHandle As IntPtr = CreateService(scHandle, serviceName, displayName, SERVICE_ALL_ACCESS, SERVICE_WIN32_OWN_PROCESS, _

.

        MsgBox(Marshal.GetLastWin32Error())

.

[DllImport("advapi32.dll", SetLastError=true)]

.

    Private Declare Function CreateWellKnownSid Lib "advapi32.dll" ( _

.

      pSid = Marshal.AllocCoTaskMem(Convert.ToInt32(cbSid));

.

        ret = Marshal.GetLastWin32Error()

.

        Throw New Win32Exception(ret)

.

    [DllImport("advapi32.dll", EntryPoint = "CredDeleteW", CharSet = CharSet.Unicode)]

.

  Public Declare Unicode Function CredDelete Lib "advapi32.dll" Alias "CredDeleteW" ( ByVal TargetName As String, ByVal Type As Integer, ByVal Flags As Integer) As Boolean

.

    [DllImport("advapi32.dll", EntryPoint = "CredDeleteW", CharSet = CharSet.Unicode)]

.

     public UInt32 flags;

.

     public UInt32 type;

.

    Add-Type -MemberDefinition $sig -Namespace "ADVAPI32" -Name 'Util'

.

    $cred = New-Object ADVAPI32.Util+Credential

.

[DllImport("advapi32.dll", SetLastError=true)]

.

Declare Function CredFree Lib "advapi32.dll" (Buffer As IntPtr) As Boolean

.

[DllImport("advapi32.dll", CharSet = CharSet.Unicode, SetLastError=true)]

.

Declare Function CredMarshalCredential Lib "advapi32.dll" (TODO) As TODO

.

[DllImport("advapi32.dll", EntryPoint="CredReadW", CharSet = CharSet.Unicode, SetLastError=true)]

.

Declare Function CredRead  Lib "advapi32.dll" (TODO) As TODO

.

        [DllImport("Advapi32.dll", EntryPoint = "CredReadW", CharSet = CharSet.Unicode, SetLastError = true)]

.

Declare Function CredRead Lib "advapi32.dll" (TODO) As TODO

.

        public UInt32 Flags;

.

            public UInt32 Flags;

.

            public UInt32 CredentialBlobSize;

.

            public UInt32 AttributeCount;

.

[DllImport("Advapi32.dll", SetLastError=true, EntryPoint="CredWriteW", CharSet=CharSet.Unicode)]

.

static extern bool CredWrite([In] ref Credential userCredential, [In] UInt32 flags);

.

Declare Function CredWrite Lib "advapi32.dll" (TODO) As TODO

.

     public UInt32 flags;

.

     public UInt32 type;

.

     public UInt32 credentialBlobSize;

.

     public UInt32 persist;

.

     public UInt32 attributeCount;

.

     userCredential.type = (UInt32)CRED_TYPE.CRED_TYPE_DOMAIN_PASSWORD;

.

     userCredential.persist = (UInt32)CRED_PERSIST.CRED_PERSIST_ENTERPRISE;

.

     userCredential.credentialBlobSize = (UInt32)bpassword.Length;

.

     throw new System.ComponentModel.Win32Exception(Marshal.GetLastWin32Error());

.

[DllImport("Advapi32.dll", SetLastError=true, EntryPoint="CredWriteW", CharSet=CharSet.Unicode)]

.

public static extern bool CredWrite([In] ref Credential userCredential, [In] UInt32 flags);

.

     public UInt32 flags;

.

     public UInt32 type;

.

     public UInt32 credentialBlobSize;

.

     public UInt32 persist;

.

     public UInt32 attributeCount;

.

Add-Type -MemberDefinition $sig -Namespace "ADVAPI32" -Name 'Util'

.

$cred = New-Object ADVAPI32.Util+Credential

.

[ADVAPI32.Util]::CredWrite([ref]$cred,0)

.

[DllImport("advapi32.dll", CharSet=CharSet.Auto, SetLastError=true)]

.

Declare Function CryptAcquireContext Lib "advapi32.dll" (ByRef hProv As IntPtr, _

.

public class Crypt32 { [DllImport("advapi32.dll", SetLastError=true)]

.

bool res = Crypt32.CryptAcquireContext(out hProv, "user", null, PROV_RSA_FULL, CRYPT_NEWKEYSET);

.

[DllImport("advapi32.dll", CharSet=CharSet.Auto, SetLastError=true)]

.

Declare Auto Function CryptCreateHash Lib "advapi32.dll" (ByVal hProv As IntPtr, _

.

[DllImport("advapi32.dll", SetLastError = true)]

.

Declare Function CryptDecrypt Lib "advapi32.dll" (ByVal hkey As IntPtr, _

.

[DllImport("advapi32.dll", SetLastError=true)]

.

Declare Function CryptDeriveKey Lib "advapi32.dll" (ByVal hProv As IntPtr, _

.

[DllImport("advapi32.dll", SetLastError=true)]

.

Declare Function CryptDestroyHash Lib "advapi32.dll" (ByVal hHash As IntPtr) _

.

[DllImport("advapi32.dll", SetLastError=true)]

.

Declare Function CryptDestroyKey Lib "advapi32.dll" (ByVal hKey As IntPtr) _

.

    [DllImport("advapi32.dll", SetLastError=true)]

.

Declare Function CryptDuplicateKey Lib "advapi32.dll" (TODO) As TODO

.

[DllImport(@"advapi32.dll", CharSet = CharSet.Auto, SetLastError = true)]

.

Declare Function CryptEncrypt Lib "advapi32.dll" (ByVal hkey As IntPtr, _

.

[DllImport("advapi32.dll", SetLastError=true, CharSet=CharSet.Auto)]

.

[DllImport("advapi32.dll", EntryPoint = "CryptEnumProviders", SetLastError = true)]

.

[DllImport("Advapi32.dll")]

.

     [DllImport("advapi32", CharSet = CharSet.Unicode, SetLastError = true), SuppressUnmanagedCodeSecurityAttribute]

.

     [DllImport("advapi32", CharSet = CharSet.Unicode, SetLastError = true), SuppressUnmanagedCodeSecurityAttribute]

.

     [UInt32]$dwIndex = 0

.

     [UInt32]$pdwProvType = 0

.

     [UInt32]$pcbTypeName = 0

.

     [UInt32]$dwIndex = 0

.

     [UInt32]$pdwProvType = 0

.

     [UInt32]$pcbProvName = 0

.

[DllImport("advapi32.dll", SetLastError=true, CharSet=CharSet.Auto)]

.

Declare Function CryptEnumProviderTypes Lib "advapi32.dll" (TODO) As TODO

.

[DllImport(@"advapi32.dll", CharSet = CharSet.Auto, SetLastError = true)]

.

Declare Function CryptExportKey Lib "advapi32.dll" (TODO) As TODO

.

[DllImport(@"Advapi32.dll", CharSet = CharSet.Auto, SetLastError = true)]

.

<DLLImport("advapi32.dll", CharSet := CharSet.Auto, SetLastError := True)>

.

[DllImport("advapi32.dll", SetLastError=true)]

.

Declare Function CryptGenRandom Lib "advapi32.dll" (ByVal hProv As IntPtr, ByVal dwLen As Integer, ByVal pbBuffer As Byte()) As Boolean

.

    throw new Win32Exception(Marshal.GetLastWin32Error());

.

[DllImport("advapi32.dll", SetLastError=true)]

.

    UInt32 dwProvType,

.

    UInt32 dwFlags,

.

Declare Function CryptGetDefaultProvider Lib "advapi32.dll" (TODO) As TODO

.

const UInt32 CRYPT_USER_DEFAULT = 0x00000002;

.

const UInt32 CRYPT_MACHINE_DEFAULT = 0x00000001;

.

[DllImport("advapi32.dll", SetLastError = true)]

.

Declare Function cryptgethashparamsize Lib "advapi32.dll" (TODO) As TODO

.

    [DllImport("advapi32.dll", SetLastError=true)]

.

Declare Function CryptGetKeyParam Lib "advapi32.dll" (TODO) As TODO

.

[DllImport("advapi32.dll", SetLastError=true)]

.

[DllImport("advapi32.dll", SetLastError=true)]

.

Declare Function CryptGetProvParam Lib "advapi32.dll" (hProv As IntPtr, dwParam As Integer, _

.
Summary
The CryptGetUserKey function retrieves a handle of one of a user's two public/private key pairs. This function is used only by the owner of the public/private key pairs and only when the handle of a cryptographic service provider (CSP) and its associated key container is available. If the CSP handle is not available and the user's certificate is, use CryptAcquireCertificatePrivateKey.
.

    [DllImport("advapi32.dll", SetLastError=true)]

.

Declare Function CryptGetUserKey Lib "advapi32.dll" (TODO) As TODO

.

  [DllImport("advapi32.dll", SetLastError=true)]

.

     Friend Declare Function CryptHashData Lib "advapi32.dll"(ByVal hHash As IntPtr, ByVal pbData As Byte(), ByVal dwDataLen As Integer, ByVal dwFlags As Integer) As <MarshalAs(UnmanagedType.Bool)> Boolean

.

[DllImport("advapi32.dll", SetLastError=true)]

.

        Int32 dwFlags

.

Declare Function CryptHashSessionKey Lib "advapi32.dll" (TODO) As TODO

.

[DllImport(@"advapi32.dll", CharSet = CharSet.Auto, SetLastError = true)]

.

public static extern bool CryptImportKey(IntPtr hProv, byte[] pbKeyData, UInt32 dwDataLen, IntPtr hPubKey, UInt32 dwFlags, ref IntPtr hKey);

.

Public Declare Function CryptImportKey Lib "advapi32.dll" (ByVal hProv As Long, _

.

[DllImport("Advapi32.dll", EntryPoint = "CryptReleaseContext", CharSet = CharSet.Unicode, SetLastError = true)]

.

   Int32 dwFlags   // Reserved. Must be 0.

.

Declare Function CryptReleaseContext Lib "advapi32.dll" (hProv As IntPtr, _

.

[DllImport("advapi32.dll", SetLastError = true)]

.

[DllImport("advapi32.dll", SetLastError = true)]

.

Declare Function CryptSetKeyParam Lib "advapi32.dll" (TODO) As TODO

.

[DllImport("advapi32.dll", SetLastError = true, CharSet = CharSet.Auto)]

.

    throw new Exception("Ошибка ввода пин-кода.", new Win32Exception(Marshal.GetLastWin32Error()));

Cut off search results after 60. Please refine your search.


 
Access PInvoke.net directly from VS: