FREE Subscription to Dr. Dobb’s Digest: Same Great Content, New Digital Edition
Site Archive (Complete)
Dobbs M-Dev
Email
Print
Reprint

add to:
Del.icio.us
Digg
Google
Furl
Slashdot
Y! MyWeb
Blink
March 01, 2001

Customizing Windows Installer

(Page 6 of 24)
March 2001/Customizing Windows Installer/Listing 3

Listing 3: cadll.cpp — Finding shared files

#include "stdafx.h"

#include <stdio.h>

#include <MsiQuery.h>





BOOL APIENTRY DllMain( HANDLE hModule, 

                       DWORD  ul_reason_for_call, 

                       LPVOID lpReserved

                     )

{

    switch (ul_reason_for_call )

    {

     case DLL_PROCESS_ATTACH:

            break;

     case DLL_PROCESS_DETACH:



            break;

    }

    return TRUE;

}





UINT __stdcall FindShared(MSIHANDLE hInstall)

        

{

    

    HKEY hk;



    long res = RegOpenKeyEx (HKEY_LOCAL_MACHINE, 

        "Software\\MyCompany\\MyProduct\\MyFiles", 

        0, KEY_READ, &hk); 

    

    DWORD inx;

    char thevalue [MAX_PATH] = {0};

    DWORD buflen; 

    DWORD type;

    for (inx=0; 1; inx++ )

    {

    buflen = sizeof(thevalue);

    long regres = RegEnumValue(hk, inx, thevalue, 

        &buflen, NULL, &type, NULL, NULL);

    if (ERROR_SUCCESS==regres)

        {

            _strlwr (thevalue);

            char* pf = strstr (thevalue, "another.exe");

            if (pf!=NULL)

            {

                MsiSetProperty(hInstall, "FOUNDANOTHER", thevalue);

                break;

            }



        }

    else

        break;

    }





    RegCloseKey (hk);



    return 0;



}





//End of File

Previous Page | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 Next Page
TOP 5 ARTICLES
No Top Articles.



MICROSITES
FEATURED TOPIC

ADDITIONAL TOPICS

INFO-LINK