Added patch with stub for ntdll.RtlQueryPackageIdentity.

This commit is contained in:
Sebastian Lackner
2016-01-17 06:50:43 +01:00
parent 00ba58231d
commit 6775f4126e
7 changed files with 286 additions and 10 deletions

View File

@@ -0,0 +1,43 @@
From 3fad7f8640f1600a00896f82056423303e4cc3e0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
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

View File

@@ -0,0 +1,64 @@
From 730defc94816ecb8e67f79f4bbee7cf31bedfec1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
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

View File

@@ -0,0 +1,137 @@
From 12db1d30697314446ae03aaed86a1a57efa786da Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
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

View File

@@ -0,0 +1 @@
Fixes: Add stub for ntdll.RtlQueryPackageIdentity