The MSDN: http://msdn.microsoft.com/en-us/library/aa364980(VS.85).aspx states that GetLongPathNameW returns the length of the string required to hold the pathname if the buffer is too small to hold the path. In the case where the buffer is too small, the filename should not be stored in the buffer.
This ensures that the buffer is not written to (for UNC pathnames) if the buffer is not large enought to store the path.
Kind regards Alexandre