Jump to content


This is a ready-only archive of the InstallSite Forum. You cannot post any new content here. / Dies ist ein Archiv des InstallSite Forums. Hier können keine neuen Beiträge veröffentlicht werden.
Photo

Calling a dll function


1 reply to this topic

Leigh Ravenhall

Leigh Ravenhall
  • Members
  • 269 posts

Posted 03 January 2002 - 04:01

I'm trying to call the SearchPath function contained within the kernel32 library of functions, calling it directly from a custom action, instead of calling it from a script.

What I've got at the moment:
Type:  131232 (Call a function in a standard dll, in the path of the destination machine)

Function name:  SearchPathA
Arguments:  (Type, source, Value)
STRING, inProperty, NULLSTRING
STRING, inProperty, SEARCHFILE
STRING, inProperty, EXTENSION
NUMBER, inProperty, BUFFERSIZE
STRING, outProperty, FILEPATH
POINTER, outProperty, FILENAME

The return type is a number, the return property is RETURNVALUE.

The source is set to Kernel32.dll

The SearchPath function has the following prototype:
DWORD SearchPath (
   LPCTSTR lpPath,
   LPCTSTR lpFileName,
   LPCTSTR lpExtension,
   DWORD nBufferLength,
   LPTSTR lpBuffer,
   LPTSTR *lpFilePart
)

I think I'm passing in all the right details.  After running the custom action, the return value is 0 (function failed), the filepath is blank and the filename pointer is 0.  To get error information, I need to call GetLastError, which I can't do as part of the custom action.

Does anybody have any suggestions?  Is this call possible?


Stefan Krueger

Stefan Krueger

    InstallSite.org

  • Administrators
  • 13,269 posts

Posted 03 January 2002 - 20:36

Maybe use a constant in the first parameter, and be sure to set the BUFFERSIZE property to a reasonable number before the function call.
You could try to debug the API call (if you have a debuggíng version of Windows) useing the method described in this article:
http://www.installsi...buggingIPWI.htm