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
1bcd38f7
Commit
1bcd38f7
authored
Dec 18, 2016
by
Zebediah Figura
Committed by
Alexandre Julliard
Dec 20, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
advapi32: Add tests for StartTrace().
Signed-off-by:
Zebediah Figura
<
z.figura12@gmail.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
f900879d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
93 additions
and
0 deletions
+93
-0
eventlog.c
dlls/advapi32/tests/eventlog.c
+92
-0
evntrace.h
include/evntrace.h
+1
-0
No files found.
dlls/advapi32/tests/eventlog.c
View file @
1bcd38f7
...
...
@@ -20,12 +20,15 @@
#include <stdarg.h>
#include "initguid.h"
#include "windef.h"
#include "winbase.h"
#include "winerror.h"
#include "winnt.h"
#include "winreg.h"
#include "sddl.h"
#include "wmistr.h"
#include "evntrace.h"
#include "wine/test.h"
...
...
@@ -1143,6 +1146,92 @@ static void cleanup_eventlog(void)
ok
(
bret
,
"Expected MoveFileEx to succeed: %d
\n
"
,
GetLastError
());
}
static
void
test_start_trace
(
void
)
{
const
char
sessionname
[]
=
"wine"
;
const
char
filepath
[]
=
"wine.etl"
;
const
char
filepath2
[]
=
"eniw.etl"
;
EVENT_TRACE_PROPERTIES
*
properties
;
TRACEHANDLE
handle
;
LONG
buffersize
;
LONG
ret
;
buffersize
=
sizeof
(
EVENT_TRACE_PROPERTIES
)
+
sizeof
(
sessionname
)
+
sizeof
(
filepath
);
properties
=
(
EVENT_TRACE_PROPERTIES
*
)
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
buffersize
);
properties
->
Wnode
.
BufferSize
=
buffersize
;
properties
->
Wnode
.
Flags
=
WNODE_FLAG_TRACED_GUID
;
properties
->
LogFileMode
=
EVENT_TRACE_FILE_MODE_NONE
;
properties
->
LoggerNameOffset
=
sizeof
(
EVENT_TRACE_PROPERTIES
);
properties
->
LogFileNameOffset
=
sizeof
(
EVENT_TRACE_PROPERTIES
)
+
sizeof
(
sessionname
);
strcpy
((
char
*
)
properties
+
properties
->
LogFileNameOffset
,
filepath
);
properties
->
Wnode
.
BufferSize
=
0
;
ret
=
StartTraceA
(
&
handle
,
sessionname
,
properties
);
todo_wine
ok
(
ret
==
ERROR_BAD_LENGTH
||
ret
==
ERROR_INVALID_PARAMETER
,
/* XP and 2k3 */
"Expected ERROR_BAD_LENGTH, got %d
\n
"
,
ret
);
properties
->
Wnode
.
BufferSize
=
buffersize
;
ret
=
StartTraceA
(
&
handle
,
"this name is too long"
,
properties
);
todo_wine
ok
(
ret
==
ERROR_BAD_LENGTH
,
"Expected ERROR_BAD_LENGTH, got %d
\n
"
,
ret
);
ret
=
StartTraceA
(
&
handle
,
sessionname
,
NULL
);
todo_wine
ok
(
ret
==
ERROR_INVALID_PARAMETER
,
"Expected ERROR_INVALID_PARAMETER, got %d
\n
"
,
ret
);
ret
=
StartTraceA
(
NULL
,
sessionname
,
properties
);
todo_wine
ok
(
ret
==
ERROR_INVALID_PARAMETER
,
"Expected ERROR_INVALID_PARAMETER, got %d
\n
"
,
ret
);
properties
->
LogFileNameOffset
=
1
;
ret
=
StartTraceA
(
&
handle
,
sessionname
,
properties
);
todo_wine
ok
(
ret
==
ERROR_INVALID_PARAMETER
,
"Expected ERROR_INVALID_PARAMETER, got %d
\n
"
,
ret
);
properties
->
LogFileNameOffset
=
sizeof
(
EVENT_TRACE_PROPERTIES
)
+
sizeof
(
sessionname
);
properties
->
LoggerNameOffset
=
1
;
ret
=
StartTraceA
(
&
handle
,
sessionname
,
properties
);
todo_wine
ok
(
ret
==
ERROR_INVALID_PARAMETER
,
"Expected ERROR_INVALID_PARAMETER, got %d
\n
"
,
ret
);
properties
->
LoggerNameOffset
=
sizeof
(
EVENT_TRACE_PROPERTIES
);
properties
->
LogFileMode
=
EVENT_TRACE_FILE_MODE_SEQUENTIAL
|
EVENT_TRACE_FILE_MODE_CIRCULAR
;
ret
=
StartTraceA
(
&
handle
,
sessionname
,
properties
);
todo_wine
ok
(
ret
==
ERROR_INVALID_PARAMETER
,
"Expected ERROR_INVALID_PARAMETER, got %d
\n
"
,
ret
);
properties
->
LogFileMode
=
EVENT_TRACE_FILE_MODE_NONE
;
/* XP creates a file we can't delete, so change the filepath to something else */
strcpy
((
char
*
)
properties
+
properties
->
LogFileNameOffset
,
filepath2
);
properties
->
Wnode
.
Guid
=
SystemTraceControlGuid
;
ret
=
StartTraceA
(
&
handle
,
sessionname
,
properties
);
todo_wine
ok
(
ret
==
ERROR_INVALID_PARAMETER
,
"Expected ERROR_INVALID_PARAMETER, got %d
\n
"
,
ret
);
properties
->
Wnode
.
Guid
=
(
GUID
){
0
};
properties
->
LogFileNameOffset
=
0
;
ret
=
StartTraceA
(
&
handle
,
sessionname
,
properties
);
todo_wine
ok
(
ret
==
ERROR_BAD_PATHNAME
,
"Expected ERROR_BAD_PATHNAME, got %d
\n
"
,
ret
);
properties
->
LogFileNameOffset
=
sizeof
(
EVENT_TRACE_PROPERTIES
)
+
sizeof
(
sessionname
);
ret
=
StartTraceA
(
&
handle
,
sessionname
,
properties
);
ok
(
ret
==
ERROR_SUCCESS
,
"Expected success, got %d
\n
"
,
ret
);
ret
=
StartTraceA
(
&
handle
,
sessionname
,
properties
);
todo_wine
ok
(
ret
==
ERROR_ALREADY_EXISTS
||
ret
==
ERROR_SHARING_VIOLATION
,
/* 2k3 */
"Expected ERROR_ALREADY_EXISTS, got %d
\n
"
,
ret
);
/* clean up */
ControlTraceA
(
handle
,
sessionname
,
properties
,
EVENT_TRACE_CONTROL_STOP
);
HeapFree
(
GetProcessHeap
(),
0
,
properties
);
DeleteFileA
(
filepath
);
}
START_TEST
(
eventlog
)
{
SetLastError
(
0xdeadbeef
);
...
...
@@ -1172,4 +1261,7 @@ START_TEST(eventlog)
test_autocreation
();
cleanup_eventlog
();
}
/* Trace tests */
test_start_trace
();
}
include/evntrace.h
View file @
1bcd38f7
...
...
@@ -236,6 +236,7 @@ typedef struct _EVENT_TRACE_PROPERTIES
ULONG
MaximumFileSize
;
ULONG
LogFileMode
;
ULONG
FlushTimer
;
ULONG
EnableFlags
;
LONG
AgeLimit
;
ULONG
NumberOfBuffers
;
ULONG
FreeBuffers
;
...
...
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