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.

119 lines
5.4KB

  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. /** Deletes a registry value. */
  66. static void deleteValue (const String& regValuePath);
  67. /** Deletes a registry key (which is registry-talk for 'folder'). */
  68. static void deleteKey (const String& regKeyPath);
  69. /** Creates a file association in the registry.
  70. This lets you set the executable that should be launched by a given file extension.
  71. @param fileExtension the file extension to associate, including the
  72. initial dot, e.g. ".txt"
  73. @param symbolicDescription a space-free short token to identify the file type
  74. @param fullDescription a human-readable description of the file type
  75. @param targetExecutable the executable that should be launched
  76. @param iconResourceNumber the icon that gets displayed for the file type will be
  77. found by looking up this resource number in the
  78. executable. Pass 0 here to not use an icon
  79. @param registerForCurrentUserOnly if false, this will try to register the association
  80. for all users (you might not have permission to do this
  81. unless running in an installer). If true, it will register the
  82. association in HKEY_CURRENT_USER.
  83. */
  84. static bool registerFileAssociation (const String& fileExtension,
  85. const String& symbolicDescription,
  86. const String& fullDescription,
  87. const File& targetExecutable,
  88. int iconResourceNumber,
  89. bool registerForCurrentUserOnly);
  90. private:
  91. WindowsRegistry();
  92. JUCE_DECLARE_NON_COPYABLE (WindowsRegistry);
  93. };
  94. #endif
  95. #endif // __JUCE_WINDOWSREGISTRY_JUCEHEADER__