Index: util/file/file_io_win.cc |
diff --git a/util/file/file_io_win.cc b/util/file/file_io_win.cc |
index 7426737dcfe9cdaf82e5601ccd1e5f9d97af67d8..9106ab0bd32f5693d1cbabf31e67ddf4b193af34 100644 |
--- a/util/file/file_io_win.cc |
+++ b/util/file/file_io_win.cc |
@@ -103,6 +103,34 @@ FileHandle LoggingOpenFileForWrite(const base::FilePath& path, |
return file; |
} |
+FileOffset LoggingSeekFile(FileHandle file, FileOffset offset, int whence) { |
+ DWORD method = 0; |
+ switch (whence) { |
+ case SEEK_SET: |
+ method = FILE_BEGIN; |
+ break; |
+ case SEEK_CUR: |
+ method = FILE_CURRENT; |
+ break; |
+ case SEEK_END: |
+ method = FILE_END; |
+ break; |
+ default: |
+ NOTREACHED(); |
+ break; |
+ } |
+ |
+ LARGE_INTEGER distance_to_move; |
+ distance_to_move.QuadPart = offset; |
+ LARGE_INTEGER new_offset; |
+ BOOL result = SetFilePointerEx(file, distance_to_move, &new_offset, method); |
+ if (!result) { |
+ PLOG(ERROR) << "SetFilePointerEx"; |
+ return -1; |
+ } |
+ return new_offset.QuadPart; |
+} |
+ |
bool LoggingCloseFile(FileHandle file) { |
BOOL rv = CloseHandle(file); |
PLOG_IF(ERROR, !rv) << "CloseHandle"; |