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

C / C++ / MFC

 
QuestionRe: Create Registry Key with C++ Pin
J_E_D_I28-Aug-07 1:55
J_E_D_I28-Aug-07 1:55 
GeneralRe: Create Registry Key with C++ Pin
hxhl9528-Aug-07 6:49
hxhl9528-Aug-07 6:49 
GeneralRe: Create Registry Key with C++ Pin
J_E_D_I28-Aug-07 20:15
J_E_D_I28-Aug-07 20:15 
AnswerRe: Create Registry Key with C++ Pin
hxhl9529-Aug-07 6:28
hxhl9529-Aug-07 6:28 
QuestionRe: Create Registry Key with C++ Pin
J_E_D_I29-Aug-07 21:55
J_E_D_I29-Aug-07 21:55 
QuestionRe: Create Registry Key with C++ [modified] Pin
hxhl9530-Aug-07 6:03
hxhl9530-Aug-07 6:03 
AnswerRe: Create Registry Key with C++ Pin
J_E_D_I1-Sep-07 21:06
J_E_D_I1-Sep-07 21:06 
AnswerRe: Create Registry Key with C++ Pin
hxhl952-Sep-07 6:22
hxhl952-Sep-07 6:22 
You have an array of 31 chars right now. What I mean is you should null-terminate your char* by allocating 32 chars to your char* value, and then after retrieving the value, set value[31]=0;

Are you doing something like this right now?:

HKEY temporarykey;

char* value;
value = (char*)malloc(32); //the value of the key has 31 characters 

DWORD lpcbData = 32;

RegOpenKeyEx(HKEY_LOCAL_MACHINE,"SOFTWARE\\test",0,KEY_QUERY_VALUE,&temporarykey);

RegQueryValueEx(temporarykey,"License",NULL,NULL,(unsigned char*)value,&lpcbData);
RegCloseKey(temporarykey);

value[31]=0;

cout<<value;
free(value);


For me, that chunk of code works fine. I am a bit puzzled on why you set lpcdData to 64 at the start...you only need 32.
GeneralRe: Create Registry Key with C++ Pin
J_E_D_I3-Sep-07 4:19
J_E_D_I3-Sep-07 4:19 
AnswerRe: Create Registry Key with C++ Pin
hxhl953-Sep-07 8:10
hxhl953-Sep-07 8:10 
GeneralRe: Create Registry Key with C++ Pin
J_E_D_I3-Sep-07 19:34
J_E_D_I3-Sep-07 19:34 
AnswerRe: Create Registry Key with C++ Pin
hxhl954-Sep-07 14:03
hxhl954-Sep-07 14:03 
GeneralRe: Create Registry Key with C++ Pin
J_E_D_I4-Sep-07 20:35
J_E_D_I4-Sep-07 20:35 
GeneralRe: Create Registry Key with C++ Pin
J_E_D_I9-Sep-07 1:05
J_E_D_I9-Sep-07 1:05 
AnswerRe: Create Registry Key with C++ Pin
hxhl959-Sep-07 5:07
hxhl959-Sep-07 5:07 
Questionstring size according to user's input Pin
dona jain9-Aug-07 0:12
dona jain9-Aug-07 0:12 
AnswerRe: string size according to user's input Pin
Cedric Moonen9-Aug-07 0:16
Cedric Moonen9-Aug-07 0:16 
AnswerRe: string size according to user's input Pin
toxcct9-Aug-07 0:17
toxcct9-Aug-07 0:17 
GeneralRe: string size according to user's input Pin
dona jain9-Aug-07 0:19
dona jain9-Aug-07 0:19 
GeneralRe: string size according to user's input Pin
toxcct9-Aug-07 0:31
toxcct9-Aug-07 0:31 
AnswerRe: string size according to user's input Pin
Maynka9-Aug-07 0:24
Maynka9-Aug-07 0:24 
AnswerRe: string size according to user's input Pin
Ranjoy Guha9-Aug-07 0:29
Ranjoy Guha9-Aug-07 0:29 
GeneralRe: string size according to user's input Pin
dona jain9-Aug-07 0:35
dona jain9-Aug-07 0:35 
GeneralRe: string size according to user's input Pin
toxcct9-Aug-07 0:36
toxcct9-Aug-07 0:36 
GeneralRe: string size according to user's input Pin
jhwurmbach9-Aug-07 0:47
jhwurmbach9-Aug-07 0:47 

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.