- NSIS Discussion
- System::Call Locking up
Archive: System::Call Locking up
turtlehand
22nd March 2005 22:15 UTC
System::Call Locking up
This simple script locks up at the first DetailPrint 'Return: "$2"'. This occurs on my W2K machine at work, it works fine on my W2K and XP Pro machines at home.
The System::Call works, the correct path is displayed in the Title Bar of the window, but the window becomes unresponsive. No error message. If I comment out System::Call the script works, though it doesn't do anything.
Script:
SetPluginUnload alwaysoff
OutFile 'C:\Downloads\NSIS\Plugin.exe'
Section main
InitPluginsDir
SetOutPath "$PLUGINSDIR"
File 'C:\Program Files\Palm\CondMgr.dll' ; copy dll there
StrCpy $1 ${NSIS_MAX_STRLEN} ; assign memory to $0
System::Call 'CondMgr::CmGetCorePath(t, *i) i(.r0, r1r1).r2'
DetailPrint 'Return: "$2"'
DetailPrint 'Path: "$0"'
; last plugin call must not have /NOUNLOAD so NSIS will be able to delete
; the temporary DLL
SetPluginUnload manual
; do nothing (but let the installer unload the System dll)
System::Free 0
SectionEnd
Any help appreciated.
Afrow UK
22nd March 2005 22:45 UTC
Wouldn't you have to register the dll first with RegDLL?
-Stu
turtlehand
23rd March 2005 13:59 UTC
No, this isn't a COM dll.
Afrow UK
23rd March 2005 17:48 UTC
Well, I'm not sure how dll calls work in general, but how would the System plugin know where CondMgr is?
-Stu
turtlehand
23rd March 2005 17:51 UTC
SetOutPath "$PLUGINSDIR"
The system call succeeds, the correct path is displayed in the title bar of the installer window. The install hangs after that point though.
kichik
24th March 2005 15:25 UTC
Try the u option to unload the DLL after it's called. For example:
System::Call 'CondMgr::CmGetCorePath(t, *i) i(.r0, r1r1).r2?u'
turtlehand
24th March 2005 16:19 UTC
Thanks for the response, but no joy :igor:. Tried the ?u with the same result.
kichik
24th March 2005 16:25 UTC
According to this page, CmGetCorePath expects a pointer to a buffer in the first parameter. You give it just a buffer. Try using *t instead of just t.
turtlehand
24th March 2005 17:39 UTC
Thanks for the suggestion. I've now tried both t which returns an empty string and *t which returns the correct path. In either case the install locks up after making the System::Call and tries DetailPrint. The t appears to be correct per the NSIS Help: t - text, string (LPCSTR, pointer to first character).
kichik
25th March 2005 11:27 UTC
t is not enough because the function expects a pointer to a pointer to the first char, not a pointer to the first char.
If it still hangs, it's time to get the debugger into action and find exactly where it hangs.
turtlehand
25th March 2005 14:07 UTC
I'm using HM NIS Edit, all I have found is the NSIS Help suggesting DetailPrint and MessageBox, DumpState and writing to a log file. Is there something better than these?
kichik
25th March 2005 14:15 UTC
I am not talking about a NSIS debugger. The script is fine, there is no need to debug it. It most probably hangs on the System::Free call. You need a debugger such as windbg to see what really happens deeper than the script.
turtlehand
25th March 2005 16:17 UTC
Then I need debug symbols for System plugin and CondMgr. Do debug symbols exist for the System plugin?
kichik
25th March 2005 16:30 UTC
You'll have to compile the System plug-in yourself to get the symbols. The source code is available in Contrib\System\Source. If you don't have VC, you can compile it using the free Visual C++ Toolkit 2003:
cl /nologo /O1 /W3 /DSYSTEM_EXPORTS /c Buffers.c /FoBuffers.obj
cl /nologo /O1 /W3 /DSYSTEM_EXPORTS /c Plugin.c /FoPlugin.obj
cl /nologo /O1 /W3 /DSYSTEM_EXPORTS /c System.c /FoSystem.obj
link /nologo /opt:nowin98 /entry:_DllMainCRTStartup /dll /out:System.dll kernel32.lib user32.lib ole32.lib Buffers.obj Plugin.obj System.obj
If you're getting errors about CLSIDFromString and another function, add:
#include <objbase.h>
to the top of System.c.