- 時間撮記:
- 2009-10-7 下午09:22:10 (15 年 以前)
- 檔案:
-
- 修改 1 筆資料
圖例:
- 未更動
- 新增
- 刪除
-
trunk/src/VBox/Runtime/r0drv/nt/memobj-r0drv-nt.cpp
r23065 r23610 501 501 * @return IPRT status code. 502 502 * 503 * @param ppMem Where to store the memory object pointer. 504 * @param pv First page. 505 * @param cb Number of bytes. 506 * @param R0Process The process \a pv and \a cb refers to. 503 * @param ppMem Where to store the memory object pointer. 504 * @param pv First page. 505 * @param cb Number of bytes. 506 * @param fAccess The desired access, a combination of RTMEM_PROT_READ 507 * and RTMEM_PROT_WRITE. 508 * @param R0Process The process \a pv and \a cb refers to. 507 509 */ 508 static int rtR0MemObjNtLock(PPRTR0MEMOBJINTERNAL ppMem, void *pv, size_t cb, RTR0PROCESS R0Process)510 static int rtR0MemObjNtLock(PPRTR0MEMOBJINTERNAL ppMem, void *pv, size_t cb, uint32_t fAccess, RTR0PROCESS R0Process) 509 511 { 510 512 /* … … 549 551 __try 550 552 { 551 MmProbeAndLockPages(pMdl, R0Process == NIL_RTR0PROCESS ? KernelMode : UserMode, IoModifyAccess); 553 MmProbeAndLockPages(pMdl, 554 R0Process == NIL_RTR0PROCESS ? KernelMode : UserMode, 555 fAccess == RTMEM_PROT_READ 556 ? IoReadAccess 557 : fAccess == RTMEM_PROT_WRITE 558 ? IoWriteAccess 559 : IoModifyAccess); 552 560 553 561 pMemNt->apMdls[iMdl] = pMdl; … … 561 569 } 562 570 563 if (R0Process != NIL_RTR0PROCESS 571 if (R0Process != NIL_RTR0PROCESS) 564 572 { 565 573 /* Make sure the user process can't change the allocation. */ 566 pMemNt->pvSecureMem = MmSecureVirtualMemory(pv, cb, PAGE_READWRITE); 574 pMemNt->pvSecureMem = MmSecureVirtualMemory(pv, cb, 575 fAccess & RTMEM_PROT_WRITE 576 ? PAGE_READWRITE 577 : PAGE_READONLY); 567 578 if (!pMemNt->pvSecureMem) 568 579 { … … 604 615 605 616 606 int rtR0MemObjNativeLockUser(PPRTR0MEMOBJINTERNAL ppMem, RTR3PTR R3Ptr, size_t cb, RTR0PROCESS R0Process)617 int rtR0MemObjNativeLockUser(PPRTR0MEMOBJINTERNAL ppMem, RTR3PTR R3Ptr, size_t cb, uint32_t fAccess, RTR0PROCESS R0Process) 607 618 { 608 619 AssertMsgReturn(R0Process == RTR0ProcHandleSelf(), ("%p != %p\n", R0Process, RTR0ProcHandleSelf()), VERR_NOT_SUPPORTED); 609 620 /* (Can use MmProbeAndLockProcessPages if we need to mess with other processes later.) */ 610 return rtR0MemObjNtLock(ppMem, (void *)R3Ptr, cb, R0Process);611 } 612 613 614 int rtR0MemObjNativeLockKernel(PPRTR0MEMOBJINTERNAL ppMem, void *pv, size_t cb )615 { 616 return rtR0MemObjNtLock(ppMem, pv, cb, NIL_RTR0PROCESS);621 return rtR0MemObjNtLock(ppMem, (void *)R3Ptr, cb, fAccess, R0Process); 622 } 623 624 625 int rtR0MemObjNativeLockKernel(PPRTR0MEMOBJINTERNAL ppMem, void *pv, size_t cb, uint32_t fAccess) 626 { 627 return rtR0MemObjNtLock(ppMem, pv, cb, fAccess, NIL_RTR0PROCESS); 617 628 } 618 629
注意:
瀏覽 TracChangeset
來幫助您使用更動檢視器