Skip to content

Commit

Permalink
Fix potential crash in FindDevice()
Browse files Browse the repository at this point in the history
  • Loading branch information
elishacloud committed Nov 21, 2024
1 parent 5b24fa2 commit b53deaf
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Dllmain/BuildNo.rc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
#define BUILD_NUMBER 7333
#define BUILD_NUMBER 7334
12 changes: 8 additions & 4 deletions ddraw/IDirect3DX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -593,10 +593,14 @@ HRESULT m_IDirect3DX::FindDevice(LPD3DFINDDEVICESEARCH lpD3DFDS, LPD3DFINDDEVICE
if (CallbackContext.Found)
{
lpD3DFDR->guid = CallbackContext.DeviceDesc7.deviceGUID;
lpD3DFDR->ddHwDesc.dwSize = (lpD3DFDR->dwSize - sizeof(DWORD) - sizeof(GUID)) / 2;
ConvertDeviceDesc(lpD3DFDR->ddHwDesc, CallbackContext.DeviceDesc7);
lpD3DFDR->ddSwDesc.dwSize = (lpD3DFDR->dwSize - sizeof(DWORD) - sizeof(GUID)) / 2;
ConvertDeviceDesc(lpD3DFDR->ddSwDesc, CallbackContext.DeviceDesc7);
if (lpD3DFDR->ddHwDesc.dwSize)
{
ConvertDeviceDesc(lpD3DFDR->ddHwDesc, CallbackContext.DeviceDesc7);
}
if (lpD3DFDR->ddSwDesc.dwSize)
{
ConvertDeviceDesc(lpD3DFDR->ddSwDesc, CallbackContext.DeviceDesc7);
}

return D3D_OK;
}
Expand Down

0 comments on commit b53deaf

Please sign in to comment.