reactos/lib/kernel32/file
diff -u -r1.49 -r1.50
--- file.c 23 Jan 2004 21:16:03 -0000 1.49
+++ file.c 14 Mar 2004 13:11:55 -0000 1.50
@@ -1,4 +1,4 @@
-/* $Id: file.c,v 1.49 2004/01/23 21:16:03 ekohl Exp $
+/* $Id: file.c,v 1.50 2004/03/14 13:11:55 weiden Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS system libraries
@@ -203,6 +203,8 @@
DPRINT("SetFilePointer(hFile %x, lDistanceToMove %d, dwMoveMethod %d)\n",
hFile,lDistanceToMove,dwMoveMethod);
+ /* FIXME - should fail if hFile is a console handle */
+
Distance.u.LowPart = lDistanceToMove;
if (lpDistanceToMoveHigh)
{
@@ -216,18 +218,18 @@
{
Distance.u.HighPart = -1;
}
-
- if (dwMoveMethod == FILE_CURRENT)
- {
+
+ switch(dwMoveMethod)
+ {
+ case FILE_CURRENT:
NtQueryInformationFile(hFile,
&IoStatusBlock,
&FilePosition,
sizeof(FILE_POSITION_INFORMATION),
FilePositionInformation);
FilePosition.CurrentByteOffset.QuadPart += Distance.QuadPart;
- }
- else if (dwMoveMethod == FILE_END)
- {
+ break;
+ case FILE_END:
NtQueryInformationFile(hFile,
&IoStatusBlock,
&FileStandart,
@@ -235,11 +237,17 @@
FileStandardInformation);
FilePosition.CurrentByteOffset.QuadPart =
FileStandart.EndOfFile.QuadPart + Distance.QuadPart;
- }
- else if ( dwMoveMethod == FILE_BEGIN )
- {
+ break;
+ case FILE_BEGIN:
FilePosition.CurrentByteOffset.QuadPart = Distance.QuadPart;
- }
+ break;
+ }
+
+ if(FilePosition.CurrentByteOffset.QuadPart < 0)
+ {
+ SetLastError(ERROR_NEGATIVE_SEEK);
+ return -1;
+ }
errCode = NtSetInformationFile(hFile,
&IoStatusBlock,
@@ -263,6 +271,72 @@
/*
* @implemented
*/
+BOOL
+STDCALL
+SetFilePointerEx(HANDLE hFile,
+ LARGE_INTEGER liDistanceToMove,
+ PLARGE_INTEGER lpNewFilePointer,
+ DWORD dwMoveMethod)
+{
+ FILE_POSITION_INFORMATION FilePosition;
+ FILE_STANDARD_INFORMATION FileStandart;
+ NTSTATUS errCode;
+ IO_STATUS_BLOCK IoStatusBlock;
+
+ /* FIXME - should fail if hFile is a console handle */
+
+ switch(dwMoveMethod)
+ {
+ case FILE_CURRENT:
+ NtQueryInformationFile(hFile,
+ &IoStatusBlock,
+ &FilePosition,
+ sizeof(FILE_POSITION_INFORMATION),
+ FilePositionInformation);
+ FilePosition.CurrentByteOffset.QuadPart += liDistanceToMove.QuadPart;
+ break;
+ case FILE_END:
+ NtQueryInformationFile(hFile,
+ &IoStatusBlock,
+ &FileStandart,
+ sizeof(FILE_STANDARD_INFORMATION),
+ FileStandardInformation);
+ FilePosition.CurrentByteOffset.QuadPart =
+ FileStandart.EndOfFile.QuadPart + liDistanceToMove.QuadPart;
+ break;
+ case FILE_BEGIN:
+ FilePosition.CurrentByteOffset.QuadPart = liDistanceToMove.QuadPart;
+ break;
+ }
+
+ if(FilePosition.CurrentByteOffset.QuadPart < 0)
+ {
+ SetLastError(ERROR_NEGATIVE_SEEK);
+ return FALSE;
+ }
+
+ errCode = NtSetInformationFile(hFile,
+ &IoStatusBlock,
+ &FilePosition,
+ sizeof(FILE_POSITION_INFORMATION),
+ FilePositionInformation);
+ if (!NT_SUCCESS(errCode))
+ {
+ SetLastErrorByStatus(errCode);
+ return FALSE;
+ }
+
+ if (lpNewFilePointer)
+ {
+ *lpNewFilePointer = FilePosition.CurrentByteOffset;
+ }
+ return TRUE;
+}
+
+
+/*
+ * @implemented
+ */
DWORD STDCALL
GetFileType(HANDLE hFile)
{
reactos/lib/kernel32/misc
diff -u -r1.64 -r1.65
--- stubs.c 14 Mar 2004 11:11:17 -0000 1.64
+++ stubs.c 14 Mar 2004 13:11:55 -0000 1.65
@@ -1,4 +1,4 @@
-/* $Id: stubs.c,v 1.64 2004/03/14 11:11:17 weiden Exp $
+/* $Id: stubs.c,v 1.65 2004/03/14 13:11:55 weiden Exp $
*
* KERNEL32.DLL stubs (unimplemented functions)
* Remove from this file, if you implement them.
@@ -1426,22 +1426,6 @@
*/
BOOL
STDCALL
-SetFilePointerEx(
- HANDLE hFile,
- LARGE_INTEGER liDistanceToMove,
- PLARGE_INTEGER lpNewFilePointer,
- DWORD dwMoveMethod
- )
-{
- SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
- return 0;
-}
-
-/*
- * @unimplemented
- */
-BOOL
-STDCALL
SetFileValidData(
HANDLE hFile,
LONGLONG ValidDataLength