1

I need that my program be protected with a dynamic password that includes the current date.

I need just the month or the day or the hour or the minute.

I tried this code to include the day into the password:

[Setup]
Password=Password!{code:DateTime|0}

[Code]
function DateTime (Param: string): string;
begin
    Result := GetDateTimeString('dd', #0, #0);
end;

But it's not working.

Regards.

Martin Prikryl
  • 188,800
  • 56
  • 490
  • 992
Robertopcn
  • 447
  • 1
  • 5
  • 15

1 Answers1

0

The Password directive cannot contain any constants, let alone scripted constants.

So your script makes the password be literally Password!{code:DateTime|0}.

Instead, use CheckPassword event function:

[Code]

function CheckPassword(Password: String): Boolean;
begin
  Result := (Password = ('Password!' + GetDateTimeString('dd', #0, #0)));
end;

Though safer than comparing against a literal string (which can be seen in .exe binary) is comparing a checksum.

See How to do a dynamic password in Inno Setup?

Martin Prikryl
  • 188,800
  • 56
  • 490
  • 992