ATAPI on Win 7 x64bit

Jul 31, 2013 at 2:24 PM

I'm having some problems with ATAPI on a Win7 x64bit operating system.

When making a call with the Phone example application (build for 64bit) it hangs/freezes in TapiAddress.cs line 863:

The call is made (I can see it on the phone that I just called) however the ActiveCall form is never shown, because the program doesn't advance that far.

When the application is built for 32bit it works, however I need to make it work for 64bit too.
Aug 2, 2013 at 8:21 AM
I have found the problem, and it seems that might be a bug in ATAPI.

In Interop.cs there is the following structure:
internal struct LINEMESSAGE
    internal IntPtr hDevice;                         // TAPI v2.0
    internal TapiEvent dwMessageID;                  // TAPI v2.0
    internal IntPtr dwCallbackInstance;              // TAPI v2.0
    internal IntPtr dwParam1;                        // TAPI v2.0
    internal IntPtr dwParam2;                        // TAPI v2.0
    internal IntPtr dwParam3;                        // TAPI v2.0
however hDevice in Tapi.h is declared as DWORD, that means that on the tapi side hDevice's size will always be 4, however on our side it will be 8 when we build it in 64bit environment. My suggestion is to change the type of hDevice to something that always has the size of 4.
Aug 2, 2013 at 2:30 PM
You will find this all over the place. ATAPI was built before x64 was around/popular - I originally used .NET 1.0 and then moved it to 2.0 later. So all the signatures are for x86. In order to make this work with 64-bit, you will need to take the source and modify all the interop structures based on the current Win32/64 headers, possibly building two different DLLs. I've not attempted it because I have no need for a 64-bit implementation - I have no 64-bit TSPs to even try it on! But if you are up for the task, it should be fairly straight forward and I'm sure others could use the work! Contact me offline if you are interested - mark at and we'll see about getting you contributor access to the project...

Sep 9, 2013 at 10:26 PM
The official 64-bit version is 1.04 -- it is in the source code form, or available via Nuget if you search for TAPI and pick ATAPI 64-bit.
Sep 27, 2013 at 10:15 PM
Edited Sep 27, 2013 at 10:35 PM
I have had a simmilar problem with version 1.4.0 x64 on Windows 8.
I found the Problem:

In TapiManager.cs Row 625:

if (msg.dwCallbackInstance.ToInt32() != 0)

should be changed to

if (msg.dwCallbackInstance.ToInt64() != 0)

I have had a arithmetic overflow at that point.
Oct 1, 2013 at 3:49 PM
msg.dwCallbackInstance != IntPtr.Zero would be the preferred method for comparing IntPtrs to zero.

Oct 2, 2013 at 2:59 PM
I added a fix into the current source tree - it's not an official build (yet) but you can grab the current source code and build it.