per-user-registry-20040320

Rename existing registry Read/Write functions to Global

Add new registry functions to support Per User Read/Write operations

Clean up references to Registry Key strings

Change "ShowTrayIcon" to be a "Per User" item from a "Global" item
This commit is contained in:
Jeffrey Altman 2004-03-20 18:00:01 +00:00 committed by Jeffrey Altman
parent 804a85a487
commit aaed9b1a5a
6 changed files with 130 additions and 66 deletions

View File

@ -15,7 +15,13 @@
BOOL Config_ReadString (LPCTSTR pszLHS, LPTSTR pszRHS, size_t cchMax); BOOL Config_ReadString (LPCTSTR pszLHS, LPTSTR pszRHS, size_t cchMax);
extern TCHAR AFSConfigKeyName[] = TEXT("SYSTEM\\CurrentControlSet\\Services\\TransarcAFSDaemon\\Parameters"); /*
* REGISTRY ___________________________________________________________________
*
*/
extern const TCHAR AFSDConfigKeyName[] = TEXT("SYSTEM\\CurrentControlSet\\Services\\TransarcAFSDaemon\\Parameters");
extern const TCHAR AFSClientKeyName[] = TEXT("SOFTWARE\\OpenAFS\\Client");
void Config_GetGlobalDriveList (DRIVEMAPLIST *pDriveList) void Config_GetGlobalDriveList (DRIVEMAPLIST *pDriveList)
{ {
@ -35,7 +41,7 @@ void Config_GetGlobalDriveList (DRIVEMAPLIST *pDriveList)
memset(pDriveList, 0, sizeof(DRIVEMAPLIST)); memset(pDriveList, 0, sizeof(DRIVEMAPLIST));
lstrcpy(szKeyName, AFSConfigKeyName); lstrcpy(szKeyName, AFSDConfigKeyName);
lstrcat(szKeyName, TEXT("\\GlobalAutoMapper")); lstrcat(szKeyName, TEXT("\\GlobalAutoMapper"));
dwResult = RegOpenKeyEx(HKEY_LOCAL_MACHINE, szKeyName, 0, KEY_QUERY_VALUE, &hKey); dwResult = RegOpenKeyEx(HKEY_LOCAL_MACHINE, szKeyName, 0, KEY_QUERY_VALUE, &hKey);
@ -71,10 +77,10 @@ void Config_GetGlobalDriveList (DRIVEMAPLIST *pDriveList)
RegCloseKey(hKey); RegCloseKey(hKey);
} }
BOOL Config_ReadNum (LPCTSTR pszLHS, DWORD *pdwRHS) BOOL Config_ReadGlobalNum (LPCTSTR pszLHS, DWORD *pdwRHS)
{ {
HKEY hk; HKEY hk;
if (RegOpenKeyEx (HKEY_LOCAL_MACHINE, AFSConfigKeyName, 0, KEY_QUERY_VALUE, &hk) != ERROR_SUCCESS) if (RegOpenKeyEx (HKEY_LOCAL_MACHINE, AFSDConfigKeyName, 0, KEY_QUERY_VALUE, &hk) != ERROR_SUCCESS)
return FALSE; return FALSE;
DWORD dwSize = sizeof(*pdwRHS); DWORD dwSize = sizeof(*pdwRHS);
@ -89,10 +95,10 @@ BOOL Config_ReadNum (LPCTSTR pszLHS, DWORD *pdwRHS)
} }
BOOL Config_ReadString (LPCTSTR pszLHS, LPTSTR pszRHS, size_t cchMax) BOOL Config_ReadGlobalString (LPCTSTR pszLHS, LPTSTR pszRHS, size_t cchMax)
{ {
HKEY hk; HKEY hk;
if (RegOpenKeyEx (HKEY_LOCAL_MACHINE, AFSConfigKeyName, 0, KEY_QUERY_VALUE, &hk) != ERROR_SUCCESS) if (RegOpenKeyEx (HKEY_LOCAL_MACHINE, AFSDConfigKeyName, 0, KEY_QUERY_VALUE, &hk) != ERROR_SUCCESS)
return FALSE; return FALSE;
DWORD dwSize = sizeof(TCHAR) * cchMax; DWORD dwSize = sizeof(TCHAR) * cchMax;
@ -107,11 +113,11 @@ BOOL Config_ReadString (LPCTSTR pszLHS, LPTSTR pszRHS, size_t cchMax)
} }
void Config_WriteNum (LPCTSTR pszLHS, DWORD dwRHS) void Config_WriteGlobalNum (LPCTSTR pszLHS, DWORD dwRHS)
{ {
HKEY hk; HKEY hk;
DWORD dwDisp; DWORD dwDisp;
if (RegCreateKeyEx (HKEY_LOCAL_MACHINE, AFSConfigKeyName, 0, TEXT("container"), 0, KEY_SET_VALUE, NULL, &hk, &dwDisp) == ERROR_SUCCESS) if (RegCreateKeyEx (HKEY_LOCAL_MACHINE, AFSDConfigKeyName, 0, TEXT("container"), 0, KEY_SET_VALUE, NULL, &hk, &dwDisp) == ERROR_SUCCESS)
{ {
RegSetValueEx (hk, pszLHS, NULL, REG_DWORD, (PBYTE)&dwRHS, sizeof(dwRHS)); RegSetValueEx (hk, pszLHS, NULL, REG_DWORD, (PBYTE)&dwRHS, sizeof(dwRHS));
RegCloseKey (hk); RegCloseKey (hk);
@ -119,14 +125,77 @@ void Config_WriteNum (LPCTSTR pszLHS, DWORD dwRHS)
} }
void Config_WriteString (LPCTSTR pszLHS, LPCTSTR pszRHS) void Config_WriteGlobalString (LPCTSTR pszLHS, LPCTSTR pszRHS)
{ {
HKEY hk; HKEY hk;
DWORD dwDisp; DWORD dwDisp;
if (RegCreateKeyEx (HKEY_LOCAL_MACHINE, AFSConfigKeyName, 0, TEXT("container"), 0, KEY_SET_VALUE, NULL, &hk, &dwDisp) == ERROR_SUCCESS) if (RegCreateKeyEx (HKEY_LOCAL_MACHINE, AFSDConfigKeyName, 0, TEXT("container"), 0, KEY_SET_VALUE, NULL, &hk, &dwDisp) == ERROR_SUCCESS)
{ {
RegSetValueEx (hk, pszLHS, NULL, REG_SZ, (PBYTE)pszRHS, sizeof(TCHAR) * (1+lstrlen(pszRHS))); RegSetValueEx (hk, pszLHS, NULL, REG_SZ, (PBYTE)pszRHS, sizeof(TCHAR) * (1+lstrlen(pszRHS)));
RegCloseKey (hk); RegCloseKey (hk);
} }
} }
BOOL Config_ReadUserNum (LPCTSTR pszLHS, DWORD *pdwRHS)
{
HKEY hk;
if (RegOpenKeyEx (HKEY_CURRENT_USER, AFSClientKeyName, 0, KEY_QUERY_VALUE, &hk) != ERROR_SUCCESS)
if (RegOpenKeyEx (HKEY_LOCAL_MACHINE, AFSClientKeyName, 0, KEY_QUERY_VALUE, &hk) != ERROR_SUCCESS)
return FALSE;
DWORD dwSize = sizeof(*pdwRHS);
if (RegQueryValueEx (hk, pszLHS, NULL, NULL, (PBYTE)pdwRHS, &dwSize) != ERROR_SUCCESS)
{
RegCloseKey (hk);
return FALSE;
}
RegCloseKey (hk);
return TRUE;
}
BOOL Config_ReadUserString (LPCTSTR pszLHS, LPTSTR pszRHS, size_t cchMax)
{
HKEY hk;
if (RegOpenKeyEx (HKEY_CURRENT_USER, AFSClientKeyName, 0, KEY_QUERY_VALUE, &hk) != ERROR_SUCCESS)
if (RegOpenKeyEx (HKEY_LOCAL_MACHINE, AFSClientKeyName, 0, KEY_QUERY_VALUE, &hk) != ERROR_SUCCESS)
return FALSE;
DWORD dwSize = sizeof(TCHAR) * cchMax;
if (RegQueryValueEx (hk, pszLHS, NULL, NULL, (PBYTE)pszRHS, &dwSize) != ERROR_SUCCESS)
{
RegCloseKey (hk);
return FALSE;
}
RegCloseKey (hk);
return TRUE;
}
void Config_WriteUserNum (LPCTSTR pszLHS, DWORD dwRHS)
{
HKEY hk;
DWORD dwDisp;
if (RegCreateKeyEx (HKEY_CURRENT_USER, AFSClientKeyName, 0, TEXT("container"), 0, KEY_SET_VALUE, NULL, &hk, &dwDisp) == ERROR_SUCCESS)
{
RegSetValueEx (hk, pszLHS, NULL, REG_DWORD, (PBYTE)&dwRHS, sizeof(dwRHS));
RegCloseKey (hk);
}
}
void Config_WriteUserString (LPCTSTR pszLHS, LPCTSTR pszRHS)
{
HKEY hk;
DWORD dwDisp;
if (RegCreateKeyEx (HKEY_CURRENT_USER, AFSClientKeyName, 0, TEXT("container"), 0, KEY_SET_VALUE, NULL, &hk, &dwDisp) == ERROR_SUCCESS)
{
RegSetValueEx (hk, pszLHS, NULL, REG_SZ, (PBYTE)pszRHS, sizeof(TCHAR) * (1+lstrlen(pszRHS)));
RegCloseKey (hk);
}
}

View File

@ -83,8 +83,8 @@ typedef struct
extern GLOBALS g; extern GLOBALS g;
extern const TCHAR AFSConfigKeyName[]; extern const TCHAR AFSDConfigKeyName[];
extern const TCHAR AFSClientKeyName[];
/* /*
* MACROS _____________________________________________________________________ * MACROS _____________________________________________________________________

View File

@ -34,14 +34,6 @@ extern "C" {
#define PIOCTL_MAXSIZE 2048 #define PIOCTL_MAXSIZE 2048
/*
* REGISTRY ___________________________________________________________________
*
*/
static TCHAR cszLANMANDEVICE[] = TEXT("\\Device\\LanmanRedirector\\");
const TCHAR AFSConfigKeyName[] = TEXT("SYSTEM\\CurrentControlSet\\Services\\TransarcAFSDaemon\\Parameters");
/* /*
* ROUTINES ___________________________________________________________________ * ROUTINES ___________________________________________________________________
@ -91,14 +83,14 @@ DWORD Config_GetServiceState (void)
void Config_GetGatewayFlag (BOOL *pfFlag) void Config_GetGatewayFlag (BOOL *pfFlag)
{ {
if (!Config_ReadNum (TEXT("IsGateway"), (DWORD*)pfFlag)) if (!Config_ReadGlobalNum (TEXT("IsGateway"), (DWORD*)pfFlag))
*pfFlag = FALSE; *pfFlag = FALSE;
} }
BOOL Config_SetGatewayFlag (BOOL fFlag, ULONG *pStatus) BOOL Config_SetGatewayFlag (BOOL fFlag, ULONG *pStatus)
{ {
Config_WriteNum (TEXT("IsGateway"), fFlag); Config_WriteGlobalNum (TEXT("IsGateway"), fFlag);
g.fNeedRestart = TRUE; g.fNeedRestart = TRUE;
return TRUE; return TRUE;
} }
@ -106,7 +98,7 @@ BOOL Config_SetGatewayFlag (BOOL fFlag, ULONG *pStatus)
void Config_GetGatewayName (LPTSTR pszName) void Config_GetGatewayName (LPTSTR pszName)
{ {
if (!Config_ReadString (TEXT("Gateway"), pszName, MAX_PATH)) if (!Config_ReadGlobalString (TEXT("Gateway"), pszName, MAX_PATH))
GetString (pszName, IDS_GATEWAY_UNKNOWN); GetString (pszName, IDS_GATEWAY_UNKNOWN);
else if (!*pszName) else if (!*pszName)
GetString (pszName, IDS_GATEWAY_UNKNOWN); GetString (pszName, IDS_GATEWAY_UNKNOWN);
@ -119,11 +111,11 @@ BOOL Config_SetGatewayName (LPCTSTR pszName, ULONG *pStatus)
GetString (szBogus, IDS_GATEWAY_UNKNOWN); GetString (szBogus, IDS_GATEWAY_UNKNOWN);
if (!lstrcmpi (szBogus, pszName)) if (!lstrcmpi (szBogus, pszName))
{ {
Config_WriteString (TEXT("Gateway"), TEXT("")); Config_WriteGlobalString (TEXT("Gateway"), TEXT(""));
} }
else else
{ {
Config_WriteString (TEXT("Gateway"), pszName); Config_WriteGlobalString (TEXT("Gateway"), pszName);
} }
return TRUE; return TRUE;
@ -165,7 +157,7 @@ void Config_FixGatewayDrives (void)
void Config_GetCellName (LPTSTR pszName) void Config_GetCellName (LPTSTR pszName)
{ {
if (!Config_ReadString (TEXT("Cell"), pszName, MAX_PATH)) if (!Config_ReadGlobalString (TEXT("Cell"), pszName, MAX_PATH))
GetString (pszName, IDS_CELL_UNKNOWN); GetString (pszName, IDS_CELL_UNKNOWN);
else if (!*pszName) else if (!*pszName)
GetString (pszName, IDS_CELL_UNKNOWN); GetString (pszName, IDS_CELL_UNKNOWN);
@ -211,7 +203,7 @@ BOOL Config_SetCellName (LPCTSTR pszName, ULONG *pStatus)
GetString (szBogus, IDS_CELL_UNKNOWN); GetString (szBogus, IDS_CELL_UNKNOWN);
if (lstrcmpi (szBogus, pszName)) if (lstrcmpi (szBogus, pszName))
{ {
Config_WriteString (TEXT("Cell"), pszName); Config_WriteGlobalString (TEXT("Cell"), pszName);
g.fNeedRestart = TRUE; g.fNeedRestart = TRUE;
} }
return TRUE; return TRUE;
@ -347,14 +339,14 @@ BOOL Config_SetAuthentFlag (BOOL fFlag, ULONG *pStatus)
void Config_GetTrayIconFlag (BOOL *pfFlag) void Config_GetTrayIconFlag (BOOL *pfFlag)
{ {
if (!Config_ReadNum (TEXT("ShowTrayIcon"), (DWORD*)pfFlag)) if (!Config_ReadUserNum (TEXT("ShowTrayIcon"), (DWORD*)pfFlag))
*pfFlag = FALSE; *pfFlag = FALSE;
} }
BOOL Config_SetTrayIconFlag (BOOL fFlag, ULONG *pStatus) BOOL Config_SetTrayIconFlag (BOOL fFlag, ULONG *pStatus)
{ {
Config_WriteNum (TEXT("ShowTrayIcon"), fFlag); Config_WriteUserNum (TEXT("ShowTrayIcon"), fFlag);
for (HWND hSearch = GetWindow (GetDesktopWindow(), GW_CHILD); for (HWND hSearch = GetWindow (GetDesktopWindow(), GW_CHILD);
hSearch && IsWindow(hSearch); hSearch && IsWindow(hSearch);
@ -521,7 +513,7 @@ void Config_FreeServerPrefs (PSERVERPREFS pPrefs)
void Config_GetCacheSize (ULONG *pckCache) void Config_GetCacheSize (ULONG *pckCache)
{ {
if (!Config_ReadNum (TEXT("CacheSize"), (DWORD*)pckCache)) if (!Config_ReadGlobalNum (TEXT("CacheSize"), (DWORD*)pckCache))
*pckCache = CM_CONFIGDEFAULT_CACHESIZE; *pckCache = CM_CONFIGDEFAULT_CACHESIZE;
} }
@ -555,7 +547,7 @@ BOOL Config_SetCacheSize (ULONG ckCache, ULONG *pStatus)
if (rc) if (rc)
{ {
Config_WriteNum (TEXT("CacheSize"), ckCache); Config_WriteGlobalNum (TEXT("CacheSize"), ckCache);
} }
if (pStatus && !rc) if (pStatus && !rc)
@ -569,7 +561,7 @@ BOOL Config_SetCacheSize (ULONG ckCache, ULONG *pStatus)
void Config_GetChunkSize (ULONG *pckChunk) void Config_GetChunkSize (ULONG *pckChunk)
{ {
if (!Config_ReadNum (TEXT("ChunkSize"), (DWORD*)pckChunk)) if (!Config_ReadGlobalNum (TEXT("ChunkSize"), (DWORD*)pckChunk))
*pckChunk = CM_CONFIGDEFAULT_CHUNKSIZE; *pckChunk = CM_CONFIGDEFAULT_CHUNKSIZE;
*pckChunk = max (*pckChunk, 10); *pckChunk = max (*pckChunk, 10);
*pckChunk = (1 << ((*pckChunk)-10)); *pckChunk = (1 << ((*pckChunk)-10));
@ -578,7 +570,7 @@ void Config_GetChunkSize (ULONG *pckChunk)
BOOL Config_SetChunkSize (ULONG ckChunk, ULONG *pStatus) BOOL Config_SetChunkSize (ULONG ckChunk, ULONG *pStatus)
{ {
Config_WriteNum (TEXT("ChunkSize"), log2(ckChunk * 1024)); Config_WriteGlobalNum (TEXT("ChunkSize"), log2(ckChunk * 1024));
g.fNeedRestart = TRUE; g.fNeedRestart = TRUE;
return TRUE; return TRUE;
} }
@ -587,14 +579,14 @@ BOOL Config_SetChunkSize (ULONG ckChunk, ULONG *pStatus)
void Config_GetStatEntries (ULONG *pcEntries) void Config_GetStatEntries (ULONG *pcEntries)
{ {
if (!Config_ReadNum (TEXT("Stats"), (DWORD*)pcEntries)) if (!Config_ReadGlobalNum (TEXT("Stats"), (DWORD*)pcEntries))
*pcEntries = CM_CONFIGDEFAULT_STATS; *pcEntries = CM_CONFIGDEFAULT_STATS;
} }
BOOL Config_SetStatEntries (ULONG cEntries, ULONG *pStatus) BOOL Config_SetStatEntries (ULONG cEntries, ULONG *pStatus)
{ {
Config_WriteNum (TEXT("Stats"), cEntries); Config_WriteGlobalNum (TEXT("Stats"), cEntries);
g.fNeedRestart = TRUE; g.fNeedRestart = TRUE;
return TRUE; return TRUE;
} }
@ -647,14 +639,14 @@ BOOL Config_SetProbeInt (ULONG csecProbe, ULONG *pStatus)
void Config_GetNumThreads (ULONG *pcThreads) void Config_GetNumThreads (ULONG *pcThreads)
{ {
if (!Config_ReadNum (TEXT("ServerThreads"), (DWORD*)pcThreads)) if (!Config_ReadGlobalNum (TEXT("ServerThreads"), (DWORD*)pcThreads))
*pcThreads = CM_CONFIGDEFAULT_SVTHREADS; *pcThreads = CM_CONFIGDEFAULT_SVTHREADS;
} }
BOOL Config_SetNumThreads (ULONG cThreads, ULONG *pStatus) BOOL Config_SetNumThreads (ULONG cThreads, ULONG *pStatus)
{ {
Config_WriteNum (TEXT("ServerThreads"), cThreads); Config_WriteGlobalNum (TEXT("ServerThreads"), cThreads);
g.fNeedRestart = TRUE; g.fNeedRestart = TRUE;
return TRUE; return TRUE;
} }
@ -663,14 +655,14 @@ BOOL Config_SetNumThreads (ULONG cThreads, ULONG *pStatus)
void Config_GetNumDaemons (ULONG *pcDaemons) void Config_GetNumDaemons (ULONG *pcDaemons)
{ {
if (!Config_ReadNum (TEXT("Daemons"), (DWORD*)pcDaemons)) if (!Config_ReadGlobalNum (TEXT("Daemons"), (DWORD*)pcDaemons))
*pcDaemons = CM_CONFIGDEFAULT_DAEMONS; *pcDaemons = CM_CONFIGDEFAULT_DAEMONS;
} }
BOOL Config_SetNumDaemons (ULONG cDaemons, ULONG *pStatus) BOOL Config_SetNumDaemons (ULONG cDaemons, ULONG *pStatus)
{ {
Config_WriteNum (TEXT("Daemons"), cDaemons); Config_WriteGlobalNum (TEXT("Daemons"), cDaemons);
g.fNeedRestart = TRUE; g.fNeedRestart = TRUE;
return TRUE; return TRUE;
} }
@ -679,7 +671,7 @@ BOOL Config_SetNumDaemons (ULONG cDaemons, ULONG *pStatus)
void Config_GetSysName (LPTSTR pszName) void Config_GetSysName (LPTSTR pszName)
{ {
if (!Config_ReadString (TEXT("SysName"), pszName, MAX_PATH)) if (!Config_ReadGlobalString (TEXT("SysName"), pszName, MAX_PATH))
lstrcpy (pszName, TEXT("i386_nt40")); lstrcpy (pszName, TEXT("i386_nt40"));
} }
@ -716,7 +708,7 @@ BOOL Config_SetSysName (LPCTSTR pszName, ULONG *pStatus)
if (rc) if (rc)
{ {
Config_WriteString (TEXT("SysName"), pszName); Config_WriteGlobalString (TEXT("SysName"), pszName);
} }
if (pStatus && !rc) if (pStatus && !rc)
@ -730,14 +722,14 @@ BOOL Config_SetSysName (LPCTSTR pszName, ULONG *pStatus)
void Config_GetRootVolume (LPTSTR pszName) void Config_GetRootVolume (LPTSTR pszName)
{ {
if (!Config_ReadString (TEXT("RootVolume"), pszName, MAX_PATH)) if (!Config_ReadGlobalString (TEXT("RootVolume"), pszName, MAX_PATH))
lstrcpy (pszName, TEXT("root.afs")); lstrcpy (pszName, TEXT("root.afs"));
} }
BOOL Config_SetRootVolume (LPCTSTR pszName, ULONG *pStatus) BOOL Config_SetRootVolume (LPCTSTR pszName, ULONG *pStatus)
{ {
Config_WriteString (TEXT("RootVolume"), pszName); Config_WriteGlobalString (TEXT("RootVolume"), pszName);
g.fNeedRestart = TRUE; g.fNeedRestart = TRUE;
return TRUE; return TRUE;
} }
@ -746,14 +738,14 @@ BOOL Config_SetRootVolume (LPCTSTR pszName, ULONG *pStatus)
void Config_GetMountRoot (LPTSTR pszPath) void Config_GetMountRoot (LPTSTR pszPath)
{ {
if (!Config_ReadString (TEXT("MountRoot"), pszPath, MAX_PATH)) if (!Config_ReadGlobalString (TEXT("MountRoot"), pszPath, MAX_PATH))
lstrcpy (pszPath, TEXT("/afs")); lstrcpy (pszPath, TEXT("/afs"));
} }
BOOL Config_SetMountRoot (LPCTSTR pszPath, ULONG *pStatus) BOOL Config_SetMountRoot (LPCTSTR pszPath, ULONG *pStatus)
{ {
Config_WriteString (TEXT("MountRoot"), pszPath); Config_WriteGlobalString (TEXT("MountRoot"), pszPath);
g.fNeedRestart = TRUE; g.fNeedRestart = TRUE;
return TRUE; return TRUE;
} }
@ -799,7 +791,7 @@ BOOL Config_GetCacheInUse (ULONG *pckCacheInUse, ULONG *pStatus)
void Config_GetCachePath (LPTSTR pszCachePath) void Config_GetCachePath (LPTSTR pszCachePath)
{ {
if (!Config_ReadString (TEXT("CachePath"), pszCachePath, MAX_PATH)) { if (!Config_ReadGlobalString (TEXT("CachePath"), pszCachePath, MAX_PATH)) {
TCHAR szPath[MAX_PATH]; TCHAR szPath[MAX_PATH];
GetWindowsDirectory(szPath, sizeof(szPath)); GetWindowsDirectory(szPath, sizeof(szPath));
szPath[2] = 0; /* get drive letter only */ szPath[2] = 0; /* get drive letter only */
@ -811,83 +803,83 @@ void Config_GetCachePath (LPTSTR pszCachePath)
BOOL Config_SetCachePath(LPCTSTR pszPath, ULONG *pStatus) BOOL Config_SetCachePath(LPCTSTR pszPath, ULONG *pStatus)
{ {
Config_WriteString (TEXT("CachePath"), pszPath); Config_WriteGlobalString (TEXT("CachePath"), pszPath);
g.fNeedRestart = TRUE; g.fNeedRestart = TRUE;
return TRUE; return TRUE;
} }
void Config_GetLanAdapter (ULONG *pnLanAdapter) void Config_GetLanAdapter (ULONG *pnLanAdapter)
{ {
if (!Config_ReadNum (TEXT("LANadapter"), (DWORD*)pnLanAdapter)) if (!Config_ReadGlobalNum (TEXT("LANadapter"), (DWORD*)pnLanAdapter))
*pnLanAdapter = -1; *pnLanAdapter = -1;
} }
BOOL Config_SetLanAdapter (ULONG nLanAdapter, ULONG *pStatus) BOOL Config_SetLanAdapter (ULONG nLanAdapter, ULONG *pStatus)
{ {
Config_WriteNum (TEXT("LANadapter"), nLanAdapter); Config_WriteGlobalNum (TEXT("LANadapter"), nLanAdapter);
g.fNeedRestart = TRUE; g.fNeedRestart = TRUE;
return TRUE; return TRUE;
} }
void Config_GetTrapOnPanic (BOOL *pfFlag) void Config_GetTrapOnPanic (BOOL *pfFlag)
{ {
if (!Config_ReadNum (TEXT("TrapOnPanic"), (DWORD*)pfFlag)) if (!Config_ReadGlobalNum (TEXT("TrapOnPanic"), (DWORD*)pfFlag))
*pfFlag = TRUE; *pfFlag = TRUE;
} }
BOOL Config_SetTrapOnPanic (BOOL fFlag, ULONG *pStatus) BOOL Config_SetTrapOnPanic (BOOL fFlag, ULONG *pStatus)
{ {
Config_WriteNum (TEXT("TrapOnPanic"), fFlag); Config_WriteGlobalNum (TEXT("TrapOnPanic"), fFlag);
g.fNeedRestart = TRUE; g.fNeedRestart = TRUE;
return TRUE; return TRUE;
} }
void Config_GetTraceBufferSize (ULONG *pnBufSize) void Config_GetTraceBufferSize (ULONG *pnBufSize)
{ {
if (!Config_ReadNum (TEXT("TraceBufferSize"), (DWORD*)pnBufSize)) if (!Config_ReadGlobalNum (TEXT("TraceBufferSize"), (DWORD*)pnBufSize))
*pnBufSize = 5000; *pnBufSize = 5000;
} }
BOOL Config_SetTraceBufferSize (ULONG nBufSize, ULONG *pStatus) BOOL Config_SetTraceBufferSize (ULONG nBufSize, ULONG *pStatus)
{ {
Config_WriteNum (TEXT("TraceBufferSize"), nBufSize); Config_WriteGlobalNum (TEXT("TraceBufferSize"), nBufSize);
g.fNeedRestart = TRUE; g.fNeedRestart = TRUE;
return TRUE; return TRUE;
} }
void Config_GetLoginRetryInterval (ULONG *pnInterval) void Config_GetLoginRetryInterval (ULONG *pnInterval)
{ {
if (!Config_ReadNum (TEXT("LoginRetryInterval"), (DWORD*)pnInterval)) if (!Config_ReadGlobalNum (TEXT("LoginRetryInterval"), (DWORD*)pnInterval))
*pnInterval = 30; *pnInterval = 30;
} }
BOOL Config_SetLoginRetryInterval (ULONG nInterval, ULONG *pStatus) BOOL Config_SetLoginRetryInterval (ULONG nInterval, ULONG *pStatus)
{ {
Config_WriteNum (TEXT("LoginRetryInterval"), nInterval); Config_WriteGlobalNum (TEXT("LoginRetryInterval"), nInterval);
return TRUE; return TRUE;
} }
void Config_GetFailLoginsSilently (BOOL *pfFlag) void Config_GetFailLoginsSilently (BOOL *pfFlag)
{ {
if (!Config_ReadNum (TEXT("FailLoginsSilently"), (DWORD*)pfFlag)) if (!Config_ReadGlobalNum (TEXT("FailLoginsSilently"), (DWORD*)pfFlag))
*pfFlag = FALSE; *pfFlag = FALSE;
} }
BOOL Config_SetFailLoginsSilently (BOOL fFlag, ULONG *pStatus) BOOL Config_SetFailLoginsSilently (BOOL fFlag, ULONG *pStatus)
{ {
Config_WriteNum (TEXT("FailLoginsSilently"), fFlag); Config_WriteGlobalNum (TEXT("FailLoginsSilently"), fFlag);
return TRUE; return TRUE;
} }
void Config_GetReportSessionStartups (BOOL *pfFlag) void Config_GetReportSessionStartups (BOOL *pfFlag)
{ {
if (!Config_ReadNum (TEXT("ReportSessionStartups"), (DWORD*)pfFlag)) if (!Config_ReadGlobalNum (TEXT("ReportSessionStartups"), (DWORD*)pfFlag))
*pfFlag = FALSE; *pfFlag = FALSE;
} }
BOOL Config_SetReportSessionStartups (BOOL fFlag, ULONG *pStatus) BOOL Config_SetReportSessionStartups (BOOL fFlag, ULONG *pStatus)
{ {
Config_WriteNum (TEXT("ReportSessionStartups"), fFlag); Config_WriteGlobalNum (TEXT("ReportSessionStartups"), fFlag);
return TRUE; return TRUE;
} }

View File

@ -115,10 +115,15 @@ BOOL Config_SetReportSessionStartups (BOOL fFlag, ULONG *pStatus = NULL);
void Config_GetGlobalDriveList (DRIVEMAPLIST *pDriveList); void Config_GetGlobalDriveList (DRIVEMAPLIST *pDriveList);
BOOL Config_ReadNum (LPCTSTR pszLHS, DWORD *pdwRHS); BOOL Config_ReadGlobalNum (LPCTSTR pszLHS, DWORD *pdwRHS);
BOOL Config_ReadString (LPCTSTR pszLHS, LPTSTR pszRHS, size_t cchMax); BOOL Config_ReadGlobalString (LPCTSTR pszLHS, LPTSTR pszRHS, size_t cchMax);
void Config_WriteNum (LPCTSTR pszLHS, DWORD dwRHS); void Config_WriteGlobalNum (LPCTSTR pszLHS, DWORD dwRHS);
void Config_WriteString (LPCTSTR pszLHS, LPCTSTR pszRHS); void Config_WriteGlobalString (LPCTSTR pszLHS, LPCTSTR pszRHS);
BOOL Config_ReadUserNum (LPCTSTR pszLHS, DWORD *pdwRHS);
BOOL Config_ReadUserString (LPCTSTR pszLHS, LPTSTR pszRHS, size_t cchMax);
void Config_WriteUserNum (LPCTSTR pszLHS, DWORD dwRHS);
void Config_WriteUserString (LPCTSTR pszLHS, LPCTSTR pszRHS);
#endif #endif

View File

@ -218,7 +218,7 @@ BOOL UpdateRegistry(DRIVEMAP *pDrive, BOOL bRemove)
if (!pDrive) if (!pDrive)
return FALSE; return FALSE;
_stprintf(szKeyName, TEXT("%s\\GlobalAutoMapper"), AFSConfigKeyName); _stprintf(szKeyName, TEXT("%s\\GlobalAutoMapper"), AFSDConfigKeyName);
if (RegCreateKeyEx(HKEY_LOCAL_MACHINE, szKeyName, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_SET_VALUE, NULL, &hKey, &dwDispo) != ERROR_SUCCESS) if (RegCreateKeyEx(HKEY_LOCAL_MACHINE, szKeyName, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_SET_VALUE, NULL, &hKey, &dwDispo) != ERROR_SUCCESS)
return FALSE; return FALSE;

View File

@ -26,8 +26,6 @@ extern "C" {
#include <lanahelper.h> #include <lanahelper.h>
extern void Config_GetLanAdapter (ULONG *pnLanAdapter); extern void Config_GetLanAdapter (ULONG *pnLanAdapter);
extern BOOL Config_ReadNum (LPCTSTR pszLHS, DWORD *pdwRHS);
extern BOOL Config_ReadString (LPCTSTR pszLHS, LPTSTR pszRHS, size_t cchMax);
/* /*
* REGISTRY ___________________________________________________________________ * REGISTRY ___________________________________________________________________