title: GetComputerName() works on win7 but fails on xp
body: <p>I am trying to use GetComputerName() to retrieve the box's name. The code works great on windows 7, however, when i test on windows xp the code does not work (result is UNKNOWN). Any idea why?</p>
  
  <pre><code>int GetBoxName(BoxInfo &amp;box_info)
  {
      int Ret;    
      DWORD dwLen;
      const char* szUnk = "UNKNOWN\0";
  
      // Get the size of the box name then allocate memory.
      Ret = GetComputerName(NULL, &amp;dwLen);
      box_info.BoxName = new char[dwLen]; 
  
      // Attempt to retrieve the box name.
      if((Ret = GetComputerName(box_info.BoxName, &amp;dwLen) == 0))
      {       
          delete[] box_info.BoxName;
          box_info.BoxName = new char[strlen(szUnk)];
          box_info.BoxName = (char*)szUnk;
          return 1;       
      }   
  
      return 0;
  }
  </code></pre>