本文整理汇总了Python中dllretrace.DllRetracer类的典型用法代码示例。如果您正苦于以下问题:Python DllRetracer类的具体用法?Python DllRetracer怎么用?Python DllRetracer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了DllRetracer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: retraceApi
def retraceApi(self, api):
print 'static const GUID GUID_D3DRETRACE = {0x7D71CAC9,0x7F58,0x432C,{0xA9,0x75,0xA1,0x9F,0xCF,0xCE,0xFD,0x14}};'
print
self.table_name = 'd3dretrace::%s_callbacks' % api.name.lower()
Retracer.retraceApi(self, api)
示例2: invokeFunction
def invokeFunction(self, function):
if function.name in self.createDeviceFunctionNames:
# create windows as neccessary
if 'pSwapChainDesc' in function.argNames():
print r' d3dretrace::createWindowForSwapChain(pSwapChainDesc);'
# Compensate for the fact we don't trace DXGI object creation
if function.name.startswith('D3D11CreateDevice'):
print r' if (DriverType == D3D_DRIVER_TYPE_UNKNOWN && !pAdapter) {'
print r' DriverType = D3D_DRIVER_TYPE_HARDWARE;'
print r' }'
if function.name.startswith('D3D10CreateDevice'):
# Toggle debugging
print r' if (retrace::debug >= 2) {'
print r' Flags |= D3D10_CREATE_DEVICE_DEBUG;'
print r' } else if (retrace::debug < 0) {'
print r' Flags &= ~D3D10_CREATE_DEVICE_DEBUG;'
print r' }'
# Force driver
self.forceDriver('D3D10_DRIVER_TYPE')
if function.name.startswith('D3D11CreateDevice'):
# Toggle debugging
print r' if (retrace::debug >= 2) {'
print r' Flags |= D3D11_CREATE_DEVICE_DEBUG;'
print r' } else if (retrace::debug < 0) {'
print r' Flags &= ~D3D11_CREATE_DEVICE_DEBUG;'
print r' }'
# Force driver
self.forceDriver('D3D_DRIVER_TYPE')
Retracer.invokeFunction(self, function)
示例3: retraceApi
def retraceApi(self, api):
print '// Swizzling mapping for lock addresses'
print 'typedef std::pair<void *, UINT> MappingKey;'
print 'static std::map<MappingKey, void *> _maps;'
print
Retracer.retraceApi(self, api)
示例4: retraceApi
def retraceApi(self, api):
print '// Swizzling mapping for lock addresses'
print 'static std::map<void *, void *> _maps;'
print
self.table_name = 'd3dretrace::dxgi_callbacks'
Retracer.retraceApi(self, api)
示例5: retraceApi
def retraceApi(self, api):
print '// Swizzling mapping for lock addresses, mapping a (pDeviceContext, pResource, Subresource) -> void *'
print 'typedef std::pair< IUnknown *, UINT > SubresourceKey;'
print 'static std::map< IUnknown *, std::map< SubresourceKey, void * > > g_Maps;'
print
self.table_name = 'd3dretrace::dxgi_callbacks'
Retracer.retraceApi(self, api)
示例6: doInvokeInterfaceMethod
def doInvokeInterfaceMethod(self, interface, method):
Retracer.doInvokeInterfaceMethod(self, interface, method)
# Keep retrying ID3D11VideoContext::DecoderBeginFrame when returns E_PENDING
if interface.name == 'ID3D11VideoContext' and method.name == 'DecoderBeginFrame':
print r' while (_result == D3DERR_WASSTILLDRAWING || _result == E_PENDING) {'
print r' Sleep(1);'
Retracer.doInvokeInterfaceMethod(self, interface, method)
print r' }'
示例7: retraceApi
def retraceApi(self, api):
print '// Swizzling mapping for lock addresses'
print 'static std::map<void *, void *> _maps;'
print
# TODO: Keep a table of windows
print 'static HWND g_hWnd;'
print
Retracer.retraceApi(self, api)
示例8: extractArg
def extractArg(self, function, arg, arg_type, lvalue, rvalue):
# Handle DDCREATE_* flags
if arg.type is DDCREATE_LPGUID:
print ' if (%s.toArray()) {' % rvalue
Retracer.extractArg(self, function, arg, arg_type, lvalue, rvalue)
print ' } else {'
print ' %s = static_cast<%s>(%s.toPointer());' % (lvalue, arg_type, rvalue)
print ' }'
return
Retracer.extractArg(self, function, arg, arg_type, lvalue, rvalue)
示例9: handleFailure
def handleFailure(self, interface, methodOrFunction):
# Catch when device is removed, and report the reason.
if interface is not None:
getDeviceRemovedReasonMethod = interface.getMethodByName("GetDeviceRemovedReason")
if getDeviceRemovedReasonMethod is not None:
print r' if (_result == DXGI_ERROR_DEVICE_REMOVED) {'
print r' HRESULT _reason = _this->GetDeviceRemovedReason();'
print r' retrace::failed(call, _reason);'
print r' exit(EXIT_FAILURE);'
print r' }'
Retracer.handleFailure(self, interface, methodOrFunction)
示例10: invokeInterfaceMethod
def invokeInterfaceMethod(self, interface, method):
# keep track of the last used device for state dumping
if interface.name in ('IDirect3DDevice9', 'IDirect3DDevice9Ex'):
print r' d3dretrace::pLastDirect3DDevice9 = _this;'
# create windows as neccessary
if method.name in ('CreateDevice', 'CreateDeviceEx', 'CreateAdditionalSwapChain'):
print r' HWND hWnd = d3dretrace::createWindow(pPresentationParameters->BackBufferWidth, pPresentationParameters->BackBufferHeight);'
print r' pPresentationParameters->hDeviceWindow = hWnd;'
if 'hFocusWindow' in method.argNames():
print r' hFocusWindow = hWnd;'
if method.name in ('Reset', 'ResetEx'):
print r' if (pPresentationParameters->Windowed) {'
print r' d3dretrace::resizeWindow(pPresentationParameters->hDeviceWindow, pPresentationParameters->BackBufferWidth, pPresentationParameters->BackBufferHeight);'
print r' }'
# notify frame has been completed
if method.name == 'Present':
print r' retrace::frameComplete(call);'
print r' hDestWindowOverride = NULL;'
if 'pSharedHandle' in method.argNames():
print r' if (pSharedHandle) {'
print r' retrace::warning(call) << "shared surfaces unsupported\n";'
print r' pSharedHandle = NULL;'
print r' }'
Retracer.invokeInterfaceMethod(self, interface, method)
# process events after presents
if method.name == 'Present':
print r' d3dretrace::processEvents();'
# check errors
if str(method.type) == 'HRESULT':
print r' if (FAILED(_result)) {'
print r' retrace::warning(call) << "failed\n";'
print r' }'
if method.name in ('Lock', 'LockRect', 'LockBox'):
print ' VOID *_pbData = NULL;'
print ' size_t _LockedSize = 0;'
print ' _getLockInfo(_this, %s, _pbData, _LockedSize);' % ', '.join(method.argNames()[:-1])
print ' _this->SetPrivateData(GUID_D3DRETRACE, &_pbData, sizeof _pbData, 0);'
if method.name in ('Unlock', 'UnlockRect', 'UnlockBox'):
print ' VOID *_pbData = 0;'
print ' DWORD dwSizeOfData = sizeof _pbData;'
print ' _this->GetPrivateData(GUID_D3DRETRACE, &_pbData, &dwSizeOfData);'
print ' if (_pbData) {'
print ' retrace::delRegionByPointer(_pbData);'
print ' }'
示例11: handleFailure
def handleFailure(self, interface, methodOrFunction):
if methodOrFunction.name in self.createDeviceMethodNames:
print r' exit(EXIT_FAILURE);'
return
# https://msdn.microsoft.com/en-us/library/windows/desktop/bb324479.aspx
if methodOrFunction.name in ('Present', 'PresentEx'):
print r' if (_result == D3DERR_DEVICELOST) {'
print r' exit(EXIT_FAILURE);'
print r' }'
Retracer.handleFailure(self, interface, methodOrFunction)
示例12: invokeFunction
def invokeFunction(self, function):
if function.name in ('Direct3DCreate9', 'Direct3DCreate9Ex'):
print 'if (retrace::debug && !g_szD3D9DllName) {'
print ' /* '
print ' * XXX: D3D9D only works for simple things, it often introduces errors'
print ' * on complex traces, or traces which use unofficial D3D9 features.'
print ' */'
print ' if (0) {'
print ' g_szD3D9DllName = "d3d9d.dll";'
print ' }'
print '}'
Retracer.invokeFunction(self, function)
示例13: extractArg
def extractArg(self, function, arg, arg_type, lvalue, rvalue):
# Set object names
if function.name == 'SetPrivateData' and arg.name == 'pData':
iid = function.args[0].name
print r' if (%s != WKPDID_D3DDebugObjectName) {' % iid
print r' return;'
print r' }'
# Interpret argument as string
Retracer.extractArg(self, function, arg, LPCSTR, lvalue, rvalue)
print r' assert(pData);'
print r' assert(DataSize == strlen((const char *)pData));'
return
Retracer.extractArg(self, function, arg, arg_type, lvalue, rvalue)
示例14: invokeFunction
def invokeFunction(self, function):
if function.name in ('Direct3DCreate9', 'Direct3DCreate9Ex'):
print 'if (retrace::debug >= 2 && !g_szD3D9DllName && LoadLibraryA("d3d9d.dll")) {'
print ' /*'
print ' * D3D9D only works for simple applications, it will often report bogus errors'
print ' * on complex traces, or traces which use unofficial D3D9 features.'
print ' */'
print ' g_szD3D9DllName = "d3d9d.dll";'
print ' SDKVersion |= 0x80000000;'
print '} else {'
print ' SDKVersion &= ~0x80000000;'
print '}'
Retracer.invokeFunction(self, function)
示例15: retraceApi
def retraceApi(self, api):
print '// Swizzling mapping for lock addresses'
print 'static std::map<void *, void *> _maps;'
print
print r'''
static void
createWindow(DXGI_SWAP_CHAIN_DESC *pSwapChainDesc) {
UINT Width = pSwapChainDesc->BufferDesc.Width;
UINT Height = pSwapChainDesc->BufferDesc.Height;
if (!Width) Width = 1024;
if (!Height) Height = 768;
pSwapChainDesc->OutputWindow = d3dretrace::createWindow(Width, Height);
}
'''
self.table_name = 'd3dretrace::dxgi_callbacks'
Retracer.retraceApi(self, api)