title: GetUserNameEx with NameFullyQualifiedDN doesn't return for 3-4 seconds, why?
body: <p>I have a very weird problem and a question about a possible solution. I need to get a fully qualified distinguished name on a Windows computer from a program written in C++ (using native WinAPIs.) For that I use the following API:</p>
  
  <pre><code>TCHAR buff[256];
  DWORD dwSz = 256;
  GetUserNameEx(NameFullyQualifiedDN, buff, &amp;dwSz);
  </code></pre>
  
  <p>The code above works at no time if I run it from a user-mode process (from a user desktop.) But when I call that API from a system service it does not return for 3-4 seconds! (I should say that the code above may be called on a system that is not a member of an Active Directory domain.)</p>
  
  <p>So my first question is, why would calling it from a service be an issue?</p>
  
  <p>And second question, if I call that API when my service starts and later cache the result in a global variable and later on use it instead, what are the chances that a Distinguished Name changes on that system?</p>