Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
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-winehq
Commits
daaae48e
Commit
daaae48e
authored
Mar 04, 2014
by
Francois Gouget
Committed by
Alexandre Julliard
Mar 04, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
advapi32/tests: Fix the backup tests when run in a non-administrator pre-Vista account.
parent
237d7891
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
11 deletions
+31
-11
eventlog.c
dlls/advapi32/tests/eventlog.c
+31
-11
No files found.
dlls/advapi32/tests/eventlog.c
View file @
daaae48e
...
...
@@ -49,17 +49,27 @@ static void init_function_pointers(void)
pWow64RevertWow64FsRedirection
=
(
void
*
)
GetProcAddress
(
hkernel32
,
"Wow64RevertWow64FsRedirection"
);
}
static
void
create_backup
(
const
char
*
filename
)
static
BOOL
create_backup
(
const
char
*
filename
)
{
HANDLE
handle
;
DWORD
rc
,
attribs
;
DeleteFileA
(
filename
);
handle
=
OpenEventLogA
(
NULL
,
"Application"
);
BackupEventLogA
(
handle
,
filename
);
rc
=
BackupEventLogA
(
handle
,
filename
);
if
(
!
rc
&&
GetLastError
()
==
ERROR_PRIVILEGE_NOT_HELD
)
{
skip
(
"insufficient privileges to backup the eventlog
\n
"
);
CloseEventLog
(
handle
);
return
FALSE
;
}
ok
(
rc
,
"BackupEventLogA failed, le=%u
\n
"
,
GetLastError
());
CloseEventLog
(
handle
);
attribs
=
GetFileAttributesA
(
filename
);
todo_wine
ok
(
GetFileAttributesA
(
filename
)
!=
INVALID_FILE_ATTRIBUTES
,
"Expected a backup file
\n
"
);
ok
(
attribs
!=
INVALID_FILE_ATTRIBUTES
,
"Expected a backup file attribs=%#x le=%u
\n
"
,
attribs
,
GetLastError
());
return
TRUE
;
}
static
void
test_open_close
(
void
)
...
...
@@ -209,11 +219,11 @@ static void test_count(void)
CloseEventLog
(
handle
);
/* Make a backup eventlog to work with */
create_backup
(
backup
);
if
(
create_backup
(
backup
))
{
handle
=
OpenBackupEventLogA
(
NULL
,
backup
);
todo_wine
ok
(
handle
!=
NULL
,
"Expected a handle
\n
"
);
ok
(
handle
!=
NULL
,
"Expected a handle, le=%d
\n
"
,
GetLastError
()
);
/* Does GetNumberOfEventLogRecords work with backup eventlogs? */
count
=
0xdeadbeef
;
...
...
@@ -226,6 +236,7 @@ static void test_count(void)
CloseEventLog
(
handle
);
DeleteFileA
(
backup
);
}
}
static
void
test_oldest
(
void
)
...
...
@@ -262,8 +273,8 @@ static void test_oldest(void)
CloseEventLog
(
handle
);
/* Make a backup eventlog to work with */
create_backup
(
backup
);
if
(
create_backup
(
backup
))
{
handle
=
OpenBackupEventLogA
(
NULL
,
backup
);
todo_wine
ok
(
handle
!=
NULL
,
"Expected a handle
\n
"
);
...
...
@@ -279,6 +290,7 @@ static void test_oldest(void)
CloseEventLog
(
handle
);
DeleteFileA
(
backup
);
}
}
static
void
test_backup
(
void
)
...
...
@@ -306,6 +318,12 @@ static void test_backup(void)
ok
(
GetLastError
()
==
ERROR_INVALID_PARAMETER
,
"Expected ERROR_INVALID_PARAMETER, got %d
\n
"
,
GetLastError
());
ret
=
BackupEventLogA
(
handle
,
backup
);
if
(
!
ret
&&
GetLastError
()
==
ERROR_PRIVILEGE_NOT_HELD
)
{
skip
(
"insufficient privileges for backup tests
\n
"
);
CloseEventLog
(
handle
);
return
;
}
ok
(
ret
,
"Expected success
\n
"
);
todo_wine
ok
(
GetFileAttributesA
(
backup
)
!=
INVALID_FILE_ATTRIBUTES
,
"Expected a backup file
\n
"
);
...
...
@@ -516,8 +534,8 @@ static void test_openbackup(void)
"Expected RPC_S_SERVER_UNAVAILABLE, got %d
\n
"
,
GetLastError
());
/* Make a backup eventlog to work with */
create_backup
(
backup
);
if
(
create_backup
(
backup
))
{
/* FIXME: Wine stops here */
if
(
GetFileAttributesA
(
backup
)
==
INVALID_FILE_ATTRIBUTES
)
{
...
...
@@ -548,6 +566,7 @@ static void test_openbackup(void)
CloseEventLog
(
handle
);
DeleteFileA
(
backup
);
}
/* Is there any content checking done? */
file
=
CreateFileA
(
backup
,
GENERIC_WRITE
,
0
,
NULL
,
CREATE_NEW
,
0
,
NULL
);
...
...
@@ -585,7 +604,8 @@ static void test_clear(void)
ok
(
GetLastError
()
==
ERROR_INVALID_HANDLE
,
"Expected ERROR_INVALID_HANDLE, got %d
\n
"
,
GetLastError
());
/* Make a backup eventlog to work with */
create_backup
(
backup
);
if
(
!
create_backup
(
backup
))
return
;
SetLastError
(
0xdeadbeef
);
ret
=
ClearEventLogA
(
NULL
,
backup
);
...
...
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