Changeset 3511 in vbox for trunk/src/VBox/HostDrivers/Support/SUPLib.cpp
- Timestamp:
- Jul 9, 2007 2:53:13 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/HostDrivers/Support/SUPLib.cpp
r3393 r3511 1208 1208 supLoadModuleResolveImport, (void *)pszModule); 1209 1209 1210 /*1211 * Get the entry points.1212 */1213 RTUINTPTR VMMR0Entry = 0;1214 RTUINTPTR ModuleInit = 0;1215 RTUINTPTR ModuleTerm = 0;1216 if (fIsVMMR0 && VBOX_SUCCESS(rc))1217 rc = RTLdrGetSymbolEx(hLdrMod, &pIn->achImage[0], (uintptr_t)OpenOut.pvImageBase, "VMMR0Entry", &VMMR0Entry);1218 1210 if (VBOX_SUCCESS(rc)) 1219 1211 { 1220 rc = RTLdrGetSymbolEx(hLdrMod, &pIn->achImage[0], (uintptr_t)OpenOut.pvImageBase, "ModuleInit", &ModuleInit);1221 if (VBOX_FAILURE(rc))1222 ModuleInit = 0;1223 1224 rc = RTLdrGetSymbolEx(hLdrMod, &pIn->achImage[0], (uintptr_t)OpenOut.pvImageBase, "ModuleTerm", &ModuleTerm);1225 if (VBOX_FAILURE(rc))1226 ModuleTerm = 0;1227 }1228 1229 /*1230 * Create the symbol and string tables.1231 */1232 SUPLDRCREATETABSARGS CreateArgs;1233 CreateArgs.cbImage = CalcArgs.cbImage;1234 CreateArgs.pSym = (PSUPLDRSYM)&pIn->achImage[offSymTab];1235 CreateArgs.pszBase = (char *)&pIn->achImage[offStrTab];1236 CreateArgs.psz = CreateArgs.pszBase;1237 rc = RTLdrEnumSymbols(hLdrMod, 0, NULL, 0, supLoadModuleCreateTabsCB, &CreateArgs);1238 if (VBOX_SUCCESS(rc))1239 {1240 AssertRelease((size_t)(CreateArgs.psz - CreateArgs.pszBase) <= CalcArgs.cbStrings);1241 AssertRelease((size_t)(CreateArgs.pSym - (PSUPLDRSYM)&pIn->achImage[offSymTab]) <= CalcArgs.cSymbols);1242 1243 1212 /* 1244 * Upload the image.1213 * Get the entry points. 1245 1214 */ 1246 pIn->u32Cookie = g_u32Cookie; 1247 pIn->u32SessionCookie = g_u32SessionCookie; 1248 pIn->pfnModuleInit = (RTR0PTR)ModuleInit; 1249 pIn->pfnModuleTerm = (RTR0PTR)ModuleTerm; 1215 RTUINTPTR VMMR0Entry = 0; 1216 RTUINTPTR ModuleInit = 0; 1217 RTUINTPTR ModuleTerm = 0; 1250 1218 if (fIsVMMR0) 1219 rc = RTLdrGetSymbolEx(hLdrMod, &pIn->achImage[0], (uintptr_t)OpenOut.pvImageBase, "VMMR0Entry", &VMMR0Entry); 1220 if (VBOX_SUCCESS(rc)) 1251 1221 { 1252 pIn->eEPType = pIn->EP_VMMR0; 1253 pIn->EP.VMMR0.pvVMMR0 = OpenOut.pvImageBase; 1254 pIn->EP.VMMR0.pvVMMR0Entry = (RTR0PTR)VMMR0Entry; 1222 rc = RTLdrGetSymbolEx(hLdrMod, &pIn->achImage[0], (uintptr_t)OpenOut.pvImageBase, "ModuleInit", &ModuleInit); 1223 if (VBOX_FAILURE(rc)) 1224 ModuleInit = 0; 1225 1226 rc = RTLdrGetSymbolEx(hLdrMod, &pIn->achImage[0], (uintptr_t)OpenOut.pvImageBase, "ModuleTerm", &ModuleTerm); 1227 if (VBOX_FAILURE(rc)) 1228 ModuleTerm = 0; 1255 1229 } 1256 else 1257 pIn->eEPType = pIn->EP_NOTHING; 1258 pIn->offStrTab = offStrTab; 1259 pIn->cbStrTab = (uint32_t)CalcArgs.cbStrings; 1260 AssertRelease(pIn->cbStrTab == CalcArgs.cbStrings); 1261 pIn->offSymbols = offSymTab; 1262 pIn->cSymbols = CalcArgs.cSymbols; 1263 pIn->cbImage = cbImage; 1264 pIn->pvImageBase = OpenOut.pvImageBase; 1265 if (!g_u32FakeMode) 1266 rc = suplibOsIOCtl(SUP_IOCTL_LDR_LOAD, pIn, cbIn, NULL, 0); 1267 else 1268 rc = VINF_SUCCESS; 1269 if ( VBOX_SUCCESS(rc) 1270 || rc == VERR_ALREADY_LOADED /* this is because of a competing process. */ 1271 ) 1230 1231 /* 1232 * Create the symbol and string tables. 1233 */ 1234 SUPLDRCREATETABSARGS CreateArgs; 1235 CreateArgs.cbImage = CalcArgs.cbImage; 1236 CreateArgs.pSym = (PSUPLDRSYM)&pIn->achImage[offSymTab]; 1237 CreateArgs.pszBase = (char *)&pIn->achImage[offStrTab]; 1238 CreateArgs.psz = CreateArgs.pszBase; 1239 rc = RTLdrEnumSymbols(hLdrMod, 0, NULL, 0, supLoadModuleCreateTabsCB, &CreateArgs); 1240 if (VBOX_SUCCESS(rc)) 1272 1241 { 1242 AssertRelease((size_t)(CreateArgs.psz - CreateArgs.pszBase) <= CalcArgs.cbStrings); 1243 AssertRelease((size_t)(CreateArgs.pSym - (PSUPLDRSYM)&pIn->achImage[offSymTab]) <= CalcArgs.cSymbols); 1244 1245 /* 1246 * Upload the image. 1247 */ 1248 pIn->u32Cookie = g_u32Cookie; 1249 pIn->u32SessionCookie = g_u32SessionCookie; 1250 pIn->pfnModuleInit = (RTR0PTR)ModuleInit; 1251 pIn->pfnModuleTerm = (RTR0PTR)ModuleTerm; 1273 1252 if (fIsVMMR0) 1274 g_pvVMMR0 = OpenOut.pvImageBase; 1275 RTMemTmpFree(pIn); 1276 RTLdrClose(hLdrMod); 1277 return VINF_SUCCESS; 1253 { 1254 pIn->eEPType = pIn->EP_VMMR0; 1255 pIn->EP.VMMR0.pvVMMR0 = OpenOut.pvImageBase; 1256 pIn->EP.VMMR0.pvVMMR0Entry = (RTR0PTR)VMMR0Entry; 1257 } 1258 else 1259 pIn->eEPType = pIn->EP_NOTHING; 1260 pIn->offStrTab = offStrTab; 1261 pIn->cbStrTab = (uint32_t)CalcArgs.cbStrings; 1262 AssertRelease(pIn->cbStrTab == CalcArgs.cbStrings); 1263 pIn->offSymbols = offSymTab; 1264 pIn->cSymbols = CalcArgs.cSymbols; 1265 pIn->cbImage = cbImage; 1266 pIn->pvImageBase = OpenOut.pvImageBase; 1267 if (!g_u32FakeMode) 1268 rc = suplibOsIOCtl(SUP_IOCTL_LDR_LOAD, pIn, cbIn, NULL, 0); 1269 else 1270 rc = VINF_SUCCESS; 1271 if ( VBOX_SUCCESS(rc) 1272 || rc == VERR_ALREADY_LOADED /* this is because of a competing process. */ 1273 ) 1274 { 1275 if (fIsVMMR0) 1276 g_pvVMMR0 = OpenOut.pvImageBase; 1277 RTMemTmpFree(pIn); 1278 RTLdrClose(hLdrMod); 1279 return VINF_SUCCESS; 1280 } 1278 1281 } 1279 1282 }
Note:
See TracChangeset
for help on using the changeset viewer.