.Reg file format

xiaoxiao2021-03-06  80

.Reg file format

Original: j.mostert translation: Nakai 1 Overview Registry Editor Use .reg file format import, export registry settings, supported operating systems include Windows3.x, Windows95 / 98 / NT and above. Although the role and principles of the registry are very important, this article does not intend to introduce, you can get relevant information through the URL listed in the article. At the same time, Windows3.x's .reg file format is different from Windows95, this article will ignore this content, after all, WINDOWS3.X registry is not important.

2 Detailed explanation.Reg file is an unformed plain text consisting of ASCII code, each line ends with "CR / LF".

2.1 File head. The beginning of the registry editor is the version of the Registry Editor. The next version of Windows95 / NT is 4, you can use such a string: regedit4. Before performing the import, the Registry Editor will check if the version is correct and gives a prompt without match, which is also the only check of the registry editor pair .reg file. In general, the Registry Editor will silently ignore the error of the file that does not import the registry, more cases, will import the content that may cause the problem into the registry, which is a defect in the Microsoft Registry Editor.

2.2 The key button and the subkey are exported to .reg files, there is no order difference. For example: hkey_classes_root / clsID button is HKEY_CLASS_ROOT / CLSID / {21EC2020-3AEA-1069-A2DD-08002B30309D} This subkey (this button is to add a class declaration on the control panel), which is exported as follows: [HKEY_CLASES_ROOT / clsid] [hkey_classes_root / clsid / {21ec2020-3aea-1069-a2dd-08002b30309d}] any valid key must include the full path, and must therefore start with the root key, the root key comprising: hkey_classes_root hkey_current_user hkey_local_machine hkey_users hkey_current_config hkey_dyn_data bond The name can only be composed of the printable characters in the ASCII code (i.e., the characters represented by the ASCII code 32 to 127), the key name cannot contain spaces, backslash (/), and wildcards (* and?). Each key name is close to its key value, the key value list ends with the empty line, and the key value list of a key can be an empty line. For example: [Key-name]

[SECOND-key-name] "value1" = Something "value2" = Something

[third-key-name] If a key value does not exist in the file, this button will be created when the key is imported (if there is no existence). For example: The key is specified in the file; only HKEY_USERS / JEROEN this button is exists in the registry; when the import, the HKEY_USERS / JEROEN / TEST button is created.

Note that you can only add or modify the keys and key values ​​without deleting them. (Translator Note: In fact, it can be deleted. The method is to add-numbers in front of the key name. This button will be deleted; if the specified key value is -, the key value can be deleted.)

2.3 Key Value Registry Key Values ​​can be three data types: string, binary value, and dual machine characters (DWORD, 32-bit integers). The name of the key value is included in quotation marks, and the value is tight after the equal number =. Each key contains at least one string type key value, this key value is displayed as "default" in the registry editor (Default) You can modify the default value by specifying the name @ @ @ = "this is the default value." 2.3.1 String strings can be any length, with quotation marks "included by ASCII code characters The value of the composition. Characters and / / can also be included in the string, but need to be escaped with ///. At the same time, the Registry Editor can import the non-ACSII code other than the export remission (and new line characters, the character specified by the ASCII code 10). When a string value contains a newline, it is output to be two lines at the time of export, but when imported again, only the first line can be imported, and the second line will be ignored. So please keep in mind: Do not include a newline character in the string value. For example: "foo" = "bar" "foopath" = "c: // windows // system" "foomessage" = "this / nof / one / nlong / nLINE."

2.3.2 Binary values ​​can use binary values ​​in the case where strings and double words are not applicable. The binary value can be used to store any type of data, which is HEX: XX, YY, Zz, etc. For longer binary values ​​can be used in a multi-line manner with a C language. For example: "BAR" = HEX: 48,00, 00, 01, 00, 00, 0A, 00, 0A, 00, 0A, 00, 0A, 00, 0A, 00, 0A, 00, 0A, / 00, 0A, 00, 0A, 00, 0A, 00, 0A, 00, 0A, 00, 0A, 00, 0A, 00, 0A, 00, 0A, 00 , / 0A, 00, 0A, 00, 0A, 00, 0A, 00, 0A, 00, 0A, 00, 100, 100, 100, C4, AC, 01, / 00 Remember, / characters can only be applied to binary values. In addition, Microsoft declares that a binary value cannot store more than 2K information, which is also worth noting. Example of binary value: "foo" = hex: 00, DE, CA, DE, 12, 34

2.3.2.1 Specific binary types In addition to conventional binary values, there are several specific types of binary values. We can specify: "FOOBAR" = HEX (Type): XX, XX, XX, XX, ... These types are represented by 0 to 10 these numbers, the specifics: 0 reg_none 1 reg_sz 2 reg_expand_sz 3 reg_binary 4 reg_dword, reg_dword_little_endian 5 reg_dword_big_endian 6 reg_link 7 reg_multi_sz 8 REG_RESOURCE_LIST 9 reg_full_resource_descriptor 10 reg_resource_requirements_list

2.3.2.1.1 REG_NONE Type The default binary value type is applied without special requirements. 2.3.2.1.2 The REG_SZ type is the string ending with '/ 0'. This is a string value specified by binary value. The following two expression methods are the same: "Barfoo" = HEX (1): 41, 42, 43, 44, "BARFOO" = "abcd" see 2.3.1 And strings.

2.3.2.1.3 The REG_EXPAND_SZ type contains a string of hidden strings, usually a reference to environment variables. When an application reads such a string, the system will convert the reference string to the correct environment variable. The following example represents a string "% path%; Something", when this value is referenced, "% PATH%" will be converted to the Path value of the current system. "Forbaa" = HEX (2): 25, 50, 41, 54, 48, 25, 3b, 53, 6f, 6d, 65, 74, 68, 69, 6e, 67, 100

2.3.2.1.4 Reg_dword, reg_dword_little_endian type small segment alignment, is a usual double word data type, stored in this format, the high byte is before, the low byte is behind.

2.3.2.1.5 REG_DWORD_BIG_ENDIAN Type large segment alignment is the two-word data type of the Apple machine, stored in this format, the low byte is before, the high byte is behind.

2.3.2.1.6 REG_LINK Type Unicode symbol connection.

2.3.2.1.7 REG_MULTI_SZ Multi-byte string set, ended in two row '/ 0', for example: "farboo" = HEX (7): 41, 42, 43, 44, 100, 45, 46, 47, 48, 00, represents two strings "ABCD" and "EFGH".

2.3.2.1.8 REG_RESOURCE_LIST Device Driver Resource List.

2.3.2.1.9 REG_FULL_RESOURCE_DESCRIPTOR Microsoft reserves the data type for auxiliary device drivers.

2.3.2.1.10 REG_RESOURCE_REQUIREMENTS_LIST Microsoft reserves the data type for auxiliary device drivers.

2.3.3. Double word data type double word data type, 32-bit integers, is represented as DWORD: XXXXXXXX, where x is a 16-digit value indicating 4-bit binary. For example: "foo" = dword: 00DECADE

3 Conclusion This article briefly introduces the format of the .reg file, because the author is limited, the wrong leakage is inevitable, if you find a mistake, please let me know. My email: j.mostert@oke.nl.

4 References The following is the URL for registry knowledge, I hope to help everyone. (Translator Note: Since these links are previously ago, they are no longer translated)

original:

Thethe .reg file format

J.MOSTERT

1 introduction the .reg file format is used by regedit, the program supplied with windows 3.x, windows 95, and windows nt, to import and export settings from the registry. Note that i will not explain what the registry is, how it works, or what it can be used for there are other documents describing the registry and it's most interesting parts all over the net -.. check out some of the links at the end of this document also, i will not provide you with information on regedit for windows 3.x - i know that it exists, but not if it's format is in any way like the regedit of 95 / nt besides, the registry is much less interesting on windows 3.x.2 description the file is formatted. AS Plain ASCII TEXT. EVERY LINE IS ended with a cr / lf combination.

2.1 Header IT Starts with regeditX, WHERE X is Regedit's Version Number - On 95 / NT, IT's 4, Making The String Regedit4.

this is also the only part of the file actually checked by regedit when it's importing - if the file contains any formatting errors, regedit will not notify you and simply skip the settings that contain errors.

In Particular, Reedit Will Pretty Much Accept Anything As Long As It Starts with regeditx, and ignore anything erroneous. Yes, That Does add up to the microsoft stupid missakes list.

2.2 keys key names are exported as they are encountered, but need not be in any order. Subkeys are explicitly named. For example, if you had the key hkey_classes_root / clsid and it's subkey hkey_classes_root / clsid / {21ec2020-3aea-1069-a2dd -08002b30309d} (Which Repesents the classid of the control panel, by the Way), They Would Be Exported As: [HKEY_CLASES_ROOT / CLSID]

[HKEY_CLASS_ROOT / CLSID / {21EC2020-3AEA-1069-A2DD-08002B30309D}]

For a key name to be valid, IT Must Start with one of the root key names: hkey_classes_root, hkey_current_user, hkey_local_machine, hkey_users, hkey_current_config and hkey_dyn_data.

A Key Name May Only Contain Printable Ascii Characters (That IS, Characters with Values ​​from 32 THROUGH 127) And May Not Contain Spaces, Backslashes / or The Wildcards * and?

Every Key Name Is Followed by It's Values, Starting on The Line Directly Following It. The list of values ​​is terminated with an es Empty line, And May Be Empty Itself.

For example: [key-name]

[SECOND-key-name] "value1" = Something "value2" = Something

[third-key-name]

if a key is specified which does not exist, it is created, along with any parent keys that do not exist. for example, if the key hkey_users / jeroen / test / subkey is specified, and only the key hkey_users / jeroen exists, the Key HKEY_USERS / JEROEN / TEST IS Also Created.

Not.

2.3 values ​​there are three kinds of values ​​in the registry:. Strings, binary values, and dwords they represent a collection of characters, a collection of bytes, and a 32-bit integer, respectively.values ​​consist of a name, enclosed in quotes "", FOLLOWED by an equal sign =, FOLLOWED by the value value (There's no Other Way to Put IT).

every key, even if created empty, contains at least one string value - this is the value shown as (default) in regedit to set it's value, use @ as the value name, and omit the usual quotes around the value name..

Example: @ = "this is the default value."

2.3.1 Strings strings may be any size. They is represented within quotes "", And Contain Normal ASCII Characters.

the quote "and backslash / are also allowed in strings - however, they must be represented as /" and //, respectively also, regedit can import and export all non-ascii characters except for linefeed (or newline, ascii code 10). . should a linefeed end up in a string, regedit will export this as a real newline, splitting the string in two lines when reimporting this string, regedit will only read the first line the moral of the story:.. do not store linefeeds in strings.

Examples of strings: "foo" = "bar" "foopath" = "c: // windows // system" "foomessage" = "this / nof / one / nlong / nline."

2.3.2 binary values ​​binary values ​​are used where strings and dwords fail they can be used to represent any type of data they are represented as hex:.. Xx, yy, zz where xx, yy and zz are hexadecimal representations of single bytes. THEY MULUES CAN Be Divided InTo Multiple Lines Using THE C LINE SEPARATOR /. FOR EXAMPLE: "bar" = HEX: 48,00,00,00,01,00,00,00 ,0a, 00 0A, 00, 0A, 00, 0A, 00, 0A, 0A, 00, 0A, 00, 0A, 00, 0A, 00, 0A, 00, 0A, 00, 0A, 00, 0A, 00, 0A, 00, 0A, 00, 00, 0A, 00, 0A, 00, 0A, 00, 0A, 00, 0A, 00, 0A , 00, 0A, 00, 0A, 00, 00, 00, C4, AC, 01, / 00

Also Take Note That Is Only ALLOWED with BINARY VALUES. IN Particular, You Cannot Divide Strings this Way. And Yes, this is pretty stupid.

Although I Usually Ignore Microsoft, The Recommend You Shouldn't Store More Than the Around Two Kilobytes of Binary Data At Most, And i Agree with Them for Once.

Example of Binary Values: "foo" = hex: 00, DE, CA, DE, 12, 34

2.3.3.2.1 Types of Binary Values ​​Along with 'REGULAR' Binary Values

"FOOBAR" = HEX (Type): XX, XX, XX, XX, ...

WHERE TYPE IS A Number Ranging from Zero To Ten In The Current Versions Of Windows, As Follows:

type name 0 reg_none 1 reg_sz 2 reg_expand_sz 3 reg_binary 4 reg_dword, reg_dword_little_endian 5 reg_dword_big_endian 6 reg_link 7 reg_multi_sz 8 reg_resource_list 9 reg_full_resource_descriptor 10 reg_resource_requirements_list

2.3.2.1.1 reg_none reg_none means 'no defined value type' no, i do not know what it's good for -. Reg_binary is already a catch-all type for everything that has no type perhaps it's used for values ​​that have no. Contents, although I can't imagine what this is the string. this is the Same as the string type, represented as bytes. for example, these definitions are equal:

"barfoo" = HEX (1): 41, 42, 43, 44, 00 and "barfoo" = "abcd"

See Also 2.3.1, Strings.

2.3.2.1.3 reg_expand_sz a null-terminated string that contains unexpanded references to environment variables. When an application reads this string from the registry, it can let windows replace the references with the environment variable value.

For Example, The Following Value

"forbaa" = HEX (2): 25, 50, 41, 54, 48, 25, 3b, 53, 6f, 6d, 65, 74, 68, 69, 6e, 67, 100

Repersents the string "% PATH%; Something". When this string is read, The "% path%" section can be replaced with the contents of your path variable.

2.3.2.1.4 reg_dword, reg_dword_little_endian represents a little-endian dword (the common format of windows dwords). In little-endian format, the most significant byte of a word is the high-order byte. See also 2.3.3, dwords .

2.3.2.1.5 reg_dword_big_endian represents a big-endian dword (used on macintoshes, for example). As you can probably guess, in big-endian format, the most significant byte of a word is the low-order byte.

2.3.2.1.6 REG_LINK REGERESENTS A UNICODE SYMBOLIC LINK. NO, I DON 'THAS, AND I Probably Don't Want To Know Either.2.3.2.1.7 Reg_Multi_SZ a Collection of Null-Terminated Strings, Null- Terminated. for exampled:

"farboo" = HEX (7): 41, 42, 43, 44, 00, 45, 46, 47, 48, 00, 00

Represents two strings: "abcd" and "efgh".

2.3.2.1.8 REG_RESOURCE_LIST A Device Driver Resource List. Another One In The Category "DON 'TOW AND DON' TANT TO KNOW."

2.3.2.1.9 REG_FULL_RESOURCE_DESCRIPTOR UNDOCUMENTED. It's probably momst for Windows Itself Only, AS Device Driver Stuff.

2.3.2.1.10 REG_RESOURCE_REQUIREMENTS_LIST UNDOCUMENTED. IT'S PROBABLY MENT for Windows Itself Only, AS Device Driver Stuff.

2.3.3. DWORDS DWORDS Are 32-Bit Integers Reperesented AS DWORD: XXXXXXXX, WHERE X IS A HEXADECIMAL DIGIT. They're Pretty Boring, As That's All I Can Tell About Them.

Example of DWord Values: "foo" = dword: 00DECADE

3. The end thing's about it - the .reg format is pretty simple, but it does the job. SHOULD you Find Any UNCLARISIES, MISTAKES or Things you thinking to "j.MOSTERT@oke.nl" .

4. Well, Almost, WE Still Need The Links Oh Yeah, Here Are The Links I Promised, Listed In No Particular Order. They Were All Valid On November 4th, 1997.

http://help.mindspring.com/technotes/96dec/registry1.htm this is the registry page at technotes , the site for a lot of tips and tricks about pretty much anything technical. it contains an introduction to the registry, and how it should be used i recommend to read this first if you've never even heard about this registry thing.http:. //www.geocities.com/siliconvalley/pines/2857/ this is a registry page by neil mcquarry, and a nice one it is, too. it contains a quick introduction to the registry, a brief description of .reg files, and a detailed description of various keys of interest. recommended if you want to get the most of the registry.

http://www.amazon.com this is amazons home page, "earth's biggest bookstore" try their search function to search for "windows registry" -.. this will provide you with more than enough literary references no online information, however.

http://www.windows95.com/tips this is the tips section of windows95.com. although it does not contain just registry tips, it's really worth checking out. but then again, all of windows95.com is worth checking out . if you have windows 95 / NT, Be Sure To Visit IT.

转载请注明原文地址:https://www.9cbs.com/read-93365.html

New Post(0)