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
2a86f347
Commit
2a86f347
authored
Apr 02, 2007
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernel32: Added some last error tests for mailslots.
parent
02ed704b
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
0 deletions
+21
-0
mailslot.c
dlls/kernel32/tests/mailslot.c
+21
-0
No files found.
dlls/kernel32/tests/mailslot.c
View file @
2a86f347
...
...
@@ -82,8 +82,10 @@ static int mailslot_test(void)
memset
(
buffer
,
0
,
sizeof
buffer
);
ok
(
!
ReadFile
(
hSlot
,
buffer
,
sizeof
buffer
,
&
count
,
NULL
),
"slot read
\n
"
);
ok
(
GetLastError
()
==
ERROR_SEM_TIMEOUT
,
"wrong error %u
\n
"
,
GetLastError
()
);
ok
(
!
WriteFile
(
hSlot
,
buffer
,
sizeof
buffer
,
&
count
,
NULL
),
"slot write
\n
"
);
ok
(
GetLastError
()
==
ERROR_ACCESS_DENIED
,
"wrong error %u
\n
"
,
GetLastError
()
);
/* now try and openthe client, but with the wrong sharing mode */
hWriter
=
CreateFile
(
szmspath
,
GENERIC_READ
|
GENERIC_WRITE
,
...
...
@@ -103,8 +105,10 @@ static int mailslot_test(void)
*/
ok
(
!
ReadFile
(
hSlot
,
buffer
,
sizeof
buffer
/
2
,
&
count
,
NULL
),
"slot read
\n
"
);
ok
(
GetLastError
()
==
ERROR_SEM_TIMEOUT
,
"wrong error %u
\n
"
,
GetLastError
()
);
ok
(
!
WriteFile
(
hSlot
,
buffer
,
sizeof
buffer
/
2
,
&
count
,
NULL
),
"slot write
\n
"
);
ok
(
GetLastError
()
==
ERROR_ACCESS_DENIED
,
"wrong error %u
\n
"
,
GetLastError
()
);
/*
* we can't read from this client,
...
...
@@ -112,10 +116,12 @@ static int mailslot_test(void)
*/
ok
(
!
ReadFile
(
hWriter
,
buffer
,
sizeof
buffer
/
2
,
&
count
,
NULL
),
"can read client
\n
"
);
todo_wine
ok
(
GetLastError
()
==
ERROR_INVALID_PARAMETER
,
"wrong error %u
\n
"
,
GetLastError
()
);
ok
(
WriteFile
(
hWriter
,
buffer
,
sizeof
buffer
/
2
,
&
count
,
NULL
),
"can't write client
\n
"
);
ok
(
!
ReadFile
(
hWriter
,
buffer
,
sizeof
buffer
/
2
,
&
count
,
NULL
),
"can read client
\n
"
);
todo_wine
ok
(
GetLastError
()
==
ERROR_INVALID_PARAMETER
,
"wrong error %u
\n
"
,
GetLastError
()
);
/*
* seeing as there's something in the slot,
...
...
@@ -128,6 +134,7 @@ static int mailslot_test(void)
/* but not again */
ok
(
!
ReadFile
(
hSlot
,
buffer
,
sizeof
buffer
,
&
count
,
NULL
),
"slot read
\n
"
);
ok
(
GetLastError
()
==
ERROR_SEM_TIMEOUT
,
"wrong error %u
\n
"
,
GetLastError
()
);
/* now try open another writer... should fail */
hWriter2
=
CreateFile
(
szmspath
,
GENERIC_READ
|
GENERIC_WRITE
,
...
...
@@ -183,6 +190,7 @@ static int mailslot_test(void)
/* check there's still no data */
ok
(
!
ReadFile
(
hSlot
,
buffer
,
sizeof
buffer
,
&
count
,
NULL
),
"slot read
\n
"
);
ok
(
GetLastError
()
==
ERROR_SEM_TIMEOUT
,
"wrong error %u
\n
"
,
GetLastError
()
);
/* write two messages */
buffer
[
0
]
=
'a'
;
...
...
@@ -275,12 +283,25 @@ static int mailslot_test(void)
/* check that reads fail */
ok
(
!
ReadFile
(
hSlot
,
buffer
,
sizeof
buffer
,
&
count
,
NULL
),
"3rd slot read succeeded
\n
"
);
ok
(
GetLastError
()
==
ERROR_SEM_TIMEOUT
,
"wrong error %u
\n
"
,
GetLastError
()
);
/* finally close the mailslot and its client */
ok
(
CloseHandle
(
hWriter2
),
"closing 2nd client
\n
"
);
ok
(
CloseHandle
(
hWriter
),
"closing the client
\n
"
);
ok
(
CloseHandle
(
hSlot
),
"closing the mailslot
\n
"
);
/* test timeouts */
hSlot
=
CreateMailslot
(
szmspath
,
0
,
1000
,
NULL
);
ok
(
hSlot
!=
INVALID_HANDLE_VALUE
,
"valid mailslot failed
\n
"
);
count
=
0
;
memset
(
buffer
,
0
,
sizeof
buffer
);
dwTimeout
=
GetTickCount
();
ok
(
!
ReadFile
(
hSlot
,
buffer
,
sizeof
buffer
,
&
count
,
NULL
),
"slot read
\n
"
);
ok
(
GetLastError
()
==
ERROR_SEM_TIMEOUT
,
"wrong error %u
\n
"
,
GetLastError
()
);
dwTimeout
=
GetTickCount
()
-
dwTimeout
;
todo_wine
ok
(
dwTimeout
>=
1000
,
"timeout too short %u
\n
"
,
dwTimeout
);
ok
(
CloseHandle
(
hSlot
),
"closing the mailslot
\n
"
);
return
0
;
}
...
...
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