jrsoftware.org // Jordan Russell's Software


-Inno Setup







visitors since
Jan. 1998

Inno Setup Knowledge Base
Return to index

HOWTO: Deploy shfolder.dll

Article Created: 2003-10-13 23:38 GMT by Jordan Russell
Last Updated: 2003-11-04 08:41 GMT by Jordan Russell

Why deploy shfolder.dll?

If your application uses the SHGetFolderPath function, shfolder.dll must be present on your users' systems. This DLL comes with Internet Explorer 5 and later. If you do not wish to create a dependency on Internet Explorer 5, you may install shfolder.dll separately during your installation. (Note: Internet Explorer 5 comes standard with Windows starting with Windows 98 Second Edition.)

How to deploy shfolder.dll

  1. Download shfinst.exe.
  2. Run shfinst.exe; it will extract a file named ShFolder.exe.
  3. Add these lines to your script:
    Source: "ShFolder.exe"; DestDir: "{tmp}"
      { The shfolder.dll file we're deploying is version 5.50.4027.300 }
      OurShFolderVersionMS = (5 shl 16) or 50;
      OurShFolderVersionLS = (4027 shl 16) or 300;
    function ShouldInstallShFolderDLL: Boolean;
      MS, LS: Cardinal;
      { Only install if shfolder.dll doesn't already exist or it's an earlier version.
        These checks aren't really needed, but prevent unnecessary reboots on Windows 95
        when the correct version of shfolder.dll is already installed. }
      if not GetVersionNumbers(ExpandConstant('{sys}\shfolder.dll'), MS, LS) then
        Result := True
      if (OurShFolderVersionMS > MS) or
         ((OurShFolderVersionMS = MS) and (OurShFolderVersionLS > LS)) then
        Result := True
        Result := False;
    Filename: "{tmp}\ShFolder.exe"; Parameters: "/r:n /q:1"; Check: ShouldInstallShFolderDLL; OnlyBelowVersion: 0,5.0
    (Note: The OnlyBelowVersion parameter prevents installation on Windows 2000 and later, where System File Protection doesn't allow the file to be replaced.)

Site contents Copyright © 1997-2020 Jordan Russell. All rights reserved.
Portions Copyright © 2000-2020 Martijn Laan. All rights reserved.