Click here to Skip to main content
15,913,587 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: MFC help : code error 0000007B Pin
soaringpilot15-May-12 10:44
soaringpilot15-May-12 10:44 
GeneralRe: MFC help : code error 0000007B Pin
jawadali47716-May-12 19:19
jawadali47716-May-12 19:19 
GeneralRe: MFC help : code error 0000007B Pin
soaringpilot17-May-12 6:19
soaringpilot17-May-12 6:19 
QuestionResponding To Asynchronous Functions Pin
AmbiguousName14-May-12 20:38
AmbiguousName14-May-12 20:38 
AnswerRe: Responding To Asynchronous Functions Pin
CPallini14-May-12 22:08
mveCPallini14-May-12 22:08 
AnswerRe: Responding To Asynchronous Functions Pin
TinyDevices15-May-12 3:31
professionalTinyDevices15-May-12 3:31 
AnswerRe: Responding To Asynchronous Functions Pin
soaringpilot15-May-12 10:51
soaringpilot15-May-12 10:51 
AnswerRe: Responding To Asynchronous Functions Pin
TomasRiker217-May-12 8:12
TomasRiker217-May-12 8:12 
QuestionHow do I check or change text in a VS2008 menu bar menu item Pin
soaringpilot14-May-12 12:22
soaringpilot14-May-12 12:22 
AnswerRe: How do I check or change text in a VS2008 menu bar menu item Pin
«_Superman_»14-May-12 16:32
professional«_Superman_»14-May-12 16:32 
GeneralRe: How do I check or change text in a VS2008 menu bar menu item Pin
soaringpilot15-May-12 10:21
soaringpilot15-May-12 10:21 
Questionc++ win32, What's the best way to handle large fonts 120 dpi Pin
jkirkerx14-May-12 8:33
professionaljkirkerx14-May-12 8:33 
AnswerRe: c++ win32, What's the best way to handle large fonts 120 dpi Pin
enhzflep14-May-12 11:06
enhzflep14-May-12 11:06 
GeneralRe: c++ win32, What's the best way to handle large fonts 120 dpi Pin
jkirkerx14-May-12 11:38
professionaljkirkerx14-May-12 11:38 
QuestionVfw decompression - real sample code wanted Pin
Vaclav_14-May-12 8:24
Vaclav_14-May-12 8:24 
QuestionDrawImage from 2 image buffer Pin
john563213-May-12 23:34
john563213-May-12 23:34 
AnswerRe: DrawImage from 2 image buffer Pin
Richard MacCutchan14-May-12 0:17
mveRichard MacCutchan14-May-12 0:17 
QuestionIPC using named pipes Pin
ForNow13-May-12 9:27
ForNow13-May-12 9:27 
GeneralRe: IPC using named pipes Pin
«_Superman_»13-May-12 16:15
professional«_Superman_»13-May-12 16:15 
AnswerRe: IPC using named pipes Pin
ThatsAlok13-May-12 20:06
ThatsAlok13-May-12 20:06 
AnswerRe: IPC using named pipes Pin
Software_Developer14-May-12 0:02
Software_Developer14-May-12 0:02 
Questionc++, CryptGetHashParam works in XP, Vista, but not Windows 7 Pin
jkirkerx13-May-12 8:49
professionaljkirkerx13-May-12 8:49 
I'm baffled by this. My MD5 Hash function works in Windows XP and Windows Vista, but fails in windows 7 with an Error 87.

So I rewrote the function to use HP_HASHSIZE to properly get the size, but nothing I did on Windows 7 made a difference.

I went back to XP, modified my code with the new changes, ran it, and produced the correct hash value result.

My Triple DES works fine on Windows 7, and my DES, so I'm going to check my crypt files on Windows 7 now, and see if I can find anything.

BYTE* CA_Encryption::_create_MD5_Hash( WCHAR *pzInputW, LPDWORD dwOutput )
{
BOOL			bResult = FALSE;
HCRYPTPROV		hProv = 0;
HCRYPTHASH		hHash = 0;

BYTE			*szBuffer = NULL;
DWORD			dwHashLen = 0;	
			
// Get the size of the conversion
int iCharA = ( WideCharToMultiByte(CP_UTF8, 0, pzInputW, -1, NULL, 0, NULL, NULL) - 1 );	
char *szInputA = new char[ iCharA ];
WideCharToMultiByte( CP_UTF8, 0, pzInputW, -1, szInputA, iCharA, NULL, NULL );
			
DWORD	dwCount = sizeof( DWORD );	
DWORD	dwPasswordLen = iCharA;	
		
bResult = CryptAcquireContextW( &hProv, NULL, MS_STRONG_PROV, PROV_RSA_FULL, 0);	
bResult = CryptCreateHash( hProv, CALG_MD5, 0, 0, &hHash );   
bResult = CryptHashData( hHash, (BYTE*)szInputA, dwPasswordLen, 0 );

delete [] szInputA;
// The line below does nothing and produces an error 87, 
if(CryptGetHashParam( hHash, HP_HASHSIZE, (BYTE*)&dwHashLen, &dwCount, 0 ) ) {
	if  (( *dwOutput > 0 ) && ( *dwOutput < 4096)) {
		szBuffer = new BYTE[dwHashLen+1];
		CryptGetHashParam( hHash, HP_HASHVAL, szBuffer, &dwHashLen, 0 );
		*dwOutput = dwHashLen;
		szBuffer[dwHashLen] = 0;		
	}
	else {
		*dwOutput = dwHashLen+1;
		szBuffer = L'\0';
	}
}
else {
	*dwOutput = 1;
	szBuffer = new BYTE[ *dwOutput ];
	szBuffer[ 0 ] = L'\0';
}
		
CryptDestroyHash(hHash);
CryptReleaseContext(hProv, 0);
		    	
return szBuffer;
}

Answer[SOLVED] Re: c++, CryptGetHashParam works in XP, Vista, but not Windows 7 Pin
jkirkerx13-May-12 10:13
professionaljkirkerx13-May-12 10:13 
Questionwhere should add the try-catch? Pin
yu-jian13-May-12 5:55
yu-jian13-May-12 5:55 
AnswerRe: where should add the try-catch? Pin
Richard MacCutchan13-May-12 6:45
mveRichard MacCutchan13-May-12 6:45 

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.