Changeset 25258 in vbox for trunk/src/VBox/HostDrivers/Support/SUPLib.cpp
- Timestamp:
- Dec 9, 2009 1:52:52 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/HostDrivers/Support/SUPLib.cpp
r23725 r25258 272 272 strcpy(CookieReq.u.In.szMagic, SUPCOOKIE_MAGIC); 273 273 CookieReq.u.In.u32ReqVersion = SUPDRV_IOC_VERSION; 274 const uint32_t uMinVersion = (SUPDRV_IOC_VERSION & 0xffff0000) == 0x00100001 275 ? 0x00100001 274 #ifdef SUPDRV_USE_NATIVE_LOADER 275 const uint32_t uMinVersion = (SUPDRV_IOC_VERSION & 0xffff0000) == 0x00120000 276 ? 0x00120000 276 277 : SUPDRV_IOC_VERSION & 0xffff0000; 278 #else 279 const uint32_t uMinVersion = (SUPDRV_IOC_VERSION & 0xffff0000) == 0x00100001 280 ? 0x00100001 281 : SUPDRV_IOC_VERSION & 0xffff0000; 282 #endif 277 283 CookieReq.u.In.u32MinVersion = uMinVersion; 278 284 rc = suplibOsIOCtl(&g_supLibData, SUP_IOCTL_COOKIE, &CookieReq, SUP_IOCTL_COOKIE_SIZE); … … 1644 1650 static int supLoadModule(const char *pszFilename, const char *pszModule, const char *pszSrvReqHandler, void **ppvImageBase) 1645 1651 { 1652 int rc; 1653 1646 1654 /* 1647 1655 * Validate input. … … 1651 1659 AssertPtrReturn(ppvImageBase, VERR_INVALID_PARAMETER); 1652 1660 AssertReturn(strlen(pszModule) < RT_SIZEOFMEMB(SUPLDROPEN, u.In.szName), VERR_FILENAME_TOO_LONG); 1661 #ifdef SUPDRV_USE_NATIVE_LOADER 1662 char szAbsFilename[RT_SIZEOFMEMB(SUPLDROPEN, u.In.szFilename)]; 1663 rc = RTPathAbs(pszFilename, szAbsFilename, sizeof(szAbsFilename)); 1664 if (RT_FAILURE(rc)) 1665 return rc; 1666 pszFilename = szAbsFilename; 1667 #endif 1653 1668 1654 1669 const bool fIsVMMR0 = !strcmp(pszModule, "VMMR0.r0"); … … 1660 1675 */ 1661 1676 RTLDRMOD hLdrMod; 1662 intrc = RTLdrOpen(pszFilename, 0, RTLDRARCH_HOST, &hLdrMod);1677 rc = RTLdrOpen(pszFilename, 0, RTLDRARCH_HOST, &hLdrMod); 1663 1678 if (!RT_SUCCESS(rc)) 1664 1679 return rc; … … 1673 1688 const uint32_t offSymTab = RT_ALIGN_32(CalcArgs.cbImage, 8); 1674 1689 const uint32_t offStrTab = offSymTab + CalcArgs.cSymbols * sizeof(SUPLDRSYM); 1675 const uint32_t cbImage 1690 const uint32_t cbImageWithTabs = RT_ALIGN_32(offStrTab + CalcArgs.cbStrings, 8); 1676 1691 1677 1692 /* … … 1685 1700 OpenReq.Hdr.fFlags = SUPREQHDR_FLAGS_DEFAULT; 1686 1701 OpenReq.Hdr.rc = VERR_INTERNAL_ERROR; 1687 OpenReq.u.In.cbImage = cbImage; 1702 OpenReq.u.In.cbImageWithTabs = cbImageWithTabs; 1703 #ifdef SUPDRV_USE_NATIVE_LOADER 1704 OpenReq.u.In.cbImageBits = (uint32_t)CalcArgs.cbImage; 1705 #endif 1688 1706 strcpy(OpenReq.u.In.szName, pszModule); 1707 #ifdef SUPDRV_USE_NATIVE_LOADER 1708 strcpy(OpenReq.u.In.szFilename, pszFilename); 1709 #endif 1689 1710 if (!g_u32FakeMode) 1690 1711 { … … 1706 1727 * Allocate memory for the image bits. 1707 1728 */ 1708 PSUPLDRLOAD pLoadReq = (PSUPLDRLOAD)RTMemTmpAlloc(SUP_IOCTL_LDR_LOAD_SIZE(cbImage ));1729 PSUPLDRLOAD pLoadReq = (PSUPLDRLOAD)RTMemTmpAlloc(SUP_IOCTL_LDR_LOAD_SIZE(cbImageWithTabs)); 1709 1730 if (pLoadReq) 1710 1731 { … … 1767 1788 pLoadReq->Hdr.u32Cookie = g_u32Cookie; 1768 1789 pLoadReq->Hdr.u32SessionCookie = g_u32SessionCookie; 1769 pLoadReq->Hdr.cbIn = SUP_IOCTL_LDR_LOAD_SIZE_IN(cbImage );1790 pLoadReq->Hdr.cbIn = SUP_IOCTL_LDR_LOAD_SIZE_IN(cbImageWithTabs); 1770 1791 pLoadReq->Hdr.cbOut = SUP_IOCTL_LDR_LOAD_SIZE_OUT; 1771 1792 pLoadReq->Hdr.fFlags = SUPREQHDR_FLAGS_MAGIC | SUPREQHDR_FLAGS_EXTRA_IN; … … 1795 1816 pLoadReq->u.In.cbStrTab = (uint32_t)CalcArgs.cbStrings; 1796 1817 AssertRelease(pLoadReq->u.In.cbStrTab == CalcArgs.cbStrings); 1818 #ifdef SUPDRV_USE_NATIVE_LOADER 1819 pLoadReq->u.In.cbImageBits = (uint32_t)CalcArgs.cbImage; 1820 #endif 1797 1821 pLoadReq->u.In.offSymbols = offSymTab; 1798 1822 pLoadReq->u.In.cSymbols = CalcArgs.cSymbols; 1799 pLoadReq->u.In.cbImage = cbImage;1823 pLoadReq->u.In.cbImageWithTabs = cbImageWithTabs; 1800 1824 pLoadReq->u.In.pvImageBase = OpenReq.u.Out.pvImageBase; 1801 1825 if (!g_u32FakeMode) 1802 1826 { 1803 rc = suplibOsIOCtl(&g_supLibData, SUP_IOCTL_LDR_LOAD, pLoadReq, SUP_IOCTL_LDR_LOAD_SIZE(cbImage ));1827 rc = suplibOsIOCtl(&g_supLibData, SUP_IOCTL_LDR_LOAD, pLoadReq, SUP_IOCTL_LDR_LOAD_SIZE(cbImageWithTabs)); 1804 1828 if (RT_SUCCESS(rc)) 1805 1829 rc = pLoadReq->Hdr.rc; … … 1834 1858 else 1835 1859 { 1836 AssertMsgFailed(("failed to allocated % d bytes for SUPLDRLOAD_IN structure!\n", SUP_IOCTL_LDR_LOAD_SIZE(cbImage)));1860 AssertMsgFailed(("failed to allocated %u bytes for SUPLDRLOAD_IN structure!\n", SUP_IOCTL_LDR_LOAD_SIZE(cbImageWithTabs))); 1837 1861 rc = VERR_NO_TMP_MEMORY; 1838 1862 }
Note:
See TracChangeset
for help on using the changeset viewer.