Markus,

> I will see, if I can work aorund your bug. But if this isn't possible, we
> (menas: you) have to investigate in this problem, because I can't tell our
> customer, that he can't install our product and give him the money (nearly
> 10k Eur) back.

I don't think that it is a SetupBuilder "bug".

GetLastError() is supposed to return meaningful data only if the previous
Windows API call has "failed". But there might be quite a few internal
Windows API calls between the script line(s). One script function does not
mean one Windows API call.

And you can't really compare your Delphi test app with the SetupBuilder app
here. The SetupBuilder app needs more internal information (elevation
level, permissions, etc.) and all this is done automatically behind the
scenes. So perhaps one of the previous Windows API calls (in the
initialization process) returned ERROR_ENVVAR_NOT_FOUND.

If you can tell me how to reproduce the "ERROR_ENVVAR_NOT_FOUND"
GetLastError value then we can try to work around it for you.

BTW, I have seen ERROR_ENVVAR_NOT_FOUND GetLastError return values for
function calls to "SetThreadToken" and/or "SetNamedSecurityInfo". Not
directly related to environment variabls, but GetLastError returned
ERROR_ENVVAR_NOT_FOUND.

Friedrich