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
5d85f578
Commit
5d85f578
authored
Apr 02, 2015
by
Andrew Cook
Committed by
Alexandre Julliard
Apr 03, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
server: Track handle count of objects.
parent
8cf9108b
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
33 additions
and
12 deletions
+33
-12
om.c
dlls/ntdll/om.c
+1
-1
server_protocol.h
include/wine/server_protocol.h
+2
-2
handle.c
server/handle.c
+19
-4
object.c
server/object.c
+6
-4
object.h
server/object.h
+1
-0
protocol.def
server/protocol.def
+1
-0
request.h
server/request.h
+2
-1
trace.c
server/trace.c
+1
-0
No files found.
dlls/ntdll/om.c
View file @
5d85f578
...
...
@@ -77,7 +77,7 @@ NTSTATUS WINAPI NtQueryObject(IN HANDLE handle,
memset
(
p
,
0
,
sizeof
(
*
p
)
);
p
->
GrantedAccess
=
reply
->
access
;
p
->
PointerCount
=
reply
->
ref_count
;
p
->
HandleCount
=
1
;
/* at least one */
p
->
HandleCount
=
reply
->
handle_count
;
if
(
used_len
)
*
used_len
=
sizeof
(
*
p
);
}
}
...
...
include/wine/server_protocol.h
View file @
5d85f578
...
...
@@ -4690,9 +4690,9 @@ struct get_object_info_reply
struct
reply_header
__header
;
unsigned
int
access
;
unsigned
int
ref_count
;
unsigned
int
handle_count
;
data_size_t
total
;
/* VARARG(name,unicode_str); */
char
__pad_20
[
4
];
};
...
...
@@ -5955,6 +5955,6 @@ union generic_reply
struct
set_job_completion_port_reply
set_job_completion_port_reply
;
};
#define SERVER_PROTOCOL_VERSION 46
5
#define SERVER_PROTOCOL_VERSION 46
6
#endif
/* __WINE_WINE_SERVER_PROTOCOL_H */
server/handle.c
View file @
5d85f578
...
...
@@ -97,6 +97,20 @@ static inline obj_handle_t handle_global_to_local( obj_handle_t handle )
return
handle
^
HANDLE_OBFUSCATOR
;
}
/* grab an object and increment its handle count */
static
struct
object
*
grab_object_for_handle
(
struct
object
*
obj
)
{
obj
->
handle_count
++
;
return
grab_object
(
obj
);
}
/* release an object and decrement its handle count */
static
void
release_object_from_handle
(
struct
object
*
obj
)
{
assert
(
obj
->
handle_count
);
obj
->
handle_count
--
;
release_object
(
obj
);
}
static
void
handle_table_dump
(
struct
object
*
obj
,
int
verbose
);
static
void
handle_table_destroy
(
struct
object
*
obj
);
...
...
@@ -166,7 +180,7 @@ static void handle_table_destroy( struct object *obj )
{
struct
object
*
obj
=
entry
->
ptr
;
entry
->
ptr
=
NULL
;
if
(
obj
)
release_object
(
obj
);
if
(
obj
)
release_object
_from_handle
(
obj
);
}
free
(
table
->
entries
);
}
...
...
@@ -229,7 +243,7 @@ static obj_handle_t alloc_entry( struct handle_table *table, void *obj, unsigned
table
->
last
=
i
;
found:
table
->
free
=
i
+
1
;
entry
->
ptr
=
grab_object
(
obj
);
entry
->
ptr
=
grab_object
_for_handle
(
obj
);
entry
->
access
=
access
;
return
index_to_handle
(
i
);
}
...
...
@@ -355,7 +369,7 @@ struct handle_table *copy_handle_table( struct process *process, struct process
for
(
i
=
0
;
i
<=
table
->
last
;
i
++
,
ptr
++
)
{
if
(
!
ptr
->
ptr
)
continue
;
if
(
ptr
->
access
&
RESERVED_INHERIT
)
grab_object
(
ptr
->
ptr
);
if
(
ptr
->
access
&
RESERVED_INHERIT
)
grab_object
_for_handle
(
ptr
->
ptr
);
else
ptr
->
ptr
=
NULL
;
/* don't inherit this entry */
}
}
...
...
@@ -379,7 +393,7 @@ unsigned int close_handle( struct process *process, obj_handle_t handle )
table
=
handle_is_global
(
handle
)
?
global_table
:
process
->
handles
;
if
(
entry
<
table
->
entries
+
table
->
free
)
table
->
free
=
entry
-
table
->
entries
;
if
(
entry
==
table
->
entries
+
table
->
last
)
shrink_handle_table
(
table
);
release_object
(
obj
);
release_object
_from_handle
(
obj
);
return
STATUS_SUCCESS
;
}
...
...
@@ -630,6 +644,7 @@ DECL_HANDLER(get_object_info)
reply
->
access
=
get_handle_access
(
current
->
process
,
req
->
handle
);
reply
->
ref_count
=
obj
->
refcount
;
reply
->
handle_count
=
obj
->
handle_count
;
if
((
name
=
get_object_full_name
(
obj
,
&
reply
->
total
)))
set_reply_data_ptr
(
name
,
min
(
reply
->
total
,
get_reply_max_size
()
));
release_object
(
obj
);
...
...
server/object.c
View file @
5d85f578
...
...
@@ -206,10 +206,11 @@ void *alloc_object( const struct object_ops *ops )
struct
object
*
obj
=
mem_alloc
(
ops
->
size
);
if
(
obj
)
{
obj
->
refcount
=
1
;
obj
->
ops
=
ops
;
obj
->
name
=
NULL
;
obj
->
sd
=
NULL
;
obj
->
refcount
=
1
;
obj
->
handle_count
=
0
;
obj
->
ops
=
ops
;
obj
->
name
=
NULL
;
obj
->
sd
=
NULL
;
list_init
(
&
obj
->
wait_queue
);
#ifdef DEBUG_OBJECTS
list_add_head
(
&
object_list
,
&
obj
->
obj_list
);
...
...
@@ -306,6 +307,7 @@ void release_object( void *ptr )
assert
(
obj
->
refcount
);
if
(
!--
obj
->
refcount
)
{
assert
(
!
obj
->
handle_count
);
/* if the refcount is 0, nobody can be in the wait queue */
assert
(
list_empty
(
&
obj
->
wait_queue
));
obj
->
ops
->
destroy
(
obj
);
...
...
server/object.h
View file @
5d85f578
...
...
@@ -95,6 +95,7 @@ struct object_ops
struct
object
{
unsigned
int
refcount
;
/* reference count */
unsigned
int
handle_count
;
/* handle count */
const
struct
object_ops
*
ops
;
struct
list
wait_queue
;
struct
object_name
*
name
;
...
...
server/protocol.def
View file @
5d85f578
...
...
@@ -3269,6 +3269,7 @@ enum coords_relative
@REPLY
unsigned int access; /* granted access mask */
unsigned int ref_count; /* object ref count */
unsigned int handle_count; /* object handle count */
data_size_t total; /* total needed size for name */
VARARG(name,unicode_str); /* object name */
@END
...
...
server/request.h
View file @
5d85f578
...
...
@@ -2088,7 +2088,8 @@ C_ASSERT( FIELD_OFFSET(struct get_object_info_request, handle) == 12 );
C_ASSERT
(
sizeof
(
struct
get_object_info_request
)
==
16
);
C_ASSERT
(
FIELD_OFFSET
(
struct
get_object_info_reply
,
access
)
==
8
);
C_ASSERT
(
FIELD_OFFSET
(
struct
get_object_info_reply
,
ref_count
)
==
12
);
C_ASSERT
(
FIELD_OFFSET
(
struct
get_object_info_reply
,
total
)
==
16
);
C_ASSERT
(
FIELD_OFFSET
(
struct
get_object_info_reply
,
handle_count
)
==
16
);
C_ASSERT
(
FIELD_OFFSET
(
struct
get_object_info_reply
,
total
)
==
20
);
C_ASSERT
(
sizeof
(
struct
get_object_info_reply
)
==
24
);
C_ASSERT
(
FIELD_OFFSET
(
struct
unlink_object_request
,
handle
)
==
12
);
C_ASSERT
(
sizeof
(
struct
unlink_object_request
)
==
16
);
...
...
server/trace.c
View file @
5d85f578
...
...
@@ -3842,6 +3842,7 @@ static void dump_get_object_info_reply( const struct get_object_info_reply *req
{
fprintf
(
stderr
,
" access=%08x"
,
req
->
access
);
fprintf
(
stderr
,
", ref_count=%08x"
,
req
->
ref_count
);
fprintf
(
stderr
,
", handle_count=%08x"
,
req
->
handle_count
);
fprintf
(
stderr
,
", total=%u"
,
req
->
total
);
dump_varargs_unicode_str
(
", name="
,
cur_size
);
}
...
...
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