1
一个D3D11device我如何获得一个指向虚函数表在此:正确的指针,虚函数表
ID3D11Device *dev; //the pointer to the device interface
这就是我现在所拥有的,我不认为这是正确的。
uintptr_t* pInterfaceVTable = *(uintptr_t**)dev;
如果是这样,那么我如何获得成员函数呢?再次,这就是我现在所拥有的。
uintptr_t** g_deviceFunctionAddresses = new uintptr_t*[D3D11_DEVICE_METHOD_COUNT];
if(dev != NULL && swapchain != NULL){
for(int i=0; i<D3D11_DEVICE_METHOD_COUNT; i++){
g_deviceFunctionAddresses[i] = (uintptr_t*)pInterfaceVTable[i];
}
smplvtablefunction = pInterfaceVTable[functionoffset];
}
我一直在这上面停留了一段时间。
'DWORD * vt = * reinterpret_cast(dev);'每个索引是32位程序中的一个函数(4字节指针)。 –
Brandon
2014-12-04 03:58:24