summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormarco <marco@3ad0048d-3df7-0310-abae-a5850022a9f2>2011-06-01 08:36:14 +0000
committermarco <marco@3ad0048d-3df7-0310-abae-a5850022a9f2>2011-06-01 08:36:14 +0000
commit91aba99ac02b554d5afab85a30aba65dac1dc276 (patch)
treecd486d02711f580d6af53a561e80f5d7b58e2f8c
parent2b81633ecc5e4f906dcd2e409ce59590f69e69d2 (diff)
downloadfpc-91aba99ac02b554d5afab85a30aba65dac1dc276.tar.gz
--- Merging r17333 into '.':
U rtl/win/wininc/defines.inc A tests/test/tstdhandle.pp # revisions: 17333 ------------------------------------------------------------------------ r17333 | sergei | 2011-04-18 00:27:56 +0200 (Mon, 18 Apr 2011) | 2 lines Changed paths: M /trunk/rtl/win/wininc/defines.inc A /trunk/tests/test/tstdhandle.pp * 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: http://svn.freepascal.org/svn/fpc/branches/fixes_2_4@17621 3ad0048d-3df7-0310-abae-a5850022a9f2
-rw-r--r--rtl/win/wininc/defines.inc7
-rw-r--r--tests/test/tstdhandle.pp12
2 files changed, 16 insertions, 3 deletions
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