2 patches CLK_TCK undefined and SetFilePointerEx
Rob Crittenden <[email protected]> Wed, 28 Jun 2006 15:14:33 -0400
| Newsgroups | gmane.comp.emulators.winex.devel |
|---|---|
| Message-ID | <[email protected]> |
This is a multi-part message in MIME format.
--------------090600030306070903030506
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Attached are 2 patches. The first one fixes a compile issue on my FC4
machine where CLK_TCK is undefined since I upgraded kernels from 2.6.14
to 2.6.16. I think it should be generally safe.
The second adds the function SetFilePointerEx which is required by the
Titans Quest demo. I wasn't able to get the demo to launch, it craps out
trying to create the first window, but this at least resolves the
0xdeadbeef issue.
I only tested files < 2GB (the largest was 25MB) so I don't know for
sure that it does the right thing for very large files.
rob
--------------090600030306070903030506
Content-Type: text/x-diff;
name="time.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="time.diff"
Index: dlls/kernel/time.c
===================================================================
RCS file: /cvsroot/winex/dlls/kernel/time.c,v
retrieving revision 1.8
diff -u -r1.8 time.c
--- dlls/kernel/time.c 14 Mar 2005 17:13:38 -0000 1.8
+++ dlls/kernel/time.c 28 Jun 2006 17:57:09 -0000
@@ -20,6 +20,11 @@
#include "wine/unicode.h"
#include "wine/debug.h"
+/* Fix for Fedora systems that don't define this */
+#ifndef CLK_TCK
+#define CLK_TCK CLOCKS_PER_SEC
+#endif
+
WINE_DEFAULT_DEBUG_CHANNEL(win32);
/* maximum time adjustment in seconds for SetLocalTime and SetSystemTime */
@@ -515,7 +520,6 @@
NtQuerySystemTime( (LARGE_INTEGER *)time );
}
-
/*********************************************************************
* TIME_ClockTimeToFileTime ([email protected], 20-Sep-1998)
*
--------------090600030306070903030506
Content-Type: text/x-diff;
name="setfile.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="setfile.diff"
Index: ./dlls/kernel/kernel32.spec
===================================================================
RCS file: /cvsroot/winex/dlls/kernel/kernel32.spec,v
retrieving revision 1.8
diff -u -r1.8 kernel32.spec
--- ./dlls/kernel/kernel32.spec 15 Nov 2004 15:35:11 -0000 1.8
+++ ./dlls/kernel/kernel32.spec 28 Jun 2006 17:51:33 -0000
@@ -706,6 +706,7 @@
@ stdcall SetFileAttributesA(str long) SetFileAttributesA
@ stdcall SetFileAttributesW(wstr long) SetFileAttributesW
@ stdcall SetFilePointer(long long ptr long) SetFilePointer
+@ stdcall SetFilePointerEx(long long long ptr long) SetFilePointerEx
@ stdcall SetFileTime(long ptr ptr ptr) SetFileTime
@ stdcall SetHandleContext(long long) SetHandleContext
@ stdcall SetHandleCount(long) SetHandleCount
Index: ./files/file.c
===================================================================
RCS file: /cvsroot/winex/files/file.c,v
retrieving revision 1.31
diff -u -r1.31 file.c
--- ./files/file.c 9 Jan 2006 18:26:25 -0000 1.31
+++ ./files/file.c 28 Jun 2006 17:51:39 -0000
@@ -2053,6 +2053,37 @@
return ret;
}
+/***********************************************************************
+ * SetFilePointerEx (KERNEL32.@)
+ */
+BOOL WINAPI SetFilePointerEx( HANDLE hFile, LARGE_INTEGER liDistanceToMove,
+ PLARGE_INTEGER lpNewFilePointer,
+ DWORD dwMoveMethod)
+{
+ TRACE("handle %d offset %ld high %ld origin %ld newpointer %d\n",
+ hFile, liDistanceToMove.u.LowPart, liDistanceToMove.u.HighPart?liDistanceToMove.u.HighPart:0, dwMoveMethod, lpNewFilePointer?1:0 );
+
+ if (dwMoveMethod < FILE_BEGIN || dwMoveMethod > FILE_END) {
+ ERR("Invalid dwMoveMethod\n");
+ SetLastError(ERROR_INVALID_PARAMETER);
+ return FALSE;
+ }
+
+ liDistanceToMove.u.LowPart = SetFilePointer(hFile,
+ liDistanceToMove.u.LowPart, &liDistanceToMove.u.HighPart,
+ dwMoveMethod);
+
+ if (GetLastError() != NO_ERROR) {
+ return FALSE;
+ }
+
+ if (lpNewFilePointer) {
+ lpNewFilePointer->u.LowPart = liDistanceToMove.u.LowPart;
+ lpNewFilePointer->u.HighPart = liDistanceToMove.u.HighPart;
+ }
+
+ return TRUE;
+}
/***********************************************************************
* _llseek (KERNEL.84)
--------------090600030306070903030506--