From 62e11742bf4ddca07cd717da45ed47fe849fa620 Mon Sep 17 00:00:00 2001 From: sergei Date: Sun, 17 Apr 2011 22:27:56 +0000 Subject: [PATCH] * 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 - --- .gitattributes | 1 + rtl/win/wininc/defines.inc | 7 ++++--- tests/test/tstdhandle.pp | 12 ++++++++++++ 3 files changed, 17 insertions(+), 3 deletions(-) create mode 100644 tests/test/tstdhandle.pp diff --git a/.gitattributes b/.gitattributes index 6a2fecab06..a97fa3771e 100644 --- a/.gitattributes +++ b/.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 diff --git a/rtl/win/wininc/defines.inc b/rtl/win/wininc/defines.inc index 21d0b2afea..81bf1a68fb 100644 --- a/rtl/win/wininc/defines.inc +++ b/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); diff --git a/tests/test/tstdhandle.pp b/tests/test/tstdhandle.pp new file mode 100644 index 0000000000..037dd7d2e0 --- /dev/null +++ b/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. \ No newline at end of file