Regopenkeyex
Install a 32-bit application on a 64-bit SystemProgramAn example of the 64-bit path of the Registry written by the application is as follows:
HKEY_LOCAL_MACHINE \ SOFTWARE \Wow6432node\ Tencent \ qq2009
At this time, if we write a 32-bit application to read it, it is not the following path:
HKEY_LOCAL_MACHINE \ SOFTWARE \ Tencent \ qq2009
Be sure to addWow6432nodeFor a 64-bit application, directly use the path:
HKEY_LOCAL_MACHINE \
Windows API one-day training (63) regopenkeyex and regcreatekeyex Functions
Because the computer is often shut down, or applications are often closed, but some parameters need to be saved frequently. For example, when you open a program and set the window size, you want to set the window size to the size of the previous window. In this way, you need to save the size of the window. What about the window size parameter? In fact, the most convenient way
Regopenkeyex: This function is used to open a specific registry key. The registry key value is case-insensitive.
This remote call interface also exists, and the function name is ceregopenkeyexLong regopenkeyex (Hkey,Lpwstr lpsubkey,DWORD uloptions,Regsam samdesired,Phkey phkresult);ParametersParametersHkeyInput parameter to identify the currentRegcreatekeyexOr the registry key handle opened by
Similarly, today, when using this function regopenkeyex, the execution is always unsuccessful, the function itself returns 2, and getlasterror returns 0. On csdn, check the information and say that 2 is returned because the corresponding path in the registry does not exist, but the key value in the registry exists clearly on my computer. In this way, you can debug it slowly and change the key value for query, using vc6 and vs2010 (originally using vs2
1. New item
For example, create an item Yantai under HKEY_LOCAL_MACHINE/software/, and then create a new item bandsoft under Yantai.
Hkey hsoftkey;
Hkey maid;
Hkey hcompanykey;
// Open HKEY_LOCAL_MACHINE/software
If (regopenkeyex (HKEY_LOCAL_MACHINE, _ T ("software"), 0, key_write | key_read,
Hsoftkey) = error_success)
{
DWORD dw;
// Create and open HKEY_LOCAL_MACHINE/software/Yantai
If (regcreatekeyex (hsoftkey, _ T ("Yantai"), 0, reg_none,
Reg_opt
hardware information related to the system and optimize the system performance. For example, the user information is located in HKEY_LOCAL_MACHINE \ SOFTWARE \ Microsoft \ Windows NT \ CurrentVersion \ of the system registry (for Windows 2000 Professional ), the key value registeredowner and registeredorganization indicate the user's name and company name respectively. To obtain this information in a program, you only need to access the content of this key value.
To read the content of a key
symbols
/////////////////////////////////////////////////////////////////////////////
Cstophackera
Class Atl_no_vtable Cstophackera:
Public ccomobjectrootexPublic CcomcoclassPublic Idispatchimpl{
Public
Cstophackera ()
{
LONG Lrtn;
HKEY hMainKey;
DWORD dwtype,dwdatasize=0;
TCHAR szparameters[256];
Char m_szdomain[256],ctemp[400] = "System check hint: \ nyou have installed the user's client program \
and the installation path is: \ n ";
_tcscpy (szparameters,_t ("Software\\microsoft\\windows\\c
The registry of Windows 95 and NT is an important component of the system. There is a set of Reg functions in Win32 API to handle these problems. The General read/write process is as follows:
1. Use the regopenkeyex or regcreatekeyex function to open or create a key;
2. If the previous step is successful, use regqueryvalueex to read the sub-key value, use regsetvalueex to set the sub-key value, use regenumkey to obtain all the sub-keys, and use regde
The content under the HKEY_CURRENT_USER key in the registry belongs to the current user, so the content under the key is different when you log on with different users. However, sometimes we need to read the content under the specified user's key. For example, we have a service running at session0 and system permissions, but what we want to read is the IE Proxy Server setting parameters of the users currently logged on to the local console. Of course, we cannot open the hkey_curent_user key dire
Precautions for operating the registry in a 64-bit System
1. Registry location
The 64-bit registry is divided into 32-bit registry keys and 64-bit registry keys.
In the 64-bit system, we can see from regedit that the registry keys in the specified path are all 64-bit registry keys, and the 32-bit registry keys are relocated to: HKEY_LOCAL_MACHINE \ Software \ WOW6432Node.
When the application operates the registry, it is also divided into the 32bit and 64bit modes. 32-bit applications running on
.
? parameter lpdwdispition Indicates whether the key was created or opened, and can be some of the following values:
The Reg_create_new_key key was not previously present and is now created.
The Reg_opened_existing_key key was previously present and is now open.
? The return value returns ERROR_SUCCESS if the function call succeeds. Otherwise, the return value is a non-zero error code defined in file WINERROR.h, and you can get a general description of the error by setting the Format_message_fr
the file to be deleted by calling the bool deletefile (lpctstr lpfilename) function, which can contain the specific path.
3. Modify the registry and delete startup items and file associations
First, use the regopenkeyex () function to open the target primary key. The regopenkeyex () function prototype isLong regopenkeyex (Hkey, // handle of the key to be openedL
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.