Old 22nd March 2005, 21:15   #1
turtlehand
Junior Member
 
Join Date: Mar 2005
Posts: 7
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.
turtlehand is offline   Reply With Quote
Old 22nd March 2005, 21:45   #2
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
Wouldn't you have to register the dll first with RegDLL?

-Stu
Afrow UK is offline   Reply With Quote
Old 23rd March 2005, 12:59   #3
turtlehand
Junior Member
 
Join Date: Mar 2005
Posts: 7
No, this isn't a COM dll.
turtlehand is offline   Reply With Quote
Old 23rd March 2005, 16:48   #4
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
Well, I'm not sure how dll calls work in general, but how would the System plugin know where CondMgr is?

-Stu
Afrow UK is offline   Reply With Quote
Old 23rd March 2005, 16:51   #5
turtlehand
Junior Member
 
Join Date: Mar 2005
Posts: 7
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.
turtlehand is offline   Reply With Quote
Old 24th March 2005, 14:25   #6
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
Try the u option to unload the DLL after it's called. For example:
code:
System::Call 'CondMgr::CmGetCorePath(t, *i) i(.r0, r1r1).r2?u'

NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
Old 24th March 2005, 15:19   #7
turtlehand
Junior Member
 
Join Date: Mar 2005
Posts: 7
Thanks for the response, but no joy . Tried the ?u with the same result.
turtlehand is offline   Reply With Quote
Old 24th March 2005, 15:25   #8
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
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.

NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
Old 24th March 2005, 16:39   #9
turtlehand
Junior Member
 
Join Date: Mar 2005
Posts: 7
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).
turtlehand is offline   Reply With Quote
Old 25th March 2005, 10:27   #10
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
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.

NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
Old 25th March 2005, 13:07   #11
turtlehand
Junior Member
 
Join Date: Mar 2005
Posts: 7
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?
turtlehand is offline   Reply With Quote
Old 25th March 2005, 13:15   #12
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
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.

NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
Old 25th March 2005, 15:17   #13
turtlehand
Junior Member
 
Join Date: Mar 2005
Posts: 7
Then I need debug symbols for System plugin and CondMgr. Do debug symbols exist for the System plugin?
turtlehand is offline   Reply With Quote
Old 25th March 2005, 15:30   #14
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
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:
Quote:
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:
code:
#include <objbase.h>
to the top of System.c.

NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump