Log On
Embarcadero Home
Watch, Follow, &
Connect with Us
Share This
QualityCentral
Communities
Articles
Blogs
Resources
Downloads
Help
QualityCentral
Delphi-BCB
RTL
Delphi
Arithmetic
ConvUtils
Date - Time
DateUtils
File Management
Format + Float
Input/Output
Math Unit
Memory, Pointer, Address
Null-terminated strings
Other Classes
Other RTL
Pascal Strings
Regular Expressions
RTL Exceptions
Text Files
Thread support
Typed/Untyped Files
WinAPI
You are not logged in.
Help
Print
Public Report
Report From:
Delphi-BCB/RTL/Delphi/WinAPI
[ Add a report in this area ]
Report #:
100430
Status:
Closed
[x64] Registry Rootkeys misdefined in winapi.windows.pas
Project:
Delphi
Build #:
16.0.4276.44006
Version:
16.0
Submitted By:
Daniel Terhell
Report Type:
Crash / Data loss / Total failure
Date Reported:
10/25/2011 4:39:52 AM
Severity:
Critical / Show Stopper
Last Updated:
3/20/2012 2:24:39 AM
Platform:
All versions
Internal Tracking #:
288387
Resolution:
Cannot Reproduce
(Resolution Comments)
Resolved in Build:
:
latest build
Duplicate of:
None
Voting and Rating
Overall Rating:
No Ratings Yet
0.00 out of 5
Total Votes:
None
Description
[x64]
Registry rootkeys constants are misdefined in
winapi.windows.pas:
HKEY is defined as
{$EXTERNALSYM HKEY}
HKEY = type UINT_PTR;
{$EXTERNALSYM HKEY_CLASSES_ROOT}
HKEY_CLASSES_ROOT = HKEY(Integer($80000000));
etc...
There are three problems with this approach:
*It casts a pointer type to a normal data type
*It casts an UNSIGNED data type to a SIGNED data type
*On 64 bit Windows, it truncates a 64 bit value to 32 bits with data loss
Compiling for 64 bit Windows, the registry rootkey constants are completely misdefined and lost in the conversion. As a result Win32 registry functions are not usable on a 64 bits target.
This is a show stopper for any application which is not aware of the problem that makes use of the registry.
Even on 32 bit I this is dangerous practice and makes no sense.
Steps to Reproduce:
Write a Delphi application that makes use of the registry and compile as a 64 bit Windows target.
Workarounds
Rewrite all code making use of registry rootkey constants with a proper self-defined type. That is without the useless and dangerous conversion to Integer.
Attachment
None
Comments
Tomohiro Takahashi at 1/16/2012 5:56:05 PM
-
This is a comment from internal tracking system.
<<<<<<<<<<
We can use registry functions in x64 without an issue...
definition in Visual Studio:
HKEY_LOCAL_MACHINE ((HKEY) (ULONG_PTR)((LONG)0x80000002) )
we:
HKEY_LOCAL_MACHINE = HKEY(Integer($80000002));
the same value is used in Visual Studio x64 and Delphi x64, no issues with HKEY values.
>>>>>>>>>>
View Your Reports
Search
Server Response from: ETNACODE01
Developer Tools
Blackfish SQL
C++Builder
Delphi
FireMonkey
Prism
InterBase
JBuilder
J Optimizer
HTML5 Builder
3rdRail & TurboRuby
Database Tools
Change Manager
DBArtisan
DB Optimizer
ER/Studio
Performance Center
Rapid SQL
Technical Articles
Tutorials
White Papers
Press Releases
Newsletters
Add Content (GetPublished)
Audio
Audio & Video
Video
Bugs & Suggestions (QualityCentral)
Discussion Forums
Examples (CodeCentral)
Tags
Technology Partners
Downloads
Free Trials
Registered User Downloads
Beta Programs
Add Content (GetPublished)
Articles
Blogs
Bugs & Suggestions (QualityCentral)
Discussion Forums
Examples (CodeCentral)
Member Services
About
Connect with Us