check for environment variable first on windows, too.

git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@2978 c6295689-39f2-0310-b995-f0e70906c6a9
This commit is contained in:
aj 2006-06-26 21:03:11 +00:00
parent fae6f3feae
commit ec38927731
1 changed files with 13 additions and 10 deletions

View File

@ -555,16 +555,19 @@ static void process_config_file(sc_context_t *ctx, struct _sc_ctx_options *opts)
memset(ctx->conf_blocks, 0, sizeof(ctx->conf_blocks));
#ifdef _WIN32
rc = RegOpenKeyEx( HKEY_CURRENT_USER, "Software\\OpenSC",
0, KEY_QUERY_VALUE, &hKey );
if( rc == ERROR_SUCCESS ) {
temp_len = PATH_MAX;
rc = RegQueryValueEx( hKey, "ConfigFile", NULL, NULL,
(LPBYTE) temp_path, &temp_len);
if( (rc == ERROR_SUCCESS) && (temp_len < PATH_MAX) )
conf_path = temp_path;
RegCloseKey( hKey );
}
conf_path = getenv("OPENSC_CONF");
if (!conf_path) {
rc = RegOpenKeyEx( HKEY_CURRENT_USER, "Software\\OpenSC",
0, KEY_QUERY_VALUE, &hKey );
if( rc == ERROR_SUCCESS ) {
temp_len = PATH_MAX;
rc = RegQueryValueEx( hKey, "ConfigFile", NULL, NULL,
(LPBYTE) temp_path, &temp_len);
if( (rc == ERROR_SUCCESS) && (temp_len < PATH_MAX) )
conf_path = temp_path;
RegCloseKey( hKey );
}
}
if (! conf_path) {
rc = RegOpenKeyEx( HKEY_LOCAL_MACHINE, "Software\\OpenSC",