0
votes

I am using the NSIS installer and as part of my setup I need to install the Access Database Engine. This part I have working.

What I can't seem to be able to work out how to do is check if the Access Database Engine (32 or 64 bit) is installed already - I don't know if NSIS can do that? Does anyone know?

The NSIS script for Access Database Engine currently does this:-

${If} ${RunningX64}
        HideWindow
        File "access64.exe"
        ExecWait "$INSTDIR\access64.exe"
        BringToFront
${Else}
        HideWindow
        File "access32.exe"
        ExecWait "$INSTDIR\access32.exe"
        BringToFront
${EndIf}
1
You could use FileExists to check if there is still access32.exe oder access64.exe installed. Or are there registry entries from the access database engine? Then check if there are one. - ikreb

1 Answers

0
votes

NSIS can check for the presence of certain files and/or registry values.

There are many questions about Access detection already on Stackoverflow, you should take a look at those to see which registry keys you should query. Which key to look for really depends on if you care about a specific version or if any version of Access is acceptable.

You can also ask the Windows shell about the Access ProgId:

!include LogicLib.nsh
Section

System::Call 'SHLWAPI::AssocQueryString(i0x00000540,i4,t"Access.Application",p0,t.r1,*i${NSIS_MAX_STRLEN})i.r0'
${If} $0 = 0
    DetailPrint "Registered application friendly name: $1"
${EndIf}
System::Call 'SHLWAPI::AssocQueryString(i0x00000540,i2,t"Access.Application",p0,t.r1,*i${NSIS_MAX_STRLEN})i.r0'
${If} $0 = 0
    DetailPrint "EXE: $1"
    ; Call GetDLLVersion etc. if needed
${EndIf} 

SectionEnd