Changeset 47039 in vbox for trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm
- Timestamp:
- Jul 8, 2013 1:19:00 PM (11 years ago)
- Location:
- trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPMisc.cpp
r46966 r47039 659 659 #define VBOXWDDM_REG_DISPLAYSETTINGSVIDEOKEY_SUBKEY L"\\Video" 660 660 661 NTSTATUS vboxWddmRegQueryVideoGuidString(ULONG cbBuf, PWCHAR pBuf, PULONG pcbResult) 662 { 663 HANDLE hKey; 664 NTSTATUS Status = vboxWddmRegOpenKey(&hKey, VBOXWDDM_REG_DISPLAYSETTINGSVIDEOKEY, GENERIC_READ); 661 NTSTATUS vboxWddmRegQueryVideoGuidString(PVBOXMP_DEVEXT pDevExt, ULONG cbBuf, PWCHAR pBuf, PULONG pcbResult) 662 { 663 BOOLEAN fNewMethodSucceeded = FALSE; 664 HANDLE hKey = NULL; 665 NTSTATUS Status = IoOpenDeviceRegistryKey(pDevExt->pPDO, PLUGPLAY_REGKEY_DEVICE, GENERIC_READ, &hKey); 666 if (NT_SUCCESS(Status)) 667 { 668 struct 669 { 670 KEY_VALUE_PARTIAL_INFORMATION Info; 671 UCHAR Buf[1024]; /* should be enough */ 672 } KeyData; 673 ULONG cbResult; 674 UNICODE_STRING RtlStr; 675 RtlInitUnicodeString(&RtlStr, L"VideoID"); 676 Status = ZwQueryValueKey(hKey, 677 &RtlStr, 678 KeyValuePartialInformation, 679 &KeyData.Info, 680 sizeof(KeyData), 681 &cbResult); 682 if (NT_SUCCESS(Status)) 683 { 684 if (KeyData.Info.Type == REG_SZ) 685 { 686 fNewMethodSucceeded = TRUE; 687 *pcbResult = KeyData.Info.DataLength + 2; 688 if (cbBuf >= KeyData.Info.DataLength) 689 { 690 memcpy(pBuf, KeyData.Info.Data, KeyData.Info.DataLength + 2); 691 Status = STATUS_SUCCESS; 692 } 693 else 694 Status = STATUS_BUFFER_TOO_SMALL; 695 } 696 } 697 else 698 { 699 WARN(("ZwQueryValueKey failed, Status 0x%x", Status)); 700 } 701 702 NTSTATUS tmpStatus = ZwClose(hKey); 703 Assert(tmpStatus == STATUS_SUCCESS); 704 } 705 else 706 { 707 WARN(("IoOpenDeviceRegistryKey failed Status 0x%x", Status)); 708 } 709 710 if (fNewMethodSucceeded) 711 return Status; 712 else 713 WARN(("failed to acquire the VideoID, falling back to the old impl")); 714 715 Status = vboxWddmRegOpenKey(&hKey, VBOXWDDM_REG_DISPLAYSETTINGSVIDEOKEY, GENERIC_READ); 665 716 Assert(Status == STATUS_SUCCESS); 666 717 if (Status == STATUS_SUCCESS) … … 744 795 } 745 796 746 NTSTATUS vboxWddmRegOpenKey (OUT PHANDLE phKey, IN PWCHAR pName, IN ACCESS_MASK fAccess)797 NTSTATUS vboxWddmRegOpenKeyEx(OUT PHANDLE phKey, IN HANDLE hRootKey, IN PWCHAR pName, IN ACCESS_MASK fAccess) 747 798 { 748 799 OBJECT_ATTRIBUTES ObjAttr; … … 750 801 751 802 RtlInitUnicodeString(&RtlStr, pName); 752 InitializeObjectAttributes(&ObjAttr, &RtlStr, OBJ_CASE_INSENSITIVE | OBJ_KERNEL_HANDLE, NULL, NULL);803 InitializeObjectAttributes(&ObjAttr, &RtlStr, OBJ_CASE_INSENSITIVE | OBJ_KERNEL_HANDLE, hRootKey, NULL); 753 804 754 805 return ZwOpenKey(phKey, fAccess, &ObjAttr); 806 } 807 808 NTSTATUS vboxWddmRegOpenKey(OUT PHANDLE phKey, IN PWCHAR pName, IN ACCESS_MASK fAccess) 809 { 810 return vboxWddmRegOpenKeyEx(phKey, NULL, pName, fAccess); 755 811 } 756 812 … … 878 934 WCHAR VideoGuidBuf[512]; 879 935 ULONG cbVideoGuidBuf = sizeof (VideoGuidBuf); 880 NTSTATUS Status = vboxWddmRegQueryVideoGuidString( cbVideoGuidBuf, VideoGuidBuf, &cbVideoGuidBuf);936 NTSTATUS Status = vboxWddmRegQueryVideoGuidString(pDevExt ,cbVideoGuidBuf, VideoGuidBuf, &cbVideoGuidBuf); 881 937 Assert(Status == STATUS_SUCCESS); 882 938 if (Status == STATUS_SUCCESS) -
trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPMisc.h
r46757 r47039 91 91 NTSTATUS vboxWddmRegDisplaySettingsQueryRelY(HANDLE hKey, int * pResult); 92 92 NTSTATUS vboxWddmDisplaySettingsQueryPos(IN PVBOXMP_DEVEXT pDeviceExtension, D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId, POINT * pPos); 93 NTSTATUS vboxWddmRegQueryVideoGuidString( ULONG cbBuf, PWCHAR pBuf, PULONG pcbResult);93 NTSTATUS vboxWddmRegQueryVideoGuidString(PVBOXMP_DEVEXT pDevExt, ULONG cbBuf, PWCHAR pBuf, PULONG pcbResult); 94 94 95 95 NTSTATUS vboxWddmRegQueryDrvKeyName(PVBOXMP_DEVEXT pDevExt, ULONG cbBuf, PWCHAR pBuf, PULONG pcbResult); 96 96 97 NTSTATUS vboxWddmRegOpenKeyEx(OUT PHANDLE phKey, IN HANDLE hRootKey, IN PWCHAR pName, IN ACCESS_MASK fAccess); 97 98 NTSTATUS vboxWddmRegOpenKey(OUT PHANDLE phKey, IN PWCHAR pName, IN ACCESS_MASK fAccess); 98 99 NTSTATUS vboxWddmRegQueryValueDword(IN HANDLE hKey, IN PWCHAR pName, OUT PDWORD pDword);
Note:
See TracChangeset
for help on using the changeset viewer.