belowaverage-org / SuperGrate

💾 Get moving with Super Grate; a free & open source Windows Profile Migration & Backup Utility. Super Grate is a GUI (Graphical User Interface) that assists Microsoft's USMT (User State Migration Utility) in performing remote migrations over a network connection.
https://belowaverage.org/software/supergrate
GNU General Public License v3.0
194 stars 23 forks source link

Incorrect architecture detection. #45

Closed Didrole closed 4 years ago

Didrole commented 4 years ago

Describe the bug The function Misc::GetRemoteArch uses WMI's Win32_OperatingSystem class to detect computer's architecture. Unfortunately the OSArchitecture property can be localized (https://docs.microsoft.com/en-us/windows/win32/cimwin32prov/win32-operatingsystem), leading to unexpected values being returned.

To Reproduce Run SuperGrate on a localized version of Windows (I've tested on a French installation of Windows Server 2008 R2). Select some accounts, click on start. Watch the migration fails (it won't be able to find USMT path due to unhandled architecture string, ie: USMT::USMTPath returns null).

Expected behavior Account migration starting.

Logs

Reading OS Architecture...
OS Architecture is: 64 bits.
Uploading USMT to: Server1
Could not find the USMT folder at: .
Downloading USMT (64 bits) from the web...
Removing USMT folder due to failure...
La valeur ne peut pas être null.
Nom du paramètre : path
Error uploading USMT to: Server1
Reading OS Architecture...
OS Architecture is: 64 bits.
Uploading USMT to: Server2
Could not find the USMT folder at: .
Downloading USMT (64 bits) from the web...
Removing USMT folder due to failure...
La valeur ne peut pas être null.
Nom du paramètre : path
Error uploading USMT to: Server2
Done.

Edit : USMT won't work on Windows Server anyway but the bug is still valid.

krisdb2009 commented 4 years ago

Thanks for the report. I will do some research and find an alternative way to get the remote-host's OS architecture.

krisdb2009 commented 4 years ago

I did some research on what other methods there is to getting the OS architecture remotely via different WMI classes, or registries. I noticed there was a way to get the processor architecture, but that was not going to risk Super Grate not detecting the right architecture if someone installed a 32 bit version of windows on a 64 bit processor. So I am sticking with the WMI class OperatingSystem and Property OSArchitecture. What I ended up doing in the commit 0e0f82d28762ce7934f6ed7388c0961dae67565a was just doing a String.Contains("64") on the string returned from WMI. Hopefully, other Windows languages contain the number 64 in their localized version of the OSArchitecture property.

krisdb2009 commented 4 years ago

Here is a build of this commit if you would like to test it out on the french version of windows server.

https://belowaverage.visualstudio.com/SuperGrate/_build/results?buildId=97&view=results

Click here to download the build:

image