diff --git a/include/winpr/crt.h b/include/winpr/crt.h index d0b889b49..6bc32dd6c 100644 --- a/include/winpr/crt.h +++ b/include/winpr/crt.h @@ -25,10 +25,6 @@ #include -#ifdef _WIN32 -#include -#endif - #include #include diff --git a/include/winpr/wtypes.h b/include/winpr/wtypes.h index af905f875..a8a9b0ad9 100644 --- a/include/winpr/wtypes.h +++ b/include/winpr/wtypes.h @@ -78,7 +78,6 @@ typedef const wchar_t* LPCWSTR; typedef char* PSTR, *LPSTR; typedef wchar_t* LPWSTR, *PWSTR; -typedef long NTSTATUS; typedef unsigned __int64 QWORD; typedef UCHAR* STRING; @@ -187,4 +186,9 @@ typedef PCONTEXT_HANDLE* PPCONTEXT_HANDLE; typedef unsigned long error_status_t; +#ifndef _NTDEF_ +typedef LONG NTSTATUS; +typedef NTSTATUS *PNTSTATUS; +#endif + #endif /* WINPR_WTYPES_H */ diff --git a/libfreerdp-core/CMakeLists.txt b/libfreerdp-core/CMakeLists.txt index 4161e101e..45cbe2947 100644 --- a/libfreerdp-core/CMakeLists.txt +++ b/libfreerdp-core/CMakeLists.txt @@ -104,12 +104,14 @@ endif() target_link_libraries(freerdp-core freerdp-utils) target_link_libraries(freerdp-core freerdp-codec) -target_link_libraries(freerdp-core freerdp-crypto) target_link_libraries(freerdp-core freerdp-locale) -target_link_libraries(freerdp-core ${OPENSSL_LIBRARIES}) +target_link_libraries(freerdp-core winpr-utils) target_link_libraries(freerdp-core winpr-rpc) target_link_libraries(freerdp-core winpr-sspi) +target_link_libraries(freerdp-core freerdp-crypto) +target_link_libraries(freerdp-core ${OPENSSL_LIBRARIES}) + install(TARGETS freerdp-core DESTINATION ${CMAKE_INSTALL_LIBDIR}) diff --git a/libfreerdp-crypto/CMakeLists.txt b/libfreerdp-crypto/CMakeLists.txt index 641cd09e3..a2f6822fc 100644 --- a/libfreerdp-crypto/CMakeLists.txt +++ b/libfreerdp-crypto/CMakeLists.txt @@ -40,6 +40,7 @@ else() target_link_libraries(freerdp-crypto ${ZLIB_LIBRARIES}) endif() +target_link_libraries(freerdp-crypto winpr-sspi) target_link_libraries(freerdp-crypto freerdp-utils) target_link_libraries(freerdp-crypto ${OPENSSL_LIBRARIES}) diff --git a/winpr/sspi/CMakeLists.txt b/winpr/sspi/CMakeLists.txt index 3aa3e49b7..8ac379c97 100644 --- a/winpr/sspi/CMakeLists.txt +++ b/winpr/sspi/CMakeLists.txt @@ -56,8 +56,8 @@ endif() add_library(winpr-sspi ${WINPR_SSPI_SRCS}) -include_directories(${OPENSSL_INCLUDE_DIR}) include_directories(${ZLIB_INCLUDE_DIRS}) +include_directories(${OPENSSL_INCLUDE_DIR}) set_target_properties(winpr-sspi PROPERTIES VERSION ${FREERDP_VERSION_FULL} SOVERSION ${FREERDP_VERSION} PREFIX "lib") @@ -66,7 +66,8 @@ if (NOT WIN32) endif() target_link_libraries(winpr-sspi winpr-utils) -target_link_libraries(winpr-sspi ${ZLIB_LIBRARIES}) +target_link_libraries(winpr-sspi ${ZLIB_LIBRARIES}) +target_link_libraries(winpr-sspi ${OPENSSL_LIBRARIES}) install(TARGETS winpr-sspi DESTINATION ${CMAKE_INSTALL_LIBDIR}) diff --git a/winpr/sspi/sspi.c b/winpr/sspi/sspi.c index 6374a8da4..40a1bb9f8 100644 --- a/winpr/sspi/sspi.c +++ b/winpr/sspi/sspi.c @@ -110,7 +110,8 @@ void sspi_ContextBufferAllocTableNew() size = sizeof(CONTEXT_BUFFER_ALLOC_ENTRY) * ContextBufferAllocTable.cMaxEntries; - ContextBufferAllocTable.entries = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, size); + ContextBufferAllocTable.entries = malloc(size); + ZeroMemory(ContextBufferAllocTable.entries, size); } void sspi_ContextBufferAllocTableGrow() @@ -128,7 +129,7 @@ void sspi_ContextBufferAllocTableGrow() void sspi_ContextBufferAllocTableFree() { ContextBufferAllocTable.cEntries = ContextBufferAllocTable.cMaxEntries = 0; - HeapFree(GetProcessHeap(), 0, ContextBufferAllocTable.entries); + free(ContextBufferAllocTable.entries); } void* sspi_ContextBufferAlloc(UINT32 allocatorIndex, size_t size) @@ -140,7 +141,8 @@ void* sspi_ContextBufferAlloc(UINT32 allocatorIndex, size_t size) { if (ContextBufferAllocTable.entries[index].contextBuffer == NULL) { - contextBuffer = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, size); + contextBuffer = malloc(size); + ZeroMemory(contextBuffer, size); ContextBufferAllocTable.cEntries++; ContextBufferAllocTable.entries[index].contextBuffer = contextBuffer; @@ -163,7 +165,8 @@ CREDENTIALS* sspi_CredentialsNew() { CREDENTIALS* credentials; - credentials = (CREDENTIALS*) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(CREDENTIALS)); + credentials = (CREDENTIALS*) malloc(sizeof(CREDENTIALS)); + ZeroMemory(credentials, sizeof(CREDENTIALS)); if (credentials != NULL) { @@ -178,25 +181,26 @@ void sspi_CredentialsFree(CREDENTIALS* credentials) if (!credentials) return; - HeapFree(GetProcessHeap(), 0, credentials); + free(credentials); } void sspi_SecBufferAlloc(PSecBuffer SecBuffer, size_t size) { SecBuffer->cbBuffer = size; - SecBuffer->pvBuffer = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, size); + SecBuffer->pvBuffer = malloc(size); + ZeroMemory(SecBuffer->pvBuffer, SecBuffer->cbBuffer); } void sspi_SecBufferFree(PSecBuffer SecBuffer) { - SecBuffer->cbBuffer = 0; - HeapFree(GetProcessHeap(), 0, SecBuffer->pvBuffer); + free(SecBuffer->pvBuffer); SecBuffer->pvBuffer = NULL; + SecBuffer->cbBuffer = 0; } SecHandle* sspi_SecureHandleAlloc() { - SecHandle* handle = malloc(sizeof(SecHandle)); + SecHandle* handle = (SecHandle*) malloc(sizeof(SecHandle)); sspi_SecureHandleInit(handle); return handle; } diff --git a/winpr/utils/CMakeLists.txt b/winpr/utils/CMakeLists.txt index 8568d17fd..33b1c427c 100644 --- a/winpr/utils/CMakeLists.txt +++ b/winpr/utils/CMakeLists.txt @@ -25,7 +25,9 @@ add_library(winpr-utils ${WINPR_UTILS_SRCS}) set_target_properties(winpr-utils PROPERTIES VERSION ${FREERDP_VERSION_FULL} SOVERSION ${FREERDP_VERSION} PREFIX "lib") -target_link_libraries(winpr-utils winpr-crt) +if (NOT WIN32) + target_link_libraries(winpr-utils winpr-crt) +endif() install(TARGETS winpr-utils DESTINATION ${CMAKE_INSTALL_LIBDIR})