Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
a7897d3d
Commit
a7897d3d
authored
Feb 17, 2014
by
Francois Gouget
Committed by
Alexandre Julliard
Feb 18, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
faultrep/tests: AddERExcludedApplication() fails if we have insufficient privileges.
parent
8c0a717a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
41 additions
and
5 deletions
+41
-5
faultrep.c
dlls/faultrep/tests/faultrep.c
+41
-5
No files found.
dlls/faultrep/tests/faultrep.c
View file @
a7897d3d
...
...
@@ -33,6 +33,34 @@
static
const
char
regpath_root
[]
=
"Software
\\
Microsoft
\\
PCHealth
\\
ErrorReporting"
;
static
const
char
regpath_exclude
[]
=
"ExclusionList"
;
static
BOOL
is_process_limited
(
void
)
{
static
BOOL
(
WINAPI
*
pOpenProcessToken
)(
HANDLE
,
DWORD
,
PHANDLE
)
=
NULL
;
HANDLE
token
;
if
(
!
pOpenProcessToken
)
{
HMODULE
hadvapi32
=
GetModuleHandleA
(
"advapi32.dll"
);
pOpenProcessToken
=
(
void
*
)
GetProcAddress
(
hadvapi32
,
"OpenProcessToken"
);
if
(
!
pOpenProcessToken
)
return
FALSE
;
}
if
(
pOpenProcessToken
(
GetCurrentProcess
(),
TOKEN_QUERY
,
&
token
))
{
BOOL
ret
;
TOKEN_ELEVATION_TYPE
type
=
TokenElevationTypeDefault
;
DWORD
size
;
ret
=
GetTokenInformation
(
token
,
TokenElevationType
,
&
type
,
sizeof
(
type
),
&
size
);
CloseHandle
(
token
);
return
(
ret
&&
type
==
TokenElevationTypeLimited
);
}
return
FALSE
;
}
/* ###### */
static
void
test_AddERExcludedApplicationA
(
void
)
...
...
@@ -68,12 +96,20 @@ static void test_AddERExcludedApplicationA(void)
SetLastError
(
0xdeadbeef
);
/* existence of the path doesn't matter this function succeeded */
res
=
AddERExcludedApplicationA
(
"winetest_faultrep.exe"
);
ok
(
res
,
"got %d and 0x%x (expected TRUE)
\n
"
,
res
,
GetLastError
());
if
(
is_process_limited
())
{
/* LastError is not set! */
ok
(
!
res
,
"AddERExcludedApplicationA should have failed got %d
\n
"
,
res
);
}
else
{
ok
(
res
,
"AddERExcludedApplicationA failed (le=0x%x)
\n
"
,
GetLastError
());
/* add, when already present */
SetLastError
(
0xdeadbeef
);
res
=
AddERExcludedApplicationA
(
"winetest_faultrep.exe"
);
ok
(
res
,
"got %d and 0x%x (expected TRUE)
\n
"
,
res
,
GetLastError
());
/* add, when already present */
SetLastError
(
0xdeadbeef
);
res
=
AddERExcludedApplicationA
(
"winetest_faultrep.exe"
);
ok
(
res
,
"AddERExcludedApplicationA failed (le=0x%x)
\n
"
,
GetLastError
());
}
/* cleanup */
RegDeleteValueA
(
hexclude
,
"winetest_faultrep.exe"
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment