注册表的键值的数据类型有以下几种:
数据类型 | 含义 |
REG_BINARY | Binary data in any form.(以任何形式表示的二进制数据) |
REG_DWORD | A 32-bit number.(32位数值) |
REG_DWORD_LITTLE_ENDIAN | A 32-bit number in little-endian format.(以little-endian形式存储的32位数值) |
Windows is designed to run on little-endian computer architectures. Therefore, this value is defined as REG_DWORD in the Windows header files. (由于Windows操作系统都是little-endian架构运行的,所以在Windows操作系统这个数据类型等同于REG_DWORD) |
|
REG_DWORD_BIG_ENDIAN | A 32-bit number in big-endian format.(以 big-endian形式存储的32位数值) |
Some UNIX systems support big-endian architectures. (一些UNIX系统支持big-endian架构) |
|
REG_EXPAND_SZ | A null-terminated string that contains unexpanded references to environment variables
(for example, “%PATH%”). |
REG_LINK | A null-terminated Unicode string that contains the target path of a symbolic link
that was created by calling the RegCreateKeyEx function with REG_OPTION_CREATE_LINK. |
REG_MULTI_SZ | A sequence of null-terminated strings, terminated by an empty string (\0). (一序列由Null结尾的字符串组成的字符串,并且最后还是以Null字符结尾) |
The following is an example: (下面是一个例子:) |
|
String1\0String2\0String3\0LastString\0\0 | |
The first \0 terminates the first string, the second to the last \0 terminates the last string,
and the final \0 terminates the sequence. Note that the final terminator must be factored into the length of the string. (注意最后一个结束符也属于字符串长度的一部分) |
|
REG_NONE | No defined value type. (没有定义的值类型) |
REG_QWORD | A 64-bit number. (一个64位数值) |
REG_QWORD_LITTLE_ENDIAN | A 64-bit number in little-endian format. (以little-endian形式存储的64位数值) |
Windows is designed to run on little-endian computer architectures.
Therefore, this value is defined as REG_QWORD in the Windows header files. 所以在Windows操作系统这个数据类型等同于REG_QWORD) |
|
REG_SZ | A null-terminated string.
This will be either a Unicode or an ANSI string, depending on whether you use the Unicode or ANSI functions. |
这些数据类型都被定义在Winnt.h文件中,根据查找得知,它们对应的C++常量定义如下:
#define REG_NONE ( 0 ) // No value type #define REG_SZ ( 1 ) // Unicode null terminated string #define REG_EXPAND_SZ ( 2 ) // Unicode null terminated string // (with environment variable references) #define REG_BINARY ( 3 ) // Free form binary #define REG_DWORD ( 4 ) // 32-bit number #define REG_DWORD_LITTLE_ENDIAN ( 4 ) // 32-bit number (same as REG_DWORD) #define REG_DWORD_BIG_ENDIAN ( 5 ) // 32-bit number #define REG_LINK ( 6 ) // Symbolic Link (unicode) #define REG_MULTI_SZ ( 7 ) // Multiple Unicode strings #define REG_RESOURCE_LIST ( 8 ) // Resource list in the resource map #define REG_FULL_RESOURCE_DESCRIPTOR ( 9 ) // Resource list in the hardware description #define REG_RESOURCE_REQUIREMENTS_LIST ( 10 ) #define REG_QWORD ( 11 ) // 64-bit number #define REG_QWORD_LITTLE_ENDIAN ( 11 ) // 64-bit number (same as REG_QWORD)
相应的vb常量声明如下:
Public Enum RegistryValueTypes 'Predefined Value Types REG_NONE = (0) 'No value type REG_SZ = (1) 'Unicode nul terminated string REG_EXPAND_SZ = (2) 'Unicode nul terminated string w/enviornment var REG_BINARY = (3) 'Free form binary REG_DWORD = (4) '32-bit number REG_DWORD_LITTLE_ENDIAN = (4) '32-bit number (same as REG_DWORD) REG_DWORD_BIG_ENDIAN = (5) '32-bit number REG_LINK = (6) 'Symbolic Link (unicode) REG_MULTI_SZ = (7) 'Multiple Unicode strings REG_RESOURCE_LIST = (8) 'Resource list in the resource map REG_FULL_RESOURCE_DESCRIPTOR = (9) 'Resource list in the hardware description REG_RESOURCE_REQUIREMENTS_LIST = (10) REG_QWORD = (11) '64-bit number REG_QWORD_LITTLE_ENDIAN = (11) '64-bit number (same as REG_QWORD) End Enum
发表评论