winpr: move wtypes.h and windows.h

This commit is contained in:
Marc-André Moreau 2012-05-04 19:36:35 -04:00
parent be1e7f8291
commit e1e3f12114
26 changed files with 89 additions and 36 deletions

View File

@ -79,6 +79,7 @@ if(MSVC)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /O2 /Ob2") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /O2 /Ob2")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_X86_") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_X86_")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_UNICODE") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_UNICODE")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWINPR_EXPORTS")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DFREERDP_EXPORTS") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DFREERDP_EXPORTS")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_CRT_SECURE_NO_WARNINGS") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_CRT_SECURE_NO_WARNINGS")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWIN32_LEAN_AND_MEAN") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWIN32_LEAN_AND_MEAN")

View File

@ -19,7 +19,7 @@
* limitations under the License. * limitations under the License.
*/ */
#include <freerdp/utils/windows.h> #include <winpr/windows.h>
#include <errno.h> #include <errno.h>
#include <stdio.h> #include <stdio.h>

View File

@ -22,7 +22,7 @@
#ifndef __WFREERDP_H #ifndef __WFREERDP_H
#define __WFREERDP_H #define __WFREERDP_H
#include <freerdp/utils/windows.h> #include <winpr/windows.h>
#include <freerdp/freerdp.h> #include <freerdp/freerdp.h>
#include <freerdp/gdi/gdi.h> #include <freerdp/gdi/gdi.h>

View File

@ -21,7 +21,7 @@
#define FREERDP_CRYPTO_H #define FREERDP_CRYPTO_H
/* OpenSSL includes windows.h */ /* OpenSSL includes windows.h */
#include <freerdp/utils/windows.h> #include <winpr/windows.h>
#include <openssl/ssl.h> #include <openssl/ssl.h>
#include <openssl/err.h> #include <openssl/err.h>

View File

@ -21,10 +21,10 @@
#define FREERDP_SSPI_H #define FREERDP_SSPI_H
#include <wchar.h> #include <wchar.h>
#include <winpr/windows.h>
#include <freerdp/api.h> #include <freerdp/api.h>
#include <freerdp/types.h> #include <freerdp/types.h>
#include <freerdp/utils/windows.h>
#ifdef _WIN32 #ifdef _WIN32

View File

@ -20,10 +20,8 @@
#ifndef WINPR_RPC_NDR_H #ifndef WINPR_RPC_NDR_H
#define WINPR_RPC_NDR_H #define WINPR_RPC_NDR_H
#include "config.h"
#include <winpr/rpc.h> #include <winpr/rpc.h>
#include <freerdp/wtypes.h> #include <winpr/wtypes.h>
#define __RPC_WIN32__ 1 #define __RPC_WIN32__ 1
#define TARGET_IS_NT50_OR_LATER 1 #define TARGET_IS_NT50_OR_LATER 1

View File

@ -20,11 +20,10 @@
#ifndef WINPR_RPC_H #ifndef WINPR_RPC_H
#define WINPR_RPC_H #define WINPR_RPC_H
#include <freerdp/api.h> #include <winpr/winpr.h>
#include <freerdp/wtypes.h> #include <winpr/wtypes.h>
#define RPC_VAR_ENTRY __cdecl #define RPC_VAR_ENTRY __cdecl
#define WINPR_API FREERDP_API
typedef long RPC_STATUS; typedef long RPC_STATUS;

View File

@ -1,6 +1,6 @@
/** /**
* FreeRDP: A Remote Desktop Protocol Client * WinPR: Windows Portable Runtime
* Windows Header Utils * Windows Header Include Wrapper
* *
* Copyright 2012 Marc-Andre Moreau <marcandre.moreau@gmail.com> * Copyright 2012 Marc-Andre Moreau <marcandre.moreau@gmail.com>
* *
@ -17,8 +17,8 @@
* limitations under the License. * limitations under the License.
*/ */
#ifndef FREERDP_WINDOWS_UTILS_H #ifndef WINPR_WINDOWS_H
#define FREERDP_WINDOWS_UTILS_H #define WINPR_WINDOWS_H
/* Windows header include order is important, use this instead of including windows.h directly */ /* Windows header include order is important, use this instead of including windows.h directly */
@ -34,4 +34,4 @@
#endif #endif
#endif /* FREERDP_WINDOWS_UTILS_H */ #endif /* WINPR_WINDOWS_H */

52
include/winpr/winpr.h Normal file
View File

@ -0,0 +1,52 @@
/**
* WinPR: Windows Portable Runtime
*
* Copyright 2012 Marc-Andre Moreau <marcandre.moreau@gmail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef WINPR_H
#define WINPR_H
#include "config.h"
#if defined _WIN32 || defined __CYGWIN__
#ifdef WINPR_EXPORTS
#ifdef __GNUC__
#define WINPR_API __attribute__((dllexport))
#else
#define WINPR_API __declspec(dllexport)
#endif
#else
#ifdef __GNUC__
#define WINPR_API __attribute__((dllimport))
#else
#define WINPR_API __declspec(dllimport)
#endif
#endif
#else
#if __GNUC__ >= 4
#define WINPR_API __attribute__ ((visibility("default")))
#else
#define WINPR_API
#endif
#endif
#ifdef _WIN32
#define INLINE __inline
#else
#define INLINE inline
#endif
#endif /* WINPR_H */

View File

@ -1,5 +1,5 @@
/** /**
* FreeRDP: A Remote Desktop Protocol Client * WinPR: Windows Portable Runtime
* Windows Data Types * Windows Data Types
* *
* Copyright 2012 Marc-Andre Moreau <marcandre.moreau@gmail.com> * Copyright 2012 Marc-Andre Moreau <marcandre.moreau@gmail.com>
@ -17,15 +17,14 @@
* limitations under the License. * limitations under the License.
*/ */
#ifndef FREERDP_WINDOWS_TYPES_H #ifndef WINPR_WTYPES_H
#define FREERDP_WINDOWS_TYPES_H #define WINPR_WTYPES_H
/* MSDN: Windows Data Types - http://msdn.microsoft.com/en-us/library/aa383751/ */ /* MSDN: Windows Data Types - http://msdn.microsoft.com/en-us/library/aa383751/ */
/* [MS-DTYP]: Windows Data Types - http://msdn.microsoft.com/en-us/library/cc230273/ */ /* [MS-DTYP]: Windows Data Types - http://msdn.microsoft.com/en-us/library/cc230273/ */
#include <wchar.h> #include <wchar.h>
#include <freerdp/types.h> #include <winpr/windows.h>
#include <freerdp/utils/windows.h>
#ifndef _WIN32 #ifndef _WIN32
@ -182,4 +181,4 @@ typedef PCONTEXT_HANDLE* PPCONTEXT_HANDLE;
typedef unsigned long error_status_t; typedef unsigned long error_status_t;
#endif /* FREERDP_WINDOWS_TYPES_H */ #endif /* WINPR_WTYPES_H */

View File

@ -21,10 +21,11 @@
#ifndef __EXTENSION_H #ifndef __EXTENSION_H
#define __EXTENSION_H #define __EXTENSION_H
#include <winpr/windows.h>
#include <freerdp/api.h> #include <freerdp/api.h>
#include <freerdp/freerdp.h> #include <freerdp/freerdp.h>
#include <freerdp/extension.h> #include <freerdp/extension.h>
#include <freerdp/utils/windows.h>
#define FREERDP_EXT_MAX_COUNT 16 #define FREERDP_EXT_MAX_COUNT 16

View File

@ -756,7 +756,7 @@ int rpc_read(rdpRpc* rpc, uint8* data, int length)
if (rpc->read_buffer_len > 0) if (rpc->read_buffer_len > 0)
{ {
if (rpc->read_buffer_len > length) if (rpc->read_buffer_len > (uint32) length)
{ {
printf("rpc_read error: receiving buffer is not large enough\n"); printf("rpc_read error: receiving buffer is not large enough\n");
return -1; return -1;

View File

@ -21,7 +21,7 @@
#ifndef __TCP_H #ifndef __TCP_H
#define __TCP_H #define __TCP_H
#include <freerdp/utils/windows.h> #include <winpr/windows.h>
#include <freerdp/types.h> #include <freerdp/types.h>
#include <freerdp/settings.h> #include <freerdp/settings.h>

View File

@ -27,10 +27,10 @@ typedef struct rdp_tsg rdpTsg;
#include "transport.h" #include "transport.h"
#include <winpr/rpc.h> #include <winpr/rpc.h>
#include <winpr/winpr.h>
#include <time.h> #include <time.h>
#include <freerdp/types.h> #include <freerdp/types.h>
#include <freerdp/wtypes.h>
#include <freerdp/settings.h> #include <freerdp/settings.h>
#include <freerdp/utils/stream.h> #include <freerdp/utils/stream.h>
#include <freerdp/utils/wait_obj.h> #include <freerdp/utils/wait_obj.h>

View File

@ -17,11 +17,11 @@
* limitations under the License. * limitations under the License.
*/ */
#include <winpr/windows.h>
#include <freerdp/utils/stream.h> #include <freerdp/utils/stream.h>
#include <freerdp/utils/memory.h> #include <freerdp/utils/memory.h>
#include <freerdp/utils/hexdump.h> #include <freerdp/utils/hexdump.h>
#include <freerdp/utils/unicode.h> #include <freerdp/utils/unicode.h>
#include <freerdp/utils/windows.h>
#include "librail.h" #include "librail.h"

View File

@ -34,8 +34,8 @@
#define getcwd _getcwd #define getcwd _getcwd
#endif #endif
#include <winpr/windows.h>
#include <freerdp/utils/file.h> #include <freerdp/utils/file.h>
#include <freerdp/utils/windows.h>
#ifndef _WIN32 #ifndef _WIN32
#define PATH_SEPARATOR_STR "/" #define PATH_SEPARATOR_STR "/"

View File

@ -22,11 +22,11 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <winpr/windows.h>
#include <freerdp/utils/file.h> #include <freerdp/utils/file.h>
#include <freerdp/utils/print.h> #include <freerdp/utils/print.h>
#include <freerdp/utils/memory.h> #include <freerdp/utils/memory.h>
#include <freerdp/utils/load_plugin.h> #include <freerdp/utils/load_plugin.h>
#include <freerdp/utils/windows.h>
#ifdef _WIN32 #ifdef _WIN32

View File

@ -17,9 +17,9 @@
* limitations under the License. * limitations under the License.
*/ */
#include <winpr/windows.h>
#include <freerdp/utils/memory.h> #include <freerdp/utils/memory.h>
#include <freerdp/utils/mutex.h> #include <freerdp/utils/mutex.h>
#include <freerdp/utils/windows.h>
#ifdef _WIN32 #ifdef _WIN32
#define freerdp_mutex_t HANDLE #define freerdp_mutex_t HANDLE

View File

@ -17,9 +17,9 @@
* limitations under the License. * limitations under the License.
*/ */
#include <winpr/windows.h>
#include <freerdp/utils/memory.h> #include <freerdp/utils/memory.h>
#include <freerdp/utils/semaphore.h> #include <freerdp/utils/semaphore.h>
#include <freerdp/utils/windows.h>
#if defined __APPLE__ #if defined __APPLE__

View File

@ -17,8 +17,8 @@
* limitations under the License. * limitations under the License.
*/ */
#include <winpr/windows.h>
#include <freerdp/utils/sleep.h> #include <freerdp/utils/sleep.h>
#include <freerdp/utils/windows.h>
#include <time.h> #include <time.h>

View File

@ -45,7 +45,7 @@
#else /* ifdef _WIN32 */ #else /* ifdef _WIN32 */
#include <freerdp/utils/windows.h> #include <winpr/windows.h>
#define SHUT_RDWR SD_BOTH #define SHUT_RDWR SD_BOTH
#define close(_fd) closesocket(_fd) #define close(_fd) closesocket(_fd)
#endif #endif

View File

@ -22,7 +22,7 @@
#include <string.h> #include <string.h>
#include <time.h> #include <time.h>
#include <freerdp/utils/windows.h> #include <winpr/windows.h>
#ifdef _WIN32 #ifdef _WIN32
#ifdef _MSC_VER #ifdef _MSC_VER

View File

@ -17,8 +17,8 @@
* limitations under the License. * limitations under the License.
*/ */
#include <winpr/windows.h>
#include <freerdp/utils/time.h> #include <freerdp/utils/time.h>
#include <freerdp/utils/windows.h>
uint64 freerdp_windows_gmtime() uint64 freerdp_windows_gmtime()
{ {

View File

@ -114,7 +114,7 @@ char* freerdp_uniconv_out(UNICONV* uniconv, const char *str, size_t* pout_len)
ibl = strlen(str); ibl = strlen(str);
obl = 2 * ibl; obl = 2 * ibl;
pin = str; pin = (char*) str;
pout0 = xmalloc(obl + 2); pout0 = xmalloc(obl + 2);
pout = pout0; pout = pout0;

View File

@ -18,12 +18,13 @@
*/ */
#include "config.h" #include "config.h"
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <winpr/windows.h>
#include <freerdp/utils/memory.h> #include <freerdp/utils/memory.h>
#include <freerdp/utils/wait_obj.h> #include <freerdp/utils/wait_obj.h>
#include <freerdp/utils/windows.h>
#ifndef _WIN32 #ifndef _WIN32
#include <sys/time.h> #include <sys/time.h>

View File

@ -17,6 +17,8 @@
* limitations under the License. * limitations under the License.
*/ */
#include <stdio.h>
#include <winpr/ndr.h> #include <winpr/ndr.h>
/** /**