mirror of
git://source.winehq.org/git/wine.git
synced 2024-10-06 08:54:05 +00:00
schedsvc/tests: Deleting tasks & folders requires elevated privileges on Windows 7.
This means skipping any test that requires creating a folder as the test would be unable to clean up after itself. Wine-Bug: https://bugs.winehq.org//show_bug.cgi?id=53128 Wine-Bug: https://bugs.winehq.org//show_bug.cgi?id=54109
This commit is contained in:
parent
4385a3c29e
commit
bb516ae1a6
|
@ -1,5 +1,5 @@
|
||||||
TESTDLL = schedsvc.dll
|
TESTDLL = schedsvc.dll
|
||||||
IMPORTS = rpcrt4 ole32
|
IMPORTS = advapi32 rpcrt4 ole32
|
||||||
|
|
||||||
C_SRCS = \
|
C_SRCS = \
|
||||||
atsvcapi.c \
|
atsvcapi.c \
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
#include "winternl.h"
|
||||||
#include <ole2.h>
|
#include <ole2.h>
|
||||||
#include <rpcdce.h>
|
#include <rpcdce.h>
|
||||||
#include <taskschd.h>
|
#include <taskschd.h>
|
||||||
|
@ -25,6 +26,37 @@
|
||||||
|
|
||||||
#include "wine/test.h"
|
#include "wine/test.h"
|
||||||
|
|
||||||
|
static BOOL is_process_elevated(void)
|
||||||
|
{
|
||||||
|
HANDLE token;
|
||||||
|
if (OpenProcessToken( GetCurrentProcess(), TOKEN_QUERY, &token ))
|
||||||
|
{
|
||||||
|
TOKEN_ELEVATION_TYPE type;
|
||||||
|
DWORD size;
|
||||||
|
BOOL ret;
|
||||||
|
|
||||||
|
ret = GetTokenInformation( token, TokenElevationType, &type, sizeof(type), &size );
|
||||||
|
CloseHandle( token );
|
||||||
|
return (ret && type == TokenElevationTypeFull);
|
||||||
|
}
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static BOOL check_win_version(int min_major, int min_minor)
|
||||||
|
{
|
||||||
|
HMODULE hntdll = GetModuleHandleA("ntdll.dll");
|
||||||
|
NTSTATUS (WINAPI *pRtlGetVersion)(RTL_OSVERSIONINFOEXW *);
|
||||||
|
RTL_OSVERSIONINFOEXW rtlver;
|
||||||
|
|
||||||
|
rtlver.dwOSVersionInfoSize = sizeof(RTL_OSVERSIONINFOEXW);
|
||||||
|
pRtlGetVersion = (void *)GetProcAddress(hntdll, "RtlGetVersion");
|
||||||
|
pRtlGetVersion(&rtlver);
|
||||||
|
return rtlver.dwMajorVersion > min_major ||
|
||||||
|
(rtlver.dwMajorVersion == min_major &&
|
||||||
|
rtlver.dwMinorVersion >= min_minor);
|
||||||
|
}
|
||||||
|
#define is_win8_plus() check_win_version(6, 2)
|
||||||
|
|
||||||
extern handle_t schrpc_handle;
|
extern handle_t schrpc_handle;
|
||||||
|
|
||||||
static LONG CALLBACK rpc_exception_filter(EXCEPTION_POINTERS *ptrs)
|
static LONG CALLBACK rpc_exception_filter(EXCEPTION_POINTERS *ptrs)
|
||||||
|
@ -143,6 +175,12 @@ START_TEST(rpcapi)
|
||||||
hr = SchRpcDelete(L"", 0);
|
hr = SchRpcDelete(L"", 0);
|
||||||
ok(hr == E_ACCESSDENIED /* win7 */ || hr == E_INVALIDARG /* vista */, "expected E_ACCESSDENIED, got %#lx\n", hr);
|
ok(hr == E_ACCESSDENIED /* win7 */ || hr == E_INVALIDARG /* vista */, "expected E_ACCESSDENIED, got %#lx\n", hr);
|
||||||
|
|
||||||
|
if (!is_process_elevated() && !is_win8_plus())
|
||||||
|
{
|
||||||
|
win_skip("Skipping because deleting anything requires elevated privileges on Windows 7\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
hr = SchRpcCreateFolder(L"\\Wine", NULL, 0);
|
hr = SchRpcCreateFolder(L"\\Wine", NULL, 0);
|
||||||
ok(hr == S_OK, "expected S_OK, got %#lx\n", hr);
|
ok(hr == S_OK, "expected S_OK, got %#lx\n", hr);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue