-
Notifications
You must be signed in to change notification settings - Fork 501
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement machine id support for the future. #152
Conversation
public override byte[] GetMachineGuid() | ||
{ | ||
RegistryKey localKey = RegistryKey | ||
.OpenBaseKey( Microsoft.Win32.RegistryHive.LocalMachine, RegistryView.Registry64 ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How does Registry64
behave on 32-bit Windows?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://msdn.microsoft.com/en-us/library/microsoft.win32.registryview%28v=vs.110%29.aspx
"If you request a 64-bit view on a 32-bit operating system, the returned keys will be in the 32-bit view."
OS X notes:
That's going to be a pain to P/Invoke, I doubt Mono has a wrapper for DiskArbitration. |
|
||
public override byte[] GetDiskId() | ||
{ | ||
return Encoding.UTF8.GetBytes( "SteamKit-DiskId" ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that's too generic and it should return null instead. We don't want completely different servers to match as one machineid, do we?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A null hash would have the same result.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't hash it, if it's null?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The hash field needs to be present and populated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well that's no good, I'm not keen on having a generic hash this way.
@@ -161,7 +161,7 @@ public void LogOnAnonymous( uint appId = 0 ) | |||
|
|||
logon.Body.client_os_type = ( uint )Utils.GetOSType(); | |||
logon.Body.game_server_app_id = ( int )appId; | |||
logon.Body.machine_id = MachineIdUtils.GenerateMachineID(); | |||
logon.Body.machine_id = HardwareUtils.GenerateMachineID(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just nethooked steamcmd, and anonymous logins do not have machine_id set. And anonymous logins worked fine last night.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well I just checked normal logins, and they send an empty MessageObject on windows. Someone in steamworks forum was complaining that steamcmd didn't work last night 😆
// this was flipped off shortly after the update rolled out, likely due to linux steamclients running on distros without a way to build a machineid | ||
// so while a valid MO isn't currently (as of aug 25th) required, they could be in the future and we'll abide by The Valve Law now | ||
|
||
var machineId = new MachineID(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this function cache constructed machine id, and just return the cached object on future calls? WMI is slow, and the result isn't going to change between calls.
Okay, we now essentially have 1:1 functionality with how steamclient generates machine ids, along with a few extras:
I believe one last issue is outstanding for Linux: what can we do about getting some disk information for anyone not mounting their root directory by UUID? Perhaps iterate |
On OS X, Valve get the UUID for whichever disk is mounted to If it's not mounted by UUID, there's gotta be another way to get the UUID for that disk. |
// if it turns out to be buggy we can always roll our own and poke into /sys/class/net on nix | ||
|
||
var firstEth = NetworkInterface.GetAllNetworkInterfaces() | ||
.Where( i => i.NetworkInterfaceType == NetworkInterfaceType.Ethernet ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about other network interface types?
On OS X Mono 4.0.1, almost everything is showing as Ethernet
.
On Windows .NET Framework, I'm seeing Ethernet
for wired connections and Wireless80211
for WiFi.
This seems like it could fall back to "SteamKit-MacAddress"
a bit too frequently. What adapters does Steam search for?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and
Wireless80211
for WiFi.
Interesting, the MSDN docs don't state that that's a possible value. I suppose it can't hurt to include wireless adapters as well.
On Windows, Steam is using GetAdaptersInfo
and checks for adapters of type MIB_IF_TYPE_ETHERNET
and MIB_IF_TYPE_OTHER
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IF_TYPE_IEEE80211
71
An IEEE 802.11 wireless network interface.
Note This adapter type is returned on Windows Vista and later. On Windows Server 2003 and Windows XP , an IEEE 802.11 wireless network interface returns an adapter type of MIB_IF_TYPE_ETHERNET.
I wonder when the machine ID code was written.
LGTM 👍 I don't think it should be reasonably able to fall back to the |
Implement machine id support for the future.
Any day that requires code changes to logon to Steam is a spooky day, so here's some work to make sure we don't need any changes in the future when valid machine ids are required for logon.
Things to note:
we currently query for info at logon time. Not ideal, but this is still a WIP./var/lib/dbus/machine-id
, but this may not be present on some systems (and may have been why certain linux steamclients were unable to logon today). Might need to look into alternatives for anybody not using systemd/dbus.Nothing available for OSX. Haven't had much time to dig into the steamclient binary for it, but I'd imagine there aren't many consumers who need SteamKit on OSX.