The JUCE cross-platform C++ framework, with DISTRHO/KXStudio specific changes
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

122 lines
5.5KB

  1. /*
  2. ==============================================================================
  3. This file is part of the JUCE library - "Jules' Utility Class Extensions"
  4. Copyright 2004-11 by Raw Material Software Ltd.
  5. ------------------------------------------------------------------------------
  6. JUCE can be redistributed and/or modified under the terms of the GNU General
  7. Public License (Version 2), as published by the Free Software Foundation.
  8. A copy of the license is included in the JUCE distribution, or can be found
  9. online at www.gnu.org/licenses.
  10. JUCE is distributed in the hope that it will be useful, but WITHOUT ANY
  11. WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
  12. A PARTICULAR PURPOSE. See the GNU General Public License for more details.
  13. ------------------------------------------------------------------------------
  14. To release a closed-source product which uses JUCE, commercial licenses are
  15. available: visit www.rawmaterialsoftware.com/juce for more information.
  16. ==============================================================================
  17. */
  18. #ifndef __JUCE_WINDOWSREGISTRY_JUCEHEADER__
  19. #define __JUCE_WINDOWSREGISTRY_JUCEHEADER__
  20. #if JUCE_WINDOWS || DOXYGEN
  21. /**
  22. Contains some static helper functions for manipulating the MS Windows registry
  23. (Only available on Windows, of course!)
  24. */
  25. class WindowsRegistry
  26. {
  27. public:
  28. //==============================================================================
  29. /** Returns a string from the registry.
  30. The path is a string for the entire path of a value in the registry,
  31. e.g. "HKEY_CURRENT_USER\Software\foo\bar"
  32. */
  33. static String getValue (const String& regValuePath,
  34. const String& defaultValue = String::empty);
  35. /** Returns a string from the WOW64 registry.
  36. The path is a string for the entire path of a value in the registry,
  37. e.g. "HKEY_CURRENT_USER\Software\foo\bar"
  38. */
  39. static String getValueWow64 (const String& regValuePath,
  40. const String& defaultValue = String::empty);
  41. /** Reads a binary block from the registry.
  42. The path is a string for the entire path of a value in the registry,
  43. e.g. "HKEY_CURRENT_USER\Software\foo\bar"
  44. @returns a DWORD indicating the type of the key.
  45. */
  46. static uint32 getBinaryValue (const String& regValuePath, MemoryBlock& resultData);
  47. /** Sets a registry value as a string.
  48. This will take care of creating any groups needed to get to the given registry value.
  49. */
  50. static bool setValue (const String& regValuePath, const String& value);
  51. /** Sets a registry value as a DWORD.
  52. This will take care of creating any groups needed to get to the given registry value.
  53. */
  54. static bool setValue (const String& regValuePath, uint32 value);
  55. /** Sets a registry value as a QWORD.
  56. This will take care of creating any groups needed to get to the given registry value.
  57. */
  58. static bool setValue (const String& regValuePath, uint64 value);
  59. /** Sets a registry value as a binary block.
  60. This will take care of creating any groups needed to get to the given registry value.
  61. */
  62. static bool setValue (const String& regValuePath, const MemoryBlock& value);
  63. /** Returns true if the given value exists in the registry. */
  64. static bool valueExists (const String& regValuePath);
  65. /** Returns true if the given value exists in the registry. */
  66. static bool valueExistsWow64 (const String& regValuePath);
  67. /** Deletes a registry value. */
  68. static void deleteValue (const String& regValuePath);
  69. /** Deletes a registry key (which is registry-talk for 'folder'). */
  70. static void deleteKey (const String& regKeyPath);
  71. /** Creates a file association in the registry.
  72. This lets you set the executable that should be launched by a given file extension.
  73. @param fileExtension the file extension to associate, including the
  74. initial dot, e.g. ".txt"
  75. @param symbolicDescription a space-free short token to identify the file type
  76. @param fullDescription a human-readable description of the file type
  77. @param targetExecutable the executable that should be launched
  78. @param iconResourceNumber the icon that gets displayed for the file type will be
  79. found by looking up this resource number in the
  80. executable. Pass 0 here to not use an icon
  81. @param registerForCurrentUserOnly if false, this will try to register the association
  82. for all users (you might not have permission to do this
  83. unless running in an installer). If true, it will register the
  84. association in HKEY_CURRENT_USER.
  85. */
  86. static bool registerFileAssociation (const String& fileExtension,
  87. const String& symbolicDescription,
  88. const String& fullDescription,
  89. const File& targetExecutable,
  90. int iconResourceNumber,
  91. bool registerForCurrentUserOnly);
  92. private:
  93. WindowsRegistry();
  94. JUCE_DECLARE_NON_COPYABLE (WindowsRegistry)
  95. };
  96. #endif
  97. #endif // __JUCE_WINDOWSREGISTRY_JUCEHEADER__