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!!!"
System::Call is not working with Win98
40 posts
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.
What's r1? Maybe some attachment I can try it in my old Win98?
I copy the dll to a temp directory. The I set the SetOutPath to that location so that system::call can see my dll
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.
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
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
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?
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?
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.
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.
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
*******************************************************
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
*******************************************************
I have no idea why this would work on any OS, but is your dll function _stdcall or _cdecl?
I use stdcall for my functions . This is what I use.
extern "C" int __stdcall isValidProductKeyNSIS( const char *productKey )
extern "C" int __stdcall isValidProductKeyNSIS( const char *productKey )
Is there any difference between isValidProductKey and isValidProductKeyNSIS? (and shouldn't that declaration have included a __declspec(dllexport)?)
Try from this:
To this:
System::Call 'InstLibrary::isValidProductKey(t r1) i .r2'
/edit: Forgot the "'s
System::Call 'InstLibrary::isValidProductKey(t "$1") i .r2'
-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.
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.
Well what did you wanted me to do with the "'sNowhere :/
Is just my personal not that I forgot to include the ".
If the path is the problem, then you should try use the InitpluginsDir
I do use the InitpluginsDir
Then... I rest my case.... :/
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.
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.
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.
This looks like a good lead.
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:
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:
So I need to load the dll first with kernel32::LoadLibrary
and then call system::call
and then call system::call
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.
It's a test, not a solution.
You mean something like this
System::Call 'kernel32::LoadLibrary(t "${INSTALLERDLL}\ApplianzInstallerLibrary.dll" ) v ?e'
and then pop the stack
System::Call 'kernel32::LoadLibrary(t "${INSTALLERDLL}\ApplianzInstallerLibrary.dll" ) v ?e'
and then pop the stack
Yes. But I'd get the return value too, just to make sure you get all the details.
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'
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'
It returns HMODULE which you should treat as an integer.
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"
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"
From WinError.h:
#define ERROR_DLL_NOT_FOUND 1157L
#define ERROR_DLL_NOT_FOUND 1157L
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'
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'
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?
regsvr32 "C:\ApplianzDevWorkingFolder\Client\ApplianzInstallerLibrary\Debug\ApplianzInstal
lerLibrary.dll"
What does the error message say?