Go Back   Winamp Forums > Developer Center > NSIS Discussion

Reply
Thread Tools Search this Thread Display Modes
Old 30th August 2004, 23:04   #1
Gurleen
Junior Member
 
Join Date: Aug 2004
Posts: 26
System::Call is not working with Win98

I have a custom Dll, that I use with System::Call . It works fine with 2000 , 2003 and XP , but it does not work with win98. Is it a problem with my Dll or with System:Call compatability with win98.

Eg:

System::Call 'InstLibrary::isValidProductKey(t r1)i .r2'
IntCmp $2 1 validKey
MessageBox MB_OK|MB_ICONSTOP "Key Not valid!!!"
Gurleen is offline   Reply With Quote
Old 31st August 2004, 04:41   #2
KrYpT
Junior Member
 
Join Date: Aug 2003
Posts: 26
System::Call should work on Win98, AFAIK. What exactly is going wrong? (I think you can pop an error message from the stack if System::Call fails.) Also maybe check your search path; I know the different operating systems use different search paths, and that may stop it from finding your DLL.
KrYpT is offline   Reply With Quote
Old 31st August 2004, 13:50   #3
Joel
Debian user
(Forum King)
 
Joel's Avatar
 
Join Date: Jan 2003
Location: Arch land
Posts: 4,896
What's r1? Maybe some attachment I can try it in my old Win98?


* PC: Intel Core 2 DUO E6550 @ 2.33 GHz with 2 GB RAM: Archlinux w/ xfce4.
* Laptop: Intel Core 2 DUO T6600 @ 2.20 GHz with 4 GB RAM: Debian unstable w/ xfce4.
Joel is offline   Reply With Quote
Old 31st August 2004, 14:15   #4
Gurleen
Junior Member
 
Join Date: Aug 2004
Posts: 26
I copy the dll to a temp directory. The I set the SetOutPath to that location so that system::call can see my dll
Gurleen is offline   Reply With Quote
Old 31st August 2004, 14:21   #5
Gurleen
Junior Member
 
Join Date: Aug 2004
Posts: 26
r1 is a string . It's a product key . I use a function in the dll to check if it's a valid key . The problem is not with the function as I tried caling several other function in the dll and none gets called.
Gurleen is offline   Reply With Quote
Old 31st August 2004, 14:35   #6
Gurleen
Junior Member
 
Join Date: Aug 2004
Posts: 26
The odd thing is that there is no error also . It skips the iferrors statement and dies on IntCmp statement. The output from the MessageBox MB_OK|MB_ICONSTOP " Output: $2"
is " Output: error" . Hope this may shed some light on the problem.


clearerrors
; check if the product key is valid
System::Call 'InstLibrary::isValidProductKey(t r1) i .r2'
MessageBox MB_OK|MB_ICONSTOP " Output: $2"
iferrors 0 moveNextInst
MessageBox MB_OK|MB_ICONSTOP " Error in System Call:"
quit
moveNextInst:
IntCmp $2 1 validKey
MessageBox MB_OK|MB_ICONSTOP "Key Not valid!!!"
Quit
Gurleen is offline   Reply With Quote
Old 31st August 2004, 14:52   #7
Joel
Debian user
(Forum King)
 
Joel's Avatar
 
Join Date: Jan 2003
Location: Arch land
Posts: 4,896
Sorry... same :/

From this view, I don't see problems with your last post code.... I'm still confised about r1, can you post how r1 become string?


* PC: Intel Core 2 DUO E6550 @ 2.33 GHz with 2 GB RAM: Archlinux w/ xfce4.
* Laptop: Intel Core 2 DUO T6600 @ 2.20 GHz with 4 GB RAM: Debian unstable w/ xfce4.
Joel is offline   Reply With Quote
Old 31st August 2004, 14:53   #8
zimsms
Senior Member
 
zimsms's Avatar
 
Join Date: Jan 2004
Location: London, Ontario, Canada
Posts: 272
Sounds like a "no unicode support" error. Try installing unicows.dll (The win9x unicode support library) onto your 95/98/ME, NT4 box, then try again.

Those platforms listed above don't support unicode fully, and if your dll calls any unicode function, or was compiled with unicode support on a box that supports unicode, your dll may not function on these OSes.
zimsms is offline   Reply With Quote
Old 31st August 2004, 15:19   #9
Gurleen
Junior Member
 
Join Date: Aug 2004
Posts: 26
For Lobo Lunar -

Now you cans ee where the value is coming from. It's a custom Page that asks for a username and a password. But that should have no effect on the outcome of the system:call

*******************************************************
Push ${TEMP1}
InstallOptions::dialog $PLUGINSDIR\CustomDialog.ini
Pop ${TEMP1}
StrCmp ${TEMP1} "success" 0 continue
; get the values of the Name and Product key
ReadINIStr $0 "$PLUGINSDIR\CustomDialog.ini" "Field 1" "State"

ReadINIStr $1 "$PLUGINSDIR\CustomDialog.ini" "Field 3" "State"

strcmp $debugMode "Yes" 0 +2
MessageBox MB_OK|MB_ICONSTOP " $\nName: $0 $\nKEY: $1"
clearerrors
; check if the product key is valid
System::Call 'InstLibrary::isValidProductKey(t r1) i .r2'
MessageBox MB_OK|MB_ICONSTOP " Output: $2"
iferrors 0 moveNextInst
MessageBox MB_OK|MB_ICONSTOP " Error in System Call:"
quit
moveNextInst:
IntCmp $2 1 validKey
MessageBox MB_OK|MB_ICONSTOP "Key Not valid!!!"
Quit
validKey:
Strcpy $UserName $0
StrCpy $Key $1
*******************************************************
Gurleen is offline   Reply With Quote
Old 31st August 2004, 15:56   #10
KrYpT
Junior Member
 
Join Date: Aug 2003
Posts: 26
I have no idea why this would work on any OS, but is your dll function _stdcall or _cdecl?
KrYpT is offline   Reply With Quote
Old 31st August 2004, 16:10   #11
Gurleen
Junior Member
 
Join Date: Aug 2004
Posts: 26
I use stdcall for my functions . This is what I use.

extern "C" int __stdcall isValidProductKeyNSIS( const char *productKey )
Gurleen is offline   Reply With Quote
Old 31st August 2004, 16:20   #12
KrYpT
Junior Member
 
Join Date: Aug 2003
Posts: 26
Is there any difference between isValidProductKey and isValidProductKeyNSIS? (and shouldn't that declaration have included a __declspec(dllexport)?)
KrYpT is offline   Reply With Quote
Old 31st August 2004, 17:51   #13
Joel
Debian user
(Forum King)
 
Joel's Avatar
 
Join Date: Jan 2003
Location: Arch land
Posts: 4,896
Try from this:
code:

System::Call 'InstLibrary::isValidProductKey(t r1) i .r2'


To this:
code:

System::Call 'InstLibrary::isValidProductKey(t "$1") i .r2'



/edit: Forgot the "'s


* PC: Intel Core 2 DUO E6550 @ 2.33 GHz with 2 GB RAM: Archlinux w/ xfce4.
* Laptop: Intel Core 2 DUO T6600 @ 2.20 GHz with 4 GB RAM: Debian unstable w/ xfce4.
Joel is offline   Reply With Quote
Old 31st August 2004, 18:24   #14
Gurleen
Junior Member
 
Join Date: Aug 2004
Posts: 26
-Is there any difference between isValidProductKey and isValidProductKeyNSIS? (and shouldn't that declaration have included a __declspec(dllexport)?)

Well I use a .def file for exporting the functions, the function name was just a misspell in the previous post , sorry about that
*****************************************************

"Lobo Lunar"
System::Call 'InstLibrary::isValidProductKey(t "$1") i .r2'

Well what did you wanted me to do with the "'s .Also the coe that I am using works fine with ME,2000, XP So i think there is nothing wrong with the syntax. It's just that maybe my installer cannot locate the dll.
Gurleen is offline   Reply With Quote
Old 31st August 2004, 18:36   #15
Joel
Debian user
(Forum King)
 
Joel's Avatar
 
Join Date: Jan 2003
Location: Arch land
Posts: 4,896
Quote:
Well what did you wanted me to do with the "'s
Nowhere :/

Is just my personal not that I forgot to include the ".
If the path is the problem, then you should try use the InitpluginsDir


* PC: Intel Core 2 DUO E6550 @ 2.33 GHz with 2 GB RAM: Archlinux w/ xfce4.
* Laptop: Intel Core 2 DUO T6600 @ 2.20 GHz with 4 GB RAM: Debian unstable w/ xfce4.
Joel is offline   Reply With Quote
Old 31st August 2004, 18:46   #16
Gurleen
Junior Member
 
Join Date: Aug 2004
Posts: 26
I do use the InitpluginsDir
Gurleen is offline   Reply With Quote
Old 31st August 2004, 18:58   #17
Joel
Debian user
(Forum King)
 
Joel's Avatar
 
Join Date: Jan 2003
Location: Arch land
Posts: 4,896
Then... I rest my case.... :/


* PC: Intel Core 2 DUO E6550 @ 2.33 GHz with 2 GB RAM: Archlinux w/ xfce4.
* Laptop: Intel Core 2 DUO T6600 @ 2.20 GHz with 4 GB RAM: Debian unstable w/ xfce4.
Joel is offline   Reply With Quote
Old 31st August 2004, 19:06   #18
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,337
If $2 is "error" after the call, System.dll couldn't find or load the DLL or the address of the requested function.

I suggest you try loading the DLL using a call to kernel32::LoadLibrary with the ?e flag and see what you get.

It's probably a missing import.

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 31st August 2004, 19:34   #19
Gurleen
Junior Member
 
Join Date: Aug 2004
Posts: 26
Can you tell me the full command name. Also where is the manual for system dll ( like the info on return values etc)
This looks like a good lead.
Gurleen is offline   Reply With Quote
Old 31st August 2004, 19:38   #20
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,337
Which command name? LoadLibrary? That's already the full name.

The documentation is, as always, in Contrib\<Plug-in name>. In this case, Contrib\System\System.txt or System.html if you're using the latest CVS version.

You should also take a look at:

http://forums.winamp.com/showthread....+documentation

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 31st August 2004, 19:43   #21
Gurleen
Junior Member
 
Join Date: Aug 2004
Posts: 26
So I need to load the dll first with kernel32::LoadLibrary
and then call system::call
Gurleen is offline   Reply With Quote
Old 31st August 2004, 19:47   #22
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,337
No. You should use LoadLibrary and the ?e flag to see if you get any error. If you get an error, you know something went wrong with loading the DLL and you also have the error code.

It's a test, not a solution.

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 31st August 2004, 20:03   #23
Gurleen
Junior Member
 
Join Date: Aug 2004
Posts: 26
You mean something like this

System::Call 'kernel32::LoadLibrary(t "${INSTALLERDLL}\ApplianzInstallerLibrary.dll" ) v ?e'
and then pop the stack
Gurleen is offline   Reply With Quote
Old 31st August 2004, 20:07   #24
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,337
Yes. But I'd get the return value too, just to make sure you get all the details.

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 31st August 2004, 20:18   #25
Gurleen
Junior Member
 
Join Date: Aug 2004
Posts: 26
What is the function prototype for Kernel::LoadDll
Does it return a int or a pointer to an Int.

System::Call 'kernel32::LoadLibrary(t "${INSTALLERDLL}\ApplianzInstallerLibrary.dll" ) i .r4 ? e'

OR

System::Call 'kernel32::LoadLibrary(t "${INSTALLERDLL}\ApplianzInstallerLibrary.dll" ) !i .r4 ?e'
Gurleen is offline   Reply With Quote
Old 31st August 2004, 20:23   #26
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,337
It returns HMODULE which you should treat as an integer.

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 31st August 2004, 20:33   #27
Gurleen
Junior Member
 
Join Date: Aug 2004
Posts: 26
When I pop the variable I get the result 1157 . The return value is 0.

System::Call 'kernel32::LoadLibrary(t "${INSTALLERDLL}\ApplianzInstallerLibrary.dll" ) i .r4 ? e'
POP $5
MessageBox MB_OK|MB_ICONSTOP "Library Loadinjg Message: $5 , return value : $4"
Gurleen is offline   Reply With Quote
Old 31st August 2004, 20:43   #28
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,337
From WinError.h:

#define ERROR_DLL_NOT_FOUND 1157L

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 31st August 2004, 21:14   #29
Gurleen
Junior Member
 
Join Date: Aug 2004
Posts: 26
So how do I get system:: to see my dll . I have tried putting it in system folder , system32 , windows . What can it be ?
I am dining the temp dir as :

!define INSTALLERDLL "$TEMP\eInspect"

The I copy the dll with these commands

SetOutPath ${INSTALLERDLL}
File C:\ApplianzDevWorkingFolder\Client\ApplianzInstallerLibrary\Debug\ApplianzInstallerLibrary.dll

SetOutPath ${INSTALLERDLL}
System::Call 'ApplianzInstallerLibrary::isValidProductKeyNSIS(t r1) i .r2'
Gurleen is offline   Reply With Quote
Old 31st August 2004, 21:22   #30
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,337
Hmm... Lets skip this method, seems not so reliable. Go to Start->Run and type:

regsvr32 "C:\ApplianzDevWorkingFolder\Client\ApplianzInstallerLibrary\Debug\ApplianzInstal
lerLibrary.dll"

What does the error message say?

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 31st August 2004, 21:29   #31
Gurleen
Junior Member
 
Join Date: Aug 2004
Posts: 26
Well I am attching the screenshot of what I got after running the command.
Attached Images
File Type: gif screenshot1.gif (64.1 KB, 116 views)
Gurleen is offline   Reply With Quote
Old 31st August 2004, 21:33   #32
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,337
That looks like XP. Didn't you say your problem is on Windows 98?

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 31st August 2004, 21:38   #33
Gurleen
Junior Member
 
Join Date: Aug 2004
Posts: 26
Sorry for that. I did not realise I was running the command on Xp . Well when I ran that on win98 it said "Bdd Command" . Does that mean that I am missing some basic libraries on 98 .
Gurleen is offline   Reply With Quote
Old 31st August 2004, 21:41   #34
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,337
No, it probably means the path is not set right. Anyway, lets just skip the testing part and assume it is a missing import. Use Dependency Walker on the DLL (from Windows 98) and see what it's missing.

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 31st August 2004, 21:44   #35
Gurleen
Junior Member
 
Join Date: Aug 2004
Posts: 26
Well I did run it. It gave the following error
Attached Images
File Type: jpg errorshot.jpg (8.9 KB, 80 views)
Gurleen is offline   Reply With Quote
Old 31st August 2004, 21:47   #36
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,337
Taken from:

http://support.microsoft.com/default...b;en-us;249873

Quote:
LoadLibrary("Dllname") failed. GetlastError returns 0x00000485

From Winerror.h, 0x00000485 = 1157 (ERROR_DLL_NOT_FOUND), which means "One of the library files needed to run this application cannot be found." For example, typing regsvr32 missing.dll returns this error message if the Missing.dll file is not found.
So it really is a missing import. Use Dependecy Walker to find out which one it is.

[edit] hmm... misread that... seems like it can't find the DLL. Assuming the DLL is really located in C:\, I'd still say it's a missing import.

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 31st August 2004, 21:48   #37
KrYpT
Junior Member
 
Join Date: Aug 2003
Posts: 26
My two bits: Why are you tring to use the debug version of the DLL? Maybe switching to a release version would help.
KrYpT is offline   Reply With Quote
Old 31st August 2004, 21:53   #38
Gurleen
Junior Member
 
Join Date: Aug 2004
Posts: 26
I ran the Depends and it says I am missing msi.dll
Gurleen is offline   Reply With Quote
Old 31st August 2004, 21:56   #39
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,337
Then you must require the user to install MSI, or, the more reasonable solution, remove that dependency as it makes no sense. You're already using NSIS, why would you need MSI?

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 31st August 2004, 22:03   #40
Gurleen
Junior Member
 
Join Date: Aug 2004
Posts: 26
Talking Thanks Man .. It Worked

Well in the end it required MSI.dll . But why would it require MSI.dll . I just created a dll using VS6.0 .
But in the end it worked.. Thats what matters. Thanks a lot for helping me out. Now I can sleep tonight. Thanks to all of you who gave their input and special thanks to "kichik" for meking it work.
Gurleen is offline   Reply With Quote
Reply
Go Back   Winamp 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