l3codeca.acm: Avoid mpg123 functions with suffix.
[wine.git] / dlls / krnl386.exe16 / int25.c
blobd414f27b8e9b19f60b3965ab00fafc60a384aa93
1 /*
2 * DOS interrupt 25h 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 #include <stdlib.h>
22 #include <stdio.h>
23 #include <string.h>
24 #include <fcntl.h>
26 #include "dosexe.h"
27 #include "wine/debug.h"
29 WINE_DEFAULT_DEBUG_CHANNEL(int);
32 /***********************************************************************
33 * DOSVM_RawRead
35 * Read raw sectors from a device.
37 BOOL DOSVM_RawRead(BYTE drive, DWORD begin, DWORD nr_sect, BYTE *dataptr, BOOL fake_success)
39 WCHAR root[] = {'\\','\\','.','\\','A',':',0};
40 HANDLE h;
42 TRACE( "abs diskread, drive %d, sector %ld, "
43 "count %ld, buffer %p\n",
44 drive, begin, nr_sect, dataptr );
46 root[4] += drive;
47 h = CreateFileW(root, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING,
48 FILE_FLAG_BACKUP_SEMANTICS, NULL);
49 if (h != INVALID_HANDLE_VALUE)
51 DWORD r;
52 SetFilePointer(h, begin * 512, NULL, SEEK_SET );
53 /* FIXME: check errors */
54 ReadFile(h, dataptr, nr_sect * 512, &r, NULL );
55 CloseHandle(h);
57 else
59 memset( dataptr, 0, nr_sect * 512 );
60 if (fake_success)
62 /* FIXME: explain what happens here */
63 if (begin == 0 && nr_sect > 1) *(dataptr + 512) = 0xf8;
64 if (begin == 1) *dataptr = 0xf8;
66 else
67 return FALSE;
70 return TRUE;
74 /**********************************************************************
75 * DOSVM_Int25Handler
77 * Handler for int 25h (absolute disk read).
79 void WINAPI DOSVM_Int25Handler( CONTEXT *context )
81 WCHAR drivespec[] = {'A', ':', '\\', 0};
82 BYTE *dataptr = CTX_SEG_OFF_TO_LIN( context, context->SegDs, context->Ebx );
83 DWORD begin;
84 DWORD length;
86 drivespec[0] += AL_reg( context );
88 if (GetDriveTypeW( drivespec ) == DRIVE_NO_ROOT_DIR ||
89 GetDriveTypeW( drivespec ) == DRIVE_UNKNOWN)
91 SET_CFLAG( context );
92 SET_AX( context, 0x0201 ); /* unknown unit */
93 return;
96 if (CX_reg( context ) == 0xffff)
98 begin = *(DWORD *)dataptr;
99 length = *(WORD *)(dataptr + 4);
100 dataptr = (BYTE *)CTX_SEG_OFF_TO_LIN( context,
101 *(WORD *)(dataptr + 8),
102 *(DWORD *)(dataptr + 6) );
104 else
106 begin = DX_reg( context );
107 length = CX_reg( context );
110 DOSVM_RawRead( AL_reg( context ), begin, length, dataptr, TRUE );
111 RESET_CFLAG( context );