-
Notifications
You must be signed in to change notification settings - Fork 2
/
utilities.h
66 lines (51 loc) · 1.55 KB
/
utilities.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
/*
Name: utilities.h
Copyright: Under the GNU General Public License Version 2 or later (the "GPL")
Author: Nick Knight
Klaus Darilion
Description:
*/
/* ***** BEGIN LICENSE BLOCK *****
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Asttapi.
*
* The Initial Developer of the Original Code is
* Nick Knight.
* Portions created by the Initial Developer are Copyright (C) 2005
* the Initial Developer. All Rights Reserved.
*
* Contributor(s): Klaus Darilion (enum.at)
*
* ***** END LICENSE BLOCK ***** */
//Public functions from this file
#include <windows.h>
#include <string>
#ifndef UTILITIES
#define UTILITIES
//One off time call to ensure we have a key for our configs
bool initConfigStore(void);
bool storeConfigString(std::string item, std::string str);
bool readConfigString(std::string item, std::string &str);
bool storeConfigInt(std::string item, DWORD str);
bool readConfigInt(std::string item, DWORD &str);
//some mutex simplification
//courtsey of a doc@ http://world.std.com/~jimf/papers/c++sync/c++sync.html
class Mutex {
private:
CRITICAL_SECTION lock;
public:
Mutex(void) {
InitializeCriticalSection(&lock);
}
void Lock(void) {
EnterCriticalSection(&lock);
}
void Unlock(void) {
LeaveCriticalSection(&lock);
}
};
#endif