From 50ca88be2a8dcce74ba9386d0161c39e46e1d57c Mon Sep 17 00:00:00 2001 From: Jeffrey Altman Date: Tue, 23 Nov 2004 04:19:42 +0000 Subject: [PATCH] freelance-import-20041122 Fix the afs_freelance.ini import code. Check both the Client install directory and the %WINDIR% directory for afs_freelance.ini --- src/WINNT/afsd/afsd_init.c | 27 ++++++++++++++------------- src/WINNT/afsd/cm_freelance.c | 7 +++++++ 2 files changed, 21 insertions(+), 13 deletions(-) diff --git a/src/WINNT/afsd/afsd_init.c b/src/WINNT/afsd/afsd_init.c index e7911fa..8ee00e5 100644 --- a/src/WINNT/afsd/afsd_init.c +++ b/src/WINNT/afsd/afsd_init.c @@ -108,16 +108,16 @@ void afsd_initUpperCaseTable() void afsi_start() { - char wd[100]; - char t[100], u[100], *p, *path; - int zilch; - int code; + char wd[100]; + char t[100], u[100], *p, *path; + int zilch; + int code; DWORD dwLow, dwHigh; - HKEY parmKey; - DWORD dummyLen; + HKEY parmKey; + DWORD dummyLen; DWORD maxLogSize = 100 * 1024; - afsi_file = INVALID_HANDLE_VALUE; + afsi_file = INVALID_HANDLE_VALUE; if (getenv("TEMP")) { StringCbCopyA(wd, sizeof(wd), getenv("TEMP")); @@ -125,21 +125,22 @@ afsi_start() else { code = GetWindowsDirectory(wd, sizeof(wd)); - if (code == 0) return; + if (code == 0) + return; } - StringCbCatA(wd, sizeof(wd), "\\afsd_init.log"); - GetTimeFormat(LOCALE_SYSTEM_DEFAULT, 0, NULL, NULL, t, sizeof(t)); - afsi_file = CreateFile(wd, GENERIC_WRITE, FILE_SHARE_READ, NULL, + StringCbCatA(wd, sizeof(wd), "\\afsd_init.log"); + GetTimeFormat(LOCALE_SYSTEM_DEFAULT, 0, NULL, NULL, t, sizeof(t)); + afsi_file = CreateFile(wd, GENERIC_WRITE, FILE_SHARE_READ, NULL, OPEN_ALWAYS, FILE_FLAG_WRITE_THROUGH, NULL); code = RegOpenKeyEx(HKEY_LOCAL_MACHINE, AFSConfigKeyName, 0, KEY_QUERY_VALUE, &parmKey); - if (code == ERROR_SUCCESS) { + if (code == ERROR_SUCCESS) { dummyLen = sizeof(maxLogSize); code = RegQueryValueEx(parmKey, "MaxLogSize", NULL, NULL, (BYTE *) &maxLogSize, &dummyLen); RegCloseKey (parmKey); - } + } if (maxLogSize) { dwLow = GetFileSize( afsi_file, &dwHigh ); diff --git a/src/WINNT/afsd/cm_freelance.c b/src/WINNT/afsd/cm_freelance.c index 6ea9360..f0358af 100644 --- a/src/WINNT/afsd/cm_freelance.c +++ b/src/WINNT/afsd/cm_freelance.c @@ -618,6 +618,13 @@ long cm_InitLocalMountPoints() { strcat(hdir, AFS_FREELANCE_INI); // open the ini file for reading fp = fopen(hdir, "r"); + if (!fp) { + /* look in the Windows directory where we used to store the file */ + GetWindowsDirectory(hdir, sizeof(hdir)); + strcat(hdir,"\\"); + strcat(hdir, AFS_FREELANCE_INI); + fp = fopen(hdir, "r"); + } #if !defined(DJGPP) RegCreateKeyEx( HKEY_LOCAL_MACHINE, -- 1.9.4