Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
99 lines (88 loc) · 3.23 KB

File metadata and controls

99 lines (88 loc) · 3.23 KB
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
/*
AppleWin : An Apple //e emulator for Windows
Copyright (C) 1994-1996, Michael O'Brien
Copyright (C) 1999-2001, Oliver Schmidt
Copyright (C) 2002-2005, Tom Charlesworth
Copyright (C) 2006-2007, Tom Charlesworth, Michael Pohoreski
AppleWin is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
AppleWin is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with AppleWin; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/* Description: Registry module
*
* Author: Various
*/
#include "StdAfx.h"
//===========================================================================
BOOL RegLoadString (LPCTSTR section, LPCTSTR key, BOOL peruser,
LPTSTR buffer, DWORD chars) {
int success = 0;
TCHAR fullkeyname[256];
wsprintf(fullkeyname,
TEXT("Software\\AppleWin\\CurrentVersion\\%s"),
(LPCTSTR)section);
HKEY keyhandle;
if (!RegOpenKeyEx((peruser ? HKEY_CURRENT_USER : HKEY_LOCAL_MACHINE),
fullkeyname,
0,
KEY_READ,
&keyhandle)) {
DWORD type;
DWORD size = chars;
success = (!RegQueryValueEx(keyhandle,key,0,&type,(LPBYTE)buffer,&size)) &&
size;
RegCloseKey(keyhandle);
}
return success;
}
//===========================================================================
BOOL RegLoadValue (LPCTSTR section, LPCTSTR key, BOOL peruser, DWORD *value) {
if (!value)
return 0;
TCHAR buffer[32] = TEXT("");
if (!RegLoadString(section,key,peruser,buffer,32))
return 0;
buffer[31] = 0;
*value = (DWORD)_ttoi(buffer);
return 1;
}
//===========================================================================
void RegSaveString (LPCTSTR section, LPCTSTR key, BOOL peruser, LPCTSTR buffer) {
TCHAR fullkeyname[256];
wsprintf(fullkeyname,
TEXT("Software\\AppleWin\\CurrentVersion\\%s"),
(LPCTSTR)section);
HKEY keyhandle;
DWORD disposition;
if (!RegCreateKeyEx((peruser ? HKEY_CURRENT_USER : HKEY_LOCAL_MACHINE),
fullkeyname,
0,
NULL,
REG_OPTION_NON_VOLATILE,
KEY_READ | KEY_WRITE,
(LPSECURITY_ATTRIBUTES)NULL,
&keyhandle,
&disposition)) {
RegSetValueEx(keyhandle,
key,
0,
REG_SZ,
(CONST BYTE *)buffer,
(_tcslen(buffer)+1)*sizeof(TCHAR));
RegCloseKey(keyhandle);
}
}
//===========================================================================
void RegSaveValue (LPCTSTR section, LPCTSTR key, BOOL peruser, DWORD value) {
TCHAR buffer[32] = TEXT("");
_ultot(value,buffer,10);
RegSaveString(section,key,peruser,buffer);
}
Morty Proxy This is a proxified and sanitized view of the page, visit original site.