[API]
RegQueryValueExA
RegQueryValueExW
RtlMoveMemory

[INCLUDE]
GenericInit

[CODE]
Public Function RegQueryValueEx_DWord(ByVal HKEY As Long, ByVal lpValueName As String, ByRef ReturnValue As Long) As Boolean
  Dim xLong1 As Long
  Dim xLong2 As Long
  Dim xBool1 As Boolean

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