[pkg-opensc-commit] [opensc] 16/50: md: use register to enable debug log
Eric Dorland
eric at moszumanska.debian.org
Sat May 28 03:35:47 UTC 2016
This is an automated email from the git hooks/post-receive script.
eric pushed a commit to branch master
in repository opensc.
commit 09cbcd80f462979bd0ad7c89fe6948904a8d872b
Author: Viktor Tarasov <viktor.tarasov at gmail.com>
Date: Wed Apr 13 14:28:06 2016 +0200
md: use register to enable debug log
---
src/minidriver/minidriver.c | 17 ++++++++---------
win32/OpenSC.wxs.in | 1 +
2 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/src/minidriver/minidriver.c b/src/minidriver/minidriver.c
index 44ba667..1568e8f 100644
--- a/src/minidriver/minidriver.c
+++ b/src/minidriver/minidriver.c
@@ -247,8 +247,6 @@ static void logprintf(PCARD_DATA pCardData, int level, _Printf_format_string_ co
{
va_list arg;
VENDOR_SPECIFIC *vs;
-#define CARDMOD_LOW_LEVEL_DEBUG 1
-#ifdef CARDMOD_LOW_LEVEL_DEBUG
/* Use a simplied log to get all messages including messages
* before opensc is loaded. The file must be modifiable by all
* users as we maybe called under lsa or user. Note data from
@@ -256,20 +254,23 @@ static void logprintf(PCARD_DATA pCardData, int level, _Printf_format_string_ co
* flush to get last message before ann crash
* close so as the file is not left open during any wait.
*/
- {
- FILE* lldebugfp = NULL;
+ DWORD md_debug = 0;
+ DWORD sz = sizeof(md_debug);
+ int rv;
- lldebugfp = fopen("C:\\tmp\\md.log","a+");
+ rv = sc_ctx_win32_get_config_value("CARDMOD_LOW_LEVEL_DEBUG",
+ "MiniDriverDebug", "Software\\OpenSC Project\\OpenSC",
+ (char *)(&md_debug), &sz);
+ if (rv == SC_SUCCESS && md_debug != 0) {
+ FILE *lldebugfp = fopen("C:\\tmp\\md.log","a+");
if (lldebugfp) {
va_start(arg, format);
vfprintf(lldebugfp, format, arg);
va_end(arg);
fflush(lldebugfp);
fclose(lldebugfp);
- lldebugfp = NULL;
}
}
-#endif
va_start(arg, format);
if(pCardData != NULL) {
@@ -5689,7 +5690,6 @@ BOOL APIENTRY DllMain( HINSTANCE hinstDLL,
LPVOID lpReserved
)
{
-#ifdef CARDMOD_LOW_LEVEL_DEBUG
CHAR name[MAX_PATH + 1] = "\0";
char *reason = "";
@@ -5712,7 +5712,6 @@ BOOL APIENTRY DllMain( HINSTANCE hinstDLL,
logprintf(NULL,8,"\n********** DllMain Module(handle:0x%p) '%s'; reason='%s'; Reserved=%p; P:%d; T:%d\n",
hinstDLL, name, reason, lpReserved, GetCurrentProcessId(), GetCurrentThreadId());
-#endif
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
diff --git a/win32/OpenSC.wxs.in b/win32/OpenSC.wxs.in
index c96783f..0092ede 100644
--- a/win32/OpenSC.wxs.in
+++ b/win32/OpenSC.wxs.in
@@ -111,6 +111,7 @@
<RegistryValue Type="string" Name="ConfigFile" Value="[INSTALLDIR]opensc.conf"/>
<RegistryValue Type="string" Name="ProfileDir" Value="[INSTALLDIR]profiles"/>
<RegistryValue Type="string" Name="SmDir" Value="[INSTALLDIR]tools"/>
+ <RegistryValue Type="integer" Name="MiniDriverDebug" Value="0"/>
</RegistryKey>
</Component>
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-opensc/opensc.git
More information about the pkg-opensc-commit
mailing list