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
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()
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.
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.