atapi.net icon indicating copy to clipboard operation
atapi.net copied to clipboard

lineOpen failed; The operation failed for unspecified reasons

Open chiekku opened this issue 3 years ago • 2 comments

The sample apps work fine, but in my own app (Win 10, .NET Core 3.1 -> referencing ATAPI project source), the line fails to open:

lineOpen failed [0xFFFFFFFF80000048] The operation failed for unspecified reasons

The error code is LINEERR_OPERATIONFAILED

I'm explicitly targeting x86 (32-bit) for hardware reasons. I can initialized TapiManager fine and get my lines. I'm following the examples and passing in the available media modes when opening the line:

        line.Open(line.Capabilities.MediaModes);             

When I follow into the open call, it fails at Line 1157 in TapiLine.cs:

int rc = NativeMethods.lineOpen(_mgr.LineHandle, _deviceId, out hLine, _negotiatedVersion, _negotiatedExtVersion,
                Marshal.GetFunctionPointerForDelegate(_lcb), privilege, (int) mediaMode, ref lcp);

returns

-2147483576

which is obviously a bad pointer. Everything being passed into the native call is valid and not null, so it's failing somewhere during the interop part. It looks like Interop.cs explicitly points to TAPI32.dll:

[DllImport("Tapi32.dll", EntryPoint = "lineOpenW", CharSet = CharSet.Auto)]
internal static extern int lineOpen(HTLINEAPP hLineApp, int dwDeviceID, out uint hLine, int dwAPIVersion, int dwExtVersion, IntPtr dwCallbackInstance, int dwPrivileges, int dwMediaModes, ref LINECALLPARAMS lpCallParams);

I do have the TAPI32 dll in System32. I've tried two different modems, and tried explicitly setting the media mode, but it errors out the same way. It's probably something dumb I'm doing, but I can't figure it out.

chiekku avatar Oct 20 '20 02:10 chiekku