[prev in list] [next in list] [prev in thread] [next in thread] 

List:       ms-cryptoapi
Subject:    Re: Help with CryptUIDlgSelectCertificateFromStore
From:       "Kostka, Petr" <petr.kostka () ST ! COM>
Date:       2002-01-11 17:17:17
[Download RAW message or body]


Hi Gary,

CryptUIDlgSelectCertificateFromStore() works only on WinXP as MSDN says.
CryptUIDlgSelectCertificateFromStore() is only
a wrapper to CryptUIDlgSelectCertificate() which is present in CryptoAPI for
a long time, but was undocumented.
I made a little research on that and here are the results. Enjoy it, but be
carefull with using undocumented API!

Have a nice weekend
Petr


    HCERTSTORE  hStore = ::CertOpenSystemStore(0, _T("MY"));

    HMODULE hCryptUI = ::LoadLibrary("cryptui.dll");

    struct CryptUIDlgSelectCertificateParam {
        DWORD   dwSize;     // 60 for WinNT, Win98 and Win98SE and 64 for
Win2K, WinME and WinXP
        HWND    hWndParent;
        DWORD   param3;     // 0x00010000 - Find user button on XP, I do not
understand others
        LPCTSTR szTitle;
        DWORD   dwDontUseColumn;        // Maybe the same values as in
XEncrypt
        LPCTSTR szDisplayString;
        DWORD   param7;
        DWORD   param8;
        DWORD   param9;
        DWORD   param10;    // must be 1
        HCERTSTORE*   hCertStore;
        DWORD   param12;
        DWORD   param13;
        DWORD   param14;
        DWORD   param15;
        DWORD   param16;

    } mParam = {
        sizeof(mParam),     // 60 for WinNT, Win98 and Win98SE and 64 for
Win2K, WinME and WinXP
        0,
        0,
        L"Title",
        0,
        L"Display string",
        0,
        0,
        0,
        1,
        &hStore,
        0,
        0,
        0,
        0,
        0
    };

    typedef PCCERT_CONTEXT WINAPI
CryptUIDlgSelectCertificate(CryptUIDlgSelectCertificateParam*);

    CryptUIDlgSelectCertificate* pfnSelectCert =
        reinterpret_cast<CryptUIDlgSelectCertificate*>
(::GetProcAddress(hCryptUI, "CryptUIDlgSelectCertificateW"));   // CHange W
to A for ANSI version

    PCCERT_CONTEXT pCert = pfnSelectCert(&mParam);


> -----Original Message-----
> From: gary@WEBELOT.COM [mailto:gary@WEBELOT.COM]
> Sent: 11. ledna 2002 17:29
> To: CryptoAPI@DISCUSS.MICROSOFT.COM
> Subject: Help with CryptUIDlgSelectCertificateFromStore
>
>
> Hello,
>
>     I am in the process of writing a test application in VB
> for load testing our Web server components. Our system
> requires the sender to be identified with an appropriate
> certificate before accepting any data posted to it. Since
> this is a test application many tests will be run on
> workstations that have many certificates registered for this purpose.
>
>     What I would like to do is use the
> CryptUIDlgSelectCertificateFromStore CryptoAPI function so
> the desired certificate can be selected by the user, but I am
> unable to find a dll that includes this function. Can anyone
> point me toward one? I would rather not have to write my own. Thanks!
>
> Regards,
>
> Gary Garrison
>
> ----------------------------------------------------------------
> Users Guide http://discuss.microsoft.com/archives/mailfaq.asp
> contains important info. Save time, search the archives at
> http://discuss.microsoft.com/archives/index.ht> ml . To
> unsubscribe,
> mailto:CryptoAPI-signoff-request@DISCUSS.MICROSOFT.COM
>

----------------------------------------------------------------
Users Guide http://discuss.microsoft.com/archives/mailfaq.asp
contains important info. Save time, search the archives at
http://discuss.microsoft.com/archives/index.html .
To unsubscribe, mailto:CryptoAPI-signoff-request@DISCUSS.MICROSOFT.COM

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic