diff --git a/rtl/amicommon/sysutils.pp b/rtl/amicommon/sysutils.pp
index b4a3a919c8..74f4a9083e 100644
--- a/rtl/amicommon/sysutils.pp
+++ b/rtl/amicommon/sysutils.pp
@@ -182,7 +182,7 @@ begin
 end;
 
 
-function FileGetDate(Handle: THandle) : LongInt;
+function FileGetDate(Handle: THandle) : Int64;
 var
   tmpFIB : PFileInfoBlock;
   tmpDateTime: TDateTime;
diff --git a/rtl/atari/sysutils.pp b/rtl/atari/sysutils.pp
index bcdd9d32a4..d19ee2f6af 100644
--- a/rtl/atari/sysutils.pp
+++ b/rtl/atari/sysutils.pp
@@ -76,7 +76,7 @@ begin
 end;
 
 
-function FileGetDate(Handle: THandle) : LongInt;
+function FileGetDate(Handle: THandle) : Int64;
 var
   td: TDOSTIME;
 begin
diff --git a/rtl/embedded/sysutils.pp b/rtl/embedded/sysutils.pp
index 7336209809..d912263e5f 100644
--- a/rtl/embedded/sysutils.pp
+++ b/rtl/embedded/sysutils.pp
@@ -52,8 +52,7 @@ begin
   result := -1;
 end;
 
-
-function FileGetDate(Handle: LongInt) : LongInt;
+function FileGetDate(Handle: THandle) : Int64;
 begin
   result := -1;
 end;
diff --git a/rtl/emx/sysutils.pp b/rtl/emx/sysutils.pp
index 7a4ecfdb83..d34cd1fad5 100644
--- a/rtl/emx/sysutils.pp
+++ b/rtl/emx/sysutils.pp
@@ -838,7 +838,7 @@ begin
 end;
 
 
-function FileGetDate (Handle: longint): longint; assembler;
+function FileGetDate (Handle: longint): Int64; assembler;
 asm
  push ebx
 {$IFDEF REGCALL}
@@ -854,10 +854,11 @@ asm
  shld eax, ecx, 16
 @FGetDateEnd:
  pop ebx
+ xorl edx,edx
 end {['eax', 'ebx', 'ecx', 'edx']};
 
 
-function FileSetDate (Handle, Age: longint): longint;
+function FileSetDate (Handle: longint; Age: Int64): longint;
 var FStat: PFileStatus3;
     RC: cardinal;
 begin
diff --git a/rtl/gba/sysutils.pp b/rtl/gba/sysutils.pp
index 14f86bc8fd..af47482c2b 100644
--- a/rtl/gba/sysutils.pp
+++ b/rtl/gba/sysutils.pp
@@ -61,13 +61,13 @@ begin
 end;
 
 
-function FileGetDate(Handle: LongInt) : LongInt;
+function FileGetDate(Handle: LongInt) : Int64;
 begin
   result := -1;
 end;
 
 
-function FileSetDate(Handle, Age: Int64) : LongInt;
+function FileSetDate(Handle: Longint; Age: Int64) : LongInt;
 begin
   result := -1;
 end;
diff --git a/rtl/go32v2/sysutils.pp b/rtl/go32v2/sysutils.pp
index a039bf507c..0da43188f3 100644
--- a/rtl/go32v2/sysutils.pp
+++ b/rtl/go32v2/sysutils.pp
@@ -424,7 +424,7 @@ begin
 end;
 
 
-Function FileGetDate (Handle : Longint) : Longint;
+Function FileGetDate (Handle : Longint) : Int64;
 var
   Regs: registers;
 begin
@@ -435,14 +435,11 @@ begin
   if Regs.Flags and CarryFlag <> 0 then
    result := -1
   else
-   begin
-     LongRec(result).Lo := Regs.cx;
-     LongRec(result).Hi := Regs.dx;
-   end ;
+   result:=(Regs.dx shl 16) or Regs.cx;
 end;
 
 
-Function FileSetDate (Handle, Age : Int64) : Longint;
+Function FileSetDate (Handle: longint; Age: Int64) : Longint;
 var
   Regs: registers;
 begin
diff --git a/rtl/macos/sysutils.pp b/rtl/macos/sysutils.pp
index 047440916f..5614f3ceec 100644
--- a/rtl/macos/sysutils.pp
+++ b/rtl/macos/sysutils.pp
@@ -446,7 +446,7 @@ begin
 end;
 
 
-Function FileGetDate (Handle : Longint) : Longint;
+Function FileGetDate (Handle : Longint) : Int64;
 
   (*
 Var Info : Stat;
@@ -462,7 +462,7 @@ begin
 end;
 
 
-Function FileSetDate (Handle,Age : Int64) : Longint;
+Function FileSetDate (Handle: Longint; Age: Int64) : Longint;
 
 begin
   // TODO fix
diff --git a/rtl/msdos/sysutils.pp b/rtl/msdos/sysutils.pp
index 69c85971ad..f540e98f27 100644
--- a/rtl/msdos/sysutils.pp
+++ b/rtl/msdos/sysutils.pp
@@ -423,7 +423,7 @@ begin
 end;
 
 
-Function FileGetDate (Handle : THandle) : Longint;
+Function FileGetDate (Handle : THandle) : Int64;
 var
   Regs: registers;
 begin
@@ -434,10 +434,7 @@ begin
   if Regs.Flags and fCarry <> 0 then
    result := -1
   else
-   begin
-     LongRec(result).Lo := Regs.cx;
-     LongRec(result).Hi := Regs.dx;
-   end ;
+   result:=(Regs.dx shl 16) or Regs.cx;
 end;
 
 
diff --git a/rtl/nativent/sysutils.pp b/rtl/nativent/sysutils.pp
index a894a5264b..c8798a6200 100644
--- a/rtl/nativent/sysutils.pp
+++ b/rtl/nativent/sysutils.pp
@@ -853,7 +853,7 @@ Begin
 end;
 
 
-function FileGetDate(Handle: THandle): Longint;
+function FileGetDate(Handle: THandle): Int64;
 var
   res: NTSTATUS;
   basic: FILE_BASIC_INFORMATION;
diff --git a/rtl/nds/sysutils.pp b/rtl/nds/sysutils.pp
index 27d4b50de8..4f3369c495 100644
--- a/rtl/nds/sysutils.pp
+++ b/rtl/nds/sysutils.pp
@@ -70,13 +70,13 @@ begin
 end;
 
 
-function FileGetDate(Handle: LongInt) : LongInt;
+function FileGetDate(Handle: LongInt) : Int64;
 begin
   result := -1;
 end;
 
 
-function FileSetDate(Handle, Age: Int64) : LongInt;
+function FileSetDate(Handle: LongInt; Age: Int64) : LongInt;
 begin
   result := -1;
 end;
diff --git a/rtl/netware/sysutils.pp b/rtl/netware/sysutils.pp
index f253d2a11c..806a461e23 100644
--- a/rtl/netware/sysutils.pp
+++ b/rtl/netware/sysutils.pp
@@ -362,7 +362,7 @@ begin
 end;
 
 
-Function FileGetDate (Handle : THandle) : Longint;
+Function FileGetDate (Handle : THandle) : Int64;
 Var Info : NWStatBufT;
     PTM  : PNWTM;
 begin
diff --git a/rtl/netware/tests/test.pas b/rtl/netware/tests/test.pas
index 1352079abd..200cc63102 100644
--- a/rtl/netware/tests/test.pas
+++ b/rtl/netware/tests/test.pas
@@ -336,7 +336,7 @@ BEGIN
 END;
 
 {
-Function FileSetDate (Handle,Age : Int64) : Longint;
+Function FileSetDate (Handle: longint; Age: Int64) : Longint;
 Function FileSetAttr (Const Filename : String; Attr: longint) : Longint;
 }
 PROCEDURE SysUtilsTest;
diff --git a/rtl/netwlibc/sysutils.pp b/rtl/netwlibc/sysutils.pp
index e687b08251..84cafd4269 100644
--- a/rtl/netwlibc/sysutils.pp
+++ b/rtl/netwlibc/sysutils.pp
@@ -354,7 +354,7 @@ end;
 
 
 
-Function FileGetDate (Handle : THandle) : Longint;
+Function FileGetDate (Handle : THandle) : Int64;
 Var Info : TStat;
     _PTM : PTM;
 begin
diff --git a/rtl/objpas/sysutils/filutil.inc b/rtl/objpas/sysutils/filutil.inc
index 0c3b153130..62bc87f2ad 100644
--- a/rtl/objpas/sysutils/filutil.inc
+++ b/rtl/objpas/sysutils/filutil.inc
@@ -537,7 +537,7 @@ end;
 
 type
   TAbstractSearchRec = Record
-    Time : Longint;
+    Time : Int64;
     Size : Int64;
     Attr : Longint;
     { this will be assigned by the generic code; it is actually either a
diff --git a/rtl/os2/sysutils.pp b/rtl/os2/sysutils.pp
index e98e638cc9..4061ee9217 100644
--- a/rtl/os2/sysutils.pp
+++ b/rtl/os2/sysutils.pp
@@ -356,7 +356,7 @@ begin
 end;
 
 
-function FileGetDate (Handle: THandle): longint;
+function FileGetDate (Handle: THandle): Int64;
 var
   FStat: TFileStatus3;
   Time: Longint;
@@ -376,7 +376,7 @@ begin
   FileGetDate:=Time;
 end;
 
-function FileSetDate (Handle: THandle; Age: longint): longint;
+function FileSetDate (Handle: THandle; Age: Int64): longint;
 var
   FStat: PFileStatus3;
   RC: cardinal;
diff --git a/rtl/symbian/sysutils.pp b/rtl/symbian/sysutils.pp
index 8d754bd6d9..7c2ab15b79 100644
--- a/rtl/symbian/sysutils.pp
+++ b/rtl/symbian/sysutils.pp
@@ -53,7 +53,7 @@ begin
 end;
 
 
-function FileGetDate(Handle: LongInt) : LongInt;
+function FileGetDate(Handle: LongInt) : Int64;
 begin
   result := -1;
 end;
diff --git a/rtl/watcom/sysutils.pp b/rtl/watcom/sysutils.pp
index f1ccba2428..cd5e56cc48 100644
--- a/rtl/watcom/sysutils.pp
+++ b/rtl/watcom/sysutils.pp
@@ -406,7 +406,7 @@ begin
 end;
 
 
-Function FileGetDate (Handle : Longint) : Longint;
+Function FileGetDate (Handle : Longint) : Int64;
 var
   Regs: registers;
 begin
@@ -424,7 +424,7 @@ begin
 end;
 
 
-Function FileSetDate (Handle, Age : Int64) : Longint;
+Function FileSetDate (Handle: longint; Age: Int64) : Longint;
 var
   Regs: registers;
 begin
diff --git a/rtl/wii/sysutils.pp b/rtl/wii/sysutils.pp
index 6202903cc4..c309895f10 100644
--- a/rtl/wii/sysutils.pp
+++ b/rtl/wii/sysutils.pp
@@ -60,13 +60,13 @@ begin
 end;
 
 
-function FileGetDate(Handle: LongInt) : LongInt;
+function FileGetDate(Handle: LongInt) : Int64;
 begin
   result := -1;
 end;
 
 
-function FileSetDate(Handle, Age: Int64) : LongInt;
+function FileSetDate(Handle: Longint; Age: Int64) : LongInt;
 begin
   result := -1;
 end;
diff --git a/rtl/win/sysutils.pp b/rtl/win/sysutils.pp
index 364cc26a01..76da36747c 100644
--- a/rtl/win/sysutils.pp
+++ b/rtl/win/sysutils.pp
@@ -650,7 +650,7 @@ end;
 
 
 
-Function FileGetDate (Handle : THandle) : Longint;
+Function FileGetDate (Handle : THandle) : Int64;
 Var
   FT : TFileTime;
   tmpdtime : longint;
diff --git a/rtl/win16/sysutils.pp b/rtl/win16/sysutils.pp
index 69d512b81b..8064e8c65b 100644
--- a/rtl/win16/sysutils.pp
+++ b/rtl/win16/sysutils.pp
@@ -449,7 +449,7 @@ begin
 end;
 
 
-Function FileGetDate (Handle : THandle) : Longint;
+Function FileGetDate (Handle : THandle) : Int64;
 var
   Regs: registers;
 begin
@@ -461,10 +461,7 @@ begin
   if Regs.Flags and fCarry <> 0 then
    result := -1
   else
-   begin
-     LongRec(result).Lo := Regs.cx;
-     LongRec(result).Hi := Regs.dx;
-   end ;
+   Result:=(Regs.dx shl 16) or Regs.cx;
 end;
 
 
diff --git a/rtl/wince/sysutils.pp b/rtl/wince/sysutils.pp
index e98ce1d0f7..80e1e05181 100644
--- a/rtl/wince/sysutils.pp
+++ b/rtl/wince/sysutils.pp
@@ -361,7 +361,7 @@ begin
 end;
 
 
-Function FileGetDate (Handle : THandle) : Longint;
+Function FileGetDate (Handle : THandle) : Int64;
 Var
   FT : TFileTime;
   tmpdtime : longint;