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
381533e5
Commit
381533e5
authored
Nov 02, 2009
by
Paul Vriens
Committed by
Alexandre Julliard
Nov 03, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
advapi32/tests: Add some OpenBackupEventLog tests.
parent
531363f6
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
102 additions
and
0 deletions
+102
-0
eventlog.c
dlls/advapi32/tests/eventlog.c
+102
-0
No files found.
dlls/advapi32/tests/eventlog.c
View file @
381533e5
...
...
@@ -404,6 +404,107 @@ static void test_read(void)
CloseEventLog
(
handle
);
}
static
void
test_openbackup
(
void
)
{
HANDLE
handle
,
handle2
,
file
;
DWORD
written
;
const
char
backup
[]
=
"backup.evt"
;
const
char
text
[]
=
"Just some text"
;
SetLastError
(
0xdeadbeef
);
handle
=
OpenBackupEventLogA
(
NULL
,
NULL
);
todo_wine
{
ok
(
handle
==
NULL
,
"Didn't expect a handle
\n
"
);
ok
(
GetLastError
()
==
ERROR_INVALID_PARAMETER
,
"Expected ERROR_INVALID_PARAMETER, got %d
\n
"
,
GetLastError
());
}
SetLastError
(
0xdeadbeef
);
handle
=
OpenBackupEventLogA
(
NULL
,
"idontexist.evt"
);
todo_wine
{
ok
(
handle
==
NULL
,
"Didn't expect a handle
\n
"
);
ok
(
GetLastError
()
==
ERROR_FILE_NOT_FOUND
,
"Expected ERROR_FILE_NOT_FOUND, got %d
\n
"
,
GetLastError
());
}
SetLastError
(
0xdeadbeef
);
handle
=
OpenBackupEventLogA
(
"IDontExist"
,
NULL
);
todo_wine
{
ok
(
handle
==
NULL
,
"Didn't expect a handle
\n
"
);
ok
(
GetLastError
()
==
ERROR_INVALID_PARAMETER
,
"Expected ERROR_INVALID_PARAMETER, got %d
\n
"
,
GetLastError
());
}
SetLastError
(
0xdeadbeef
);
handle
=
OpenBackupEventLogA
(
"IDontExist"
,
"idontexist.evt"
);
todo_wine
{
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
());
}
/* Make a backup eventlog to work with */
DeleteFileA
(
backup
);
handle
=
OpenEventLogA
(
NULL
,
"Application"
);
BackupEventLogA
(
handle
,
backup
);
CloseEventLog
(
handle
);
/* FIXME: Wine stops here */
if
(
GetFileAttributesA
(
backup
)
==
INVALID_FILE_ATTRIBUTES
)
{
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
());
/* 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
"
);
/* 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
);
/* Is there any content checking done? */
file
=
CreateFileA
(
backup
,
GENERIC_WRITE
,
0
,
NULL
,
CREATE_NEW
,
0
,
NULL
);
CloseHandle
(
file
);
SetLastError
(
0xdeadbeef
);
handle
=
OpenBackupEventLogA
(
NULL
,
backup
);
ok
(
handle
==
NULL
,
"Didn't expect a handle
\n
"
);
ok
(
GetLastError
()
==
ERROR_NOT_ENOUGH_MEMORY
||
GetLastError
()
==
ERROR_EVENTLOG_FILE_CORRUPT
,
/* Vista and Win7 */
"Expected ERROR_NOT_ENOUGH_MEMORY, got %d
\n
"
,
GetLastError
());
CloseEventLog
(
handle
);
DeleteFileA
(
backup
);
file
=
CreateFileA
(
backup
,
GENERIC_WRITE
,
0
,
NULL
,
CREATE_NEW
,
0
,
NULL
);
WriteFile
(
file
,
text
,
sizeof
(
text
),
&
written
,
NULL
);
CloseHandle
(
file
);
SetLastError
(
0xdeadbeef
);
handle
=
OpenBackupEventLogA
(
NULL
,
backup
);
ok
(
handle
==
NULL
,
"Didn't expect a handle
\n
"
);
ok
(
GetLastError
()
==
ERROR_EVENTLOG_FILE_CORRUPT
,
"Expected ERROR_EVENTLOG_FILE_CORRUPT, got %d
\n
"
,
GetLastError
());
CloseEventLog
(
handle
);
DeleteFileA
(
backup
);
}
START_TEST
(
eventlog
)
{
SetLastError
(
0xdeadbeef
);
...
...
@@ -422,5 +523,6 @@ START_TEST(eventlog)
test_count
();
test_oldest
();
test_backup
();
test_openbackup
();
test_read
();
}
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