Andreas Jellinghaus wrote:
https://www.opensc-project.org/opensc/wiki/UsingOpensc
contains the registry keys and the environment setting.
so your approach with OPENSC_CONFIG on windows should work fine.
if it does not, we have a bug.
need to investigate ...
On windows the opensc config file is found using the registry key
HKML\Software\OpenSC\ConfigFile?. If you compile and install OpenSC from
source you need to set this registry key to point to the install file.
Users can set HKMU\Software\OpenSC\ConfigFile? to override the system
wide settings. Also users can use the OPENSC_CONFIG environment variable
to override both registry settings.
The last part is not true in the current code :(
Attached is a patch, if noone objects I will commit it to add
this functionality to the code.
Andreas
diff -udrNPp --exclude=.svn opensc.orig/src/libopensc/ctx.c
opensc/src/libopensc/ctx.c
--- opensc.orig/src/libopensc/ctx.c 2006-06-08 09:08:52.000000000 +0200
+++ opensc/src/libopensc/ctx.c 2006-06-26 09:28:32.000000000 +0200
@@ -555,16 +555,19 @@ static void process_config_file(sc_conte
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",
_______________________________________________
opensc-devel mailing list
opensc-devel@lists.opensc-project.org
http://www.opensc-project.org/mailman/listinfo/opensc-devel