c++ registry not getting second value

why is this not working? the first RegGetValue puts correct values in value variable, the second doesn't, however if I comment the first RegGetValue the second will then work and put the correct content into value2 variable. I tried closind and reopening the registry key using RegOpenKeyEx after the first RegGetValue function call but with no succes. What I am doing wrong


res=RegOpenKeyEx(HKEY_CLASSES_ROOT, "", 0, KEY_READ|KEY_WOW64_64KEY, &hKey);
else {
    char value[255], value2[255];
DWORD BufferSize = BUFFER;
RegGetValue(hKey,"\\.jpeg","",RRF_RT_ANY,NULL,(PVOID)&value, &BufferSize);
RegGetValue(hKey,"jpegfile\\DefaultIcon","",RRF_RT_ANY,NULL,(PVOID)&value2, &BufferSize);

printf("succes %s\n",value2);



From the RegGetValue manual about your last parameter;

pcbData [in, out, optional]

A pointer to a variable that specifies the size of the buffer pointed to by the pvData parameter, in bytes. When the function returns, this variable contains the size of the data copied to pvData.

In other words, the contents of your BufferSize variable is changed by the first call to be the size of the first value returned, and needs to be reset before the second call.

Need Your Help

Gradient Stripe Background Color Understanding

css css3 gradient linear-gradients

I need to understand this alignment! I have done a lot of search for this problem, but still unclear.

How to get Pagination direction in twig for KNP paginator?

symfony2 pagination twig knppaginator

I am using knp paginator and it works well but when I want to use its sorting feature I have problem to get the sort direction in twig.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.