Strange behavior in WOW64 DLL loading in Windows 2008 R2

That is, if a 32bit DLL was loaded by CreateRemoteThread(), the DLL would be unloaded silently without DLL_PROCESS_DETACH invocation sent to DLLMain() of the DLL. There are indeed 2 weird issues, one is silent unloading, the other is no DLL_PROCESS_DETACH callback.

This occurs on WOW64 environment of Windows 2008 Server R2 only.  Windows 2012 and 2016 don’t have this issue, while x64 environment of 2008 also doesn’t have the issue.

To fix it, we can make the DLL depend on another DLL. The 2nd DLL can receive all notification callbacks of DLLMain(). This way can fix the callback issue. And by adding an extra LoadLibrary() call of 2nd DLL in 1st DLL’s DLL_PROCESS_ATTACH notification, we can keep the 2nd DLL in memory even if 1st DLL unloaded silently.


MacPorts trick for High Sierra taster

If you happen see a lot of port failed to build and error is about clock_gettime or even u_int, it is because some definition are in platform SDK instead /usr/**/*.h

Here is the trick:

Maybe /opt/local/etc/macports.conf is the right place to config it, but I have not found the key yet.