<div dir="ltr"><div dir="ltr"><div class="gmail_default" style="font-family:arial,sans-serif">On Fri, Mar 11, 2022 at 11:47 AM Zebediah Figura <<a href="mailto:zfigura@codeweavers.com" target="_blank">zfigura@codeweavers.com</a>> wrote:<br>> On 3/10/22 22:57, Mohamad Al-Jaf wrote:<br>> > +/***********************************************************************<br>> > + *           WinUsb_Free (winusb.@)<br>> > + */<br>> > +BOOL WINAPI WinUsb_Free(WINUSB_INTERFACE_HANDLE handle)<br>> > +{<br>> > +    FIXME( "(%p) - semi-stub\n", handle );<br>> > +    if (handle) HeapFree( GetProcessHeap(), 0, handle );<br>> > +    return TRUE;<br>> > +}<br>><br>> This doesn't make any sense by itself. Where is that handle coming from?<br><br>Hi Zebediah,<br><br>Thanks for the feedback.<br><br>Yeah, it doesn't make sense to me either. I asked about this in my previous patch, but no one replied.<br><br>> Also, I thought about adding heap_free(handle) to make this<br>> into a semi-stub, but wouldn't that cause heap corruption<br>> since the handle is not initialized? I'm not sure why<br>> it's being called first and not the function that<br>> initializes WINUSB_INTERFACE_HANDLE.<br><br>I don't know why the game calls WinUsb_Free prior to initializing the handle. What is it passing, a NULL pointer? If not, where did it get the handle?<br><br>This is why I added the if statement.<br><br>Also, this doesn't seem to be affecting just this game, but an application called REVELPROG-IS.[1] It too calls WinUsb_Free prior to initializing a handle.<br><br>Perhaps they're creating a SafeWinUsbHandle, in which case the handle can be assigned IntPtr.Zero before WinUsb_Free is called, but again this appears to be a NULL pointer.[2]<br><br>In any case, would it cause a problem to leave this function as a semi-stub? The if statement should prevent HeapFree from attempting to free a NULL pointer. If not, I can resubmit the original stub.<br><br>This patch isn't intended to fix applications that rely on winusb, just games. Proton just disabled the dll to fix the issue and this is why I offered to stub the entire dll even though it's likely not needed. The native dll can be used for applications, but seeing as how it's a Windows driver I don't think it would work properly, if at all.<br><br>[1] <a href="https://forum.reveltronics.com/viewtopic.php?p=2579&sid=ee42ab8a5b5737fb909eaabb39daaa15#p2579" target="_blank">https://forum.reveltronics.com/viewtopic.php?p=2579&sid=ee42ab8a5b5737fb909eaabb39daaa15#p2579</a><br>[2] <a href="https://books.google.ca/books?id=pkefBgAAQBAJ&pg=PA319&lpg=PA319&dq=SafeWinUsbHandle+winusb_free&source=bl&ots=6-kwcOzvyG&sig=ACfU3U1BahyBUO0oIzH8Gfrrc0XEkvM_SA&hl=en&sa=X&ved=2ahUKEwiyzpfpmr_2AhWgAZ0JHfUaAKIQ6AF6BAgEEAM#v=onepage&q=SafeWinUsbHandle%20winusb_free&f=false" target="_blank">https://books.google.ca/books?id=pkefBgAAQBAJ&pg=PA319&lpg=PA319&dq=SafeWinUsbHandle+winusb_free&source=bl&ots=6-kwcOzvyG&sig=ACfU3U1BahyBUO0oIzH8Gfrrc0XEkvM_SA&hl=en&sa=X&ved=2ahUKEwiyzpfpmr_2AhWgAZ0JHfUaAKIQ6AF6BAgEEAM#v=onepage&q=SafeWinUsbHandle%20winusb_free&f=false</a><br><br>--<br>Kind regards,<br>Mohamad<br></div></div></div>