Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

RegCreateKeyEx parameter documentation unclear 1

Status
Not open for further replies.

happyabc

IS-IT--Management
Mar 10, 2004
164
IN
Can anyone tell me what this paragraph from the MSDN documenation for RegCreateKeyEx lpClass parameter means:

"lpClass
Pointer to a null-terminated string that specifies the class (object type) of this key. This parameter is ignored if the key already exists."

Nowhere is it stated that keys are of different types.

Also what are the permissible values for this parameter?
 
I would just pass an empty string for that value.

Chip H.


If you want to get the best response to a question, please check out FAQ222-2244 first
 
Don't think any classes are defined. Just pass a null string.

======================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
 
I've located some code on the Web and they're passing value type specifiers viz. REG_SZ etc. It still doesn't make sense to me.
 
The class value corresponds to the value you'll see in the "Type" column when you run RegEdit. The commonly used types are REG_SZ, REG_DWORD, and REG_BINARY. The full list (from WinNT.h) are:
[ul][li]REG_NONE - no value type[/li]
[li]REG_SZ - null-terminated Unicode string[/li]
[li]REG_EXPAND_SZ - null-terminated Unicode string with embedded enviromental variables[/li]
[li]REG_BINARY - free form binary value[/li]
[li]REG_DWORD - 32-bit number[/li]
[li]REG_DWORD_LITTLE_ENDIAN - 32-bit number for Intel CPUs[/li]
[li]REG_DWORD_BIG_ENDIAN - 32-bit number for non-Intel CPUs[/li]
[li]REG_LINK - Symbolic link (Unicode)[/li]
[li]REG_MULTI_SZ - Multiple null-terminated Unicode strings, terminated with a double-null[/li]
[li]REG_RESOURCE_LIST - resource list in the resource map[/li]
[li]REG_FULL_RESOURCE_DESCRIPTOR - resource list in the hardware description[/li]
[li]REG_RESOURCE_REQUIREMENTS_LIST - no clue[/li]
[li]REG_QWORD - 64-bit number[/li]
[li]REG_QWORD_LITTLE_ENDIAN - 64-bit number for Intel CPUs[/li][/ul]

In order to use some of the less-common types, you'll either need to use the RegCreateKeyEx API, or use RegEdt32, which will allow you to type an arbitrary class name.

99.9% of the VB programmers (and nearly the same percentage of C/C++ developers) don't need anything more than REG_SZ, which is the default type when calling the API.

Chip H.


If you want to get the best response to a question, please check out FAQ222-2244 first
 
Could it be that it specifies the data type for the default value? This whole question of data types of stored values is confusing. I mean the whole point of having typed data is to alllow checking of operations so why bring it into the picture when you only want to store and retreive values ( it could be done the way the Win16 version did it - handle it as a raw array of bytes )?

Theres also the question of why the documentation desribes the paramater as a string but people are passing long values?
 
Class (as referred to in RegCreateKeyEx) is a different thing from Type (as referred to in, say, RegSetValueEx). It is the the latter (Type) which matches the "Type" column in RegEdit, and relates to the REG_NONE, REG_SZ, REG_BINARY, etc. Class in RegCreateKeyEx would appear not to. So what does it refer to? Well, depends which variant of the MSDN documentation you read. Here's the one I like:

lpClass
[in] Pointer to a null-terminated string that specifies the class (object type) of this key. This parameter is ignored if the key already exists. No classes are currently defined; applications should pass a null string. Windows 95 and Windows 98 use this parameter only for remote registry keys; it is ignored for local registry keys. Windows NT/Windows 2000 supports this parameter for both local and remote registry keys
 
Thanks a lot, strongm ( and what version of MSDN is this )? Incidentally, so what is the role of the data type in relation to the Registry?
 
Yeah, I didn't have that sentence in my copy of MSDN.

Chip H.


If you want to get the best response to a question, please check out FAQ222-2244 first
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top