Skip to content

Commit

Permalink
Merge pull request FreeRDP#59 from ynezz/ynezz-winfix
Browse files Browse the repository at this point in the history
Make it compile on Windows again
  • Loading branch information
awakecoding committed Aug 17, 2011
2 parents 0e2d46e + 15cee04 commit dfafaa6
Show file tree
Hide file tree
Showing 12 changed files with 105 additions and 26 deletions.
18 changes: 9 additions & 9 deletions include/freerdp/utils/profiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
25 changes: 25 additions & 0 deletions include/freerdp/utils/usleep.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/*
FreeRDP: A Remote Desktop Protocol client.
usleep implementation
Copyright 2011 Petr Stetiar <[email protected]>
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 */
2 changes: 1 addition & 1 deletion libfreerdp-chanman/libchanman.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
11 changes: 3 additions & 8 deletions libfreerdp-core/crypto/openssl.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -351,7 +351,6 @@ struct rdp_tls
{
SSL_CTX * ctx;
SSL * ssl;
struct timespec ts;
};

RD_BOOL
Expand Down Expand Up @@ -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;
}

Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down
4 changes: 4 additions & 0 deletions libfreerdp-core/ntlmssp.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@
limitations under the License.
*/

#ifdef WIN32
#define _WINSOCKAPI_
#endif

#include <time.h>
#include <openssl/des.h>
#include <openssl/md4.h>
Expand Down
4 changes: 4 additions & 0 deletions libfreerdp-rfx/rfx_decode.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
3 changes: 3 additions & 0 deletions libfreerdp-utils/unicode.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@
limitations under the License.
*/

#ifdef HAVE_CONFIG_H
#include "config.h"
#endif

#include <errno.h>
#include <freerdp/utils/memory.h>

Expand Down
45 changes: 45 additions & 0 deletions libfreerdp-utils/usleep.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/*
FreeRDP: A Remote Desktop Protocol client.
usleep implementation
Copyright 2011 Petr Stetiar <[email protected]>
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
}
14 changes: 8 additions & 6 deletions win/libfreerdp-core.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand All @@ -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>
Expand All @@ -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>
Expand All @@ -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>
Expand All @@ -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" />
Expand All @@ -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" />
Expand Down Expand Up @@ -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" />
Expand Down
1 change: 0 additions & 1 deletion win/libfreerdp-rfx.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -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" />
Expand Down
2 changes: 2 additions & 0 deletions win/libfreerdp-utils.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -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">
Expand Down
2 changes: 1 addition & 1 deletion win/wfreerdp/wfreerdp.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down

0 comments on commit dfafaa6

Please sign in to comment.