Skip to content
⌘ NSIS Forum Archive

How to handle/debug setup Errors?

26 posts

bankeris#

How to handle/debug setup Errors?

Is there any way to debug and extract full error information and what caused it?

I've got error which is same as yesterday(i was posting here in forum) but now it's on simple Excel file. The location on which NSIS setup must place a file "darbas.xls" on mapped driver which is on Linux Server. First of all i though "damn permissions", but i was wrong, all permissions are maxed, user can copy, paste, modify, create, delete files in folder. I've tried my self on same PC manually all these functions and it worked fine I've tried to manually copy same "darbas.xls" and replace and its OK. Oh and by the way its Windows7 SP1. On another PC which is Windows XP SP3 with same User permissions on same location setup nicely completes and replaces file..

Here is an Error:
"error opening file for writing darbas.xls"

XPStyle on
RequestExecutionLevel admin

Section "kiti" SEC03
SetDetailsPrint textonly
DetailPrint "Įrašomi programos bazės failai..."
SetDetailsPrint listonly
SetOutPath "$INSTDIR_BAZE"
SetOverwrite on
File "..\..\baz2003\darbas.xls"

Past days i feel unlucky with NSIS but I'm looking forward to solve all coming problems.

p.s As always sry for my English.
Anders#
Originally Posted by bankeris View Post
ty, for fast reply.

you mean Microsoft Process Monitor v3.05?
Yes
bankeris#
Ok, so i downloaded "Microsoft Process Monitor v3.05" and tryed to search some clues and find some solution.. i found the place where it fails but i don't understand it. maybe someone can help? 🙁

Here is LogFile: http://speedyshare.com/Wyy46/Logfile.xlsb
Here is Error message: http://s11.postimg.org/3mg2nrd4z/Untitled.png
Error message is in Lithuania language, in english it will be: "Error opening file for writing T:\ASTERA\DataVilma\201310_Valstybes rekom. medziagos.lnt"

In the LogFile.xlsb error starts from: 32740 row as i assume.

In installation I've got such rows:


XPStyle on
RequestExecutionLevel admin
...
SetOutPath "$INSTDIR_DATA"
SetOverwrite on
File "..\..\SamExpert\SamEXPERT\data\201310_Valstybes rekom. medziagos.lnt"
The User can manually delete, read, modify, rename.. T:\ASTERA\DataVilma\201310_Valstybes rekom. medziagos.lnt file. Only Setup fails to overwrite.
zedzedbeta5#
If Silent I use DebugView (http://technet.microsoft.com/en-us/s.../bb896647.aspx)

!define DEBUG `System::Call kernel32::OutputDebugString(ts)`

${DEBUG} "out"
bankeris#
Thank you for respond.

Anders I have saved Logs.txt and uploaded. Logs from the point where setup started to fail its starts from 8 row (i've used notepad++). Till 7 row it's all ok. After error message pop-up i pressed several times "retry".

zedzedbeta5:

!define DEBUG `System::Call kernel32::OutputDebugString(ts)`
${DEBUG} "out"
i should write this in to my setup project .nsi and after use DebugView v4.81 on setup?

Can you a bit explain what does it do?
Anders#
I don't see any access to 201310... in that log.

Can you do:
MessageBox mb_ok start
SetOutPath "$INSTDIR_DATA"
SetOverwrite on
File "..\..\SamExpert\SamEXPERT\data\201310_Valstybes rekom. medziagos.lnt"
MessageBox mb_ok stop
and export in the PML format?
bankeris#
here you are. I've noticed too that there is no string of file on which setup gives error.. hope this new file will help you to see my problem.
Anders#
Without the call to CreateFile for the file with the problem it is hard to tell what's going on...
zedzedbeta5#
Originally Posted by bankeris View Post
Can you a bit explain what does it do?
It's a helper to OutputDebugString. See here: http://msdn.microsoft.com/en-us/libr...(v=vs.85).aspx
Anders#
Originally Posted by zedzedbeta5 View Post
It's a helper to OutputDebugString. See here: http://msdn.microsoft.com/en-us/libr...(v=vs.85).aspx
How is this going to help?

You could try calling kernel32::CreateFile with the system plugin and use the ?e parameter to get the GetLastError value and even if you do that you can probably just display it with MessageBox, no need to use OutputDebugString for one string...
bankeris#
Can you give some example?

I have found in forum how to create .txt file:

FileOpen $0 '$INSTDIR_DATA\file_name.txt' w
FileWrite $0 'a_line_of_text$\r$\n'
FileWrite $0 'more_line_of_text$\r$\n'
FileClose $0
but i did not get any error, and file did not created in directory.. but again i've made Right Click on mouse ->> New ->> Text Document ->> file_name.txt ->> OK

I'm kind new here and I'm very low in scripting with methods "kernel..", can you help me a bit? I have found in NSIS forum some clues..

I wrote:

!define OPEN_EXISTING 3
!define CREATE_NEW 1
!define CREATE_ALWAYS 2

!define FILE_ATTRIBUTES_NORMAL 128
!define GENERIC_WRITE 0x40000000
!define GENERIC_READ 0x80000000

ClearErrors
System::Call "kernel32::CreateFile(t '$INSTDIR_DATA\aaa.txt', ${GENERIC_READ},i 0, i 0, i ${OPEN_EXISTING}, i ${FILE_ATTRIBUTES_NORMAL}, i 0) i .r0 ?e"
MessageBox mb_ok $0
MessageBox mb_ok $0 returning -1
but it's not creating file in any location.. I'm sure, I'm missing something here, just don't know how to use properly.
Anders#
-1 means CreateFile failed and your system call syntax is not 100% correct either.

!define GENERIC_WRITE 0x40000000
!define CREATE_ALWAYS 2
StrCpy $0 "$temp\testing.txt"
System::Call 'kernel32::CreateFile(t "$0",i ${GENERIC_WRITE},i 0,i 0,i ${CREATE_ALWAYS},i 0, i 0)i.r0?e'
Pop $1
MessageBox mb_ok "Handle=$0 GetLastError=$1"
System::Call 'kernel32::CloseHandle(i$0)'
bankeris#edited
Ok i found it:

ERROR_PATH_NOT_FOUND
3 (0x3)
The system cannot find the path specified.
I made some testings and got interesting results... If location is mapped like "T:\.." and i try to install in that place something, i got same error code. But if i change mapped driver to original location "\\Server_name\.." there is no error left.. hmz.

So maybe it's NSIS bug?

And next my question is maybe i can get real path from Mapped driver name?

Updated:
I found: http://nsis.sourceforge.net/Get_Universal_Name

Push $INSTDIR_DATA
Call get_universal_name
Pop $0 ; = "\\servername\sharename\path\file"
StrCpy $1 $INSTDIR_DATA
MessageBox mb_ok "Handle=$0 Mapped=$1"
System::Call 'kernel32::CloseHandle(i$0)'
But it returned me: "T:\..\", I've added picture. Any help would be awesome!
Anders#
Is your installer elevated (UAC)? Mapped drives do not survive elevation.

If you add a directory page, is T: mapped correctly when you click the browse button?
zedzedbeta5#
@Anders. I use DebugView more often than Message Boxes to display errors/sentinels/etc. It's just my preference / opinion and is what personally helps me.
Anders#
Originally Posted by zedzedbeta5 View Post
@Anders. I use DebugView more often than Message Boxes to display errors/sentinels/etc. It's just my preference / opinion and is what personally helps me.
That's fine but when you suggested it bankeris had no string to print so your suggestion was only confusing things...
bankeris#edited
ty for reply,

Yes it goes though UAC, I've added Untitled.png. The strange thing i made by right click and found no options to map that drive.. and i could not map all server.. it's in Untitled1.png. In Untitled2.png the same paths as before.

I went to check to another PC, which is Windows XP Pro and has the same path but the user said he don't get any errors, I've added Untitiled3.png. As you can see he got right full path, only mapped drive disk is V:\. And by the way on XP there was no UAC.

I did not understood Anders your last sentence: 'If you add a directory page, is T: mapped correctly when you click the browse button?' Can you tell in different way or explain step by step?

Any suggestions more? :s

Updated:

I've tried even this method: Open Explorer -> go to files on mapped driver -> Hold Shift Key and then Right Click on file -> Copy As Path -> Ctrl + V = "T:\ASTERA\DataVilma\V6_1_9.xlsx" :| which is still mapped location..
JasonFriday13#
Originally Posted by bankeris View Post
I did not understood Anders your last sentence: 'If you add a directory page, is T: mapped correctly when you click the browse button?' Can you tell in different way or explain step by step?
Like this:
Name "mapped drive test"
OutFile "mapped drive test.exe"

InstallDir "T:\"

Page Directory
Page InstFiles

Section
SectionEnd
Run it and click the browse button. Also the install button should be clickable if the path is valid.
bankeris#
Name "mapped drive test"
OutFile "bandymas.exe"
InstallDir "T:\ASTERA\DataVilma\"
Page Directory
Page InstFiles
Section
SectionEnd
So then i first time run my setup had Button Install not active. that means Path was not valid? I accidentally overwrote first picture, but i made correction how it was first time with red mark [Untitiled.png]. When I'm trying again to run i always can press Install.. and disk space is shown. So after i pressed Browse i went My Network place -> \\Elmodasrv\ -> Public -> Samatininkai -> ASTERA -> DataVilma and then we have a picture: Untitled1.png.

So after these steps when ever i launch setup i got Untitled2.png.
bankeris#
After i made my last steps by 'JasonFriday13', I've noticed that my setup goes smoothly - like a miracle happened. I told my client to restart PC.
After PC restart it was bad again. So i started same steps from 'JasonFriday13'. The result in pictures:
Pirmas.png - you can see my Install button is disabled.
Antras.png - here is the interesting part, On left side you can see that mapped driver "Samatininkai" is connected, but in NSIS browse it's showing not-connected right? its small red "x". And in reverse mapped "Z:\" showing connected on NSIS browse, but on left side windows showing not-connected... So after i browse through server full path it starting to work, even with mapped location: - trecias.png. And it works till client restart PC.

So this is a tricky thing i found, any solutions?
Anders#

http://blogs.msdn.com/b/cjacks/archi...ows-vista.aspx
bankeris#
Thank you for your help. I'm very glad thats it's not NSIS bug or problem.

I'm not strong with understanding how works UAC even i read those 3 articles, i know this is not the place for asking, but maybe someone can give me a hint what should i make to get my setup work properly? I have to lower UAC notify level, or should i go to other place and do something there?

Anyway big thanks to Anders for your effort.