Thanks
Travis Martin
var StringData : TStringStream;
BinaryData : TMemoryStream;
counter : integer;
Key : TKey64;
Deskey : string;
AFCUReg : TRegistry;
EncryptedProgname : shortString;
FirstPrivs,LastPrivs,TempStr: shortString;
begin
StringData := TStringStream.Create('');
BinaryData := TMemoryStream.Create;
BinaryData.SetSize(256);
BinaryData.Position := 0;
AFCUReg := TRegistry.Create;
AFCUReg.RootKey := HKEY_LOCAL_MACHINE;
EncryptedProgname := 'Casetrac1';
AFCUReg.OpenKey('\SOFTWARE\AFCU\CSAIR\OBJECT MODULES',TRUE);
AFCUReg.ReadBinaryData(EncryptedProgname,BinaryData,256);
BinaryData.Position := 0; //This line causes an access
violation.
StringData.Position := 0;
> AFCUReg.ReadBinaryData(EncryptedProgname,BinaryData,256);
BinaryData is the reference to the memory stream object itself not the data
stored in the stream. You might try BinaryData.Memory. I didn't have time so
I haven't a clue. But check the on-line help for TMemoryStream.
Regards, Frederick C. Wilt
Why do you think that this has any chance of working? You are passing
an object instance where the function requires a memory buffer. Change
the code to
AFCUReg.ReadBinaryData(EncryptedProgname,BinaryData.Memory^ ,256);
The syntax may look a bit weird but it is required since the Buffer
parameter for ReadBinaryData is an untyped Var parameter. This is also
the reason why the compiler happily accepted your code, an untyped Var
parameter will eat anything <g>.
Peter Below (TeamB) 10011...@compuserve.com)
No e-mail responses, please, unless explicitly requested!