Click here to Skip to main content
16,004,828 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Help Pin
ThatsAlok3-Oct-04 20:36
ThatsAlok3-Oct-04 20:36 
GeneralExtract HBITMAP from IMAGELIST icon Pin
peterchen3-Oct-04 14:15
peterchen3-Oct-04 14:15 
GeneralRe: Extract HBITMAP from IMAGELIST icon Pin
PJ Arends3-Oct-04 16:24
professionalPJ Arends3-Oct-04 16:24 
GeneralMFC Progress Bar Pin
Anonymous3-Oct-04 11:59
Anonymous3-Oct-04 11:59 
GeneralRe: MFC Progress Bar Pin
ThatsAlok3-Oct-04 19:25
ThatsAlok3-Oct-04 19:25 
GeneralRe: MFC Progress Bar Pin
pubududilena4-Oct-04 0:06
pubududilena4-Oct-04 0:06 
QuestionWinVerifyTrust on legacy Win9x? Pin
Jason De Arte3-Oct-04 10:36
Jason De Arte3-Oct-04 10:36 
AnswerRe: WinVerifyTrust on legacy Win9x? Pin
Jason De Arte3-Oct-04 17:01
Jason De Arte3-Oct-04 17:01 
Well, after a few hours of digging and testing my theories - I've answered my own question. There's this thing called CAPICOM.DLL that provides a number of com interfaces for checking the authenticode signature on a file. And it even (as the rumor goes) have a redistributable for win98!

With a little work, I'm sure somebody with more time on their hands than I, could write up a full featured article that also Signs and timestamps a file. Smile | :)

#ifndef __SIGNED_CODE_H__
#define __SIGNED_CODE_H__
	
// 2004.Oct.03.JED - A quick tool to check the signatures of an Authenticode signed file
//  coded under DevStudio6 for an ATL/WTL project
	
// MSDN Docs
// http://msdn.microsoft.com/library/default.asp?url=/library/en-us/seccrypto/security/signedcode.asp
	
// Get the typelib header info
#import "capicom.dll" named_guids no_implementation
	
#pragma once
	
class CSignedCode
{
protected:
	CComQIPtr<CAPICOM::ISignedCode> m_spSignedCode;

public:
	CSignedCode(LPCTSTR pszFileName)
	{
		HRESULT hr = m_spSignedCode.CoCreateInstance(CAPICOM::CLSID_SignedCode);
		if( SUCCEEDED(hr) && pszFileName && *pszFileName )
			SetFileName( pszFileName );
	}
	
	// The act of setting the filename starts the Authenticode check
	HRESULT SetFileName( LPCTSTR pszFileName )
	{
		if( !m_spSignedCode )
			return E_POINTER;
		return m_spSignedCode->put_FileName( CComBSTR(pszFileName) );
	}

	// XP SP2, calling with TRUE displays the warning dialog that is displayed
	// when you run an EXE you just downloaded.
	// THIS DOES NOT DO THE ACTUAL CHECK - SetFileName does
	HRESULT Verify(BOOL bAllowWindowsPromptUI)
	{
		if( !m_spSignedCode )
			return E_POINTER;
		return m_spSignedCode->raw_Verify(bAllowWindowsPromptUI?VARIANT_TRUE:VARIANT_FALSE);
	}

	HRESULT GetDescription(CString& rstrDescription)
	{
		if( !m_spSignedCode )
			return E_POINTER;
		CComBSTR bs;
		HRESULT hr = m_spSignedCode->get_Description(&bs);
		if( SUCCEEDED(hr) )
			rstrDescription = bs;
		return hr;
	}

	HRESULT GetURL(CString& rstrDescriptionURL)
	{
		if( !m_spSignedCode )
			return E_POINTER;
		CComBSTR bs;
		HRESULT hr = m_spSignedCode->get_DescriptionURL(&bs);
		if( SUCCEEDED(hr) )
			rstrDescriptionURL = bs;
		return hr;
	}

	HRESULT GetFileName(CString& rstrFileName)
	{
		if( !m_spSignedCode )
			return E_POINTER;
		CComBSTR bs;
		HRESULT hr = m_spSignedCode->get_FileName(&bs);
		if( SUCCEEDED(hr) )
			rstrFileName = bs;
		return hr;
	}
};

#endif //__SIGNED_CODE_H__


[ Jason De Arte | Toy Maker | 1001010.com ]
Generalresource is open in another editor Pin
Anonymous3-Oct-04 10:08
Anonymous3-Oct-04 10:08 
GeneralRe: resource is open in another editor Pin
pubududilena3-Oct-04 21:07
pubududilena3-Oct-04 21:07 
GeneralPopup inside popup Pin
Kamis3-Oct-04 9:21
Kamis3-Oct-04 9:21 
GeneralRe: Popup inside popup Pin
Michael Dunn3-Oct-04 10:37
sitebuilderMichael Dunn3-Oct-04 10:37 
GeneralRe: Popup inside popup Pin
Kamis3-Oct-04 11:12
Kamis3-Oct-04 11:12 
GeneralCompile HTML Files Pin
Azghar Hussain3-Oct-04 7:33
professionalAzghar Hussain3-Oct-04 7:33 
GeneralRe: Compile HTML Files Pin
Ravi Bhavnani3-Oct-04 7:51
professionalRavi Bhavnani3-Oct-04 7:51 
GeneralRe: Compile HTML Files Pin
Azghar Hussain4-Oct-04 7:43
professionalAzghar Hussain4-Oct-04 7:43 
GeneralDialog Box Pin
ANDYFA3-Oct-04 6:33
ANDYFA3-Oct-04 6:33 
GeneralRe: Dialog Box Pin
Yulianto.3-Oct-04 18:55
Yulianto.3-Oct-04 18:55 
GeneralRe: Dialog Box Pin
ANDYFA4-Oct-04 12:09
ANDYFA4-Oct-04 12:09 
GeneralRe: Dialog Box Pin
Yulianto.4-Oct-04 15:11
Yulianto.4-Oct-04 15:11 
GeneralHTTP Serveur (2) Pin
tom87@213-Oct-04 6:05
tom87@213-Oct-04 6:05 
GeneralRe: HTTP Serveur (2) Pin
Ravi Bhavnani3-Oct-04 7:54
professionalRavi Bhavnani3-Oct-04 7:54 
Generalrunning applications from a shared folder Pin
Nailbite3-Oct-04 5:32
Nailbite3-Oct-04 5:32 
GeneralCreate process in memory Pin
aLifSa3-Oct-04 4:46
aLifSa3-Oct-04 4:46 
GeneralUSB device access from DLL Pin
Vladimir Dubovoy3-Oct-04 3:46
Vladimir Dubovoy3-Oct-04 3:46 

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.