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
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
79 additions
and
59 deletions
+79
-59
eventlog.c
dlls/advapi32/tests/eventlog.c
+79
-59
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,23 +219,24 @@ 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, le=%d
\n
"
,
GetLastError
());
handle
=
OpenBackupEventLogA
(
NULL
,
backup
);
todo_wine
ok
(
handle
!=
NULL
,
"Expected a handle
\n
"
);
/* Does GetNumberOfEventLogRecords work with backup eventlogs? */
count
=
0xdeadbeef
;
ret
=
GetNumberOfEventLogRecords
(
handle
,
&
count
);
todo_wine
{
ok
(
ret
,
"Expected success
\n
"
);
ok
(
count
!=
0xdeadbeef
,
"Expected the number of records
\n
"
);
}
/* Does GetNumberOfEventLogRecords work with backup eventlogs? */
count
=
0xdeadbeef
;
ret
=
GetNumberOfEventLogRecords
(
handle
,
&
count
);
todo_wine
{
ok
(
ret
,
"Expected success
\n
"
);
ok
(
count
!=
0xdeadbeef
,
"Expected the number of records
\n
"
);
CloseEventLog
(
handle
);
DeleteFileA
(
backup
);
}
CloseEventLog
(
handle
);
DeleteFileA
(
backup
);
}
static
void
test_oldest
(
void
)
...
...
@@ -262,23 +273,24 @@ 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
"
);
handle
=
OpenBackupEventLogA
(
NULL
,
backup
);
todo_wine
ok
(
handle
!=
NULL
,
"Expected a handle
\n
"
);
/* Does GetOldestEventLogRecord work with backup eventlogs? */
oldest
=
0xdeadbeef
;
ret
=
GetOldestEventLogRecord
(
handle
,
&
oldest
);
todo_wine
{
ok
(
ret
,
"Expected success
\n
"
);
ok
(
oldest
!=
0xdeadbeef
,
"Expected the number of the oldest record
\n
"
);
}
/* Does GetOldestEventLogRecord work with backup eventlogs? */
oldest
=
0xdeadbeef
;
ret
=
GetOldestEventLogRecord
(
handle
,
&
oldest
);
todo_wine
{
ok
(
ret
,
"Expected success
\n
"
);
ok
(
oldest
!=
0xdeadbeef
,
"Expected the number of the oldest record
\n
"
);
CloseEventLog
(
handle
);
DeleteFileA
(
backup
);
}
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,38 +534,39 @@ static void test_openbackup(void)
"Expected RPC_S_SERVER_UNAVAILABLE, got %d
\n
"
,
GetLastError
());
/* Make a backup eventlog to work with */
create_backup
(
backup
);
/* FIXME: Wine stops here */
if
(
GetFileAttributesA
(
backup
)
==
INVALID_FILE_ATTRIBUTES
)
if
(
create_backup
(
backup
))
{
skip
(
"We don't have a backup eventlog to work with
\n
"
);
return
;
}
SetLastError
(
0xdeadbeef
);
handle
=
OpenBackupEventLogA
(
"IDontExist"
,
backup
);
ok
(
handle
==
NULL
,
"Didn't expect a handle
\n
"
);
ok
(
GetLastError
()
==
RPC_S_SERVER_UNAVAILABLE
||
GetLastError
()
==
RPC_S_INVALID_NET_ADDR
,
/* Some Vista and Win7 */
"Expected RPC_S_SERVER_UNAVAILABLE, got %d
\n
"
,
GetLastError
());
/* FIXME: Wine stops here */
if
(
GetFileAttributesA
(
backup
)
==
INVALID_FILE_ATTRIBUTES
)
{
skip
(
"We don't have a backup eventlog to work with
\n
"
);
return
;
}
/* Empty servername should be read as local server */
handle
=
OpenBackupEventLogA
(
""
,
backup
);
ok
(
handle
!=
NULL
,
"Expected a handle
\n
"
);
CloseEventLog
(
handle
);
SetLastError
(
0xdeadbeef
);
handle
=
OpenBackupEventLogA
(
"IDontExist"
,
backup
);
ok
(
handle
==
NULL
,
"Didn't expect a handle
\n
"
);
ok
(
GetLastError
()
==
RPC_S_SERVER_UNAVAILABLE
||
GetLastError
()
==
RPC_S_INVALID_NET_ADDR
,
/* Some Vista and Win7 */
"Expected RPC_S_SERVER_UNAVAILABLE, got %d
\n
"
,
GetLastError
());
/* Empty servername should be read as local server */
handle
=
OpenBackupEventLogA
(
""
,
backup
);
ok
(
handle
!=
NULL
,
"Expected a handle
\n
"
);
CloseEventLog
(
handle
);
handle
=
OpenBackupEventLogA
(
NULL
,
backup
);
ok
(
handle
!=
NULL
,
"Expected a handle
\n
"
);
handle
=
OpenBackupEventLogA
(
NULL
,
backup
);
ok
(
handle
!=
NULL
,
"Expected a handle
\n
"
);
/* Can we open that same backup eventlog more than once? */
handle2
=
OpenBackupEventLogA
(
NULL
,
backup
);
ok
(
handle2
!=
NULL
,
"Expected a handle
\n
"
);
ok
(
handle2
!=
handle
,
"Didn't expect the same handle
\n
"
);
CloseEventLog
(
handle2
);
/* Can we open that same backup eventlog more than once? */
handle2
=
OpenBackupEventLogA
(
NULL
,
backup
);
ok
(
handle2
!=
NULL
,
"Expected a handle
\n
"
);
ok
(
handle2
!=
handle
,
"Didn't expect the same handle
\n
"
);
CloseEventLog
(
handle2
);
CloseEventLog
(
handle
);
DeleteFileA
(
backup
);
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