Changeset 25262 in vbox
- Timestamp:
- Dec 9, 2009 4:20:18 AM (15 years ago)
- Location:
- trunk/src/VBox/HostDrivers/Support
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/HostDrivers/Support/SUPDrv.c
r25260 r25262 3502 3502 #ifdef VBOX_WITH_NATIVE_R0_LOADER 3503 3503 pImage->fNative = true; 3504 RTSemFastMutexRelease(pDevExt->mtxLdr); /*hack*/ 3504 3505 rc = supdrvOSLdrOpen(pDevExt, pImage, pReq->u.In.szFilename); 3506 RTSemFastMutexRequest(pDevExt->mtxLdr); /*hack*/ 3505 3507 #else 3506 3508 rc = VERR_NOT_SUPPORTED; … … 3520 3522 RTMemFree(pImage); 3521 3523 Log(("supdrvIOCtl_LdrOpen(%s): failed - %Rrc\n", pReq->u.In.szName, rc)); 3522 return VERR_NO_MEMORY;3524 return rc; 3523 3525 } 3524 3526 Assert(VALID_PTR(pImage->pvImage) || RT_FAILURE(rc)); -
trunk/src/VBox/HostDrivers/Support/SUPDrvInternal.h
r25260 r25262 429 429 uint32_t volatile cUsage; 430 430 #ifdef VBOX_WITH_NATIVE_R0_LOADER 431 # ifdef RT_OS_WINDOWS 432 /** The section object for the loaded image (fNative=true). */ 433 void *pvNtSectionObj; 434 # endif 431 435 /** Whether it's loaded by the native loader or not. */ 432 436 bool fNative; -
trunk/src/VBox/HostDrivers/Support/solaris/SUPDrv-solaris.c
r25260 r25262 901 901 int VBOXCALL supdrvOSLdrOpen(PSUPDRVDEVEXT pDevExt, PSUPDRVLDRIMAGE pImage, const char *pszFilename) 902 902 { 903 /** @todo This is something that shouldn't be impossible to implement 904 * here and would make a few people happy. */ 903 905 NOREF(pDevExt); NOREF(pImage); NOREF(pszFilename); 904 906 return VERR_NOT_SUPPORTED; -
trunk/src/VBox/HostDrivers/Support/win/SUPDrv-win.cpp
r25260 r25262 596 596 #ifdef VBOX_WITH_NATIVE_R0_LOADER 597 597 598 #define MY_SystemLoadGdiDriverInformation 26 599 #define MY_SystemLoadGdiDriverInSystemSpaceInformation 54 600 #define MY_SystemUnloadGdiDriverInformation 27 601 602 typedef struct MYSYSTEMGDIDRIVERINFO 603 { 604 UNICODE_STRING Name; /**< In: image file name. */ 605 PVOID ImageAddress; /**< Out: the load address. */ 606 PVOID SectionPointer; /**< Out: section object. */ 607 PVOID EntryPointer; /**< Out: entry point address. */ 608 PVOID ExportSectionPointer; /**< Out: export directory/section. */ 609 ULONG ImageLength; /**< Out: SizeOfImage. */ 610 } MYSYSTEMGDIDRIVERINFO; 611 612 extern "C" __declspec(dllimport) NTSTATUS NTAPI ZwSetSystemInformation(ULONG, PVOID, ULONG); 613 598 614 int VBOXCALL supdrvOSLdrOpen(PSUPDRVDEVEXT pDevExt, PSUPDRVLDRIMAGE pImage, const char *pszFilename) 599 615 { 600 NOREF(pDevExt); NOREF(pImage); NOREF(pszFilename); 601 return VERR_NOT_SUPPORTED; 616 MYSYSTEMGDIDRIVERINFO Info; 617 618 /** @todo fix this horrible stuff. */ 619 WCHAR wszConv[192 + 32]; 620 unsigned i = 0; 621 wszConv[i++] = '\\'; 622 wszConv[i++] = '?'; 623 wszConv[i++] = '?'; 624 wszConv[i++] = '\\'; 625 unsigned cchPref = i; 626 char ch; 627 do 628 { 629 ch = pszFilename[i - cchPref]; 630 wszConv[i++] = ch == '/' ? '\\' : ch; 631 } while (ch); 632 RtlInitUnicodeString(&Info.Name, wszConv); 633 634 Info.ImageAddress = NULL; 635 Info.SectionPointer = NULL; 636 Info.EntryPointer = NULL; 637 Info.ExportSectionPointer = NULL; 638 Info.ImageLength = 0; 639 640 NTSTATUS rc = ZwSetSystemInformation(MY_SystemLoadGdiDriverInSystemSpaceInformation, &Info, sizeof(Info)); 641 if (NT_SUCCESS(rc)) 642 { 643 pImage->pvImage = Info.ImageAddress; 644 pImage->pvNtSectionObj = Info.SectionPointer; 645 SUPR0Printf("ImageAddress=%p SectionPointer=%p ImageLength=%#x cbImageBits=%#x rc=%#x '%ws'\n", 646 Info.ImageAddress, Info.SectionPointer, Info.ImageLength, pImage->cbImageBits, rc, Info.Name.Buffer); 647 if (pImage->cbImageBits == Info.ImageLength) 648 return VINF_SUCCESS; 649 supdrvOSLdrUnload(pDevExt, pImage); 650 rc = STATUS_INFO_LENGTH_MISMATCH; 651 } 652 SUPR0Printf("rc=%#x '%ws'\n", rc, Info.Name.Buffer); 653 //STATUS_OBJECT_NAME_NOT_FOUND == 0xc0000034 -> SUPR0 654 655 NOREF(pDevExt); NOREF(pszFilename); 656 pImage->pvNtSectionObj = NULL; 657 return VERR_INTERNAL_ERROR_5; /** @todo convert status, making sure it isn't NOT_SUPPORTED. */ 602 658 } 603 659 … … 606 662 { 607 663 NOREF(pDevExt); NOREF(pImage); NOREF(pv); NOREF(pbImageBits); 608 return V ERR_NOT_SUPPORTED;664 return VINF_SUCCESS; 609 665 } 610 666 … … 613 669 { 614 670 NOREF(pDevExt); NOREF(pImage); NOREF(pbImageBits); 615 return VERR_NOT_SUPPORTED; 671 if (pImage->pvNtSectionObj) 672 { 673 /** @todo check that the two image versions matches. */ 674 return VINF_SUCCESS; 675 } 676 return VERR_INTERNAL_ERROR_4; 616 677 } 617 678 … … 619 680 void VBOXCALL supdrvOSLdrUnload(PSUPDRVDEVEXT pDevExt, PSUPDRVLDRIMAGE pImage) 620 681 { 621 NOREF(pDevExt); NOREF(pImage); 682 if (pImage->pvNtSectionObj) 683 { 684 NTSTATUS rc = ZwSetSystemInformation(MY_SystemUnloadGdiDriverInformation, 685 &pImage->pvNtSectionObj, sizeof(pImage->pvNtSectionObj)); 686 } 687 NOREF(pDevExt); 622 688 } 623 689
Note:
See TracChangeset
for help on using the changeset viewer.