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

fsutils/tests: Fsutils requires elevated privileges on Windows <= 7.

So skip the tests if the first fsutils run fails and we don't have elevated privileges. Signed-off-by: 's avatarFrancois Gouget <fgouget@codeweavers.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent 24508594
TESTDLL = fsutil.exe
IMPORTS = user32
IMPORTS = advapi32 user32
C_SRCS = \
fsutil.c
......@@ -21,6 +21,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 DWORD runcmd(const char* cmd)
{
STARTUPINFOA si = { sizeof(STARTUPINFOA) };
......@@ -64,6 +80,11 @@ static void test_hardlink(void)
CloseHandle(hfile);
rc = runcmd("fsutil");
if (rc == 1 && !is_process_elevated())
{
win_skip("Cannot run fsutil without elevated privileges on Windows <= 7\n");
return;
}
ok(rc == 0, "failed to run fsutil\n");
rc = runcmd("fsutil hardlink");
......
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