[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
  
  ReturnString = ""
  xLong1 = ptrTempSizeX
  If IsUnicode Then
    'xLong3 = ptrTempSizeX
    RegQueryValueEx_String = (RegQueryValueExW(HKEY, ByVal StrPtr(lpValueName), 0&, 0&, ByVal ptrTemp, xLong1) = 0&)
    xLong1 = xLong1 / 2&
    Else
    'xLong3 = ptrTempSizeX
    RegQueryValueEx_String = (RegQueryValueExA(HKEY, lpValueName, 0&, 0&, ByVal ptrTemp, xLong1) = 0&)
    End If
  'And xLong2 = 1&
  If RegQueryValueEx_String And xLong1 > 1& Then
    ReturnString = PeekS(ptrTemp, xLong1 - 1&)
    Else
    RegQueryValueEx_String = False
    End If
  End Function
