Changeset 86160 in vbox for trunk/src/VBox
- Timestamp:
- Sep 17, 2020 5:10:14 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Debugger/DBGCRemoteKd.cpp
r86155 r86160 56 56 #define NTSTATUS_NOT_IMPLEMENTED UINT32_C(0xc0000002) 57 57 58 /** Offset where the KD version block pointer is stored in the KPCR. 59 * From: https://www.geoffchappell.com/studies/windows/km/ntoskrnl/structs/kprcb/amd64.htm */ 60 #define KD_KPCR_VERSION_BLOCK_ADDR_OFF 0x34 58 61 59 62 /********************************************************************************************************************************* … … 523 526 /** Pointer to a const 64bit get version manipulate payload. */ 524 527 typedef const KDPACKETMANIPULATE_GETVERSION64 *PCKDPACKETMANIPULATE_GETVERSION64; 528 529 530 /** @name Get version flags. 531 * @{ */ 532 /** Flag whether this is a multi processor kernel. */ 533 #define KD_PACKET_MANIPULATE64_GET_VERSION_F_MP RT_BIT_32(0) 534 /** Flag whether the pointer is 64bit. */ 535 #define KD_PACKET_MANIPULATE64_GET_VERSION_F_PTR64 RT_BIT_32(2) 536 /** @} */ 525 537 526 538 … … 1888 1900 Resp.Hdr.u32NtStatus = NTSTATUS_SUCCESS; 1889 1901 1890 #if 01891 1902 /* Build our own response in case there is no Windows interface available. */ 1903 uint32_t NtBuildNumber = 0x0f2800; /* Used when there is no NT interface available, which probably breaks symbol loading. */ 1904 bool f32Bit = false; 1892 1905 if (pThis->pIfWinNt) 1893 1906 { 1894 RTGCUINTPTR GCPtrKpcr = 0; 1895 1896 int rc = pThis->pIfWinNt->pfnQueryKpcrForVCpu(pThis->pIfWinNt, pThis->Dbgc.pUVM, Resp.Hdr.idCpu, 1897 &GCPtrKpcr, NULL /*pKpcrb*/); 1907 int rc = pThis->pIfWinNt->pfnQueryVersion(pThis->pIfWinNt, pThis->Dbgc.pUVM, 1908 NULL /*puVersMajor*/, NULL /*puVersMinor*/, 1909 &NtBuildNumber, &f32Bit); 1898 1910 if (RT_SUCCESS(rc)) 1899 { 1900 DBGFADDRESS AddrKdVersionBlock; 1901 DBGFR3AddrFromFlat(pThis->Dbgc.pUVM, &AddrKdVersionBlock, GCPtrKpcr + 0x108); 1902 rc = DBGFR3MemRead(pThis->Dbgc.pUVM, Resp.Hdr.idCpu, &AddrKdVersionBlock, &Resp.u.GetVersion, sizeof(Resp.u.GetVersion)); 1903 } 1904 } 1911 rc = pThis->pIfWinNt->pfnQueryKernelPtrs(pThis->pIfWinNt, pThis->Dbgc.pUVM, &Resp.u.GetVersion.u64PtrKernBase, 1912 &Resp.u.GetVersion.u64PtrPsLoadedModuleList); 1913 } 1914 1915 /* Fill in the request specific part. */ 1916 Resp.u.GetVersion.u16VersMaj = NtBuildNumber >> 16; 1917 Resp.u.GetVersion.u16VersMin = NtBuildNumber & UINT32_C(0xffff); 1918 Resp.u.GetVersion.u8VersProtocol = 0x6; /* From a Windows 10 guest. */ 1919 Resp.u.GetVersion.u8VersKdSecondary = 0x2; /* From a Windows 10 guest. */ 1920 Resp.u.GetVersion.fFlags = KD_PACKET_MANIPULATE64_GET_VERSION_F_MP; 1921 Resp.u.GetVersion.u8MaxPktType = KD_PACKET_HDR_SUB_TYPE_MAX; 1922 Resp.u.GetVersion.u8MaxStateChange = KD_PACKET_STATE_CHANGE_MAX - KD_PACKET_STATE_CHANGE_MIN; 1923 Resp.u.GetVersion.u8MaxManipulate = KD_PACKET_MANIPULATE_REQ_MAX - KD_PACKET_MANIPULATE_REQ_MIN; 1924 Resp.u.GetVersion.u64PtrDebuggerDataList = 0; 1925 1926 if (f32Bit) 1927 Resp.u.GetVersion.u16MachineType = IMAGE_FILE_MACHINE_I386; 1905 1928 else 1906 #endif 1907 { 1908 /* Fill in the request specific part, the static parts are from an amd64 Windows 10 guest. */ 1909 Resp.u.GetVersion.u16VersMaj = 0x0f; 1910 Resp.u.GetVersion.u16VersMin = 0x2800; 1911 Resp.u.GetVersion.u8VersProtocol = 0x6; /** From a Windows 10 guest. */ 1912 Resp.u.GetVersion.u8VersKdSecondary = 0x2; /** From a Windows 10 guest. */ 1913 Resp.u.GetVersion.fFlags = 0x5; /** 64bit pointer. */ 1914 Resp.u.GetVersion.u16MachineType = IMAGE_FILE_MACHINE_AMD64; 1915 Resp.u.GetVersion.u8MaxPktType = KD_PACKET_HDR_SUB_TYPE_MAX; 1916 Resp.u.GetVersion.u8MaxStateChange = KD_PACKET_STATE_CHANGE_MAX - KD_PACKET_STATE_CHANGE_MIN; 1917 Resp.u.GetVersion.u8MaxManipulate = KD_PACKET_MANIPULATE_REQ_CLEAR_ALL_INTERNAL_BKPT - KD_PACKET_MANIPULATE_REQ_MIN; 1918 Resp.u.GetVersion.u64PtrDebuggerDataList = 0 ;//0xfffff800deadc0de; 1919 } 1920 1921 /* Try to fill in the rest using the OS digger interface if available. */ 1922 int rc = VINF_SUCCESS; 1923 if (pThis->pIfWinNt) 1924 rc = pThis->pIfWinNt->pfnQueryKernelPtrs(pThis->pIfWinNt, pThis->Dbgc.pUVM, &Resp.u.GetVersion.u64PtrKernBase, 1925 &Resp.u.GetVersion.u64PtrPsLoadedModuleList); 1926 else 1927 { 1928 /** @todo */ 1929 } 1930 1931 if (RT_SUCCESS(rc)) 1932 rc = dbgcKdCtxPktSend(pThis, KD_PACKET_HDR_SIGNATURE_DATA, KD_PACKET_HDR_SUB_TYPE_STATE_MANIPULATE, 1933 &Resp, sizeof(Resp), true /*fAck*/); 1934 1935 return rc; 1929 { 1930 Resp.u.GetVersion.u16MachineType = IMAGE_FILE_MACHINE_AMD64; 1931 Resp.u.GetVersion.fFlags |= KD_PACKET_MANIPULATE64_GET_VERSION_F_PTR64; 1932 } 1933 1934 return dbgcKdCtxPktSend(pThis, KD_PACKET_HDR_SIGNATURE_DATA, KD_PACKET_HDR_SUB_TYPE_STATE_MANIPULATE, 1935 &Resp, sizeof(Resp), true /*fAck*/); 1936 1936 } 1937 1937
Note:
See TracChangeset
for help on using the changeset viewer.