Click here to Skip to main content
15,914,016 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralWhat's The Best Way... Pin
LighthouseJ27-Feb-05 3:15
LighthouseJ27-Feb-05 3:15 
GeneralRe: What's The Best Way... Pin
Blake Miller28-Feb-05 5:58
Blake Miller28-Feb-05 5:58 
GeneralRe: What's The Best Way... Pin
LighthouseJ1-Mar-05 11:11
LighthouseJ1-Mar-05 11:11 
GeneralRe: What's The Best Way... Pin
Blake Miller1-Mar-05 12:21
Blake Miller1-Mar-05 12:21 
GeneralRe: What's The Best Way... Pin
LighthouseJ1-Mar-05 14:47
LighthouseJ1-Mar-05 14:47 
GeneralRe: What's The Best Way... Pin
PJ Arends28-Feb-05 6:02
professionalPJ Arends28-Feb-05 6:02 
GeneralWinHTTP, error 12175, howto Pin
qdzhulf27-Feb-05 3:10
qdzhulf27-Feb-05 3:10 
GeneralRe: WinHTTP, error 12175, howto Pin
KitchenMaster26-Feb-09 12:02
KitchenMaster26-Feb-09 12:02 
You have to obtain the certificate that is sent by your server and install it on the Trusted Providers. The following code will do the job:

bool InstallCertificationAuthority()<br />
{<br />
	HCERTSTORE		hSystemStore;<br />
	hSystemStore = CertOpenSystemStore(NULL, _T("ROOT"));<br />
	if (hSystemStore == NULL)<br />
		return false;<br />
<br />
	// Find the certificate resource<br />
	HRSRC		hRSRC;<br />
	hRSRC = FindResource(AfxGetResourceHandle()MAKEINTRESOURCE(IDR_CERTIFICATE), _T("CERTIFICATE"));<br />
	if (hRSRC == NULL)<br />
		return false;<br />
<br />
	// Obtain the size of the Certificate resource<br />
	DWORD		dwSize;<br />
	dwSize = SizeofResource(AfxGetResourceHandle(), hRSRC);<br />
	if (dwSize == 0)<br />
		return false;<br />
<br />
	// Load the resource into a global memory handler<br />
	HGLOBAL		hCertificate;<br />
	hCertificate = LoadResource(AfxGetResourceHandle(), hRSRC);<br />
	if (hCertificate == NULL)<br />
		return false;<br />
<br />
	// Lock the resource<br />
	LPBYTE		lpCertificate;<br />
	lpCertificate = (LPBYTE) LockResource(hCertificate);<br />
	if (lpCertificate == NULL) {<br />
		FreeResource(hCertificate);<br />
		return false;<br />
	}<br />
<br />
	if (!CertAddEncodedCertificateToStore(hSystemStore, X509_ASN_ENCODING | PKCS_7_ASN_ENCODING, lpCertificate, dwSize, CERT_STORE_ADD_USE_EXISTING, NULL)) {<br />
		logRPCCore.Output("Cannot install certificate!\n");<br />
	}<br />
<br />
	UnlockResource(hCertificate);<br />
	FreeResource(hCertificate);<br />
<br />
	CertCloseStore(hSystemStore, 0);<br />
	return true;<br />
}<br />


As you see, the code install the certification from a resource of your application into the ROOT Store.
QuestionHow to catch events? Pin
Roozbeh6926-Feb-05 20:13
professionalRoozbeh6926-Feb-05 20:13 
GeneralPDF format Pin
Chna26-Feb-05 18:58
Chna26-Feb-05 18:58 
GeneralWhen to draw the focus rectangle Pin
Ron Waller26-Feb-05 17:38
Ron Waller26-Feb-05 17:38 
GeneralRe: When to draw the focus rectangle Pin
Ravi Bhavnani27-Feb-05 5:55
professionalRavi Bhavnani27-Feb-05 5:55 
GeneralRe: When to draw the focus rectangle Pin
Michael Dunn27-Feb-05 7:04
sitebuilderMichael Dunn27-Feb-05 7:04 
Generalrandom number between.... Pin
Raylan26-Feb-05 16:20
Raylan26-Feb-05 16:20 
GeneralRe: random number between.... Pin
Ravi Bhavnani26-Feb-05 16:28
professionalRavi Bhavnani26-Feb-05 16:28 
GeneralRe: random number between.... Pin
Sheng Jiang 蒋晟27-Feb-05 9:39
Sheng Jiang 蒋晟27-Feb-05 9:39 
Generalcolor values for palettes Pin
nm_11426-Feb-05 14:10
nm_11426-Feb-05 14:10 
Generalint, read from text file Pin
jonavon blakly26-Feb-05 14:02
jonavon blakly26-Feb-05 14:02 
GeneralRe: int, read from text file Pin
Ravi Bhavnani26-Feb-05 14:11
professionalRavi Bhavnani26-Feb-05 14:11 
GeneralRe: int, read from text file Pin
uus9926-Feb-05 15:37
uus9926-Feb-05 15:37 
GeneralRe: int, read from text file Pin
jonavon blakly27-Feb-05 5:40
jonavon blakly27-Feb-05 5:40 
GeneralRe: int, read from text file Pin
uus9927-Feb-05 13:12
uus9927-Feb-05 13:12 
GeneralRe: int, read from text file Pin
eli1502197927-Feb-05 4:16
eli1502197927-Feb-05 4:16 
GeneralRe: int, read from text file Pin
jonavon blakly27-Feb-05 5:28
jonavon blakly27-Feb-05 5:28 
GeneralRe: int, read from text file (Try this 1) Pin
Alton Williams27-Feb-05 23:39
Alton Williams27-Feb-05 23:39 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.