Changeset 70150 in vbox for trunk/src/VBox/Runtime/r0drv/nt
- Timestamp:
- Dec 15, 2017 2:10:17 PM (7 years ago)
- svn:sync-xref-src-repo-rev:
- 119710
- Location:
- trunk/src/VBox/Runtime/r0drv/nt
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/r0drv/nt/internal-r0drv-nt.h
r69111 r70150 80 80 extern PFNKEREGISTERPROCESSORCHANGECALLBACK g_pfnrtKeRegisterProcessorChangeCallback; 81 81 extern PFNKEDEREGISTERPROCESSORCHANGECALLBACK g_pfnrtKeDeregisterProcessorChangeCallback; 82 extern decltype(MmProtectMdlSystemAddress) *g_pfnrtMmProtectMdlSystemAddress; 82 83 extern PFNRTRTLGETVERSION g_pfnrtRtlGetVersion; 83 84 #ifndef RT_ARCH_AMD64 -
trunk/src/VBox/Runtime/r0drv/nt/memobj-r0drv-nt.cpp
r69111 r70150 78 78 } RTR0MEMOBJNT, *PRTR0MEMOBJNT; 79 79 80 81 /*********************************************************************************************************************************82 * Global Variables *83 *********************************************************************************************************************************/84 /** Pointer to the MmProtectMdlSystemAddress kernel function if it's available.85 * This API was introduced in XP. */86 static decltype(MmProtectMdlSystemAddress) *g_pfnMmProtectMdlSystemAddress = NULL;87 /** Set if we've resolved the dynamic APIs. */88 static bool volatile g_fResolvedDynamicApis = false;89 static ULONG g_uMajorVersion = 5;90 static ULONG g_uMinorVersion = 1;91 92 93 static void rtR0MemObjNtResolveDynamicApis(void)94 {95 ULONG uBuildNumber = 0;96 PsGetVersion(&g_uMajorVersion, &g_uMinorVersion, &uBuildNumber, NULL);97 98 #ifndef IPRT_TARGET_NT4 /* MmGetSystemRoutineAddress was introduced in w2k. */99 100 UNICODE_STRING RoutineName;101 RtlInitUnicodeString(&RoutineName, L"MmProtectMdlSystemAddress");102 g_pfnMmProtectMdlSystemAddress = (decltype(MmProtectMdlSystemAddress) *)MmGetSystemRoutineAddress(&RoutineName);103 104 #endif105 ASMCompilerBarrier();106 g_fResolvedDynamicApis = true;107 }108 80 109 81 … … 861 833 PRTR0MEMOBJNT pMemNt = (PRTR0MEMOBJNT)pMem; 862 834 #endif 863 if (!g_fResolvedDynamicApis)864 rtR0MemObjNtResolveDynamicApis();865 835 866 836 /* … … 873 843 */ 874 844 if ( pMemNt->cMdls 875 && g_pfn MmProtectMdlSystemAddress876 && (g_u MajorVersion > 6 || (g_uMajorVersion == 6 && g_uMinorVersion>= 1)) /* Windows 7 and later. */845 && g_pfnrtMmProtectMdlSystemAddress 846 && (g_uRtNtMajorVer > 6 || (g_uRtNtMajorVer == 6 && g_uRtNtMinorVer >= 1)) /* Windows 7 and later. */ 877 847 && pMemNt->Core.pv != NULL 878 848 && ( pMemNt->Core.enmType == RTR0MEMOBJTYPE_PAGE … … 926 896 while (iMdl-- > 0) 927 897 { 928 rcNt = g_pfn MmProtectMdlSystemAddress(pMemNt->apMdls[i], fAccess);898 rcNt = g_pfnrtMmProtectMdlSystemAddress(pMemNt->apMdls[i], fAccess); 929 899 if (!NT_SUCCESS(rcNt)) 930 900 break; … … 962 932 if (NT_SUCCESS(rcNt)) 963 933 { 964 rcNt = g_pfn MmProtectMdlSystemAddress(pMdl, fAccess);934 rcNt = g_pfnrtMmProtectMdlSystemAddress(pMdl, fAccess); 965 935 MmUnlockPages(pMdl); 966 936 }
Note:
See TracChangeset
for help on using the changeset viewer.