{"issue":{"state":"open","created_at":"2011-11-20T06:33:46Z","updated_at":"2011-11-20T06:33:46Z","comments":0,"user":{"gravatar_id":"0e9734f8619bfb91123005240c35dafd","id":1207779,"url":"https://api.github.com/users/jbry","login":"jbry","avatar_url":"https://secure.gravatar.com/avatar/0e9734f8619bfb91123005240c35dafd?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png"},"body":"ReceiveFile on the window oibc will deadlock.\r\n\r\nThe function is written in a way that appears to always make that happen (that or a lucky race condition before stopped it).\r\n\r\nThere are several issues:\r\n1) After using ReadFile with the overlapped flag set, GetOverlappedResult should be used to check how many bytes were read, as the parameter will always come back 0. (This can also be used instead of WaitForSingleObject) \r\n2) EnterCriticalSection for gReadSection seems to be entered before WriteFile is called. The gReadSection is locked by waiting for the device to output some information, this of course won't happen as it is sitting idly. The EnterCriticalSection should be moved after the WriteFile\r\n3) WriteFile and ReadFile in receiveFile both need to have the &rfOverlapped parameter added to them, otherwise you will get an error\r\n4) sprintf when building the receivefile command, %ul is not a valid token (VS2010 C++ express at least)\r\n\r\nThe rest of it seems to work fine","assignee":null,"id":2291448,"labels":[],"pull_request":{"patch_url":null,"html_url":null,"diff_url":null},"number":19,"title":"Cannot use windows oibc to receive a file","closed_at":null,"html_url":"https://github.com/iDroid-Project/openiBoot/issues/19","milestone":null,"url":"https://api.github.com/repos/iDroid-Project/openiBoot/issues/19"},"action":"opened"}