Figuring out the Subst magic

So, I’ve got a problem and I’m hoping someone out there can help. I live on the command-line all day, and to make life easier, I use subst quite a bit. Generally for stuff like this: subst p: c:\somepath
What I’d like to be able to do is reverse the subst mapping from within c# code. That is, if I have the directory p:\foo\bar, I’d like to be able to figure out that it’s really c:\somepath\foo\bar\ I need to do this because I have to tell some server-based processes where to look for diferrent things and those server processes don’t know anything about my subst setup (nor should they). Apparently ProcessExplorer and Handle over on the SysInternals site do this, so it is possible at some level.

Anyone have any ideas?