mirror of
https://github.com/ApfelTeeSaft/reactos.git
synced 2026-08-27 19:25:36 +00:00
* [WINESYNC] ntdll: Add support for parsing application settings in manifests. Signed-off-by: Alexandre Julliard <[email protected]> wine commit id fc14442970dc6b97032c3cdd76cab33d774dc1a2 by Alexandre Julliard <[email protected]> * [WINESYNC] ntdll: Implement RtlQueryActivationContextApplicationSettings. Signed-off-by: Alexandre Julliard <[email protected]> wine commit id 14b9a5af0b44d7e2ca5232ad810c77e561d5d30c by Alexandre Julliard <[email protected]> * [WINESYNC] ntdll: Propagate the error through the XML buffer in manifest parser. Signed-off-by: Alexandre Julliard <[email protected]> wine commit id 7b871727e5cbb8581167acbaae2f4e34dc4ee59e by Alexandre Julliard <[email protected]> * [WINESYNC] ntdll: Check the namespace in RtlQueryActivationContextApplicationSettings. Signed-off-by: Alexandre Julliard <[email protected]> wine commit id e46259fb823f55aa331381fe56916d20049d52f2 by Alexandre Julliard <[email protected]> * [WINESYNC] ntdll: Use the ARRAY_SIZE() macro. Signed-off-by: Michael Stefaniuc <[email protected]> Signed-off-by: Alexandre Julliard <[email protected]> wine commit id 10f23ddb58b0583c8bce99e59d879c653b389363 by Michael Stefaniuc <[email protected]> * [WINESYNC] ntdll/actctx: Don't stop looking for manifest if dll without manifest is found. Signed-off-by: Fabian Maurer <[email protected]> Signed-off-by: Alexandre Julliard <[email protected]> wine commit id 56b3304a019486b52681a05d4b5454b475275e51 by Fabian Maurer <[email protected]> * [WINESYNC] ntdll: Use the current platform as processorArchitecture instead of a wildcard. Signed-off-by: Alexandre Julliard <[email protected]> wine commit id 6abf99b4803003812d4fcf7bf9effc99030cbec9 by Alexandre Julliard <[email protected]> * [WINESYNC] ntdll: Use strncmpiW instead of memicmpW for strings without embedded nulls. Signed-off-by: Alexandre Julliard <[email protected]> wine commit id 6fc259a57dafab9e72af13980c021e2a59257935 by Alexandre Julliard <[email protected]> * [WINESYNC] ntdll: Avoid dead initialization (scan-build). Signed-off-by: Alex Henrie <[email protected]> Signed-off-by: Alexandre Julliard <[email protected]> wine commit id 6ea282c7e1abd7ab09a5f0a18a437e63f909da96 by Alex Henrie <[email protected]> * [NDK] Add RtlUTF8ToUnicodeN for user mode * [WINESYNC] ntdll: Use the Rtl UTF8 conversion functions. Signed-off-by: Alexandre Julliard <[email protected]> wine commit id f46fa9c92d08c6e656bc22b94e09aa9dbe7d3be9 by Alexandre Julliard <[email protected]> * [WINESYNC] ntdll: Use module path as assembly path for manifests embedded in resources. Fixes Office 2016 installer, which removes its .exe directory from load path, but expects to be able to load files listed in manifest. Signed-off-by: Jacek Caban <[email protected]> Signed-off-by: Alexandre Julliard <[email protected]> wine commit id 2d764e90dd2c624f7a2d863ab29bd418ed33d252 by Jacek Caban <[email protected]> * [WINESYNC] ntdll: Store the default process activation context into the PEB. Signed-off-by: Gabriel Ivăncescu <[email protected]> Signed-off-by: Alexandre Julliard <[email protected]> wine commit id e95d0813fdfcfcac2bb1761e62e1d54e6f73cd6d by Gabriel Ivăncescu <[email protected]> * [WINESYNC] ntdll: Use wcsicmp() instead of strcmpiW() where possible. Signed-off-by: Alexandre Julliard <[email protected]> wine commit id 3e049b6b962b8e6f048101b9910c09d5b1d8f167 by Alexandre Julliard <[email protected]> * [WINESYNC] ntdll: Use wcsnicmp() instead of strncmpiW() where possible. Signed-off-by: Alexandre Julliard <[email protected]> wine commit id f831b3bd3d6b013893be7645df3a9cd05289c415 by Alexandre Julliard <[email protected]> * [WINESYNC] ntdll: Use RtlEqualUnicodeString() instead of strcmpiW(). Signed-off-by: Alexandre Julliard <[email protected]> wine commit id 4d93bafe961ed53488ff0fb4b44cb1ad085531fe by Alexandre Julliard <[email protected]> * [WINESYNC] ntdll: Avoid using memchrW(). Signed-off-by: Alexandre Julliard <[email protected]> wine commit id 186f189107972b739311f95a4ba3833838349b32 by Alexandre Julliard <[email protected]> * [WINESYNC] ntdll: Avoid using atoiW(). Signed-off-by: Alexandre Julliard <[email protected]> wine commit id 8f3d869d784753d814a3493d01c3650f45389eda by Alexandre Julliard <[email protected]> * [WINESYNC] ntdll: Avoid using sprintfW(). Signed-off-by: Alexandre Julliard <[email protected]> wine commit id eb1b2e548656dc3d08cbf3c35454621491b84126 by Alexandre Julliard <[email protected]> * [WINESYNC] ntdll: Use wcscpy() instead of strcpyW(). Signed-off-by: Alexandre Julliard <[email protected]> wine commit id 18411a19b4ea3a68234980c56d4c252670dfc000 by Alexandre Julliard <[email protected]> * [WINESYNC] ntdll: Use wcscat() instead of strcatW(). Signed-off-by: Alexandre Julliard <[email protected]> wine commit id 80005ee016aeed42967adfe5b3042803d008c50d by Alexandre Julliard <[email protected]> * [WINESYNC] ntdll: Use wcschr() instead of strchrW(). Signed-off-by: Alexandre Julliard <[email protected]> wine commit id 6de0ab276b3b79db4331993316f529a43f67c29a by Alexandre Julliard <[email protected]> * [WINESYNC] ntdll: Use wcsrchr() instead of strrchrW(). Signed-off-by: Alexandre Julliard <[email protected]> wine commit id 285c5490a4c0ee4a92d042a3e6ab32e6bc14fb49 by Alexandre Julliard <[email protected]> * [WINESYNC] ntdll: Use wcslen() instead of strlenW(). Signed-off-by: Alexandre Julliard <[email protected]> wine commit id e003b9884edcccc417d41d30073b312648741aaa by Alexandre Julliard <[email protected]> * [WINESYNC] ntdll: Use wcscmp() instead of strcmpW(). Signed-off-by: Alexandre Julliard <[email protected]> wine commit id 4501ab0a7c80e31e602c540a446809e8ae3ebade by Alexandre Julliard <[email protected]> * [WINESYNC] ntdll: Use wcsncmp() instead of strncmpW(). Signed-off-by: Alexandre Julliard <[email protected]> wine commit id e36b97e1d0644f90606d27f5104bb09a910540d2 by Alexandre Julliard <[email protected]> * [WINESYNC] ntdll: Make the windows directory a global variable. Signed-off-by: Alexandre Julliard <[email protected]> wine commit id ca13f489e18fb1f7944e3bdcfdfc4a810bf80994 by Alexandre Julliard <[email protected]> * [WINESYNC] ntdll: Use single field for misc flags in ComClass redirection section. Signed-off-by: Nikolay Sivov <[email protected]> Signed-off-by: Alexandre Julliard <[email protected]> wine commit id 72d055854b59db9059a3465f1e65247c0cc5e94e by Nikolay Sivov <[email protected]> * [WINESYNC] ntdll: Create class section for proxy-stub interface entries. Signed-off-by: Nikolay Sivov <[email protected]> Signed-off-by: Alexandre Julliard <[email protected]> wine commit id dd9295b415345f2b686b65bd05fae0320cf6dc39 by Nikolay Sivov <[email protected]> * [WINESYNC] ntdll: Use the standard C library names for the printf functions. Signed-off-by: Alexandre Julliard <[email protected]> wine commit id 4478ba258e45559ac97353ab27951e84dd9865c1 by Alexandre Julliard <[email protected]> * [WINESYNC] ntdll: Implement RtlActivateActivationContextEx(). Signed-off-by: Alexandre Julliard <[email protected]> wine commit id c71da19d24a5d6f01e65b3b3691a9d7dd17a2278 by Alexandre Julliard <[email protected]> * [WINESYNC] ntdll: Fix a memory leak (Valgrind). Signed-off-by: Chao Long <[email protected]> Signed-off-by: Alexandre Julliard <[email protected]> wine commit id d0946955ec21e4da57aaec92459f81f131b27a49 by Chao Long <[email protected]> * [WINESYNC] rtl is now in sync with wine-staging wine-5.18 --------- Co-authored-by: winesync <[email protected]> Co-authored-by: winesync <[email protected]>
217 lines
5.7 KiB
C++
217 lines
5.7 KiB
C++
/*
|
|
* COPYRIGHT: See COPYING in the top level directory
|
|
* PROJECT: BtrFS FSD for ReactOS
|
|
* FILE: dll/shellext/shellbtrfs/reactos.cpp
|
|
* PURPOSE: ReactOS glue for Win8.1
|
|
* PROGRAMMERS: Pierre Schweitzer <[email protected]>
|
|
*/
|
|
|
|
#include "shellext.h"
|
|
#include <initguid.h>
|
|
#include <ntddstor.h>
|
|
#define RtlUTF8ToUnicodeN RtlUTF8ToUnicodeN_
|
|
#include <ndk/rtlfuncs.h>
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
/* So that we can link */
|
|
DEFINE_GUID(CLSID_WICImagingFactory, 0xcacaf262,0x9370,0x4615,0xa1,0x3b,0x9f,0x55,0x39,0xda,0x4c,0x0a);
|
|
|
|
/* Copied from ntoskrnl_vista */
|
|
NTSTATUS WINAPI RtlUTF8ToUnicodeN(PWSTR uni_dest, ULONG uni_bytes_max,
|
|
PULONG uni_bytes_written,
|
|
PCCH utf8_src, ULONG utf8_bytes)
|
|
{
|
|
NTSTATUS status;
|
|
ULONG i, j;
|
|
ULONG written;
|
|
ULONG ch;
|
|
ULONG utf8_trail_bytes;
|
|
WCHAR utf16_ch[3];
|
|
ULONG utf16_ch_len;
|
|
|
|
if (!utf8_src)
|
|
return STATUS_INVALID_PARAMETER_4;
|
|
if (!uni_bytes_written)
|
|
return STATUS_INVALID_PARAMETER;
|
|
|
|
written = 0;
|
|
status = STATUS_SUCCESS;
|
|
|
|
for (i = 0; i < utf8_bytes; i++)
|
|
{
|
|
/* read UTF-8 lead byte */
|
|
ch = (BYTE)utf8_src[i];
|
|
utf8_trail_bytes = 0;
|
|
if (ch >= 0xf5)
|
|
{
|
|
ch = 0xfffd;
|
|
status = STATUS_SOME_NOT_MAPPED;
|
|
}
|
|
else if (ch >= 0xf0)
|
|
{
|
|
ch &= 0x07;
|
|
utf8_trail_bytes = 3;
|
|
}
|
|
else if (ch >= 0xe0)
|
|
{
|
|
ch &= 0x0f;
|
|
utf8_trail_bytes = 2;
|
|
}
|
|
else if (ch >= 0xc2)
|
|
{
|
|
ch &= 0x1f;
|
|
utf8_trail_bytes = 1;
|
|
}
|
|
else if (ch >= 0x80)
|
|
{
|
|
/* overlong or trail byte */
|
|
ch = 0xfffd;
|
|
status = STATUS_SOME_NOT_MAPPED;
|
|
}
|
|
|
|
/* read UTF-8 trail bytes */
|
|
if (i + utf8_trail_bytes < utf8_bytes)
|
|
{
|
|
for (j = 0; j < utf8_trail_bytes; j++)
|
|
{
|
|
if ((utf8_src[i + 1] & 0xc0) == 0x80)
|
|
{
|
|
ch <<= 6;
|
|
ch |= utf8_src[i + 1] & 0x3f;
|
|
i++;
|
|
}
|
|
else
|
|
{
|
|
ch = 0xfffd;
|
|
utf8_trail_bytes = 0;
|
|
status = STATUS_SOME_NOT_MAPPED;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
ch = 0xfffd;
|
|
utf8_trail_bytes = 0;
|
|
status = STATUS_SOME_NOT_MAPPED;
|
|
i = utf8_bytes;
|
|
}
|
|
|
|
/* encode ch as UTF-16 */
|
|
if ((ch > 0x10ffff) ||
|
|
(ch >= 0xd800 && ch <= 0xdfff) ||
|
|
(utf8_trail_bytes == 2 && ch < 0x00800) ||
|
|
(utf8_trail_bytes == 3 && ch < 0x10000))
|
|
{
|
|
/* invalid codepoint or overlong encoding */
|
|
utf16_ch[0] = 0xfffd;
|
|
utf16_ch[1] = 0xfffd;
|
|
utf16_ch[2] = 0xfffd;
|
|
utf16_ch_len = utf8_trail_bytes;
|
|
status = STATUS_SOME_NOT_MAPPED;
|
|
}
|
|
else if (ch >= 0x10000)
|
|
{
|
|
/* surrogate pair */
|
|
ch -= 0x010000;
|
|
utf16_ch[0] = 0xd800 + (ch >> 10 & 0x3ff);
|
|
utf16_ch[1] = 0xdc00 + (ch >> 0 & 0x3ff);
|
|
utf16_ch_len = 2;
|
|
}
|
|
else
|
|
{
|
|
/* single unit */
|
|
utf16_ch[0] = ch;
|
|
utf16_ch_len = 1;
|
|
}
|
|
|
|
if (!uni_dest)
|
|
{
|
|
written += utf16_ch_len;
|
|
continue;
|
|
}
|
|
|
|
for (j = 0; j < utf16_ch_len; j++)
|
|
{
|
|
if (uni_bytes_max >= sizeof(WCHAR))
|
|
{
|
|
*uni_dest++ = utf16_ch[j];
|
|
uni_bytes_max -= sizeof(WCHAR);
|
|
written++;
|
|
}
|
|
else
|
|
{
|
|
uni_bytes_max = 0;
|
|
status = STATUS_BUFFER_TOO_SMALL;
|
|
}
|
|
}
|
|
}
|
|
|
|
*uni_bytes_written = written * sizeof(WCHAR);
|
|
return status;
|
|
}
|
|
|
|
/* Quick and dirty table for conversion */
|
|
FILE_INFORMATION_CLASS ConvertToFileInfo[MaximumFileInfoByHandleClass] =
|
|
{
|
|
FileBasicInformation, FileStandardInformation, FileNameInformation, FileRenameInformation,
|
|
FileDispositionInformation, FileAllocationInformation, FileEndOfFileInformation, FileStreamInformation,
|
|
FileCompressionInformation, FileAttributeTagInformation, FileIdBothDirectoryInformation, (FILE_INFORMATION_CLASS)-1,
|
|
FileIoPriorityHintInformation, FileRemoteProtocolInformation
|
|
};
|
|
|
|
/* Taken from kernel32 */
|
|
DWORD
|
|
BaseSetLastNTError(IN NTSTATUS Status)
|
|
{
|
|
DWORD dwErrCode;
|
|
dwErrCode = RtlNtStatusToDosError(Status);
|
|
SetLastError(dwErrCode);
|
|
return dwErrCode;
|
|
}
|
|
|
|
/* Quick implementation, still going farther than Wine implementation */
|
|
BOOL
|
|
WINAPI
|
|
SetFileInformationByHandle(HANDLE hFile,
|
|
FILE_INFO_BY_HANDLE_CLASS FileInformationClass,
|
|
LPVOID lpFileInformation,
|
|
DWORD dwBufferSize)
|
|
{
|
|
NTSTATUS Status;
|
|
IO_STATUS_BLOCK IoStatusBlock;
|
|
FILE_INFORMATION_CLASS FileInfoClass;
|
|
|
|
FileInfoClass = (FILE_INFORMATION_CLASS)-1;
|
|
|
|
/* Attempt to convert the class */
|
|
if (FileInformationClass < MaximumFileInfoByHandleClass)
|
|
{
|
|
FileInfoClass = ConvertToFileInfo[FileInformationClass];
|
|
}
|
|
|
|
/* If wrong, bail out */
|
|
if (FileInfoClass == -1)
|
|
{
|
|
SetLastError(ERROR_INVALID_PARAMETER);
|
|
return FALSE;
|
|
}
|
|
|
|
/* And set the information */
|
|
Status = NtSetInformationFile(hFile, &IoStatusBlock, lpFileInformation,
|
|
dwBufferSize, FileInfoClass);
|
|
|
|
if (!NT_SUCCESS(Status))
|
|
{
|
|
BaseSetLastNTError(Status);
|
|
return FALSE;
|
|
}
|
|
|
|
return TRUE;
|
|
}
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|