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
6613580e
Commit
6613580e
authored
Sep 30, 2005
by
Vitaliy Margolen
Committed by
Alexandre Julliard
Sep 30, 2005
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add a few tests for object manager.
parent
7e9b17f7
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
160 additions
and
0 deletions
+160
-0
.cvsignore
dlls/ntdll/tests/.cvsignore
+1
-0
Makefile.in
dlls/ntdll/tests/Makefile.in
+1
-0
om.c
dlls/ntdll/tests/om.c
+158
-0
No files found.
dlls/ntdll/tests/.cvsignore
View file @
6613580e
...
@@ -5,6 +5,7 @@ error.ok
...
@@ -5,6 +5,7 @@ error.ok
generated.ok
generated.ok
info.ok
info.ok
large_int.ok
large_int.ok
om.ok
path.ok
path.ok
reg.ok
reg.ok
rtl.ok
rtl.ok
...
...
dlls/ntdll/tests/Makefile.in
View file @
6613580e
...
@@ -13,6 +13,7 @@ CTESTS = \
...
@@ -13,6 +13,7 @@ CTESTS = \
info.c
\
info.c
\
large_int.c
\
large_int.c
\
path.c
\
path.c
\
om.c
\
reg.c
\
reg.c
\
rtl.c
\
rtl.c
\
rtlbitmap.c
\
rtlbitmap.c
\
...
...
dlls/ntdll/tests/om.c
0 → 100644
View file @
6613580e
/*
* Unit test suite for object manager functions
*
* Copyright 2005 Robert Shearman
* Copyright 2005 Vitaliy Margolen
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "ntdll_test.h"
#include "winternl.h"
#include "stdio.h"
#include "winnt.h"
#include "stdlib.h"
static
NTSTATUS
(
WINAPI
*
pNtCreateEvent
)
(
PHANDLE
,
ACCESS_MASK
,
const
POBJECT_ATTRIBUTES
,
BOOLEAN
,
BOOLEAN
);
static
NTSTATUS
(
WINAPI
*
pNtCreateMutant
)(
PHANDLE
,
ACCESS_MASK
,
const
POBJECT_ATTRIBUTES
,
BOOLEAN
);
static
NTSTATUS
(
WINAPI
*
pNtOpenMutant
)
(
PHANDLE
,
ACCESS_MASK
,
const
POBJECT_ATTRIBUTES
);
static
NTSTATUS
(
WINAPI
*
pNtOpenFile
)
(
PHANDLE
,
ACCESS_MASK
,
POBJECT_ATTRIBUTES
,
PIO_STATUS_BLOCK
,
ULONG
,
ULONG
);
static
NTSTATUS
(
WINAPI
*
pNtClose
)
(
HANDLE
);
static
VOID
(
WINAPI
*
pRtlInitUnicodeString
)(
PUNICODE_STRING
,
LPCWSTR
);
static
NTSTATUS
(
WINAPI
*
pNtCreateNamedPipeFile
)(
PHANDLE
,
ULONG
,
POBJECT_ATTRIBUTES
,
PIO_STATUS_BLOCK
,
ULONG
,
ULONG
,
ULONG
,
ULONG
,
ULONG
,
ULONG
,
ULONG
,
ULONG
,
ULONG
,
PLARGE_INTEGER
);
void
test_case_sensitive
(
void
)
{
static
const
WCHAR
buffer1
[]
=
{
'\\'
,
'B'
,
'a'
,
's'
,
'e'
,
'N'
,
'a'
,
'm'
,
'e'
,
'd'
,
'O'
,
'b'
,
'j'
,
'e'
,
'c'
,
't'
,
's'
,
'\\'
,
't'
,
'e'
,
's'
,
't'
,
0
};
static
const
WCHAR
buffer2
[]
=
{
'\\'
,
'B'
,
'a'
,
's'
,
'e'
,
'N'
,
'a'
,
'm'
,
'e'
,
'd'
,
'O'
,
'b'
,
'j'
,
'e'
,
'c'
,
't'
,
's'
,
'\\'
,
'T'
,
'e'
,
's'
,
't'
,
0
};
static
const
WCHAR
buffer3
[]
=
{
'\\'
,
'B'
,
'a'
,
's'
,
'e'
,
'N'
,
'a'
,
'm'
,
'e'
,
'd'
,
'O'
,
'b'
,
'j'
,
'e'
,
'c'
,
't'
,
's'
,
'\\'
,
'T'
,
'E'
,
's'
,
't'
,
0
};
static
const
WCHAR
buffer4
[]
=
{
'\\'
,
'B'
,
'A'
,
'S'
,
'E'
,
'N'
,
'a'
,
'm'
,
'e'
,
'd'
,
'O'
,
'b'
,
'j'
,
'e'
,
'c'
,
't'
,
's'
,
'\\'
,
't'
,
'e'
,
's'
,
't'
,
0
};
NTSTATUS
status
;
OBJECT_ATTRIBUTES
attr
;
UNICODE_STRING
str
;
HANDLE
Event
,
Mutant
,
h
;
pRtlInitUnicodeString
(
&
str
,
buffer1
);
InitializeObjectAttributes
(
&
attr
,
&
str
,
0
,
0
,
NULL
);
status
=
pNtCreateMutant
(
&
Mutant
,
GENERIC_ALL
,
&
attr
,
FALSE
);
ok
(
status
==
STATUS_SUCCESS
,
"Failed to create Mutant(%08lx)
\n
"
,
status
);
status
=
pNtCreateEvent
(
&
Event
,
GENERIC_ALL
,
&
attr
,
FALSE
,
FALSE
);
ok
(
status
==
STATUS_OBJECT_NAME_COLLISION
,
"NtCreateEvent should have failed with STATUS_OBJECT_NAME_COLLISION got(%08lx)
\n
"
,
status
);
pRtlInitUnicodeString
(
&
str
,
buffer2
);
InitializeObjectAttributes
(
&
attr
,
&
str
,
0
,
0
,
NULL
);
status
=
pNtCreateEvent
(
&
Event
,
GENERIC_ALL
,
&
attr
,
FALSE
,
FALSE
);
ok
(
status
==
STATUS_SUCCESS
,
"Failed to create Event(%08lx)
\n
"
,
status
);
pRtlInitUnicodeString
(
&
str
,
buffer3
);
InitializeObjectAttributes
(
&
attr
,
&
str
,
OBJ_CASE_INSENSITIVE
,
0
,
NULL
);
status
=
pNtOpenMutant
(
&
h
,
GENERIC_ALL
,
&
attr
);
todo_wine
ok
(
status
==
STATUS_OBJECT_TYPE_MISMATCH
,
"NtOpenMutant should have failed with STATUS_OBJECT_TYPE_MISMATCH got(%08lx)
\n
"
,
status
);
pNtClose
(
Mutant
);
pRtlInitUnicodeString
(
&
str
,
buffer4
);
InitializeObjectAttributes
(
&
attr
,
&
str
,
OBJ_CASE_INSENSITIVE
,
0
,
NULL
);
status
=
pNtCreateMutant
(
&
Mutant
,
GENERIC_ALL
,
&
attr
,
FALSE
);
todo_wine
ok
(
status
==
STATUS_OBJECT_NAME_COLLISION
,
"NtCreateMutant should have failed with STATUS_OBJECT_NAME_COLLISION got(%08lx)
\n
"
,
status
);
status
=
pNtCreateEvent
(
&
h
,
GENERIC_ALL
,
&
attr
,
FALSE
,
FALSE
);
ok
(
status
==
STATUS_OBJECT_NAME_COLLISION
,
"NtCreateEvent should have failed with STATUS_OBJECT_NAME_COLLISION got(%08lx)
\n
"
,
status
);
attr
.
Attributes
=
0
;
status
=
pNtCreateMutant
(
&
Mutant
,
GENERIC_ALL
,
&
attr
,
FALSE
);
todo_wine
ok
(
status
==
STATUS_OBJECT_PATH_NOT_FOUND
,
"NtCreateMutant should have failed with STATUS_OBJECT_PATH_NOT_FOUND got(%08lx)
\n
"
,
status
);
pNtClose
(
Event
);
}
void
test_namespace_pipe
(
void
)
{
static
const
WCHAR
buffer1
[]
=
{
'\\'
,
'?'
,
'?'
,
'\\'
,
'P'
,
'I'
,
'P'
,
'E'
,
'\\'
,
't'
,
'e'
,
's'
,
't'
,
'\\'
,
'p'
,
'i'
,
'p'
,
'e'
,
0
};
static
const
WCHAR
buffer2
[]
=
{
'\\'
,
'?'
,
'?'
,
'\\'
,
'P'
,
'I'
,
'P'
,
'E'
,
'\\'
,
'T'
,
'E'
,
'S'
,
'T'
,
'\\'
,
'P'
,
'I'
,
'P'
,
'E'
,
0
};
static
const
WCHAR
buffer3
[]
=
{
'\\'
,
'?'
,
'?'
,
'\\'
,
'p'
,
'i'
,
'p'
,
'e'
,
'\\'
,
't'
,
'e'
,
's'
,
't'
,
'\\'
,
'p'
,
'i'
,
'p'
,
'e'
,
0
};
static
const
WCHAR
buffer4
[]
=
{
'\\'
,
'?'
,
'?'
,
'\\'
,
'p'
,
'i'
,
'p'
,
'e'
,
'\\'
,
't'
,
'e'
,
's'
,
't'
,
0
};
OBJECT_ATTRIBUTES
attr
;
UNICODE_STRING
str
;
IO_STATUS_BLOCK
iosb
;
NTSTATUS
status
;
LARGE_INTEGER
timeout
;
HANDLE
pipe
,
h
;
timeout
.
QuadPart
=
-
10000
;
pRtlInitUnicodeString
(
&
str
,
buffer1
);
InitializeObjectAttributes
(
&
attr
,
&
str
,
0
,
0
,
NULL
);
status
=
pNtCreateNamedPipeFile
(
&
pipe
,
GENERIC_READ
|
GENERIC_WRITE
,
&
attr
,
&
iosb
,
FILE_SHARE_READ
|
FILE_SHARE_WRITE
,
FILE_CREATE
,
FILE_PIPE_FULL_DUPLEX
,
FALSE
,
FALSE
,
FALSE
,
1
,
256
,
256
,
&
timeout
);
ok
(
status
==
STATUS_SUCCESS
,
"Failed to create NamedPipe(%08lx)
\n
"
,
status
);
status
=
pNtCreateNamedPipeFile
(
&
pipe
,
GENERIC_READ
|
GENERIC_WRITE
,
&
attr
,
&
iosb
,
FILE_SHARE_READ
|
FILE_SHARE_WRITE
,
FILE_CREATE
,
FILE_PIPE_FULL_DUPLEX
,
FALSE
,
FALSE
,
FALSE
,
1
,
256
,
256
,
&
timeout
);
todo_wine
ok
(
status
==
STATUS_INSTANCE_NOT_AVAILABLE
,
"NtCreateNamedPipeFile should have failed with STATUS_INSTANCE_NOT_AVAILABLE got(%08lx)
\n
"
,
status
);
pRtlInitUnicodeString
(
&
str
,
buffer2
);
InitializeObjectAttributes
(
&
attr
,
&
str
,
0
,
0
,
NULL
);
status
=
pNtCreateNamedPipeFile
(
&
pipe
,
GENERIC_READ
|
GENERIC_WRITE
,
&
attr
,
&
iosb
,
FILE_SHARE_READ
|
FILE_SHARE_WRITE
,
FILE_CREATE
,
FILE_PIPE_FULL_DUPLEX
,
FALSE
,
FALSE
,
FALSE
,
1
,
256
,
256
,
&
timeout
);
todo_wine
ok
(
status
==
STATUS_INSTANCE_NOT_AVAILABLE
,
"NtCreateNamedPipeFile should have failed with STATUS_INSTANCE_NOT_AVAILABLE got(%08lx)
\n
"
,
status
);
attr
.
Attributes
=
OBJ_CASE_INSENSITIVE
;
status
=
pNtOpenFile
(
&
h
,
GENERIC_READ
,
&
attr
,
&
iosb
,
FILE_SHARE_READ
|
FILE_SHARE_WRITE
,
FILE_OPEN
);
ok
(
status
==
STATUS_SUCCESS
,
"Failed to open NamedPipe(%08lx)
\n
"
,
status
);
pNtClose
(
h
);
pRtlInitUnicodeString
(
&
str
,
buffer3
);
InitializeObjectAttributes
(
&
attr
,
&
str
,
0
,
0
,
NULL
);
status
=
pNtOpenFile
(
&
h
,
GENERIC_READ
,
&
attr
,
&
iosb
,
FILE_SHARE_READ
|
FILE_SHARE_WRITE
,
FILE_OPEN
);
todo_wine
ok
(
status
==
STATUS_OBJECT_PATH_NOT_FOUND
,
"pNtOpenFile should have failed with STATUS_OBJECT_PATH_NOT_FOUND got(%08lx)
\n
"
,
status
);
pRtlInitUnicodeString
(
&
str
,
buffer4
);
InitializeObjectAttributes
(
&
attr
,
&
str
,
OBJ_CASE_INSENSITIVE
,
0
,
NULL
);
status
=
pNtOpenFile
(
&
h
,
GENERIC_READ
,
&
attr
,
&
iosb
,
FILE_SHARE_READ
|
FILE_SHARE_WRITE
,
FILE_OPEN
);
todo_wine
ok
(
status
==
STATUS_OBJECT_NAME_NOT_FOUND
,
"pNtOpenFile should have failed with STATUS_OBJECT_NAME_NOT_FOUND got(%08lx)
\n
"
,
status
);
pNtClose
(
pipe
);
}
START_TEST
(
om
)
{
HMODULE
hntdll
=
GetModuleHandleA
(
"ntdll.dll"
);
if
(
hntdll
)
{
pNtCreateEvent
=
(
void
*
)
GetProcAddress
(
hntdll
,
"NtCreateEvent"
);
pNtCreateMutant
=
(
void
*
)
GetProcAddress
(
hntdll
,
"NtCreateMutant"
);
pNtOpenMutant
=
(
void
*
)
GetProcAddress
(
hntdll
,
"NtOpenMutant"
);
pNtOpenFile
=
(
void
*
)
GetProcAddress
(
hntdll
,
"NtOpenFile"
);
pNtClose
=
(
void
*
)
GetProcAddress
(
hntdll
,
"NtClose"
);
pRtlInitUnicodeString
=
(
void
*
)
GetProcAddress
(
hntdll
,
"RtlInitUnicodeString"
);
pNtCreateNamedPipeFile
=
(
void
*
)
GetProcAddress
(
hntdll
,
"NtCreateNamedPipeFile"
);
test_case_sensitive
();
test_namespace_pipe
();
}
}
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