aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTheodore Ts'o <tytso@mit.edu>2024-04-25 12:06:28 -0400
committerTheodore Ts'o <tytso@mit.edu>2024-04-25 12:06:28 -0400
commit39b1b0f2ad85237190b52fa0c987aaee7a630f0b (patch)
tree0406a2bdb9a93d239fce1fbfa40b7096511935f8
parentc698dc51a4f7823795b6584fb0f4428bbd593dc9 (diff)
parent7c4af8b07f77f909744b0ee77659e10246df8cc0 (diff)
downloade2fsprogs-39b1b0f2ad85237190b52fa0c987aaee7a630f0b.tar.gz
Merge branch 'fix-windows-64-bit' of https://github.com/steffen-kiess/e2fsprogs into next
-rw-r--r--lib/ext2fs/windows_io.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/lib/ext2fs/windows_io.c b/lib/ext2fs/windows_io.c
index f01bbb6ad..4bff07462 100644
--- a/lib/ext2fs/windows_io.c
+++ b/lib/ext2fs/windows_io.c
@@ -154,6 +154,14 @@ static errcode_t windows_get_stats(io_channel channel, io_stats *stats)
return retval;
}
+static LARGE_INTEGER make_large_integer(LONGLONG value)
+{
+ LARGE_INTEGER li;
+
+ li.QuadPart = value;
+ return li;
+}
+
/*
* Here are the raw I/O functions
*/
@@ -174,14 +182,14 @@ static errcode_t raw_read_blk(io_channel channel,
location = ((ext2_loff_t) block * channel->block_size) + data->offset;
if (data->flags & IO_FLAG_FORCE_BOUNCE) {
- if (SetFilePointer(data->handle, location, NULL, FILE_BEGIN) == INVALID_SET_FILE_POINTER) {
+ if (!SetFilePointerEx(data->handle, make_large_integer(location), NULL, FILE_BEGIN)) {
retval = GetLastError();
goto error_out;
}
goto bounce_read;
}
- if (SetFilePointer(data->handle, location, NULL, FILE_BEGIN) == INVALID_SET_FILE_POINTER) {
+ if (!SetFilePointerEx(data->handle, make_large_integer(location), NULL, FILE_BEGIN)) {
retval = GetLastError();
goto error_out;
}
@@ -261,14 +269,14 @@ static errcode_t raw_write_blk(io_channel channel,
location = ((ext2_loff_t) block * channel->block_size) + data->offset;
if (data->flags & IO_FLAG_FORCE_BOUNCE) {
- if (SetFilePointer(data->handle, location, NULL, FILE_BEGIN) == INVALID_SET_FILE_POINTER) {
+ if (!SetFilePointerEx(data->handle, make_large_integer(location), NULL, FILE_BEGIN)) {
retval = GetLastError();
goto error_out;
}
goto bounce_write;
}
- if (SetFilePointer(data->handle, location, NULL, FILE_BEGIN) == INVALID_SET_FILE_POINTER) {
+ if (!SetFilePointerEx(data->handle, make_large_integer(location), NULL, FILE_BEGIN)) {
retval = GetLastError();
goto error_out;
}
@@ -313,7 +321,7 @@ bounce_write:
if (size > channel->block_size)
actual = channel->block_size;
memcpy(data->bounce, buf, actual);
- if (SetFilePointer(data->handle, location, NULL, FILE_BEGIN) == INVALID_SET_FILE_POINTER) {
+ if (!SetFilePointerEx(data->handle, make_large_integer(location), NULL, FILE_BEGIN)) {
retval = GetLastError();
goto error_out;
}