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
c1c346ae
Commit
c1c346ae
authored
Oct 31, 2002
by
Jukka Heinonen
Committed by
Alexandre Julliard
Oct 31, 2002
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Prevent crashes when DOS program tries to access console and no
Windows console is available.
parent
e0315e44
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
31 additions
and
17 deletions
+31
-17
int10.c
dlls/winedos/int10.c
+6
-3
vga.c
dlls/winedos/vga.c
+23
-12
vga.h
dlls/winedos/vga.h
+2
-2
No files found.
dlls/winedos/int10.c
View file @
c1c346ae
...
...
@@ -489,7 +489,10 @@ void WINAPI DOSVM_Int10Handler( CONTEXT86 *context )
{
BYTE
ascii
,
attr
;
TRACE
(
"Read Character and Attribute at Cursor Position
\n
"
);
VGA_GetCharacterAtCursor
(
&
ascii
,
&
attr
);
if
(
!
VGA_GetCharacterAtCursor
(
&
ascii
,
&
attr
))
{
ascii
=
0
;
attr
=
0
;
}
SET_AL
(
context
,
ascii
);
SET_AH
(
context
,
attr
);
}
...
...
@@ -845,6 +848,6 @@ void WINAPI DOSVM_PutChar(BYTE ascii)
TRACE
(
"char: 0x%02x(%c)
\n
"
,
ascii
,
ascii
);
VGA_PutChar
(
ascii
);
VGA_GetCursorPos
(
&
xpos
,
&
ypos
);
BIOS_SetCursorPos
(
data
,
0
,
xpos
,
ypos
);
if
(
VGA_GetCursorPos
(
&
xpos
,
&
ypos
))
BIOS_SetCursorPos
(
data
,
0
,
xpos
,
ypos
);
}
dlls/winedos/vga.c
View file @
c1c346ae
...
...
@@ -627,12 +627,17 @@ void VGA_SetCursorPos(unsigned X,unsigned Y)
SetConsoleCursorPosition
(
VGA_AlphaConsole
(),
pos
);
}
void
VGA_GetCursorPos
(
unsigned
*
X
,
unsigned
*
Y
)
BOOL
VGA_GetCursorPos
(
unsigned
*
X
,
unsigned
*
Y
)
{
CONSOLE_SCREEN_BUFFER_INFO
info
;
GetConsoleScreenBufferInfo
(
VGA_AlphaConsole
(),
&
info
);
if
(
X
)
*
X
=
info
.
dwCursorPosition
.
X
;
if
(
Y
)
*
Y
=
info
.
dwCursorPosition
.
Y
;
if
(
!
GetConsoleScreenBufferInfo
(
VGA_AlphaConsole
(),
&
info
))
{
return
FALSE
;
}
else
{
if
(
X
)
*
X
=
info
.
dwCursorPosition
.
X
;
if
(
Y
)
*
Y
=
info
.
dwCursorPosition
.
Y
;
return
TRUE
;
}
}
void
VGA_WriteChars
(
unsigned
X
,
unsigned
Y
,
unsigned
ch
,
int
attr
,
int
count
)
...
...
@@ -643,6 +648,9 @@ void VGA_WriteChars(unsigned X,unsigned Y,unsigned ch,int attr,int count)
unsigned
XR
,
YR
;
char
*
dat
;
if
(
!
VGA_GetAlphaMode
(
&
XR
,
&
YR
))
return
;
EnterCriticalSection
(
&
vga_lock
);
info
.
Char
.
AsciiChar
=
ch
;
...
...
@@ -654,7 +662,6 @@ void VGA_WriteChars(unsigned X,unsigned Y,unsigned ch,int attr,int count)
dest
.
Top
=
Y
;
dest
.
Bottom
=
Y
;
VGA_GetAlphaMode
(
&
XR
,
&
YR
);
dat
=
VGA_AlphaBuffer
()
+
((
XR
*
Y
+
X
)
*
2
);
while
(
count
--
)
{
dest
.
Left
=
X
+
count
;
...
...
@@ -688,9 +695,13 @@ void VGA_PutChar(BYTE ascii)
{
unsigned
width
,
height
,
x
,
y
,
nx
,
ny
;
if
(
!
VGA_GetAlphaMode
(
&
width
,
&
height
))
{
WriteFile
(
VGA_AlphaConsole
(),
&
ascii
,
1
,
NULL
,
NULL
);
return
;
}
EnterCriticalSection
(
&
vga_lock
);
VGA_GetAlphaMode
(
&
width
,
&
height
);
VGA_GetCursorPos
(
&
x
,
&
y
);
switch
(
ascii
)
{
...
...
@@ -753,10 +764,7 @@ BOOL VGA_ClearText(unsigned row1, unsigned col1,
/* return if we fail to get the height and width of the window */
if
(
!
VGA_GetAlphaMode
(
&
width
,
&
height
))
{
ERR
(
"failed
\n
"
);
return
FALSE
;
}
TRACE
(
"dat = %p, width = %d, height = %d
\n
"
,
dat
,
width
,
height
);
...
...
@@ -794,17 +802,20 @@ void VGA_ScrollDownText(unsigned row1, unsigned col1,
FIXME
(
"not implemented
\n
"
);
}
void
VGA_GetCharacterAtCursor
(
BYTE
*
ascii
,
BYTE
*
attr
)
BOOL
VGA_GetCharacterAtCursor
(
BYTE
*
ascii
,
BYTE
*
attr
)
{
unsigned
width
,
height
,
x
,
y
;
char
*
dat
;
VGA_GetAlphaMode
(
&
width
,
&
height
);
VGA_GetCursorPos
(
&
x
,
&
y
);
if
(
!
VGA_GetAlphaMode
(
&
width
,
&
height
)
||
!
VGA_GetCursorPos
(
&
x
,
&
y
))
return
FALSE
;
dat
=
VGA_AlphaBuffer
()
+
((
width
*
y
+
x
)
*
2
);
*
ascii
=
dat
[
0
];
*
attr
=
dat
[
1
];
return
TRUE
;
}
...
...
dlls/winedos/vga.h
View file @
c1c346ae
...
...
@@ -44,7 +44,7 @@ int VGA_SetAlphaMode(unsigned Xres,unsigned Yres);
BOOL
VGA_GetAlphaMode
(
unsigned
*
Xres
,
unsigned
*
Yres
);
void
VGA_SetCursorShape
(
unsigned
char
start_options
,
unsigned
char
end
);
void
VGA_SetCursorPos
(
unsigned
X
,
unsigned
Y
);
void
VGA_GetCursorPos
(
unsigned
*
X
,
unsigned
*
Y
);
BOOL
VGA_GetCursorPos
(
unsigned
*
X
,
unsigned
*
Y
);
void
VGA_WriteChars
(
unsigned
X
,
unsigned
Y
,
unsigned
ch
,
int
attr
,
int
count
);
void
VGA_PutChar
(
BYTE
ascii
);
void
VGA_SetTextAttribute
(
BYTE
attr
);
...
...
@@ -57,7 +57,7 @@ void VGA_ScrollUpText(unsigned row1, unsigned col1,
void
VGA_ScrollDownText
(
unsigned
row1
,
unsigned
col1
,
unsigned
row2
,
unsigned
col2
,
unsigned
lines
,
BYTE
attr
);
void
VGA_GetCharacterAtCursor
(
BYTE
*
ascii
,
BYTE
*
attr
);
BOOL
VGA_GetCharacterAtCursor
(
BYTE
*
ascii
,
BYTE
*
attr
);
/* control */
void
VGA_ioport_out
(
WORD
port
,
BYTE
val
);
...
...
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