Solved

Problem reading REG_BINARY data from the registry

Posted on 2004-04-27
2
1,259 Views
Last Modified: 2007-12-19
Hi Friends,

I am having some problems in reading the REG_BINARY data from windows registry. I want to retrive the password of a SMTP account. Please see the code segemnt.

buf: Array[0..255] of char;
csSMTPPassword : string;

Registry.OpenKey('\Software\Microsoft\Internet Account Manager\Accounts\00000001')
Registry.ReadBinaryData('SMTP Password2', buf, Sizeof(buf));
csSMTPPassword :=  buf;


But I am receiving junk values in csSMTPPassword. What might be the reason

regards,
Partha
0
Comment
Question by:perthg
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 17

Assisted Solution

by:geobul
geobul earned 125 total points
ID: 10928016
Hi,

1. The password might be encrypted

2. Try the following (the size of the buffer is not fixed):

buf: array of char;
ASize : integer;
csSMTPPassword : string;

Registry.OpenKey('\Software\Microsoft\Internet Account Manager\Accounts\00000001');
ASize := Registry.GetDataSize('SMTP Password2');
SetLength(buf,ASize);
Registry.ReadBinaryData('SMTP Password2', buf, ASize);
csSMTPPassword :=  buf;

Regards, Geo
0
 
LVL 11

Accepted Solution

by:
shaneholmes earned 125 total points
ID: 10928378
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
This video shows how to use Hyena, from SystemTools Software, to update 100 user accounts from an external text file. View in 1080p for best video quality.

738 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question