Răsfoiți Sursa

* Reverted STD_xxx_HANDLE constants back to DWORD type (issue introduced in r15824). These are not handles, and are 32-bit even in Win64. See http://msdn.microsoft.com/en-us/library/ms683231.aspx
+ added a test to help detecting this happening again.

git-svn-id: trunk@17333 -

sergei 14 ani în urmă
părinte
comite
62e11742bf
3 a modificat fișierele cu 17 adăugiri și 3 ștergeri
  1. 1 0
      .gitattributes
  2. 4 3
      rtl/win/wininc/defines.inc
  3. 12 0
      tests/test/tstdhandle.pp

+ 1 - 0
.gitattributes

@@ -10204,6 +10204,7 @@ tests/test/tstatic2.pp svneol=native#text/pascal
 tests/test/tstatic3.pp svneol=native#text/pascal
 tests/test/tstatic4.pp svneol=native#text/pascal
 tests/test/tstatic5.pp svneol=native#text/pascal
+tests/test/tstdhandle.pp svneol=native#text/plain
 tests/test/tstprocv.pp svneol=native#text/plain
 tests/test/tstring1.pp svneol=native#text/plain
 tests/test/tstring10.pp svneol=native#text/plain

+ 4 - 3
rtl/win/wininc/defines.inc

@@ -1696,9 +1696,10 @@
      SIF_RANGE = 1;
      SIF_DISABLENOSCROLL = 8;
   { GetStdHandle  }
-     STD_INPUT_HANDLE = HANDLE(-10);
-     STD_OUTPUT_HANDLE = HANDLE(-11);
-     STD_ERROR_HANDLE = HANDLE(-12);
+  { !!! The 3 following constants are NOT handles. They remain 32-bit on Win64. }
+     STD_INPUT_HANDLE = DWORD(-10);
+     STD_OUTPUT_HANDLE = DWORD(-11);
+     STD_ERROR_HANDLE = DWORD(-12);
 
 
 

+ 12 - 0
tests/test/tstdhandle.pp

@@ -0,0 +1,12 @@
+{ %TARGET=win64 }
+uses
+  Windows;
+
+{ The STD_xxx_HANDLE constants remain 32-bit in 64-bit Windows. }
+{$warnings off} // unreachable code warnings when things are correct.
+begin
+  if STD_INPUT_HANDLE > High(DWORD) then Halt(1);
+  if STD_OUTPUT_HANDLE > High(DWORD) then Halt(2);
+  if STD_ERROR_HANDLE > High(DWORD) then Halt(3);
+  Halt(0);
+end.