Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lineOpen failed; The operation failed for unspecified reasons #33

Open
chiekku opened this issue Oct 20, 2020 · 2 comments
Open

lineOpen failed; The operation failed for unspecified reasons #33

chiekku opened this issue Oct 20, 2020 · 2 comments

Comments

@chiekku
Copy link

chiekku commented Oct 20, 2020

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
Copy link
Author

chiekku commented Oct 20, 2020

Made some progress. For some reason Monitor() works, but it's very limited in what I can do:

            line.Monitor(); // works

            if (ValidateLine(line) && !line.IsOpen)
            {
                // skips this because Monitor technically opens the line
                line.Open(line.Capabilities.MediaModes, CurrentAddress.Id); 
                return;
            }

Bug?

@markjulmar
Copy link
Owner

Possibly -- the library wasn't written for .NET Core - it was written against .NET 4.0 - 4.5 so it's hard to say how well it works against the latest portable .NET runtime.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants