13#if !defined(OWL_REGISTRY_H)
17#if defined(BI_HAS_PRAGMA_ONCE)
57#if defined(BI_COMP_BORLANDC)
70 uint32 GetDataType()
const;
71 uint32 GetDataSize()
const;
72 const uint8* GetData()
const;
102 mutable std::vector<uint8> Data;
105 long QueryTypeAndSize();
106 void RetrieveOnDemand()
const;
131 static auto GetClassesRoot() ->
TRegKey&;
132 static auto GetClassesRootClsid() ->
TRegKey&;
133 static auto GetCurrentConfig() ->
TRegKey&;
134 static auto GetCurrentUser() ->
TRegKey&;
135 static auto GetLocalMachine() ->
TRegKey&;
136 static auto GetPerformanceData() ->
TRegKey&;
137 static auto GetUsers() ->
TRegKey&;
141#if defined(OWL5_COMPAT)
147 static auto ClassesRootClsid() -> TRegKey& {
return GetClassesRootClsid(); }
148 static auto CurrentConfig() -> TRegKey& {
return GetCurrentConfig(); }
149 static auto CurrentUser() -> TRegKey& {
return GetCurrentUser(); }
150 static auto LocalMachine() -> TRegKey& {
return GetLocalMachine(); }
151 static auto PerformanceData() -> TRegKey& {
return GetPerformanceData(); }
152 static auto Users() -> TRegKey& {
return GetUsers(); }
168#if defined(BI_COMP_BORLANDC)
209 auto IsValid()
const noexcept ->
bool;
212 auto GetLength()
const ->
DWORD;
213 auto GetDacl()
const -> std::optional<PACL>;
214 auto GetGroup()
const ->
PSID;
215 auto GetOwner()
const ->
PSID;
216 auto GetRevision()
const ->
DWORD;
217 auto GetRmControl()
const -> std::optional<UCHAR>;
218 auto GetSacl()
const -> std::optional<PACL>;
224 void RemoveRmControl();
264 std::vector<std::byte> Data;
317 auto QueryInfo() const ->
TInfo;
322 uint32 GetSubkeyCount() const;
323 auto HasValue(const
tstring& valueName) const ->
bool;
325 uint32 GetValueCount() const;
338 static_assert(!std::is_pointer_v<T>,
"Return type can not be pointer.");
339 const auto v = GetValue(valueName);
348#if defined(OWL5_COMPAT)
384 {
return DeleteValue(
valName.c_str()); }
416 const TRegKey& BaseKey()
const;
442 const TRegKey& BaseKey()
const;
537 {
return Lookup(key.c_str(),
lang); }
541 {
return LookupRef(key.c_str()); }
545 {
return operator[](key.c_str()); }
583#define BEGIN_REGISTRATION(regname) \
584 extern TRegItem regname##_list[];\
585 extern TRegFormatHeap __regHeap;\
586 TRegList regname(regname##_list);\
587 TRegItem regname##_list[] = {
589#define END_REGISTRATION {0,{0}} };
591#define REGDATA(var,val) {#var, {val}},
592#define REGXLAT(var,val) {#var, {AUTOLANG_XLAT val}},
593#define REGITEM(key,val) {" " key, {val}},
594#define REGFORMAT(i,f,a,t,d) {"format" #i,{TRegItem::RegFormat(f,a,t,d,__regHeap)}},
595#define REGSTATUS(a,f) {"aspect" #a, {TRegItem::RegFlags(f,__regHeap)}},
596#define REGVERBOPT(v,mf,sf) {#v "opt",{TRegItem::RegVerbOpt(mf,sf,__regHeap)}},
597#define REGICON(i) {"iconindex",{TRegItem::RegFlags(i,__regHeap)}},
598#define REGDOCFLAGS(i) {"docflags",{TRegItem::RegFlags(i,__regHeap)}},
603#define REGISTRATION_FORMAT_BUFFER(n) \
604 TRegFormatHeap __regHeap;
606#define REGISTRATION_FORMAT_HEAP \
607 TRegFormatHeap __regHeap;
637#define ocrRichText _T("Rich Text Format")
638#define ocrEmbedSource _T("Embed Source")
639#define ocrEmbeddedObject _T("Embedded Object")
640#define ocrLinkSource _T("Link Source")
641#define ocrObjectDescriptor _T("Object Descriptor")
642#define ocrLinkSrcDescriptor _T("Link Source Descriptor")
726#define ocrSingleUse _T("1")
727#define ocrMultipleUse _T("2")
728#define ocrMultipleLocal _T("3")
747 int GetCount()
const;
760 void Activate(
int i);
764 bool IsActive(
int i)
const;
795 int GetCount()
const;
796 const tchar*& Value(
int i);
797 void ResetDefaultValues();
804 const tchar** Values;
888 return ::RegFlushKey(
Key);
1010 return Name.c_str();
1059#if defined(OWL5_COMPAT)
1105 return Name.c_str();
1142inline TRegKeyIterator::operator
bool()
1144 return Index >= 0 && Index <
int(Key.GetSubkeyCount());
1186 return Index = index;
1228inline TRegValueIterator::operator
bool()
1230 return Index >= 0 && Index <
int(Key.GetValueCount());
1272 return Index = index;
1400 memset(EnabledFlags, 0x80, Count);
1408 memset(EnabledFlags, 0x00, Count);
1418 if (
i > 0 &&
i <= Count)
1419 EnabledFlags[
i - 1] = 0;
1429 if (
i > 0 &&
i <= Count)
1430 EnabledFlags[
i - 1]++;
1440 if (
i > 0 &&
i <= Count)
1441 return EnabledFlags[
i - 1] > 0;
Diagnostic macros for assertions and tracing.
#define PRECONDITION(condition)
Encapsulates a SECURITY_DESCRIPTOR.
auto IsDaclPresent() const
Returns the SE_DACL_PRESENT flag in the SECURITY_DESCRIPTOR_CONTROL structure.
auto IsAbsolute() const
Returns the inverse of the SE_SELF_RELATIVE flag in the SECURITY_DESCRIPTOR_CONTROL structure.
auto IsSaclPresent() const
Returns the SE_SACL_PRESENT flag in the SECURITY_DESCRIPTOR_CONTROL structure.
auto IsSaclProtected() const
Returns the SE_SACL_PROTECTED flag in the SECURITY_DESCRIPTOR_CONTROL structure.
auto GetData() const noexcept -> const SECURITY_DESCRIPTOR *
auto GetData() noexcept -> SECURITY_DESCRIPTOR *
auto IsDaclDefaulted() const
Returns the SE_DACL_DEFAULTED flag in the SECURITY_DESCRIPTOR_CONTROL structure.
auto GetDataSize() const noexcept -> int
auto IsSaclAutoInheritRequired() const
Returns the SE_SACL_AUTO_INHERIT_REQ flag in the SECURITY_DESCRIPTOR_CONTROL structure.
auto IsDaclAutoInheritRequired() const
Returns the SE_DACL_AUTO_INHERIT_REQ flag in the SECURITY_DESCRIPTOR_CONTROL structure.
auto IsSelfRelative() const
Returns the SE_SELF_RELATIVE flag in the SECURITY_DESCRIPTOR_CONTROL structure.
auto IsSaclAutoInherited() const
Returns the SE_SACL_AUTO_INHERITED flag in the SECURITY_DESCRIPTOR_CONTROL structure.
auto IsOwnerDefaulted() const
Returns the SE_OWNER_DEFAULTED flag in the SECURITY_DESCRIPTOR_CONTROL structure.
auto IsSaclDefaulted() const
Returns the SE_SACL_DEFAULTED flag in the SECURITY_DESCRIPTOR_CONTROL structure.
auto IsDaclAutoInherited() const
Returns the SE_DACL_AUTO_INHERITED flag in the SECURITY_DESCRIPTOR_CONTROL structure.
auto IsGroupDefaulted() const
Returns the SE_GROUP_DEFAULTED flag in the SECURITY_DESCRIPTOR_CONTROL structure.
auto IsFlagSet(SECURITY_DESCRIPTOR_CONTROL mask) const
Returns true if all the set bits in the given mask are set in the SECURITY_DESCRIPTOR_CONTROL structu...
auto IsRmControlValid() const
Returns the SE_RM_CONTROL_VALID flag in the SECURITY_DESCRIPTOR_CONTROL structure.
auto IsDaclProtected() const
Returns the SE_DACL_PROTECTED flag in the SECURITY_DESCRIPTOR_CONTROL structure.
Encapsulates a registration key in the Windows Registry.
long EnumValue(int index, TCHAR *valueName, uint32 &valueNameSize, uint32 *type=nullptr, uint8 *data=nullptr, uint32 *dataSize=nullptr) const
Enumerates the values associated with this key.
long UnLoadKey(LPCTSTR subKeyName)
Unloads this key and its subkeys from the registry.
long Save(const tstring &fileName)
auto SetSecurity(SECURITY_INFORMATION infoToSet, PSECURITY_DESCRIPTOR secDesc) const -> long
Sets the security descriptor of this key.
long ReplaceKey(LPCTSTR subKeyName, LPCTSTR newFileName, LPCTSTR oldFileName)
Replaces the file backing this key and all of its subkeys with another file, so that when the system ...
LPCTSTR GetName() const
Returns a string identifying this key.
long SetValue(const tstring &valName, const tstring &value) const
auto GetHandle() const -> THandle
DWORD SubkeyCount
Number of subkeys.
long DeleteKey(LPCTSTR subKeyName)
Deletes the specified subkey of this registry key.
long Save(LPCTSTR fileName)
Saves this key and all of its subkeys and values to the specified file.
tstring Name
This Key's Name.
THandle Key
This Key's Handle.
long Restore(const tstring &fileName, uint32 options=0)
long Flush() const
Writes the attribute of this key in the registry.
long Restore(LPCTSTR fileName, uint32 options=0)
Reads the registry information in a specified file and copies it over this key.
long SetValue(const tstring &valName, uint32 type, const uint8 *data, uint32 dataSize) const
long DeleteValue(const tstring &valName) const
long SetValue(LPCTSTR valName, uint32 type, const uint8 *data, uint32 dataSize) const
Associates a value with this key.
long LoadKey(LPCTSTR subKeyName, LPCTSTR fileName)
Creates a subkey under HKEY_USER or HKEY_LOCAL_MACHINE and stores registration information from a spe...
long DeleteKey(const tstring &subKeyName)
long DeleteValue(LPCTSTR valName) const
Removes a named value from this registry key.
auto GetSecurity(SECURITY_INFORMATION infoRequested, PSECURITY_DESCRIPTOR secDesc, DWORD *secDescSize) const -> long
Retrieves a copy of the security descriptor protecting this registry key.
long UnLoadKey(const tstring &subKeyName)
long NukeKey(const tstring &subKeyName)
long QueryValue(const tstring &valName, uint32 *type, uint8 *data, uint32 *dataSize) const
long ReplaceKey(const tstring &subKeyName, const tstring &newFileName, const tstring &oldFileName)
bool ShouldClose
Should this key be closed on destruction.
long QueryValue(LPCTSTR valName, uint32 *type, uint8 *data, uint32 *dataSize) const
Retrieves the value associated with the unnamed value for this key in the registry.
uint32 GetSubkeyCount() const
Returns the number of subkeys attached to this key.
long EnumKey(int index, TCHAR *subKeyName, int subKeyNameSize) const
Enumerates the subkeys of this registry key.
long LoadKey(const tstring &subKeyName, const tstring &fileName)
uint32 GetValueCount() const
Returns the number of values attached to this key.
long SetValue(const tstring &valName, uint32 data) const
DWORD ValueCount
Number of value entries.
TCreateOK
Enumeration used to specify whether a key should be created (or simply opened).
@ CreateOK
Create key if it does not exist.
Iterator for walking thru the subkeys of a key.
uint32 operator[](int index)
Sets the index of the iterator to the passed value.
uint32 operator++()
Preincrements to the next subkey.
uint32 operator--()
Predecrements to the previous subkey.
const TRegKey & BaseKey() const
Returns the registration key this iterator is bound to.
TRegKeyIterator(const TRegKey &key)
Creates a subkey iterator for a registration key.
void Reset()
Resets the subkey index to zero.
int Current() const
Returns the index to the current subkey.
A linked structure in which each node points to a list of TRegList objects (or TRegList-derived objec...
TRegLink * Next
Next RegLink.
virtual ~TRegLink()
Registration link node destructor.
TRegLink * GetNext() const
Returns a pointer to the next link.
void SetNext(TRegLink *link)
TRegList * RegList
Pointer to registration parameter table.
TRegLink()
Derived class must fill in ptrs.
TRegList & GetRegList() const
Returns a pointer to the registration parameter table (reglist).
A registration parameter table, composed of a list of TRegItems.
TRegList(TRegItem *_list)
Constructs a TRegList object from an array of TRegItems terminated by a NULL item name.
LPCTSTR Lookup(LPCSTR key, TLangId lang=TLocaleString::UserDefaultLangId)
Performs the lookup of the TRegItems using a key (an item name such as progid) and returns the value ...
TLocaleString & LookupRef(const std::string &key)
LPCTSTR operator[](LPCSTR key)
The array operator uses an item name (key) to locate an item in the array.
LPCTSTR operator[](const std::string &key)
LPCTSTR Lookup(const std::string &key, TLangId lang=TLocaleString::UserDefaultLangId)
A list of param entries for use as an intermediate between a TRegList and the actual template list us...
const tchar *& Value(int i)
Return the value of the param entry at the passed index.
int Find(const tstring ¶m)
const TEntry & operator[](int i) const
Return the template string at the passed index.
int GetCount() const
Return the number of param entries in this list.
High level symbol-based registry entry manipulation.
TRegTemplateList Templates
List of parameterized template strings that represent the actual entries to be registered.
LPCTSTR operator[](int i)
Returns the template string at the passed index.
void DisableAll()
Disables all templates in this list.
bool IsActive(int i) const
Returns true if the template at the passed index is active, false otherwise.
void Activate(int i)
Activates the template at the passed index.
void Activate(const tstring &set)
void Enable(const tstring &set)
int GetCount() const
Returns the number of templates in this list.
TRegKey & GetBaseKey()
Returns the registry key upon which these templates are based.
void Enable(int i)
Enables the template at the passed index.
void EnableAll()
Enables all templates in this list.
Encapsulates a value-data entry within one registration key.
uint32 GetDataSize() const
Returns the size in bytes of the data associated with this value.
uint32 GetDataType() const
Returns the type code for the data associated with this value.
LPCTSTR GetName() const
Returns a string identifying this value.
Iterator for walking through the values of a key.
void Reset()
Resets the value index to zero.
int Current() const
Returns the index to the current value.
uint32 operator--()
Predecrements to the previous value.
const TRegKey & BaseKey() const
Returns the registration key that this iterator is bound to.
uint32 operator[](int index)
Sets the index of the iterator to the passed value.
uint32 operator++()
Preincrements to the next value.
TRegValueIterator(const TRegKey ®Key)
Creates a value iterator for a registration key.
TRegistry provides high level stream and list access to the registry.
TXOwl is root class of the ObjectWindows exception hierarchy.
Thrown for errors within the Registry classes.
TXRegistry(const tstring &context, const TRegKey &key, long errorCode=0)
TXRegistry(const tstring &context, tstring keyName, long errorCode=0)
auto GetKeyName() const -> const tstring &
auto GetErrorCode() const -> long
ocrObjectStatus
IOleObject miscellaneous status flags, defined for each or all aspects.
ocrMedium
Medium: means of data transfer.
ocrVerbAttributes
IOleObject verb attribute flags.
ocrAspect
Aspect: view types supported by transfer.
ocrDirection
Direction: transfer directions supported.
const int ocrFormatLimit
Maximum number of data formats per class.
ocrClipFormat
Format: standard clipboard numeric format, or name of custom format.
ocrVerbMenuFlags
IOleObject verb menu flags.
const int ocrVerbLimit
Maximum number of verbs registered per class.
@ ocrCantLinkInside
Should not be the link source.
@ ocrNoSpecialRendering
Older enum for previous entry.
@ ocrStatic
Object is an OLE static object.
@ ocrInsertNotReplace
Should not replace current select.
@ ocrRecomposeOnResize
Request redraw on container resize.
@ ocrRenderingIsDeviceIndependent
No decisions made based on target.
@ ocrOnlyIconic
Only useful context view is Icon.
@ ocrCanLinkByOle1
Only used in OBJECTDESCRIPTOR.
@ ocrActivateWhenVisible
Hint to cntnr when ocrInsideOut set.
@ ocrInsideOut
Can be activated concurrently.
@ ocrIsLinkObject
Set by OLE2 link for OLE1 compat.
@ ocrFile
TYMED_FILE - data as contents of file.
@ ocrStaticMed
OLE 2 static object.
@ ocrIStream
TYMED_ISTREAM - instance of an IStream object.
@ ocrMfPict
TYMED_MFPICT - CF_METAFILEPICT containing global handle.
@ ocrGDI
TYMED_GDI - GDI object in global handle.
@ ocrHGlobal
TYMED_HGLOBAL - global memory handle.
@ ocrIStorage
TYMED_ISTORAGE - streams within an instance of IStorage.
@ ocrNeverDirties
Verb can never cause object to become dirty.
@ ocrOnContainerMenu
Only useful context view is Icon.
@ ocrDocPrint
DVASPECT_DOCPRINT - print preview representation.
@ ocrThumbnail
DVASPECT_THUMBNAIL - picture appropriate for browser.
@ ocrContent
DVASPECT_CONTENT - normal display representation.
@ ocrIcon
DVASPECT_ICON - iconized representation of object.
@ ocrUnicodeText
CF_UNICODETEXT Win32 only.
@ ocrMetafilePict
CF_METAFILEPICT.
@ ocrEnhMetafile
CF_ENHMETAFILE Win32 only.
@ ocrMenuBreak
MF_MENUBAR.
@ ocrMenuBarBreak
MF_MENUBARBREAK.
@ ocrDisabled
MF_DISABLED.
TLocaleString - localized name support.
Reliable platform independent header for common memory and string functions.
Object Windows Library (OWLNext Core)
owl::uint16 TLangId
Holds a language ID, a predefined number that represents a base language and dialect.
ObjectWindows exception class & function definitions.
Designed to provide support for localized registration parameters, the TLocaleString Struct defines a...
A single registration list entry.
TLocaleString Value
Localizable value for parameter or subkey.
const char * Key
Non-localized parameter or registry subkey.
static tchar * RegFormat(const tstring &f, int a, int t, int d, TRegFormatHeap &heap)
static void OverflowCheck()
Data structure returned by QueryInfo.
DWORD SecurityDescriptorSize
DWORD MaxValueDataSize
In bytes.
LPCTSTR Default
Default value, 0 if no default & param is required.
LPCTSTR TemplatesNeeded
Octal string list of template indices to activate.
LPCTSTR Param
Substituted parameter name.
tchar Prepend
Optional tchar to prepend to key before removing.
LPCTSTR Name
Name of param.
TRegKey * BaseKey
Key that that the param is based upon.
Includes windowing system headers, with necessary macros defined.