[PATCH] krnl386: Add error handling and bootblock emulation for int25 (RawRead)
Detlef Riekenberg
wine.dev at web.de
Sun May 16 12:23:02 CDT 2010
This let the adobe reader 1 installer go a step further
--
By by ... Detlef
---
dlls/krnl386.exe16/int25.c | 56 +++++++++++++++++++++++++++++++------------
1 files changed, 40 insertions(+), 16 deletions(-)
diff --git a/dlls/krnl386.exe16/int25.c b/dlls/krnl386.exe16/int25.c
index c4588a3..21e3e60 100644
--- a/dlls/krnl386.exe16/int25.c
+++ b/dlls/krnl386.exe16/int25.c
@@ -42,36 +42,60 @@ BOOL DOSVM_RawRead(BYTE drive, DWORD begin, DWORD nr_sect, BYTE *dataptr, BOOL f
{
WCHAR root[] = {'\\','\\','.','\\','A',':',0};
HANDLE h;
+ DWORD r;
+ DWORD res;
TRACE( "abs diskread, drive %d, sector %d, "
- "count %d, buffer %p\n",
- drive, begin, nr_sect, dataptr );
+ "count %d, buffer %p (%d)\n",
+ drive, begin, nr_sect, dataptr, fake_success );
root[4] += drive;
h = CreateFileW(root, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING,
FILE_FLAG_BACKUP_SEMANTICS, NULL);
+
if (h != INVALID_HANDLE_VALUE)
{
- DWORD r;
- SetFilePointer(h, begin * 512, NULL, SEEK_SET );
- /* FIXME: check errors */
- ReadFile(h, dataptr, nr_sect * 512, &r, NULL );
+ /* ToDo: add support for FAT32 */
+ res = SetFilePointer(h, begin * 512, NULL, SEEK_SET );
+ if (res != INVALID_SET_FILE_POINTER)
+ {
+ res = ReadFile(h, dataptr, nr_sect * 512, &r, NULL );
+ if (res)
+ {
+ CloseHandle(h);
+ return TRUE;
+ }
+ TRACE("ReadFile failed: (%d blocks) with %d\n", r, GetLastError());
+
+ }
+ else
+ TRACE("SetFilePointer failed with %d\n", GetLastError());
+
CloseHandle(h);
}
else
+ TRACE("CreateFile(%s, ...) failed with %d\n", debugstr_w(root), GetLastError());
+
+
+ memset( dataptr, 0, nr_sect * 512 );
+ if (fake_success)
{
- memset( dataptr, 0, nr_sect * 512 );
- if (fake_success)
- {
- /* FIXME: explain what happens here */
- if (begin == 0 && nr_sect > 1) *(dataptr + 512) = 0xf8;
- if (begin == 1) *dataptr = 0xf8;
+ TRACE("building a fake result\n");
+ /* simulate content for a FAT16 */
+ if (begin == 0 && nr_sect > 1) *(dataptr + 512) = 0xf8;
+ if (begin == 1) *dataptr = 0xf8;
+
+ /* simulate content for a boot block */
+ if (begin == 0 && nr_sect > 0) {
+ /* mark first partition as FAT16 */
+ dataptr[0x01be + 0x04] = 0x06;
+ /* MBR signature */
+ dataptr[0x1fe] = 0x55;
+ dataptr[0x1ff] = 0xAA;
}
- else
- return FALSE;
+ return TRUE;
}
-
- return TRUE;
+ return FALSE;
}
--
1.7.0.4
More information about the wine-patches
mailing list