diff options
author | Marc-André Moreau <marcandre.moreau@gmail.com> | 2011-08-17 19:28:32 +0400 |
---|---|---|
committer | Marc-André Moreau <marcandre.moreau@gmail.com> | 2011-08-17 19:28:32 +0400 |
commit | dfafaa6de24d6bdc8a69297509b0e001d36d8ea7 (patch) | |
tree | 93b9ffe32a18ea7d52684827c1a69dffcee5d875 | |
parent | 0e2d46ec579cc8bd273b4ef46ccad9af71069a51 (diff) | |
parent | 15cee04fb84d7fe27782890cc22f11b41fc540f3 (diff) |
Merge pull request #59 from ynezz/ynezz-winfix
Make it compile on Windows again
-rw-r--r-- | include/freerdp/utils/profiler.h | 18 | ||||
-rw-r--r-- | include/freerdp/utils/usleep.h | 25 | ||||
-rw-r--r-- | libfreerdp-chanman/libchanman.c | 2 | ||||
-rw-r--r-- | libfreerdp-core/crypto/openssl.c | 11 | ||||
-rw-r--r-- | libfreerdp-core/ntlmssp.c | 4 | ||||
-rw-r--r-- | libfreerdp-rfx/rfx_decode.c | 4 | ||||
-rw-r--r-- | libfreerdp-utils/unicode.c | 3 | ||||
-rw-r--r-- | libfreerdp-utils/usleep.c | 45 | ||||
-rw-r--r-- | win/libfreerdp-core.vcxproj | 14 | ||||
-rw-r--r-- | win/libfreerdp-rfx.vcxproj | 1 | ||||
-rw-r--r-- | win/libfreerdp-utils.vcxproj | 2 | ||||
-rw-r--r-- | win/wfreerdp/wfreerdp.vcxproj | 2 |
12 files changed, 105 insertions, 26 deletions
diff --git a/include/freerdp/utils/profiler.h b/include/freerdp/utils/profiler.h index 1a149c1..22767cd 100644 --- a/include/freerdp/utils/profiler.h +++ b/include/freerdp/utils/profiler.h @@ -57,15 +57,15 @@ void profiler_print_footer(); #define PROFILER_PRINT(prof) profiler_print(prof) #define PROFILER_PRINT_FOOTER profiler_print_footer() #else -#define IF_PROFILER(then) ; -#define PROFILER_DEFINE(prof) ; -#define PROFILER_CREATE(prof,name) ; -#define PROFILER_FREE(prof) ; -#define PROFILER_ENTER(prof) ; -#define PROFILER_EXIT(prof) ; -#define PROFILER_PRINT_HEADER ; -#define PROFILER_PRINT(prof) ; -#define PROFILER_PRINT_FOOTER ; +#define IF_PROFILER +#define PROFILER_DEFINE(prof) void *prof +#define PROFILER_CREATE +#define PROFILER_FREE +#define PROFILER_ENTER +#define PROFILER_EXIT +#define PROFILER_PRINT_HEADER +#define PROFILER_PRINT +#define PROFILER_PRINT_FOOTER #endif #endif /* __UTILS_PROFILER_H */ diff --git a/include/freerdp/utils/usleep.h b/include/freerdp/utils/usleep.h new file mode 100644 index 0000000..75ff5a9 --- /dev/null +++ b/include/freerdp/utils/usleep.h @@ -0,0 +1,25 @@ +/* + FreeRDP: A Remote Desktop Protocol client. + usleep implementation + + Copyright 2011 Petr Stetiar <ynezz@true.cz> + + 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 __UTILS_USLEEP_H +#define __UTILS_USLEEP_H + +void freerdp_usleep(uint32 delay); + +#endif /* __UTILS_USLEEP_H */ diff --git a/libfreerdp-chanman/libchanman.c b/libfreerdp-chanman/libchanman.c index 1a82743..03b34ec 100644 --- a/libfreerdp-chanman/libchanman.c +++ b/libfreerdp-chanman/libchanman.c @@ -43,7 +43,7 @@ #define MUTEX_UNLOCK(m) ReleaseMutex(m) #define MUTEX_DESTROY(m) CloseHandle(m) #define SEMAPHORE HANDLE -#define SEMAPHORE_INIT(s, i, m) s = CreateSemaphore(NULL, i, m, NULL) +#define SEMAPHORE_INIT(s, m) s = CreateSemaphore(NULL, m, 1<<16, NULL) #define SEMAPHORE_WAIT(s) WaitForSingleObject(s, INFINITE) #define SEMAPHORE_POST(s) ReleaseSemaphore(s, 1, NULL) #define SEMAPHORE_DESTROY(s) CloseHandle(s) diff --git a/libfreerdp-core/crypto/openssl.c b/libfreerdp-core/crypto/openssl.c index 507288c..e85b4a0 100644 --- a/libfreerdp-core/crypto/openssl.c +++ b/libfreerdp-core/crypto/openssl.c @@ -21,8 +21,8 @@ #include "crypto.h" #include <freerdp/types/base.h> #include <freerdp/utils/memory.h> +#include <freerdp/utils/usleep.h> #include <freerdp/constants/constants.h> -#include <time.h> #include "tls.h" #include "crypto/openssl.h" @@ -351,7 +351,6 @@ struct rdp_tls { SSL_CTX * ctx; SSL * ssl; - struct timespec ts; }; RD_BOOL @@ -431,10 +430,6 @@ tls_new(void) SSL_CTX_set_options(tls->ctx, SSL_OP_ALL); - /* a small 0.1ms delay when network blocking happens. */ - tls->ts.tv_sec = 0; - tls->ts.tv_nsec = 100000; - return tls; } @@ -522,7 +517,7 @@ tls_write(rdpTls * tls, char* b, int length) break; case SSL_ERROR_WANT_WRITE: - nanosleep(&tls->ts, NULL); + freerdp_usleep(1000); break; default: @@ -551,7 +546,7 @@ tls_read(rdpTls * tls, char* b, int length) break; case SSL_ERROR_WANT_READ: - nanosleep(&tls->ts, NULL); + freerdp_usleep(1000); break; default: diff --git a/libfreerdp-core/ntlmssp.c b/libfreerdp-core/ntlmssp.c index 46a55b1..218d10f 100644 --- a/libfreerdp-core/ntlmssp.c +++ b/libfreerdp-core/ntlmssp.c @@ -17,6 +17,10 @@ limitations under the License. */ +#ifdef WIN32 +#define _WINSOCKAPI_ +#endif + #include <time.h> #include <openssl/des.h> #include <openssl/md4.h> diff --git a/libfreerdp-rfx/rfx_decode.c b/libfreerdp-rfx/rfx_decode.c index 8dc8853..c57dba3 100644 --- a/libfreerdp-rfx/rfx_decode.c +++ b/libfreerdp-rfx/rfx_decode.c @@ -27,7 +27,11 @@ #include "rfx_decode.h" +#ifdef WIN32 +static __inline void +#else static __inline void __attribute__((__gnu_inline__, __always_inline__, __artificial__)) +#endif rfx_decode_format_RGB(sint16 * r_buf, sint16 * g_buf, sint16 * b_buf, RFX_PIXEL_FORMAT pixel_format, uint8 * dst_buf) { diff --git a/libfreerdp-utils/unicode.c b/libfreerdp-utils/unicode.c index c4c6fc7..13cdc4c 100644 --- a/libfreerdp-utils/unicode.c +++ b/libfreerdp-utils/unicode.c @@ -17,7 +17,10 @@ limitations under the License. */ +#ifdef HAVE_CONFIG_H #include "config.h" +#endif + #include <errno.h> #include <freerdp/utils/memory.h> diff --git a/libfreerdp-utils/usleep.c b/libfreerdp-utils/usleep.c new file mode 100644 index 0000000..efc13fc --- /dev/null +++ b/libfreerdp-utils/usleep.c @@ -0,0 +1,45 @@ +/* + FreeRDP: A Remote Desktop Protocol client. + usleep implementation + + Copyright 2011 Petr Stetiar <ynezz@true.cz> + + 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. +*/ + +#ifdef _WIN32 +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN +#endif +#include <winsock2.h> +#endif + +#include <time.h> + +#include <freerdp/types/base.h> +#include <freerdp/utils/usleep.h> + +void freerdp_usleep(uint32 delay) +{ +#ifdef WIN32 + struct timeval tv; + tv.tv_sec = 0; + tv.tv_usec = delay; + select(0, NULL, NULL, NULL, &tv); +#else + struct timespec ts; + ts.tv_sec = 0; + ts.tv_nsec = delay * 1000; + nanosleep(&ts, NULL); +#endif +} diff --git a/win/libfreerdp-core.vcxproj b/win/libfreerdp-core.vcxproj index 7eddeef..6525718 100644 --- a/win/libfreerdp-core.vcxproj +++ b/win/libfreerdp-core.vcxproj @@ -47,7 +47,7 @@ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <ClCompile> <Optimization>Disabled</Optimization> - <AdditionalIncludeDirectories>..\include;C:\OpenSSL\include;..\libfreerdp-asn1;..\libfreerdp-core</AdditionalIncludeDirectories> + <AdditionalIncludeDirectories>..\include;..\..\openssl\build\win32-static\include;..\libfreerdp-asn1;..\libfreerdp-core</AdditionalIncludeDirectories> <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;FREERDP_EXPORTS;FREERDP_CHANMAN_EXPORTS;WIN32_LEAN_AND_MEAN;_CRT_SECURE_NO_WARNINGS;L_ENDIAN;EXT_PATH="extensions";%(PreprocessorDefinitions)</PreprocessorDefinitions> <MinimalRebuild>true</MinimalRebuild> <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> @@ -60,7 +60,7 @@ </ClCompile> <Link> <AdditionalDependencies>ws2_32.lib;libeay32.lib;ssleay32.lib;%(AdditionalDependencies)</AdditionalDependencies> - <AdditionalLibraryDirectories>C:\OpenSSL\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> + <AdditionalLibraryDirectories>..\..\openssl\build\win32-static\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> <GenerateDebugInformation>true</GenerateDebugInformation> <SubSystem>Windows</SubSystem> <TargetMachine>MachineX86</TargetMachine> @@ -70,7 +70,7 @@ <ClCompile> <Optimization>MaxSpeed</Optimization> <IntrinsicFunctions>true</IntrinsicFunctions> - <AdditionalIncludeDirectories>..\include;..;C:\OpenSSL\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <AdditionalIncludeDirectories>..\include;..\..\openssl\build\win32-static\include;..\libfreerdp-asn1;..\libfreerdp-core</AdditionalIncludeDirectories> <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;FREERDP_EXPORTS;_CRT_SECURE_NO_WARNINGS;L_ENDIAN;EXT_PATH="extensions";%(PreprocessorDefinitions)</PreprocessorDefinitions> <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> <FunctionLevelLinking>true</FunctionLevelLinking> @@ -81,7 +81,7 @@ </ClCompile> <Link> <AdditionalDependencies>ws2_32.lib;libeay32.lib;ssleay32.lib;%(AdditionalDependencies)</AdditionalDependencies> - <AdditionalLibraryDirectories>C:\OpenSSL\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> + <AdditionalLibraryDirectories>..\..\openssl\build\win32-static\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> <GenerateDebugInformation>true</GenerateDebugInformation> <SubSystem>Windows</SubSystem> <OptimizeReferences>true</OptimizeReferences> @@ -95,6 +95,7 @@ <ClCompile Include="..\libfreerdp-core\cache.c" /> <ClCompile Include="..\libfreerdp-core\capabilities.c" /> <ClCompile Include="..\libfreerdp-core\chan.c" /> + <ClCompile Include="..\libfreerdp-core\connect.c" /> <ClCompile Include="..\libfreerdp-core\credssp.c" /> <ClCompile Include="..\libfreerdp-core\crypto\openssl.c" /> <ClCompile Include="..\libfreerdp-core\ext.c" /> @@ -104,12 +105,13 @@ <ClCompile Include="..\libfreerdp-core\mcs.c" /> <ClCompile Include="..\libfreerdp-core\mppc.c" /> <ClCompile Include="..\libfreerdp-core\nego.c" /> + <ClCompile Include="..\libfreerdp-core\network.c" /> <ClCompile Include="..\libfreerdp-core\ntlmssp.c" /> <ClCompile Include="..\libfreerdp-core\orders.c" /> <ClCompile Include="..\libfreerdp-core\pstcache.c" /> <ClCompile Include="..\libfreerdp-core\rail.c" /> <ClCompile Include="..\libfreerdp-core\rdp.c" /> - <ClCompile Include="..\libfreerdp-core\secure.c" /> + <ClCompile Include="..\libfreerdp-core\security.c" /> <ClCompile Include="..\libfreerdp-core\stream.c" /> <ClCompile Include="..\libfreerdp-core\surface.c" /> <ClCompile Include="..\libfreerdp-core\tcp.c" /> @@ -137,7 +139,7 @@ <ClInclude Include="..\libfreerdp-core\pstcache.h" /> <ClInclude Include="..\libfreerdp-core\rail.h" /> <ClInclude Include="..\libfreerdp-core\rdp.h" /> - <ClInclude Include="..\libfreerdp-core\secure.h" /> + <ClInclude Include="..\libfreerdp-core\security.h" /> <ClInclude Include="..\libfreerdp-core\stream.h" /> <ClInclude Include="..\libfreerdp-core\surface.h" /> <ClInclude Include="..\libfreerdp-core\tcp.h" /> diff --git a/win/libfreerdp-rfx.vcxproj b/win/libfreerdp-rfx.vcxproj index cf3b432..80d1237 100644 --- a/win/libfreerdp-rfx.vcxproj +++ b/win/libfreerdp-rfx.vcxproj @@ -22,7 +22,6 @@ <ClInclude Include="..\libfreerdp-rfx\rfx_rlgr.h" /> </ItemGroup> <ItemGroup> - <ClCompile Include="..\libfreerdp-rfx\rfx.c" /> <ClCompile Include="..\libfreerdp-rfx\rfx_bitstream.c" /> <ClCompile Include="..\libfreerdp-rfx\rfx_decode.c" /> <ClCompile Include="..\libfreerdp-rfx\rfx_differential.c" /> diff --git a/win/libfreerdp-utils.vcxproj b/win/libfreerdp-utils.vcxproj index 7cf6ba9..1d9c10f 100644 --- a/win/libfreerdp-utils.vcxproj +++ b/win/libfreerdp-utils.vcxproj @@ -73,8 +73,10 @@ </ItemDefinitionGroup> <ItemGroup> <ClCompile Include="..\libfreerdp-utils\datablob.c" /> + <ClCompile Include="..\libfreerdp-utils\hexdump.c" /> <ClCompile Include="..\libfreerdp-utils\memory.c" /> <ClCompile Include="..\libfreerdp-utils\unicode.c" /> + <ClCompile Include="..\libfreerdp-utils\usleep.c" /> </ItemGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <ImportGroup Label="ExtensionTargets"> diff --git a/win/wfreerdp/wfreerdp.vcxproj b/win/wfreerdp/wfreerdp.vcxproj index d6660f7..34475e6 100644 --- a/win/wfreerdp/wfreerdp.vcxproj +++ b/win/wfreerdp/wfreerdp.vcxproj @@ -70,7 +70,7 @@ <ClCompile> <Optimization>MaxSpeed</Optimization> <IntrinsicFunctions>true</IntrinsicFunctions> - <AdditionalIncludeDirectories>..\..\libgdi;..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <AdditionalIncludeDirectories>..\..\libfreerdp-gdi;..\..\libfreerdp-rfx;..\..\include</AdditionalIncludeDirectories> <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_CRT_SECURE_NO_WARNINGS;PACKAGE_VERSION="unknown";%(PreprocessorDefinitions)</PreprocessorDefinitions> <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> <FunctionLevelLinking>true</FunctionLevelLinking> |