mirror of
https://github.com/reactos/reactos.git
synced 2025-07-31 16:51:39 +00:00
fix storing and loading registry settings
svn path=/trunk/; revision=32063
This commit is contained in:
parent
08720c6375
commit
871c1fe88e
1 changed files with 10 additions and 16 deletions
|
@ -35,7 +35,7 @@ void LoadSettings()
|
|||
if(hugechar == 0)
|
||||
return;
|
||||
|
||||
hugechar[0] = _T('\0');
|
||||
ZeroMemory(hugechar, 4096);
|
||||
|
||||
RegCreateKeyEx(HKEY_CURRENT_USER, _T("Software\\Catch22\\Matrix Screen Saver"), 0,
|
||||
_T(""), 0, KEY_READ, NULL, &hkey, NULL);
|
||||
|
@ -71,21 +71,15 @@ void LoadSettings()
|
|||
if(ERROR_SUCCESS == RegQueryValueEx(hkey, _T("Randomize"), 0, 0, (BYTE *)&value, &len))
|
||||
g_fRandomizeMessages = (value == 0 ? FALSE : TRUE);
|
||||
|
||||
len = 4096;
|
||||
if(ERROR_SUCCESS == RegQueryValueEx(hkey, _T("FontName"), 0, 0, (BYTE *)hugechar, &len))
|
||||
{
|
||||
if(len > 0)
|
||||
lstrcpy(g_szFontName, hugechar);
|
||||
else
|
||||
lstrcpy(g_szFontName, _T("Arial"));
|
||||
|
||||
}
|
||||
len = 512;
|
||||
if(RegQueryValueEx(hkey, _T("FontName"), 0, 0, (BYTE *)g_szFontName, &len) != ERROR_SUCCESS)
|
||||
lstrcpy(g_szFontName, _T("Arial"));
|
||||
|
||||
len = 4096;
|
||||
|
||||
if(ERROR_SUCCESS == RegQueryValueEx(hkey, _T("Messages"), 0, 0 , (BYTE *)hugechar, &len))
|
||||
{
|
||||
while(len > 0 && *hptr && isascii(*hptr))
|
||||
while(len > 0 && *hptr && _istascii(*hptr))
|
||||
{
|
||||
if(lstrlen(hptr) > 0)
|
||||
{
|
||||
|
@ -109,7 +103,7 @@ void LoadSettings()
|
|||
void SaveSettings()
|
||||
{
|
||||
HKEY hkey;
|
||||
TCHAR *hugechar = malloc(4096);
|
||||
TCHAR *hugechar = malloc(4096 * sizeof(TCHAR));
|
||||
TCHAR *msgptr = hugechar;
|
||||
int totallen = 0;
|
||||
int i,len;
|
||||
|
@ -118,7 +112,7 @@ void SaveSettings()
|
|||
if(hugechar == 0)
|
||||
return;
|
||||
|
||||
hugechar[0] = _T('\0');
|
||||
ZeroMemory(hugechar, 4096 * sizeof(TCHAR));
|
||||
msgptr = hugechar;
|
||||
|
||||
RegCreateKeyEx(HKEY_CURRENT_USER, _T("Software\\Catch22\\Matrix Screen Saver"), 0,
|
||||
|
@ -142,7 +136,7 @@ void SaveSettings()
|
|||
value = g_fFontBold;
|
||||
RegSetValueEx(hkey, _T("FontBold"), 0, REG_DWORD, (BYTE *)&value, sizeof value);
|
||||
|
||||
RegSetValueEx(hkey, _T("FontName"), 0, REG_SZ, (BYTE *)g_szFontName, lstrlen(g_szFontName));
|
||||
RegSetValueEx(hkey, _T("FontName"), 0, REG_SZ, (BYTE *)g_szFontName, lstrlen(g_szFontName) * sizeof(TCHAR));
|
||||
|
||||
for(i = 0; i < g_nNumMessages; i++)
|
||||
{
|
||||
|
@ -156,10 +150,10 @@ void SaveSettings()
|
|||
}
|
||||
}
|
||||
|
||||
*msgptr = _T('\0');
|
||||
//*msgptr = _T('\0');
|
||||
totallen++;
|
||||
|
||||
RegSetValueEx(hkey, _T("Messages"), 0, REG_MULTI_SZ, (BYTE *)hugechar, totallen);
|
||||
RegSetValueEx(hkey, _T("Messages"), 0, REG_MULTI_SZ, (BYTE *)hugechar, totallen * sizeof(TCHAR));
|
||||
RegCloseKey(hkey);
|
||||
|
||||
free(hugechar);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue