Click here to Skip to main content
15,916,030 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: unicode value ??? Pin
Anonymous27-Aug-03 3:51
Anonymous27-Aug-03 3:51 
QuestionHow to rigister the auto-hide style window? Pin
Hendy_So26-Aug-03 22:37
Hendy_So26-Aug-03 22:37 
GeneralMemory Leakage Pin
Jahangir Jamshed26-Aug-03 22:30
sussJahangir Jamshed26-Aug-03 22:30 
GeneralRe: Memory Leakage Pin
Magnus Westin27-Aug-03 3:02
Magnus Westin27-Aug-03 3:02 
Questionhow i can retrieved thread handle from ID one Pin
El'Cachubrey26-Aug-03 22:26
El'Cachubrey26-Aug-03 22:26 
AnswerRe: how i can retrieved thread handle from ID one Pin
Mike Dimmick26-Aug-03 22:44
Mike Dimmick26-Aug-03 22:44 
GeneralRe: how i can retrieved thread handle from ID one Pin
El'Cachubrey26-Aug-03 23:42
El'Cachubrey26-Aug-03 23:42 
GeneralCryptAcquireContext error Pin
devvvy26-Aug-03 22:24
devvvy26-Aug-03 22:24 
Try to encrpt something, using CryptAcquireContext, unfortunately, return value==0 for everycall. I called GetLastError trying to figure out what exactly was the error, but it was a very big negative number - and no error code should be negative???

I moved to dot net for a while, I don't remeber how to link to a library (don't want to bother LoadLibrary). I checked MSDN documentation:

Header: Declared in Wincrypt.h.
Library: Use Advapi32.lib.

But I think that shouldn't be the reason why I'm getting this weird big/negative error code right?


Anyway, here's my code - it's so simple i have no idea what's wrong with it:

#include "stdafx.h"


//For screen dump:
//#include <stdio.h>


//************************//
#define _WIN32_WINNT 0x0400

#include <windows.h>
#include <wincrypt.h>

#define MY_ENCODING_TYPE (PKCS_7_ASN_ENCODING | X509_ASN_ENCODING)
#define MS_DEF_PROV "Microsoft Base Cryptographic Provider v1.0"
#define PROV_RSA_FULL 1
//************************//

int _tmain(int argc, _TCHAR* argv[])
{
BOOL bResult;

HCRYPTPROV hProv=NULL; //handle to CSP

bResult = CryptAcquireContext(
&hProv, // Variable to hold returned handle.
NULL, // Use default key container.
MS_DEF_PROV, // Use default CSP: "Microsoft Base Cryptographic Provider v1.0"
PROV_RSA_FULL, // Type of provider to acquire.
0); // No special action.
if(bResult==0) {
//
printf("Error: STEP 1. Error code: %d\n", GetLastError());
}
else
{
printf("Retrieve handle to provider success.\n");
}



return 0;
}


norm
GeneralRe: CryptAcquireContext error Pin
Mike Dimmick26-Aug-03 22:56
Mike Dimmick26-Aug-03 22:56 
GeneralRe: CryptAcquireContext error Pin
devvvy26-Aug-03 23:03
devvvy26-Aug-03 23:03 
Generalsetting truetype font height in a special way Pin
JP GOBLET26-Aug-03 22:06
JP GOBLET26-Aug-03 22:06 
GeneralCPropertyPage Pin
hph26-Aug-03 21:54
hph26-Aug-03 21:54 
GeneralRe: CPropertyPage Pin
Member 42425926-Aug-03 22:05
Member 42425926-Aug-03 22:05 
Generalrestricting to type in CEdit Pin
Ph@ntom26-Aug-03 21:30
Ph@ntom26-Aug-03 21:30 
GeneralRe: restricting to type in CEdit Pin
iceage26-Aug-03 21:53
iceage26-Aug-03 21:53 
GeneralRe: restricting to type in CEdit Pin
Member 42425926-Aug-03 22:10
Member 42425926-Aug-03 22:10 
GeneralRe: restricting to type in CEdit Pin
henchook26-Aug-03 22:11
henchook26-Aug-03 22:11 
GeneralRe: restricting to type in CEdit Pin
David Crow27-Aug-03 4:24
David Crow27-Aug-03 4:24 
GeneralProgramatically copying files Pin
Scozturk26-Aug-03 21:16
professionalScozturk26-Aug-03 21:16 
GeneralRe: Programatically copying files Pin
Johnny ²26-Aug-03 21:25
Johnny ²26-Aug-03 21:25 
GeneralRe: Programatically copying files Pin
henchook26-Aug-03 22:21
henchook26-Aug-03 22:21 
GeneralGenerate Ctrl-Alt-Del programmatically Pin
Chintan26-Aug-03 20:58
Chintan26-Aug-03 20:58 
GeneralRe: Generate Ctrl-Alt-Del programmatically Pin
David Crow27-Aug-03 4:33
David Crow27-Aug-03 4:33 
GeneralAdd/Remove Programs under XP Pin
HeiniBlad26-Aug-03 20:48
HeiniBlad26-Aug-03 20:48 
GeneralRe: Add/Remove Programs under XP Pin
Michael P Butler27-Aug-03 1:42
Michael P Butler27-Aug-03 1:42 

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.