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

taskschd/tests: Elevated privileges are needed to connect using a hostname.

Being in the administrator group is not sufficient.
parent 27f378f0
......@@ -29,6 +29,22 @@
#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 void test_Connect(void)
{
WCHAR comp_name[MAX_COMPUTERNAME_LENGTH + 1];
......@@ -73,7 +89,8 @@ static void test_Connect(void)
V_BSTR(&v_comp) = SysAllocString(comp_name);
hr = ITaskService_Connect(service, v_comp, v_null, v_null, v_null);
ok(hr == S_OK || hr == E_ACCESSDENIED /* not an administrator */, "Connect error %#lx\n", hr);
ok(hr == S_OK || (hr == E_ACCESSDENIED && !is_process_elevated()),
"Connect error %#lx\n", hr);
was_connected = hr == S_OK;
SysFreeString(V_BSTR(&v_comp));
......
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