- Get opensc.conf from %windir% rather than hard-coded C:\\WINNT (Stef)
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@875 c6295689-39f2-0310-b995-f0e70906c6a9
This commit is contained in:
parent
1a994ef760
commit
501cdbd7e0
|
@ -40,7 +40,10 @@
|
||||||
#define HAVE_IO_H
|
#define HAVE_IO_H
|
||||||
#define HAVE_GETPASS
|
#define HAVE_GETPASS
|
||||||
|
|
||||||
#define OPENSC_CONF_PATH "C:\\WINNT\\opensc.conf"
|
/* %windir% is replaced by the path of the Windows directory,
|
||||||
|
* this is C:\WINNT or C:\WINDOWS on most systems.
|
||||||
|
*/
|
||||||
|
#define OPENSC_CONF_PATH "%windir%\\opensc.conf"
|
||||||
|
|
||||||
#define PATH_MAX _MAX_PATH
|
#define PATH_MAX _MAX_PATH
|
||||||
|
|
||||||
|
|
|
@ -27,6 +27,9 @@
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <sys/stat.h> /* for mkdir */
|
#include <sys/stat.h> /* for mkdir */
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
|
#ifdef _WIN32
|
||||||
|
#include <windows.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
int _sc_add_reader(struct sc_context *ctx, struct sc_reader *reader)
|
int _sc_add_reader(struct sc_context *ctx, struct sc_reader *reader)
|
||||||
{
|
{
|
||||||
|
@ -325,9 +328,19 @@ void process_config_file(struct sc_context *ctx, struct _sc_ctx_options *opts)
|
||||||
{
|
{
|
||||||
int i, r, count = 0;
|
int i, r, count = 0;
|
||||||
scconf_block **blocks;
|
scconf_block **blocks;
|
||||||
|
char *conf_path = OPENSC_CONF_PATH;
|
||||||
|
|
||||||
memset(ctx->conf_blocks, 0, sizeof(ctx->conf_blocks));
|
memset(ctx->conf_blocks, 0, sizeof(ctx->conf_blocks));
|
||||||
ctx->conf = scconf_new(OPENSC_CONF_PATH);
|
#ifdef _WIN32
|
||||||
|
if (!strncmp(conf_path, "%windir%", 8)) {
|
||||||
|
static char temp_path[PATH_MAX];
|
||||||
|
|
||||||
|
GetWindowsDirectory(opensc_conf_path, sizeof(temp_path));
|
||||||
|
strcat(opensc_conf_path, conf_path + 8);
|
||||||
|
conf_path = temp_path;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
ctx->conf = scconf_new(conf_path);
|
||||||
if (ctx->conf == NULL)
|
if (ctx->conf == NULL)
|
||||||
return;
|
return;
|
||||||
r = scconf_parse(ctx->conf);
|
r = scconf_parse(ctx->conf);
|
||||||
|
|
Loading…
Reference in New Issue