From 5ed9796e9676c13108a20cb7d3444f1dad2d80c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Moreau?= Date: Wed, 6 Jun 2012 02:59:37 -0400 Subject: [PATCH] libwinpr-sspi: fix compilation on Windows --- config.h.in | 1 + include/winpr/sspi.h | 4 +--- include/winpr/tchar.h | 4 ++-- libfreerdp-core/rpc.c | 2 +- libfreerdp-crypto/nla.c | 4 ++-- winpr/registry/registry_reg.c | 2 +- winpr/sspi/CMakeLists.txt | 2 -- winpr/sspi/sspi.c | 2 +- winpr/synch/CMakeLists.txt | 4 +++- winpr/tools/reg/CMakeLists.txt | 4 +++- winpr/tools/reg/reg.c | 8 ++++---- winpr/utils/CMakeLists.txt | 3 +++ 12 files changed, 22 insertions(+), 18 deletions(-) diff --git a/config.h.in b/config.h.in index 9b1f92599..1dced6c30 100644 --- a/config.h.in +++ b/config.h.in @@ -25,6 +25,7 @@ #cmakedefine WITH_PROFILER #cmakedefine WITH_SSE2 #cmakedefine WITH_NEON +#cmakedefine WITH_NATIVE_SSPI /* Debug */ #cmakedefine WITH_DEBUG_CERTIFICATE diff --git a/include/winpr/sspi.h b/include/winpr/sspi.h index 4220d5cd6..2995ce747 100644 --- a/include/winpr/sspi.h +++ b/include/winpr/sspi.h @@ -22,8 +22,6 @@ #include "config.h" -//#define NATIVE_SSPI - #include #include #include @@ -34,7 +32,7 @@ #include #include -#ifdef NATIVE_SSPI +#ifdef WITH_NATIVE_SSPI #define SECURITY_WIN32 #include #include diff --git a/include/winpr/tchar.h b/include/winpr/tchar.h index f6e973f90..e63633b63 100644 --- a/include/winpr/tchar.h +++ b/include/winpr/tchar.h @@ -30,10 +30,10 @@ #ifdef UNICODE typedef WCHAR TCHAR; -#define tprintf wprintf +#define _tprintf wprintf #else typedef CHAR TCHAR; -#define tprintf printf +#define _tprintf printf #endif #endif diff --git a/libfreerdp-core/rpc.c b/libfreerdp-core/rpc.c index aacc89c5f..874667488 100644 --- a/libfreerdp-core/rpc.c +++ b/libfreerdp-core/rpc.c @@ -38,7 +38,7 @@ boolean ntlm_client_init(rdpNtlm* ntlm, boolean confidentiality, char* user, cha ntlm->confidentiality = confidentiality; -#ifdef NATIVE_SSPI +#ifdef WITH_NATIVE_SSPI { HMODULE hSSPI; INIT_SECURITY_INTERFACE InitSecurityInterface; diff --git a/libfreerdp-crypto/nla.c b/libfreerdp-crypto/nla.c index 281234b93..c6cc4fd6d 100644 --- a/libfreerdp-crypto/nla.c +++ b/libfreerdp-crypto/nla.c @@ -155,7 +155,7 @@ int credssp_client_authenticate(rdpCredssp* credssp) if (credssp_ntlm_client_init(credssp) == 0) return 0; -#ifdef NATIVE_SSPI +#ifdef WITH_NATIVE_SSPI { HMODULE hSSPI; INIT_SECURITY_INTERFACE InitSecurityInterface; @@ -396,7 +396,7 @@ int credssp_server_authenticate(rdpCredssp* credssp) if (credssp_ntlm_server_init(credssp) == 0) return 0; -#ifdef NATIVE_SSPI +#ifdef WITH_NATIVE_SSPI { HMODULE hSSPI; INIT_SECURITY_INTERFACE InitSecurityInterface; diff --git a/winpr/registry/registry_reg.c b/winpr/registry/registry_reg.c index 41391d75c..c391555b2 100644 --- a/winpr/registry/registry_reg.c +++ b/winpr/registry/registry_reg.c @@ -147,7 +147,7 @@ RegVal* reg_load_value(Reg* reg, RegKey* key) { p[4] = strchr(data, '"'); p[4][0] = '\0'; - value->data.string = strdup(data); + value->data.string = _strdup(data); } else { diff --git a/winpr/sspi/CMakeLists.txt b/winpr/sspi/CMakeLists.txt index 8ac379c97..283822edc 100644 --- a/winpr/sspi/CMakeLists.txt +++ b/winpr/sspi/CMakeLists.txt @@ -50,8 +50,6 @@ if(NOT WITH_NATIVE_SSPI) ${WINPR_SSPI_NEGOTIATE_SRCS} ${WINPR_SSPI_SCHANNEL_SRCS} ${WINPR_SSPI_SRCS}) -else() - add_definitions(-DNATIVE_SSPI) endif() add_library(winpr-sspi ${WINPR_SSPI_SRCS}) diff --git a/winpr/sspi/sspi.c b/winpr/sspi/sspi.c index 2b7fc6513..5bc6532e6 100644 --- a/winpr/sspi/sspi.c +++ b/winpr/sspi/sspi.c @@ -353,7 +353,7 @@ void sspi_GlobalFinish() sspi_ContextBufferAllocTableFree(); } -#ifndef NATIVE_SSPI +#ifndef WITH_NATIVE_SSPI SecurityFunctionTableA* sspi_GetSecurityFunctionTableByNameA(const SEC_CHAR* Name) { diff --git a/winpr/synch/CMakeLists.txt b/winpr/synch/CMakeLists.txt index d60f73c40..ddbca8c96 100644 --- a/winpr/synch/CMakeLists.txt +++ b/winpr/synch/CMakeLists.txt @@ -28,7 +28,9 @@ add_library(winpr-synch ${WINPR_SYNCH_SRCS}) set_target_properties(winpr-synch PROPERTIES VERSION ${FREERDP_VERSION_FULL} SOVERSION ${FREERDP_VERSION} PREFIX "lib") -target_link_libraries(winpr-synch winpr-handle) +if(NOT WIN32) + target_link_libraries(winpr-synch winpr-handle) +endif() install(TARGETS winpr-synch DESTINATION ${CMAKE_INSTALL_LIBDIR}) diff --git a/winpr/tools/reg/CMakeLists.txt b/winpr/tools/reg/CMakeLists.txt index dde5cbbed..fd121a00e 100644 --- a/winpr/tools/reg/CMakeLists.txt +++ b/winpr/tools/reg/CMakeLists.txt @@ -21,5 +21,7 @@ add_executable(winpr-reg reg.c) target_link_libraries(winpr-reg winpr-utils) -target_link_libraries(winpr-reg winpr-registry) +if(NOT WIN32) + target_link_libraries(winpr-reg winpr-registry) +endif() diff --git a/winpr/tools/reg/reg.c b/winpr/tools/reg/reg.c index 5405aa901..5333a7a9f 100644 --- a/winpr/tools/reg/reg.c +++ b/winpr/tools/reg/reg.c @@ -41,7 +41,7 @@ int main(int argc, char* argv[]) if (status != ERROR_SUCCESS) { - tprintf(_T("RegOpenKeyEx error: 0x%08lX\n"), status); + _tprintf(_T("RegOpenKeyEx error: 0x%08lX\n"), status); return 0; } @@ -50,7 +50,7 @@ int main(int argc, char* argv[]) if (status != ERROR_SUCCESS) { - tprintf(_T("RegQueryValueEx error: 0x%08lX\n"), status); + _tprintf(_T("RegQueryValueEx error: 0x%08lX\n"), status); return 0; } @@ -60,7 +60,7 @@ int main(int argc, char* argv[]) if (status != ERROR_SUCCESS) { - tprintf(_T("RegQueryValueEx error: 0x%08lX\n"), status); + _tprintf(_T("RegQueryValueEx error: 0x%08lX\n"), status); return 0; } @@ -70,7 +70,7 @@ int main(int argc, char* argv[]) if (status != ERROR_SUCCESS) { - tprintf(_T("RegQueryValueEx error: 0x%08lX\n"), status); + _tprintf(_T("RegQueryValueEx error: 0x%08lX\n"), status); return 0; } diff --git a/winpr/utils/CMakeLists.txt b/winpr/utils/CMakeLists.txt index 2ee14dc52..12d24a0b7 100644 --- a/winpr/utils/CMakeLists.txt +++ b/winpr/utils/CMakeLists.txt @@ -25,6 +25,9 @@ set(WINPR_UTILS_SRCS add_library(winpr-utils ${WINPR_UTILS_SRCS}) +include_directories(${ZLIB_INCLUDE_DIRS}) +include_directories(${OPENSSL_INCLUDE_DIR}) + set_target_properties(winpr-utils PROPERTIES VERSION ${FREERDP_VERSION_FULL} SOVERSION ${FREERDP_VERSION} PREFIX "lib") if (NOT WIN32)