I've successfully built the SMS sample project came with the D211 SDK.
But when I ran it,the D211Ctl Panic with Illegal Operation & shut down immediately.Why?
It executed without anyerror until it trying to send the sms using Req_Sms_Send.
If there is something wrong with the parameter , it should return with error only without causing the panic by the D211Ctl & coz it shutting down!
The err code return by the Req_Sms_Send is 50397204.
The code of the sample is as below,

int main(int argc, char* argv[])
{
HANDLE hIpc;
DWORD dwStatus;

_tprintf(TEXT("1. Opening the IPC...\n&quot);
if (IPC_STATUS_SUCCESS != (dwStatus = IPCCreateNamedPipe (TEXT("NokiaD211&quot,
16384, TEXT("Sms_Sample&quot, &hIpc)))
{
if (IPC_STATUS_SUCCESS != (dwStatus = IPCCreateNamedPipe (TEXT("NokiaD311&quot,
16384, TEXT("Sms_Sample&quot, &hIpc)))
{
hIpc = NULL;
}
}

if (hIpc)
{
// Enumerating SMSs...
_tprintf(TEXT("2. Enumerating SMSs...\n&quot);
DWORD dwNew, dwProcessed, dwEmpty;
if (IPC_STATUS_SUCCESS != (dwStatus = Req_Sms_Enum(hIpc,
&dwNew, &dwProcessed, &dwEmpty)))
{
WriteError(TEXT("Req_Sms_Enum()&quot, dwStatus);
} else
{
_tprintf(TEXT("\tNew SMSs:\t%d\n&quot, dwNew);
_tprintf(TEXT("\tProcessed SMSs:\t%d\n&quot, dwProcessed);
_tprintf(TEXT("\tEmpty SMSs:\t%d\n&quot, dwEmpty);
}

// Reads the first SMS
_tprintf(TEXT("3. Read the first SMS...\n&quot);
PSMS pSms;
if (IPC_STATUS_SUCCESS != (dwStatus = Req_Sms_Read(hIpc, 0, &pSms)))
{
WriteError(TEXT("Req_Sms_Read()&quot, dwStatus);
} else
{
// Shows some info of the SMS
_tprintf(TEXT("\tStatus:\t\t&quot);
if (pSms->Status & SMS_EMPTY)
{
_tprintf(TEXT("empty.&quot);
}
if (pSms->Status & SMS_NEW)
{
_tprintf(TEXT("new.&quot);
}
if (pSms->Status & SMS_DELETED)
{
_tprintf(TEXT("deleted.&quot);
}
if (pSms->Status & SMS_PROCESSED)
{
_tprintf(TEXT("processed.&quot);
}
if (pSms->Status & 0xffff<<4)
{
_tprintf(TEXT("<UnknownBits>.&quot);
}
_tprintf(TEXT("\n&quot);
_tprintf(TEXT("\tType:\t\t&quot);
switch (pSms->Type)
{
case SMS_UNICODE:
_tprintf(TEXT("unicode\n&quot);
break;

case SMS_BINARY:
_tprintf(TEXT("binary\n&quot);
break;

case SMS_PROFILE:
_tprintf(TEXT("profile\n&quot);
break;

case SMS_PICTURE:
_tprintf(TEXT("picture\n&quot);
break;

case SMS_7BITASCII:
_tprintf(TEXT("7bitASCII\n&quot);
break;

case SMS_VCARD:
_tprintf(TEXT("vcard\n&quot);
break;

case SMS_STATUSREPORT:
_tprintf(TEXT("statusreport: &quot);
switch (pSms->DeliveryStatus)
{
case SMS_STATUS_PENDING:
_tprintf(TEXT("pending\n&quot);
break;
case SMS_STATUS_DELIVERED:
_tprintf(TEXT("delivered\n&quot);
break;
case SMS_STATUS_FAILED:
_tprintf(TEXT("failed\n&quot);
break;
default:
_tprintf(TEXT("unknown\n&quot);
break;
}
break;

default:
_tprintf(TEXT("invalid/unknown\n&quot);
}
_tprintf(TEXT("\tSMS center:\t%s\n&quot, pSms->ScAddr);
_tprintf(TEXT("\tSender:\t\t%s\n&quot, pSms->SenderAddr);
_tprintf(TEXT("\tSMS length:\t%d\n&quot, pSms->Length);
}
// Frees up the allocated buffer for SMS
delete pSms;

// Set first SMS processed
_tprintf(TEXT("4. Set first SMS processed...\n&quot);
if (IPC_STATUS_SUCCESS != (dwStatus = Req_Sms_Processed(hIpc, 0)))
{
WriteError(TEXT("Req_Sms_Processed()&quot, dwStatus);
}

// Send SMS
_tprintf(TEXT("5. Send SMS...\n&quot);
// Prefill some structures
TCHAR pSmsC[MAX_GSM_NUMBER_LENGTH + 1], szTargetPerson[MAX_GSM_NUMBER_LENGTH + 1];

if (IPC_STATUS_SUCCESS != Req_Sms_ReadParameters (hIpc, pSmsC, NULL, NULL))
{
// Set the SMS center manually
//strcpy (pSmsC, "+358........."
}
pSms = (PSMS)new BYTE[sizeof(SMS) + 176];
memset (pSms, 0, sizeof(SMS) + 176);
pSms->Type = SMS_7BITASCII;
_tcscpy((PCHAR)pSms->ScAddr, pSmsC);
_tcscpy((PCHAR)pSms->SmsData, "SMS test..."
pSms->Length = _tcslen((PCHAR)pSms->SmsData);
_tcscpy(szTargetPerson, "+358407408550"

// The error point is the line below !!!
if (IPC_STATUS_SUCCESS != (dwStatus = Req_Sms_Send (hIpc, FALSE, FALSE,
FALSE, szTargetPerson, pSms, NULL)))
{
WriteError(TEXT("Req_Sms_Send()&quot, dwStatus);
}
delete pSms;

// Closes the IPC
_tprintf(TEXT("8. Closes the IPC...\n&quot);
// Destroy IPC
if (IPC_STATUS_SUCCESS != (dwStatus = IPCCloseHandle (hIpc)))
{
WriteError(TEXT("IPCCloseHandle()&quot, dwStatus);
}
} else
{
WriteError(TEXT("IPCCreateNamedPipe()&quot, dwStatus);
}

return 0;
}

///////////////////////////////////////////////////////////////////////////////
//
// Function: WriteError()
//
// Details: Shows an error message.
// Platforms: ALL
//
// Parameters: IN LPCTSTR szTxt - text to write out
// IN ULONG ulCode - errorcode
//
// Returns: -
//
///////////////////////////////////////////////////////////////////////////////
void WriteError(IN LPCTSTR szTxt, IN ULONG ulCode)
{
_tprintf(TEXT("\n#Error: %s. Code:%d\n\n&quot, szTxt, ulCode);
}