7 Copyright 2000-2006, Morgan McGuire.
11 #ifndef G3D_REGISTRYUTIL_H
12 #define G3D_REGISTRYUTIL_H
14 #include "G3D/platform.h"
15 #include "G3D/g3dmath.h"
17 // This file is only used on Windows
25 Provides generalized Windows registry querying.
27 All key names are one string in the format:
28 "[base key]\[sub-keys]\value"
30 [base key] can be any of the following:
36 HKEY_PERFORMANCE_NLSTEXT
40 keyExists() should be used to validate a key before reading or writing
41 to ensure that a debug assert or false return is for a different error.
46 /** returns true if the key exists */
47 static bool keyExists(const std::string
& key
);
49 /** returns false if the key could not be read for any reason. */
50 static bool readInt32(const std::string
& key
, int32
& valueData
);
53 Reads an arbitrary amount of data from a binary registry key.
54 returns false if the key could not be read for any reason.
57 @param valueData pointer to the output buffer of sufficient size. Pass NULL as valueData in order to have available data size returned in dataSize.
58 @param dataSize size of the output buffer. When NULL is passed for valueData, contains the size of available data on successful return.
60 static bool readBytes(const std::string
& key
, uint8
* valueData
, uint32
& dataSize
);
62 /** returns false if the key could not be read for any reason. */
63 static bool readString(const std::string
& key
, std::string
& valueData
);
65 /** returns false if the key could not be written for any reason. */
66 static bool writeInt32(const std::string
& key
, int32 valueData
);
69 Writes an arbitrary amount of data to a binary registry key.
70 returns false if the key could not be written for any reason.
72 @param valueData pointer to the input buffer
73 @param dataSize size of the input buffer that should be written
75 static bool writeBytes(const std::string
& key
, const uint8
* valueData
, uint32 dataSize
);
77 /** returns false if the key could not be written for any reason. */
78 static bool writeString(const std::string
& key
, const std::string
& valueData
);
86 #endif // G3D_REGISTRYTUIL_H