rsivam
asked on
How to convert binary data to string
Registry.RootKey := HKEY_CURRENT_USER;
Registry.OpenKey('\Softwar e\Microsof t\Windows\ CurrentVer sion\Explo rer\Recent Docs\Folde r',False)
Registry.ReadBinaryData('V ALUE7', Buffer , Sizeof(Buffer))
How to convert binary data to string.
Registry.OpenKey('\Softwar
Registry.ReadBinaryData('V
How to convert binary data to string.
Carry out below method, you can use buffer var as string.
var Registry: TRegistry;
Buffer : array[1..255] of char;
isize : Integer;
begin
Registry := TRegistry.Create;
Registry.RootKey := HKEY_LOCAL_MACHINE;
Registry.OpenKey('\SOFTWAR E\Prn\DEMO 2',False);
iSize := sizeof(Buffer);
Registry.ReadBinaryData('P ASSWD', Buffer, isize);
Registry.Free;
Buffer[isize] := #0;
ShowMessage(buffer);
end;
var Registry: TRegistry;
Buffer : array[1..255] of char;
isize : Integer;
begin
Registry := TRegistry.Create;
Registry.RootKey := HKEY_LOCAL_MACHINE;
Registry.OpenKey('\SOFTWAR
iSize := sizeof(Buffer);
Registry.ReadBinaryData('P
Registry.Free;
Buffer[isize] := #0;
ShowMessage(buffer);
end;
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Dear Mr.millious
Thank u for your detailed mail.
My aim is tio find the current open dir in explorer.
When i read the binary data stored in
\Software\Microsoft\Window s\CurrentV ersion\Exp lorer\Rece ntDocs\Fol der',
i := Registry.ReadBinaryData('V alue1', Buffer, isize);
it returns the value 0 for all values stored in the folder.
pls. give your idea reg. How to get the current open
directory.
Thank u for your detailed mail.
My aim is tio find the current open dir in explorer.
When i read the binary data stored in
\Software\Microsoft\Window
i := Registry.ReadBinaryData('V
it returns the value 0 for all values stored in the folder.
pls. give your idea reg. How to get the current open
directory.
rsivam:
This old question needs to be finalized -- accept an answer, split points, or get a refund. For information on your options, please click here-> http:/help/closing.jsp#1
EXPERTS:
Post your closing recommendations! No comment means you don't care.
This old question needs to be finalized -- accept an answer, split points, or get a refund. For information on your options, please click here-> http:/help/closing.jsp#1
EXPERTS:
Post your closing recommendations! No comment means you don't care.
Hi!
No comment has been added lately and this question is therefore classified abandoned.
If asker wishes to close the question, then refer to
https://www.experts-exchange.com/help/closing.jsp
Otherwise, I will leave a recommendation in the Cleanup topic area that this question is:
Answered by: billious
Please leave any comments here within the next seven days. It is assumed that any participant not responding to this request is no longer interested in its final disposition.
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
...Snehanshu
EE Cleanup Volunteer
No comment has been added lately and this question is therefore classified abandoned.
If asker wishes to close the question, then refer to
https://www.experts-exchange.com/help/closing.jsp
Otherwise, I will leave a recommendation in the Cleanup topic area that this question is:
Answered by: billious
Please leave any comments here within the next seven days. It is assumed that any participant not responding to this request is no longer interested in its final disposition.
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
...Snehanshu
EE Cleanup Volunteer
so you could try
var s : string; i : integer;
i := readbinarydata(.....);
s := '';
while i > 0 do
s := char(buffer[i]) + s; {assuming buffer is an array of byte}
which may give you a string of non-ASCII characters
or
...
while i > 0 do
s := hex2(buffer[i]) + s; {assuming buffer is an array of byte}
and hex2 is something like
function hex2(b : byte) : string[2];
const
hexchars : array[0..15] of char = ('0','1','2',
'3','4','5',
'6','7','8',
'9','A','B',
'C','D','E','F');
begin
hex2 := hexchars[b div 16] + hexchars[b mod 16];
end;
...it all really depends on what you mean!
...Bill