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
ca7a7abe
Commit
ca7a7abe
authored
May 24, 2023
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernelbase: Add a helper function to validate process/thread attributes.
parent
4356fe0d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
59 deletions
+34
-59
process.c
dlls/kernelbase/process.c
+34
-59
No files found.
dlls/kernelbase/process.c
View file @
ca7a7abe
...
...
@@ -1696,85 +1696,60 @@ BOOL WINAPI DECLSPEC_HOTPATCH InitializeProcThreadAttributeList( struct _PROC_TH
}
/***********************************************************************
* UpdateProcThreadAttribute (kernelbase.@)
*/
BOOL
WINAPI
DECLSPEC_HOTPATCH
UpdateProcThreadAttribute
(
struct
_PROC_THREAD_ATTRIBUTE_LIST
*
list
,
DWORD
flags
,
DWORD_PTR
attr
,
void
*
value
,
SIZE_T
size
,
void
*
prev_ret
,
SIZE_T
*
size_ret
)
static
inline
DWORD
validate_proc_thread_attribute
(
DWORD_PTR
attr
,
SIZE_T
size
)
{
DWORD
mask
;
struct
proc_thread_attr
*
entry
;
TRACE
(
"(%p %lx %08Ix %p %Id %p %p)
\n
"
,
list
,
flags
,
attr
,
value
,
size
,
prev_ret
,
size_ret
);
if
(
list
->
count
>=
list
->
size
)
{
SetLastError
(
ERROR_GEN_FAILURE
);
return
FALSE
;
}
switch
(
attr
)
{
case
PROC_THREAD_ATTRIBUTE_PARENT_PROCESS
:
if
(
size
!=
sizeof
(
HANDLE
))
{
SetLastError
(
ERROR_BAD_LENGTH
);
return
FALSE
;
}
if
(
size
!=
sizeof
(
HANDLE
))
return
ERROR_BAD_LENGTH
;
break
;
case
PROC_THREAD_ATTRIBUTE_HANDLE_LIST
:
if
((
size
/
sizeof
(
HANDLE
))
*
sizeof
(
HANDLE
)
!=
size
)
{
SetLastError
(
ERROR_BAD_LENGTH
);
return
FALSE
;
}
if
((
size
/
sizeof
(
HANDLE
))
*
sizeof
(
HANDLE
)
!=
size
)
return
ERROR_BAD_LENGTH
;
break
;
case
PROC_THREAD_ATTRIBUTE_IDEAL_PROCESSOR
:
if
(
size
!=
sizeof
(
PROCESSOR_NUMBER
))
{
SetLastError
(
ERROR_BAD_LENGTH
);
return
FALSE
;
}
if
(
size
!=
sizeof
(
PROCESSOR_NUMBER
))
return
ERROR_BAD_LENGTH
;
break
;
case
PROC_THREAD_ATTRIBUTE_CHILD_PROCESS_POLICY
:
if
(
size
!=
sizeof
(
DWORD
)
&&
size
!=
sizeof
(
DWORD64
))
{
SetLastError
(
ERROR_BAD_LENGTH
);
return
FALSE
;
}
if
(
size
!=
sizeof
(
DWORD
)
&&
size
!=
sizeof
(
DWORD64
))
return
ERROR_BAD_LENGTH
;
break
;
case
PROC_THREAD_ATTRIBUTE_MITIGATION_POLICY
:
if
(
size
!=
sizeof
(
DWORD
)
&&
size
!=
sizeof
(
DWORD64
)
&&
size
!=
sizeof
(
DWORD64
)
*
2
)
{
SetLastError
(
ERROR_BAD_LENGTH
);
return
FALSE
;
}
return
ERROR_BAD_LENGTH
;
break
;
case
PROC_THREAD_ATTRIBUTE_PSEUDOCONSOLE
:
if
(
size
!=
sizeof
(
HPCON
))
{
SetLastError
(
ERROR_BAD_LENGTH
);
return
FALSE
;
}
if
(
size
!=
sizeof
(
HPCON
))
return
ERROR_BAD_LENGTH
;
break
;
case
PROC_THREAD_ATTRIBUTE_JOB_LIST
:
if
((
size
/
sizeof
(
HANDLE
))
*
sizeof
(
HANDLE
)
!=
size
)
{
SetLastError
(
ERROR_BAD_LENGTH
);
return
FALSE
;
}
if
((
size
/
sizeof
(
HANDLE
))
*
sizeof
(
HANDLE
)
!=
size
)
return
ERROR_BAD_LENGTH
;
break
;
default:
SetLastError
(
ERROR_NOT_SUPPORTED
);
FIXME
(
"Unhandled attribute %Iu
\n
"
,
attr
&
PROC_THREAD_ATTRIBUTE_NUMBER
);
return
ERROR_NOT_SUPPORTED
;
}
return
0
;
}
/***********************************************************************
* UpdateProcThreadAttribute (kernelbase.@)
*/
BOOL
WINAPI
DECLSPEC_HOTPATCH
UpdateProcThreadAttribute
(
struct
_PROC_THREAD_ATTRIBUTE_LIST
*
list
,
DWORD
flags
,
DWORD_PTR
attr
,
void
*
value
,
SIZE_T
size
,
void
*
prev_ret
,
SIZE_T
*
size_ret
)
{
DWORD
mask
,
err
;
struct
proc_thread_attr
*
entry
;
TRACE
(
"(%p %lx %08Ix %p %Id %p %p)
\n
"
,
list
,
flags
,
attr
,
value
,
size
,
prev_ret
,
size_ret
);
if
(
list
->
count
>=
list
->
size
)
{
SetLastError
(
ERROR_GEN_FAILURE
);
return
FALSE
;
}
if
((
err
=
validate_proc_thread_attribute
(
attr
,
size
)))
{
SetLastError
(
err
);
return
FALSE
;
}
...
...
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