From 6775f4126e360af65e7505c156e46a52a6154fb6 Mon Sep 17 00:00:00 2001 From: Sebastian Lackner Date: Sun, 17 Jan 2016 06:50:43 +0100 Subject: [PATCH] Added patch with stub for ntdll.RtlQueryPackageIdentity. --- ...sts-for-RtlIpv6StringToAddress-try-6.patch | 20 +-- patches/ntdll-RtlIpStringToAddress/definition | 1 + ...Add-stub-for-RtlQueryPackageIdentity.patch | 43 ++++++ ...licationActivationManager-interface-.patch | 64 ++++++++ ...basic-tests-for-RtlQueryPackageIdent.patch | 137 ++++++++++++++++++ .../ntdll-RtlQueryPackageIdentity/definition | 1 + patches/patchinstall.sh | 30 ++++ 7 files changed, 286 insertions(+), 10 deletions(-) create mode 100644 patches/ntdll-RtlQueryPackageIdentity/0001-ntdll-Add-stub-for-RtlQueryPackageIdentity.patch create mode 100644 patches/ntdll-RtlQueryPackageIdentity/0002-include-Add-IApplicationActivationManager-interface-.patch create mode 100644 patches/ntdll-RtlQueryPackageIdentity/0003-ntdll-tests-Add-basic-tests-for-RtlQueryPackageIdent.patch create mode 100644 patches/ntdll-RtlQueryPackageIdentity/definition diff --git a/patches/ntdll-RtlIpStringToAddress/0001-ntdll-tests-Tests-for-RtlIpv6StringToAddress-try-6.patch b/patches/ntdll-RtlIpStringToAddress/0001-ntdll-tests-Tests-for-RtlIpv6StringToAddress-try-6.patch index 2fc135f8..41cbf5c0 100644 --- a/patches/ntdll-RtlIpStringToAddress/0001-ntdll-tests-Tests-for-RtlIpv6StringToAddress-try-6.patch +++ b/patches/ntdll-RtlIpStringToAddress/0001-ntdll-tests-Tests-for-RtlIpv6StringToAddress-try-6.patch @@ -1,4 +1,4 @@ -From 14cab3188b8f83081a686892d94594a30abebf14 Mon Sep 17 00:00:00 2001 +From 34d880216777154f9fef645795783a6deaddf2f8 Mon Sep 17 00:00:00 2001 From: Mark Jansen Date: Sun, 8 Mar 2015 18:24:45 +0100 Subject: ntdll/tests: Tests for RtlIpv6StringToAddress (try 6) @@ -22,7 +22,7 @@ duplication 1 file changed, 430 insertions(+) diff --git a/dlls/ntdll/tests/rtl.c b/dlls/ntdll/tests/rtl.c -index 4903790..47acfe9 100644 +index ac463c6..657c1ae 100644 --- a/dlls/ntdll/tests/rtl.c +++ b/dlls/ntdll/tests/rtl.c @@ -25,6 +25,7 @@ @@ -30,10 +30,10 @@ index 4903790..47acfe9 100644 #include "ntdll_test.h" #include "inaddr.h" +#include "in6addr.h" - - #ifndef __WINE_WINTERNL_H - -@@ -89,9 +90,12 @@ static IMAGE_BASE_RELOCATION *(WINAPI *pLdrProcessRelocationBlock)(void*,UINT,US + #include "initguid.h" + #define COBJMACROS + #include "shobjidl.h" +@@ -92,9 +93,12 @@ static IMAGE_BASE_RELOCATION *(WINAPI *pLdrProcessRelocationBlock)(void*,UINT,US static CHAR * (WINAPI *pRtlIpv4AddressToStringA)(const IN_ADDR *, LPSTR); static NTSTATUS (WINAPI *pRtlIpv4AddressToStringExA)(const IN_ADDR *, USHORT, LPSTR, PULONG); static NTSTATUS (WINAPI *pRtlIpv4StringToAddressA)(PCSTR, BOOLEAN, PCSTR *, IN_ADDR *); @@ -46,7 +46,7 @@ index 4903790..47acfe9 100644 static NTSTATUS (WINAPI *pRtlGetCompressionWorkSpaceSize)(USHORT, PULONG, PULONG); static NTSTATUS (WINAPI *pRtlDecompressBuffer)(USHORT, PUCHAR, ULONG, const UCHAR*, ULONG, PULONG); static NTSTATUS (WINAPI *pRtlDecompressFragment)(USHORT, PUCHAR, ULONG, const UCHAR*, ULONG, ULONG, PULONG, PVOID); -@@ -140,9 +144,12 @@ static void InitFunctionPtrs(void) +@@ -146,9 +150,12 @@ static void InitFunctionPtrs(void) pRtlIpv4AddressToStringA = (void *)GetProcAddress(hntdll, "RtlIpv4AddressToStringA"); pRtlIpv4AddressToStringExA = (void *)GetProcAddress(hntdll, "RtlIpv4AddressToStringExA"); pRtlIpv4StringToAddressA = (void *)GetProcAddress(hntdll, "RtlIpv4StringToAddressA"); @@ -59,7 +59,7 @@ index 4903790..47acfe9 100644 pRtlGetCompressionWorkSpaceSize = (void *)GetProcAddress(hntdll, "RtlGetCompressionWorkSpaceSize"); pRtlDecompressBuffer = (void *)GetProcAddress(hntdll, "RtlDecompressBuffer"); pRtlDecompressFragment = (void *)GetProcAddress(hntdll, "RtlDecompressFragment"); -@@ -1500,6 +1507,428 @@ static void test_RtlIpv4StringToAddress(void) +@@ -1303,6 +1310,428 @@ static void test_RtlIpv4StringToAddress(void) } } @@ -488,7 +488,7 @@ index 4903790..47acfe9 100644 static void test_LdrAddRefDll(void) { HMODULE mod, mod2; -@@ -2186,6 +2615,7 @@ START_TEST(rtl) +@@ -2155,6 +2584,7 @@ START_TEST(rtl) test_RtlIpv4AddressToString(); test_RtlIpv4AddressToStringEx(); test_RtlIpv4StringToAddress(); @@ -497,5 +497,5 @@ index 4903790..47acfe9 100644 test_LdrLockLoaderLock(); test_RtlCompressBuffer(); -- -2.4.5 +2.6.4 diff --git a/patches/ntdll-RtlIpStringToAddress/definition b/patches/ntdll-RtlIpStringToAddress/definition index 5d05f260..2991c43e 100644 --- a/patches/ntdll-RtlIpStringToAddress/definition +++ b/patches/ntdll-RtlIpStringToAddress/definition @@ -1 +1,2 @@ Category: stable +Depends: ntdll-RtlQueryPackageIdentity diff --git a/patches/ntdll-RtlQueryPackageIdentity/0001-ntdll-Add-stub-for-RtlQueryPackageIdentity.patch b/patches/ntdll-RtlQueryPackageIdentity/0001-ntdll-Add-stub-for-RtlQueryPackageIdentity.patch new file mode 100644 index 00000000..e050c99b --- /dev/null +++ b/patches/ntdll-RtlQueryPackageIdentity/0001-ntdll-Add-stub-for-RtlQueryPackageIdentity.patch @@ -0,0 +1,43 @@ +From 3fad7f8640f1600a00896f82056423303e4cc3e0 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Michael=20M=C3=BCller?= +Date: Sun, 17 Jan 2016 00:48:11 +0100 +Subject: ntdll: Add stub for RtlQueryPackageIdentity. + +--- + dlls/ntdll/ntdll.spec | 1 + + dlls/ntdll/rtl.c | 10 ++++++++++ + 2 files changed, 11 insertions(+) + +diff --git a/dlls/ntdll/ntdll.spec b/dlls/ntdll/ntdll.spec +index 4e49709..fee2e11 100644 +--- a/dlls/ntdll/ntdll.spec ++++ b/dlls/ntdll/ntdll.spec +@@ -799,6 +799,7 @@ + @ stdcall RtlQueryInformationActivationContext(long long ptr long ptr long ptr) + @ stub RtlQueryInformationActiveActivationContext + @ stub RtlQueryInterfaceMemoryStream ++@ stdcall RtlQueryPackageIdentity(long ptr ptr ptr ptr ptr) + @ stub RtlQueryProcessBackTraceInformation + @ stdcall RtlQueryProcessDebugInformation(long long ptr) + @ stub RtlQueryProcessHeapInformation +diff --git a/dlls/ntdll/rtl.c b/dlls/ntdll/rtl.c +index f699cff..37dce23 100644 +--- a/dlls/ntdll/rtl.c ++++ b/dlls/ntdll/rtl.c +@@ -1626,3 +1626,13 @@ NTSTATUS WINAPI RtlCreateUserProcess(UNICODE_STRING *path, ULONG attributes, RTL + parent, inherit, debug, exception, info); + return STATUS_NOT_IMPLEMENTED; + } ++ ++/********************************************************************* ++ * RtlQueryPackageIdentity [NTDLL.@] ++ */ ++NTSTATUS WINAPI RtlQueryPackageIdentity(HANDLE token, WCHAR *fullname, SIZE_T *fullname_size, ++ WCHAR *appid, SIZE_T *appid_size, BOOLEAN *packaged) ++{ ++ FIXME("(%p, %p, %p, %p, %p, %p): stub\n", token, fullname, fullname_size, appid, appid_size, packaged); ++ return STATUS_NOT_FOUND; ++} +-- +2.6.4 + diff --git a/patches/ntdll-RtlQueryPackageIdentity/0002-include-Add-IApplicationActivationManager-interface-.patch b/patches/ntdll-RtlQueryPackageIdentity/0002-include-Add-IApplicationActivationManager-interface-.patch new file mode 100644 index 00000000..1a3655fb --- /dev/null +++ b/patches/ntdll-RtlQueryPackageIdentity/0002-include-Add-IApplicationActivationManager-interface-.patch @@ -0,0 +1,64 @@ +From 730defc94816ecb8e67f79f4bbee7cf31bedfec1 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Michael=20M=C3=BCller?= +Date: Sun, 17 Jan 2016 00:46:34 +0100 +Subject: include: Add IApplicationActivationManager interface declaration. + +--- + include/shobjidl.idl | 36 ++++++++++++++++++++++++++++++++++++ + 1 file changed, 36 insertions(+) + +diff --git a/include/shobjidl.idl b/include/shobjidl.idl +index 1cc6132..cf9b8b3 100644 +--- a/include/shobjidl.idl ++++ b/include/shobjidl.idl +@@ -3639,6 +3639,34 @@ typedef enum ASSOC_FILTER + } ASSOC_FILTER; + cpp_quote("HRESULT WINAPI SHAssocEnumHandlers(PCWSTR extra, ASSOC_FILTER filter, IEnumAssocHandlers **handlersenum);") + ++typedef [v1_enum] enum ACTIVATEOPTIONS ++{ ++ AO_NONE = 0x00000000, ++ AO_DESIGNMODE = 0x00000001, ++ AO_NOERRORUI = 0x00000002, ++ AO_NOSPLASHSCREEN = 0x00000004 ++} ACTIVATEOPTIONS; ++ ++[ ++ uuid(2e941141-7f97-4756-ba1d-9decde894a3d), ++ object, ++ pointer_default(unique) ++] ++interface IApplicationActivationManager : IUnknown ++{ ++ HRESULT ActivateApplication([in] LPCWSTR appusermodelid, ++ [in, unique] LPCWSTR arguments, ++ [in] ACTIVATEOPTIONS options, ++ [out] DWORD *processid); ++ HRESULT ActivateForFile([in] LPCWSTR appusermodelid, ++ [in] IShellItemArray *itemarray, ++ [in, unique] LPCWSTR verb, ++ [out] DWORD *processid); ++ HRESULT ActivateForProtocol([in] LPCWSTR appusermodelid, ++ [in] IShellItemArray *itemarray, ++ [out] DWORD *processid); ++} ++ + /***************************************************************************** + * ShellObjects typelibrary + */ +@@ -3735,4 +3763,12 @@ library ShellObjects + { + interface IQueryCancelAutoPlay; + } ++ ++ [ ++ uuid(45ba127d-10a8-46ea-8ab7-56ea9078943c) ++ ] ++ coclass ApplicationActivationManager ++ { ++ interface IApplicationActivationManager; ++ } + } +-- +2.6.4 + diff --git a/patches/ntdll-RtlQueryPackageIdentity/0003-ntdll-tests-Add-basic-tests-for-RtlQueryPackageIdent.patch b/patches/ntdll-RtlQueryPackageIdentity/0003-ntdll-tests-Add-basic-tests-for-RtlQueryPackageIdent.patch new file mode 100644 index 00000000..4cd3cdc8 --- /dev/null +++ b/patches/ntdll-RtlQueryPackageIdentity/0003-ntdll-tests-Add-basic-tests-for-RtlQueryPackageIdent.patch @@ -0,0 +1,137 @@ +From 12db1d30697314446ae03aaed86a1a57efa786da Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Michael=20M=C3=BCller?= +Date: Sun, 17 Jan 2016 00:50:50 +0100 +Subject: ntdll/tests: Add basic tests for RtlQueryPackageIdentity. + +--- + dlls/ntdll/tests/Makefile.in | 2 +- + dlls/ntdll/tests/rtl.c | 76 ++++++++++++++++++++++++++++++++++++++++++++ + 2 files changed, 77 insertions(+), 1 deletion(-) + +diff --git a/dlls/ntdll/tests/Makefile.in b/dlls/ntdll/tests/Makefile.in +index fc352dd..0de4fe8 100644 +--- a/dlls/ntdll/tests/Makefile.in ++++ b/dlls/ntdll/tests/Makefile.in +@@ -1,5 +1,5 @@ + TESTDLL = ntdll.dll +-IMPORTS = user32 ++IMPORTS = user32 ole32 advapi32 + + C_SRCS = \ + atom.c \ +diff --git a/dlls/ntdll/tests/rtl.c b/dlls/ntdll/tests/rtl.c +index 94a22ac..ac463c6 100644 +--- a/dlls/ntdll/tests/rtl.c ++++ b/dlls/ntdll/tests/rtl.c +@@ -25,6 +25,9 @@ + + #include "ntdll_test.h" + #include "inaddr.h" ++#include "initguid.h" ++#define COBJMACROS ++#include "shobjidl.h" + + #ifndef __WINE_WINTERNL_H + +@@ -98,6 +101,7 @@ static NTSTATUS (WINAPI *pRtlDecompressFragment)(USHORT, PUCHAR, ULONG, const U + static NTSTATUS (WINAPI *pRtlCompressBuffer)(USHORT, const UCHAR*, ULONG, PUCHAR, ULONG, ULONG, PULONG, PVOID); + static BOOL (WINAPI *pRtlIsCriticalSectionLocked)(CRITICAL_SECTION *); + static BOOL (WINAPI *pRtlIsCriticalSectionLockedByThread)(CRITICAL_SECTION *); ++static NTSTATUS (WINAPI *pRtlQueryPackageIdentity)(HANDLE, WCHAR*, SIZE_T*, WCHAR*, SIZE_T*, BOOLEAN*); + + static HMODULE hkernel32 = 0; + static BOOL (WINAPI *pIsWow64Process)(HANDLE, PBOOL); +@@ -151,6 +155,7 @@ static void InitFunctionPtrs(void) + pRtlCompressBuffer = (void *)GetProcAddress(hntdll, "RtlCompressBuffer"); + pRtlIsCriticalSectionLocked = (void *)GetProcAddress(hntdll, "RtlIsCriticalSectionLocked"); + pRtlIsCriticalSectionLockedByThread = (void *)GetProcAddress(hntdll, "RtlIsCriticalSectionLockedByThread"); ++ pRtlQueryPackageIdentity = (void *)GetProcAddress(hntdll, "RtlQueryPackageIdentity"); + } + hkernel32 = LoadLibraryA("kernel32.dll"); + ok(hkernel32 != 0, "LoadLibrary failed\n"); +@@ -2056,6 +2061,76 @@ static void test_RtlIsCriticalSectionLocked(void) + DeleteCriticalSection(&info.crit); + } + ++static void test_RtlQueryPackageIdentity(void) ++{ ++ const WCHAR programW[] = {'M','i','c','r','o','s','o','f','t','.','W','i','n','d','o','w','s','.', ++ 'P','h','o','t','o','s','_','8','w','e','k','y','b','3','d','8','b','b','w','e','!','A','p','p',0}; ++ const WCHAR fullnameW[] = {'M','i','c','r','o','s','o','f','t','.','W','i','n','d','o','w','s','.', ++ 'P','h','o','t','o','s', 0}; ++ const WCHAR appidW[] = {'A','p','p',0}; ++ IApplicationActivationManager *manager; ++ WCHAR buf1[MAX_PATH], buf2[MAX_PATH]; ++ HANDLE process, token; ++ SIZE_T size1, size2; ++ NTSTATUS status; ++ DWORD processid; ++ HRESULT hr; ++ BOOL ret; ++ ++ if (!pRtlQueryPackageIdentity) ++ { ++ win_skip("RtlQueryPackageIdentity not available\n"); ++ return; ++ } ++ ++ size1 = size2 = MAX_PATH * sizeof(WCHAR); ++ status = pRtlQueryPackageIdentity((HANDLE)~(ULONG_PTR)3, buf1, &size1, buf2, &size2, NULL); ++ ok(status == STATUS_NOT_FOUND, "expected STATUS_NOT_FOUND, got %08x\n", status); ++ ++ CoInitializeEx(0, COINIT_APARTMENTTHREADED); ++ hr = CoCreateInstance(&CLSID_ApplicationActivationManager, NULL, CLSCTX_LOCAL_SERVER, ++ &IID_IApplicationActivationManager, (void **)&manager); ++ if (FAILED(hr)) ++ { ++ todo_wine win_skip("Failed to create ApplicationActivationManager (%x)\n", hr); ++ goto done; ++ } ++ ++ hr = IApplicationActivationManager_ActivateApplication(manager, programW, NULL, ++ AO_NOERRORUI, &processid); ++ if (FAILED(hr)) ++ { ++ todo_wine win_skip("Failed to start program (%x)\n", hr); ++ IApplicationActivationManager_Release(manager); ++ goto done; ++ } ++ ++ process = OpenProcess(PROCESS_QUERY_LIMITED_INFORMATION | PROCESS_TERMINATE, FALSE, processid); ++ ok(process != NULL, "OpenProcess failed with %u\n", GetLastError()); ++ ret = OpenProcessToken(process, TOKEN_QUERY, &token); ++ ok(ret, "OpenProcessToken failed with error %u\n", GetLastError()); ++ ++ size1 = size2 = MAX_PATH * sizeof(WCHAR); ++ status = pRtlQueryPackageIdentity(token, buf1, &size1, buf2, &size2, NULL); ++ ok(status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08x\n", status); ++ ++ ok(!memcmp(buf1, fullnameW, sizeof(fullnameW) - sizeof(WCHAR)), ++ "Expected buf1 to begin with %s, got %s\n", wine_dbgstr_w(fullnameW), wine_dbgstr_w(buf1)); ++ ok(size1 >= sizeof(WCHAR) && !(size1 % sizeof(WCHAR)), "Unexpected size1 = %lu\n", size1); ++ ok(buf1[size1 / sizeof(WCHAR) - 1] == 0, "Expected buf1[%lu] == 0\n", size1 / sizeof(WCHAR) - 1); ++ ++ ok(!lstrcmpW(buf2, appidW), "Expected buf2 to be %s, got %s\n", wine_dbgstr_w(appidW), wine_dbgstr_w(buf2)); ++ ok(size2 >= sizeof(WCHAR) && !(size2 % sizeof(WCHAR)), "Unexpected size2 = %lu\n", size2); ++ ok(buf2[size2 / sizeof(WCHAR) - 1] == 0, "Expected buf2[%lu] == 0\n", size2 / sizeof(WCHAR) - 1); ++ ++ CloseHandle(token); ++ TerminateProcess(process, 0); ++ CloseHandle(process); ++ ++done: ++ CoUninitialize(); ++} ++ + START_TEST(rtl) + { + InitFunctionPtrs(); +@@ -2086,4 +2161,5 @@ START_TEST(rtl) + test_RtlGetCompressionWorkSpaceSize(); + test_RtlDecompressBuffer(); + test_RtlIsCriticalSectionLocked(); ++ test_RtlQueryPackageIdentity(); + } +-- +2.6.4 + diff --git a/patches/ntdll-RtlQueryPackageIdentity/definition b/patches/ntdll-RtlQueryPackageIdentity/definition new file mode 100644 index 00000000..6672b665 --- /dev/null +++ b/patches/ntdll-RtlQueryPackageIdentity/definition @@ -0,0 +1 @@ +Fixes: Add stub for ntdll.RtlQueryPackageIdentity diff --git a/patches/patchinstall.sh b/patches/patchinstall.sh index 84993a15..45045e2c 100755 --- a/patches/patchinstall.sh +++ b/patches/patchinstall.sh @@ -214,6 +214,7 @@ patch_enable_all () enable_ntdll_ProcessQuotaLimits="$1" enable_ntdll_Purist_Mode="$1" enable_ntdll_RtlIpStringToAddress="$1" + enable_ntdll_RtlQueryPackageIdentity="$1" enable_ntdll_Serial_Port_Detection="$1" enable_ntdll_Status_Mapping="$1" enable_ntdll_Syscall_Wrappers="$1" @@ -773,6 +774,9 @@ patch_enable () ntdll-RtlIpStringToAddress) enable_ntdll_RtlIpStringToAddress="$2" ;; + ntdll-RtlQueryPackageIdentity) + enable_ntdll_RtlQueryPackageIdentity="$2" + ;; ntdll-Serial_Port_Detection) enable_ntdll_Serial_Port_Detection="$2" ;; @@ -1995,6 +1999,13 @@ if test "$enable_ntdll_SystemRoot_Symlink" -eq 1; then enable_ntdll_Syscall_Wrappers=1 fi +if test "$enable_ntdll_RtlIpStringToAddress" -eq 1; then + if test "$enable_ntdll_RtlQueryPackageIdentity" -gt 1; then + abort "Patchset ntdll-RtlQueryPackageIdentity disabled, but ntdll-RtlIpStringToAddress depends on that." + fi + enable_ntdll_RtlQueryPackageIdentity=1 +fi + if test "$enable_ntdll_Purist_Mode" -eq 1; then if test "$enable_ntdll_DllRedirects" -gt 1; then abort "Patchset ntdll-DllRedirects disabled, but ntdll-Purist_Mode depends on that." @@ -4644,8 +4655,27 @@ if test "$enable_ntdll_Purist_Mode" -eq 1; then ) >> "$patchlist" fi +# Patchset ntdll-RtlQueryPackageIdentity +# | +# | Modified files: +# | * dlls/ntdll/ntdll.spec, dlls/ntdll/rtl.c, dlls/ntdll/tests/Makefile.in, dlls/ntdll/tests/rtl.c, include/shobjidl.idl +# | +if test "$enable_ntdll_RtlQueryPackageIdentity" -eq 1; then + patch_apply ntdll-RtlQueryPackageIdentity/0001-ntdll-Add-stub-for-RtlQueryPackageIdentity.patch + patch_apply ntdll-RtlQueryPackageIdentity/0002-include-Add-IApplicationActivationManager-interface-.patch + patch_apply ntdll-RtlQueryPackageIdentity/0003-ntdll-tests-Add-basic-tests-for-RtlQueryPackageIdent.patch + ( + echo '+ { "Michael Müller", "ntdll: Add stub for RtlQueryPackageIdentity.", 1 },'; + echo '+ { "Michael Müller", "include: Add IApplicationActivationManager interface declaration.", 1 },'; + echo '+ { "Michael Müller", "ntdll/tests: Add basic tests for RtlQueryPackageIdentity.", 1 },'; + ) >> "$patchlist" +fi + # Patchset ntdll-RtlIpStringToAddress # | +# | This patchset has the following (direct or indirect) dependencies: +# | * ntdll-RtlQueryPackageIdentity +# | # | Modified files: # | * dlls/ntdll/tests/rtl.c # |