Title: Search the boot drive
Use "BootDir" value in HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Setup:
uses Registry;
...
procedure TForm1.Button1Click(Sender: TObject);
begin
with TRegistry.Create do
begin
RootKey:=HKEY_LOCAL_MACHINE;
if OpenKey(
'Software\Microsoft\Windows\CurrentVersion\Setup',
False) then
try
Edit1.Text:=ReadString('BootDir');
except
MessageDlg('Can not go to this handle',mtError,[mbOk],0);
end
else
MessageDlg('Error registry reading',mtError,[mbOk],0);
CloseKey;
end;
end;