Changeset 85786 in vbox
- Timestamp:
- Aug 16, 2020 8:05:53 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/configure.vbs
r85785 r85786 222 222 223 223 224 '' 225 ' Gets the SID of the current user. 226 function GetSid() 227 dim objNet, strUser, strDomain, offSlash, objWmiUser 228 GetSid = "" 229 230 ' Figure the user + domain 231 set objNet = CreateObject("WScript.Network") 232 strUser = objNet.UserName 233 strDomain = objNet.UserDomain 234 offSlash = InStr(1, strUser, "\") 235 if offSlash > 0 then 236 strDomain = Left(strUser, offSlash - 1) 237 strUser = Right(strUser, Len(strUser) - offSlash) 238 end if 239 240 ' Lookup the user. 241 on error resume next 242 set objWmiUser = GetObject("winmgmts:{impersonationlevel=impersonate}!/root/cimv2:Win32_UserAccount." _ 243 & "Domain='" & strDomain &"',Name='" & strUser & "'") 244 if err.number = 0 then 245 GetSid = objWmiUser.SID 246 end if 247 end function 248 224 249 225 250 '' 226 251 ' Translates a register root name to a value 227 function RegTransRoot(strRoot) 252 ' This will translate HKCU path to HKEY_USERS and fixing 253 function RegTransRoot(strRoot, ByRef sSubKeyName) 228 254 const HKEY_LOCAL_MACHINE = &H80000002 229 255 const HKEY_CURRENT_USER = &H80000001 256 const HKEY_USERS = &H80000003 257 230 258 select case strRoot 231 259 case "HKLM" 232 260 RegTransRoot = HKEY_LOCAL_MACHINE 261 case "HKUS" 262 RegTransRoot = HKEY_USERS 233 263 case "HKCU" 234 RegTransRoot = HKEY_CURRENT_USER 264 dim strCurrentSid 265 strCurrentSid = GetSid() 266 if strCurrentSid <> "" then 267 sSubKeyName = strCurrentSid & "\" & sSubKeyName 268 RegTransRoot = HKEY_USERS 269 'LogPrint "RegTransRoot: HKCU -> HKEY_USERS + " & sSubKeyName 270 else 271 RegTransRoot = HKEY_CURRENT_USER 272 LogPrint "RegTransRoot: Warning! HKCU -> HKEY_USERS failed!" 273 end if 235 274 case else 236 275 MsgFatal "RegTransRoot: Unknown root: '" & strRoot & "'" … … 282 321 ' Must use ExecMethod to call the GetStringValue method because of the context. 283 322 Set InParms = g_objReg.Methods_("GetStringValue").Inparameters 284 InParms.hDefKey = RegTransRoot(strRoot )323 InParms.hDefKey = RegTransRoot(strRoot, strKey) 285 324 InParms.sSubKeyName = strKey 286 325 InParms.sValueName = strValue … … 288 327 set OutParms = g_objReg.ExecMethod_("GetStringValue", InParms, , g_objRegCtx) 289 328 if OutParms.ReturnValue = 0 then 290 RegGetString = OutParms.sValue 329 if OutParms.sValue <> Null then 330 RegGetString = OutParms.sValue 331 end if 291 332 end if 292 333 else … … 299 340 300 341 '' 342 ' Gets a multi string value from the registry. Returns array of strings if found, otherwise empty array(). 343 function RegGetMultiString(strName) 344 RegGetMultiString = Array() 345 if RegInit() then 346 dim strRoot, strKey, strValue 347 dim iRoot 348 349 ' split up into root, key and value parts. 350 strRoot = left(strName, instr(strName, "\") - 1) 351 strKey = mid(strName, instr(strName, "\") + 1, instrrev(strName, "\") - instr(strName, "\")) 352 strValue = mid(strName, instrrev(strName, "\") + 1) 353 354 ' Must use ExecMethod to call the GetStringValue method because of the context. 355 Set InParms = g_objReg.Methods_("GetMultiStringValue").Inparameters 356 InParms.hDefKey = RegTransRoot(strRoot, strKey) 357 InParms.sSubKeyName = strKey 358 InParms.sValueName = strValue 359 On Error Resume Next 360 set OutParms = g_objReg.ExecMethod_("GetMultiStringValue", InParms, , g_objRegCtx) 361 if OutParms.ReturnValue = 0 then 362 if OutParms.sValue <> Null then 363 RegGetMultiString = OutParms.sValue 364 end if 365 end if 366 else 367 ' fallback mode 368 On Error Resume Next 369 RegGetMultiString = g_objShell.RegRead(strName) 370 end if 371 end function 372 373 374 '' 301 375 ' Returns an array of subkey strings. 302 function RegEnumSubKeys(strRoot, strKeyPath) 303 dim iRoot 304 iRoot = RegTransRoot(strRoot) 376 function RegEnumSubKeys(strRoot, ByVal strKeyPath) 305 377 RegEnumSubKeys = Array() 306 307 378 if RegInit() then 308 379 ' Must use ExecMethod to call the EnumKey method because of the context. 309 380 Set InParms = g_objReg.Methods_("EnumKey").Inparameters 310 InParms.hDefKey = RegTransRoot(strRoot )381 InParms.hDefKey = RegTransRoot(strRoot, strKeyPath) 311 382 InParms.sSubKeyName = strKeyPath 312 383 On Error Resume Next 313 384 set OutParms = g_objReg.ExecMethod_("EnumKey", InParms, , g_objRegCtx) 385 'LogPrint "RegEnumSubKeys(" & Hex(InParms.hDefKey) & "," & InParms.sSubKeyName &") -> " & OutParms.GetText_(1) 314 386 if OutParms.ReturnValue = 0 then 315 RegEnumSubKeys = OutParms.sNames 387 if OutParms.sNames <> Null then 388 RegEnumSubKeys = OutParms.sNames 389 end if 316 390 end if 317 391 else … … 320 394 set objReg = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\default:StdRegProv") 321 395 On Error Resume Next 322 rc = objReg.EnumKey( iRoot, strKeyPath, arrSubKeys)396 rc = objReg.EnumKey(RegTransRoot(strRoot, strKeyPath), strKeyPath, arrSubKeys) 323 397 if rc = 0 then 324 398 RegEnumSubKeys = arrSubKeys … … 351 425 function RegEnumSubKeysFullRSort(strRoot, strKeyPath) 352 426 RegEnumSubKeysFullRSort = ArrayRSortStrings(RegEnumSubKeysFull(strRoot, strKeyPath)) 427 end function 428 429 430 '' 431 ' Returns an array of value name strings. 432 function RegEnumValueNames(strRoot, ByVal strKeyPath) 433 RegEnumValueNames = Array() 434 if RegInit() then 435 ' Must use ExecMethod to call the EnumKey method because of the context. 436 Set InParms = g_objReg.Methods_("EnumValues").Inparameters 437 InParms.hDefKey = RegTransRoot(strRoot, strKeyPath) 438 InParms.sSubKeyName = strKeyPath 439 On Error Resume Next 440 set OutParms = g_objReg.ExecMethod_("EnumValues", InParms, , g_objRegCtx) 441 'LogPrint "RegEnumValueNames(" & Hex(InParms.hDefKey) & "," & InParms.sSubKeyName &") -> " & OutParms.GetText_(1) 442 if OutParms.ReturnValue = 0 then 443 if OutParms.sNames <> Null then 444 RegEnumValueNames = OutParms.sNames 445 end if 446 end if 447 else 448 ' fallback mode 449 dim objReg, rc, arrSubKeys 450 set objReg = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\default:StdRegProv") 451 On Error Resume Next 452 rc = objReg.EnumValues(RegTransRoot(strRoot, strKeyPath), strKeyPath, arrSubKeys) 453 if rc = 0 then 454 RegEnumValueNames = arrSubKeys 455 end if 456 end if 457 end function 458 459 460 '' 461 ' Returns an array of full path value name strings. 462 function RegEnumValueNamesFull(strRoot, strKeyPath) 463 dim arrTmp 464 arrTmp = RegEnumValueNames(strRoot, strKeyPath) 465 for i = LBound(arrTmp) to UBound(arrTmp) 466 arrTmp(i) = strKeyPath & "\" & arrTmp(i) 467 next 468 RegEnumValueNamesFull = arrTmp 353 469 end function 354 470 … … 2007 2123 2008 2124 2009 2010 2125 '' 2011 2126 ' Checks for any Qt5 binaries. 2012 sub CheckForQt(strOptQt5 )2013 dim strPathQt5, arrFolders, arrInfixes, strInfix2127 sub CheckForQt(strOptQt5, strOptInfix) 2128 dim strPathQt5, strInfixQt5, arrFolders, arrVccInfixes, strVccInfix 2014 2129 PrintHdr "Qt5" 2015 2130 … … 2020 2135 strPathQt5 = "" 2021 2136 if strOptQt5 <> "" then 2022 strPathQt5 = CheckForQt5Sub(UnixSlashes(strOptQt5)) 2023 end if 2024 2025 ' Check the dev tools - prefer ones matching the compiler. 2026 if strPathQt5 = "" then 2027 arrFolders = GetSubdirsStartingWithSorted(g_strPathDev & "/win." & g_strTargetArch & "/qt", "v5") 2028 arrInfixes = Array(LCase(g_strVCCVersion), Left(LCase(g_strVCCVersion), Len(g_strVCCVersion) - 1), "") 2029 for each strInfix in arrInfixes 2030 for i = UBound(arrFolders) to LBound(arrFolders) step -1 2031 if strInfix = "" or InStr(1, LCase(arrFolders(i)), strInfix) > 0 then 2032 strPathQt5 = CheckForQt5Sub(g_strPathDev & "/win." & g_strTargetArch & "/qt/" & arrFolders(i)) 2137 strPathQt5 = CheckForQt5Sub(UnixSlashes(strOptQt5), strOptInfix, strInfixQt5) 2138 end if 2139 2140 if strPathQt = "" then 2141 ' 2142 ' Collect links from "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\UFH\SHC" 2143 ' 2144 ' Typical string list: 2145 ' C:\Users\someuser\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Qt\5.x.y\MSVC 20zz (64-bit)\Qt 5.x.y (MSVC 20zz 64-bit).lnk 2146 ' C:\Windows\System32\cmd.exe 2147 ' /A /Q /K E:\qt\installed\5.x.y\msvc20zz_64\bin\qtenv2.bat 2148 ' 2149 dim arrValues, strValue, arrStrings, str, arrCandidates, iCandidates, strCandidate, off 2150 arrValues = RegEnumValueNamesFull("HKCU", "SOFTWARE\Microsoft\Windows\CurrentVersion\UFH\SHC") 2151 redim arrCandidates(UBound(arrValues) - LBound(arrValues) + 1) 2152 iCandidates = 0 2153 for each strValue in arrValues 2154 arrStrings = RegGetMultiString("HKCU\" & strValue) 2155 if UBound(arrStrings) >= 0 and UBound(arrStrings) - LBound(arrStrings) >= 2 then 2156 str = Trim(arrStrings(UBound(arrStrings))) 2157 if LCase(Right(str, Len("\bin\qtenv2.bat"))) = "\bin\qtenv2.bat" _ 2158 and InStr(1, LCase(str), "\msvc20") > 0 _ 2159 and InStr(1, str, ":") > 0 _ 2160 then 2161 off = InStr(1, str, ":") - 1 2162 arrCandidates(iCandidates) = Mid(str, off, Len(str) - off - Len("\bin\qtenv2.bat") + 1) 2163 LogPrint "qt5 candidate #" & iCandidates & "=" & arrCandidates(iCandidates) & " (" & str & ")" 2164 iCandidates = iCandidates + 1 2165 end if 2166 end if 2167 next 2168 redim preserve arrCandidates(iCandidates) 2169 if iCandidates > 0 then arrCandidates = ArrayRSortStrings(arrCandidates) ' Kind of needs version sorting here... 2170 LogPrint "Testing qtenv2.bat links (" & iCandidates & ") ..." 2171 2172 ' VC infixes/subdir names to consider (ASSUMES 64bit) 2173 if g_strVCCVersion = "VCC142" or g_strVCCVersion = "" then 2174 arrVccInfixes = Array("msvc2019_64", "msvc2017_64", "msvc2015_64") 2175 elseif g_strVCCVersion = "VCC141" then 2176 arrVccInfixes = Array("msvc2017_64", "msvc2015_64", "msvc2019_64") 2177 elseif g_strVCCVersion = "VCC140" then 2178 arrVccInfixes = Array("msvc2015_64", "msvc2017_64", "msvc2019_64") 2179 elseif g_strVCCVersion = "VCC120" then 2180 arrVccInfixes = Array("msvc2013_64") 2181 elseif g_strVCCVersion = "VCC110" then 2182 arrVccInfixes = Array("msvc2012_64") 2183 elseif g_strVCCVersion = "VCC100" then 2184 arrVccInfixes = Array("msvc2010_64") 2185 else 2186 MsgFatal "Unexpected VC version: " & g_strVCCVersion 2187 arrVccInfixes = Array() 2188 end if 2189 for each strVccInfix in arrVccInfixes 2190 for each strCandidate in arrCandidates 2191 if InStr(1, LCase(strCandidate), strVccInfix) > 0 then 2192 strPathQt5 = CheckForQt5Sub(strCandidate, strOptInfix, strInfixQt5) 2033 2193 if strPathQt5 <> "" then exit for 2034 2194 end if … … 2038 2198 end if 2039 2199 2040 ' Note! We could scan Computer\HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\UFH\SHC looking for entries 2041 ' executing stuff like C:\qt\5.x.y\msvc2017_64\bin\qtenv2.bat 2042 2043 ' Display the result. 2200 ' Check the dev tools - prefer ones matching the compiler. 2044 2201 if strPathQt5 = "" then 2045 PrintResultMsg "Qt5", "not found" 2046 else 2202 LogPrint "Testing tools dir (" & g_strPathDev & "/win." & g_strTargetArch & "/qt/v5*) ..." 2203 arrFolders = GetSubdirsStartingWithSorted(g_strPathDev & "/win." & g_strTargetArch & "/qt", "v5") 2204 arrVccInfixes = Array(LCase(g_strVCCVersion), Left(LCase(g_strVCCVersion), Len(g_strVCCVersion) - 1), "") 2205 for each strVccInfix in arrVccInfixes 2206 for i = UBound(arrFolders) to LBound(arrFolders) step -1 2207 if strVccInfix = "" or InStr(1, LCase(arrFolders(i)), strVccInfix) > 0 then 2208 strPathQt5 = CheckForQt5Sub(g_strPathDev & "/win." & g_strTargetArch & "/qt/" & arrFolders(i), strOptInfix, strInfixQt5) 2209 if strPathQt5 <> "" then exit for 2210 end if 2211 next 2212 if strPathQt5 <> "" then exit for 2213 next 2214 end if 2215 2216 ' 2217 ' Display the result and output the config. 2218 ' 2219 if strPathQt5 <> "" then 2047 2220 PrintResult "Qt5", strPathQt5 2048 end if 2049 2050 if strPathQt5 <> "" then 2221 PrintResultMsg "Qt5 infix", strInfixQt5 2051 2222 CfgPrint "PATH_SDK_QT5 := " & strPathQt5 2052 2223 CfgPrint "PATH_TOOL_QT5 := $(PATH_SDK_QT5)" 2053 2224 CfgPrint "VBOX_PATH_QT := $(PATH_SDK_QT5)" 2054 end if 2055 if strPathQt5 = "" then 2225 CfgPrint "VBOX_QT_INFIX := " & strInfixQt5 2226 CfgPrint "VBOX_WITH_QT_PAYLOAD := 1" 2227 else 2056 2228 CfgPrint "VBOX_WITH_QTGUI :=" 2057 end if2058 end sub 2059 2229 PrintResultMsg "Qt5", "not found" 2230 end if 2231 end sub 2060 2232 2061 2233 '' 2062 2234 ' Checks if the specified path points to an usable Qt5 library. 2063 function CheckForQt5Sub(strPathQt5 )2235 function CheckForQt5Sub(strPathQt5, strOptInfix, ByRef strInfixQt5) 2064 2236 CheckForQt5Sub = "" 2065 2237 LogPrint "trying: strPathQt5=" & strPathQt5 2066 2238 2067 2239 if LogFileExists(strPathQt5, "bin/moc.exe") _ 2068 And LogFileExists(strPathQt5, "bin/uic.exe") _ 2069 And LogFileExists(strPathQt5, "include/QtWidgets/qwidget.h") _ 2070 And LogFileExists(strPathQt5, "include/QtWidgets/QApplication") _ 2071 And LogFileExists(strPathQt5, "include/QtGui/QImage") _ 2072 And LogFileExists(strPathQt5, "include/QtNetwork/QHostAddress") _ 2073 And ( LogFileExists(strPathQt5, "lib/Qt5Core.lib") _ 2074 Or LogFileExists(strPathQt5, "lib/Qt5CoreVBox.lib")) _ 2075 And ( LogFileExists(strPathQt5, "lib/Qt5Network.lib") _ 2076 Or LogFileExists(strPathQt5, "lib/Qt5NetworkVBox.lib")) _ 2240 and LogFileExists(strPathQt5, "bin/uic.exe") _ 2241 and LogFileExists(strPathQt5, "include/QtWidgets/qwidget.h") _ 2242 and LogFileExists(strPathQt5, "include/QtWidgets/QApplication") _ 2243 and LogFileExists(strPathQt5, "include/QtGui/QImage") _ 2244 and LogFileExists(strPathQt5, "include/QtNetwork/QHostAddress") _ 2245 then 2246 ' Infix testing. 2247 if LogFileExists(strPathQt5, "lib/Qt5Core.lib") _ 2248 and LogFileExists(strPathQt5, "lib/Qt5Network.lib") then 2249 strInfixQt5 = "" 2250 CheckForQt5Sub = UnixSlashes(PathAbs(strPathQt5)) 2251 elseif LogFileExists(strPathQt5, "lib/Qt5Core" & strOptInfix & ".lib") _ 2252 and LogFileExists(strPathQt5, "lib/Qt5Network" & strOptInfix & ".lib") then 2253 strInfixQt5 = strOptInfix 2254 CheckForQt5Sub = UnixSlashes(PathAbs(strPathQt5)) 2255 elseif LogFileExists(strPathQt5, "lib/Qt5CoreVBox.lib") _ 2256 and LogFileExists(strPathQt5, "lib/Qt5NetworkVBox.lib") then 2257 strInfixQt5 = "VBox" 2258 CheckForQt5Sub = UnixSlashes(PathAbs(strPathQt5)) 2259 end if 2260 end if 2261 end function 2262 2263 2264 '' 2265 ' Checks for python. 2266 function CheckForPython(strOptPython) 2267 dim strPathPython, arrVersions, strVer, str 2268 PrintHdr "Python" 2269 CheckForPython = False 2270 2271 ' 2272 ' Locate it. 2273 ' 2274 strPathPython = CheckForPythonSub(strOptPython) 2275 if strPathPython = "" then 2276 arrVersions = Array("3.12", "3.11", "3.10", "3.9", "3.8", "3.7", "3.6", "3.5", "2.7") 2277 for each strVer in arrVersions 2278 strPathPython = CheckForPythonSub(RegGetString("HKLM\SOFTWARE\Python\PythonCore\" & strVer & "\InstallPath\")) 2279 if strPathPython <> "" then exit for 2280 next 2281 end if 2282 if strPathPython = "" then strPathPython = CheckForPythonSub(PathStripFilename(Which("python.exe"))) 2283 2284 ' 2285 ' Output config & result. 2286 ' 2287 CheckForPython = strPathPython <> "" 2288 if CheckForPython then 2289 CfgPrint "VBOX_BLD_PYTHON := " & strPathPython 2290 PrintResult "Python", strPathPython 2291 else 2292 PrintResultMsg "Python", "not found" 2293 end if 2294 end function 2295 2296 '' Worker for CheckForPython. 2297 ' 2298 function CheckForPythonSub(strPathPython) 2299 CheckForPythonSub = "" 2300 if strPathPython <> "" then 2301 if LogFileExists(strPathPython, "python.exe") _ 2302 and LogDirExists(strPathPython & "/DLLs") _ 2077 2303 then 2078 CheckForQt5Sub = strPathQt5 2079 end if 2080 end function 2081 2082 2083 ' 2084 ' 2085 function CheckForPython(strPathPython) 2086 2087 PrintHdr "Python" 2088 2089 CheckForPython = False 2090 LogPrint "trying: strPathPython=" & strPathPython 2091 2092 if LogFileExists(strPathPython, "python.exe") then 2093 CfgPrint "VBOX_BLD_PYTHON := " & strPathPython & "\python.exe" 2094 CheckForPython = True 2095 end if 2096 2097 PrintResult "Python ", strPathPython 2304 CheckForPythonSub = UnixSlashes(PathAbs(strPathPython & "/python.exe")) 2305 end if 2306 end if 2098 2307 end function 2099 2308 … … 2158 2367 strOptlibSDL = "" 2159 2368 strOptQt5 = "" 2369 strOptQt5Infix = "" 2160 2370 strOptSDK = "" 2161 2371 strOptVC = "" … … 2186 2396 ' Process the argument 2187 2397 select case LCase(strArg) 2398 ' --with-something: 2188 2399 case "--with-ddk" 2189 2400 strOptDDK = strPath … … 2200 2411 case "--with-qt5" 2201 2412 strOptQt5 = strPath 2413 case "--with-qt5-infix" 2414 strOptQt5Infix = strPath 2202 2415 case "--with-sdk" 2203 2416 strOptSDK = strPath … … 2222 2435 case "--with-python" 2223 2436 strOptPython = strPath 2437 2438 ' --disable-something/--enable-something 2224 2439 case "--disable-com" 2225 2440 blnOptDisableCOM = True … … 2228 2443 case "--disable-udptunnel" 2229 2444 blnOptDisableUDPTunnel = True 2445 case "--enable-udptunnel" 2446 blnOptDisableUDPTunnel = False 2230 2447 case "--disable-sdl" 2231 2448 blnOptDisableSDL = True 2449 case "--endable-sdl" 2450 blnOptDisableSDL = False 2451 2452 ' Other stuff. 2232 2453 case "--continue-on-error" 2233 2454 g_blnContinueOnError = True … … 2280 2501 end if 2281 2502 CheckSourcePath 2282 CheckForkBuild strOptkBuild2283 CheckForWinDDK strOptDDK2284 CheckForVisualCPP strOptVC, strOptVCCommon2285 CheckForPlatformSDK strOptSDK2503 CheckForkBuild strOptkBuild 2504 CheckForWinDDK strOptDDK 2505 CheckForVisualCPP strOptVC, strOptVCCommon 2506 CheckForPlatformSDK strOptSDK 2286 2507 CheckForMidl 2287 2508 CfgPrint "VBOX_WITH_OPEN_WATCOM := " '' @todo look for openwatcom 1.9+ … … 2298 2519 DisableSDL "--disable-sdl" 2299 2520 else 2300 CheckForlibSDL strOptlibSDL2301 end if 2302 CheckForXml2 strOptXml22303 CheckForSsl strOptSsl, False2521 CheckForlibSDL strOptlibSDL 2522 end if 2523 CheckForXml2 strOptXml2 2524 CheckForSsl strOptSsl, False 2304 2525 if g_strTargetArch = "amd64" then 2305 2526 ' 32-bit openssl required as well 2306 CheckForSsl strOptSsl32, True2307 end if 2308 CheckForCurl strOptCurl, False2527 CheckForSsl strOptSsl32, True 2528 end if 2529 CheckForCurl strOptCurl, False 2309 2530 if g_strTargetArch = "amd64" then 2310 2531 ' 32-bit Curl required as well 2311 CheckForCurl strOptCurl32, True 2312 end if 2313 CheckForQt strOptQt5 2314 if (strOptPython <> "") then 2315 CheckForPython strOptPython 2316 end if 2532 CheckForCurl strOptCurl32, True 2533 end if 2534 CheckForQt strOptQt5, strOptQt5Infix 2535 CheckForPython strOptPython 2317 2536 2318 2537 Print ""
Note:
See TracChangeset
for help on using the changeset viewer.