• Welcome to Theos PowerBasic Museum 2017.

News:

Attachments are only available to registered users.
Please register using your full, real name.

Main Menu

CryptUIDlgCertMgr

Started by John Thompson, December 27, 2010, 12:25:51 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

John Thompson

I couldn't find any PowerBASIC headers for CryptUIDlgCertMgr.  I tried putting the below together, but it immediately crashes.  Does anyone see something I'm doing wrong?  Thanks!


#COMPILE EXE
#DIM ALL

#INCLUDE "Win32API.INC" 'JR WinAPI 1.17

'http://msdn.microsoft.com/en-us/library/aa380605(v=VS.85).aspx
TYPE CRYPTUI_CERT_MGR_STRUCT DWORD
    dwSize          AS DWORD
    hWndParent      AS DWORD
    dwFlags         AS DWORD
    pwszTitle       AS DWORD
    pszInitUsageOID AS DWORD
END TYPE

'http://msdn.microsoft.com/en-us/library/aa380286(VS.85).aspx
DECLARE FUNCTION CryptUIDlgCertMgr LIB "CRYPTUI.DLL" ALIAS "CryptUIDlgCertMgr" ( _
    BYVAL pCryptUICertMgrStruct AS CRYPTUI_CERT_MGR_STRUCT PTR _ 'IN
) AS LONG                                                        'BOOL

FUNCTION PBMAIN () AS LONG

    LOCAL pCRYPTUI_CERT_MGR_STRUCT AS CRYPTUI_CERT_MGR_STRUCT PTR
    LOCAL sTitle AS STRING

    @pCRYPTUI_CERT_MGR_STRUCT.dwSize = SIZEOF ( CRYPTUI_CERT_MGR_STRUCT )
    @pCRYPTUI_CERT_MGR_STRUCT.hWndParent = %HWND_DESKTOP
    @pCRYPTUI_CERT_MGR_STRUCT.dwFlags = 0
    sTitle = UCODE$ ( "Caption" & $NUL )
    @pCRYPTUI_CERT_MGR_STRUCT.pwszTitle = STRPTR ( sTitle )
    @pCRYPTUI_CERT_MGR_STRUCT.pszInitUsageOID = %NULL

    CryptUIDlgCertMgr ( pCRYPTUI_CERT_MGR_STRUCT )
    'Debugging on above I get "Program tried to read or write an invalid memory address".

END FUNCTION

José Roca

Use this:


#COMPILE EXE
#DIM ALL

#INCLUDE "Win32API.INC" 'JR WinAPI 1.17

'http://msdn.microsoft.com/en-us/library/aa380605(v=VS.85).aspx
TYPE CRYPTUI_CERT_MGR_STRUCT DWORD
    dwSize          AS DWORD
    hWndParent      AS DWORD
    dwFlags         AS DWORD
    pwszTitle       AS DWORD
    pszInitUsageOID AS ASCIIZ PTR
END TYPE

'http://msdn.microsoft.com/en-us/library/aa380286(VS.85).aspx
DECLARE FUNCTION CryptUIDlgCertMgr LIB "CRYPTUI.DLL" ALIAS "CryptUIDlgCertMgr" ( _
    BYREF pCryptUICertMgrStruct AS CRYPTUI_CERT_MGR_STRUCT _     'IN
) AS LONG                                                        'BOOL

FUNCTION PBMAIN () AS LONG

    LOCAL tCRYPTUI_CERT_MGR_STRUCT AS CRYPTUI_CERT_MGR_STRUCT
    LOCAL sTitle AS STRING

    tCRYPTUI_CERT_MGR_STRUCT.dwSize = SIZEOF ( CRYPTUI_CERT_MGR_STRUCT )
    tCRYPTUI_CERT_MGR_STRUCT.hWndParent = %HWND_DESKTOP
    tCRYPTUI_CERT_MGR_STRUCT.dwFlags = 0
    sTitle = UCODE$ ( "Caption" & $NUL )
    tCRYPTUI_CERT_MGR_STRUCT.pwszTitle = STRPTR ( sTitle )
    tCRYPTUI_CERT_MGR_STRUCT.pszInitUsageOID = %NULL

    CryptUIDlgCertMgr ( tCRYPTUI_CERT_MGR_STRUCT )

END FUNCTION


John Thompson

Hi Jose,

Thank you very much!  It works perfectly, of course :)

-John