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
c93afe6b
Commit
c93afe6b
authored
Jan 25, 2006
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernel: Handle a failure to load winedos a bit more gracefully.
parent
0e085844
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
20 deletions
+23
-20
dosmem.c
dlls/kernel/dosmem.c
+22
-19
kernel_private.h
dlls/kernel/kernel_private.h
+1
-1
No files found.
dlls/kernel/dosmem.c
View file @
c93afe6b
...
...
@@ -80,7 +80,7 @@ static LONG WINAPI dosmem_handler(EXCEPTION_POINTERS* except);
struct
winedos_exports
winedos
;
void
load_winedos
(
void
)
BOOL
load_winedos
(
void
)
{
static
HANDLE
hRunOnce
/* = 0 */
;
static
HMODULE
hWineDos
/* = 0 */
;
...
...
@@ -88,7 +88,7 @@ void load_winedos(void)
/* FIXME: this isn't 100% thread safe, as we won't catch access to 1MB while
* loading winedos (and may return uninitialized valued)
*/
if
(
hWineDos
)
return
;
if
(
hWineDos
)
goto
done
;
if
(
hRunOnce
==
0
)
{
HANDLE
hEvent
=
CreateEventW
(
NULL
,
TRUE
,
FALSE
,
NULL
);
...
...
@@ -97,29 +97,31 @@ void load_winedos(void)
HMODULE
hModule
;
/* ok, we're the winning thread */
VirtualProtect
(
DOSMEM_dosmem
+
DOSMEM_protect
,
DOSMEM_SIZE
-
DOSMEM_protect
,
PAGE_EXECUTE_READWRITE
,
NULL
);
if
(
!
(
hModule
=
LoadLibraryA
(
"winedos.dll"
)))
if
(
!
VirtualProtect
(
DOSMEM_dosmem
+
DOSMEM_protect
,
DOSMEM_SIZE
-
DOSMEM_protect
,
PAGE_EXECUTE_READWRITE
,
NULL
)
||
!
(
hModule
=
LoadLibraryA
(
"winedos.dll"
)))
{
ERR
(
"Could not load winedos.dll, DOS subsystem unavailable
\n
"
);
hWineDos
=
(
HMODULE
)
1
;
/* not to try to load it again */
return
;
hModule
=
(
HMODULE
)
1
;
/* not to try to load it again */
}
else
{
#define GET_ADDR(func) winedos.func = (void *)GetProcAddress( hModule, #func );
GET_ADDR
(
AllocDosBlock
);
GET_ADDR
(
FreeDosBlock
);
GET_ADDR
(
ResizeDosBlock
);
GET_ADDR
(
inport
);
GET_ADDR
(
outport
);
GET_ADDR
(
EmulateInterruptPM
);
GET_ADDR
(
CallBuiltinHandler
);
GET_ADDR
(
BiosTick
);
GET_ADDR
(
AllocDosBlock
);
GET_ADDR
(
FreeDosBlock
);
GET_ADDR
(
ResizeDosBlock
);
GET_ADDR
(
inport
);
GET_ADDR
(
outport
);
GET_ADDR
(
EmulateInterruptPM
);
GET_ADDR
(
CallBuiltinHandler
);
GET_ADDR
(
BiosTick
);
#undef GET_ADDR
}
RtlRemoveVectoredExceptionHandler
(
dosmem_handler
);
hWineDos
=
hModule
;
SetEvent
(
hRunOnce
);
return
;
goto
done
;
}
/* someone beat us here... */
CloseHandle
(
hEvent
);
...
...
@@ -127,6 +129,8 @@ void load_winedos(void)
/* and wait for the winner to have finished */
WaitForSingleObject
(
hRunOnce
,
INFINITE
);
done:
return
(
hWineDos
!=
(
HMODULE
)
1
);
}
/******************************************************************
...
...
@@ -142,8 +146,7 @@ static LONG WINAPI dosmem_handler(EXCEPTION_POINTERS* except)
if
(
addr
>=
(
ULONG_PTR
)
DOSMEM_dosmem
+
DOSMEM_protect
&&
addr
<
(
ULONG_PTR
)
DOSMEM_dosmem
+
DOSMEM_SIZE
)
{
load_winedos
();
return
EXCEPTION_CONTINUE_EXECUTION
;
if
(
load_winedos
())
return
EXCEPTION_CONTINUE_EXECUTION
;
}
}
return
EXCEPTION_CONTINUE_SEARCH
;
...
...
dlls/kernel/kernel_private.h
View file @
c93afe6b
...
...
@@ -113,7 +113,7 @@ extern BOOL DOSMEM_Init(void);
extern
LPVOID
DOSMEM_MapRealToLinear
(
DWORD
);
/* real-mode to linear */
extern
LPVOID
DOSMEM_MapDosToLinear
(
UINT
);
/* linear DOS to Wine */
extern
UINT
DOSMEM_MapLinearToDos
(
LPVOID
);
/* linear Wine to DOS */
extern
void
load_winedos
(
void
);
extern
BOOL
load_winedos
(
void
);
/* environ.c */
extern
void
ENV_CopyStartupInformation
(
void
);
...
...
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