VirtualBox

Changeset 73097 in vbox for trunk/src/VBox/Runtime/r0drv/nt


Ignore:
Timestamp:
Jul 12, 2018 9:06:33 PM (7 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
123672
Message:

*: Made RT_UOFFSETOF, RT_OFFSETOF, RT_UOFFSETOF_ADD and RT_OFFSETOF_ADD work like builtin_offsetof() and require compile time resolvable requests, adding RT_UOFFSETOF_DYN for the dynamic questions that can only be answered at runtime.

Location:
trunk/src/VBox/Runtime/r0drv/nt
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/r0drv/nt/dbgkrnlinfo-r0drv-nt.cpp

    r70292 r73097  
    357357     */
    358358    uint32_t                cModules = pModInfo ? 110 /*32KB*/ : 27 /*8KB*/;
    359     ULONG                   cbInfo   = RT_OFFSETOF(RTL_PROCESS_MODULES, Modules[cModules]);
     359    ULONG                   cbInfo   = RT_UOFFSETOF_DYN(RTL_PROCESS_MODULES, Modules[cModules]);
    360360    PRTL_PROCESS_MODULES    pInfo    = (PRTL_PROCESS_MODULES)RTMemAllocZ(cbInfo);
    361361    if (!pInfo)
    362362    {
    363363        cModules = cModules / 4;
    364         cbInfo   = RT_OFFSETOF(RTL_PROCESS_MODULES, Modules[cModules]);
     364        cbInfo   = RT_UOFFSETOF_DYN(RTL_PROCESS_MODULES, Modules[cModules]);
    365365        pInfo    = (PRTL_PROCESS_MODULES)RTMemAllocZ(cbInfo);
    366366        if (!pInfo)
  • trunk/src/VBox/Runtime/r0drv/nt/initterm-r0drv-nt.cpp

    r72639 r73097  
    385385    {
    386386#if defined(RT_ARCH_X86)
    387         PKPCR    pPcr   = (PKPCR)__readfsdword(RT_OFFSETOF(KPCR,SelfPcr));
     387        PKPCR    pPcr   = (PKPCR)__readfsdword(RT_UOFFSETOF(KPCR,SelfPcr));
    388388        pbPrcb = (uint8_t *)pPcr->Prcb;
    389389#elif defined(RT_ARCH_AMD64)
    390         PKPCR    pPcr   = (PKPCR)__readgsqword(RT_OFFSETOF(KPCR,Self));
     390        PKPCR    pPcr   = (PKPCR)__readgsqword(RT_UOFFSETOF(KPCR,Self));
    391391        pbPrcb = (uint8_t *)pPcr->CurrentPrcb;
    392392#else
  • trunk/src/VBox/Runtime/r0drv/nt/memobj-r0drv-nt.cpp

    r70212 r73097  
    551551    if (cMdls >= UINT32_MAX)
    552552        return VERR_OUT_OF_RANGE;
    553     PRTR0MEMOBJNT pMemNt = (PRTR0MEMOBJNT)rtR0MemObjNew(RT_OFFSETOF(RTR0MEMOBJNT, apMdls[cMdls]),
     553    PRTR0MEMOBJNT pMemNt = (PRTR0MEMOBJNT)rtR0MemObjNew(RT_UOFFSETOF_DYN(RTR0MEMOBJNT, apMdls[cMdls]),
    554554                                                        RTR0MEMOBJTYPE_LOCK, pv, cb);
    555555    if (!pMemNt)
  • trunk/src/VBox/Runtime/r0drv/nt/nt3fakes-r0drv-nt.cpp

    r70387 r73097  
    469469        {
    470470            uZero     = *(uint32_t const *)pbCode;
    471             offNewHdr = *(uint32_t const *)&pbCode[RT_OFFSETOF(IMAGE_DOS_HEADER, e_lfanew)];
     471            offNewHdr = *(uint32_t const *)&pbCode[RT_UOFFSETOF(IMAGE_DOS_HEADER, e_lfanew)];
    472472        }
    473473        __except(EXCEPTION_EXECUTE_HANDLER)
  • trunk/src/VBox/Runtime/r0drv/nt/ntBldSymDb.cpp

    r72614 r73097  
    350350    if (s_cbNeeded == 0)
    351351    {
    352         s_cbNeeded = RT_OFFSETOF(MYSET, aStructs[RT_ELEMENTS(g_aStructs)]);
     352        s_cbNeeded = RT_UOFFSETOF(MYSET, aStructs[RT_ELEMENTS(g_aStructs)]);
    353353        for (uint32_t i = 0; i < RT_ELEMENTS(g_aStructs); i++)
    354354            s_cbNeeded += sizeof(MYMEMBER) * g_aStructs[i].cMembers;
     
    522522    MyDbgPrintf(" %s: cChildren=%u (%#x)\n", pszStructNm, cChildren);
    523523    TI_FINDCHILDREN_PARAMS *pChildren;
    524     pChildren = (TI_FINDCHILDREN_PARAMS *)alloca(RT_OFFSETOF(TI_FINDCHILDREN_PARAMS, ChildId[cChildren]));
     524    pChildren = (TI_FINDCHILDREN_PARAMS *)alloca(RT_UOFFSETOF_DYN(TI_FINDCHILDREN_PARAMS, ChildId[cChildren]));
    525525    pChildren->Start = 0;
    526526    pChildren->Count = cChildren;
  • trunk/src/VBox/Runtime/r0drv/nt/thread-r0drv-nt.cpp

    r72639 r73097  
    137137
    138138#ifdef RT_ARCH_X86
    139     PKPCR       pPcr   = (PKPCR)__readfsdword(RT_OFFSETOF(KPCR,SelfPcr));
     139    PKPCR       pPcr   = (PKPCR)__readfsdword(RT_UOFFSETOF(KPCR,SelfPcr));
    140140    uint8_t    *pbPrcb = (uint8_t *)pPcr->Prcb;
    141141
    142142#elif defined(RT_ARCH_AMD64)
    143143    /* HACK ALERT! The offset is from windbg/vista64. */
    144     PKPCR       pPcr   = (PKPCR)__readgsqword(RT_OFFSETOF(KPCR,Self));
     144    PKPCR       pPcr   = (PKPCR)__readgsqword(RT_UOFFSETOF(KPCR,Self));
    145145    uint8_t    *pbPrcb = (uint8_t *)pPcr->CurrentPrcb;
    146146
  • trunk/src/VBox/Runtime/r0drv/nt/timer-r0drv-nt.cpp

    r70341 r73097  
    493493    }
    494494
    495     PRTTIMER pTimer = (PRTTIMER)RTMemAllocZ(RT_OFFSETOF(RTTIMER, aSubTimers[cSubTimers]));
     495    PRTTIMER pTimer = (PRTTIMER)RTMemAllocZ(RT_UOFFSETOF_DYN(RTTIMER, aSubTimers[cSubTimers]));
    496496    if (!pTimer)
    497497        return VERR_NO_MEMORY;
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