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
This commit is contained in:
Ondrej Holy 2017-11-23 19:51:57 +01:00
parent 5dcd1ebb06
commit e5574f276a

View File

@ -27,6 +27,7 @@
#include <winpr/library.h>
#include <winpr/wlog.h>
#include <winpr/nt.h>
#include <winpr/endian.h>
#include "../log.h"
#define TAG WINPR_TAG("nt")
@ -187,7 +188,7 @@ NTSTATUS _RtlAnsiStringToUnicodeString(PUNICODE_STRING DestinationString,
for (index = 0; index < SourceString->MaximumLength; index++)
{
DestinationString->Buffer[index] = (WCHAR) SourceString->Buffer[index];
Data_Write_UINT16(&DestinationString->Buffer[index], SourceString->Buffer[index]);
}
DestinationString->Length = SourceString->Length * 2;