tags:

views:

284

answers:

2

Which number cast is a registry Dword in vb based on its minimum and max values?

I am trying to build an editor that can read and edit registry dumps

+1  A: 

This is actually fairly easy to find out:

Dim value As Object = Registry.GetValue("HKEY_CURRENT_USER\Console", "FontSize", -1)
Console.WriteLine(value.GetType().FullName)

In the case of a REG_DWORD value this will print "System.Int32", which would be an Integer in VB.NET.

Fredrik Mörk
A: 

For VB.Net, you should use the Integer data type. See this handy list for details on the available datatypes. In older Visual Basic, you would have used the long data type.

This has the proper number of bits (32; an x86 DWORD is a "double word", where a word is understood to be 16-bit), but I think there's a slight problem with VB not supporting "unsigned" values. This limitation might make presentation/editing a bit more complicated.

unwind
Nope, that’s wrong (at least for VB.NET, which is what the question is tagged as). `Long` in VB is 64 bits (maps to `System.Int64`) – also, VB *does* know unsigned data types (again: VB.NET).
Konrad Rudolph
A `Long` in VB.NET is a 64-bit value.
Fredrik Mörk
Thanks, I didn't catch the .net tag. Updated.
unwind