好久没有贴代码了,今天贴一个。目的和作用如题。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
// copied from cryptuiapi.h typedef struct _CRYPTUI_CERT_MGR_STRUCT { DWORD dwSize; HWND hwndParent; DWORD dwFlags; LPCWSTR pwszTitle; LPCSTR pszInitUsageOID; } CRYPTUI_CERT_MGR_STRUCT, *PCRYPTUI_CERT_MGR_STRUCT; typedef const CRYPTUI_CERT_MGR_STRUCT *PCCRYPTUI_CERT_MGR_STRUCT; int APIENTRY _tWinMain(HINSTANCE hInstance, HINSTANCE, LPTSTR pszCmdLine, int nCmdShow) { HINSTANCE hCryptui = LoadLibrary(TEXT("cryptui.dll")); if(!hCryptui) return 0; typedef BOOL (WINAPI* fnCryptUIDlgCertMgr)(PCCRYPTUI_CERT_MGR_STRUCT pCryptUICertMgr); fnCryptUIDlgCertMgr CryptUIDlgCertMgr = NULL; ((FARPROC&)CryptUIDlgCertMgr) = GetProcAddress(hCryptui, TEXT("CryptUIDlgCertMgr")); if(CryptUIDlgCertMgr) { CRYPTUI_CERT_MGR_STRUCT ccm = { sizeof(CRYPTUI_CERT_MGR_STRUCT) }; CryptUIDlgCertMgr(&ccm); } FreeLibrary(hCryptui); return 0; } |