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

To detect of MSI engine version


4 replies to this topic

Irina

Irina
  • Members
  • 227 posts

Posted 15 August 2002 - 14:18

Hi all,
How can I detect an MSI engine version without checking msiexec.exe (msi.dll) file version and don't use the MSIVersion property in the project. I would check an MSI version prior an execution of the remote(silent) installation to make sure it is higher then v1.0. I have to do that by VB code. Do the registry keys have any information about MSI engine?
Thanks a lot,
Irina Shirinsky
Software Engineer, Heroix Corporation
http://www.heroix.com

hambone

hambone
  • Members
  • 206 posts

Posted 15 August 2002 - 15:48

i know you don't wish to but in vb i would use the GetVers code from microsoft to determine the version of the msi.dll file.  in an msi i would use MSIGetFileVersion.

it is also possible to set the minimum msi version requirement in a package and have the package upgrade the msi if required, or refuse to install if the minimum requirement is not met.  using wise windows installer editor this can be accomplished by going to the Target System are and selecting System Requirements.  from here you set the "Windows Installer Runtime Version" to the desired engine.  in orca i believe the same thing can be accomplished from the Edit Summary Information window and setting the Schema to 110, 120, etc for version 1.1, 1.2,....  the edit summary information window can be accessed from the View->Summary Information... pull-down menu option.

Irina

Irina
  • Members
  • 227 posts

Posted 15 August 2002 - 16:57

Hi,
I can't do this in the installation project, because I need to determine the MSI version for the allowing the installation. If this version is less then 1.1 our product doesn't allow to apply a remote installation. I know it is possible to check file versions by C Windows API function, but our product interface was written on VB, and as far as I know VB has only FileDataTime routine in FileSystem object.
So the registry key will be good.
Anywhere could you please tell me where I can get the GetVers code?
Irina Shirinsky
Software Engineer, Heroix Corporation
http://www.heroix.com

hambone

hambone
  • Members
  • 206 posts

Posted 15 August 2002 - 18:06

i know the kb article is Q167597

This is the source code for the GetVer program ( sorry not vb source but will dig thru old system and try to re-post ):

     void reportError()
    {
        LPVOID lpMsgBuf;

         FormatMessage(
            FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
            NULL,
            GetLastError(),
            MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
            (LPTSTR) &lpMsgBuf,
            0,
            NULL );

         cout << (char*)lpMsgBuf << "\n";

         // Free the buffer.
        LocalFree( lpMsgBuf );
    }

     void main( int argc, char *argv[ ], char *envp[ ] )
    {
        cout << "\n";

         if(2 != argc)
        {
            cout << "Syntax: GetVer <File Name>\n";
            return;
        }

         DWORD dwArg;
        DWORD dwInfoSize = GetFileVersionInfoSize(argv[1], &dwArg;);

         if(0 == dwInfoSize)
        {
            cout << "No version info available\n";
            reportError();
            return;
        }

         BYTE* lpBuff = new BYTE[dwInfoSize];

         if(!lpBuff)
        {
            cout << "Out of Memory\n";
            return;
        }

         if(0 == GetFileVersionInfo(argv[1], 0, dwInfoSize, lpBuff))
        {
            cout << "Error retrieving version info\n";
            reportError();
            return;
        }

         VS_FIXEDFILEINFO *vInfo;

         UINT uInfoSize;

         if(0 == VerQueryValue(lpBuff, TEXT("\\"),
                (LPVOID*)&vInfo,
                &uInfoSize))
        {
            cout << "Version information not available\n";
            delete lpBuff;
            return;
        }

         if(0 == uInfoSize)
        {
            cout << "Version information not available\n";
            delete lpBuff;
            return;
        }

         cout << argv[1]
            << " Version: "
            << HIWORD(vInfo->dwFileVersionMS) << ","
            << LOWORD(vInfo->dwFileVersionMS) << ","
            << HIWORD(vInfo->dwFileVersionLS) << ","
            << LOWORD(vInfo->dwFileVersionLS) << "\n";

         delete lpBuff;
    }

Irina

Irina
  • Members
  • 227 posts

Posted 15 August 2002 - 18:26

Thanks a lot
Irina Shirinsky
Software Engineer, Heroix Corporation
http://www.heroix.com