title: Another JNI UnsatisfiedLinkError DLL problem
body: <p>I've read lots of posts about this, but none address my problem.</p>
  
  <p>I have a very small DLL that allows a Java process to send windows messages.  It simply calls</p>
  
  <pre><code>    FindWindowEx(...)
      SendMessage(...)
  </code></pre>
  
  <p>I have compiled that with VS2005 and linked with /MT and all's fine, but if I try to make my DLL depend on MSVCRT and link with /MD then I get the unsatisfied link error.</p>
  
  <p>java.lang.UnsatisfiedLinkError: MyDll.dll: Can't find dependent libraries</p>
  
  <p>According to depends.exe it has two missing DLLs, GPSVC.DLL and IESHIMS.DLL.  The first exists in c:\windows\system32 and the second is in a winsxs path.  There are LOADS of other DLLs loaded from c:\windows\system32 and GPSVC.DLL is an odd one in that even as admin on my win7x64 machine, I cannot run depends on that - it says it's not found...</p>
  
  <p>Anyway, I tried forcing a load of both of those DLLs in my Java by (simplified - I'm not in control of java.library.path)</p>
  
  <pre><code>    Field field = ClassLoader.class.getDeclaredField("usr_paths");
      field.setAccessible(true);
      String[] paths = (String[]) field.get(null);
      String[] tmp = new String[paths.length + 2];
      System.arraycopy(paths, 0, tmp, 0, paths.length);
      tmp[paths.length] = "c:/windows/system32";
      tmp[paths.length + 1] = "c:/Windows/winsxs/amd64_microsoft-windows-ie-ieshims_31bf3856ad364e35_8.0.7601.17514_none_c06d7c9c27da8591";
      field.set(null, tmp);
  </code></pre>
  
  <p>but that made no difference.  I can fallback to make it statically linked, but I'd rather not.</p>
  
  <p>Any ideas on what I can try next?
  Antony</p>