Page 1 of 3 123 LastLast
Results 1 to 10 of 30

Thread: Call DLL sets WinLastError to 203

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1

    Default Call DLL sets WinLastError to 203

    Hi Friedrich,

    on two customer Machines, every call of "Call DLL" sets WinLastError to 203.

    I have created a blank script with only the following lines inside:

    Display Message Box "" -- "Ready"
    Call DLL "kernel32.dll" -- Function "GetLastError" () ()
    Set Variable %_RESULT% to "%_SB_RETURN%"
    Display Message Box "Result = %_RESULT%" -- "Done"

    And it returns 203, what means: ERROR_ENVVAR_NOT_FOUND - "The system
    could not find the environment option that was entered."

    I have written an identical Program with Delphi and it returns 0, what
    is expected. So it is not Windows itself, what causes the problem.

    This leads me to guess, that the Setupbuilder "call dll" script function
    itself makes use of an "environment option", which does not exists on
    this two machines and causes the error.

    Please, could you have a look into your sources and tell me, what is
    missing on this machines?

    Thanks in advance.

    Markus


    Here is the SBEvents.txt:
    |10/28/2013|11:21:17.706|Logging started: \\server05\AIDA6\Client\test.exe
    |10/28/2013|11:21:17.708|Resource:
    sbside.bmp->C:\Users\schnabel\AppData\Local\Temp\~SBFBD4.tm p
    |10/28/2013|11:21:17.709|Resource:
    sbtop.bmp->C:\Users\schnabel\AppData\Local\Temp\~SBFBD5.tm p
    |10/28/2013|11:21:17.710|Resource:
    0001.lib->C:\Users\schnabel\AppData\Local\Temp\~SBFBD6.tm p
    |10/28/2013|11:21:17.713|RichEdID: 1
    |10/28/2013|11:21:17.714|Set Variable {SELLNG} to 1033
    |10/28/2013|11:21:17.719|InitScriptBegin
    |10/28/2013|11:21:17.719|Set Variable {NULL} to
    |10/28/2013|11:21:17.719|Set Variable {SB5VAR1} to

    |10/28/2013|11:21:17.719|Set Variable {SB5VAR2} to

    |10/28/2013|11:21:17.719|Set Variable {SB5VAR3} to

    |10/28/2013|11:21:17.719|Set Variable %_SB_ERRORCODE% to
    |10/28/2013|11:21:17.719|Set Variable %_SB_RETURN% to
    |10/28/2013|11:21:17.719|Set Variable %_SB_RETURNEX% to
    |10/28/2013|11:21:17.719|Set Variable %_SB_RESUME% to 0
    |10/28/2013|11:21:17.719|Set Variable %_SB_TMP% to
    |10/28/2013|11:21:17.719|Set Variable %_SB_PARAM1% to
    |10/28/2013|11:21:17.719|Set Variable %_SB_PARAM2% to
    |10/28/2013|11:21:17.719|Set Variable %_SB_PARAM3% to
    |10/28/2013|11:21:17.719|Set Variable %_SB_PARAM4% to
    |10/28/2013|11:21:17.719|Set Variable %_SB_PARAM5% to
    |10/28/2013|11:21:17.719|Set Variable %_SB_DIALOGID% to 0
    |10/28/2013|11:21:17.719|Set Variable %_SB_DIALOGNEXTID% to 0
    |10/28/2013|11:21:17.719|Set Variable %_SB_DIALOGMAX% to 0
    |10/28/2013|11:21:17.719|Set Variable %_SB_BUTTONID% to 0
    |10/28/2013|11:21:17.719|Set Variable %_SB_CONTROLID% to 0
    |10/28/2013|11:21:17.719|Set Variable %_SB_EVENTID% to 0
    |10/28/2013|11:21:17.719|Set Variable %_SB_WIZHWND% to 0
    |10/28/2013|11:21:17.719|Set Variable %_SB_FEATURESID% to _0000_
    |10/28/2013|11:21:17.719|Set Variable %_SB_SETUPTYPEID% to 0
    |10/28/2013|11:21:17.719|Set Variable %_SB_USERNAME% to install
    |10/28/2013|11:21:17.719|Set Variable %_SB_USERCOMPANY% to
    |10/28/2013|11:21:17.719|Set Variable %_SB_USERSERIAL% to
    |10/28/2013|11:21:17.719|Set Variable %_SB_PASSWORD% to
    |10/28/2013|11:21:17.719|Set Variable {WINVER} to 1024
    |10/28/2013|11:21:17.719|Set Variable %WINVER% to 1024
    |10/28/2013|11:21:17.719|Set Variable %SYSLNG% to 1031
    |10/28/2013|11:21:17.719|Set Variable {CURLNG} to 1033
    |10/28/2013|11:21:17.719|Set Variable %CURLNG% to 1033
    |10/28/2013|11:21:17.719|Set Variable {WINDIR} to C:\Windows
    |10/28/2013|11:21:17.719|Set Variable %WINDIR% to C:\Windows
    |10/28/2013|11:21:17.719|Set Variable {SYSDIR} to %WINDIR%\System
    |10/28/2013|11:21:17.719|Set Variable %SYSDIR% to %WINDIR%\System
    |10/28/2013|11:21:17.719|Set Variable {SYS32DIR} to C:\Windows\SysWOW64
    |10/28/2013|11:21:17.719|Set Variable %SYS32DIR% to C:\Windows\SysWOW64
    |10/28/2013|11:21:17.724|Set Variable {FONTSDIR} to C:\Windows\Fonts
    |10/28/2013|11:21:17.724|Set Variable %FONTSDIR% to C:\Windows\Fonts
    |10/28/2013|11:21:17.724|Set Variable {TMPDIR} to
    C:\Users\schnabel\AppData\Local\Temp\70575f90-3fbb-11e3-4823-00f0fbd00029
    |10/28/2013|11:21:17.724|Set Variable %TMPDIR% to
    C:\Users\schnabel\AppData\Local\Temp\70575f90-3fbb-11e3-4823-00f0fbd00029
    |10/28/2013|11:21:17.724|Set Variable %TMPWINDIR% to
    C:\Users\schnabel\AppData\Local\Temp
    |10/28/2013|11:21:17.724|Set Variable %_SB_BACKUPDIR% to
    C:\Users\schnabel\AppData\Local\Temp
    |10/28/2013|11:21:17.724|Set Variable {PROGRAMFILESDIR} to C:\Program
    Files (x86)
    |10/28/2013|11:21:17.724|Set Variable %PROGRAMFILESDIR% to C:\Program
    Files (x86)
    |10/28/2013|11:21:17.724|Set Variable {COMMONFILESDIR} to C:\Program
    Files (x86)\Common Files
    |10/28/2013|11:21:17.724|Set Variable %COMMONFILESDIR% to C:\Program
    Files (x86)\Common Files
    |10/28/2013|11:21:17.724|Set Variable {PRIVILEGES} to Admin
    |10/28/2013|11:21:17.724|Set Variable %PRIVILEGES% to Admin
    |10/28/2013|11:21:17.724|Set Variable %_SB_INSTALLERFLAG% to
    000110000000000000000000000000
    |10/28/2013|11:21:17.724|Set Variable {CURDIR} to \\server05\AIDA6\Client
    |10/28/2013|11:21:17.724|Set Variable %CURDIR% to \\server05\AIDA6\Client
    |10/28/2013|11:21:17.724|Set Variable %_SB_ROOT% to
    |10/28/2013|11:21:17.724|Set Variable %_SB_INSTALLDIR% to
    |10/28/2013|11:21:17.724|Set Variable %_SB_ROOT% to
    |10/28/2013|11:21:17.724|Set Variable {SRCDRV} to \\server05\AIDA6
    |10/28/2013|11:21:17.724|Set Variable %SRCDRV% to \\server05\AIDA6
    |10/28/2013|11:21:17.724|Set Variable %_SB_PROGRAMGROUP% to
    |10/28/2013|11:21:17.724|Set Variable %_SB_DISKSPACEREQ% to 0
    |10/28/2013|11:21:17.725|Set Variable %_SB_DISKSPACEFREE% to 0
    |10/28/2013|11:21:17.725|Set Variable %_CSIDL_DESKTOP% to
    C:\Users\schnabel\Desktop
    |10/28/2013|11:21:17.727|Set Variable %_CSIDL_PROGRAMS% to
    C:\Users\schnabel\AppData\Roaming\Microsoft\Window s\Start Menu\Programs
    |10/28/2013|11:21:17.729|Set Variable %_CSIDL_PERSONAL% to
    C:\Users\schnabel\Documents
    |10/28/2013|11:21:17.731|Set Variable %_CSIDL_FAVORITES% to
    C:\Users\schnabel\Favorites
    |10/28/2013|11:21:17.732|Set Variable %_CSIDL_STARTUP% to
    C:\Users\schnabel\AppData\Roaming\Microsoft\Window s\Start
    Menu\Programs\Startup
    |10/28/2013|11:21:17.734|Set Variable %_CSIDL_RECENT% to
    C:\Users\schnabel\AppData\Roaming\Microsoft\Window s\Recent
    |10/28/2013|11:21:17.735|Set Variable %_CSIDL_SENDTO% to
    C:\Users\schnabel\AppData\Roaming\Microsoft\Window s\SendTo
    |10/28/2013|11:21:17.737|Set Variable %_CSIDL_STARTMENU% to
    C:\Users\schnabel\AppData\Roaming\Microsoft\Window s\Start Menu
    |10/28/2013|11:21:17.738|Set Variable %_CSIDL_DESKTOPDIRECTORY% to
    C:\Users\schnabel\Desktop
    |10/28/2013|11:21:17.739|Set Variable %_CSIDL_NETHOOD% to
    C:\Users\schnabel\AppData\Roaming\Microsoft\Window s\Network Shortcuts
    |10/28/2013|11:21:17.739|Set Variable %_CSIDL_FONTS% to C:\Windows\Fonts
    |10/28/2013|11:21:17.741|Set Variable %_CSIDL_TEMPLATES% to
    C:\Users\schnabel\AppData\Roaming\Microsoft\Window s\Templates
    |10/28/2013|11:21:17.742|Set Variable %_CSIDL_COMMON_STARTMENU% to
    C:\ProgramData\Microsoft\Windows\Start Menu
    |10/28/2013|11:21:17.744|Set Variable %_CSIDL_COMMON_PROGRAMS% to
    C:\ProgramData\Microsoft\Windows\Start Menu\Programs
    |10/28/2013|11:21:17.745|Set Variable %_CSIDL_COMMON_STARTUP% to
    C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup
    |10/28/2013|11:21:17.746|Set Variable %_CSIDL_COMMON_DESKTOPDIRECTORY%
    to C:\Users\Public\Desktop
    |10/28/2013|11:21:17.747|Set Variable %_CSIDL_APPDATA% to
    C:\Users\schnabel\AppData\Roaming
    |10/28/2013|11:21:17.749|Set Variable %_CSIDL_PRINTHOOD% to
    C:\Users\schnabel\AppData\Roaming\Microsoft\Window s\Printer Shortcuts
    |10/28/2013|11:21:17.750|Set Variable %_CSIDL_LOCAL_APPDATA% to
    C:\Users\schnabel\AppData\Local
    |10/28/2013|11:21:17.750|Set Variable %_CSIDL_COMMON_APPDATA% to
    C:\ProgramData
    |10/28/2013|11:21:17.752|Set Variable %_CSIDL_PROGRAM_FILES% to
    C:\Program Files (x86)
    |10/28/2013|11:21:17.752|Set Variable %_CSIDL_PROGRAM_FILES_COMMON% to
    C:\Program Files (x86)\Common Files
    |10/28/2013|11:21:17.754|Set Variable %_CSIDL_COMMON_DOCUMENTS% to
    C:\Users\Public\Documents
    |10/28/2013|11:21:17.755|Set Variable %_CSIDL_RESOURCES% to
    C:\Windows\Resources
    |10/28/2013|11:21:17.755|RunScriptBegin
    |10/28/2013|11:21:17.755|Global: Start
    |10/28/2013|11:21:17.755|Set Variable %_SB_DISKSPACEREQ% to 0
    |10/28/2013|11:21:17.755|Set Variable {IDEPLOY_CLI} to IDEPLOY.CLI
    |10/28/2013|11:21:17.755|sbkernel: 8.1.4210 : WinID: 1024 : HTTP_Timeout : 0
    |10/28/2013|11:21:17.755|Global: End
    |10/28/2013|11:21:17.755|@DISPLAYMESSAGE : Ready
    |10/28/2013|11:21:19.414|Set Variable %_SB_RETURN% to 1
    |10/28/2013|11:21:19.414|@CALLDLL kernel32.dll : GetLastError
    |10/28/2013|11:21:19.414|Set Variable %_SB_RETURN% to 203
    |10/28/2013|11:21:19.414|@SETVARIABLE (0 : 3 : 1)
    |10/28/2013|11:21:19.414|Set Variable %_RESULT% to 203
    |10/28/2013|11:21:19.414|@DISPLAYMESSAGE Result = 203 : Done
    |10/28/2013|11:21:20.899|Set Variable %_SB_RETURN% to 1
    |10/28/2013|11:21:20.899|RunScriptEnd
    |10/28/2013|11:21:20.899|InitScriptBeforeScriptClose
    |10/28/2013|11:21:20.899|InitScriptEnd
    |10/28/2013|11:21:20.899|ShutDown1
    |10/28/2013|11:21:20.899|ShutDown2
    |10/28/2013|11:21:20.899|ShutDown3
    |10/28/2013|11:21:20.899|RebootStatus: 0
    |10/28/2013|11:21:20.899|ShutDown4
    |10/28/2013|11:21:20.899|ShutDown5
    |10/28/2013|11:21:20.949|ShutDown6
    |10/28/2013|11:21:20.949|ShutDown7
    |10/28/2013|11:21:20.949|ShutDown8
    |10/28/2013|11:21:20.949|ShutDown9
    |10/28/2013|11:21:20.949|FreeDialogQueueMemoryBegin
    |10/28/2013|11:21:20.949|FreeDialogQueueMemoryEnd
    |10/28/2013|11:21:20.950|ShutDown10
    |10/28/2013|11:21:20.950|ShutDown11
    |10/28/2013|11:21:20.950|Logging terminated

  2. #2

    Default Re: Call DLL sets WinLastError to 203

    Hi Markus,

    Unfortunately, I don't know why "GetLastError" returns 203 on these
    machines.

    I have created a small blank script project. The call to "GetLastError"
    returns 0 on our test machines (XP, Windows 7 x64, Windows 8.1 x64).

    The event log reports the following:

    |10/28/2013|03:47:00.262|RunScriptBegin
    |10/28/2013|03:47:00.262|Global: Start
    |10/28/2013|03:47:00.262|Set Variable %_SB_DISKSPACEREQ% to 0
    |10/28/2013|03:47:00.262|Set Variable {IDEPLOY_CLI} to IDEPLOY.CLI
    |10/28/2013|03:47:00.262|sbkernel: 8.1.4210 : WinID: 16384 : HTTP_Timeout :
    0
    |10/28/2013|03:47:00.262|Global: End
    |10/28/2013|03:47:00.262|@DISPLAYMESSAGE Ready... :
    |10/28/2013|03:47:02.094|Set Variable %_SB_RETURN% to 1
    |10/28/2013|03:47:02.094|@CALLDLL kernel32 : GetLastError
    |10/28/2013|03:47:02.094|Set Variable %_SB_RETURN% to 0
    |10/28/2013|03:47:02.094|@SETVARIABLE (0 : 1 : 1)
    |10/28/2013|03:47:02.094|Set Variable %_RESULT% to 0
    |10/28/2013|03:47:02.094|@SETVARIABLE (0 : 1 : 1)
    |10/28/2013|03:47:02.094|Set Variable %_ERRORCODE% to 0
    |10/28/2013|03:47:02.094|@DISPLAYMESSAGE Result: 0\nErrorcode: 0 :
    |10/28/2013|03:47:02.917|Set Variable %_SB_RETURN% to 1
    |10/28/2013|03:47:02.917|RunScriptEnd
    |10/28/2013|03:47:02.917|InitScriptBeforeScriptClose
    |10/28/2013|03:47:02.917|InitScriptEnd

    As far as I can see (I have checked the source code), the "Call DLL..."
    function does not make use of any "environment option".

    Friedrich
    Attached Images Attached Images    

  3. #3

    Default Re: Call DLL sets WinLastError to 203

    Friedrich,

    I believe, what your write, but as this simple script is correct and a
    delphi program returns 0 where a SetupBuilder program returns 203, it is
    a bug in setupbuilder and we have to fix this.

    I'm sure you have further ideas (extended loggin, debug message boxes,
    additional getlasterrorchecks at different points, etc.)

    Thanks for your help.

    Markus

  4. #4

    Default Re: Call DLL sets WinLastError to 203

    Markus,

    Unfortunately, I don't have any further idea.

    The installer does not make use of environment options. Only in the "Expand
    Environment Variable" script function calls the "ExpandEnvironmentStrings"
    API. And the "Get Registry" functions to handle "REG_EXPAND_SZ" types.

    Friedrich

  5. #5

    Default Re: Call DLL sets WinLastError to 203

    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.

    Markus

  6. #6

    Default Re: Call DLL sets WinLastError to 203

    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

  7. #7

    Default Re: Call DLL sets WinLastError to 203

    Just for fun: what happens when you "reset" the last error code.

    Call DLL "kernel32" -- Function "SetLastError" (long) (0)
    Call DLL "kernel32" -- Function "GetLastError" () ()

    Does the 2nd "Call DLL" function still return ERROR_ENVVAR_NOT_FOUND?

    Friedrich

  8. #8

    Default Re: Call DLL sets WinLastError to 203

    Yes:

    |10/28/2013|13:29:08.172|RunScriptBegin
    |10/28/2013|13:29:08.172|Global: Start
    |10/28/2013|13:29:08.172|Set Variable %_SB_DISKSPACEREQ% to 0
    |10/28/2013|13:29:08.172|Set Variable {IDEPLOY_CLI} to IDEPLOY.CLI
    |10/28/2013|13:29:08.172|sbkernel: 8.1.4210 : WinID: 1024 : HTTP_Timeout : 0
    |10/28/2013|13:29:08.172|Global: End
    |10/28/2013|13:29:08.172|@CALLDLL kernel32.dll : SetLastError
    |10/28/2013|13:29:08.172|Set Variable %_SB_RETURN% to 0
    |10/28/2013|13:29:08.172|@CALLDLL kernel32.dll : GetLastError
    |10/28/2013|13:29:08.172|Set Variable %_SB_RETURN% to 203
    |10/28/2013|13:29:08.172|RunScriptEnd
    |10/28/2013|13:29:08.172|InitScriptBeforeScriptClose
    |10/28/2013|13:29:08.172|InitScriptEnd

    Project attached:
    http://www.lindersoft.com/projects/Y...ect_Name_4.zip

    Markus Zander

  9. #9

    Default Re: Call DLL sets WinLastError to 203

    Compiled your project and launched the test.exe on Windows 7. Environment
    variables removed to the minimum -- Path, PSModulePath, TEMP, TMP, etc.
    removed. Executed from an Admin account and a Standard User account.
    GetLastError always returned 0 :-(

    Friedrich
    Attached Images Attached Images  

  10. #10

    Default Re: Call DLL sets WinLastError to 203

    Marcus,

    I have added the SetLastError(0) API to the runtime (just before the "Call
    DLL" function is executed) to clear the last error code.

    This is your test project compiled with the modified runtime:

    http://www.lindersoft.com/projects/t...terrorsetA.zip

    Does this change anything?

    Friedrich

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •