Autor Beitrag
bis11
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1247
Erhaltene Danke: 2

Apple Mac OSX 10.11

BeitragVerfasst: Do 12.09.02 19:02 
Hi Leutz,

wie benutze ich den Befehl WriteBinaryData, wenn ich folgenden Wert eintragen möchte mit dem Namen BootExecute :

61, 75, 74, 6f, 63, 68, 65, 63, 6b, 20, 61, 75, 74, 6f, 63, 68, 6b, 20, 2f, 72, 20, 5c, 3f, 3f, 5c, 43, 3a, 00, 61, 75, 74, 6f, 63, 68, 65, 63, 6b, 20, 61, 75, 74, 6f, 63, 68, 6b, 20, 2a, 00, 00, 00

Wie mache ich das ?
Cashels
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 167



BeitragVerfasst: Do 12.09.02 20:50 
Hi,

kuck dir mal die Methode "ReadBinaryData" aus der TRegistry Klasse an... Die braucht 3 Parameter als Übergabe:
- Dein Feldname
- einen Buffer, z.B. mit
var Buf : string ;
definieren, und die Grösse des Inhalts, welchen du mit mit TRegistry.GetDatasize erfahren solltest.

Gruss,
Tom
bis11 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1247
Erhaltene Danke: 2

Apple Mac OSX 10.11

BeitragVerfasst: Do 12.09.02 21:03 
Das ist mir klar, aber ein Beispiel wäre nicht schlacht, da in der OH keines hinterlegt ist.
Cashels
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 167



BeitragVerfasst: Do 12.09.02 21:20 
Hallo nochmals,

also hiermit sollte es klappen:
ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
procedure TForm1.Button1Click(Sender: TObject);
var
 reg : TRegistry ;
 Buf : string ;
begin
     reg := TRegistry.Create ;
     reg.RootKey := HKEY_LOCAL_MACHINE ;
     reg.OpenKey ('software\test',true) ;

     Buf := #$02 + #$03 + #$04 + #$05 ;  // +...


     reg.WriteBinaryData('Binaer',Buf[1],SizeOf(Buf));

     reg.CloseKey ;
     reg.free ;
end;


Gruss,
Tom
DeCodeGuru
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 1333
Erhaltene Danke: 1

Arch Linux
Eclipse
BeitragVerfasst: Do 12.09.02 21:23 
hi,

nur ne frage:
die Variable Buf muss doch kein String sein, oder? Man könnte da doch auch ein Array of Byte nehmen. Wenn ich mir irre, sagst mir bitte.

_________________
Viele Grüße
Jakob
Cashels
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 167



BeitragVerfasst: Do 12.09.02 21:29 
Das dürfte auch klappen, führt aber zum gleichen Ergebnis.

Gruss,
tom
DeCodeGuru
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 1333
Erhaltene Danke: 1

Arch Linux
Eclipse
BeitragVerfasst: Fr 13.09.02 11:53 
jo, meine ich auch. Wenn ich binäre Daten speichern soll, weiche ich nur sehr ungern auf Strings aus. Da nehme ich doch lieber gleich den "direkten" Weg. :wink:

_________________
Viele Grüße
Jakob