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
9015eebf
Commit
9015eebf
authored
Feb 22, 2024
by
Hans Leidekker
Committed by
Alexandre Julliard
Feb 23, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wbemprox: Protect tables with a critical section.
Wine-Bug:
https://bugs.winehq.org/show_bug.cgi?id=56334
parent
ce6e298a
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
27 additions
and
9 deletions
+27
-9
class.c
dlls/wbemprox/class.c
+1
-1
query.c
dlls/wbemprox/query.c
+3
-2
table.c
dlls/wbemprox/table.c
+21
-4
wbemprox_private.h
dlls/wbemprox/wbemprox_private.h
+2
-2
No files found.
dlls/wbemprox/class.c
View file @
9015eebf
...
...
@@ -236,7 +236,7 @@ static struct record *create_record( struct table *table )
record
->
fields
[
i
].
u
.
ival
=
0
;
}
record
->
count
=
table
->
num_cols
;
record
->
table
=
addref
_table
(
table
);
record
->
table
=
grab
_table
(
table
);
return
record
;
}
...
...
dlls/wbemprox/query.c
View file @
9015eebf
...
...
@@ -54,11 +54,12 @@ HRESULT create_view( enum view_type type, enum wbm_namespace ns, const WCHAR *pa
case
VIEW_TYPE_SELECT
:
{
struct
table
*
table
=
grab
_table
(
ns
,
class
);
struct
table
*
table
=
find
_table
(
ns
,
class
);
HRESULT
hr
;
if
(
table
&&
(
hr
=
append_table
(
view
,
table
))
!=
S_OK
)
{
release_table
(
table
);
free
(
view
);
return
hr
;
}
...
...
@@ -631,7 +632,7 @@ static HRESULT get_antecedent_table( enum wbm_namespace ns, const WCHAR *assoccl
}
if
((
hr
=
do_query
(
ns
,
str
,
&
query
))
!=
S_OK
)
goto
done
;
if
(
query
->
view
->
table_count
)
*
table
=
addref
_table
(
query
->
view
->
table
[
0
]
);
if
(
query
->
view
->
table_count
)
*
table
=
grab
_table
(
query
->
view
->
table
[
0
]
);
else
*
table
=
NULL
;
done:
...
...
dlls/wbemprox/table.c
View file @
9015eebf
...
...
@@ -29,6 +29,15 @@
WINE_DEFAULT_DEBUG_CHANNEL
(
wbemprox
);
static
CRITICAL_SECTION
table_cs
;
static
CRITICAL_SECTION_DEBUG
table_debug
=
{
0
,
0
,
&
table_cs
,
{
&
table_debug
.
ProcessLocksList
,
&
table_debug
.
ProcessLocksList
},
0
,
0
,
{
(
DWORD_PTR
)(
__FILE__
": table_cs"
)
}
};
static
CRITICAL_SECTION
table_cs
=
{
&
table_debug
,
-
1
,
0
,
0
,
0
,
0
};
HRESULT
get_column_index
(
const
struct
table
*
table
,
const
WCHAR
*
name
,
UINT
*
column
)
{
UINT
i
;
...
...
@@ -329,6 +338,7 @@ void free_table( struct table *table )
{
if
(
!
table
)
return
;
EnterCriticalSection
(
&
table_cs
);
clear_table
(
table
);
if
(
table
->
flags
&
TABLE_FLAG_DYNAMIC
)
{
...
...
@@ -339,20 +349,23 @@ void free_table( struct table *table )
list_remove
(
&
table
->
entry
);
free
(
table
);
}
LeaveCriticalSection
(
&
table_cs
);
}
void
release_table
(
struct
table
*
table
)
{
if
(
!
InterlockedDecrement
(
&
table
->
refs
))
free_table
(
table
);
LeaveCriticalSection
(
&
table_cs
);
}
struct
table
*
addref
_table
(
struct
table
*
table
)
struct
table
*
grab
_table
(
struct
table
*
table
)
{
EnterCriticalSection
(
&
table_cs
);
InterlockedIncrement
(
&
table
->
refs
);
return
table
;
}
struct
table
*
grab
_table
(
enum
wbm_namespace
ns
,
const
WCHAR
*
name
)
struct
table
*
find
_table
(
enum
wbm_namespace
ns
,
const
WCHAR
*
name
)
{
struct
table
*
table
;
...
...
@@ -363,7 +376,7 @@ struct table *grab_table( enum wbm_namespace ns, const WCHAR *name )
if
(
name
&&
!
wcsicmp
(
table
->
name
,
name
))
{
TRACE
(
"returning %p
\n
"
,
table
);
return
addref
_table
(
table
);
return
grab
_table
(
table
);
}
}
return
NULL
;
...
...
@@ -395,15 +408,19 @@ BOOL add_table( enum wbm_namespace ns, struct table *table )
if
(
ns
==
WBEMPROX_NAMESPACE_LAST
)
return
FALSE
;
EnterCriticalSection
(
&
table_cs
);
LIST_FOR_EACH_ENTRY
(
iter
,
table_list
[
ns
],
struct
table
,
entry
)
{
if
(
!
wcsicmp
(
iter
->
name
,
table
->
name
))
{
TRACE
(
"table %s already exists
\n
"
,
debugstr_w
(
table
->
name
));
LeaveCriticalSection
(
&
table_cs
);
return
FALSE
;
}
}
list_add_tail
(
table_list
[
ns
],
&
table
->
entry
);
LeaveCriticalSection
(
&
table_cs
);
TRACE
(
"added %p
\n
"
,
table
);
return
TRUE
;
}
...
...
@@ -414,7 +431,7 @@ BSTR get_method_name( enum wbm_namespace ns, const WCHAR *class, UINT index )
UINT
i
,
count
=
0
;
BSTR
ret
;
if
(
!
(
table
=
grab
_table
(
ns
,
class
)))
return
NULL
;
if
(
!
(
table
=
find
_table
(
ns
,
class
)))
return
NULL
;
for
(
i
=
0
;
i
<
table
->
num_cols
;
i
++
)
{
...
...
dlls/wbemprox/wbemprox_private.h
View file @
9015eebf
...
...
@@ -215,8 +215,8 @@ HRESULT execute_view( struct view * );
struct
table
*
get_view_table
(
const
struct
view
*
,
UINT
);
void
init_table_list
(
void
);
enum
wbm_namespace
get_namespace_from_string
(
const
WCHAR
*
namespace
);
struct
table
*
grab
_table
(
enum
wbm_namespace
,
const
WCHAR
*
);
struct
table
*
addref
_table
(
struct
table
*
);
struct
table
*
find
_table
(
enum
wbm_namespace
,
const
WCHAR
*
);
struct
table
*
grab
_table
(
struct
table
*
);
void
release_table
(
struct
table
*
);
struct
table
*
create_table
(
const
WCHAR
*
,
UINT
,
const
struct
column
*
,
UINT
,
UINT
,
BYTE
*
,
enum
fill_status
(
*
)(
struct
table
*
,
const
struct
expr
*
)
);
...
...
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