mirror of
https://git.openafs.org/openafs.git
synced 2025-01-20 16:00:12 +00:00
STABLE14-expand-drive-mappings-20040823
Drive mappings are now per user and stored in the registry. Allow
them to continue to use environment variables in the paths.
(cherry picked from commit bca5ba20e6
)
This commit is contained in:
parent
48fba74eb7
commit
8f070161dd
@ -447,7 +447,7 @@ void QueryDriveMapList_ReadMappings (PDRIVEMAPLIST pList)
|
|||||||
{
|
{
|
||||||
HKEY hkMappings;
|
HKEY hkMappings;
|
||||||
RegCreateKeyEx( HKEY_CURRENT_USER,
|
RegCreateKeyEx( HKEY_CURRENT_USER,
|
||||||
"SOFTWARE\\OpenAFS\\Client\\Mappings",
|
cszSECTION_MAPPINGS,
|
||||||
0,
|
0,
|
||||||
"AFS",
|
"AFS",
|
||||||
REG_OPTION_NON_VOLATILE,
|
REG_OPTION_NON_VOLATILE,
|
||||||
@ -480,13 +480,20 @@ void QueryDriveMapList_ReadMappings (PDRIVEMAPLIST pList)
|
|||||||
|
|
||||||
RegEnumValue( hkMappings, dwIndex, drive, &driveLen, NULL,
|
RegEnumValue( hkMappings, dwIndex, drive, &driveLen, NULL,
|
||||||
&dwType, (LPBYTE)mapping, &mappingLen);
|
&dwType, (LPBYTE)mapping, &mappingLen);
|
||||||
|
if ( dwType == REG_EXPAND_SZ ) {
|
||||||
|
TCHAR buf[MAX_PATH];
|
||||||
|
DWORD dummyLen = ExpandEnvironmentStrings(buf, mapping, MAX_PATH);
|
||||||
|
if (dummyLen > MAX_PATH)
|
||||||
|
continue;
|
||||||
|
_tcsncpy(mapping, buf, MAX_PATH);
|
||||||
|
}
|
||||||
|
|
||||||
DRIVEMAP DriveMap;
|
DRIVEMAP DriveMap;
|
||||||
memset (&DriveMap, 0x00, sizeof(DRIVEMAP));
|
memset (&DriveMap, 0x00, sizeof(DRIVEMAP));
|
||||||
DriveMap.chDrive = toupper(*drive);
|
DriveMap.chDrive = toupper(*drive);
|
||||||
DriveMap.fPersistent = TRUE;
|
DriveMap.fPersistent = TRUE;
|
||||||
if ((DriveMap.chDrive < chDRIVE_A) || (DriveMap.chDrive > chDRIVE_Z))
|
if ((DriveMap.chDrive < chDRIVE_A) || (DriveMap.chDrive > chDRIVE_Z))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (mapping[0] != TEXT('\0'))
|
if (mapping[0] != TEXT('\0'))
|
||||||
{
|
{
|
||||||
@ -541,7 +548,7 @@ void WriteDriveMappings (PDRIVEMAPLIST pList)
|
|||||||
{
|
{
|
||||||
HKEY hkMappings;
|
HKEY hkMappings;
|
||||||
RegCreateKeyEx( HKEY_CURRENT_USER,
|
RegCreateKeyEx( HKEY_CURRENT_USER,
|
||||||
"SOFTWARE\\OpenAFS\\Client\\Mappings",
|
cszSECTION_MAPPINGS,
|
||||||
0,
|
0,
|
||||||
"AFS",
|
"AFS",
|
||||||
REG_OPTION_NON_VOLATILE,
|
REG_OPTION_NON_VOLATILE,
|
||||||
@ -587,7 +594,7 @@ void WriteDriveMappings (PDRIVEMAPLIST pList)
|
|||||||
if (!pList->aDriveMap[iDrive].fPersistent)
|
if (!pList->aDriveMap[iDrive].fPersistent)
|
||||||
lstrcat (szRHS, TEXT("*"));
|
lstrcat (szRHS, TEXT("*"));
|
||||||
|
|
||||||
RegSetValueEx( hkMappings, szLHS, 0, REG_SZ, (const BYTE *)szRHS, lstrlen(szRHS) + 1);
|
RegSetValueEx( hkMappings, szLHS, 0, REG_EXPAND_SZ, (const BYTE *)szRHS, lstrlen(szRHS) + 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
RegCloseKey( hkMappings );
|
RegCloseKey( hkMappings );
|
||||||
|
Loading…
Reference in New Issue
Block a user