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.
System::Call Locking up
14 posts
Wouldn't you have to register the dll first with RegDLL?
-Stu
-Stu
No, this isn't a COM dll.
Well, I'm not sure how dll calls work in general, but how would the System plugin know where CondMgr is?
-Stu
-Stu
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.
The system call succeeds, the correct path is displayed in the title bar of the installer window. The install hangs after that point though.
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'
Thanks for the response, but no joy 🧟. Tried the ?u with the same result.
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.
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).
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.
If it still hangs, it's time to get the debugger into action and find exactly where it hangs.
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?
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.
Then I need debug symbols for System plugin and CondMgr. Do debug symbols exist for the System plugin?
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.objIf you're getting errors about CLSIDFromString and another function, add:
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
to the top of System.c.#include <objbase.h>