[API]
RegQueryValueExA
RegQueryValueExW

[INCLUDE]
GenericInit

[CODE]
Public Function RegQueryValueEx_String(ByVal HKEY As Long, ByVal lpValueName As String, ByRef ReturnString As String) As Boolean
  Dim xLong1 As Long
  Dim xLong2 As Long

  ReturnString = ""
  xLong1 = ptrTempSizeX
  If IsUnicode Then
    RegQueryValueEx_String = (RegQueryValueExW(HKEY, ByVal StrPtr(lpValueName), 0&, VarPtr(xLong2), ByVal ptrTemp, xLong1) = 0&)
    xLong1 = xLong1 / 2&
    Else
    RegQueryValueEx_String = (RegQueryValueExA(HKEY, lpValueName, 0&, VarPtr(xLong2), ByVal ptrTemp, xLong1) = 0&)
    End If
  If RegQueryValueEx_String And xLong1 > 1& And xLong2 = 1& Then
    ReturnString = PeekS(ptrTemp, xLong1 - 1&)
    Else
    RegQueryValueEx_String = False
    End If
  End Function
