Changeset 6079 in vbox
- Timestamp:
- Dec 15, 2007 3:55:18 AM (17 years ago)
- svn:sync-xref-src-repo-rev:
- 26772
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/configure.vbs
r5999 r6079 115 115 end function 116 116 117 118 '' 119 ' Checks if this is a WOW64 process. 120 function IsWow64() 121 if g_objShell.Environment("PROCESS")("PROCESSOR_ARCHITEW6432") <> "" then 122 IsWow64 = 1 123 else 124 IsWow64 = 0 125 end if 126 end function 127 128 129 '' 130 ' Translates a register root name to a value 131 function 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 143 end function 144 145 146 '' The registry globals 147 dim g_objReg, g_objRegCtx 148 dim g_blnRegistry 149 g_blnRegistry = false 150 151 152 '' 153 ' Init the register provider globals. 154 function 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 170 end function 171 172 117 173 '' 118 174 ' Gets a value from the registry. Returns "" if string wasn't found / valid. 119 175 function RegGetString(strName) 120 176 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 201 end function 202 124 203 125 204 '' 126 205 ' Returns an array of subkey strings. 127 206 function 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 146 221 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 148 230 end if 149 231 end function … … 731 813 732 814 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 733 828 str = RegGetString("HKLM\SOFTWARE\Microsoft\VisualStudio\8.0\Setup\VS\ProductDir") 734 829 str2 = RegGetString("HKLM\SOFTWARE\Microsoft\VisualStudio\8.0\Setup\VS\EnvironmentDirectory") … … 763 858 str = str & "VC7" 764 859 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" 765 871 if CheckForVisualCPPSub(str, str2, blnOptVCExpressEdition) then 766 872 strPathVC = str … … 931 1037 end if 932 1038 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 934 1055 arrSubKeys = RegEnumSubKeys("HKLM", "SOFTWARE\Microsoft\MicrosoftSDK\InstalledSDKs") 935 1056 for Each strSubKey In arrSubKeys … … 1006 1127 end if 1007 1128 1008 if strPathDDK = "" then1009 MsgError "Cannot find a suitable Windows 2003 DDK. Check configure.log and the build requirements."1010 exit sub1011 end if1012 1013 1129 ' Check the environment 1014 1130 str = EnvGet("DDK_INC_PATH") … … 1023 1139 end if 1024 1140 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 1026 1157 arrSubKeys = RegEnumSubKeys("HKLM", "SOFTWARE\Microsoft\WINDDK") '' @todo Need some sorting stuff here. 1027 1158 for Each strSubKey In arrSubKeys … … 1039 1170 Next 1040 1171 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 1041 1177 ' 1042 1178 ' Emit the config. … … 1055 1191 CheckForWin2k3DDKSub = False 1056 1192 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")) _ 1057 1195 if LogFileExists(strPathDDK, "inc/ddk/wnet/ntdef.h") _ 1058 1196 And LogFileExists(strPathDDK, "lib/wnet/i386/int64.lib") _ … … 1658 1796 Print " --with-Xerces=PATH " 1659 1797 end sub 1798 1660 1799 1661 1800 ''
Note:
See TracChangeset
for help on using the changeset viewer.