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
7b767fb7
Commit
7b767fb7
authored
Jul 25, 2006
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
server: Try harder to find a suitable thread for read/write_process_memory.
parent
4ff4ba39
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
12 deletions
+17
-12
ptrace.c
server/ptrace.c
+17
-12
No files found.
server/ptrace.c
View file @
7b767fb7
...
@@ -298,18 +298,27 @@ static int write_thread_int( struct thread *thread, int *addr, int data, unsigne
...
@@ -298,18 +298,27 @@ static int write_thread_int( struct thread *thread, int *addr, int data, unsigne
return
res
;
return
res
;
}
}
/* return a thread of the process suitable for ptracing */
static
struct
thread
*
get_ptrace_thread
(
struct
process
*
process
)
{
struct
thread
*
thread
;
LIST_FOR_EACH_ENTRY
(
thread
,
&
process
->
thread_list
,
struct
thread
,
proc_entry
)
{
if
(
thread
->
unix_pid
!=
-
1
)
return
thread
;
}
set_error
(
STATUS_ACCESS_DENIED
);
/* process is dead */
return
NULL
;
}
/* read data from a process memory space */
/* read data from a process memory space */
int
read_process_memory
(
struct
process
*
process
,
const
void
*
ptr
,
size_t
size
,
char
*
dest
)
int
read_process_memory
(
struct
process
*
process
,
const
void
*
ptr
,
size_t
size
,
char
*
dest
)
{
{
struct
thread
*
thread
=
get_p
rocess_first
_thread
(
process
);
struct
thread
*
thread
=
get_p
trace
_thread
(
process
);
unsigned
int
first_offset
,
last_offset
,
len
;
unsigned
int
first_offset
,
last_offset
,
len
;
int
data
,
*
addr
;
int
data
,
*
addr
;
if
(
!
thread
)
/* process is dead */
if
(
!
thread
)
return
0
;
{
set_error
(
STATUS_ACCESS_DENIED
);
return
0
;
}
first_offset
=
(
unsigned
long
)
ptr
%
sizeof
(
int
);
first_offset
=
(
unsigned
long
)
ptr
%
sizeof
(
int
);
last_offset
=
(
size
+
first_offset
)
%
sizeof
(
int
);
last_offset
=
(
size
+
first_offset
)
%
sizeof
(
int
);
...
@@ -366,17 +375,13 @@ static int check_process_write_access( struct thread *thread, int *addr, size_t
...
@@ -366,17 +375,13 @@ static int check_process_write_access( struct thread *thread, int *addr, size_t
/* write data to a process memory space */
/* write data to a process memory space */
int
write_process_memory
(
struct
process
*
process
,
void
*
ptr
,
size_t
size
,
const
char
*
src
)
int
write_process_memory
(
struct
process
*
process
,
void
*
ptr
,
size_t
size
,
const
char
*
src
)
{
{
struct
thread
*
thread
=
get_p
rocess_first
_thread
(
process
);
struct
thread
*
thread
=
get_p
trace
_thread
(
process
);
int
ret
=
0
,
data
=
0
;
int
ret
=
0
,
data
=
0
;
size_t
len
;
size_t
len
;
int
*
addr
;
int
*
addr
;
unsigned
int
first_mask
,
first_offset
,
last_mask
,
last_offset
;
unsigned
int
first_mask
,
first_offset
,
last_mask
,
last_offset
;
if
(
!
thread
)
/* process is dead */
if
(
!
thread
)
return
0
;
{
set_error
(
STATUS_ACCESS_DENIED
);
return
0
;
}
/* compute the mask for the first int */
/* compute the mask for the first int */
first_mask
=
~
0
;
first_mask
=
~
0
;
...
...
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