mirror of
				https://github.com/mintty/wsltty.git
				synced 2025-10-30 22:54:03 +00:00 
			
		
		
		
	add rluetzner's patch Get VmId from registry (#356)
This commit is contained in:
		
							
								
								
									
										40
									
								
								0012-get-vmid-from-registry.patch
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										40
									
								
								0012-get-vmid-from-registry.patch
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,40 @@ | |||||||
|  | --- wslbridge2/src/wslbridge2.cpp	2024-10-10 20:20:21.931891800 +0000 | ||||||
|  | +++ wslbridge2-0.12/src/wslbridge2.cpp	2024-10-08 09:31:35.954145800 +0000 | ||||||
|  | @@ -228,6 +228,26 @@ static void start_dummy(std::wstring wsl | ||||||
|  |      CloseHandle(pi.hThread); | ||||||
|  |  } | ||||||
|  |   | ||||||
|  | +bool GetIdFromRegistry(GUID *guid) { | ||||||
|  | +    HKEY hKeyRoot = HKEY_LOCAL_MACHINE; | ||||||
|  | +    std::wstring subKey = L"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\HostComputeService\\VolatileStore\\ComputeSystem"; | ||||||
|  | +    HKEY hKey; | ||||||
|  | +    if (RegOpenKeyEx(hKeyRoot, subKey.c_str(), 0, KEY_READ, &hKey) == ERROR_SUCCESS) { | ||||||
|  | +        DWORD index = 0; | ||||||
|  | +        WCHAR keyName[256]; | ||||||
|  | +        DWORD keyNameSize = sizeof(keyName) / sizeof(keyName[0]); | ||||||
|  | + | ||||||
|  | +        while (RegEnumKeyEx(hKey, index, keyName, &keyNameSize, nullptr, nullptr, nullptr, nullptr) == ERROR_SUCCESS) { | ||||||
|  | +            RegCloseKey(hKey); | ||||||
|  | +            std::wstring id = L"{" + std::wstring(keyName) + L"}"; | ||||||
|  | +            return IIDFromString(id.c_str(), guid) == S_OK; | ||||||
|  | +        } | ||||||
|  | +        RegCloseKey(hKey); | ||||||
|  | +    } | ||||||
|  | +    return false; | ||||||
|  | +} | ||||||
|  | + | ||||||
|  | + | ||||||
|  |  int main(int argc, char *argv[]) | ||||||
|  |  { | ||||||
|  |      /* Minimum requirement Windows 10 build 17763 aka. version 1809 */ | ||||||
|  | @@ -387,8 +407,8 @@ int main(int argc, char *argv[]) | ||||||
|  |          if (LiftedWSLVersion) | ||||||
|  |              start_dummy(wslPath, wslCmdLine, distroName, debugMode); | ||||||
|  |   | ||||||
|  | -        const HRESULT hRes = GetVmId(&DistroId, &VmId, LiftedWSLVersion); | ||||||
|  | -        if (hRes != 0) | ||||||
|  | +        const bool hRes = GetIdFromRegistry(&VmId); | ||||||
|  | +        if (!hRes) | ||||||
|  |              fatal("GetVmId: %s\n", GetErrorMessage(hRes).c_str()); | ||||||
|  |   | ||||||
|  |          inputSock = win_vsock_create(); | ||||||
							
								
								
									
										2
									
								
								makefile
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								makefile
									
									
									
									
									
								
							| @@ -159,6 +159,8 @@ wslbridge-source:	$(wslbridgedir).zip | |||||||
| 	#cd $(wslbridgedir); patch -p1 < ../0001-notify-size-change-inband.patch | 	#cd $(wslbridgedir); patch -p1 < ../0001-notify-size-change-inband.patch | ||||||
| 	# patch to https://github.com/Biswa96/wslbridge2/commit/41575379b416703c49e2687e957440239a4cdfb7 | 	# patch to https://github.com/Biswa96/wslbridge2/commit/41575379b416703c49e2687e957440239a4cdfb7 | ||||||
| 	#cd $(wslbridgedir); patch -p0 < ../0002-add-com-for-lifted-wsl.patch | 	#cd $(wslbridgedir); patch -p0 < ../0002-add-com-for-lifted-wsl.patch | ||||||
|  | 	# patch to fix WSL 2 launching, again | ||||||
|  | 	cd $(wslbridgedir); patch -p1 < ../0012-get-vmid-from-registry.patch | ||||||
|  |  | ||||||
| wslbridge-frontend: | wslbridge-frontend: | ||||||
| 	echo ------------- Compiling wslbridge2 frontend | 	echo ------------- Compiling wslbridge2 frontend | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user