Commit bb516ae1 authored by Francois Gouget's avatar Francois Gouget Committed by Alexandre Julliard

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
parent 4385a3c2
TESTDLL = schedsvc.dll
IMPORTS = rpcrt4 ole32
IMPORTS = advapi32 rpcrt4 ole32
C_SRCS = \
atsvcapi.c \
......
......@@ -18,6 +18,7 @@
#include <stdio.h>
#include <windows.h>
#include "winternl.h"
#include <ole2.h>
#include <rpcdce.h>
#include <taskschd.h>
......@@ -25,6 +26,37 @@
#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;
static LONG CALLBACK rpc_exception_filter(EXCEPTION_POINTERS *ptrs)
......@@ -143,6 +175,12 @@ START_TEST(rpcapi)
hr = SchRpcDelete(L"", 0);
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);
ok(hr == S_OK, "expected S_OK, got %#lx\n", hr);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment