Hehe, I got it working! I looked in the Win32 API Reference and it said that the first DWORD must be the type of data.. Seeing as we want to receive a zero terminated string, I used REG_SZ. And the second DWORD had to be the buffer size.. you declared the buffer as being able to hold 255 bytes, so that's what I set it to.. Here's the code:
Code:
#include <windows.h>
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInst, LPSTR lpCmdLne, int nCmdShow)
{
HKEY hkey;
TCHAR buffer[255];
TCHAR sk[] = "Software\\Microsoft\\Windows\\CurrentVersion\\"
"Explorer\\Shell Folders";
DWORD a = REG_SZ; // <-- Zero terminated string
DWORD b = 255; // <-- Buffer size
RegOpenKeyEx(HKEY_CURRENT_USER,
sk,
0,
KEY_QUERY_VALUE,
&hkey);
RegQueryValueEx(hkey,
"History",
0,
&a,
(BYTE*)buffer,
&b);
MessageBox(0,buffer,0,0);
return 0;
}
Hey, I learnt something too!