From 14a164564bce7026beb33b1488239ccd9fc76a2b Mon Sep 17 00:00:00 2001 From: Juan Carlos Luciani Date: Mon, 14 Aug 2006 20:16:03 +0000 Subject: [PATCH] Modifications to allow us to find the configuration folder even when executing on a drive rather than the install drive. --- .../non-java/client/windows/dllsup.c | 29 ++++++++++++++++--- .../non-java/client/windows/platform.c | 3 +- 2 files changed, 27 insertions(+), 5 deletions(-) diff --git a/CASA-auth-token/non-java/client/windows/dllsup.c b/CASA-auth-token/non-java/client/windows/dllsup.c index c30b3cb2..9a50c46d 100644 --- a/CASA-auth-token/non-java/client/windows/dllsup.c +++ b/CASA-auth-token/non-java/client/windows/dllsup.c @@ -25,8 +25,12 @@ //===[ Include files ]===================================================== #include "internal.h" +#include +#include //===[ External data ]===================================================== +extern +char mechConfigFolderPartialPath[]; //===[ Manifest constants ]================================================ @@ -57,13 +61,30 @@ BOOL APIENTRY DllMain( { g_hModule = hModule; - // Initialize the library - if (Initialize() != 0) + // Setup the path to the auth mechanisms config folder + if (SHGetFolderPath(NULL, + CSIDL_PROGRAM_FILES, + NULL, + 0, + mechConfigFolder) == 0) { - // Failed to initialize the library - OutputDebugString("CASAAUTH -DllMain- Library initialization failed\n"); + PathAppend(mechConfigFolder, mechConfigFolderPartialPath); + + // Initialize the library + if (Initialize() != 0) + { + // Failed to initialize the library + OutputDebugString("CASAAUTH -DllMain- Library initialization failed\n"); + retStatus = FALSE; + } + } + else + { + // Failed to obtain the Program Files path + OutputDebugString("CASAAUTH -DllMain- Failed to obtain the Program Files path\n"); retStatus = FALSE; } + break; } diff --git a/CASA-auth-token/non-java/client/windows/platform.c b/CASA-auth-token/non-java/client/windows/platform.c index 1003ece0..2c83eb1c 100644 --- a/CASA-auth-token/non-java/client/windows/platform.c +++ b/CASA-auth-token/non-java/client/windows/platform.c @@ -54,7 +54,8 @@ static HANDLE hNormalizedHostNameCacheMutex; // Authentication mechanism configuration file folder -char mechConfigFolder[] = "\\Program Files\\Novell\\Casa\\Etc\\Auth\\Mechanisms"; +char mechConfigFolder[MAX_PATH]; +char mechConfigFolderPartialPath[] = "Novell\\Casa\\Etc\\Auth\\Mechanisms"; // Synchronization mutex for the dll initialization static