title: How to redistribute a software that contains 32 bit DLLs and 64 bit DLLs at the same time?
body: <p>I am working on <strong>NPcap</strong>, an open-source Windows packet capturing software originated from famous WinPcap and enhanced with more functionalities.</p>
  
  <p>WinPcap's core files are <strong>wpcap.dll, packet.dll (in System32 and SysWOW64) and the driver named npf.sys</strong>. slightly different with WinPcap, our NPcap will provide <strong>npcap.dll, wpcap.dll, packet.dll and the driver npcap.sys</strong>. npcap.dll is our NPcap's "wpcap.dll", npcap.sys is our NPcap's "npf.sys". wpcap.dll is a wrapper we added to keep compatible with original WinPcap.</p>
  
  <ol>
  <li><p>As we want NPcap to coexist with WinPcap, so we decide to install npcap.dll, wpcap.dll, packet.dll into the software installation path <strong>"C:\Program Files\NPcap"</strong> instead of System32 and SysWOW64 path.</p></li>
  <li><p>We <strong>don't want to change the file names of wpcap.dll</strong> and so on, because we want WinPcap's user software can use NPcap's DLLs automatically when WinPcap is not available in the system. As Windows finds DLLs by name.</p></li>
  <li><p>NPcap wants to support both 32 bit and 64 bit user software (like Wireshark and Nmap) at the same time in a 64 bit Windows. So 32 bit Nmap can use its 32 bit wpcap.dll and 64 bit Wireshark can use its 64 bit wpcap.dll.</p></li>
  </ol>
  
  <p>Here I encountered a problem: Our user software include nmap and Wireshark, they can be 32 bit or 64 bit. 32 bit software will only use the 32 bit DLLs and the same for 64 bit. If we put the wpcap.dll of NPcap into our installation path like "C:\Program Files\NPcap" and add this string to PATH environment variable, <strong>We can't add the 32 bit wpcap.dll and 64 bit wpcap.dll both in "C:\Program Files\NPcap", because they share the same name.</strong> We want to keep the "wpcap.dll" name as we need to keep compatible with original WinPcap. <strong>So we can't copy the "wpcap.dll" to System32 and SysWOW64 because WinPcap's wpcap.dll is already there</strong>. <strong>There is also problem that we put 32 bit DLLs and 64 bit DLLs in separated directories.</strong> If we put the DLLs into "C:\Program Files\NPcap\x86" and "C:\Program Files\NPcap\x64" separately. We still need to put these two paths into system PATH environment variable for other softwares to invoke. And there will be an order for these two DLL paths. The latter path will be overrided by the former one, as the Windows loader searches DLLs by their file names.</p>
  
  <p>Is there a way not to copy the DLLs into the System32 and SysWOW64 path and resolve the 32 bit and 64 bit DLLs resolving problem at the same time?</p>