2 * BIOS interrupt 13h handler
4 * Copyright 1997 Andreas Mohr
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 #include <sys/types.h>
28 #include "wine/debug.h"
30 WINE_DEFAULT_DEBUG_CHANNEL(int);
32 static void DIOCRegs_2_CONTEXT( DIOC_REGISTERS
*pIn
, CONTEXT86
*pCxt
)
34 memset( pCxt
, 0, sizeof(*pCxt
) );
35 /* Note: segment registers == 0 means that CTX_SEG_OFF_TO_LIN
36 will interpret 32-bit register contents as linear pointers */
38 pCxt
->ContextFlags
=CONTEXT86_INTEGER
|CONTEXT86_CONTROL
;
39 pCxt
->Eax
= pIn
->reg_EAX
;
40 pCxt
->Ebx
= pIn
->reg_EBX
;
41 pCxt
->Ecx
= pIn
->reg_ECX
;
42 pCxt
->Edx
= pIn
->reg_EDX
;
43 pCxt
->Esi
= pIn
->reg_ESI
;
44 pCxt
->Edi
= pIn
->reg_EDI
;
46 /* FIXME: Only partial CONTEXT86_CONTROL */
47 pCxt
->EFlags
= pIn
->reg_Flags
;
50 static void CONTEXT_2_DIOCRegs( CONTEXT86
*pCxt
, DIOC_REGISTERS
*pOut
)
52 memset( pOut
, 0, sizeof(DIOC_REGISTERS
) );
54 pOut
->reg_EAX
= pCxt
->Eax
;
55 pOut
->reg_EBX
= pCxt
->Ebx
;
56 pOut
->reg_ECX
= pCxt
->Ecx
;
57 pOut
->reg_EDX
= pCxt
->Edx
;
58 pOut
->reg_ESI
= pCxt
->Esi
;
59 pOut
->reg_EDI
= pCxt
->Edi
;
61 /* FIXME: Only partial CONTEXT86_CONTROL */
62 pOut
->reg_Flags
= pCxt
->EFlags
;
65 /**********************************************************************
66 * INT_Int13Handler (WPROCS.119)
68 * Handler for int 13h (disk I/O).
70 void WINAPI
INT_Int13Handler( CONTEXT86
*context
)
76 hVWin32
= CreateFileA("\\\\.\\VWIN32", GENERIC_READ
|GENERIC_WRITE
,
77 0, NULL
, OPEN_EXISTING
, FILE_FLAG_DELETE_ON_CLOSE
, 0);
79 if(hVWin32
!=INVALID_HANDLE_VALUE
)
81 CONTEXT_2_DIOCRegs( context
, ®s
);
83 if(!DeviceIoControl(hVWin32
, VWIN32_DIOC_DOS_INT13
,
84 ®s
, sizeof regs
, ®s
, sizeof regs
, &dwRet
, NULL
))
85 DIOCRegs_2_CONTEXT(®s
, context
);
93 ERR("Failed to open device VWIN32\n");