The addition of the Microsoft.WindowsMobile.Telephony assembly in the Windows Mobile 5.0 PocketPC/Smartphone SDKs makes dialing the device telephone using the .NET Compact Framework about as easy as it gets.
Phone myPhone = new Phone();
myPhone.Talk("6035551212");
As you would expect, the managed implementation of talk actually calls the native function PhoneMakeCall. Well it turns out that there's a bug in the implementation of Phone.Talk where the string containing the phone number is passed to PhoneMakeCall without adding null termination.
As a result, just like when passing a non-null terminated string in C/C++, you'll get random results when calling Phone.Talk. Sometimes it will work, sometimes it will add random characters to the end of the phone number. It may even potentially crash.
Fortunately the fix is easy; explicitly include the null termination when calling Phone.Talk.
Phone myPhone = new Phone();
myPhone.Talk("6035551212\0");
Although easily fixed, this problem could be a nightmare if not addressed. You'll want to be sure and verify that you handle this bug.
Posted
Jan 20 2006, 04:13 PM
by
jim-wilson