Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
c6464085
Commit
c6464085
authored
May 19, 2003
by
Jukka Heinonen
Committed by
Alexandre Julliard
May 19, 2003
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move get current drive int21 function to winedos.
Fix spelling mistakes. Add some drive handling helper routines.
parent
5e7ba036
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
58 additions
and
32 deletions
+58
-32
int21.c
dlls/winedos/int21.c
+58
-28
int21.c
msdos/int21.c
+0
-4
No files found.
dlls/winedos/int21.c
View file @
c6464085
...
...
@@ -86,8 +86,6 @@ typedef struct _INT21_HEAP {
BYTE
misc_indos
;
/* Interrupt 21 nesting flag */
}
INT21_HEAP
;
#include "poppack.h"
struct
FCB
{
BYTE
drive_number
;
...
...
@@ -116,6 +114,44 @@ struct XFCB {
BYTE
fcb
[
37
];
};
#include "poppack.h"
/***********************************************************************
* INT21_GetCurrentDrive
*
* Return current drive using scheme (0=A:, 1=B:, 2=C:, ...) or
* MAX_DOS_DRIVES on error.
*/
static
BYTE
INT21_GetCurrentDrive
()
{
WCHAR
current_directory
[
MAX_PATH
];
if
(
!
GetCurrentDirectoryW
(
MAX_PATH
,
current_directory
)
||
current_directory
[
1
]
!=
':'
)
{
TRACE
(
"Failed to get current drive.
\n
"
);
return
MAX_DOS_DRIVES
;
}
return
toupperW
(
current_directory
[
0
]
)
-
'A'
;
}
/***********************************************************************
* INT21_MapDrive
*
* Convert drive number from scheme (0=default, 1=A:, 2=B:, ...) into
* scheme (0=A:, 1=B:, 2=C:, ...) or MAX_DOS_DRIVES on error.
*/
static
BYTE
INT21_MapDrive
(
BYTE
drive
)
{
if
(
drive
)
return
drive
-
1
;
return
INT21_GetCurrentDrive
();
}
/***********************************************************************
* INT21_ReadChar
...
...
@@ -376,7 +412,10 @@ static WORD INT21_BufferedInput( CONTEXT86 *context, BYTE *ptr, WORD capacity )
}
static
BYTE
*
GetCurrentDTA
(
CONTEXT86
*
context
)
/***********************************************************************
* INT21_GetCurrentDTA
*/
static
BYTE
*
INT21_GetCurrentDTA
(
CONTEXT86
*
context
)
{
TDB
*
pTask
=
GlobalLock16
(
GetCurrentTask
());
...
...
@@ -407,7 +446,6 @@ static void INT21_OpenFileUsingFCB( CONTEXT86 *context )
{
struct
FCB
*
fcb
;
struct
XFCB
*
xfcb
;
char
current_directory
[
MAX_PATH
];
char
file_path
[
16
];
char
*
pos
;
HANDLE
handle
;
...
...
@@ -422,16 +460,7 @@ static void INT21_OpenFileUsingFCB( CONTEXT86 *context )
}
/* if */
AL_result
=
0
;
if
(
fcb
->
drive_number
==
0
)
{
if
(
!
GetCurrentDirectoryA
(
sizeof
(
current_directory
),
current_directory
)
||
current_directory
[
1
]
!=
':'
)
{
TRACE
(
"GetCurrentDirectoryA failed
\n
"
);
AL_result
=
0xff
;
/* failed */
}
/* if */
file_path
[
0
]
=
toupper
(
current_directory
[
0
]);
}
else
{
file_path
[
0
]
=
'A'
+
fcb
->
drive_number
-
1
;
}
/* if */
file_path
[
0
]
=
'A'
+
INT21_MapDrive
(
fcb
->
drive_number
);
if
(
AL_result
==
0
)
{
file_path
[
1
]
=
':'
;
...
...
@@ -525,7 +554,7 @@ static void INT21_CloseFileUsingFCB( CONTEXT86 *context )
}
/* if */
if
(
_lclose16
((
HFILE16
)
fcb
->
file_number
)
!=
0
)
{
TRACE
(
"_l
l
close16(%d) failed
\n
"
,
fcb
->
file_number
);
TRACE
(
"_lclose16(%d) failed
\n
"
,
fcb
->
file_number
);
AL_result
=
0xff
;
/* failed */
}
else
{
TRACE
(
"successful closed file %d
\n
"
,
fcb
->
file_number
);
...
...
@@ -536,7 +565,7 @@ static void INT21_CloseFileUsingFCB( CONTEXT86 *context )
/***********************************************************************
* INT21_SequenialReadFromFCB
* INT21_Sequen
t
ialReadFromFCB
*
* Handler for function 0x14.
*
...
...
@@ -557,7 +586,7 @@ static void INT21_CloseFileUsingFCB( CONTEXT86 *context )
* are updated to point to the next record. If a partial record is
* read, it is filled with zeros up to the FCB->logical_record_size.
*/
static
void
INT21_SequenialReadFromFCB
(
CONTEXT86
*
context
)
static
void
INT21_Sequen
t
ialReadFromFCB
(
CONTEXT86
*
context
)
{
struct
FCB
*
fcb
;
struct
XFCB
*
xfcb
;
...
...
@@ -587,7 +616,7 @@ static void INT21_SequenialReadFromFCB( CONTEXT86 *context )
fcb
->
file_number
,
record_number
*
fcb
->
logical_record_size
,
position
);
AL_result
=
0x01
;
/* end of file, no data read */
}
else
{
disk_transfer_area
=
GetCurrentDTA
(
context
);
disk_transfer_area
=
INT21_
GetCurrentDTA
(
context
);
bytes_read
=
_lread
((
HFILE
)
handle
,
disk_transfer_area
,
fcb
->
logical_record_size
);
if
(
bytes_read
!=
fcb
->
logical_record_size
)
{
TRACE
(
"_lread(%d, %p, %d) failed with %d
\n
"
,
...
...
@@ -618,7 +647,7 @@ static void INT21_SequenialReadFromFCB( CONTEXT86 *context )
/***********************************************************************
* INT21_SequenialWriteToFCB
* INT21_Sequen
t
ialWriteToFCB
*
* Handler for function 0x15.
*
...
...
@@ -637,7 +666,7 @@ static void INT21_SequenialReadFromFCB( CONTEXT86 *context )
* Then FCB->current_block_number and FCB->record_within_current_block
* are updated to point to the next record.
*/
static
void
INT21_SequenialWriteToFCB
(
CONTEXT86
*
context
)
static
void
INT21_Sequen
t
ialWriteToFCB
(
CONTEXT86
*
context
)
{
struct
FCB
*
fcb
;
struct
XFCB
*
xfcb
;
...
...
@@ -667,7 +696,7 @@ static void INT21_SequenialWriteToFCB( CONTEXT86 *context )
fcb
->
file_number
,
record_number
*
fcb
->
logical_record_size
,
position
);
AL_result
=
0x01
;
/* disk full */
}
else
{
disk_transfer_area
=
GetCurrentDTA
(
context
);
disk_transfer_area
=
INT21_
GetCurrentDTA
(
context
);
bytes_written
=
_lwrite
((
HFILE
)
handle
,
disk_transfer_area
,
fcb
->
logical_record_size
);
if
(
bytes_written
!=
fcb
->
logical_record_size
)
{
TRACE
(
"_lwrite(%d, %p, %d) failed with %d
\n
"
,
...
...
@@ -743,7 +772,7 @@ static void INT21_ReadRandomRecordFromFCB( CONTEXT86 *context )
fcb
->
file_number
,
record_number
*
fcb
->
logical_record_size
,
position
);
AL_result
=
0x01
;
/* end of file, no data read */
}
else
{
disk_transfer_area
=
GetCurrentDTA
(
context
);
disk_transfer_area
=
INT21_
GetCurrentDTA
(
context
);
bytes_read
=
_lread
((
HFILE
)
handle
,
disk_transfer_area
,
fcb
->
logical_record_size
);
if
(
bytes_read
!=
fcb
->
logical_record_size
)
{
TRACE
(
"_lread(%d, %p, %d) failed with %d
\n
"
,
...
...
@@ -816,7 +845,7 @@ static void INT21_WriteRandomRecordToFCB( CONTEXT86 *context )
fcb
->
file_number
,
record_number
*
fcb
->
logical_record_size
,
position
);
AL_result
=
0x01
;
/* disk full */
}
else
{
disk_transfer_area
=
GetCurrentDTA
(
context
);
disk_transfer_area
=
INT21_
GetCurrentDTA
(
context
);
bytes_written
=
_lwrite
((
HFILE
)
handle
,
disk_transfer_area
,
fcb
->
logical_record_size
);
if
(
bytes_written
!=
fcb
->
logical_record_size
)
{
TRACE
(
"_lwrite(%d, %p, %d) failed with %d
\n
"
,
...
...
@@ -896,7 +925,7 @@ static void INT21_RandomBlockReadFromFCB( CONTEXT86 *context )
records_read
=
0
;
AL_result
=
0x01
;
/* end of file, no data read */
}
else
{
disk_transfer_area
=
GetCurrentDTA
(
context
);
disk_transfer_area
=
INT21_
GetCurrentDTA
(
context
);
records_requested
=
CX_reg
(
context
);
bytes_requested
=
(
UINT
)
records_requested
*
fcb
->
logical_record_size
;
bytes_read
=
_lread
((
HFILE
)
handle
,
disk_transfer_area
,
bytes_requested
);
...
...
@@ -987,7 +1016,7 @@ static void INT21_RandomBlockWriteToFCB( CONTEXT86 *context )
records_written
=
0
;
AL_result
=
0x01
;
/* disk full */
}
else
{
disk_transfer_area
=
GetCurrentDTA
(
context
);
disk_transfer_area
=
INT21_
GetCurrentDTA
(
context
);
records_requested
=
CX_reg
(
context
);
bytes_requested
=
(
UINT
)
records_requested
*
fcb
->
logical_record_size
;
bytes_written
=
_lwrite
((
HFILE
)
handle
,
disk_transfer_area
,
bytes_requested
);
...
...
@@ -2144,11 +2173,11 @@ void WINAPI DOSVM_Int21Handler( CONTEXT86 *context )
break
;
case
0x14
:
/* SEQUENTIAL READ FROM FCB FILE */
INT21_SequenialReadFromFCB
(
context
);
INT21_Sequen
t
ialReadFromFCB
(
context
);
break
;
case
0x15
:
/* SEQUENTIAL WRITE TO FCB FILE */
INT21_SequenialWriteToFCB
(
context
);
INT21_Sequen
t
ialWriteToFCB
(
context
);
break
;
case
0x16
:
/* CREATE OR TRUNCATE FILE USING FCB */
...
...
@@ -2161,7 +2190,8 @@ void WINAPI DOSVM_Int21Handler( CONTEXT86 *context )
break
;
case
0x19
:
/* GET CURRENT DEFAULT DRIVE */
INT_Int21Handler
(
context
);
SET_AL
(
context
,
INT21_GetCurrentDrive
()
);
TRACE
(
"GET CURRENT DRIVE -> %c:
\n
"
,
'A'
+
AL_reg
(
context
)
);
break
;
case
0x1a
:
/* SET DISK TRANSFER AREA ADDRESS */
...
...
msdos/int21.c
View file @
c6464085
...
...
@@ -931,10 +931,6 @@ void WINAPI INT_Int21Handler( CONTEXT86 *context )
SET_AL
(
context
,
INT21_FindNextFCB
(
context
)
?
0x00
:
0xff
);
break
;
case
0x19
:
/* GET CURRENT DEFAULT DRIVE */
SET_AL
(
context
,
DRIVE_GetCurrentDrive
()
);
break
;
case
0x1b
:
/* GET ALLOCATION INFORMATION FOR DEFAULT DRIVE */
SET_DL
(
context
,
0
);
if
(
!
INT21_GetDriveAllocInfo
(
context
))
SET_AX
(
context
,
0xffff
);
...
...
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