Log On
Embarcadero Home
Watch, Follow, &
Connect with Us
Share This
QualityCentral
Communities
Articles
Blogs
Resources
Downloads
Help
QualityCentral
Delphi-BCB
VCL
8-Byte Alignment
Action Classes
Additional Controls
Core VCL Classes
DFM to TEXT
Dialog Controls
Docking
Drag/Drop
Emulation Classes
Exceptions
Gestures
Graphics
MAPI Support
MDI Support
Multi-Monitor Support
OnGesture event
Printing
Property/Type Editors
Registry / INI Objects
Ribbon Controls
Sample Controls
Services
Standard Controls
Styles
System Controls
Thread support
Touch Controls
Type Info
Win 3.1 Controls
Win 32 Controls
You are not logged in.
Help
Print
Public Report
Report From:
Delphi-BCB/VCL/Registry / INI Objects
[ Add a report in this area ]
Report #:
4620
Status:
Reported
registry.savekey function not working in Win 32 bit environments. The problem is also present with Version 7.
Project:
Delphi
Build #:
6.140up2
Version:
6.0
Submitted By:
Stefan Loeners
Report Type:
Issue
Date Reported:
6/1/2003 11:50:23 AM
Severity:
Commonly encountered problem
Last Updated:
6/22/2003 7:52:38 AM
Platform:
All platforms
Internal Tracking #:
Resolution:
None
Resolved in Build:
:
None
Duplicate of:
None
Voting and Rating
Overall Rating:
(6 Total Ratings)
3.17 out of 5
Total Votes:
1
Description
The following sample code will work in Win 95-98-ME but NOT in the 32 bit versions (tested on NT,XP,2K with latest service packs installed)
procedure TForm1.Button1Click(Sender: TObject);
const
sFileName:string = 'c:\temp\regsave';
sRegString:string= '\Software\Microsoft';
var
Form1: TForm1;
Registry1:TRegistry;
begin
Registry1 := TRegistry.create;
With Registry1 do begin
RootKey:= HKEY_LOCAL_MACHINE;
if SaveKey(sRegString,sFilename) = false then showmessage ('NOT ok');
free;
end;
Steps to Reproduce:
None
Workarounds
None
Attachment
None
Comments
Robert Cerny at 6/6/2003 1:57:25 AM
-
That's normal and desired behaviour and has nothing to do with Delphi. Win9x does not implement access rights for registry, so you can write any persistent part of registry. On NT class OS you must have write access rights. Regular users can write HKEY_CURRENT_USER hive only.
Also, your Area, Type and Severity are inappropriate.
Also, it is always a good idea to discuss an issue with with friends or in newsgroups, so that QC does not get filled with such things from uninformed individuals.
Stefan Loeners at 6/9/2003 2:49:36 AM
-
Dear Robert,
I am familiar with the possible access rights issue. However, I do have administrator rights. The function does not work for HKEY_CURRENT_USER either. Also, I am trying to read, not write to the registry. So the issue persists. I have talked to several experienced Delphi developers about this, but nobody knows the answer. A workaround solution would be to write an API call to recursively list all registry keys in the section I need and save them (but in that case you get all these different types of variables). Any advice would be appreciated. Thank yo!u.
Robert Cerny at 6/13/2003 1:33:20 AM
-
I tried following code:
RegOpenKeyEx(HKEY_LOCAL_MACHINE,PChar(sRegString),0, KEY_ALL_ACCESS ,AKey);
Res := RegSaveKey(AKey, PChar(sFileName), nil);
Here Res = 1314, which means "A required privilege is not held by the client.", though in regedit I can export key.
No ideas, sorry, but obviously has nothing to do with Delphi.
Brian Cook at 6/13/2003 11:01:19 AM
-
> No ideas, sorry, but obviously has nothing to do with Delphi.
I disagree. TRegistry is designed and meant to be a layer of insulation over the Windows API. As a layer of insulation, it should protect the developer from the mundane (managing handles and such) and provide a set of commonly used services (opening, closing, reading, writing).
In this case, TRegistry is supposed to provide the service of "SaveKey" and has failed to provide this service. If an operating system privilege must be obtained to perform the service then TRegistry should take care of that detail.
Borland intended TRegistry to provide a SaveKey service. They failed. It's Borland's bug.
Brian Cook at 6/20/2003 5:20:44 PM
-
Stefan,
Please change the Area. "VCL \ Registry / INI Objects" is probably a better choice.
Please change Version to "6.0" and Build No to "6.140up2".
Please add a note in the Description that the problem is also present with Version 7.
Thanks, Brian
Brian Cook at 6/22/2003 11:06:05 AM
-
For what little it's worth, this report gets a "5" from me.
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