Commit Graph

30 Commits

Author SHA1 Message Date
Armin Novak
7305828122 Fix #4239: Various memory leaks
* Fixed all tests, now can be run with -DWITH_ADDRESS_SANITIZER=ON compiled.
* Enabled address sanitizer for nightly builds.
2017-12-12 11:40:48 +01:00
Ondrej Holy
e5574f276a winpr/nt: Fix wide char string on big endian
Wide char strings are always little endian encoded and thus
Data_Write_UINT16 has to be used in _RtlAnsiStringToUnicodeString.
It fixes TestIoDevice on big endian machines among others.

https://github.com/FreeRDP/FreeRDP/issues/4231
2017-11-23 20:01:01 +01:00
Armin Novak
0490aeb018 Fixed clang malloc integer overflow warnings. 2017-07-20 09:29:48 +02:00
Norbert Federa
f71b6b46e8 fix string format specifiers
- fixed invalid, missing or additional arguments
- removed all type casts from arguments
- added missing (void*) typecasts for %p arguments
- use inttypes defines where appropriate
2016-12-16 13:48:43 +01:00
Norbert Federa
f2c825bb76 winpr: fix some tests
TestNtCreateFile, TestPipeCreateNamedPipeOverlapped
- These tests are currently only expected to succeed on _WIN32
- Also reflect the reverse meaning of this fact in the return values

TestSynchWaitableTimer, TestSynchWaitableTimerAPC:
- These tests are currently expected to fail on __APPLE__
- Also reflect the reverse meaning of this fact in the return values

This logic makes sure that we don't forget to fix the tests if the
corresponding WinPR implementations are fixed.

TestLibrary:
- TestLibraryA and TestLibraryB must always get built as shared libraries
2016-06-07 17:20:56 +02:00
Norbert Federa
e718fb324b fix race conditions, tests and some invalid return values
Since the current winpr implementation for overlapped operations is
incomplete and buggy, all affected functions will now fail if they are
called with a set FILE_FLAG_OVERLAPPED flag or a non-null pointer to
a OVERLAPPED structure.

winpr/nt:
- use proper one-time initialization on win32
- fix TestNtCreateFile
- fix broken/incomplete _RtlAnsiStringToUnicodeString
- unimplemented functions return appropriate error codes

winpr/pipe:
- improved TestPipeCreateNamedPipe
- rewrite the completely broken TestPipeCreateNamedPipeOverlapped test

rdtk:
- improve test and don't blindly return success

winpr/synch:
- fix race condition in TestSynchTimerQueue

winpr/ssspi:
- fix TestEnumerateSecurityPackages printf output
- fix TestQuerySecurityPackageInfo printf output

winpr/environment:
- fix GetEnvironmentStrings printf output

winpr/comm:
- unimplemented functions return appropriate error codes

winpr/io:
- unimplemented functions return appropriate error codes

winpr/thread:
- implement SwitchToThread() via sched_yield()
2016-06-01 16:26:26 +02:00
Marc-André Moreau
ceefc4b099 Merge branch 'master' of github.com:FreeRDP/FreeRDP 2016-03-07 10:19:50 -05:00
Armin Novak
68c402ac58 Removed windows module.def files.
All symbols exported from libraries are declared
using *_API defines.
2016-02-29 15:18:47 +01:00
Marc-André Moreau
d0f413db12 winpr: initial port to Universal Windows Platform (UWP) 2016-02-05 16:28:45 -05:00
Bernhard Miklautz
aa2709a999 winpr: create a specific winpr nt file handle
There exist two definitions of WINPR_FILE: in file/ and in nt/.
Both are different definitions used differently. Therefore split them
into WINPR_FILE and WINPR_NT_FILE.
2016-01-12 16:10:25 +01:00
David FORT
16d36e3083 A malloc() pass on WinPR
This patch treats remaining non-checked mallocs. And changes to calloc in places
where it makes sense
2015-06-22 19:10:00 +02:00
Norbert Federa
1eff1a345e free can handle NULL perfectly fine 2015-05-11 09:07:39 +02:00
Bernhard Miklautz
850de59b55 winpr: add checks for *alloc
Add missing checks if memory allocation was successful. Also adapt
caller(s) when possible.
2015-04-08 11:34:37 +02:00
Marc-André Moreau
398eab35d4 libwinpr-wtsapi: add Win32 winsta.dll-based VC implementation 2014-10-13 10:55:11 -04:00
Bernhard Miklautz
6a49bcfe40 winpr: always build "monolitic"
winpr is now always build as single library.
The build option MONOLITHIC_BUILD doesn't influence this behavior anymore.

The only exception is winpr-makecert-tool which is still build as extra
library.

This obsoletes complex_libraries for winpr.
2014-07-10 11:10:58 +02:00
Bernhard Miklautz
b817e92e5e cmake: mark required libraries for export 2014-04-23 10:16:02 +02:00
Bernhard Miklautz
2b6b4a6685 updated file headers 2013-12-04 11:44:22 +01:00
Marc-André Moreau
55565e056c freerdp: export targets 2013-10-28 23:06:39 -04:00
Marc-André Moreau
5fb65101e9 libwinpr-nt: make test successfully call NtCreateFile on Windows 2013-10-23 19:32:32 -04:00
Marc-André Moreau
e2fe00fd37 libwinpr-nt: load and make use of original Rtl* functions on Windows 2013-10-23 18:57:41 -04:00
Marc-André Moreau
1de70aa064 libwinpr-nt: dynamically load original NtCreateFile functions on Windows, extend tests 2013-10-23 18:15:10 -04:00
Marc-André Moreau
ebc096f2b2 libwinpr-nt: fix conflict for NtCreateFile on Windows 2013-10-22 21:38:16 -04:00
Marc-André Moreau
888812eaa0 libwinpr-nt: stub more of the native file API 2013-10-22 20:47:29 -04:00
Norbert Federa
6f9a8dbc1e winpr: greatly improved NtCurrentTeb performance
Use pthread_setspecific/pthread_getspecific to store/retrieve the thread
environment block (TEB). Use pthread_once to trigger the creation of that
data from within NtCurrentTeb.
This allows us to get rid of the process environment block stuff which
was only used to provide serialized access to a thread table in order to
retrieve the TEB.

NtCurrentTeb is currently only as a per-thread storage location for the
last error value used by SetLastError and GetLastError.

Also made the TestErrorSetLastError CTest a bit more demanding.
It makes sure the 4 threads run for at least 2 seconds.
Each thread constantly calls SetLastError with a random value and checks
if GetLastError returns the same value again. The total amount of
these iterations is calculated in order to measure the performance.

This change increases the NtCurrentTeb performance by roughly 50% on
linux and by several thousand percent (yes) on Mac OS X.

Thanks for watching.
2013-10-11 19:34:23 +02:00
Marc-André Moreau
e8a8c1cf7f winpr: fix crashing tests 2013-09-19 14:17:00 -04:00
Marc-André Moreau
0c17eb1a23 winpr: fix unit tests on Windows 2013-09-19 13:50:00 -04:00
Marc-André Moreau
8f1aceac6a libwinpr-nt: add missing link dependency 2013-09-16 17:49:16 -04:00
Marc-André Moreau
c1625c1ead libwinpr-wtsapi: start implementation, extend NtApi 2013-08-22 19:20:59 -04:00
Marc-André Moreau
d5679889f3 libwinpr-nt: start implementing core NTDLL functions 2013-08-22 13:30:44 -04:00
Marc-André Moreau
68ec10a9d9 libwinpr-nt: implement NtCurrentTeb() 2013-08-22 10:18:38 -04:00