Util_SystemInfo.h 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. /************************************************************************************
  2. Filename : Util_SystemInfo.h
  3. Content : Various operations to get information about the system
  4. Created : September 26, 2014
  5. Author : Kevin Jenkins
  6. Copyright : Copyright 2014 Oculus VR, LLC All Rights reserved.
  7. Licensed under the Oculus VR Rift SDK License Version 3.2 (the "License");
  8. you may not use the Oculus VR Rift SDK except in compliance with the License,
  9. which is provided at the time of installation or download, or which
  10. otherwise accompanies this software in either electronic or hard copy form.
  11. You may obtain a copy of the License at
  12. http://www.oculusvr.com/licenses/LICENSE-3.2
  13. Unless required by applicable law or agreed to in writing, the Oculus VR SDK
  14. distributed under the License is distributed on an "AS IS" BASIS,
  15. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  16. See the License for the specific language governing permissions and
  17. limitations under the License.
  18. ************************************************************************************/
  19. #ifndef OVR_Util_SystemInfo_h
  20. #define OVR_Util_SystemInfo_h
  21. #include "../Kernel/OVR_String.h"
  22. #include "../Kernel/OVR_Types.h"
  23. #include "../Kernel/OVR_Array.h"
  24. namespace OVR { namespace Util {
  25. bool Is64BitWindows();
  26. const char * OSAsString();
  27. String OSVersionAsString();
  28. uint64_t GetGuidInt();
  29. String GetGuidString();
  30. const char * GetProcessInfo();
  31. String GetDisplayDriverVersion();
  32. String GetCameraDriverVersion();
  33. void GetGraphicsCardList(OVR::Array< OVR::String > &gpus);
  34. String GetProcessorInfo();
  35. //Retrives the root of the Oculus install directory
  36. bool GetOVRRuntimePath(OVR::String &runtimePath);
  37. //Retrives the root of the Oculus install directory and from there finds the firmware bundle relative.
  38. //On Windows this is defined as a registry key. On Mac and Linux this is set as an environment variable.
  39. //For Development builds with no key set, we at 10 directories for (DIR)/Firmware/FirmwareBundle.json .
  40. //Iterating DIR as "..//" * maxSearchDirs concatenated.
  41. bool GetFirmwarePathFromService(OVR::String &runtimePath, int numSearchDirs = 10);
  42. #ifdef OVR_OS_MS
  43. //Retrives the root of the Oculus install directory
  44. bool GetOVRRuntimePathW(wchar_t out[MAX_PATH]);
  45. // Returns true if a string-type registry key of the given name is present, else sets out to empty and returns false.
  46. // The output string will always be 0-terminated, but may be empty.
  47. // If wow64value is true then KEY_WOW64_32KEY is used in the registry lookup.
  48. // If currentUser is true then HKEY_CURRENT_USER root is used instead of HKEY_LOCAL_MACHINE
  49. bool GetRegistryStringW(const wchar_t* pSubKey, const wchar_t* stringName, wchar_t out[MAX_PATH], bool wow64value = false, bool currentUser = false);
  50. // Returns true if a DWORD-type registry key of the given name is present, else sets out to 0 and returns false.
  51. // If wow64value is true then KEY_WOW64_32KEY is used in the registry lookup.
  52. // If currentUser is true then HKEY_CURRENT_USER root is used instead of HKEY_LOCAL_MACHINE
  53. bool GetRegistryDwordW(const wchar_t* pSubKey, const wchar_t* stringName, DWORD& out, bool wow64value = false, bool currentUser = false);
  54. // Returns true if a BINARY-type registry key of the given name is present, else sets out to 0 and returns false.
  55. // Size must be set to max size of out buffer on way in. Will be set to size actually read into the buffer on way out.
  56. // If wow64value is true then KEY_WOW64_32KEY is used in the registry lookup.
  57. // If currentUser is true then HKEY_CURRENT_USER root is used instead of HKEY_LOCAL_MACHINE
  58. bool GetRegistryBinaryW(const wchar_t* pSubKey, const wchar_t* stringName, LPBYTE out, DWORD* size, bool wow64value = false, bool currentUser = false);
  59. // Returns true if a registry key of the given type is present and can be interpreted as a boolean, otherwise
  60. // returns defaultValue. It's not possible to tell from a single call to this function if the given registry key
  61. // was present. For Strings, boolean means (atoi(str) != 0). For DWORDs, boolean means (dw != 0).
  62. // If currentUser is true then HKEY_CURRENT_USER root is used instead of HKEY_LOCAL_MACHINE
  63. bool GetRegistryBoolW(const wchar_t* pSubKey, const wchar_t* stringName, bool defaultValue, bool wow64value = false, bool currentUser = false);
  64. // Returns true if the value could be successfully written to the registry.
  65. // If wow64value is true then KEY_WOW64_32KEY is used in the registry write.
  66. // If currentUser is true then HKEY_CURRENT_USER root is used instead of HKEY_LOCAL_MACHINE
  67. bool SetRegistryBinaryW(const wchar_t* pSubKey, const wchar_t* stringName, const LPBYTE value, DWORD size, bool wow64value = false, bool currentUser = false);
  68. // Returns true if the value could be successfully deleted from the registry.
  69. // If wow64value is true then KEY_WOW64_32KEY is used.
  70. // If currentUser is true then HKEY_CURRENT_USER root is used instead of HKEY_LOCAL_MACHINE
  71. bool DeleteRegistryValue(const wchar_t* pSubKey, const wchar_t* stringName, bool wow64value = false, bool currentUser = false);
  72. //Mac + Linux equivelants are not implemented
  73. String GetFileVersionStringW(wchar_t filePath[MAX_PATH]);
  74. String GetSystemFileVersionStringW(wchar_t filePath[MAX_PATH]);
  75. #endif // OVR_OS_MS
  76. //-----------------------------------------------------------------------------
  77. // Get the path for local app data.
  78. String GetBaseOVRPath(bool create_dir);
  79. } } // namespace OVR { namespace Util {
  80. #endif // OVR_Util_SystemInfo_h