'registry key
'从 Windows 注册表中返回一个字符串。
'   hLocation:  HKEY_CLASSES_ROOT
'               HKEY_CURRENT_USER
'               HKEY_LOCAL_MACHINE
'               HKEY_USERS
'   sSubKeys： 要打开的子项的名称。
'   sValueName： 要查询的值的名称。
'   sDefault: 默认值返回如果找不到键。
'   Returns:  String value from the specified Registry.
Function FF_GetRegistryString(ByVal hLocation As HANDLE, sSubKeys As CWSTR , sValueName As CWSTR ,  sDefault As CWSTR ) As CWSTR 
   
   Dim hKey As HKEY
   Dim zRegVal As wString * 1024
   Dim dwType As UInteger
   Dim dwSize As UInteger
   
   If hLocation = 0 Then hLocation = HKEY_CURRENT_USER
   
   zRegVal = sDefault
   If (RegOpenKeyExW(hLocation, Rtrim(**sSubKeys, "\"), 0, KEY_READ, @hKey) = ERROR_SUCCESS) Then
      dwType = REG_SZ
      dwSize = Sizeof(zRegVal)
      RegQueryValueExW hKey, **sValueName, 0, @dwType,Cast(any ptr, @zRegVal), @dwSize
      RegCloseKey hKey
   End If
   Return  zRegVal
End Function

