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
76bfbf43
Commit
76bfbf43
authored
Jun 05, 2013
by
Piotr Caban
Committed by
Alexandre Julliard
Jun 05, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
server: Don't create new handle when DUP_HANDLE_CLOSE_SOURCE is used if possible.
parent
8c882f68
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
8 deletions
+11
-8
om.c
dlls/ntdll/om.c
+1
-6
handle.c
server/handle.c
+10
-2
No files found.
dlls/ntdll/om.c
View file @
76bfbf43
...
...
@@ -332,17 +332,12 @@ NTSTATUS WINAPI NtDuplicateObject( HANDLE source_process, HANDLE source,
if
(
!
(
ret
=
wine_server_call
(
req
)))
{
if
(
dest
)
*
dest
=
wine_server_ptr_handle
(
reply
->
handle
);
if
(
reply
->
closed
)
{
if
(
reply
->
self
)
if
(
reply
->
closed
&&
reply
->
self
)
{
int
fd
=
server_remove_fd_from_cache
(
source
);
if
(
fd
!=
-
1
)
close
(
fd
);
}
}
else
if
(
options
&
DUPLICATE_CLOSE_SOURCE
)
WARN
(
"failed to close handle %p in process %p
\n
"
,
source
,
source_process
);
}
}
SERVER_END_REQ
;
return
ret
;
...
...
server/handle.c
View file @
76bfbf43
...
...
@@ -531,6 +531,13 @@ obj_handle_t duplicate_handle( struct process *src, obj_handle_t src_handle, str
{
if
(
options
&
DUP_HANDLE_MAKE_GLOBAL
)
res
=
alloc_global_handle_no_access_check
(
obj
,
access
);
else
if
((
options
&
DUP_HANDLE_CLOSE_SOURCE
)
&&
src
==
dst
&&
entry
&&
!
(
entry
->
access
&
RESERVED_CLOSE_PROTECT
))
{
if
(
attr
&
OBJ_INHERIT
)
access
|=
RESERVED_INHERIT
;
entry
->
access
=
access
;
res
=
src_handle
;
}
else
res
=
alloc_handle_no_access_check
(
dst
,
obj
,
access
,
attr
);
}
...
...
@@ -581,7 +588,7 @@ DECL_HANDLER(set_handle_info)
/* duplicate a handle */
DECL_HANDLER
(
dup_handle
)
{
struct
process
*
src
,
*
dst
;
struct
process
*
src
,
*
dst
=
NULL
;
reply
->
handle
=
0
;
if
((
src
=
get_process_from_handle
(
req
->
src_process
,
PROCESS_DUP_HANDLE
)))
...
...
@@ -598,7 +605,8 @@ DECL_HANDLER(dup_handle)
release_object
(
dst
);
}
/* close the handle no matter what happened */
if
(
req
->
options
&
DUP_HANDLE_CLOSE_SOURCE
)
reply
->
closed
=
!
close_handle
(
src
,
req
->
src_handle
);
if
((
req
->
options
&
DUP_HANDLE_CLOSE_SOURCE
)
&&
(
src
!=
dst
||
req
->
src_handle
!=
reply
->
handle
))
reply
->
closed
=
!
close_handle
(
src
,
req
->
src_handle
);
reply
->
self
=
(
src
==
current
->
process
);
release_object
(
src
);
}
...
...
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