How do I read a particular registry key
-
Hi Everyone, I want to be able to read the Registry "ProxyEnable" located within HKEY_CURRENT_USER and located at the following path Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings. What I want to be able to do is tell whether "ProxyEnable" is on or off. Not quite sure how to do that particular piece though. Thanks in advance, Matt
-
Hi Everyone, I want to be able to read the Registry "ProxyEnable" located within HKEY_CURRENT_USER and located at the following path Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings. What I want to be able to do is tell whether "ProxyEnable" is on or off. Not quite sure how to do that particular piece though. Thanks in advance, Matt
Add KEY_QUERY_VALUE to the access rights specified when opening the key, and then use RegQueryValueEx[^]. -- jlr http://jlamas.blogspot.com/[^]
-
Hi Everyone, I want to be able to read the Registry "ProxyEnable" located within HKEY_CURRENT_USER and located at the following path Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings. What I want to be able to do is tell whether "ProxyEnable" is on or off. Not quite sure how to do that particular piece though. Thanks in advance, Matt
-
Add KEY_QUERY_VALUE to the access rights specified when opening the key, and then use RegQueryValueEx[^]. -- jlr http://jlamas.blogspot.com/[^]
The issue I seem to be having is that ProxyEnable is actually a Reg_DWORD key, so I don't think I'm reading it in correctly and I'm not sure how to verify that its actually an enabled key. Basically if I were to get a value back from doing a query on that key, what do I compare its value to?
-
The issue I seem to be having is that ProxyEnable is actually a Reg_DWORD key, so I don't think I'm reading it in correctly and I'm not sure how to verify that its actually an enabled key. Basically if I were to get a value back from doing a query on that key, what do I compare its value to?
Matthew Devine wrote: Basically if I were to get a value back from doing a query on that key, what do I compare its value to? As I understand it, 1 means enabled, 0 means disabled... -- jlr http://jlamas.blogspot.com/[^]
-
Matthew Devine wrote: Basically if I were to get a value back from doing a query on that key, what do I compare its value to? As I understand it, 1 means enabled, 0 means disabled... -- jlr http://jlamas.blogspot.com/[^]
Yeah that's exactly right, that's what I'm seeing HKEY hKeyRoot,hKeyNew; LPCTSTR lpSubKey; LPTSTR Value; DWORD retcode; DWORD Value_type; DWORD Value_data; DWORD Value_size; hKeyRoot = HKEY_CURRENT_USER; lpSubKey = "Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings"; Value = "ProxyEnable"; retcode = RegOpenKeyEx ( hKeyRoot, lpSubKey, 0, KEY_QUERY_VALUE, &hKeyNew ); if (retcode != ERROR_SUCCESS) MessageBox("Error opening key",_T("NO")); retcode = RegQueryValueEx ( hKeyNew, // HKEY (hkey) handle of key to query Value, // LPSTR (lpValueName) address of name of value to query NULL, // LPDWORD (lpReserved) reserved &Value_type, // LPDWORD (lpType) address of buffer for value type (BYTE *) &Value_data,// LPBYTE (lpData) address of data buffer &Value_size // LPDWORD (lpcbData) address of data buffer size ); if (retcode != ERROR_SUCCESS) MessageBox("Error reading key",_T("NO")); else fout<<"Registry Value - "<
-
Yeah that's exactly right, that's what I'm seeing HKEY hKeyRoot,hKeyNew; LPCTSTR lpSubKey; LPTSTR Value; DWORD retcode; DWORD Value_type; DWORD Value_data; DWORD Value_size; hKeyRoot = HKEY_CURRENT_USER; lpSubKey = "Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings"; Value = "ProxyEnable"; retcode = RegOpenKeyEx ( hKeyRoot, lpSubKey, 0, KEY_QUERY_VALUE, &hKeyNew ); if (retcode != ERROR_SUCCESS) MessageBox("Error opening key",_T("NO")); retcode = RegQueryValueEx ( hKeyNew, // HKEY (hkey) handle of key to query Value, // LPSTR (lpValueName) address of name of value to query NULL, // LPDWORD (lpReserved) reserved &Value_type, // LPDWORD (lpType) address of buffer for value type (BYTE *) &Value_data,// LPBYTE (lpData) address of data buffer &Value_size // LPDWORD (lpcbData) address of data buffer size ); if (retcode != ERROR_SUCCESS) MessageBox("Error reading key",_T("NO")); else fout<<"Registry Value - "<
Matthew Devine wrote: This seems to have solved the problem that I was having Good! Matthew Devine wrote: Thanks again Jose, you have been a big help. You're welcome. Glad to be of help. -- jlr http://jlamas.blogspot.com/[^]
-
Yeah that's exactly right, that's what I'm seeing HKEY hKeyRoot,hKeyNew; LPCTSTR lpSubKey; LPTSTR Value; DWORD retcode; DWORD Value_type; DWORD Value_data; DWORD Value_size; hKeyRoot = HKEY_CURRENT_USER; lpSubKey = "Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings"; Value = "ProxyEnable"; retcode = RegOpenKeyEx ( hKeyRoot, lpSubKey, 0, KEY_QUERY_VALUE, &hKeyNew ); if (retcode != ERROR_SUCCESS) MessageBox("Error opening key",_T("NO")); retcode = RegQueryValueEx ( hKeyNew, // HKEY (hkey) handle of key to query Value, // LPSTR (lpValueName) address of name of value to query NULL, // LPDWORD (lpReserved) reserved &Value_type, // LPDWORD (lpType) address of buffer for value type (BYTE *) &Value_data,// LPBYTE (lpData) address of data buffer &Value_size // LPDWORD (lpcbData) address of data buffer size ); if (retcode != ERROR_SUCCESS) MessageBox("Error reading key",_T("NO")); else fout<<"Registry Value - "<
Matthew Devine wrote: ...the reason the compare wasn't working was simply because I only had 1 "="'s after for Value_data All the more reason to put the constant on the left side of the operator!
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown