Error: “The procedure entry point UnmapAndCloseFile could not be located in the dynamic link library SETUPAPI.dll” when attempting to run RIPrep.exe on Windows XP or Windows Server 2003

System Requirements:

  • Windows XP Professional, SP2, SP3
  • Windows Server 2003 SP1, SP2

The Problem:

When you attempt to run the Remote Installation Service (RIS) image preparation tool (RiPrep.exe) on a Windows XP or Windows Server 2003 system with the latest service pack you receive the following error message.

riprep.exe – Entry Point Not Found
The procedure entry point UnmapAndCloseFile could not be located in the dynamic link library SETUPAPI.dll

Error: "The procedure entry point UnmapAndCloseFile could not be located in the dynamic link library SETUPAPI.dll"

This error is generated despite having the latest build of RIPrep.exe from Windows 2000 Server SP4 – 5.0.2195.6685 at the time of writing. If you do not have this build of RIPrep you should obtain the current version from Service Pack 4 and update your RIS host to SP4 before continuing.

More Information:

Microsoft’s XP SP2 secure code initiative and several years worth of code development has seen some fundamental changes in the standard setup api used on XP and Server 2003 systems. The problem is caused quite obviously by the lack of the entry point UnmapAndCloseFile in the setupapi.dll.

The Fix

Very simply, you need to give riprep.exe access to a version of the dll with that entry point.

  1. Go to your Windows 2000 Remote Installation Server (ensure that it is SP4)
  2. Navigate to %SystemRoot%\System32
  3. Copy the file setupapi.dll into the <RISPath>\Admin\i386 folder
    e.g. E:\RemoteInstall\Admin\i386
  4. setupapi.dll from Windows 2000 SP4 (version 5.0.2195.6622 as of writing) will now be next to the riprep.exe
    SetupAPI.dll version info
  5. When you run RIPrep from the \\<server>\REMINST\Admin\i386 folder, the version of setupapi.dll in this folder will be used as a higher precedent to the version in the Windows XP or Windows Server 2003 %SystemRoot%\System32 folder, and RIPrep will be able to load correctly.