EnableExplicit

Procedure.s RegQueryValueEx_String(HKEY.i, *lpValueName)
  Define.s xResult
  Define.i xLong1
  Define.i xLong2

  xLong1 = #ptrTempSize - 2
  If RegQueryValueEx_(HKEY, *lpValueName, 0, @xLong2, *ptrTemp, @xLong1) = 0
    CompilerIf #PB_Compiler_Unicode
      xLong1 >> 1
      CompilerEndIf
    If xLong1 > 0 And xLong2 = #REG_SZ
      xResult = PeekS(*ptrTemp, xLong1)
      EndIf
    EndIf
  ProcedureReturn xResult
  EndProcedure

; IDE Options = PureBasic 5.21 LTS (Windows - x86)
; CursorPosition = 9
; Folding = -
; EnableUnicode
; EnableXP