Not sure where and why the domain name comes into play but the SIDtoName() function should translate the SID based on current domain and trusts. From there a simple LDAP query should get you the path.