Click here to Skip to main content
15,915,684 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: unicode to mbcs problem Pin
Stephen Hewitt9-Jul-08 20:11
Stephen Hewitt9-Jul-08 20:11 
QuestionProblem of Print Preview. Pin
Le@rner9-Jul-08 18:13
Le@rner9-Jul-08 18:13 
AnswerRe: Problem of Print Preview. Pin
Iain Clarke, Warrior Programmer10-Jul-08 0:06
Iain Clarke, Warrior Programmer10-Jul-08 0:06 
NewsLook for a friend Pin
halibobo9-Jul-08 17:52
halibobo9-Jul-08 17:52 
GeneralRe: Look for a friend [modified] Pin
_AnsHUMAN_ 9-Jul-08 18:52
_AnsHUMAN_ 9-Jul-08 18:52 
GeneralRe: Look for a friend Pin
halibobo9-Jul-08 20:54
halibobo9-Jul-08 20:54 
QuestionCrashing at RegQueryValueEx Pin
monsieur_jj9-Jul-08 16:00
monsieur_jj9-Jul-08 16:00 
AnswerRe: Crashing at RegQueryValueEx Pin
krmed10-Jul-08 2:14
krmed10-Jul-08 2:14 
Your code has some problems...the fifth parameter to RegQueryValueEx should be the buffer that receives the value, and the sixth parameter is an in/out parameter. This sixth parameter should contain the size of the fifth parameter on input.

In your first call, parameter 5 is &dwData, but the size is set to the size of your PerfData (TOTALBYTES). That is incorrect - dwData is only 4 bytes long.

In the second call, Size is now 4 (as set by the first call), which is the size of dwData (which you again passed as parameter 5). You can see this if you step through your code in the debugger.

I'm not sure why you malloc PerfData (in fact you should use "new" instead of "malloc"), but never use it - perhaps that should have been used in your second call? You also don't delete the PerfData before returning from the function, so you'll have a memory leak each time you call this function.

In any case, you should remember to reset your Size parameter each time before you call RegQueryValueEx.

Hope that helps.

Karl - WK5M
PP-ASEL-IA (N43CS)
PGP Key: 0xDB02E193
PGP Key Fingerprint: 8F06 5A2E 2735 892B 821C 871A 0411 94EA DB02 E193

QuestionC++ wrappers for C struct api Pin
Kishore Jonnalagadda9-Jul-08 15:14
Kishore Jonnalagadda9-Jul-08 15:14 
AnswerRe: C++ wrappers for C struct api Pin
Saurabh.Garg9-Jul-08 17:57
Saurabh.Garg9-Jul-08 17:57 
GeneralRe: C++ wrappers for C struct api Pin
Kishore Jonnalagadda9-Jul-08 18:25
Kishore Jonnalagadda9-Jul-08 18:25 
GeneralRe: C++ wrappers for C struct api Pin
Saurabh.Garg9-Jul-08 23:25
Saurabh.Garg9-Jul-08 23:25 
GeneralRe: C++ wrappers for C struct api Pin
Kishore Jonnalagadda10-Jul-08 0:11
Kishore Jonnalagadda10-Jul-08 0:11 
GeneralRe: C++ wrappers for C struct api Pin
Saurabh.Garg10-Jul-08 0:56
Saurabh.Garg10-Jul-08 0:56 
AnswerRe: C++ wrappers for C struct api Pin
BadKarma9-Jul-08 22:54
BadKarma9-Jul-08 22:54 
GeneralRe: C++ wrappers for C struct api Pin
Kishore Jonnalagadda9-Jul-08 23:54
Kishore Jonnalagadda9-Jul-08 23:54 
Questioncall a vbscript and get an output Pin
rocktx9-Jul-08 9:32
rocktx9-Jul-08 9:32 
AnswerRe: call a vbscript and get an output Pin
led mike9-Jul-08 10:10
led mike9-Jul-08 10:10 
QuestionGDI+ Region Outline question Pin
Iain Clarke, Warrior Programmer9-Jul-08 5:44
Iain Clarke, Warrior Programmer9-Jul-08 5:44 
AnswerRe: GDI+ Region Outline question Pin
Mark Salsbery9-Jul-08 6:21
Mark Salsbery9-Jul-08 6:21 
GeneralRe: GDI+ Region Outline question Pin
Iain Clarke, Warrior Programmer9-Jul-08 11:36
Iain Clarke, Warrior Programmer9-Jul-08 11:36 
QuestionRetriving the user privilage set using WINAPI Pin
vineeshV9-Jul-08 3:17
vineeshV9-Jul-08 3:17 
AnswerRe: Retriving the user privilage set using WINAPI Pin
Iain Clarke, Warrior Programmer9-Jul-08 4:47
Iain Clarke, Warrior Programmer9-Jul-08 4:47 
GeneralRe: Retriving the user privilage set using WINAPI Pin
David Crow9-Jul-08 5:03
David Crow9-Jul-08 5:03 
Questionfriend member function in VC++ 2008 Pin
Andy Rama9-Jul-08 2:45
Andy Rama9-Jul-08 2: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.