How to tell if binary is x86 or amd64?

First get dumpbin tool, ships with any Windows SDK. Run dumpbin /headers on the binary, then look at the magic number. This is an amd64 binary:   c:\>dumpbin /headers c:\amd64\msvcr100.dll | findstr magic              20B magic # (PE32+) This is a 32-bit binary:   c:\DPMedusa1>dumpbin /headers c:\x86\msvcr100.dll | findstr magic              10B magic # (PE32)…



Just a note to self, when typing in TrustedInstaller into security dialogs in Vista/Windows 2008, be sure to prefix with:     NT SERVICE\TrustedInstaller C:\Windows>icacls c:\windows\winsxs c:\windows\winsxs                   NT SERVICE\TrustedInstaller:(OI)(CI)(F)                   BUILTIN\Administrators:(OI)(CI)(RX)                   NT AUTHORITY\SYSTEM:(OI)(CI)(RX)                   BUILTIN\Users:(OI)(CI)(RX)   The security UI dialogs do not recognize TrustedInstaller just by itself (don’t know why).


What is mscorwks_ntdef.dll?

Ok, file this one under debugger trivia.  If you are debugging a 32-bit CLR process from a 64-bit native (Windbg) debugger, you will notice:   0:040> lmvm mscorwks_ntdef start             end                 module name 00000000`69480000 00000000`69a10000   mscorwks_ntdef   (deferred)                 Image path: mscorwks_ntdef.dll     Image name: mscorwks_ntdef.dll     Timestamp:        Fri Jul 25 06:58:48 2008 (4889DC18)     CheckSum:         00597CC4…


How To Read Data From AD LDS Into Java

Just helping out the next person, this code took me all day to cobble together. Key tricky part was how to connect to AD using an NT security account from Java.   public static String ReadBindingInfoFromAd() throws NamingException { Hashtable env = new Hashtable(); env.put(Context.INITIAL_CONTEXT_FACTORY, “com.sun.jndi.ldap.LdapCtxFactory”); env.put(Context.PROVIDER_URL, “LDAP://MyLdapServer:389”); env.put(Context.SECURITY_AUTHENTICATION, “DIGEST-MD5”); // Use DIGEST-MD5, it works…


Chicken + Egg Problem With Hyper-V

When we neglect to port an old and crusty feature, one will always wave a few hands and say it’s better in the end for the customer.  But sometimes it becomes a sticking point.  Today I am trying to setup VMs using Hyper-V on Windows 2008 and by default Hyper-V does not allow mouse to…


SqlClient Timeouts Revealed

Just some notes from recent discussions internal and external of how timeouts work with SqlClient.  First a classification of where timeouts can occur with SqlClient: When attempting to get a connection from the SqlClient connection pool When attempting to create a new fresh connection to server (not getting one from pool) When sending a command…


Why Can’t I Log Into SQL Server?

Even though I’ve been working on the SQL Server protocol layer for the past 3 years I still have those days where I scratch my head because I cannot connect to my SQL Server.   I have to agree it can be frustrating sometimes.  Usually, once you get it working, it stays working, which is a…


Sharing IE Links With Live Mesh

In case you have not heard the buzz, we have this new thing called Live Mesh that is pretty awesome.  I found out about it whist trying to figure out how to share my Links (c:\users\…\Favorites\Links) folders across multiple machines.  I talked to one of my IE buds and he indicated Live Mesh might be…


Finding Locals In CLR

Today I’m looking at a few Watson dumps trying to determine why SqlConnection is failing to connect to SQL Server and hanging. I see stack like below: 0:000> k 0021dc5c 79f40778 kernel32!SleepEx+0x62 0021dc90 7a0561d7 mscorwks!EESleepEx+0xa3 0021dc9c 7a12fc71 mscorwks!CExecutionEngine::ClrSleepEx+0xd 0021dcac 7a0e4d7c mscorwks!ClrSleepEx+0x13 0021dce8 7a082a5f mscorwks!Thread::UserSleep+0x63 0021dd88 652e94cd mscorwks!ThreadNative::Sleep+0xce 0021ddc8 652e9283 System_Data_ni!System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover 0021de20 652e83ff System_Data_ni!System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist   I…


Connection Pooling, ADO.NET, SPIDs

If you have pooling issues with ADO.NET (leaking connections, pool size exceeded, etc…) one way to slice and dice these with SQL 2005 is to use the SQL 2005 system DMVs.   You can locate leaked connections like so:   select session_id, datediff(s,last_read,getdate()) as SecondsSinceLastRead, datediff(s,last_write,getdate()) as SecondsSinceLastWrite, (select text from sys.dm_exec_sql_text(dec.most_recent_sql_handle)) as LastSqlStatment from…