winpr: fix compilation on Windows

This commit is contained in:
Marc-André Moreau 2012-05-25 16:42:35 -04:00
parent 138321bc2f
commit 337bcf7605
7 changed files with 29 additions and 19 deletions

View File

@ -25,10 +25,6 @@
#include <winpr/winpr.h>
#ifdef _WIN32
#include <winnls.h>
#endif
#include <winpr/string.h>
#include <winpr/memory.h>

View File

@ -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 */

View File

@ -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})

View File

@ -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})

View File

@ -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})

View File

@ -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;
}

View File

@ -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})