> hr = WmGetObject(IID_IWMProvider, (LPVOID*) > &ports[portid].prov); > > if (FAILED(hr)) { > > CloseHandle(ports[portid].overlap.hEvent); > > portid = GetLastError() & 0x80000000; Uhm... this should be a bitwise or '|', not an and '&'. I checked in a fix. Thanks.