Solved

Problem reading REG_BINARY data from the registry

Posted on 2004-04-27
2
1,242 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
Comment Utility
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
Comment Utility
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

762 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

11 Experts available now in Live!

Get 1:1 Help Now