mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-03-22 06:50:54 +07:00
[platform] restoring previous machine ID detection algorithm (IJ-CR-147524)
(cherry-picked from commit 272156b476949a339bd1878a785ef03e5f6e7fc3) IJ-CR-147524 GitOrigin-RevId: e6a29ce1f58defb40d7d5f91fa506e1d7a741cd2
This commit is contained in:
committed by
intellij-monorepo-bot
parent
b558401b52
commit
f01b1e9813
@@ -40,9 +40,15 @@ object MachineIdManager {
|
||||
}.onFailure { LOG.debug(it) }.getOrNull()
|
||||
}
|
||||
|
||||
/** See [Win32_ComputerSystemProduct](https://learn.microsoft.com/en-us/windows/win32/cimwin32prov/win32-computersystemproduct). */
|
||||
/**
|
||||
* See [MachineGuid](https://learn.microsoft.com/en-us/answers/questions/1489139/identifying-unique-windows-installation),
|
||||
* [Win32_ComputerSystemProduct](https://learn.microsoft.com/en-us/windows/win32/cimwin32prov/win32-computersystemproduct).
|
||||
*/
|
||||
private fun getWindowsMachineId(): String? =
|
||||
runCatching {
|
||||
Advapi32Util.registryGetStringValue(WinReg.HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Cryptography", "MachineGuid")
|
||||
}.recover {
|
||||
LOG.debug(it)
|
||||
Ole32.INSTANCE.CoInitializeEx(null, Ole32.COINIT_APARTMENTTHREADED)
|
||||
WbemcliUtil.WmiQuery("Win32_ComputerSystemProduct", ComputerSystemProductProperty::class.java)
|
||||
.execute(2000)
|
||||
@@ -50,9 +56,6 @@ object MachineIdManager {
|
||||
if (result.resultCount > 0) result.getValue(ComputerSystemProductProperty.UUID, 0).toString()
|
||||
else null
|
||||
}
|
||||
}.recover {
|
||||
LOG.debug(it)
|
||||
Advapi32Util.registryGetStringValue(WinReg.HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Cryptography", "MachineGuid")
|
||||
}.getOrThrow()
|
||||
|
||||
enum class ComputerSystemProductProperty { UUID }
|
||||
|
||||
Reference in New Issue
Block a user