Solved

Problem reading REG_BINARY data from the registry

Posted on 2004-04-27
2
1,246 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
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…

895 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now