webowner47
Programmer
hello,
i'm trying to store application Code in the Registry HKLM, but i cannot write, the weird thing is that i can read anything in this Registry Root which is HKLM, but problem is in writing o it:
this is my code:
i'm trying to store application Code in the Registry HKLM, but i cannot write, the weird thing is that i can read anything in this Registry Root which is HKLM, but problem is in writing o it:
this is my code:
Code:
var KISReg : TRegistry;
KISKey : string;
RandNum1,RandNum2,RandNum3 : integer;
begin
KISReg := TRegistry.Create(KEY_ALL_ACCESS or KEY_WOW64_64KEY);
KISReg.RootKey := HKEY_LOCAL_MACHINE;
if KISReg.OpenKeyReadOnly('\SOFTWARE\WOW6432Node\Examer\ExamManager\PathFile') then
KISKey := KISReg.ReadString('EMPD');
KISReg.OpenKey('\SOFTWARE\WOW6432Node\Examer\ExamManager\PathFile', true);
RandNum1 := RandomRange(48, 57);
RandNum2 := RandomRange(48, 57);
RandNum3 := RandomRange(48, 57);
KISKey[length(KISKey)-1] := Chr(RandNum1);
KISKey[length(KISKey)-2] := Chr(RandNum2);
KISKey[length(KISKey)-3] := Chr(RandNum3);
KISReg.WriteString('EMPD', KISKey);
end;