[API]
RegQueryValueExA
RegQueryValueExW
RtlMoveMemory

[INCLUDE]
GenericInit

[CODE]
Public Function RegQueryValueEx_DWord(ByVal HKEY As Long, ByVal lpValueName As String, Optional ByVal DefaultValue As Long = 0&) As Long
  Dim xLong1 As Long
  Dim xLong2 As Long
  Dim xBool1 As Boolean

  xLong1 = 4&
  If IsUnicode Then
    xBool1 = (RegQueryValueExW(HKEY, ByVal StrPtr(lpValueName), 0&, VarPtr(xLong2), ByVal ptrTemp, xLong1) = 0&)
    Else
    xBool1 = (RegQueryValueExA(HKEY, lpValueName, 0&, VarPtr(xLong2), ByVal ptrTemp, xLong1) = 0&)
    End If
  If xBool1 And xLong1 = 4& And xLong2 = 4& Then
    Call RtlMoveMemory(ByVal VarPtr(RegQueryValueEx_DWord), ByVal ptrTemp, 4&)
    Else
    RegQueryValueEx_DWord = DefaultValue
    End If
  End Function
