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
4a546903
Commit
4a546903
authored
Oct 24, 1998
by
Ulrich Weigand
Committed by
Alexandre Julliard
Oct 24, 1998
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added support for global handles, implemented ConvertToGlobalHandle.
Allocate startup data and 16-bit stack for initial process.
parent
7692b583
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
55 additions
and
8 deletions
+55
-8
process.h
include/process.h
+8
-0
event.c
scheduler/event.c
+2
-1
handle.c
scheduler/handle.c
+5
-0
process.c
scheduler/process.c
+38
-5
thread.c
scheduler/thread.c
+2
-2
No files found.
include/process.h
View file @
4a546903
...
...
@@ -138,9 +138,17 @@ extern BOOL32 HANDLE_SetObjPtr( PDB32 *pdb, HANDLE32 handle,
K32OBJ
*
ptr
,
DWORD
access
);
extern
void
HANDLE_CloseAll
(
PDB32
*
pdb
,
K32OBJ
*
ptr
);
/* Global handle macros */
#define HANDLE_OBFUSCATOR ((DWORD)0x544a4def)
#define HANDLE_IS_GLOBAL(h) (((DWORD)(h) ^ HANDLE_OBFUSCATOR) < 0x10000)
#define HANDLE_LOCAL_TO_GLOBAL(h) ((HANDLE32)((DWORD)(h) ^ HANDLE_OBFUSCATOR))
#define HANDLE_GLOBAL_TO_LOCAL(h) ((HANDLE32)((DWORD)(h) ^ HANDLE_OBFUSCATOR))
/* scheduler/process.c */
extern
BOOL32
PROCESS_Init
(
void
);
extern
PDB32
*
PROCESS_Current
(
void
);
extern
PDB32
*
PROCESS_Initial
(
void
);
extern
PDB32
*
PROCESS_GetPtr
(
HANDLE32
handle
,
DWORD
access
,
int
*
server_handle
);
extern
PDB32
*
PROCESS_IdToPDB
(
DWORD
id
);
extern
PDB32
*
PROCESS_Create
(
struct
_NE_MODULE
*
pModule
,
LPCSTR
cmd_line
,
...
...
scheduler/event.c
View file @
4a546903
...
...
@@ -338,7 +338,8 @@ static void EVENT_Destroy( K32OBJ *obj )
*/
HANDLE32
WINAPI
VWin32_EventCreate
(
VOID
)
{
return
CreateEvent32A
(
NULL
,
FALSE
,
0
,
NULL
);
HANDLE32
hEvent
=
CreateEvent32A
(
NULL
,
FALSE
,
0
,
NULL
);
return
ConvertToGlobalHandle
(
hEvent
);
}
/***********************************************************************
...
...
scheduler/handle.c
View file @
4a546903
...
...
@@ -155,6 +155,11 @@ K32OBJ *HANDLE_GetObjPtr( PDB32 *pdb, HANDLE32 handle,
K32OBJ
*
ptr
=
NULL
;
SYSTEM_LOCK
();
if
(
HANDLE_IS_GLOBAL
(
handle
))
{
handle
=
HANDLE_GLOBAL_TO_LOCAL
(
handle
);
pdb
=
PROCESS_Initial
();
}
if
((
handle
>
0
)
&&
(
handle
<
pdb
->
handle_table
->
count
))
{
HANDLE_ENTRY
*
entry
=
&
pdb
->
handle_table
->
entries
[
handle
];
...
...
scheduler/process.c
View file @
4a546903
...
...
@@ -40,6 +40,8 @@ const K32OBJ_OPS PROCESS_Ops =
PROCESS_Destroy
/* destroy */
};
static
DWORD
PROCESS_InitialProcessID
=
0
;
/***********************************************************************
* PROCESS_Current
...
...
@@ -49,6 +51,18 @@ PDB32 *PROCESS_Current(void)
return
THREAD_Current
()
->
process
;
}
/***********************************************************************
* PROCESS_Initial
*
* FIXME: This works only while running all processes in the same
* address space (or, at least, the initial process is mapped
* into all address spaces as is KERNEL32 in Windows 95)
*
*/
PDB32
*
PROCESS_Initial
(
void
)
{
return
PROCESS_IdToPDB
(
PROCESS_InitialProcessID
);
}
/***********************************************************************
* PROCESS_GetPtr
...
...
@@ -96,6 +110,11 @@ static BOOL32 PROCESS_BuildEnvDB( PDB32 *pdb )
return
FALSE
;
InitializeCriticalSection
(
&
pdb
->
env_db
->
section
);
/* Allocate startup info */
if
(
!
(
pdb
->
env_db
->
startup_info
=
HeapAlloc
(
SystemHeap
,
HEAP_ZERO_MEMORY
,
sizeof
(
STARTUPINFO32A
)
)))
return
FALSE
;
/* Allocate the standard handles */
pdb
->
env_db
->
hStdin
=
FILE_DupUnixHandle
(
0
);
...
...
@@ -235,9 +254,11 @@ BOOL32 PROCESS_Init(void)
/* Create the initial process and thread structures */
if
(
!
(
pdb
=
PROCESS_CreatePDB
(
NULL
)))
return
FALSE
;
if
(
!
(
thdb
=
THREAD_Create
(
pdb
,
0
,
FALS
E
,
NULL
,
NULL
,
NULL
,
NULL
)))
return
FALSE
;
if
(
!
(
thdb
=
THREAD_Create
(
pdb
,
0
,
TRU
E
,
NULL
,
NULL
,
NULL
,
NULL
)))
return
FALSE
;
thdb
->
unix_pid
=
getpid
();
PROCESS_InitialProcessID
=
PDB_TO_PROCESS_ID
(
pdb
);
/* Remember TEB selector of initial process for emergency use */
SYSLEVEL_EmergencyTeb
=
thdb
->
teb_sel
;
...
...
@@ -736,12 +757,24 @@ BOOL32 WINAPI WriteProcessMemory(HANDLE32 hProcess, LPVOID lpBaseAddress,
/***********************************************************************
* ConvertToGlobalHandle (KERNEL32)
* FIXME: this is not correctly implemented...
*/
HANDLE32
WINAPI
ConvertToGlobalHandle
(
HANDLE32
h
)
HANDLE32
WINAPI
ConvertToGlobalHandle
(
HANDLE32
h
Src
)
{
FIXME
(
process
,
"(%d): stub
\n
"
,
h
);
return
h
;
HANDLE32
hProcessInit
,
hDest
;
/* Get a handle to the initial process */
hProcessInit
=
OpenProcess
(
PROCESS_ALL_ACCESS
,
FALSE
,
PROCESS_InitialProcessID
);
/* Duplicate the handle into the initial process */
if
(
!
DuplicateHandle
(
GetCurrentProcess
(),
hSrc
,
hProcessInit
,
&
hDest
,
0
,
FALSE
,
DUPLICATE_SAME_ACCESS
|
DUPLICATE_CLOSE_SOURCE
)
)
hDest
=
0
;
/* Close initial process handle */
CloseHandle
(
hProcessInit
);
/* Return obfuscated global handle */
return
hDest
?
HANDLE_LOCAL_TO_GLOBAL
(
hDest
)
:
0
;
}
/***********************************************************************
...
...
scheduler/thread.c
View file @
4a546903
...
...
@@ -365,7 +365,7 @@ void THREAD_Start( THDB *thdb )
LPTHREAD_START_ROUTINE
func
=
(
LPTHREAD_START_ROUTINE
)
thdb
->
entry_point
;
assert
(
THREAD_Current
()
==
thdb
);
CLIENT_InitThread
();
MODULE_InitializeDLLs
(
thdb
->
process
,
NULL
,
DLL_THREAD_ATTACH
,
NULL
);
MODULE_InitializeDLLs
(
thdb
->
process
,
0
,
DLL_THREAD_ATTACH
,
NULL
);
ExitThread
(
func
(
thdb
->
entry_arg
)
);
}
...
...
@@ -413,7 +413,7 @@ void WINAPI ExitThread(
/* Remove thread from process's list */
THREAD_RemoveQueue
(
&
thdb
->
process
->
thread_list
,
thdb
);
MODULE_InitializeDLLs
(
thdb
->
process
,
NULL
,
DLL_THREAD_DETACH
,
NULL
);
MODULE_InitializeDLLs
(
thdb
->
process
,
0
,
DLL_THREAD_DETACH
,
NULL
);
SYSTEM_LOCK
();
thdb
->
exit_code
=
code
;
...
...
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