OpenShot Library | libopenshot-audio  0.2.0
juce_WindowsRegistry.h
1 
2 /** @weakgroup juce_core-misc
3  * @{
4  */
5 /*
6  ==============================================================================
7 
8  This file is part of the JUCE library.
9  Copyright (c) 2017 - ROLI Ltd.
10 
11  JUCE is an open source library subject to commercial or open-source
12  licensing.
13 
14  The code included in this file is provided under the terms of the ISC license
15  http://www.isc.org/downloads/software-support-policy/isc-license. Permission
16  To use, copy, modify, and/or distribute this software for any purpose with or
17  without fee is hereby granted provided that the above copyright notice and
18  this permission notice appear in all copies.
19 
20  JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
21  EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
22  DISCLAIMED.
23 
24  ==============================================================================
25 */
26 
27 namespace juce
28 {
29 
30 #if JUCE_WINDOWS || DOXYGEN
31 
32 /**
33  Contains some static helper functions for manipulating the MS Windows registry
34  (Only available on Windows, of course!)
35 
36  @tags{Core}
37 */
39 {
40 public:
41  /** These values can be used to specify whether the 32- or 64-bit registry should be used.
42  When running on a 32-bit OS, there is no 64-bit registry, so the mode will be ignored.
43  */
44  enum WoW64Mode
45  {
46  /** Default handling: 32-bit apps will use the 32-bit registry, and 64-bit apps
47  will use the 64-bit registry. */
48  WoW64_Default = 0,
49 
50  /** Always use the 64-bit registry store. (KEY_WOW64_64KEY). */
51  WoW64_64bit = 0x100,
52 
53  /** Always use the 32-bit registry store. (KEY_WOW64_32KEY). */
54  WoW64_32bit = 0x200
55  };
56 
57  //==============================================================================
58  /** Returns a string from the registry.
59  The path is a string for the entire path of a value in the registry,
60  e.g. "HKEY_CURRENT_USER\Software\foo\bar"
61  */
62  static String JUCE_CALLTYPE getValue (const String& regValuePath,
63  const String& defaultValue = String(),
64  WoW64Mode mode = WoW64_Default);
65 
66  /** Reads a binary block from the registry.
67  The path is a string for the entire path of a value in the registry,
68  e.g. "HKEY_CURRENT_USER\Software\foo\bar"
69  @returns a DWORD indicating the type of the key.
70  */
71  static uint32 JUCE_CALLTYPE getBinaryValue (const String& regValuePath, MemoryBlock& resultData, WoW64Mode mode = WoW64_Default);
72 
73  /** Sets a registry value as a string.
74  This will take care of creating any groups needed to get to the given registry value.
75  */
76  static bool JUCE_CALLTYPE setValue (const String& regValuePath, const String& value, WoW64Mode mode = WoW64_Default);
77 
78  /** Sets a registry value as a DWORD.
79  This will take care of creating any groups needed to get to the given registry value.
80  */
81  static bool JUCE_CALLTYPE setValue (const String& regValuePath, uint32 value, WoW64Mode mode = WoW64_Default);
82 
83  /** Sets a registry value as a QWORD.
84  This will take care of creating any groups needed to get to the given registry value.
85  */
86  static bool JUCE_CALLTYPE setValue (const String& regValuePath, uint64 value, WoW64Mode mode = WoW64_Default);
87 
88  /** Sets a registry value as a binary block.
89  This will take care of creating any groups needed to get to the given registry value.
90  */
91  static bool JUCE_CALLTYPE setValue (const String& regValuePath, const MemoryBlock& value, WoW64Mode mode = WoW64_Default);
92 
93  /** Returns true if the given value exists in the registry. */
94  static bool JUCE_CALLTYPE valueExists (const String& regValuePath, WoW64Mode mode = WoW64_Default);
95 
96  /** Returns true if the given key exists in the registry. */
97  static bool JUCE_CALLTYPE keyExists (const String& regValuePath, WoW64Mode mode = WoW64_Default);
98 
99  /** Deletes a registry value. */
100  static bool JUCE_CALLTYPE deleteValue (const String& regValuePath, WoW64Mode mode = WoW64_Default);
101 
102  /** Deletes a registry key (which is registry-talk for 'folder'). */
103  static bool JUCE_CALLTYPE deleteKey (const String& regKeyPath, WoW64Mode mode = WoW64_Default);
104 
105  /** Creates a file association in the registry.
106 
107  This lets you set the executable that should be launched by a given file extension.
108  @param fileExtension the file extension to associate, including the
109  initial dot, e.g. ".txt"
110  @param symbolicDescription a space-free short token to identify the file type
111  @param fullDescription a human-readable description of the file type
112  @param targetExecutable the executable that should be launched
113  @param iconResourceNumber the icon that gets displayed for the file type will be
114  found by looking up this resource number in the
115  executable. Pass 0 here to not use an icon
116  @param registerForCurrentUserOnly if false, this will try to register the association
117  for all users (you might not have permission to do this
118  unless running in an installer). If true, it will register the
119  association in HKEY_CURRENT_USER.
120  @param mode the WoW64 mode to use for choosing the database
121  */
122  static bool JUCE_CALLTYPE registerFileAssociation (const String& fileExtension,
123  const String& symbolicDescription,
124  const String& fullDescription,
125  const File& targetExecutable,
126  int iconResourceNumber,
127  bool registerForCurrentUserOnly,
128  WoW64Mode mode = WoW64_Default);
129 
130  // DEPRECATED: use the other methods with a WoW64Mode parameter of WoW64_64bit instead.
131  JUCE_DEPRECATED (static String getValueWow64 (const String&, const String& defaultValue = String()));
132  JUCE_DEPRECATED (static bool valueExistsWow64 (const String&));
133  JUCE_DEPRECATED (static bool keyExistsWow64 (const String&));
134 
135 private:
136  WindowsRegistry() = delete;
137  JUCE_DECLARE_NON_COPYABLE (WindowsRegistry)
138 };
139 
140 #endif
141 
142 } // namespace juce
143 
144 /** @}*/
JUCE_API
#define JUCE_API
This macro is added to all JUCE public class declarations.
Definition: juce_StandardHeader.h:143
juce::File
Represents a local file or directory.
Definition: juce_File.h:44
juce::WindowsRegistry
Contains some static helper functions for manipulating the MS Windows registry (Only available on Win...
Definition: juce_WindowsRegistry.h:38
juce::String
The JUCE String class!
Definition: juce_String.h:42
juce::WindowsRegistry::WoW64Mode
WoW64Mode
These values can be used to specify whether the 32- or 64-bit registry should be used.
Definition: juce_WindowsRegistry.h:44
juce::MemoryBlock
A class to hold a resizable block of raw data.
Definition: juce_MemoryBlock.h:36