TARGETDIR"\\Common\\*.gid\0"
TARGETDIR"\\Common\\*.fts\0"
WINDIR"\\..\\AFSCache\0"
- WINDIR"\\afsd.log\0"
- WINDIR"\\afsd.ini\0"
- WINDIR"\\afsdsbmt.ini\0"
- WINDIR"\\afsdcell.ini\0"
- WINDIR"\\afsd_init.log\0",
+ WINDIR"\\TEMP\\afsd.log\0"
+ TARGETDIR"\\Client\\afsd.ini\0"
+ TARGETDIR"\\Client\\afsdsbmt.ini\0"
+ TARGETDIR"\\Client\\afsdcell.ini\0"
+ WINDIR"\\TEMP\\afsd_init.log\0",
clientRegValues,
clientWinNTRegValues,
}
}
- sprintf(filePath, "%s\\%s", winPath, "afsd.log");
+ sprintf(filePath, "%s\\%s", winPath, "temp\\afsd.log");
status = FileForceRemove(filePath);
if (status != ERROR_SUCCESS && status != ERROR_FILE_NOT_FOUND) {
rc = status;
}
- sprintf(filePath, "%s\\%s", winPath, "afsd_init.log");
+ sprintf(filePath, "%s\\%s", winPath, "temp\\afsd_init.log");
status = FileForceRemove(filePath);
if (status != ERROR_SUCCESS && status != ERROR_FILE_NOT_FOUND) {
rc = status;
}
if (!keepConfig) {
- sprintf(filePath, "%s\\%s", winPath, "afsdcell.ini");
+ sprintf(filePath, "%s\\%s", installPath, "Client\\afsdcell.ini");
status = FileForceRemove(filePath);
if (status != ERROR_SUCCESS && status != ERROR_FILE_NOT_FOUND) {
rc = status;
}
- sprintf(filePath, "%s\\%s", winPath, "afsdsbmt.ini");
+ sprintf(filePath, "%s\\%s", installPath, "Client\\afsdsbmt.ini");
status = FileForceRemove(filePath);
if (status != ERROR_SUCCESS && status != ERROR_FILE_NOT_FOUND) {
rc = status;
}
- sprintf(filePath, "%s\\%s", winPath, "afsd.ini");
+ sprintf(filePath, "%s\\%s", installPath, "Client\\afsd.ini");
status = FileForceRemove(filePath);
if (status != ERROR_SUCCESS && status != ERROR_FILE_NOT_FOUND) {
rc = status;
#include <windows.h>
#include <stdio.h>
+int
main(int argc, char **argv) {
BOOL res;
+ HKEY hkSubmounts;
+
if (argc < 2 || argc > 3) {
- fprintf(stderr, "Incorrect arguments\n");
- exit(1);
+ fprintf(stderr, "Incorrect arguments\n");
+ exit(1);
}
- res = WritePrivateProfileString("AFS Submounts",
- argv[1],
- (argc == 3) ? argv[2] : NULL,
- "afsdsbmt.ini");
- if (res == FALSE)
- fprintf(stderr, "Failed, error code %d\n", GetLastError());
+ if (RegCreateKeyEx( HKEY_LOCAL_MACHINE,
+ "SOFTWARE\\OpenAFS\\Client\\Submounts",
+ 0,
+ NULL,
+ REG_OPTION_NON_VOLATILE,
+ KEY_READ|KEY_WRITE,
+ NULL,
+ &hkSubmounts,
+ NULL) == ERROR_SUCCESS)
+ {
+ if ( argc == 2 ) {
+ if (RegDeleteValue(hkSubmounts, argv[1])) {
+ fprintf(stderr,"Submount Deletion failure for [%s]: %lX",
+ argv[1], GetLastError());
+ return 1;
+ }
+ } else {
+ if (RegSetValueEx(hkSubmounts, argv[1], 0, REG_SZ, argv[2], strlen(argv[2]+1))) {
+ fprintf(stderr,"Submount Set failure for [%s]: %lX",
+ argv[1], GetLastError());
+ return 2;
+ }
+ }
+ RegCloseKey(hkSubmounts);
+ } else {
+ fprintf(stderr,"Submount access denied: %lX", GetLastError());
+ return 3;
+ }
return 0;
}
#include <string.h>
#include "cm_config.h"
+#include <WINNT\afssw.h>
#ifdef AFS_AFSDB_ENV
#include "cm_dns.h"
#include <afs/afsint.h>
"SYSTEM\\CurrentControlSet\\Services\\TransarcAFSDaemon\\Parameters";
/* TODO: these should be pulled in from dirpath.h */
+#if !defined(DJGPP) && !defined(AFS_WIN95_ENV)
#define AFS_THISCELL "ThisCell"
+#endif
#define AFS_CELLSERVDB_UNIX "CellServDB"
#define AFS_CELLSERVDB_NT "afsdcell.ini"
#ifndef AFSDIR_CLIENT_ETC_DIRPATH
extern int errno;
#endif /* DJGPP */
#else
-#define AFS_CELLSERVDB AFS_CELLSERVDB_NT
+#define AFS_CELLSERVDB AFS_CELLSERVDB_UNIX
#endif /* DJGPP || WIN95 */
#ifdef DEBUG
#if defined(DJGPP) || defined(AFS_WIN95_ENV)
char *afsconf_path;
#endif
-#if !defined(DJGPP)
- HKEY hkClient;
- PBYTE pFilename;
- DWORD dwType, dwSize;
-#endif
#if !defined(DJGPP)
- /* First attempt to find the CellServDB file via the registry */
- if (RegCreateKeyEx( HKEY_LOCAL_MACHINE,
- "SOFTWARE\\OpenAFS\\Client",
- 0,
- NULL,
- REG_OPTION_NON_VOLATILE,
- KEY_READ|KEY_WRITE,
- NULL,
- &hkClient,
- NULL) == ERROR_SUCCESS) {
- if (RegQueryValueEx( hkClient, "CellServDB", 0, &dwType, NULL, &dwSize) == ERROR_SUCCESS) {
- pFilename = malloc(dwSize);
- RegQueryValueEx( hkClient, "CellServDB", 0, &dwType, pFilename, &dwSize);
- tfilep = fopen(pFilename, "r");
- }
- RegCloseKey(hkClient);
- }
-#endif
-
- /* If not found, fallback to old behavior */
- if (!tfilep) {
-#if !defined(DJGPP)
- code = GetWindowsDirectory(wdir, sizeof(wdir));
- if (code == 0 || code > sizeof(wdir))
- return -1;
+ strcpy(wdir, AFSDIR_CLIENT_ETC_DIRPATH);
- /* add trailing backslash, if required */
- tlen = strlen(wdir);
- if (wdir[tlen-1] != '\\') strcat(wdir, "\\");
+ /* add trailing backslash, if required */
+ tlen = strlen(wdir);
+ if (wdir[tlen-1] != '\\') strcat(wdir, "\\");
#else
- strcpy(wdir, cm_confDir);
- strcat(wdir,"/");
+ strcpy(wdir, cm_confDir);
+ strcat(wdir,"/");
#endif /* !DJGPP */
- strcat(wdir, AFS_CELLSERVDB);
- tfilep = fopen(wdir, "r");
- }
+ strcat(wdir, AFS_CELLSERVDB);
+ tfilep = fopen(wdir, "r");
#if defined(DJGPP) || defined(AFS_WIN95_ENV)
if (!tfilep) {
else
strcpy(wdir, afsconf_path);
strcat(wdir, "/");
- strcat(wdir, AFS_CELLSERVDB_UNIX);
+ strcat(wdir, AFS_CELLSERVDB);
/*fprintf(stderr, "opening cellservdb file %s\n", wdir);*/
tfilep = fopen(wdir, "r");
if (!tfilep) return -2;
FILE *tfilep;
#if !defined(DJGPP) && !defined(AFS_WIN95_ENV)
- code = GetWindowsDirectory(wdir, sizeof(wdir));
- if (code == 0 || code > sizeof(wdir))
- return 0;
+ strcpy(wdir, AFSDIR_CLIENT_ETC_DIRPATH);
/* add trailing backslash, if required */
tlen = strlen(wdir);
closeCode = fclose((FILE *)filep);
#if !defined(DJGPP) && !defined(AFS_WIN95_ENV)
- code = GetWindowsDirectory(wdir, sizeof(wdir));
- if (code == 0 || code > sizeof(wdir))
- return closeCode;
+ strcpy(wdir, AFSDIR_CLIENT_ETC_DIRPATH);
/* add trailing backslash, if required */
- tlen = strlen(wdir);
- if (wdir[tlen-1] != '\\') strcat(wdir, "\\");
+ tlen = strlen(wdir);
+ if (wdir[tlen-1] != '\\') strcat(wdir, "\\");
#else
#ifdef DJGPP
- strcpy(wdir,cm_confDir);
+ strcpy(wdir,cm_confDir);
#else
- afsconf_path = getenv("AFSCONF");
- if (!afsconf_path)
- strcpy(wdir, AFSDIR_CLIENT_ETC_DIRPATH);
- else
- strcpy(wdir, afsconf_path);
+ afsconf_path = getenv("AFSCONF");
+ if (!afsconf_path)
+ strcpy(wdir, AFSDIR_CLIENT_ETC_DIRPATH);
+ else
+ strcpy(wdir, afsconf_path);
#endif /* !DJGPP */
- strcat(wdir,"/");
+ strcat(wdir,"/");
#endif /* DJGPP || WIN95 */
- strcpy(sdir, wdir);
+ strcpy(sdir, wdir);
if (closeCode != 0) {
/* something went wrong, preserve original database */
- strcat(wdir, "afsdcel2.ini");
- unlink(wdir);
- return closeCode;
- }
+ strcat(wdir, "afsdcel2.ini");
+ unlink(wdir);
+ return closeCode;
+ }
- strcat(wdir, AFS_CELLSERVDB);
- strcat(sdir, "afsdcel2.ini"); /* new file */
-
- unlink(wdir); /* delete old file */
-
- code = rename(sdir, wdir); /* do the rename */
-
- if (code)
- code = errno;
-
- return code;
-}
+ strcat(wdir, AFS_CELLSERVDB);
+ strcat(sdir, "afsdcel2.ini"); /* new file */
+
+ unlink(wdir); /* delete old file */
+
+ code = rename(sdir, wdir); /* do the rename */
+
+ if (code)
+ code = errno;
+
+ return code;
+}
void cm_GetConfigDir(char *dir)
{
#endif
#if !defined(DJGPP) && !defined(AFS_WIN95_ENV)
- code = GetWindowsDirectory(wdir, sizeof(wdir));
- if (code == 0 || code > sizeof(wdir)) wdir[0] = 0;
+ strcpy(wdir, AFSDIR_CLIENT_ETC_DIRPATH);
/* add trailing backslash, if required */
tlen = strlen(wdir);
char afspath[MAX_PATH];
char *submountreqp;
int iteration;
- int submountDataSize;
- char *submountData;
- char *submountName;
int nextAutoSubmount;
+ HKEY hkSubmounts;
+ DWORD dwType, dwSize;
+ DWORD status;
+ DWORD dwIndex;
+ DWORD dwSubmounts;
cm_SkipIoctlPath(ioctlp);
* that submount name is in use... if so, the submount's path
* has to match our path.
*/
- if (submountreqp && *submountreqp) {
+
+ RegCreateKeyEx( HKEY_LOCAL_MACHINE,
+ "SOFTWARE\\OpenAFS\\Client\\Submounts",
+ 0,
+ "AFS",
+ REG_OPTION_NON_VOLATILE,
+ KEY_READ|KEY_WRITE|KEY_QUERY_VALUE,
+ NULL,
+ &hkSubmounts,
+ NULL );
+
+ if (submountreqp && *submountreqp) {
char submountPathNormalized[MAX_PATH];
char submountPath[MAX_PATH];
int submountPathLen;
- submountPathLen = GetPrivateProfileString("AFS Submounts",
- submountreqp, "", submountPath,
- sizeof(submountPath), "afsdsbmt.ini");
+ dwSize = sizeof(submountPath);
+ status = RegQueryValueEx( hkSubmounts, submountreqp, 0,
+ &dwType, submountPath, &dwSize);
- if ((submountPathLen == 0) ||
- (submountPathLen == sizeof(submountPath) - 1)) {
+ if (status != ERROR_SUCCESS) {
/* The suggested submount name isn't in use now--
* so we can safely map the requested submount name
* to the supplied path. Remember not to write the
* leading "/afs" when writing out the submount.
*/
- WritePrivateProfileString("AFS Submounts",
- submountreqp,
- (strlen(&afspath[strlen(cm_mountRoot)])) ?
- &afspath[strlen(cm_mountRoot)]:"/",
- "afsdsbmt.ini");
-
+ RegSetValueEx( hkSubmounts, submountreqp, 0,
+ REG_SZ,
+ (strlen(&afspath[strlen(cm_mountRoot)])) ?
+ &afspath[strlen(cm_mountRoot)]:"/",
+ (strlen(&afspath[strlen(cm_mountRoot)])) ?
+ strlen(&afspath[strlen(cm_mountRoot)])+1:2);
+
+ RegCloseKey( hkSubmounts );
strcpy(ioctlp->outDatap, submountreqp);
ioctlp->outDatap += strlen(ioctlp->outDatap) +1;
lock_ReleaseMutex(&cm_Afsdsbmt_Lock);
- return 0;
+ return 0;
}
/* The suggested submount name is already in use--if the
if (!strcmp (submountPathNormalized, afspath)) {
strcpy(ioctlp->outDatap, submountreqp);
ioctlp->outDatap += strlen(ioctlp->outDatap) +1;
+ RegCloseKey( hkSubmounts );
lock_ReleaseMutex(&cm_Afsdsbmt_Lock);
- return 0;
+ return 0;
}
}
- /* At this point, the user either didn't request a particular
- * submount name, or that submount name couldn't be used.
- * Look through afsdsbmt.ini to see if there are any submounts
- * already associated with the specified path. The first
- * step in doing that search is to load the AFS Submounts
- * section of afsdsbmt.ini into memory.
- */
+ RegQueryInfoKey( hkSubmounts,
+ NULL, /* lpClass */
+ NULL, /* lpcClass */
+ NULL, /* lpReserved */
+ NULL, /* lpcSubKeys */
+ NULL, /* lpcMaxSubKeyLen */
+ NULL, /* lpcMaxClassLen */
+ &dwSubmounts, /* lpcValues */
+ NULL, /* lpcMaxValueNameLen */
+ NULL, /* lpcMaxValueLen */
+ NULL, /* lpcbSecurityDescriptor */
+ NULL /* lpftLastWriteTime */
+ );
- submountDataSize = 1024;
- submountData = malloc (submountDataSize);
-
- for (iteration = 0; iteration < 5; ++iteration) {
-
- int sectionSize;
- sectionSize = GetPrivateProfileString("AFS Submounts",
- NULL, "", submountData,
- submountDataSize, "afsdsbmt.ini");
- if (sectionSize < submountDataSize-2)
- break;
-
- free (submountData);
- submountDataSize *= 2;
- submountData = malloc (submountDataSize);
- }
/* Having obtained a list of all available submounts, start
* searching that list for a path which matches the requested
nextAutoSubmount = 1;
- for (submountName = submountData;
- submountName && *submountName;
- submountName += 1+strlen(submountName)) {
-
+ for ( dwIndex = 0; dwIndex < dwSubmounts; dwIndex ++ ) {
char submountPathNormalized[MAX_PATH];
char submountPath[MAX_PATH] = "";
- int submountPathLen;
+ DWORD submountPathLen = sizeof(submountPath);
+ char submountName[256];
+ DWORD submountNameLen = sizeof(submountName);
+
+ RegEnumValue( hkSubmounts, dwIndex, submountName, &submountNameLen, NULL,
+ &dwType, submountPath, &submountPathLen);
/* If this is an Auto### submount, remember its ### value */
thisAutoSubmount+1);
}
- /* We have the name of a submount in the AFS Submounts
- * section; read that entry to find out what path it
- * maps to.
- */
- submountPathLen = GetPrivateProfileString("AFS Submounts",
- submountName, "", submountPath,
- sizeof(submountPath), "afsdsbmt.ini");
-
if ((submountPathLen == 0) ||
(submountPathLen == sizeof(submountPath) - 1)) {
continue;
*/
cm_NormalizeAfsPath (submountPathNormalized, submountPath);
if (!strcmp (submountPathNormalized, afspath)) {
-
strcpy(ioctlp->outDatap, submountName);
ioctlp->outDatap += strlen(ioctlp->outDatap) +1;
- free (submountData);
+ RegCloseKey(hkSubmounts);
lock_ReleaseMutex(&cm_Afsdsbmt_Lock);
- return 0;
+ return 0;
}
}
- free (submountData);
-
/* We've been through the entire list of existing submounts, and
* didn't find any which matched the specified path. So, we'll
* just have to add one. Remember not to write the leading "/afs"
sprintf(ioctlp->outDatap, "auto%ld", nextAutoSubmount);
- WritePrivateProfileString("AFS Submounts", ioctlp->outDatap,
- (strlen(&afspath[lstrlen(cm_mountRoot)])) ?
- &afspath[lstrlen(cm_mountRoot)]:"/",
- "afsdsbmt.ini");
+ RegSetValueEx( hkSubmounts,
+ ioctlp->outDatap,
+ 0,
+ REG_SZ,
+ (strlen(&afspath[strlen(cm_mountRoot)])) ?
+ &afspath[strlen(cm_mountRoot)]:"/",
+ (strlen(&afspath[strlen(cm_mountRoot)])) ?
+ strlen(&afspath[strlen(cm_mountRoot)])+1:2);
ioctlp->outDatap += strlen(ioctlp->outDatap) +1;
+ RegCloseKey(hkSubmounts);
lock_ReleaseMutex(&cm_Afsdsbmt_Lock);
return 0;
}
{
struct cmd_item *ti;
char *share = NULL;
- char sbmtpath[256];
- char *policy;
-
+ HKEY hkCSCPolicy;
+
for(ti=asp->parms[0].items; ti;ti=ti->next) {
share = ti->data;
if (share)
break;
}
}
-
+
if (share)
{
-#ifdef WIN32
- if ( !IsAdmin() ) {
+ char *policy;
+
+ RegCreateKeyEx( HKEY_LOCAL_MACHINE,
+ "SOFTWARE\\OpenAFS\\Client\\CSCPolicy",
+ 0,
+ "AFS",
+ REG_OPTION_NON_VOLATILE,
+ KEY_WRITE,
+ NULL,
+ &hkCSCPolicy,
+ NULL );
+
+ if ( !IsAdmin() || hkCSCPolicy == NULL ) {
fprintf (stderr,"Permission denied: requires Administrator access.\n");
+ if ( hkCSCPolicy )
+ RegCloseKey(hkCSCPolicy);
return EACCES;
}
-#else /* WIN32 */
- if (geteuid()) {
- fprintf (stderr,"Permission denied: requires root access.\n");
- return EACCES;
- }
-#endif /* WIN32 */
policy = "manual";
if (asp->parms[4].items)
policy = "disable";
- strcpy(sbmtpath, "afsdsbmt.ini");
- WritePrivateProfileString("CSC Policy", share, policy, sbmtpath);
+ RegSetValueEx( hkCSCPolicy, share, 0, REG_SZ, policy, strlen(policy)+1);
printf("CSC policy on share \"%s\" changed to \"%s\".\n\n", share, policy);
printf("Close all applications that accessed files on this share or restart AFS Client for the change to take effect.\n");
}
else
{
- char policies[1024];
- DWORD len = sizeof(policies);
+ DWORD dwIndex, dwPolicies;
+ char policyName[256];
+ DWORD policyNameLen;
+ char policy[256];
+ DWORD policyLen;
+ DWORD dwType;
/* list current csc policies */
- strcpy(sbmtpath, "afsdsbmt.ini");
-
- GetPrivateProfileSection("CSC Policy", policies, len, sbmtpath);
+
+ RegCreateKeyEx( HKEY_LOCAL_MACHINE,
+ "SOFTWARE\\OpenAFS\\Client\\CSCPolicy",
+ 0,
+ "AFS",
+ REG_OPTION_NON_VOLATILE,
+ KEY_READ|KEY_QUERY_VALUE,
+ NULL,
+ &hkCSCPolicy,
+ NULL );
+
+ RegQueryInfoKey( hkCSCPolicy,
+ NULL, /* lpClass */
+ NULL, /* lpcClass */
+ NULL, /* lpReserved */
+ NULL, /* lpcSubKeys */
+ NULL, /* lpcMaxSubKeyLen */
+ NULL, /* lpcMaxClassLen */
+ &dwPolicies, /* lpcValues */
+ NULL, /* lpcMaxValueNameLen */
+ NULL, /* lpcMaxValueLen */
+ NULL, /* lpcbSecurityDescriptor */
+ NULL /* lpftLastWriteTime */
+ );
printf("Current CSC policies:\n");
- policy = policies;
- while (policy[0])
- {
- printf(" %s\n", policy);
- policy += strlen(policy) + 1;
+ for ( dwIndex = 0; dwIndex < dwPolicies; dwIndex ++ ) {
+
+ policyNameLen = sizeof(policyName);
+ policyLen = sizeof(policy);
+ RegEnumValue( hkCSCPolicy, dwIndex, policyName, &policyNameLen, NULL,
+ &dwType, policy, &policyLen);
+
+ printf(" %s = %s\n", policyName, policy);
}
}
+ RegCloseKey(hkCSCPolicy);
return (0);
}
{
DWORD len;
char policy[1024];
- char sbmtpath[256];
-
-#ifndef DJGPP
- strcpy(sbmtpath, "afsdsbmt.ini");
-#else /* DJGPP */
- strcpy(sbmtpath, cm_confDir);
- strcat(sbmtpath, "/afsdsbmt.ini");
-#endif /* !DJGPP */
- len = GetPrivateProfileString("CSC Policy", shareName, "",
- policy, sizeof(policy), sbmtpath);
- if (len == 0 || len == sizeof(policy) - 1) {
- return CSC_POLICY_MANUAL;
- }
-
- if (stricmp(policy, "documents") == 0)
+ DWORD dwType;
+ HKEY hkCSCPolicy;
+ int retval = CSC_POLICY_MANUAL;
+
+ RegCreateKeyEx( HKEY_LOCAL_MACHINE,
+ "SOFTWARE\\OpenAFS\\Client\\CSCPolicy",
+ 0,
+ "AFS",
+ REG_OPTION_NON_VOLATILE,
+ KEY_READ,
+ NULL,
+ &hkCSCPolicy,
+ NULL );
+
+ len = sizeof(policy);
+ if ( RegQueryValueEx( hkCSCPolicy, shareName, 0, &dwType, policy, &len ) ||
+ len == 0) {
+ retval = CSC_POLICY_MANUAL;
+ }
+ else if (stricmp(policy, "documents") == 0)
{
- return CSC_POLICY_DOCUMENTS;
+ retval = CSC_POLICY_DOCUMENTS;
}
-
- if (stricmp(policy, "programs") == 0)
+ else if (stricmp(policy, "programs") == 0)
{
- return CSC_POLICY_PROGRAMS;
+ retval = CSC_POLICY_PROGRAMS;
}
-
- if (stricmp(policy, "disable") == 0)
+ else if (stricmp(policy, "disable") == 0)
{
- return CSC_POLICY_DISABLE;
+ retval = CSC_POLICY_DISABLE;
}
- return CSC_POLICY_MANUAL;
+ RegCloseKey(hkCSCPolicy);
+ return retval;
}
/* find a dir search structure by cookie value, and return it held.
#define cREALLOC_SUBMOUNTS 4
-static TCHAR cszINIFILE[] = TEXT("afsdsbmt.ini");
-static TCHAR cszSECTION_SUBMOUNTS[] = TEXT("AFS Submounts");
-static TCHAR cszSECTION_MAPPINGS[] = TEXT("AFS Mappings");
-static TCHAR cszSECTION_ACTIVE[] = TEXT("AFS Active");
+static TCHAR cszSECTION_SUBMOUNTS[] = TEXT("SOFTWARE\\OpenAFS\\Client\\Submounts");
+static TCHAR cszSECTION_MAPPINGS[] = TEXT("SOFTWARE\\OpenAFS\\Client\\Mappings");
+static TCHAR cszSECTION_ACTIVE[] = TEXT("SOFTWARE\\OpenAFS\\Client\\Active Maps");
static TCHAR cszAUTOSUBMOUNT[] = TEXT("Auto");
static TCHAR cszLANMANDEVICE[] = TEXT("\\Device\\LanmanRedirector\\");
+static BOOL
+WriteRegistryString(HKEY key, TCHAR * subkey, LPTSTR lhs, LPTSTR rhs)
+{
+ HKEY hkSub = NULL;
+ RegCreateKeyEx( key,
+ subkey,
+ 0,
+ NULL,
+ REG_OPTION_NON_VOLATILE,
+ KEY_WRITE,
+ NULL,
+ &hkSub,
+ NULL);
+
+ DWORD status = RegSetValueEx( hkSub, lhs, 0, REG_SZ, (const BYTE *)rhs, strlen(rhs)+1 );
+
+ if ( hkSub )
+ RegCloseKey( hkSub );
+
+ return (status == ERROR_SUCCESS);
+}
+
+static BOOL
+ReadRegistryString(HKEY key, TCHAR * subkey, LPTSTR lhs, LPTSTR rhs, DWORD * size)
+{
+ HKEY hkSub = NULL;
+ RegCreateKeyEx( key,
+ subkey,
+ 0,
+ NULL,
+ REG_OPTION_NON_VOLATILE,
+ KEY_READ,
+ NULL,
+ &hkSub,
+ NULL);
+
+ DWORD dwType;
+ DWORD status = RegQueryValueEx( hkSub, lhs, 0, &dwType, (LPBYTE)rhs, size );
+
+ if ( hkSub )
+ RegCloseKey( hkSub );
+
+ return (status == ERROR_SUCCESS);
+}
+
+static BOOL
+DeleteRegistryString(HKEY key, TCHAR * subkey, LPTSTR lhs)
+{
+ HKEY hkSub = NULL;
+ RegCreateKeyEx( key,
+ subkey,
+ 0,
+ NULL,
+ REG_OPTION_NON_VOLATILE,
+ KEY_READ,
+ NULL,
+ &hkSub,
+ NULL);
+
+ DWORD dwType;
+ DWORD status = RegDeleteValue( hkSub, lhs );
+
+ if ( hkSub )
+ RegCloseKey( hkSub );
+
+ return (status == ERROR_SUCCESS);
+}
+
/*
* STRINGS ____________________________________________________________________
*
void QueryDriveMapList_ReadSubmounts (PDRIVEMAPLIST pList)
{
- if (IsWindowsNT())
- {
- size_t cchLHS = 1024;
- LPTSTR mszLHS = AllocateStringMemory (cchLHS);
-
- for (int iRetry = 0; iRetry < 5; ++iRetry)
- {
- DWORD rc = GetPrivateProfileString (cszSECTION_SUBMOUNTS, NULL, TEXT(""), mszLHS, cchLHS, cszINIFILE);
- if ((rc != cchLHS-1) && (rc != cchLHS-2))
- break;
-
- FreeStringMemory (mszLHS);
- cchLHS *= 2;
- mszLHS = AllocateStringMemory (cchLHS);
- }
-
- for (LPTSTR psz = mszLHS; psz && *psz; psz += 1+lstrlen(psz))
- {
- SUBMOUNT Submount;
- memset (&Submount, 0x00, sizeof(SUBMOUNT));
- lstrcpy (Submount.szSubmount, psz);
-
- TCHAR szMapping[ MAX_PATH ] = TEXT("");
- GetPrivateProfileString (cszSECTION_SUBMOUNTS, Submount.szSubmount, TEXT(""), szMapping, MAX_PATH, cszINIFILE);
- if (szMapping[0] != TEXT('\0'))
- {
- AdjustAfsPath (Submount.szMapping, szMapping, FALSE, TRUE);
-
- for (size_t ii = 0; ii < pList->cSubmounts; ++ii)
- {
- if (!pList->aSubmounts[ii].szSubmount[0])
- break;
- }
- if (REALLOC (pList->aSubmounts, pList->cSubmounts, 1+ii, cREALLOC_SUBMOUNTS))
- {
- memcpy (&pList->aSubmounts[ii], &Submount, sizeof(SUBMOUNT));
- }
+ if (IsWindowsNT())
+ {
+ HKEY hkSubmounts;
+
+ RegCreateKeyEx( HKEY_LOCAL_MACHINE,
+ "SOFTWARE\\OpenAFS\\Client\\Submounts",
+ 0,
+ "AFS",
+ REG_OPTION_NON_VOLATILE,
+ KEY_READ|KEY_QUERY_VALUE,
+ NULL,
+ &hkSubmounts,
+ NULL );
+
+ DWORD dwSubmounts;
+ RegQueryInfoKey( hkSubmounts,
+ NULL, /* lpClass */
+ NULL, /* lpcClass */
+ NULL, /* lpReserved */
+ NULL, /* lpcSubKeys */
+ NULL, /* lpcMaxSubKeyLen */
+ NULL, /* lpcMaxClassLen */
+ &dwSubmounts, /* lpcValues */
+ NULL, /* lpcMaxValueNameLen */
+ NULL, /* lpcMaxValueLen */
+ NULL, /* lpcbSecurityDescriptor */
+ NULL /* lpftLastWriteTime */
+ );
+
+ for ( DWORD dwIndex = 0; dwIndex < dwSubmounts; dwIndex ++ ) {
+ TCHAR submountPath[MAX_PATH] = "";
+ DWORD submountPathLen = MAX_PATH;
+ TCHAR submountName[MAX_PATH];
+ DWORD submountNameLen = MAX_PATH;
+ DWORD dwType;
+
+ RegEnumValue( hkSubmounts, dwIndex, submountName, &submountNameLen, NULL,
+ &dwType, (LPBYTE)submountPath, &submountPathLen);
+
+ SUBMOUNT Submount;
+ memset (&Submount, 0x00, sizeof(SUBMOUNT));
+ lstrcpy (Submount.szSubmount, submountName);
+
+ if ( submountPath[0] != TEXT('\0') ) {
+ AdjustAfsPath (Submount.szMapping, submountPath, FALSE, TRUE);
+
+ for (size_t ii = 0; ii < pList->cSubmounts; ++ii)
+ {
+ if (!pList->aSubmounts[ii].szSubmount[0])
+ break;
+ }
+ if (REALLOC (pList->aSubmounts, pList->cSubmounts, 1+ii, cREALLOC_SUBMOUNTS))
+ {
+ memcpy (&pList->aSubmounts[ii], &Submount, sizeof(SUBMOUNT));
+ }
}
- }
- FreeStringMemory (mszLHS);
- }
+ }
+ RegCloseKey(hkSubmounts);
+ }
}
void QueryDriveMapList_ReadMappings (PDRIVEMAPLIST pList)
{
- size_t cchLHS = 1024;
- LPTSTR mszLHS = AllocateStringMemory (cchLHS);
-
- for (int iRetry = 0; iRetry < 5; ++iRetry)
- {
- DWORD rc = GetPrivateProfileString (cszSECTION_MAPPINGS, NULL, TEXT(""), mszLHS, cchLHS, cszINIFILE);
- if ((rc != cchLHS-1) && (rc != cchLHS-2))
- break;
-
- FreeStringMemory (mszLHS);
- cchLHS *= 2;
- mszLHS = AllocateStringMemory (cchLHS);
- }
-
- for (LPTSTR psz = mszLHS; psz && *psz; psz += 1+lstrlen(psz))
- {
- DRIVEMAP DriveMap;
- memset (&DriveMap, 0x00, sizeof(DRIVEMAP));
- DriveMap.chDrive = toupper(*psz);
- DriveMap.fPersistent = TRUE;
- if ((DriveMap.chDrive < chDRIVE_A) || (DriveMap.chDrive > chDRIVE_Z))
- continue;
-
- TCHAR szMapping[ MAX_PATH ] = TEXT("");
- GetPrivateProfileString (cszSECTION_MAPPINGS, psz, TEXT(""), szMapping, MAX_PATH, cszINIFILE);
- if (szMapping[0] != TEXT('\0'))
- {
- AdjustAfsPath (DriveMap.szMapping, szMapping, TRUE, TRUE);
- if (DriveMap.szMapping[ lstrlen(DriveMap.szMapping)-1 ] == TEXT('*'))
- {
- DriveMap.fPersistent = FALSE;
- DriveMap.szMapping[ lstrlen(DriveMap.szMapping)-1 ] = TEXT('\0');
- }
- size_t iDrive = DriveMap.chDrive - chDRIVE_A;
- memcpy (&pList->aDriveMap[ iDrive ], &DriveMap, sizeof(DRIVEMAP));
- }
- }
+ HKEY hkMappings;
+ RegCreateKeyEx( HKEY_CURRENT_USER,
+ "SOFTWARE\\OpenAFS\\Client\\Mappings",
+ 0,
+ "AFS",
+ REG_OPTION_NON_VOLATILE,
+ KEY_READ|KEY_QUERY_VALUE,
+ NULL,
+ &hkMappings,
+ NULL );
+
+ DWORD dwMappings;
+ RegQueryInfoKey( hkMappings,
+ NULL, /* lpClass */
+ NULL, /* lpcClass */
+ NULL, /* lpReserved */
+ NULL, /* lpcSubKeys */
+ NULL, /* lpcMaxSubKeyLen */
+ NULL, /* lpcMaxClassLen */
+ &dwMappings, /* lpcValues */
+ NULL, /* lpcMaxValueNameLen */
+ NULL, /* lpcMaxValueLen */
+ NULL, /* lpcbSecurityDescriptor */
+ NULL /* lpftLastWriteTime */
+ );
+
+ for ( DWORD dwIndex = 0; dwIndex < dwMappings; dwIndex ++ ) {
+ TCHAR mapping[MAX_PATH] = "";
+ DWORD mappingLen = MAX_PATH;
+ TCHAR drive[MAX_PATH];
+ DWORD driveLen = MAX_PATH;
+ DWORD dwType;
+
+ RegEnumValue( hkMappings, dwIndex, drive, &driveLen, NULL,
+ &dwType, (LPBYTE)mapping, &mappingLen);
+
+ DRIVEMAP DriveMap;
+ memset (&DriveMap, 0x00, sizeof(DRIVEMAP));
+ DriveMap.chDrive = toupper(*drive);
+ DriveMap.fPersistent = TRUE;
+ if ((DriveMap.chDrive < chDRIVE_A) || (DriveMap.chDrive > chDRIVE_Z))
+ continue;
+
+ if (mapping[0] != TEXT('\0'))
+ {
+ AdjustAfsPath (DriveMap.szMapping, mapping, TRUE, TRUE);
+ if (DriveMap.szMapping[ lstrlen(DriveMap.szMapping)-1 ] == TEXT('*'))
+ {
+ DriveMap.fPersistent = FALSE;
+ DriveMap.szMapping[ lstrlen(DriveMap.szMapping)-1 ] = TEXT('\0');
+ }
+ size_t iDrive = DriveMap.chDrive - chDRIVE_A;
+ memcpy (&pList->aDriveMap[ iDrive ], &DriveMap, sizeof(DRIVEMAP));
+ }
+ }
- FreeStringMemory (mszLHS);
+ RegCloseKey(hkMappings);
}
BOOL ForceMapActive (TCHAR chDrive)
szDrive[0] = chDrive;
szDrive[1] = 0;
- GetPrivateProfileString (cszSECTION_ACTIVE, szDrive, TEXT("0"), szActive, sizeof(szActive), cszINIFILE);
+ DWORD len = sizeof(szActive);
+ ReadRegistryString( HKEY_CURRENT_USER, cszSECTION_ACTIVE, szDrive, szActive, &len);
if ( !lstrcmp(szActive,"1") || !lstrcmpi(szActive,"true") || !lstrcmpi(szActive,"on") || !lstrcmpi(szActive,"yes") )
return TRUE;
szDrive[0] = chDrive;
szDrive[1] = 0;
- WritePrivateProfileString (cszSECTION_ACTIVE, szDrive, on ? "1" : "0", cszINIFILE);
+ WriteRegistryString(HKEY_CURRENT_USER, cszSECTION_ACTIVE, szDrive, on ? "1" : "0");
}
void QueryDriveMapList_WriteMappings (PDRIVEMAPLIST pList)
{
- WriteDriveMappings (pList);
+ WriteDriveMappings (pList);
}
void WriteDriveMappings (PDRIVEMAPLIST pList)
{
- WritePrivateProfileString (cszSECTION_MAPPINGS, NULL, NULL, cszINIFILE);
+ HKEY hkMappings;
+ RegCreateKeyEx( HKEY_CURRENT_USER,
+ "SOFTWARE\\OpenAFS\\Client\\Mappings",
+ 0,
+ "AFS",
+ REG_OPTION_NON_VOLATILE,
+ KEY_READ|KEY_QUERY_VALUE|KEY_WRITE,
+ NULL,
+ &hkMappings,
+ NULL );
+
+ DWORD dwMappings;
+ RegQueryInfoKey( hkMappings,
+ NULL, /* lpClass */
+ NULL, /* lpcClass */
+ NULL, /* lpReserved */
+ NULL, /* lpcSubKeys */
+ NULL, /* lpcMaxSubKeyLen */
+ NULL, /* lpcMaxClassLen */
+ &dwMappings, /* lpcValues */
+ NULL, /* lpcMaxValueNameLen */
+ NULL, /* lpcMaxValueLen */
+ NULL, /* lpcbSecurityDescriptor */
+ NULL /* lpftLastWriteTime */
+ );
+
+ if ( dwMappings > 0 ) {
+ for ( long dwIndex = dwMappings - 1; dwIndex >= 0; dwIndex-- ) {
+ TCHAR drive[MAX_PATH];
+ DWORD driveLen = MAX_PATH;
+
+ RegEnumValue( hkMappings, dwIndex, drive, &driveLen, NULL, NULL, NULL, NULL);
+ RegDeleteValue( hkMappings, drive );
+ }
+ }
for (size_t iDrive = 0; iDrive < 26; ++iDrive)
- {
- if (pList->aDriveMap[iDrive].szMapping[0] != TEXT('\0'))
- {
- TCHAR szLHS[] = TEXT("*");
- szLHS[0] = pList->aDriveMap[iDrive].chDrive;
-
- TCHAR szRHS[MAX_PATH];
- AdjustAfsPath (szRHS, pList->aDriveMap[iDrive].szMapping, TRUE, TRUE);
- if (!pList->aDriveMap[iDrive].fPersistent)
- lstrcat (szRHS, TEXT("*"));
-
- WritePrivateProfileString (cszSECTION_MAPPINGS, szLHS, szRHS, cszINIFILE);
- }
- }
+ {
+ if (pList->aDriveMap[iDrive].szMapping[0] != TEXT('\0'))
+ {
+ TCHAR szLHS[] = TEXT("*");
+ szLHS[0] = pList->aDriveMap[iDrive].chDrive;
+
+ TCHAR szRHS[MAX_PATH];
+ AdjustAfsPath (szRHS, pList->aDriveMap[iDrive].szMapping, TRUE, TRUE);
+ if (!pList->aDriveMap[iDrive].fPersistent)
+ lstrcat (szRHS, TEXT("*"));
+
+ RegSetValueEx( hkMappings, szLHS, 0, REG_SZ, (const BYTE *)szRHS, lstrlen(szRHS) + 1);
+ }
+ }
+ RegCloseKey( hkMappings );
}
BOOL DriveIsGlobalAfsDrive(TCHAR chDrive)
BOOL InactivateDriveMap (TCHAR chDrive, DWORD *pdwStatus)
{
- DWORD rc = DisMountDOSDrive(chDrive, FALSE);
- if (rc == NO_ERROR)
- return TRUE;
+ DWORD rc = DisMountDOSDrive(chDrive, FALSE);
+ if (rc == NO_ERROR)
+ return TRUE;
- if (pdwStatus)
- *pdwStatus = rc;
- return FALSE;
+ if (pdwStatus)
+ *pdwStatus = rc;
+ return FALSE;
}
void AddSubMount (LPTSTR pszSubmount, LPTSTR pszMapping)
{
- TCHAR szRHS[ MAX_PATH ];
- AdjustAfsPath (szRHS, pszMapping, FALSE, TRUE);
- if (!szRHS[0])
- lstrcpy (szRHS, TEXT("/"));
- WritePrivateProfileString (cszSECTION_SUBMOUNTS, pszSubmount, szRHS, cszINIFILE);
+ TCHAR szRHS[ MAX_PATH ];
+ AdjustAfsPath (szRHS, pszMapping, FALSE, TRUE);
+ if (!szRHS[0])
+ lstrcpy (szRHS, TEXT("/"));
+
+ WriteRegistryString(HKEY_LOCAL_MACHINE, cszSECTION_SUBMOUNTS, pszSubmount, szRHS);
}
void RemoveSubMount (LPTSTR pszSubmount)
{
- WritePrivateProfileString (cszSECTION_SUBMOUNTS, pszSubmount, NULL, cszINIFILE);
+ DeleteRegistryString(HKEY_LOCAL_MACHINE, cszSECTION_SUBMOUNTS, pszSubmount);
}
if (read)
{
rval=0;
- if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, AFSLogonOptionName,0, KEY_QUERY_VALUE, &hk)==ERROR_SUCCESS)
+ if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, AFSLogonOptionName, 0, KEY_QUERY_VALUE, &hk)==ERROR_SUCCESS)
{
LSPsize=sizeof(rval);
RegQueryValueEx(hk, "LogonOptions", NULL,
char pathName[1024];
- len = GetPrivateProfileString("AFS Submounts",
- PCCHAR(strShareName),
- "", pathName, sizeof(pathName),
- "afsdsbmt.ini");
-
- if (len == 0 || len == sizeof(pathName) - 1)
+ HKEY hkSubmounts;
+ RegCreateKeyEx( HKEY_LOCAL_MACHINE,
+ "SOFTWARE\\OpenAFS\\Client\\Submounts",
+ 0,
+ "AFS",
+ REG_OPTION_NON_VOLATILE,
+ KEY_READ,
+ NULL,
+ &hkSubmounts,
+ NULL );
+
+ DWORD dwType;
+ DWORD status;
+ len = sizeof(pathName);
+ status = RegQueryValueEx( hkSubmounts, (LPCSTR)PCCHAR(strShareName), 0,
+ &dwType, (LPBYTE)pathName, &len);
+ RegCloseKey( hkSubmounts );
+
+ if (status || len == 0)
return pInfo;
pInfo = new CSubmountInfo();
{
HOURGLASS hourglass;
- DWORD lsize, size = 500;
- char *buf = NULL, *next;
-
- /*
- * We don't know how large a buffer we need. Keep doubling it until
- * we're sure we have enough.
- */
- do {
- size *= 2;
- if (buf != NULL) free(buf);
- buf = (char *)malloc(size);
- lsize = GetPrivateProfileSection("AFS Submounts", buf, size,
- "afsdsbmt.ini");
- }
- while (lsize >= size - 2);
-
- if (lsize != 0) {
- next = buf;
- do {
- m_SubmtList.AddString(next);
- next += (strlen(next) + 1);
- }
- while (*next);
- }
-
- free(buf);
+ HKEY hkSubmounts;
+ DWORD dwType, dwSize;
+ DWORD status;
+ DWORD dwIndex;
+ DWORD dwSubmounts;
+
+ RegCreateKeyEx( HKEY_LOCAL_MACHINE,
+ "SOFTWARE\\OpenAFS\\Client\\Submounts",
+ 0,
+ "AFS",
+ REG_OPTION_NON_VOLATILE,
+ KEY_READ|KEY_WRITE|KEY_QUERY_VALUE,
+ NULL,
+ &hkSubmounts,
+ NULL );
+
+ RegQueryInfoKey( hkSubmounts,
+ NULL, /* lpClass */
+ NULL, /* lpcClass */
+ NULL, /* lpReserved */
+ NULL, /* lpcSubKeys */
+ NULL, /* lpcMaxSubKeyLen */
+ NULL, /* lpcMaxClassLen */
+ &dwSubmounts, /* lpcValues */
+ NULL, /* lpcMaxValueNameLen */
+ NULL, /* lpcMaxValueLen */
+ NULL, /* lpcbSecurityDescriptor */
+ NULL /* lpftLastWriteTime */
+ );
+
+
+ for ( dwIndex = 0; dwIndex < dwSubmounts; dwIndex ++ ) {
+ char submountName[256];
+ DWORD submountNameLen = sizeof(submountName);
+
+ RegEnumValue( hkSubmounts, dwIndex, submountName, &submountNameLen, NULL,
+ &dwType, NULL, NULL);
+
+ m_SubmtList.AddString(submountName);
+ }
+
+ RegCloseKey( hkSubmounts );
return TRUE;
}
{
HOURGLASS hourglass;
- BOOL written =
- WritePrivateProfileString("AFS Submounts",
- PCCHAR(pInfo->GetShareName()),
- PCCHAR(pInfo->GetPathName()),
- "afsdsbmt.ini");
-
- return written;
+ HKEY hkSubmounts;
+ RegCreateKeyEx( HKEY_LOCAL_MACHINE,
+ "SOFTWARE\\OpenAFS\\Client\\Submounts",
+ 0,
+ "AFS",
+ REG_OPTION_NON_VOLATILE,
+ KEY_WRITE,
+ NULL,
+ &hkSubmounts,
+ NULL );
+
+ DWORD status = RegSetValueEx( hkSubmounts, PCCHAR(pInfo->GetShareName()), 0, REG_SZ,
+ (const BYTE *)PCCHAR(pInfo->GetPathName()), strlen(PCCHAR(pInfo->GetPathName())) + 1);
+
+ RegCloseKey(hkSubmounts);
+ return (status == ERROR_SUCCESS);
}
static BOOL DeleteSubmt(CSubmountInfo *pInfo)
{
HOURGLASS hourglass;
- BOOL written =
- WritePrivateProfileString("AFS Submounts",
- PCCHAR(pInfo->GetShareName()),
- NULL,
- "afsdsbmt.ini");
- return written;
+ HKEY hkSubmounts;
+ RegCreateKeyEx( HKEY_LOCAL_MACHINE,
+ "SOFTWARE\\OpenAFS\\Client\\Submounts",
+ 0,
+ "AFS",
+ REG_OPTION_NON_VOLATILE,
+ KEY_WRITE,
+ NULL,
+ &hkSubmounts,
+ NULL );
+
+ DWORD status = RegDeleteValue( hkSubmounts, PCCHAR(pInfo->GetShareName()));
+
+ RegCloseKey(hkSubmounts);
+ return (status == ERROR_SUCCESS);
}
void CSubmountsDlg::OnAdd()
!ENDIF
IfSilent SkipDel
-; IfFileExists "$WINDIR\afsdcell.ini" CellExists SkipDelAsk
+; IfFileExists "$INSTDIR\Client\CellServDB" CellExists SkipDelAsk
; CellExists:
MessageBox MB_YESNO "Would you like to keep your configuration files?" IDYES SkipDel
- Delete "$WINDIR\afsdcell.ini"
+ Delete "$INSTDIR\Client\CellServDB"
- Delete "$WINDIR\afsdsbmt.ini"
; Only remove krb5.ini if KfW was installed
!IFDEF INSTALL_KFW
Delete "$WINDIR\krb5.ini"
!ENDIF
- Delete "$WINDIR\afsdns.ini"
- Delete "$WINDIR\afs_freelance.ini"
+ Delete "$INSTDIR\Client\afsdns.ini"
SkipDel:
Delete "$WINDIR\afsd_init.log"
DoDownload:
ReadINIStr $R0 $0 "Field 5" "State"
- NSISdl::download $R0 "$WINDIR\afsdcell.ini"
+ NSISdl::download $R0 "$INSTDIR\Client\CellServDB"
Pop $R0 ;Get the return value
StrCmp $R0 "success" +2
MessageBox MB_OK|MB_ICONSTOP "Download failed: $R0"
goto done
UsePackaged:
- SetOutPath "$WINDIR"
- File "afsdcell.ini"
+ SetOutPath "$INSTDIR\Client"
+ File "CellServDB"
goto done
CheckOther:
ReadINIStr $R0 $0 "Field 7" "State"
StrCmp $R0 "" done
- CopyFiles $R0 "$WINDIR\afsdcell.ini"
+ CopyFiles $R0 "$INSTDIR\Client\CellServDB"
done:
WriteINISTR $0 "Field 4" "State" "0"
WriteINIStr $0 "Field 6" "State" "0"
- ; If there is an existing afsdcell.ini file, allow the user to choose it and make it default
- IfFileExists "$WINDIR\afsdcell.ini" +1 notpresent
+ ; If there is an existing afsdcell.ini file, migrate it to CellServDB
+ IfFileExists "$WINDIR\afsdcell.ini" +1 +3
+ CopyFiles /SILENT "$WINDIR\afsdcell.ini" "$INSTDIR\Client\CellServDB"
+ Delete "$WINDIR\afsdcell.ini"
+ ; If there is an existing CellServDB file, allow the user to choose it and make it default
+ IfFileExists "$INSTDIR\Client\CellServDB" +1 notpresent
WriteINIStr $0 "Field 2" "Flags" "ENABLED"
WriteINIStr $0 "Field 2" "State" "1"
WriteINIStr $0 "Field 3" "State" "0"
FilepathNormalize(ntServerInstallDirShort);
/* get the afs client configuration directory (/usr/vice/etc equivalent) */
- status = GetWindowsDirectory(ntClientConfigDirLong, AFSDIR_PATH_MAX);
- if (status == 0 || status > AFSDIR_PATH_MAX) {
- /* failed to get canonical Windows directory; use temp directory */
- strcpy(ntClientConfigDirLong, gettmpdir());
+ if (afssw_GetClientInstallDir(&buf)) {
+ /* failed */
+ status = GetWindowsDirectory(ntClientConfigDirLong, AFSDIR_PATH_MAX);
+ if (status == 0 || status > AFSDIR_PATH_MAX) {
+ /* failed to get canonical Windows directory; use temp directory */
+ strcpy(ntClientConfigDirLong, gettmpdir());
+ } else {
+ initStatus |= AFSDIR_CLIENT_PATHS_OK;
+ }
} else {
- initStatus |= AFSDIR_CLIENT_PATHS_OK;
+ strcpy(ntClientConfigDirLong, buf);
+ free(buf);
+ initStatus |= AFSDIR_CLIENT_PATHS_OK;
}
FilepathNormalize(ntClientConfigDirLong);
/* now initialize various dir and file paths exported by dirpath module */
/* server dir paths */
-
strcpy(dirPathArray[AFSDIR_SERVER_AFS_DIRPATH_ID], afsSrvDirPath);
pathp = dirPathArray[AFSDIR_SERVER_ETC_DIRPATH_ID];
AFSDIR_SERVER_DIRPATH(pathp, AFSDIR_BIN_FILE_DIR);
/* client dir path */
-
#ifdef AFS_NT40_ENV
strcpy(dirPathArray[AFSDIR_CLIENT_VICE_DIRPATH_ID],
"/NoUsrViceDirectoryOnWindows");
#endif /* AFS_NT40_ENV */
/* server file paths */
-
pathp = dirPathArray[AFSDIR_SERVER_THISCELL_FILEPATH_ID];
AFSDIR_SERVER_FILEPATH(pathp, AFSDIR_SERVER_ETC_DIR,
AFSDIR_THISCELL_FILE);
/* client file paths */
-
#ifdef AFS_NT40_ENV
strcpy(dirPathArray[AFSDIR_CLIENT_THISCELL_FILEPATH_ID],
"/NoUsrViceEtcThisCellFileOnWindows");
#define AFSDIR_FILELOG_FILE "FileLog"
#define AFSDIR_MIGRATE_LOGNAME "wtlog."
+#ifdef COMMENT
#define AFSDIR_CELLSERVDB_FILE_NTCLIENT "afsdcell.ini"
+#else
+#define AFSDIR_CELLSERVDB_FILE_NTCLIENT AFSDIR_CELLSERVDB_FILE
+#endif
#define AFSDIR_NETINFO_FILE "NetInfo"
#define AFSDIR_NETRESTRICT_FILE "NetRestrict"