this is one I made a little while ago. written in Delphi.
the first one will show dialogs if errors. The second lacks the dialogs but will be a smaller file. third creates a log file in systemroot.
to debug change...
{$APPTYPE GUI}
to...
{$APPTYPE CONSOLE}
to debug presetup.cmd change...
SW_HIDE
to...
SW_SHOWNORMAL
Compile it in Delphi.
USE AT OWN RISK!
with dialogs...
program setup;
{$APPTYPE GUI}
uses
  SysUtils, Windows, ShellAPI, Dialogs;
{$R *.RES}
  procedure ShellExecute_AndWait(FileName: string; Params: string; Visible: DWORD);
var
  exInfo: TShellExecuteInfo;
  Ph: DWORD;
begin
  FillChar(exInfo, SizeOf(exInfo), 0);
  with exInfo do
  begin
    cbSize := SizeOf(exInfo);
    fMask := SEE_MASK_NOCLOSEPROCESS or SEE_MASK_FLAG_DDEWAIT;
    Wnd := GetActiveWindow();
    ExInfo.lpVerb := 'open';
    ExInfo.lpParameters := PChar(Params);
    lpFile := PChar(FileName);
    nShow := Visible;
  end;
  if ShellExecuteEx(@exInfo) then
    Ph := exInfo.HProcess
  else
  begin
    // if error
    Exit;
  end;
  WaitForSingleObject(ExInfo.hProcess, INFINITE);
  CloseHandle(Ph);
end;
var
  setupExe, setuporgExe, setupoldExe, cmdParams : String;
  i : Integer;
  
begin
   
    setupExe := 'setup.exe';
    setupoldExe := 'setupold.exe';
    setuporgExe := 'setuporg.exe';
    cmdParams := ParamStr(1);
    if ParamCount > 1 then
    begin
      for i := 2 to ParamCount do
        cmdParams := cmdParams+' '+ParamStr(i);
    end;
    if not RenameFile(setupExe, setupoldExe) then
        ShowMessage('Error renaming setup to setupold.');
    if not RenameFile(setuporgExe, setupExe) then
        ShowMessage('Error renaming setuporg to setup.');
    if FileExists('presetup.cmd') then
        ShellExecute_AndWait(PChar('presetup.cmd'), PChar('nada'), SW_HIDE)
    else
        ShowMessage('Error! no presetup.cmd file.');
    if not FileExists(setupExe) then
        ShowMessage('Error! no setup.exe file.');
    ShellExecute_AndWait(PChar('setup.exe'), PChar(cmdParams), SW_SHOWNORMAL);
end.
without dialogs...
program setup;
{$APPTYPE GUI}
uses
  SysUtils, Windows, ShellAPI;
{$R *.RES}
  procedure ShellExecute_AndWait(FileName: string; Params: string; Visible: DWORD);
var
  exInfo: TShellExecuteInfo;
  Ph: DWORD;
begin
  FillChar(exInfo, SizeOf(exInfo), 0);
  with exInfo do
  begin
    cbSize := SizeOf(exInfo);
    fMask := SEE_MASK_NOCLOSEPROCESS or SEE_MASK_FLAG_DDEWAIT;
    Wnd := GetActiveWindow();
    ExInfo.lpVerb := 'open';
    ExInfo.lpParameters := PChar(Params);
    lpFile := PChar(FileName);
    nShow := Visible;
  end;
  if ShellExecuteEx(@exInfo) then
    Ph := exInfo.HProcess
  else
  begin
    // if error
    Exit;
  end;
  WaitForSingleObject(ExInfo.hProcess, INFINITE);
  CloseHandle(Ph);
end;
var
  setupExe, setuporgExe, setupoldExe, cmdParams : String;
  i : Integer;
  
begin
   
    setupExe := 'setup.exe';
    setupoldExe := 'setupold.exe';
    setuporgExe := 'setuporg.exe';
    cmdParams := ParamStr(1);
    if ParamCount > 1 then
    begin
      for i := 2 to ParamCount do
        cmdParams := cmdParams+' '+ParamStr(i);
    end;
    if RenameFile(setupExe, setupoldExe) then;
    if RenameFile(setuporgExe, setupExe) then;
    if FileExists('presetup.cmd') then
        ShellExecute_AndWait(PChar('presetup.cmd'), PChar('nada'), SW_HIDE);    
    ShellExecute_AndWait(PChar('setup.exe'), PChar(cmdParams), SW_SHOWNORMAL);
end.
creates a log file in systemroot...
program setup;
{$APPTYPE GUI}
uses
  SysUtils, Windows, ShellAPI;
{$R *.RES}
  procedure ShellExecute_AndWait(FileName: string; Params: string; Visible: DWORD);
var
  exInfo: TShellExecuteInfo;
  Ph: DWORD;
begin
  FillChar(exInfo, SizeOf(exInfo), 0);
  with exInfo do
  begin
    cbSize := SizeOf(exInfo);
    fMask := SEE_MASK_NOCLOSEPROCESS or SEE_MASK_FLAG_DDEWAIT;
    Wnd := GetActiveWindow();
    ExInfo.lpVerb := 'open';
    ExInfo.lpParameters := PChar(Params);
    lpFile := PChar(FileName);
    nShow := Visible;
  end;
  if ShellExecuteEx(@exInfo) then
    Ph := exInfo.HProcess
  else
  begin
    // if error
    Exit;
  end;
  WaitForSingleObject(ExInfo.hProcess, INFINITE);
  CloseHandle(Ph);
end;
var
  setupExe, setuporgExe, setupoldExe, cmdParams, winDir : String;
  i : Integer;
  logFile : TextFile;
  
begin
    winDir := GetEnvironmentVariable('SystemRoot');
    AssignFile(logFile, winDir+'\presetup.log');
    ReWrite(logFile);
    WriteLn(logFile, '::::::::: Presetup Log File :::::::::');
    WriteLn(logFile, 'Fake setup.exe file © 2008 jaws1975');
    WriteLn(logFile, '');
    WriteLn(logFile, 'Initializing presetup...');
    setupExe := 'setup.exe';
    setupoldExe := 'setupold.exe';
    setuporgExe := 'setuporg.exe';
    WriteLn(logFile, 'Preparing commandline parameters to pass to real setup.exe...');
    cmdParams := ParamStr(1);
    if ParamCount > 1 then
    begin
      for i := 2 to ParamCount do
        cmdParams := cmdParams+' '+ParamStr(i);
    end;
    WriteLn(logFile, 'Renaming setup.exe to setupold.exe...');
    if not RenameFile(setupExe, setupoldExe) then
        WriteLn(logFile, '   error renaming setup.exe to setupold.exe...')
    else
        WriteLn(logFile, '   renamed setup.exe to setupold.exe...');
    WriteLn(logFile, 'Renaming setuporg.exe to setup.exe...');
    if not RenameFile(setuporgExe, setupExe) then
        WriteLn(logFile, '   error renaming setuporg.exe to setup.exe...')
    else
        WriteLn(logFile, '   renamed setuporg.exe to setup.exe...');
    WriteLn(logFile, 'Launching presetup.cmd...');
    if FileExists('presetup.cmd') then
        ShellExecute_AndWait(PChar('presetup.cmd'), PChar('nada'), SW_HIDE);
    if not FileExists(setupExe) then
        WriteLn(logFile, 'ERROR! setup.exe missing...')
    else
        WriteLn(logFile, 'Launching real setup.exe with parameters...');
    WriteLn(logFile, '   '+cmdParams);
    CloseFile(logFile);
    ShellExecute_AndWait(PChar('setup.exe'), PChar(cmdParams), SW_SHOWNORMAL);
    
end.
removing {$APPTYPE GUI} will cause it not to work. it says gui but there is no screen output.
use it or modify it as you like.
basically what it does is renames setup.exe to setupold.exe then rename setuporg.exe to setup.exe. it then launches presetup.cmd and waits for it to finish. it then launches the real setup.exe. It must wait for the real setup.exe to finish before the fake setup.exe closes.
I tried deleting setupold.exe but it would not delete when I tried.
						Last edited by jaws1975 (2008-08-08 13:39:50)