Use settings string setter to overwrite computername
(cherry picked from commit 4d7cddd7c6
)
This commit is contained in:
parent
8e7760ad98
commit
87f1ed1f2d
@ -244,32 +244,16 @@ static void settings_load_hkey_local_machine(rdpSettings* settings)
|
||||
|
||||
static BOOL settings_get_computer_name(rdpSettings* settings)
|
||||
{
|
||||
DWORD nSize = 0;
|
||||
CHAR* computerName;
|
||||
|
||||
if (GetComputerNameExA(ComputerNameNetBIOS, NULL, &nSize) || GetLastError() != ERROR_MORE_DATA)
|
||||
return FALSE;
|
||||
|
||||
computerName = calloc(nSize, sizeof(CHAR));
|
||||
|
||||
if (!computerName)
|
||||
return FALSE;
|
||||
CHAR computerName[256];
|
||||
DWORD nSize = sizeof(computerName);
|
||||
|
||||
if (!GetComputerNameExA(ComputerNameNetBIOS, computerName, &nSize))
|
||||
{
|
||||
free(computerName);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (nSize > MAX_COMPUTERNAME_LENGTH)
|
||||
computerName[MAX_COMPUTERNAME_LENGTH] = '\0';
|
||||
|
||||
settings->ComputerName = computerName;
|
||||
|
||||
if (!settings->ComputerName)
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
return freerdp_settings_set_string(settings, FreeRDP_ComputerName, computerName);
|
||||
}
|
||||
|
||||
BOOL freerdp_settings_set_default_order_support(rdpSettings* settings)
|
||||
|
Loading…
Reference in New Issue
Block a user