FGenericPlatformProcess::ComputerName returns "GenericComputer"

As stated in the subject,

FGenericPlatformProcess::ComputerName() returns “GenericComputer”

instead of the actual computer name my machine has …

any ideas?

1 Like

I face the exact same issue here :confused: No way to get my actual machine name…

Oh, never mind : it turned out that I have to use another platform-related function to get it. With Windows, it works with this :

FString ComputerName;
TCHAR nameBuf[MAX_COMPUTERNAME_LENGTH + 2];
unsigned long nameBufSize;

if (GetComputerName(nameBuf, &nameBufSize))
{
	ComputerName = nameBuf;
}
1 Like

I realise that this is a bit of a necro - however just so anyone in the future, like me, needs a proper, UE4, platform-generic solution to this.

###MESSAGE TO PEOPLE OF THE FUTURE:
Don’t call FGenericPlatformProcess directly. Instead call FPlatformProcess.

 FPlatformProcess::ComputerName()

FPlatformProcess is typedeffed to the correct platform process for your platform:

typedef FWindowsPlatformProcess FPlatformProcess;

FGenericPlatformProcess however looks like this:

const TCHAR* FGenericPlatformProcess::ComputerName()
{
	return TEXT("GenericComputer");
}
2 Likes

Good necro is good. This should be marked as answered.

thanks mate !