"Gerald Pfeifer" gerald@pfeifer.com wrote:
ChangeLog: Use unsigned long instead of long for return values of SetFilePointer.
It wouldn't take more than 30 additional seconds to look up the SetFilePointer prototype in include/ and use real type instead.
On Thu, 22 Nov 2007, Dmitry Timoshkov wrote:
It wouldn't take more than 30 additional seconds to look up the SetFilePointer prototype in include/ and use real type instead.
Which I had done -- except that I apparently lost that update when creating the patch a couple of weeks ago. My bad. Something went very wrong here. :-(
Thanks for catching this, Dmitry!
Update patch below.
Gerald
ChangeLog: Use DWORD instead of long for return values of SetFilePointer. Adjust type of loop variable in INT21_Ioctl_Char().
Index: dlls/winedos/int21.c =================================================================== RCS file: /home/wine/wine/dlls/winedos/int21.c,v retrieving revision 1.90 diff -u -3 -p -r1.90 int21.c --- dlls/winedos/int21.c 18 Jun 2007 13:07:13 -0000 1.90 +++ dlls/winedos/int21.c 22 Nov 2007 15:43:09 -0000 @@ -1385,7 +1385,7 @@ static void INT21_SequentialReadFromFCB( struct XFCB *xfcb; HANDLE handle; DWORD record_number; - long position; + DWORD position; BYTE *disk_transfer_area; UINT bytes_read; BYTE AL_result; @@ -1405,7 +1405,7 @@ static void INT21_SequentialReadFromFCB( record_number = 128 * fcb->current_block_number + fcb->record_within_current_block; position = SetFilePointer(handle, record_number * fcb->logical_record_size, NULL, 0); if (position != record_number * fcb->logical_record_size) { - TRACE("seek(%d, %d, 0) failed with %ld\n", + TRACE("seek(%d, %d, 0) failed with %u\n", fcb->file_number, record_number * fcb->logical_record_size, position); AL_result = 0x01; /* end of file, no data read */ } else { @@ -1421,7 +1421,7 @@ static void INT21_SequentialReadFromFCB( AL_result = 0x03; /* end of file, partial record read */ } /* if */ } else { - TRACE("successful read %d bytes from record %d (position %ld) of file %d (handle %p)\n", + TRACE("successful read %d bytes from record %d (position %u) of file %d (handle %p)\n", bytes_read, record_number, position, fcb->file_number, handle); AL_result = 0x00; /* successful */ } /* if */ @@ -1465,7 +1465,7 @@ static void INT21_SequentialWriteToFCB( struct XFCB *xfcb; HANDLE handle; DWORD record_number; - long position; + DWORD position; BYTE *disk_transfer_area; UINT bytes_written; BYTE AL_result; @@ -1485,7 +1485,7 @@ static void INT21_SequentialWriteToFCB( record_number = 128 * fcb->current_block_number + fcb->record_within_current_block; position = SetFilePointer(handle, record_number * fcb->logical_record_size, NULL, 0); if (position != record_number * fcb->logical_record_size) { - TRACE("seek(%d, %d, 0) failed with %ld\n", + TRACE("seek(%d, %d, 0) failed with %u\n", fcb->file_number, record_number * fcb->logical_record_size, position); AL_result = 0x01; /* disk full */ } else { @@ -1496,7 +1496,7 @@ static void INT21_SequentialWriteToFCB( fcb->file_number, disk_transfer_area, fcb->logical_record_size, bytes_written); AL_result = 0x01; /* disk full */ } else { - TRACE("successful written %d bytes from record %d (position %ld) of file %d (handle %p)\n", + TRACE("successful written %d bytes from record %d (position %u) of file %d (handle %p)\n", bytes_written, record_number, position, fcb->file_number, handle); AL_result = 0x00; /* successful */ } /* if */ @@ -1541,7 +1541,7 @@ static void INT21_ReadRandomRecordFromFC struct XFCB *xfcb; HANDLE handle; DWORD record_number; - long position; + DWORD position; BYTE *disk_transfer_area; UINT bytes_read; BYTE AL_result; @@ -1561,7 +1561,7 @@ static void INT21_ReadRandomRecordFromFC } else { position = SetFilePointer(handle, record_number * fcb->logical_record_size, NULL, 0); if (position != record_number * fcb->logical_record_size) { - TRACE("seek(%d, %d, 0) failed with %ld\n", + TRACE("seek(%d, %d, 0) failed with %u\n", fcb->file_number, record_number * fcb->logical_record_size, position); AL_result = 0x01; /* end of file, no data read */ } else { @@ -1577,7 +1577,7 @@ static void INT21_ReadRandomRecordFromFC AL_result = 0x03; /* end of file, partial record read */ } /* if */ } else { - TRACE("successful read %d bytes from record %d (position %ld) of file %d (handle %p)\n", + TRACE("successful read %d bytes from record %d (position %u) of file %d (handle %p)\n", bytes_read, record_number, position, fcb->file_number, handle); AL_result = 0x00; /* successful */ } /* if */ @@ -1614,7 +1614,7 @@ static void INT21_WriteRandomRecordToFCB struct XFCB *xfcb; HANDLE handle; DWORD record_number; - long position; + DWORD position; BYTE *disk_transfer_area; UINT bytes_written; BYTE AL_result; @@ -1634,7 +1634,7 @@ static void INT21_WriteRandomRecordToFCB } else { position = SetFilePointer(handle, record_number * fcb->logical_record_size, NULL, 0); if (position != record_number * fcb->logical_record_size) { - TRACE("seek(%d, %d, 0) failed with %ld\n", + TRACE("seek(%d, %d, 0) failed with %u\n", fcb->file_number, record_number * fcb->logical_record_size, position); AL_result = 0x01; /* disk full */ } else { @@ -1645,7 +1645,7 @@ static void INT21_WriteRandomRecordToFCB fcb->file_number, disk_transfer_area, fcb->logical_record_size, bytes_written); AL_result = 0x01; /* disk full */ } else { - TRACE("successful written %d bytes from record %d (position %ld) of file %d (handle %p)\n", + TRACE("successful written %d bytes from record %d (position %u) of file %d (handle %p)\n", bytes_written, record_number, position, fcb->file_number, handle); AL_result = 0x00; /* successful */ } /* if */ @@ -1689,7 +1689,7 @@ static void INT21_RandomBlockReadFromFCB struct XFCB *xfcb; HANDLE handle; DWORD record_number; - long position; + DWORD position; BYTE *disk_transfer_area; UINT records_requested; UINT bytes_requested; @@ -1713,7 +1713,7 @@ static void INT21_RandomBlockReadFromFCB } else { position = SetFilePointer(handle, record_number * fcb->logical_record_size, NULL, 0); if (position != record_number * fcb->logical_record_size) { - TRACE("seek(%d, %d, 0) failed with %ld\n", + TRACE("seek(%d, %d, 0) failed with %u\n", fcb->file_number, record_number * fcb->logical_record_size, position); records_read = 0; AL_result = 0x01; /* end of file, no data read */ @@ -1734,7 +1734,7 @@ static void INT21_RandomBlockReadFromFCB AL_result = 0x03; /* end of file, partial record read */ } /* if */ } else { - TRACE("successful read %d bytes from record %d (position %ld) of file %d (handle %p)\n", + TRACE("successful read %d bytes from record %d (position %u) of file %d (handle %p)\n", bytes_read, record_number, position, fcb->file_number, handle); records_read = records_requested; AL_result = 0x00; /* successful */ @@ -1780,7 +1780,7 @@ static void INT21_RandomBlockWriteToFCB( struct XFCB *xfcb; HANDLE handle; DWORD record_number; - long position; + DWORD position; BYTE *disk_transfer_area; UINT records_requested; UINT bytes_requested; @@ -1804,7 +1804,7 @@ static void INT21_RandomBlockWriteToFCB( } else { position = SetFilePointer(handle, record_number * fcb->logical_record_size, NULL, 0); if (position != record_number * fcb->logical_record_size) { - TRACE("seek(%d, %d, 0) failed with %ld\n", + TRACE("seek(%d, %d, 0) failed with %u\n", fcb->file_number, record_number * fcb->logical_record_size, position); records_written = 0; AL_result = 0x01; /* disk full */ @@ -1819,7 +1819,7 @@ static void INT21_RandomBlockWriteToFCB( records_written = bytes_written / fcb->logical_record_size; AL_result = 0x01; /* disk full */ } else { - TRACE("successful write %d bytes from record %d (position %ld) of file %d (handle %p)\n", + TRACE("successful write %d bytes from record %d (position %u) of file %d (handle %p)\n", bytes_written, record_number, position, fcb->file_number, handle); records_written = records_requested; AL_result = 0x00; /* successful */ @@ -2733,7 +2733,7 @@ static void INT21_IoctlHPScanHandler( CO */ static void INT21_Ioctl_Char( CONTEXT86 *context ) { - int status, i; + int status; int IsConsoleIOHandle = 0; IO_STATUS_BLOCK io; FILE_INTERNAL_INFORMATION info; @@ -2750,6 +2750,7 @@ static void INT21_Ioctl_Char( CONTEXT86 return; } } else { + UINT i; for (i = 0; i < NB_MAGIC_DEVICES; i++) { if (!magic_devices[i].handle) continue;