VirtualBox

Changeset 6079 in vbox


Ignore:
Timestamp:
Dec 15, 2007 3:55:18 AM (17 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
26772
Message:

Some workarounds for WOW64 and latest PSDK. (WDK doesn't work yet.)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/configure.vbs

    r5999 r6079  
    115115end function
    116116
     117
     118''
     119' Checks if this is a WOW64 process.
     120function IsWow64()
     121   if g_objShell.Environment("PROCESS")("PROCESSOR_ARCHITEW6432") <> "" then
     122      IsWow64 = 1
     123   else
     124      IsWow64 = 0
     125   end if
     126end function
     127
     128
     129''
     130' Translates a register root name to a value
     131function RegTransRoot(strRoot)
     132   const HKEY_LOCAL_MACHINE = &H80000002
     133   const HKEY_CURRENT_USER  = &H80000001
     134   select case strRoot
     135      case "HKLM"
     136         RegTransRoot = HKEY_LOCAL_MACHINE
     137      case "HKCU"
     138         RegTransRoot = HKEY_CURRENT_USER
     139      case else
     140         MsgFatal "RegEnumSubKeys: Unknown root: " & strRoot
     141         RegTransRoot = 0
     142   end select
     143end function
     144
     145
     146'' The registry globals
     147dim g_objReg, g_objRegCtx
     148dim g_blnRegistry
     149g_blnRegistry = false
     150
     151
     152''
     153' Init the register provider globals.
     154function RegInit()
     155   RegInit = false
     156   On Error Resume Next
     157   if g_blnRegistry = false then
     158      set g_objRegCtx = CreateObject("WbemScripting.SWbemNamedValueSet")
     159      ' Comment out the following for lines if the cause trouble on your windows version.
     160      if IsWow64() then
     161         g_objRegCtx.Add "__ProviderArchitecture", 64
     162         g_objRegCtx.Add "__RequiredArchitecture", true
     163      end if
     164      set objLocator = CreateObject("Wbemscripting.SWbemLocator")
     165      set objServices = objLocator.ConnectServer("", "root\default", "", "", , , , g_objRegCtx)
     166      set g_objReg = objServices.Get("StdRegProv")
     167      g_blnRegistry = true
     168   end if
     169   RegInit = true
     170end function
     171
     172
    117173''
    118174' Gets a value from the registry. Returns "" if string wasn't found / valid.
    119175function RegGetString(strName)
    120176   RegGetString = ""
    121    On Error Resume Next
    122    RegGetString = g_objShell.RegRead(strName)
    123 end function
     177   if RegInit() then
     178      dim strRoot, strKey, strValue
     179      dim iRoot
     180   
     181      ' split up into root, key and value parts.
     182      strRoot = left(strName, instr(strName, "\") - 1)
     183      strKey = mid(strName, instr(strName, "\") + 1, instrrev(strName, "\") - instr(strName, "\"))
     184      strValue = mid(strName, instrrev(strName, "\") + 1)
     185
     186      ' Must use ExecMethod to call the GetStringValue method because of the context.
     187      Set InParms = g_objReg.Methods_("GetStringValue").Inparameters
     188      InParms.hDefKey     = RegTransRoot(strRoot)
     189      InParms.sSubKeyName = strKey
     190      InParms.sValueName  = strValue
     191      On Error Resume Next
     192      set OutParms = g_objReg.ExecMethod_("GetStringValue", InParms, , g_objRegCtx)
     193      if OutParms.ReturnValue = 0 then
     194         RegGetString = OutParms.sValue
     195      end if
     196   else
     197      ' fallback mode
     198      On Error Resume Next
     199      RegGetString = g_objShell.RegRead(strName)
     200   end if
     201end function
     202
    124203
    125204''
    126205' Returns an array of subkey strings.
    127206function RegEnumSubKeys(strRoot, strKeyPath)
    128    const HKEY_LOCAL_MACHINE = &H80000002
    129    const HKEY_CURRENT_USER  = &H80000001
    130    dim objReg, iRoot
    131    set objReg = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\default:StdRegProv")
    132 
    133    select case strRoot
    134       case "HKLM"
    135          iRoot = HKEY_LOCAL_MACHINE
    136       case "HKCU"
    137          iRoot = HKEY_CURRENT_USER
    138       case else
    139          MsgFatal "RegEnumSubKeys: Unknown root: " & strRoot
    140    end select
    141 
    142    On Error Resume Next
    143    rc = objReg.EnumKey(iRoot, strKeyPath, arrSubKeys)
    144    if rc = 0 then
    145       RegEnumSubKeys = arrSubKeys
     207   dim iRoot
     208   iRoot = RegTransRoot(strRoot)
     209   RegEnumSubKeys = Array()
     210
     211   if RegInit() then
     212      ' Must use ExecMethod to call the EnumKey method because of the context.
     213      Set InParms = g_objReg.Methods_("EnumKey").Inparameters
     214      InParms.hDefKey     = RegTransRoot(strRoot)
     215      InParms.sSubKeyName = strKeyPath
     216      On Error Resume Next
     217      set OutParms = g_objReg.ExecMethod_("EnumKey", InParms, , g_objRegCtx)
     218      if OutParms.ReturnValue = 0 then
     219         RegEnumSubKeys = OutParms.sNames
     220      end if
    146221   else
    147       RegEnumSubKeys = Array()
     222      ' fallback mode
     223      dim objReg, rc, arrSubKeys
     224      set objReg = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\default:StdRegProv")
     225      On Error Resume Next
     226      rc = objReg.EnumKey(iRoot, strKeyPath, arrSubKeys)
     227      if rc = 0 then
     228         RegEnumSubKeys = arrSubKeys
     229      end if
    148230   end if
    149231end function
     
    731813
    732814   if strPathVC = "" then
     815      str = RegGetString("HKLM\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\8.0\Setup\VS\ProductDir")
     816      str2 = RegGetString("HKLM\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\8.0\Setup\VS\EnvironmentDirectory")
     817      if str <> "" And str2 <> "" Then
     818         str = str & "VC"
     819         str2 = PathParent(str2)
     820         if CheckForVisualCPPSub(str, str2, blnOptVCExpressEdition) then
     821            strPathVC = str
     822            strPathVCCommon = str2
     823         end if
     824      end if
     825   end if
     826
     827   if strPathVC = "" then
    733828      str = RegGetString("HKLM\SOFTWARE\Microsoft\VisualStudio\8.0\Setup\VS\ProductDir")
    734829      str2 = RegGetString("HKLM\SOFTWARE\Microsoft\VisualStudio\8.0\Setup\VS\EnvironmentDirectory")
     
    763858         str = str & "VC7"
    764859         str2 = PathParent(str2)
     860         if CheckForVisualCPPSub(str, str2, blnOptVCExpressEdition) then
     861            strPathVC = str
     862            strPathVCCommon = str2
     863         end if
     864      end if
     865   end if
     866
     867   if strPathVC = "" then
     868      str = RegGetString("HKLM\SOFTWARE\Microsoft\Wow6432Node\VisualStudio\SxS\VC7\8.0")
     869      if str <> "" then
     870         str2 = PathParent(str) & "/Common7"
    765871         if CheckForVisualCPPSub(str, str2, blnOptVCExpressEdition) then
    766872            strPathVC = str
     
    9311037   end if
    9321038
    933    ' Check the registry next.
     1039   ' Check the registry next. (first pair is vista, second is pre-vista)
     1040   arrSubKeys = RegEnumSubKeys("HKLM", "SOFTWARE\Microsoft\Microsoft SDKs\Windows")
     1041   for Each strSubKey In arrSubKeys
     1042      str = RegGetString("HKLM\SOFTWARE\Microsoft\Microsoft SDKs\Windows\" & strSubKey & "\InstallationFolder")
     1043      if (strPathPSDK = "") And (str <> "") then
     1044         if CheckForPlatformSDKSub(str) then strPathPSDK = str
     1045      end if
     1046   Next
     1047   arrSubKeys = RegEnumSubKeys("HKCU", "SOFTWARE\Microsoft\Microsoft SDKs\Windows")
     1048   for Each strSubKey In arrSubKeys
     1049      str = RegGetString("HKCU\SOFTWARE\Microsoft\Microsoft SDKs\Windows\" & strSubKey & "\InstallationFolder")
     1050      if (strPathPSDK = "") And (str <> "") then
     1051         if CheckForPlatformSDKSub(str) then strPathPSDK = str
     1052      end if
     1053   Next
     1054
    9341055   arrSubKeys = RegEnumSubKeys("HKLM", "SOFTWARE\Microsoft\MicrosoftSDK\InstalledSDKs")
    9351056   for Each strSubKey In arrSubKeys
     
    10061127   end if
    10071128
    1008    if strPathDDK = "" then
    1009       MsgError "Cannot find a suitable Windows 2003 DDK. Check configure.log and the build requirements."
    1010       exit sub
    1011    end if
    1012 
    10131129   ' Check the environment
    10141130   str = EnvGet("DDK_INC_PATH")
     
    10231139   end if
    10241140
    1025    ' Check the registry next.
     1141   ' Check the registry next. (the first pair is for vista (WDK), the second for pre-vista (DDK))
     1142   arrSubKeys = RegEnumSubKeys("HKLM", "SOFTWARE\Microsoft\WINDDK") '' @todo Need some sorting stuff here.
     1143   for Each strSubKey In arrSubKeys
     1144      str = RegGetString("HKLM\SOFTWARE\Microsoft\WINDDK\" & strSubKey & "\Setup\BUILD")
     1145      if (strPathDDK = "") And (str <> "") then
     1146         if CheckForWin2k3DDKSub(str, False) then strPathDDK = str
     1147      end if
     1148   Next
     1149   arrSubKeys = RegEnumSubKeys("HKCU", "SOFTWARE\Microsoft\WINDDK") '' @todo Need some sorting stuff here.
     1150   for Each strSubKey In arrSubKeys
     1151      str = RegGetString("HKCU\SOFTWARE\Microsoft\WINDDK\" & strSubKey & "\Setup\BUILD")
     1152      if (strPathDDK = "") And (str <> "") then
     1153         if CheckForWin2k3DDKSub(str, False) then strPathDDK = str
     1154      end if
     1155   Next
     1156
    10261157   arrSubKeys = RegEnumSubKeys("HKLM", "SOFTWARE\Microsoft\WINDDK") '' @todo Need some sorting stuff here.
    10271158   for Each strSubKey In arrSubKeys
     
    10391170   Next
    10401171
     1172   if strPathDDK = "" then
     1173      MsgError "Cannot find a suitable Windows 2003 DDK. Check configure.log and the build requirements."
     1174      exit sub
     1175   end if
     1176
    10411177   '
    10421178   ' Emit the config.
     
    10551191   CheckForWin2k3DDKSub = False
    10561192   LogPrint "trying: strPathDDK=" & strPathDDK & " blnCheckBuild=" & blnCheckBuild
     1193   '' @todo vista: if   (   LogFileExists(strPathDDK, "inc/ddk/wnet/ntdef.h") _
     1194   '      Or LogFileExists(strPathDDK, "inc/api/ntdef.h")) _
    10571195   if   LogFileExists(strPathDDK, "inc/ddk/wnet/ntdef.h") _
    10581196    And LogFileExists(strPathDDK, "lib/wnet/i386/int64.lib") _
     
    16581796   Print "  --with-Xerces=PATH    "
    16591797end sub
     1798
    16601799
    16611800''
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette