diff --git a/winpr/include/winpr/sysinfo.h b/winpr/include/winpr/sysinfo.h index 80f4e4af7..98af74387 100644 --- a/winpr/include/winpr/sysinfo.h +++ b/winpr/include/winpr/sysinfo.h @@ -214,6 +214,11 @@ WINPR_API BOOL GetVersionExW(LPOSVERSIONINFOW lpVersionInformation); #define GetVersionEx GetVersionExA #endif +WINPR_API void GetSystemTime(LPSYSTEMTIME lpSystemTime); +WINPR_API BOOL SetSystemTime(CONST SYSTEMTIME* lpSystemTime); +WINPR_API VOID GetLocalTime(LPSYSTEMTIME lpSystemTime); +WINPR_API BOOL SetLocalTime(CONST SYSTEMTIME* lpSystemTime); + WINPR_API VOID GetSystemTimeAsFileTime(LPFILETIME lpSystemTimeAsFileTime); WINPR_API DWORD GetTickCount(void); diff --git a/winpr/libwinpr/smartcard/smartcard_winscard.c b/winpr/libwinpr/smartcard/smartcard_winscard.c index d185933b9..da4d661fe 100644 --- a/winpr/libwinpr/smartcard/smartcard_winscard.c +++ b/winpr/libwinpr/smartcard/smartcard_winscard.c @@ -121,7 +121,7 @@ PSCardApiFunctionTable WinSCard_GetSCardApiFunctionTable(void) int WinSCard_InitializeSCardApi(void) { - g_WinSCardModule = LoadLibraryA("winscard.dll"); + g_WinSCardModule = LoadLibraryA("WinSCard.dll"); if (!g_WinSCardModule) return -1; diff --git a/winpr/libwinpr/sysinfo/sysinfo.c b/winpr/libwinpr/sysinfo/sysinfo.c index 4de21f062..3be14267f 100644 --- a/winpr/libwinpr/sysinfo/sysinfo.c +++ b/winpr/libwinpr/sysinfo/sysinfo.c @@ -296,6 +296,11 @@ BOOL GetVersionExW(LPOSVERSIONINFOW lpVersionInformation) return 1; } +void GetSystemTime(LPSYSTEMTIME lpSystemTime) +{ + +} + VOID GetSystemTimeAsFileTime(LPFILETIME lpSystemTimeAsFileTime) { ULARGE_INTEGER time64; @@ -311,6 +316,21 @@ VOID GetSystemTimeAsFileTime(LPFILETIME lpSystemTimeAsFileTime) lpSystemTimeAsFileTime->dwHighDateTime = time64.HighPart; } +BOOL SetSystemTime(CONST SYSTEMTIME* lpSystemTime) +{ + return FALSE; +} + +VOID GetLocalTime(LPSYSTEMTIME lpSystemTime) +{ + +} + +BOOL SetLocalTime(CONST SYSTEMTIME* lpSystemTime) +{ + return FALSE; +} + #ifndef CLOCK_MONOTONIC_RAW #define CLOCK_MONOTONIC_RAW 4 #endif @@ -606,6 +626,7 @@ BOOL IsProcessorFeaturePresent(DWORD ProcessorFeature) #endif return ret; } + #endif //_WIN32 BOOL IsProcessorFeaturePresentEx(DWORD ProcessorFeature) diff --git a/winpr/libwinpr/utils/wlog/Layout.c b/winpr/libwinpr/utils/wlog/Layout.c index 7656316f2..b26f2433d 100644 --- a/winpr/libwinpr/utils/wlog/Layout.c +++ b/winpr/libwinpr/utils/wlog/Layout.c @@ -64,7 +64,10 @@ void WLog_Layout_GetMessagePrefix(wLog* log, wLogLayout* layout, wLogMessage* me int index; int argc = 0; void* args[32]; - char format[128]; + char format[256]; + SYSTEMTIME localTime; + + GetLocalTime(&localTime); index = 0; p = (char*) layout->FormatString; @@ -77,21 +80,21 @@ void WLog_Layout_GetMessagePrefix(wLog* log, wLogLayout* layout, wLogMessage* me if (*p) { - if ((*p == 'l') && (*(p + 1) == 'v')) /* log level */ + if ((p[0] == 'l') && (p[1] == 'v')) /* log level */ { args[argc++] = (void*) WLOG_LEVELS[message->Level]; format[index++] = '%'; format[index++] = 's'; p++; } - else if ((*p == 'm') && (*(p + 1) == 'n')) /* module name */ + else if ((p[0] == 'm') && (p[1] == 'n')) /* module name */ { args[argc++] = (void*) log->Name; format[index++] = '%'; format[index++] = 's'; p++; } - else if ((*p == 'f') && (*(p + 1) == 'l')) /* file */ + else if ((p[0] == 'f') && (p[1] == 'l')) /* file */ { char* file; @@ -110,20 +113,90 @@ void WLog_Layout_GetMessagePrefix(wLog* log, wLogLayout* layout, wLogMessage* me format[index++] = 's'; p++; } - else if ((*p == 'f') && (*(p + 1) == 'n')) /* function */ + else if ((p[0] == 'f') && (p[1] == 'n')) /* function */ { args[argc++] = (void*) message->FunctionName; format[index++] = '%'; format[index++] = 's'; p++; } - else if ((*p == 'l') && (*(p + 1) == 'n')) /* line number */ + else if ((p[0] == 'l') && (p[1] == 'n')) /* line number */ { args[argc++] = (void*) (size_t) message->LineNumber; format[index++] = '%'; format[index++] = 'd'; p++; } + else if ((p[0] == 'p') && (p[1] == 'i') && (p[2] == 'd')) /* process id */ + { + args[argc++] = (void*) (size_t) GetCurrentProcessId(); + format[index++] = '%'; + format[index++] = 'd'; + p += 2; + } + else if ((p[0] == 't') && (p[1] == 'i') && (p[2] == 'd')) /* thread id */ + { + args[argc++] = (void*) (size_t) GetCurrentThreadId(); + format[index++] = '%'; + format[index++] = 'd'; + p += 2; + } + else if ((p[0] == 'y') && (p[1] == 'r')) /* year */ + { + args[argc++] = (void*) (size_t) localTime.wYear; + format[index++] = '%'; + format[index++] = 'd'; + p++; + } + else if ((p[0] == 'm') && (p[1] == 'o')) /* month */ + { + args[argc++] = (void*) (size_t) localTime.wMonth; + format[index++] = '%'; + format[index++] = 'd'; + p++; + } + else if ((p[0] == 'd') && (p[1] == 'w')) /* day of week */ + { + args[argc++] = (void*) (size_t) localTime.wDayOfWeek; + format[index++] = '%'; + format[index++] = 'd'; + p++; + } + else if ((p[0] == 'd') && (p[1] == 'y')) /* day */ + { + args[argc++] = (void*) (size_t) localTime.wDay; + format[index++] = '%'; + format[index++] = 'd'; + p++; + } + else if ((p[0] == 'h') && (p[1] == 'r')) /* hours */ + { + args[argc++] = (void*) (size_t) localTime.wHour; + format[index++] = '%'; + format[index++] = 'd'; + p++; + } + else if ((p[0] == 'm') && (p[1] == 'i')) /* minutes */ + { + args[argc++] = (void*) (size_t) localTime.wMinute; + format[index++] = '%'; + format[index++] = 'd'; + p++; + } + else if ((p[0] == 's') && (p[1] == 'e')) /* seconds */ + { + args[argc++] = (void*) (size_t) localTime.wSecond; + format[index++] = '%'; + format[index++] = 'd'; + p++; + } + else if ((p[0] == 'm') && (p[1] == 'l')) /* milliseconds */ + { + args[argc++] = (void*) (size_t) localTime.wMilliseconds; + format[index++] = '%'; + format[index++] = 'd'; + p++; + } } } else