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
e8b02745
Commit
e8b02745
authored
Nov 08, 1998
by
Ulrich Weigand
Committed by
Alexandre Julliard
Nov 08, 1998
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bugfix: really *do* switch to the initial task's stack.
CallLargeStack mechanism re-enabled.
parent
3a230263
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
89 additions
and
84 deletions
+89
-84
main.c
loader/main.c
+8
-15
task.c
loader/task.c
+0
-1
main.c
miscemu/main.c
+81
-68
No files found.
loader/main.c
View file @
e8b02745
...
@@ -26,6 +26,8 @@
...
@@ -26,6 +26,8 @@
#include "gdi.h"
#include "gdi.h"
#include "heap.h"
#include "heap.h"
#include "keyboard.h"
#include "keyboard.h"
#include "mouse.h"
#include "input.h"
#include "miscemu.h"
#include "miscemu.h"
#include "options.h"
#include "options.h"
#include "process.h"
#include "process.h"
...
@@ -89,23 +91,11 @@ BOOL32 WINAPI MAIN_KernelInit(HINSTANCE32 hinstDLL, DWORD fdwReason, LPVOID lpvR
...
@@ -89,23 +91,11 @@ BOOL32 WINAPI MAIN_KernelInit(HINSTANCE32 hinstDLL, DWORD fdwReason, LPVOID lpvR
{
{
static
BOOL32
initDone
=
FALSE
;
static
BOOL32
initDone
=
FALSE
;
NE_MODULE
*
pModule
;
HMODULE16
hModule
;
HMODULE16
hModule
;
if
(
initDone
)
return
TRUE
;
if
(
initDone
)
return
TRUE
;
initDone
=
TRUE
;
initDone
=
TRUE
;
/* Create and switch to initial task */
pModule
=
NE_GetPtr
(
GetModuleHandle16
(
"KERNEL32"
)
);
if
(
pModule
)
{
THDB
*
thdb
=
THREAD_Current
();
HINSTANCE16
hInstance
=
NE_CreateInstance
(
pModule
,
NULL
,
TRUE
);
thdb
->
process
->
task
=
TASK_Create
(
thdb
,
pModule
,
hInstance
,
0
,
FALSE
);
TASK_StartTask
(
thdb
->
process
->
task
);
}
/* Initialize special KERNEL entry points */
/* Initialize special KERNEL entry points */
hModule
=
GetModuleHandle16
(
"KERNEL"
);
hModule
=
GetModuleHandle16
(
"KERNEL"
);
if
(
hModule
)
if
(
hModule
)
...
@@ -211,9 +201,6 @@ BOOL32 WINAPI MAIN_UserInit(HINSTANCE32 hinstDLL, DWORD fdwReason, LPVOID lpvRes
...
@@ -211,9 +201,6 @@ BOOL32 WINAPI MAIN_UserInit(HINSTANCE32 hinstDLL, DWORD fdwReason, LPVOID lpvRes
/* Create the DCEs */
/* Create the DCEs */
DCE_Init
();
DCE_Init
();
/* Initialize keyboard */
if
(
!
KEYBOARD_Init
())
return
FALSE
;
/* Initialize window procedures */
/* Initialize window procedures */
if
(
!
WINPROC_Init
())
return
FALSE
;
if
(
!
WINPROC_Init
())
return
FALSE
;
...
@@ -252,6 +239,12 @@ BOOL32 WINAPI MAIN_UserInit(HINSTANCE32 hinstDLL, DWORD fdwReason, LPVOID lpvRes
...
@@ -252,6 +239,12 @@ BOOL32 WINAPI MAIN_UserInit(HINSTANCE32 hinstDLL, DWORD fdwReason, LPVOID lpvRes
if
(
!
SetMessageQueue32
(
queueSize
))
return
FALSE
;
if
(
!
SetMessageQueue32
(
queueSize
))
return
FALSE
;
}
}
/* Initialize keyboard driver */
KEYBOARD_Enable
(
keybd_event
,
InputKeyStateTable
);
/* Initialize mouse driver */
MOUSE_Enable
(
mouse_event
);
return
TRUE
;
return
TRUE
;
}
}
...
...
loader/task.c
View file @
e8b02745
...
@@ -642,7 +642,6 @@ void TASK_Reschedule(void)
...
@@ -642,7 +642,6 @@ void TASK_Reschedule(void)
newframe32
->
ebp
=
oldframe32
->
ebp
;
newframe32
->
ebp
=
oldframe32
->
ebp
;
newframe32
->
restore_addr
=
oldframe32
->
restore_addr
;
newframe32
->
restore_addr
=
oldframe32
->
restore_addr
;
newframe32
->
codeselector
=
oldframe32
->
codeselector
;
newframe32
->
codeselector
=
oldframe32
->
codeselector
;
newframe32
->
retaddr
=
oldframe32
->
retaddr
;
/* don't call TASK_CallToStart */
THREAD_Current
()
->
cur_stack
=
oldframe32
->
frame16
;
THREAD_Current
()
->
cur_stack
=
oldframe32
->
frame16
;
}
}
...
...
miscemu/main.c
View file @
e8b02745
...
@@ -15,8 +15,12 @@
...
@@ -15,8 +15,12 @@
#include "win16drv.h"
#include "win16drv.h"
#include "psdrv.h"
#include "psdrv.h"
#include "thread.h"
#include "thread.h"
#include "task.h"
#include "stackframe.h"
#include "windows.h"
#include "windows.h"
static
int
MAIN_argc
;
static
char
**
MAIN_argv
;
/***********************************************************************
/***********************************************************************
* Emulator initialisation
* Emulator initialisation
...
@@ -38,31 +42,77 @@ BOOL32 MAIN_EmulatorInit(void)
...
@@ -38,31 +42,77 @@ BOOL32 MAIN_EmulatorInit(void)
/* Create the Postscript printer driver (FIXME: should be in Winelib) */
/* Create the Postscript printer driver (FIXME: should be in Winelib) */
if
(
!
PSDRV_Init
())
return
FALSE
;
if
(
!
PSDRV_Init
())
return
FALSE
;
/* Load system DLLs into the initial process (and initialize them) */
if
(
!
LoadLibrary16
(
"KERNEL"
))
return
FALSE
;
/* always built-in */
if
(
!
LoadLibrary32A
(
"KERNEL32"
))
return
FALSE
;
/* always built-in */
if
(
!
LoadLibrary16
(
"GDI.EXE"
))
return
FALSE
;
if
(
!
LoadLibrary32A
(
"GDI32.DLL"
))
return
FALSE
;
if
(
!
LoadLibrary16
(
"USER.EXE"
))
return
FALSE
;
if
(
!
LoadLibrary32A
(
"USER32.DLL"
))
return
FALSE
;
return
TRUE
;
return
TRUE
;
}
}
/***********************************************************************
/***********************************************************************
* Main loop of initial task
* Main loop of initial task
*/
*/
void
MAIN_EmulatorRun
(
void
)
void
MAIN_EmulatorRun
(
void
)
{
{
char
startProg
[
256
],
defProg
[
256
];
int
i
,
loaded
;
HINSTANCE32
handle
;
BOOL32
(
*
WINAPI
pGetMessage
)(
MSG32
*
lpmsg
,
HWND32
hwnd
,
UINT32
min
,
UINT32
max
);
BOOL32
(
*
WINAPI
pGetMessage
)(
MSG32
*
lpmsg
,
HWND32
hwnd
,
UINT32
min
,
UINT32
max
);
BOOL32
(
*
WINAPI
pTranslateMessage
)(
const
MSG32
*
msg
);
BOOL32
(
*
WINAPI
pTranslateMessage
)(
const
MSG32
*
msg
);
LONG
(
*
WINAPI
pDispatchMessage
)(
const
MSG32
*
msg
);
LONG
(
*
WINAPI
pDispatchMessage
)(
const
MSG32
*
msg
);
HMODULE32
hModule
;
MSG32
msg
;
MSG32
msg
;
HMODULE32
hModule
=
GetModuleHandle32A
(
"USER32"
);
/* Load system DLLs into the initial process (and initialize them) */
if
(
!
LoadLibrary16
(
"GDI.EXE"
)
||
!
LoadLibrary32A
(
"GDI32.DLL"
)
||
!
LoadLibrary16
(
"USER.EXE"
)
||
!
LoadLibrary32A
(
"USER32.DLL"
))
ExitProcess
(
1
);
/* Add the Default Program if no program on the command line */
if
(
!
MAIN_argv
[
1
])
{
PROFILE_GetWineIniString
(
"programs"
,
"Default"
,
""
,
defProg
,
sizeof
(
defProg
)
);
if
(
defProg
[
0
])
MAIN_argv
[
MAIN_argc
++
]
=
defProg
;
}
/* Add the Startup Program to the run list */
PROFILE_GetWineIniString
(
"programs"
,
"Startup"
,
""
,
startProg
,
sizeof
(
startProg
)
);
if
(
startProg
[
0
])
MAIN_argv
[
MAIN_argc
++
]
=
startProg
;
loaded
=
0
;
for
(
i
=
1
;
i
<
MAIN_argc
;
i
++
)
{
if
((
handle
=
WinExec32
(
MAIN_argv
[
i
],
SW_SHOWNORMAL
))
<
32
)
{
MSG
(
"wine: can't exec '%s': "
,
MAIN_argv
[
i
]);
switch
(
handle
)
{
case
2
:
MSG
(
"file not found
\n
"
);
break
;
case
11
:
MSG
(
"invalid exe file
\n
"
);
break
;
case
21
:
MSG
(
"win32 executable
\n
"
);
break
;
/* FIXME: Obsolete? */
default:
MSG
(
"error=%d
\n
"
,
handle
);
break
;
}
ExitProcess
(
1
);
}
loaded
++
;
}
if
(
!
loaded
)
{
/* nothing loaded */
MAIN_Usage
(
MAIN_argv
[
0
]);
ExitProcess
(
1
);
}
if
(
GetNumTasks
()
<=
1
)
{
MSG
(
"wine: no executable file found.
\n
"
);
ExitProcess
(
0
);
}
if
(
Options
.
debug
)
DEBUG_AddModuleBreakpoints
();
/* Start message loop for desktop window */
hModule
=
GetModuleHandle32A
(
"USER32"
);
pGetMessage
=
GetProcAddress32
(
hModule
,
"GetMessageA"
);
pGetMessage
=
GetProcAddress32
(
hModule
,
"GetMessageA"
);
pTranslateMessage
=
GetProcAddress32
(
hModule
,
"TranslateMessage"
);
pTranslateMessage
=
GetProcAddress32
(
hModule
,
"TranslateMessage"
);
pDispatchMessage
=
GetProcAddress32
(
hModule
,
"DispatchMessageA"
);
pDispatchMessage
=
GetProcAddress32
(
hModule
,
"DispatchMessageA"
);
...
@@ -86,12 +136,12 @@ void MAIN_EmulatorRun( void )
...
@@ -86,12 +136,12 @@ void MAIN_EmulatorRun( void )
*/
*/
int
main
(
int
argc
,
char
*
argv
[]
)
int
main
(
int
argc
,
char
*
argv
[]
)
{
{
NE_MODULE
*
pModule
;
HINSTANCE16
hInstance
;
extern
char
*
DEBUG_argv0
;
extern
char
*
DEBUG_argv0
;
char
startProg
[
256
],
defProg
[
256
];
int
i
,
loaded
;
HINSTANCE32
handle
;
__winelib
=
0
;
/* First of all, clear the Winelib flag */
__winelib
=
0
;
/* First of all, clear the Winelib flag */
ctx_debug_call
=
ctx_debug
;
/*
/*
* Save this so that the internal debugger can get a hold of it if
* Save this so that the internal debugger can get a hold of it if
...
@@ -104,9 +154,9 @@ int main( int argc, char *argv[] )
...
@@ -104,9 +154,9 @@ int main( int argc, char *argv[] )
/* Parse command-line */
/* Parse command-line */
if
(
!
MAIN_WineInit
(
&
argc
,
argv
))
return
1
;
if
(
!
MAIN_WineInit
(
&
argc
,
argv
))
return
1
;
MAIN_argc
=
argc
;
MAIN_argv
=
argv
;
/* Handle -dll option (hack) */
/* Handle -dll option (hack) */
if
(
Options
.
dllFlags
)
if
(
Options
.
dllFlags
)
{
{
if
(
!
BUILTIN_ParseDLLOptions
(
Options
.
dllFlags
))
if
(
!
BUILTIN_ParseDLLOptions
(
Options
.
dllFlags
))
...
@@ -119,62 +169,25 @@ int main( int argc, char *argv[] )
...
@@ -119,62 +169,25 @@ int main( int argc, char *argv[] )
}
}
/* Initialize everything */
/* Initialize everything */
if
(
!
MAIN_EmulatorInit
())
return
1
;
if
(
!
MAIN_EmulatorInit
())
return
1
;
/* Initialize CALL32 routines */
/* Load kernel modules */
/* This needs to be done just before task-switching starts */
if
(
!
LoadLibrary16
(
"KERNEL"
))
return
1
;
if
(
!
LoadLibrary32A
(
"KERNEL32"
))
return
1
;
loaded
=
0
;
/* Add the Default Program if no program on the command line */
if
(
!
argv
[
1
])
{
PROFILE_GetWineIniString
(
"programs"
,
"Default"
,
""
,
defProg
,
sizeof
(
defProg
)
);
if
(
defProg
[
0
])
argv
[
argc
++
]
=
defProg
;
}
/* Add the Startup Program to the run list */
PROFILE_GetWineIniString
(
"programs"
,
"Startup"
,
""
,
startProg
,
sizeof
(
startProg
)
);
if
(
startProg
[
0
])
argv
[
argc
++
]
=
startProg
;
for
(
i
=
1
;
i
<
argc
;
i
++
)
{
if
((
handle
=
WinExec32
(
argv
[
i
],
SW_SHOWNORMAL
))
<
32
)
{
MSG
(
"wine: can't exec '%s': "
,
argv
[
i
]);
switch
(
handle
)
{
case
2
:
MSG
(
"file not found
\n
"
);
break
;
case
11
:
MSG
(
"invalid exe file
\n
"
);
break
;
case
21
:
MSG
(
"win32 executable
\n
"
);
break
;
/* FIXME: Obsolete? */
default:
MSG
(
"error=%d
\n
"
,
handle
);
break
;
}
return
1
;
}
loaded
++
;
}
if
(
!
loaded
)
{
/* nothing loaded */
MAIN_Usage
(
argv
[
0
]);
return
1
;
}
if
(
!
GetNumTasks
())
/* Create initial task */
{
if
(
!
(
pModule
=
NE_GetPtr
(
GetModuleHandle16
(
"KERNEL32"
)
))
)
return
1
;
MSG
(
"wine: no executable file found.
\n
"
);
hInstance
=
NE_CreateInstance
(
pModule
,
NULL
,
TRUE
);
return
0
;
PROCESS_Current
()
->
task
=
TASK_Create
(
THREAD_Current
(),
pModule
,
hInstance
,
0
,
FALSE
);
}
if
(
Options
.
debug
)
DEBUG_AddModuleBreakpoints
();
/* Initialize CALL32 routines */
/* This needs to be done just before switching stacks */
ctx_debug_call
=
ctx_debug
;
#if 0 /* FIXME!! */
IF1632_CallLargeStack
=
(
int
(
*
)(
int
(
*
func
)(),
void
*
arg
))
CALL32_Init
();
IF1632_CallLargeStack
=
(
int
(
*
)(
int
(
*
func
)(),
void
*
arg
))
CALL32_Init
();
#endif
MAIN_EmulatorRun
();
/* Switch to initial task */
MSG
(
"WinMain: Should never happen: returned from Yield16()
\n
"
);
CURRENT_STACK16
->
frame32
->
retaddr
=
(
DWORD
)
MAIN_EmulatorRun
;
TASK_StartTask
(
PROCESS_Current
()
->
task
);
MSG
(
"main: Should never happen: returned from TASK_StartTask()
\n
"
);
return
0
;
return
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