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
893987b8
Commit
893987b8
authored
Nov 21, 2005
by
Vitaliy Margolen
Committed by
Alexandre Julliard
Nov 21, 2005
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Return correct error on name collision when creating new named
objects. Check for correct error in affected places.
parent
2d41fcd8
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
31 additions
and
21 deletions
+31
-21
om.c
dlls/ntdll/tests/om.c
+12
-8
event.c
server/event.c
+1
-1
mailslot.c
server/mailslot.c
+1
-1
mapping.c
server/mapping.c
+1
-1
mutex.c
server/mutex.c
+1
-1
named_pipe.c
server/named_pipe.c
+3
-3
object.c
server/object.c
+7
-2
semaphore.c
server/semaphore.c
+1
-1
timer.c
server/timer.c
+1
-1
trace.c
server/trace.c
+1
-0
winstation.c
server/winstation.c
+2
-2
No files found.
dlls/ntdll/tests/om.c
View file @
893987b8
...
...
@@ -179,7 +179,7 @@ static void test_name_collisions(void)
NTSTATUS
status
;
UNICODE_STRING
str
;
OBJECT_ATTRIBUTES
attr
;
HANDLE
h
,
h1
,
h2
;
HANDLE
dir
,
h
,
h1
,
h2
;
DWORD
winerr
;
LARGE_INTEGER
size
;
...
...
@@ -204,12 +204,15 @@ static void test_name_collisions(void)
pRtlFreeUnicodeString
(
&
str
);
pRtlCreateUnicodeStringFromAsciiz
(
&
str
,
"
\\
BaseNamedObjects
\\
om.c-test"
);
pRtlCreateUnicodeStringFromAsciiz
(
&
str
,
"
\\
BaseNamedObjects"
);
DIR_TEST_OPEN_SUCCESS
(
&
dir
)
pRtlCreateUnicodeStringFromAsciiz
(
&
str
,
"om.c-test"
);
InitializeObjectAttributes
(
&
attr
,
&
str
,
OBJ_OPENIF
,
dir
,
NULL
);
h
=
CreateMutexA
(
NULL
,
FALSE
,
"om.c-test"
);
ok
(
h
!=
0
,
"CreateMutexA failed got ret=%p (%ld)
\n
"
,
h
,
GetLastError
());
status
=
pNtCreateMutant
(
&
h1
,
GENERIC_ALL
,
&
attr
,
FALSE
);
todo_wine
ok
(
status
==
STATUS_OBJECT_NAME_EXISTS
&&
h1
!=
NULL
,
ok
(
status
==
STATUS_OBJECT_NAME_EXISTS
&&
h1
!=
NULL
,
"NtCreateMutant should have succeeded with STATUS_OBJECT_NAME_EXISTS got(%08lx)
\n
"
,
status
);
h2
=
CreateMutexA
(
NULL
,
FALSE
,
"om.c-test"
);
winerr
=
GetLastError
();
...
...
@@ -222,7 +225,7 @@ static void test_name_collisions(void)
h
=
CreateEventA
(
NULL
,
FALSE
,
FALSE
,
"om.c-test"
);
ok
(
h
!=
0
,
"CreateEventA failed got ret=%p (%ld)
\n
"
,
h
,
GetLastError
());
status
=
pNtCreateEvent
(
&
h1
,
GENERIC_ALL
,
&
attr
,
FALSE
,
FALSE
);
todo_wine
ok
(
status
==
STATUS_OBJECT_NAME_EXISTS
&&
h1
!=
NULL
,
ok
(
status
==
STATUS_OBJECT_NAME_EXISTS
&&
h1
!=
NULL
,
"NtCreateEvent should have succeeded with STATUS_OBJECT_NAME_EXISTS got(%08lx)
\n
"
,
status
);
h2
=
CreateEventA
(
NULL
,
FALSE
,
FALSE
,
"om.c-test"
);
winerr
=
GetLastError
();
...
...
@@ -235,7 +238,7 @@ static void test_name_collisions(void)
h
=
CreateSemaphoreA
(
NULL
,
1
,
2
,
"om.c-test"
);
ok
(
h
!=
0
,
"CreateSemaphoreA failed got ret=%p (%ld)
\n
"
,
h
,
GetLastError
());
status
=
pNtCreateSemaphore
(
&
h1
,
GENERIC_ALL
,
&
attr
,
1
,
2
);
todo_wine
ok
(
status
==
STATUS_OBJECT_NAME_EXISTS
&&
h1
!=
NULL
,
ok
(
status
==
STATUS_OBJECT_NAME_EXISTS
&&
h1
!=
NULL
,
"NtCreateSemaphore should have succeeded with STATUS_OBJECT_NAME_EXISTS got(%08lx)
\n
"
,
status
);
h2
=
CreateSemaphoreA
(
NULL
,
1
,
2
,
"om.c-test"
);
winerr
=
GetLastError
();
...
...
@@ -248,7 +251,7 @@ static void test_name_collisions(void)
h
=
CreateWaitableTimerA
(
NULL
,
TRUE
,
"om.c-test"
);
ok
(
h
!=
0
,
"CreateWaitableTimerA failed got ret=%p (%ld)
\n
"
,
h
,
GetLastError
());
status
=
pNtCreateTimer
(
&
h1
,
GENERIC_ALL
,
&
attr
,
NotificationTimer
);
todo_wine
ok
(
status
==
STATUS_OBJECT_NAME_EXISTS
&&
h1
!=
NULL
,
ok
(
status
==
STATUS_OBJECT_NAME_EXISTS
&&
h1
!=
NULL
,
"NtCreateTimer should have succeeded with STATUS_OBJECT_NAME_EXISTS got(%08lx)
\n
"
,
status
);
h2
=
CreateWaitableTimerA
(
NULL
,
TRUE
,
"om.c-test"
);
winerr
=
GetLastError
();
...
...
@@ -263,7 +266,7 @@ static void test_name_collisions(void)
size
.
u
.
LowPart
=
256
;
size
.
u
.
HighPart
=
0
;
status
=
pNtCreateSection
(
&
h1
,
SECTION_MAP_WRITE
,
&
attr
,
&
size
,
PAGE_READWRITE
,
SEC_COMMIT
,
0
);
todo_wine
ok
(
status
==
STATUS_OBJECT_NAME_EXISTS
&&
h1
!=
NULL
,
ok
(
status
==
STATUS_OBJECT_NAME_EXISTS
&&
h1
!=
NULL
,
"NtCreateSection should have succeeded with STATUS_OBJECT_NAME_EXISTS got(%08lx)
\n
"
,
status
);
h2
=
CreateFileMappingA
(
INVALID_HANDLE_VALUE
,
NULL
,
PAGE_READWRITE
,
0
,
256
,
"om.c-test"
);
winerr
=
GetLastError
();
...
...
@@ -274,6 +277,7 @@ static void test_name_collisions(void)
pNtClose
(
h2
);
pRtlFreeUnicodeString
(
&
str
);
pNtClose
(
dir
);
}
void
test_directory
(
void
)
...
...
server/event.c
View file @
893987b8
...
...
@@ -66,7 +66,7 @@ struct event *create_event( const struct unicode_str *name, unsigned int attr,
if
((
event
=
create_named_object
(
sync_namespace
,
&
event_ops
,
name
,
attr
)))
{
if
(
get_error
()
!=
STATUS_OBJECT_NAME_
COLLISION
)
if
(
get_error
()
!=
STATUS_OBJECT_NAME_
EXISTS
)
{
/* initialize it if it didn't already exist */
event
->
manual_reset
=
manual_reset
;
...
...
server/mailslot.c
View file @
893987b8
...
...
@@ -230,7 +230,7 @@ static struct mailslot *create_mailslot( const struct unicode_str *name, unsigne
return
NULL
;
/* it already exists - there can only be one mailslot to read from */
if
(
get_error
()
==
STATUS_OBJECT_NAME_
COLLISION
)
if
(
get_error
()
==
STATUS_OBJECT_NAME_
EXISTS
)
{
release_object
(
mailslot
);
return
NULL
;
...
...
server/mapping.c
View file @
893987b8
...
...
@@ -280,7 +280,7 @@ static struct object *create_mapping( const struct unicode_str *name, unsigned i
if
(
!
(
mapping
=
create_named_object
(
sync_namespace
,
&
mapping_ops
,
name
,
attr
)))
return
NULL
;
if
(
get_error
()
==
STATUS_OBJECT_NAME_
COLLISION
)
if
(
get_error
()
==
STATUS_OBJECT_NAME_
EXISTS
)
return
&
mapping
->
obj
;
/* Nothing else to do */
mapping
->
header_size
=
0
;
...
...
server/mutex.c
View file @
893987b8
...
...
@@ -68,7 +68,7 @@ static struct mutex *create_mutex( const struct unicode_str *name, unsigned int
if
((
mutex
=
create_named_object
(
sync_namespace
,
&
mutex_ops
,
name
,
attr
)))
{
if
(
get_error
()
!=
STATUS_OBJECT_NAME_
COLLISION
)
if
(
get_error
()
!=
STATUS_OBJECT_NAME_
EXISTS
)
{
/* initialize it if it didn't already exist */
mutex
->
count
=
0
;
...
...
server/named_pipe.c
View file @
893987b8
...
...
@@ -444,10 +444,10 @@ static struct named_pipe *create_named_pipe( const struct unicode_str *name, uns
{
struct
named_pipe
*
pipe
;
pipe
=
create_named_object
(
sync_namespace
,
&
named_pipe_ops
,
name
,
attr
);
pipe
=
create_named_object
(
sync_namespace
,
&
named_pipe_ops
,
name
,
attr
|
OBJ_OPENIF
);
if
(
pipe
)
{
if
(
get_error
()
!=
STATUS_OBJECT_NAME_
COLLISION
)
if
(
get_error
()
!=
STATUS_OBJECT_NAME_
EXISTS
)
{
/* initialize it if it didn't already exist */
pipe
->
instances
=
0
;
...
...
@@ -552,7 +552,7 @@ DECL_HANDLER(create_named_pipe)
get_req_unicode_str
(
&
name
);
if
(
!
(
pipe
=
create_named_pipe
(
&
name
,
req
->
attributes
)))
return
;
if
(
get_error
()
!=
STATUS_OBJECT_NAME_
COLLISION
)
if
(
get_error
()
!=
STATUS_OBJECT_NAME_
EXISTS
)
{
pipe
->
insize
=
req
->
insize
;
pipe
->
outsize
=
req
->
outsize
;
...
...
server/object.c
View file @
893987b8
...
...
@@ -166,12 +166,17 @@ void *create_named_object( struct namespace *namespace, const struct object_ops
if
((
obj
=
find_object
(
namespace
,
name
,
attributes
)))
{
if
(
obj
->
ops
!=
ops
)
if
(
attributes
&
OBJ_OPENIF
&&
obj
->
ops
==
ops
)
set_error
(
STATUS_OBJECT_NAME_EXISTS
);
else
{
release_object
(
obj
);
obj
=
NULL
;
if
(
attributes
&
OBJ_OPENIF
)
set_error
(
STATUS_OBJECT_TYPE_MISMATCH
);
else
set_error
(
STATUS_OBJECT_NAME_COLLISION
);
}
set_error
(
STATUS_OBJECT_NAME_COLLISION
);
return
obj
;
}
if
(
!
(
name_ptr
=
alloc_name
(
name
)))
return
NULL
;
...
...
server/semaphore.c
View file @
893987b8
...
...
@@ -71,7 +71,7 @@ static struct semaphore *create_semaphore( const struct unicode_str *name, unsig
}
if
((
sem
=
create_named_object
(
sync_namespace
,
&
semaphore_ops
,
name
,
attr
)))
{
if
(
get_error
()
!=
STATUS_OBJECT_NAME_
COLLISION
)
if
(
get_error
()
!=
STATUS_OBJECT_NAME_
EXISTS
)
{
/* initialize it if it didn't already exist */
sem
->
count
=
initial
;
...
...
server/timer.c
View file @
893987b8
...
...
@@ -75,7 +75,7 @@ static struct timer *create_timer( const struct unicode_str *name, unsigned int
if
((
timer
=
create_named_object
(
sync_namespace
,
&
timer_ops
,
name
,
attr
)))
{
if
(
get_error
()
!=
STATUS_OBJECT_NAME_
COLLISION
)
if
(
get_error
()
!=
STATUS_OBJECT_NAME_
EXISTS
)
{
/* initialize it if it didn't already exist */
timer
->
manual
=
manual
;
...
...
server/trace.c
View file @
893987b8
...
...
@@ -3763,6 +3763,7 @@ static const struct
{
"NO_SUCH_FILE"
,
STATUS_NO_SUCH_FILE
},
{
"NO_TOKEN"
,
STATUS_NO_TOKEN
},
{
"OBJECT_NAME_COLLISION"
,
STATUS_OBJECT_NAME_COLLISION
},
{
"OBJECT_NAME_EXISTS"
,
STATUS_OBJECT_NAME_EXISTS
},
{
"OBJECT_NAME_INVALID"
,
STATUS_OBJECT_NAME_INVALID
},
{
"OBJECT_NAME_NOT_FOUND"
,
STATUS_OBJECT_NAME_NOT_FOUND
},
{
"OBJECT_PATH_INVALID"
,
STATUS_OBJECT_PATH_INVALID
},
...
...
server/winstation.c
View file @
893987b8
...
...
@@ -96,7 +96,7 @@ static struct winstation *create_winstation( const struct unicode_str *name, uns
if
((
winstation
=
create_named_object
(
winstation_namespace
,
&
winstation_ops
,
name
,
attr
)))
{
if
(
get_error
()
!=
STATUS_OBJECT_NAME_
COLLISION
)
if
(
get_error
()
!=
STATUS_OBJECT_NAME_
EXISTS
)
{
/* initialize it if it didn't already exist */
winstation
->
flags
=
flags
;
...
...
@@ -186,7 +186,7 @@ static struct desktop *create_desktop( const struct unicode_str *name, unsigned
if
((
desktop
=
create_named_object
(
winstation_namespace
,
&
desktop_ops
,
&
full_str
,
attr
)))
{
if
(
get_error
()
!=
STATUS_OBJECT_NAME_
COLLISION
)
if
(
get_error
()
!=
STATUS_OBJECT_NAME_
EXISTS
)
{
/* initialize it if it didn't already exist */
desktop
->
flags
=
flags
;
...
...
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