dmtGetCertificateInStore

Recupera il nome del certificato presente nello store (precedentemente selezionato nella chiamata alla funziona dmtCreate) in base all'indice passato.

 

Dichiarazione - C

LONG WINAPI dmtGetCertificateInStore (

HDMTOBJ hDmt,

CHAR *szOutputCertificate,

DWORD dwIndex = 0,

BOOL fDlgView = FALSE,

CHAR *outXMLCertificateFileInfo = "");

 

Dichiarazione - Visual Dataflex

External_Function dmtGetCertificateInStore "dmtGetCertificateInStore" Dimatec.dll ;

Handle hDmt ;

Address lpszOutputCertificate ;

Integer dwIndex ;                   // = 0

Boolean fDlgView ;                  // = FALSE

String sOutXMLCertificateFileInfo ;

Returns Integer

 

Dichiarazione - Visual Basic

Public Declare Function dmtGetCertificateInStore Lib "Dimatec.dll" _

(ByVal hDmt As Long, _

ByVal szOutputCertificate As String, _

Optional ByVal dwIndex As Long = 0, _

Optional ByVal fDlgView As Boolean = False, _

Optional ByVal szOutputCertificate As String) as Long                                      

 

Dichiarazione - C Sharp

[DllImport("Dimatec.dll")]

public static extern int dmtGetCertificateInStore (

int hDmt,

StringBuilder szOutputCertificate,

int dwIndex /* = 0*/,

bool fDlgView /*= false */,

string outXMLCertificateFileInfo /*= ""*/);

 

Parametri di input:
Parametri di output:
Valore di ritorno:

DMT_OK in caso di successo, altrimenti un codice di errore

 


Esempi di utilizzo

 

Visual Dataflex

Integer ret

Integer iCertInStore

Integer iCount

        

String szCertificate

Address lpszCertificate

        

Send Delete_Data of oList_CertificateInStore

        

Move (dmtGetCertificateCountInStore( ;

    ghDmt)) to iCertInStore

        

    For iCount from 0 to (iCertInStore - 1)

            

        Move (Repeat(Character(32), 256)) to szCertificate

        Move (AddressOf(szCertificate)) to lpszCertificate

 

        Move (dmtGetCertificateInStore( ;

            ghDmt , ;

            lpszCertificate , ;

            iCount , ;

            False , ;

            "")) to ret

 

        If (ret <> DMT_OK) Begin

            Send Stop_Box "dmtGetCertificateInStore" "Errore!"

            Procedure_Return

        End

        Else Begin

            Send Add_Item of oList_CertificateInStore Msg_None szCertificate

        End

            

    Loop

 

Visual Basic

Dim iCertInStore As Long

Dim iCount As Long

Dim szCertificate As String

Dim res As Long

    

szCertificate = Space(256)

    

lst_CertificateInStore.Clear

    

g_szCertificate = ""

iCertInStore = dmtGetCertificateCountInStore(g_hDmt)

    

For iCount = 0 To iCertInStore - 1

        

    res = dmtGetCertificateInStore(g_hDmt, szCertificate, iCount, False)

        

    If res <> DMT_OK Then

        MsgBox "dmtGetCertificateInStore", vbCritical, "Errore!"

        Exit Sub

    Else

        lst_CertificateInStore.AddItem szCertificate, iCount

    End If

        

Next iCount

 

C Sharp

int GetCertificateInStoreResult = CDIMATECLIBRARY.DMT_OK;

 

SystemStoreListBox.Items.Clear();

 

int SystemCertificateCount = CDIMATECLIBRARY.dmtGetCertificateCountInStore(

    CDIMATECLIBRARY.ghDimatecObj);

 

if (SystemCertificateCount > 0)

{

    SystemStoreListBox.BeginUpdate();

    for (int index = 0; index < SystemCertificateCount; index++)

    {

        StringBuilder CertificateName = new StringBuilder((new String((char)13, 256)), 256);

        GetCertificateInStoreResult = CDIMATECLIBRARY.dmtGetCertificateInStore(

            CDIMATECLIBRARY.ghDimatecObj,

            CertificateName,

            index,

            false,

            "");

            

        if (GetCertificateInStoreResult != CDIMATECLIBRARY.DMT_OK)

        {

            MessageBox.Show(this, "Errore durante il prelievo dei certificati", "GetCertificateInStore",

                MessageBoxButtons.OK, MessageBoxIcon.Error);

        }

        if (GetCertificateInStoreResult != CDIMATECLIBRARY.DMT_OK)

            break;

        

        SystemStoreListBox.Items.Add(CertificateName.ToString());

    }

    SystemStoreListBox.EndUpdate();

}