I found a possible solution, I have to query these registry values:
HKEY_LOCAL_MACHINE\System\Setup\SystemSetupInProgress
HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\MiniNT
I share the code
unit Unit1;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, Forms, Controls, Graphics, Dialogs, StdCtrls, registry;
type
{ TForm1 }
TForm1 = class(TForm)
Button1: TButton;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
procedure Button1Click(Sender: TObject);
private
public
end;
var
Form1: TForm1;
datos1, datos2: Tregistry;
implementation
{$R *.lfm}
{ TForm1 }
procedure TForm1.Button1Click(Sender: TObject);
begin
datos1:=TRegistry.Create(KEY_READ);
datos1.RootKey:=HKEY_LOCAL_MACHINE;
datos1.OpenKey('\System\Setup', false);
if datos1.ReadInteger('SystemSetupInProgress')=0 then
begin
Label1.Caption:='SystemSetupInProgress = 0';
Label3.Caption:='you are in windows normal';
end
else
begin // SystemSetupInProgress = 1
Label1.Caption:='SystemSetupInProgress = 1';
Label3.Caption:='you are in windows installation';
end;
datos1.CloseKey;
datos1.Free;
datos2:=TRegistry.Create;
datos2.RootKey:=HKEY_LOCAL_MACHINE;
datos2.OpenKey('\System\CurrentControlSet\Control', false);
if datos2.KeyExists('MiniNT') then
begin
Label2.Caption:='Key "MiniNT" exist';
Label4.Caption:='you are in windows PE';
end
else
begin
Label2.Caption:='Key "MiniNT" NOT exist';
Label4.Caption:='you are in windows normal';
end;
datos2.CloseKey;
datos2.Free;
{
HKEY_LOCAL_MACHINE\System\Setup\SystemSetupInProgress
HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\MiniNT
HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\MiniNT
}
end;
end.
at the moment it works perfect
remember to have two versions of your app (32 and 64) and test.