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

JScript and Property


2 replies to this topic

Victor

Victor
  • Members
  • 2 posts

Posted 05 December 2002 - 14:34

Hi!
How to receive the full path to installing application.
I create Custom Action by using JScript.

.js file

var str = Session.Property("TARGETDIR");
//str is empty (str="")
???

hambone

hambone
  • Members
  • 206 posts

Posted 05 December 2002 - 16:42

to my knowledge the TARGETDIR property is used when an ADMIN install is performed ( the /a command-line option is used to create a network install ).  

i believe that the INSTALLDIR might work ?  also ROOTDRIVE has some effect...

Victor

Victor
  • Members
  • 2 posts

Posted 06 December 2002 - 09:15

INSTALLDIR too does not work.
And MsiGetProperty in DLL not work :-(((

#include "windows.h"
#include "msi.h"
#include "msiquery.h"
UINT __stdcall GetInstallDir(MSIHANDLE hInstall)
{
  UINT res = ERROR_SUCCESS;
  TCHAR* szValueBuf = NULL;
   DWORD cchValueBuf = 0;
   UINT uiStat =  MsiGetProperty(hInstall, TEXT("INSTALLDIR"), TEXT(""), &cchValueBuf);
   if (ERROR_MORE_DATA == uiStat)
   {
       ++cchValueBuf; // on output does not include terminating null, so add 1
       szValueBuf = new TCHAR[cchValueBuf];
       if (szValueBuf)
       {
           uiStat = MsiGetProperty(hInstall, TEXT("MyProperty"), szValueBuf, &cchValueBuf);
       }
   }
   if (ERROR_SUCCESS != uiStat)
       res = ERROR_INSTALL_FAILURE;
else
MessageBox(NULL, szValueBuf, NULL, NULL);

   delete [] szValueBuf;

   return res;
}