There is a key in the registry:
HKEY_CURRENT_USER \ Software \ Posix \ NetStat
And the key has a value
Downloaded type
REG_SZwith valuedone
Trying to read its meaning. Nothing comes out.
#include <windows.h> #include <iostream> #include <string> using namespace std; int main() { char buf[1024]; HKEY hKey = HKEY_CURRENT_USER; ULONG result; DWORD sz = 1024; // open section and get hKey handler result = RegOpenKeyExA( hKey, "Software\\Posix\\NetStat", 0, REG_SZ, &hKey); if (result != ERROR_SUCCESS) { cout << "Can't open section" << endl; RegCloseKey(hKey); } // get desired value result = RegGetValueA( hKey, "Software\\Posix\\NetStat", "Downloaded", RRF_RT_ANY, NULL, (LPDWORD)buf, &sz); if (result != ERROR_SUCCESS) { cout << "Can't get value of Downloaded" << endl; RegCloseKey(hKey); } system("pause"); return 0; } After the first function is executed, the result is 0. That is, the first function works. After the second function is completed, the result is 2.
#define ERROR_FILE_NOT_FOUND 2L
Of course, the function in buf does not return any value .. Here is a link to the description of the function on MSDN. Only there is RegGetValue() .
https://msdn.microsoft.com/en-us/library/windows/desktop/ms724868(v=vs.85).aspx