GetLastError()返回值0说明成功了 看下传进的参数对不对 lpBuffer Pointer to a buffer that receives a null-terminated string containing the computer name. The buffer size should be large enough to contain MAX_COMPUTERNAME_LENGTH + 1 characters. nSize Pointer to a DWORD variable. On input, the variable specifies the size, in bytes or characters, of the buffer. On output, the variable returns the number of bytes or characters copied to the destination buffer, not including the terminating null character. If the buffer is too small, the function fails, GetLastError returns ERROR_BUFFER_OVERRUN, and the variable returns the required buffer size including the terminating null character.
看下传进的参数对不对
lpBuffer
Pointer to a buffer that receives a null-terminated string containing the computer name. The buffer size should be large enough to contain MAX_COMPUTERNAME_LENGTH + 1 characters.
nSize
Pointer to a DWORD variable. On input, the variable specifies the size, in bytes or characters, of the buffer. On output, the variable returns the number of bytes or characters copied to the destination buffer, not including the terminating null character.
If the buffer is too small, the function fails, GetLastError returns ERROR_BUFFER_OVERRUN, and the variable returns the required buffer size including the terminating null character.