/*****************************************************************************
 * Copyright (C) Gemalto M2M GmbH
 *****************************************************************************
 *   Project: RIL-Driver
 *****************************************************************************
 *   Author : Intrinsyc
 *****************************************************************************
 * $Workfile: Y:/z_ms-d/src/working/Quinn/RilDrv/riladdtrace.cpp $
 * $Revision: /main/ms-d/43 $
 *     $Date: 2014-06-16 13:44:47 $
 *   $Author: pmackent $
 *****************************************************************************
 * Requirements:
 * PC:      Microsoft Windows CE .NET 4.2
 * Target:  "MS Pocket PC" or "MS Smartphone"
 *****************************************************************************
 * Description:
 *  Cinterion RIL
 *****************************************************************************
 *
 * $Log: Y:/z_ms-d/src/working/Quinn/RilDrv/riladdtrace.cpp$ 
 * 
 * /main/ms-d/43   2014-06-16 13:44:47   pmackent 
 * Use RIL_E_FDNRESTRICTED error code if available (IPIS100098571)
 *
 * /main/ms-d/42   2013-11-29 12:43:28   pmackent
 * Prepare for DTMF detection (possible new PHS8 feature)
 *
 * /main/ms-d/41   2013-10-24 13:41:27   pmackent
 * Preparation to support Windows Embedded Compact 2013
 *
 * /main/ms-d/40   2013-09-13 09:21:40   pmackent
 * Added missing notification
 *
 * /main/ms-d/39   2013-06-25 13:42:54   pmackent
 * Make trace output safer (IPIS100089064)
 *
 * /main/ms-d/38   2013-06-12 13:50:08   pmackent
 * Better display of call status
 *
 * /main/ms-d/37   2013-04-26 09:15:16   pmackent
 * Additional traces for SMS
 *
 * /main/ms-d/36   2013-04-18 15:51:23   pmackent
 * Add RIL_GetSignalQuality API for CE7
 *
 * /main/ms-d/35   2012-12-21 13:09:05   pmackent
 * Introduce NV item update
 *
 * /main/ms-d/34   2012-12-13 16:07:06   pmackent
 * Corrected type mismatch in debug output
 *
 * /main/ms-d/33   2012-10-08 16:18:33   pmackent
 * Comply to Klocwork checks.
 *
 * /main/ms-d/32   2012-07-13 13:04:17   pmackent
 * Changes for compatibility with Windows CE6/6
 *
 * /main/ms-d/31   2012-07-11 15:28:37   pmackent
 * Introduce PRI update
 *
 * /main/ms-d/30   2012-06-26 10:16:12   pmackent
 * Add CDMA update notifications
 *
 * /main/ms-d/29   2012-06-13 10:44:01   pmackent
 * Added support for CDMA flash
 *
 * /main/ms-d/28   2012-06-08 16:59:28   pmackent
 * Add APIs for CDMA voice privacy
 *
 * /main/ms-d/27   2012-06-05 11:47:47   pmackent
 * Add handling of undocumented CDMA activation URC (IPIS100079730)
 *
 * /main/ms-d/26   2012-04-18 13:47:17   ctna0256
 * Introducing PVS8
 * Implementing CDMA-SMS
 * Various CDMA enhancements
 *
 * /main/ms-d/25   2012-02-16 13:45:04   ctna0256
 * Comply to CE6 and CE7 compiler warnings
 *
 * /main/ms-d/24   2011-09-26 13:34:57   ctna0256
 * Comply with CE6 warning level 4
 *
 * /main/ms-d/23   2011-09-09 14:17:42   ctna0256
 * New notifications for audio/firmware update (IPIS100074854)
 *
 * /main/ms-d/22   2011-07-22 16:26:02   ctna0256
 * Notification about GPS activities
 *
 * /main/ms-d/21   2011-07-20 13:01:43   ctna0256
 * Introduce RIL_NOTIFY_DEVSPECIFIC_NETWORK_REJECT_CAUSE and prevent multiple notifications (IPIS100073123)
 *
 * /main/ms-d/20   2011-07-14 15:09:23   ctna0256
 * Correct param type
 *
 * /main/ms-d/19   2011-06-17 10:41:06   ctna0256
 * New API for extended registration status (IPIS100073242)
 *
 * /main/ms-d/18   2011-06-10 09:09:16   ctna0256
 * New device specific notification about call release cause (IPIS100073123)
 *
 * /main/ms-d/17   2011-03-09 14:24:48   ctna0256
 * Run code analysis on Windows CE7
 *
 * /main/ms-d/16   2010-11-18 11:11:57   ctna0256
 * New notifications for dial and hangup of emergency calls
 *
 * /main/ms-d/15   2010-11-10 15:21:33   ctna0256
 * Adaptions for CE7
 *
 * /main/ms-d/14   2010-10-26 11:01:09   ctna0256
 * Introducing new notification for SIM initialization (IPIS100068246)
 *
 * /main/ms-d/13   2010-04-30 16:04:18   ctna0256
 * Wrong trace output corrected
 *
 * /main/ms-d/12   2010-03-24 13:14:22   ctna0256
 * Fixed potential index violation
 *
 * /main/ms-d/11   2010-02-24 13:26:05   ctna0256
 * Made CE6 driver comply with radiometrics test
 *
 * /main/ms-d/10   2010-02-22 15:43:16   ctna0256
 * Notify MMI about change of MSISDN via SAT (IPIS100062554)
 *
 * /main/ms-d/9   2010-02-03 10:51:12   ctna0256
 * Introduction of WinCE6 support
 *
 * /main/ms-d/8   2010-01-26 09:55:38   ctna0256
 * New API: RIL_GetPositionInfo()
 *
 * /main/ms-d/7   2009-09-04 09:08:55   ctna0256
 * recognize CCID SIM field
 *
 * /main/ms-d/6   2009-02-18 09:39:50   ctna0256
 * New WM65 API
 *
 * /main/ms-d/5   2009-01-22 10:07:37   ctna0256
 * Add missing traces
 *
 * /main/ms-d/4   2009-01-15 15:39:44   ctna0256
 * Missing item count output added
 *
 * /main/ms-d/3   2008-11-27 16:59:48   ctna0256
 * Additional SIM files to be recognized
 *
 * /main/ms-d/2   2008-11-14 15:57:28   ctna0256
 * Trace SIM file names; Fix for shortend port name
 *
 * /main/ms-d/1   2008-10-23 11:32:38   ctna0256
 * New trace option (RIL proxy)
 *
 *
*/

//////////////////////////////////////////////////////////////////////////////
// Copyright (C) 2008 Gemalto M2M GmbH
//
// Version: 1.0
// Date:    dummy
//
//////////////////////////////////////////////////////////////////////////////

#include "precomp.h"

#ifdef RIL_ADDITIONAL_DEBUG_OUTPUT

struct ADDTRACE_NOTIFICATION
{
    HRESULT dwCode;
    const char *pszText;
};

ADDTRACE_NOTIFICATION g_oTableNotifications[] = {
    { RIL_NOTIFY_RING,                          "RIL_NOTIFY_RING"},
    { RIL_NOTIFY_CONNECT,                       "RIL_NOTIFY_CONNECT"},
    { RIL_NOTIFY_DISCONNECT,                    "RIL_NOTIFY_DISCONNECT"},
    { RIL_NOTIFY_DATASVCNEGOTIATED,             "RIL_NOTIFY_DATASVCNEGOTIATED"},
    { RIL_NOTIFY_CALLSTATECHANGED,              "RIL_NOTIFY_CALLSTATECHANGED"},
    { RIL_NOTIFY_EMERGENCYMODEENTERED,          "RIL_NOTIFY_EMERGENCYMODEENTERED"},
    { RIL_NOTIFY_EMERGENCYMODEEXITED,           "RIL_NOTIFY_EMERGENCYMODEEXITED"},
    { RIL_NOTIFY_EMERGENCYHANGUP,               "RIL_NOTIFY_EMERGENCYHANGUP"},
    { RIL_NOTIFY_HSCSDPARAMSNEGOTIATED,         "RIL_NOTIFY_HSCSDPARAMSNEGOTIATED"},
    { RIL_NOTIFY_DIAL,                          "RIL_NOTIFY_DIAL"},
    { RIL_NOTIFY_CALLPROGRESSINFO,              "RIL_NOTIFY_CALLPROGRESSINFO"},
    { RIL_NOTIFY_CURRENTLINECHANGED,            "RIL_NOTIFY_CURRENTLINECHANGED"},
#if defined (RIL_NOTIFY_GPRS_DISCONNECT)
    { RIL_NOTIFY_GPRS_DISCONNECT,               "RIL_NOTIFY_GPRS_DISCONNECT"},
#endif
#if defined (RIL_NOTIFY_CALLMODIFICATIONINFO)
    { RIL_NOTIFY_CALLMODIFICATIONINFO,          "RIL_NOTIFY_CALLMODIFICATIONINFO"},
#endif
    { RIL_NOTIFY_MESSAGE,                       "RIL_NOTIFY_MESSAGE"},
    { RIL_NOTIFY_BCMESSAGE,                     "RIL_NOTIFY_BCMESSAGE"},
    { RIL_NOTIFY_STATUSMESSAGE,                 "RIL_NOTIFY_STATUSMESSAGE"},
    { RIL_NOTIFY_MSGSTORED,                     "RIL_NOTIFY_MSGSTORED"},
    { RIL_NOTIFY_MSGDELETED,                    "RIL_NOTIFY_MSGDELETED"},
    { RIL_NOTIFY_MSGSTORAGECHANGED,             "RIL_NOTIFY_MSGSTORAGECHANGED"},
    { RIL_NOTIFY_MESSAGE_IN_SIM,                "RIL_NOTIFY_MESSAGE_IN_SIM"},
    { RIL_NOTIFY_BCMESSAGE_IN_SIM,              "RIL_NOTIFY_BCMESSAGE_IN_SIM"},
    { RIL_NOTIFY_STATUSMESSAGE_IN_SIM,          "RIL_NOTIFY_STATUSMESSAGE_IN_SIM"},
    { RIL_NOTIFY_REGSTATUSCHANGED,              "RIL_NOTIFY_REGSTATUSCHANGED"},
    { RIL_NOTIFY_CALLMETER,                     "RIL_NOTIFY_CALLMETER"},
    { RIL_NOTIFY_CALLMETERMAXREACHED,           "RIL_NOTIFY_CALLMETERMAXREACHED"},
    { RIL_NOTIFY_GPRSREGSTATUSCHANGED,          "RIL_NOTIFY_GPRSREGSTATUSCHANGED"},
    { RIL_NOTIFY_SYSTEMCHANGED,                 "RIL_NOTIFY_SYSTEMCHANGED"},
    { RIL_NOTIFY_GPRSCONNECTIONSTATUS,          "RIL_NOTIFY_GPRSCONNECTIONSTATUS"},
    { RIL_NOTIFY_SYSTEMCAPSCHANGED,             "RIL_NOTIFY_SYSTEMCAPSCHANGED"},
    { RIL_NOTIFY_LOCATIONUPDATE,                "RIL_NOTIFY_LOCATIONUPDATE"},
    { RIL_NOTIFY_CALLERID,                      "RIL_NOTIFY_CALLERID"},
    { RIL_NOTIFY_DIALEDID,                      "RIL_NOTIFY_DIALEDID"},
    { RIL_NOTIFY_CALLWAITING,                   "RIL_NOTIFY_CALLWAITING"},
    { RIL_NOTIFY_SUPSERVICEDATA,                "RIL_NOTIFY_SUPSERVICEDATA"},
    { RIL_NOTIFY_INTERMEDIATESS,                "RIL_NOTIFY_INTERMEDIATESS"},
    { RIL_NOTIFY_UNSOLICITEDSS,                 "RIL_NOTIFY_UNSOLICITEDSS"},
    { RIL_NOTIFY_PHONEBOOKENTRYSTORED,          "RIL_NOTIFY_PHONEBOOKENTRYSTORED"},
    { RIL_NOTIFY_PHONEBOOKENTRYDELETED,         "RIL_NOTIFY_PHONEBOOKENTRYDELETED"},
    { RIL_NOTIFY_PHONEBOOKSTORAGECHANGED,       "RIL_NOTIFY_PHONEBOOKSTORAGECHANGED"},
    { RIL_NOTIFY_SIMTOOLKITCMD,                 "RIL_NOTIFY_SIMTOOLKITCMD"},
    { RIL_NOTIFY_SIMTOOLKITCALLSETUP,           "RIL_NOTIFY_SIMTOOLKITCALLSETUP"},
    { RIL_NOTIFY_SIMTOOLKITEVENT,               "RIL_NOTIFY_SIMTOOLKITEVENT"},
    { RIL_NOTIFY_SIMTOOLKITSESSIONEND,          "RIL_NOTIFY_SIMTOOLKITSESSIONEND"},
    { RIL_NOTIFY_RADIOEQUIPMENTSTATECHANGED,    "RIL_NOTIFY_RADIOEQUIPMENTSTATECHANGED"},
    { RIL_NOTIFY_RADIOPRESENCECHANGED,          "RIL_NOTIFY_RADIOPRESENCECHANGED"},
    { RIL_NOTIFY_RADIORESET,                    "RIL_NOTIFY_RADIORESET"},
    { RIL_NOTIFY_SIMNOTACCESSIBLE,              "RIL_NOTIFY_SIMNOTACCESSIBLE"},
    { RIL_NOTIFY_DTMFSIGNAL,                    "RIL_NOTIFY_DTMFSIGNAL"},
    { RIL_NOTIFY_GPRSCLASS_NETWORKCHANGED,      "RIL_NOTIFY_GPRSCLASS_NETWORKCHANGED"},
    { RIL_NOTIFY_GPRSCLASS_RADIOCHANGED,        "RIL_NOTIFY_GPRSCLASS_RADIOCHANGED"},
    { RIL_NOTIFY_SIGNALQUALITY,                 "RIL_NOTIFY_SIGNALQUALITY"},
    { RIL_NOTIFY_MAINTREQUIRED,                 "RIL_NOTIFY_MAINTREQUIRED"},
    { RIL_NOTIFY_PRIVACYCHANGED,                "RIL_NOTIFY_PRIVACYCHANGED"},
    { RIL_NOTIFY_SIM_DATACHANGE,                "RIL_NOTIFY_SIM_DATACHANGE"},
    { RIL_NOTIFY_ATLOGGING,                     "RIL_NOTIFY_ATLOGGING"},
    { RIL_NOTIFY_SIMSTATUSCHANGED,              "RIL_NOTIFY_SIMSTATUSCHANGED"},
#if defined(RIL_NOTIFY_EONS)
    { RIL_NOTIFY_EONS,                          "RIL_NOTIFY_EONS"},
#endif
#if defined(RIL_NOTIFY_NITZ)
    { RIL_NOTIFY_NITZ,                          "RIL_NOTIFY_NITZ"},
#endif
#if defined(RIL_NOTIFY_GPRSATTACHED)
    { RIL_NOTIFY_GPRSATTACHED,                  "RIL_NOTIFY_GPRSATTACHED"},
#endif
#if defined(RIL_NOTIFY_SIMSECURITYSTATUS)
    { RIL_NOTIFY_SIMSECURITYSTATUS,             "RIL_NOTIFY_SIMSECURITYSTATUS"},
#endif
    { RIL_NOTIFY_LOCATION,                      "RIL_NOTIFY_LOCATION"},
    { RIL_NOTIFY_ROAMSTATUS,                    "RIL_NOTIFY_ROAMSTATUS"},
    { RIL_NOTIFY_DTMFSIGNAL,                    "RIL_NOTIFY_DTMFSIGNAL"},
// The following notification a Cinterion specific extensions.
    { RIL_NOTIFY_DEVSPECIFIC_EMERG_SHUTDOWN,          "RIL_NOTIFY_DEVSPECIFIC_EMERG_SHUTDOWN"},
    { RIL_NOTIFY_DEVSPECIFIC_EMERG_SHUTDOWN_WARN,     "RIL_NOTIFY_DEVSPECIFIC_EMERG_SHUTDOWN_WARN"},
    { RIL_NOTIFY_DEVSPECIFIC_SIM_MEMORY_FULL,         "RIL_NOTIFY_DEVSPECIFIC_SIM_MEMORY_FULL"},
    { RIL_NOTIFY_DEVSPECIFIC_BARRING_INCOMING_CALL,   "RIL_NOTIFY_DEVSPECIFIC_BARRING_INCOMING_CALL"},
    { RIL_NOTIFY_DEVSPECIFIC_NSMC_STATUS_CHANGE,      "RIL_NOTIFY_DEVSPECIFIC_NSMC_STATUS_CHANGE"},
    { RIL_NOTIFY_DEVSPECIFIC_LAST_READYSTATE_MSG,     "RIL_NOTIFY_DEVSPECIFIC_LAST_READYSTATE_MSG"},
    { RIL_NOTIFY_DEVSPECIFIC_DIAL_EMERGENCY_CALL,     "RIL_NOTIFY_DEVSPECIFIC_DIAL_EMERGENCY_CALL"},
    { RIL_NOTIFY_DEVSPECIFIC_HANGUP_EMERGENCY_CALL,   "RIL_NOTIFY_DEVSPECIFIC_HANGUP_EMERGENCY_CALL"},
    { RIL_NOTIFY_DEVSPECIFIC_CALL_RELEASE_CAUSE,      "RIL_NOTIFY_DEVSPECIFIC_CALL_RELEASE_CAUSE"},
    { RIL_NOTIFY_DEVSPECIFIC_REGSTATUS_EX,            "RIL_NOTIFY_DEVSPECIFIC_REGSTATUS_EX"},
    { RIL_NOTIFY_DEVSPECIFIC_NETWORK_REJECT_CAUSE,    "RIL_NOTIFY_DEVSPECIFIC_NETWORK_REJECT_CAUSE"},
    { RIL_NOTIFY_DEVSPECIFIC_GPS_ACTIVITY,            "RIL_NOTIFY_DEVSPECIFIC_GPS_ACTIVITY"},
    { RIL_NOTIFY_DEVSPECIFIC_CDMA_ACTIVATION,         "RIL_NOTIFY_DEVSPECIFIC_CDMA_ACTIVATION"},
    { RIL_NOTIFY_DEVSPECIFIC_CDMA_OMADM_UPDATE,       "RIL_NOTIFY_DEVSPECIFIC_CDMA_OMADM_UPDATE"},
    { RIL_NOTIFY_DEVSPECIFIC_GPS_MTLR,                "RIL_NOTIFY_DEVSPECIFIC_GPS_MTLR"},
    { RIL_NOTIFY_DEVSPECIFIC_FW_UPDATE_START,         "RIL_NOTIFY_DEVSPECIFIC_FW_UPDATE_START"},
    { RIL_NOTIFY_DEVSPECIFIC_FW_UPDATE_PROGRESS,      "RIL_NOTIFY_DEVSPECIFIC_FW_UPDATE_PROGRESS"},
    { RIL_NOTIFY_DEVSPECIFIC_FW_UPDATE_END,           "RIL_NOTIFY_DEVSPECIFIC_FW_UPDATE_END"},
    { RIL_NOTIFY_DEVSPECIFIC_AUDIO_UPDATE_START,      "RIL_NOTIFY_DEVSPECIFIC_AUDIO_UPDATE_START"},
    { RIL_NOTIFY_DEVSPECIFIC_AUDIO_UPDATE_PROGRESS,   "RIL_NOTIFY_DEVSPECIFIC_AUDIO_UPDATE_PROGRESS"},
    { RIL_NOTIFY_DEVSPECIFIC_AUDIO_UPDATE_END,        "RIL_NOTIFY_DEVSPECIFIC_AUDIO_UPDATE_END"},
    { RIL_NOTIFY_DEVSPECIFIC_CDMA_PRL_UPDATE_START,   "RIL_NOTIFY_DEVSPECIFIC_CDMA_PRL_UPDATE_START"},
    { RIL_NOTIFY_DEVSPECIFIC_CDMA_PRL_UPDATE_PROGRESS,"RIL_NOTIFY_DEVSPECIFIC_CDMA_PRL_UPDATE_PROGRESS"},
    { RIL_NOTIFY_DEVSPECIFIC_CDMA_PRL_UPDATE_END,     "RIL_NOTIFY_DEVSPECIFIC_CDMA_PRL_UPDATE_END"},
    { RIL_NOTIFY_DEVSPECIFIC_NWL_UPDATE_START,        "RIL_NOTIFY_DEVSPECIFIC_NWL_UPDATE_START"},
    { RIL_NOTIFY_DEVSPECIFIC_NWL_UPDATE_PROGRESS,     "RIL_NOTIFY_DEVSPECIFIC_NWL_UPDATE_PROGRESS"},
    { RIL_NOTIFY_DEVSPECIFIC_NWL_UPDATE_END,          "RIL_NOTIFY_DEVSPECIFIC_NWL_UPDATE_END"},
    { RIL_NOTIFY_DEVSPECIFIC_CDMA_PRI_UPDATE_START,   "RIL_NOTIFY_DEVSPECIFIC_CDMA_PRI_UPDATE_START"},
    { RIL_NOTIFY_DEVSPECIFIC_CDMA_PRI_UPDATE_PROGRESS,"RIL_NOTIFY_DEVSPECIFIC_CDMA_PRI_UPDATE_PROGRESS"},
    { RIL_NOTIFY_DEVSPECIFIC_CDMA_PRI_UPDATE_END,     "RIL_NOTIFY_DEVSPECIFIC_CDMA_PRI_UPDATE_END"},
    { RIL_NOTIFY_DEVSPECIFIC_NVITEM_UPDATE_START,     "RIL_NOTIFY_DEVSPECIFIC_NVITEM_UPDATE_START"},
    { RIL_NOTIFY_DEVSPECIFIC_NVITEM_UPDATE_PROGRESS,  "RIL_NOTIFY_DEVSPECIFIC_NVITEM_UPDATE_PROGRESS"},
    { RIL_NOTIFY_DEVSPECIFIC_NVITEM_UPDATE_END,       "RIL_NOTIFY_DEVSPECIFIC_NVITEM_UPDATE_END"},
    { 0, "Unknwon Notification"}
};
#define NUM_ADDTRACENOTIFICATIONS    (sizeof(g_oTableNotifications) / sizeof(ADDTRACE_NOTIFICATION))

ADDTRACE_NOTIFICATION g_oTableErrCode[] = {
    { RIL_E_PHONEFAILURE,           "RIL_E_PHONEFAILURE"},
    { RIL_E_NOCONNECTION,           "RIL_E_NOCONNECTION"},
    { RIL_E_LINKRESERVED,           "RIL_E_LINKRESERVED"},
    { RIL_E_OPNOTALLOWED,           "RIL_E_OPNOTALLOWED"},
    { RIL_E_OPNOTSUPPORTED,         "RIL_E_OPNOTSUPPORTED"},
    { RIL_E_PHSIMPINREQUIRED,       "RIL_E_PHSIMPINREQUIRED"},
    { RIL_E_PHFSIMPINREQUIRED,      "RIL_E_PHFSIMPINREQUIRED"},
    { RIL_E_PHFSIMPUKREQUIRED,      "RIL_E_PHFSIMPUKREQUIRED"},
    { RIL_E_SIMNOTINSERTED,         "RIL_E_SIMNOTINSERTED"},
    { RIL_E_SIMPINREQUIRED,         "RIL_E_SIMPINREQUIRED"},
    { RIL_E_SIMPUKREQUIRED,         "RIL_E_SIMPUKREQUIRED"},
    { RIL_E_SIMFAILURE,             "RIL_E_SIMFAILURE"},
    { RIL_E_SIMBUSY,                "RIL_E_SIMBUSY"},
    { RIL_E_SIMWRONG,               "RIL_E_SIMWRONG"},
    { RIL_E_INCORRECTPASSWORD,      "RIL_E_INCORRECTPASSWORD"},
    { RIL_E_SIMPIN2REQUIRED,        "RIL_E_SIMPIN2REQUIRED"},
    { RIL_E_SIMPUK2REQUIRED,        "RIL_E_SIMPUK2REQUIRED"},
    { RIL_E_MEMORYFULL,             "RIL_E_MEMORYFULL"},
    { RIL_E_INVALIDINDEX,           "RIL_E_INVALIDINDEX"},
    { RIL_E_NOTFOUND,               "RIL_E_NOTFOUND"},
    { RIL_E_MEMORYFAILURE,          "RIL_E_MEMORYFAILURE"},
    { RIL_E_TEXTSTRINGTOOLONG,      "RIL_E_TEXTSTRINGTOOLONG"},
    { RIL_E_INVALIDTEXTSTRING,      "RIL_E_INVALIDTEXTSTRING"},
    { RIL_E_DIALSTRINGTOOLONG,      "RIL_E_DIALSTRINGTOOLONG"},
    { RIL_E_INVALIDDIALSTRING,      "RIL_E_INVALIDDIALSTRING"},
    { RIL_E_NONETWORKSVC,           "RIL_E_NONETWORKSVC"},
    { RIL_E_NETWORKTIMEOUT,         "RIL_E_NETWORKTIMEOUT"},
    { RIL_E_EMERGENCYONLY,          "RIL_E_EMERGENCYONLY"},
    { RIL_E_NETWKPINREQUIRED,       "RIL_E_NETWKPINREQUIRED"},
    { RIL_E_NETWKPUKREQUIRED,       "RIL_E_NETWKPUKREQUIRED"},
    { RIL_E_SUBSETPINREQUIRED,      "RIL_E_SUBSETPINREQUIRED"},
    { RIL_E_SUBSETPUKREQUIRED,      "RIL_E_SUBSETPUKREQUIRED"},
    { RIL_E_SVCPINREQUIRED,         "RIL_E_SVCPINREQUIRED"},
    { RIL_E_SVCPUKREQUIRED,         "RIL_E_SVCPUKREQUIRED"},
    { RIL_E_CORPPINREQUIRED,        "RIL_E_CORPPINREQUIRED"},
    { RIL_E_CORPPUKREQUIRED,        "RIL_E_CORPPUKREQUIRED"},
    { RIL_E_TELEMATICIWUNSUPPORTED, "RIL_E_TELEMATICIWUNSUPPORTED"},
    { RIL_E_SMTYPE0UNSUPPORTED,     "RIL_E_SMTYPE0UNSUPPORTED"},
    { RIL_E_CANTREPLACEMSG,         "RIL_E_CANTREPLACEMSG"},
    { RIL_E_PROTOCOLIDERROR,        "RIL_E_PROTOCOLIDERROR"},
    { RIL_E_DCSUNSUPPORTED,         "RIL_E_DCSUNSUPPORTED"},
    { RIL_E_MSGCLASSUNSUPPORTED,    "RIL_E_MSGCLASSUNSUPPORTED"},
    { RIL_E_DCSERROR,               "RIL_E_DCSERROR"},
    { RIL_E_CMDCANTBEACTIONED,      "RIL_E_CMDCANTBEACTIONED"},
    { RIL_E_CMDUNSUPPORTED,         "RIL_E_CMDUNSUPPORTED"},
    { RIL_E_CMDERROR,               "RIL_E_CMDERROR"},
    { RIL_E_MSGBODYHEADERERROR,     "RIL_E_MSGBODYHEADERERROR"},
    { RIL_E_SCBUSY,                 "RIL_E_SCBUSY"},
    { RIL_E_NOSCSUBSCRIPTION,       "RIL_E_NOSCSUBSCRIPTION"},
    { RIL_E_SCSYSTEMFAILURE,        "RIL_E_SCSYSTEMFAILURE"},
    { RIL_E_INVALIDADDRESS,         "RIL_E_INVALIDADDRESS"},
    { RIL_E_DESTINATIONBARRED,      "RIL_E_DESTINATIONBARRED"},
    { RIL_E_REJECTEDDUPLICATE,      "RIL_E_REJECTEDDUPLICATE"},
    { RIL_E_VPFUNSUPPORTED,         "RIL_E_VPFUNSUPPORTED"},
    { RIL_E_VPUNSUPPORTED,          "RIL_E_VPUNSUPPORTED"},
    { RIL_E_SIMMSGSTORAGEFULL,      "RIL_E_SIMMSGSTORAGEFULL"},
    { RIL_E_NOSIMMSGSTORAGE,        "RIL_E_NOSIMMSGSTORAGE"},
    { RIL_E_SIMTOOLKITBUSY,         "RIL_E_SIMTOOLKITBUSY"},
    { RIL_E_SIMDOWNLOADERROR,       "RIL_E_SIMDOWNLOADERROR"},
    { RIL_E_MSGSVCRESERVED,         "RIL_E_MSGSVCRESERVED"},
    { RIL_E_INVALIDMSGPARAM,        "RIL_E_INVALIDMSGPARAM"},
    { RIL_E_UNKNOWNSCADDRESS,       "RIL_E_UNKNOWNSCADDRESS"},
    { RIL_E_UNASSIGNEDNUMBER,       "RIL_E_UNASSIGNEDNUMBER"},
    { RIL_E_MSGBARREDBYOPERATOR,    "RIL_E_MSGBARREDBYOPERATOR"},
    { RIL_E_MSGCALLBARRED,          "RIL_E_MSGCALLBARRED"},
    { RIL_E_UNIDENTIFIEDSUBCRIBER,  "RIL_E_UNIDENTIFIEDSUBCRIBER"},
    { RIL_E_SVCUNSUPPORTED,         "RIL_E_SVCUNSUPPORTED"},
    { RIL_E_UNKNOWNSUBSCRIBER,      "RIL_E_UNKNOWNSUBSCRIBER"},
    { RIL_E_NETWKOUTOFORDER,        "RIL_E_NETWKOUTOFORDER"},
    { RIL_E_NETWKTEMPFAILURE,       "RIL_E_NETWKTEMPFAILURE"},
    { RIL_E_CONGESTION,             "RIL_E_CONGESTION"},
    { RIL_E_RESOURCESUNAVAILABLE,   "RIL_E_RESOURCESUNAVAILABLE"},
    { RIL_E_SVCNOTSUBSCRIBED,       "RIL_E_SVCNOTSUBSCRIBED"},
    { RIL_E_SVCNOTIMPLEMENTED,      "RIL_E_SVCNOTIMPLEMENTED"},
    { RIL_E_INVALIDMSGREFERENCE,    "RIL_E_INVALIDMSGREFERENCE"},
    { RIL_E_INVALIDMSG,             "RIL_E_INVALIDMSG"},
    { RIL_E_INVALIDMANDATORYINFO,   "RIL_E_INVALIDMANDATORYINFO"},
    { RIL_E_MSGTYPEUNSUPPORTED,     "RIL_E_MSGTYPEUNSUPPORTED"},
    { RIL_E_ICOMPATIBLEMSG,         "RIL_E_ICOMPATIBLEMSG"},
    { RIL_E_INFOELEMENTUNSUPPORTED, "RIL_E_INFOELEMENTUNSUPPORTED"},
    { RIL_E_PROTOCOLERROR,          "RIL_E_PROTOCOLERROR"},
    { RIL_E_NETWORKERROR,           "RIL_E_NETWORKERROR"},
    { RIL_E_MESSAGINGERROR,         "RIL_E_MESSAGINGERROR"},
    { RIL_E_NOTREADY,               "RIL_E_NOTREADY"},
    { RIL_E_TIMEDOUT,               "RIL_E_TIMEDOUT"},
    { RIL_E_CANCELLED,              "RIL_E_CANCELLED"},
    { RIL_E_NONOTIFYCALLBACK,       "RIL_E_NONOTIFYCALLBACK"},
    { RIL_E_OPFMTUNAVAILABLE,       "RIL_E_OPFMTUNAVAILABLE"},
    { RIL_E_NORESPONSETODIAL,       "RIL_E_NORESPONSETODIAL"},
    { RIL_E_SECURITYFAILURE,        "RIL_E_SECURITYFAILURE"},
    { RIL_E_RADIOFAILEDINIT,        "RIL_E_RADIOFAILEDINIT"},
    { RIL_E_DRIVERINITFAILED,       "RIL_E_DRIVERINITFAILED"},
    { RIL_E_RADIONOTPRESENT,        "RIL_E_RADIONOTPRESENT"},
    { RIL_E_RADIOOFF,               "RIL_E_RADIOOFF"},
#if defined(RIL_E_PASSWORDMISMATCH)
    { RIL_E_PASSWORDMISMATCH,       "RIL_E_PASSWORDMISMATCH"},
#endif
#if defined(RIL_E_FDNRESTRICT)
    { RIL_E_FDNRESTRICT,            "RIL_E_FDNRESTRICT"},
#endif
    { E_INVALIDARG,                 "E_INVALIDARG"},
    { E_FAIL,                       "E_FAIL"},
    { E_NOTIMPL,                    "E_NOTIMPL"},
    { 0, "Unknwon Error"}
};
#define NUM_ADDTRACEERRORCODES    (sizeof(g_oTableErrCode) / sizeof(ADDTRACE_NOTIFICATION))

ADDTRACE_NOTIFICATION g_oTableIOCTLs[] = {
    { IOCTL_RIL_GETSUBSCRIBERNUMBERS,           "IOCTL_RIL_GETSUBSCRIBERNUMBERS"},
    { IOCTL_RIL_GETOPERATORLIST,                "IOCTL_RIL_GETOPERATORLIST"},
    { IOCTL_RIL_GETPREFERREDOPERATORLIST,       "IOCTL_RIL_GETPREFERREDOPERATORLIST"},
    { IOCTL_RIL_ADDPREFERREDOPERATOR,           "IOCTL_RIL_ADDPREFERREDOPERATOR"},
    { IOCTL_RIL_REMOVEPREFERREDOPERATOR,        "IOCTL_RIL_REMOVEPREFERREDOPERATOR"},
    { IOCTL_RIL_GETCURRENTOPERATOR,             "IOCTL_RIL_GETCURRENTOPERATOR"},
    { IOCTL_RIL_GETALLOPERATORSLIST,            "IOCTL_RIL_GETALLOPERATORSLIST"},
    { IOCTL_RIL_REGISTERONNETWORK,              "IOCTL_RIL_REGISTERONNETWORK"},
    { IOCTL_RIL_UNREGISTERFROMNETWORK,          "IOCTL_RIL_UNREGISTERFROMNETWORK"},
    { IOCTL_RIL_GETREGISTRATIONSTATUS,          "IOCTL_RIL_GETREGISTRATIONSTATUS"},
    { IOCTL_RIL_GETCALLERIDSETTINGS,            "IOCTL_RIL_GETCALLERIDSETTINGS"},
    { IOCTL_RIL_SETCALLERIDSTATUS,              "IOCTL_RIL_SETCALLERIDSTATUS"},
    { IOCTL_RIL_GETHIDEIDSETTINGS,              "IOCTL_RIL_GETHIDEIDSETTINGS"},
    { IOCTL_RIL_SETHIDEIDSTATUS,                "IOCTL_RIL_SETHIDEIDSTATUS"},
    { IOCTL_RIL_GETDIALEDIDSETTINGS,            "IOCTL_RIL_GETDIALEDIDSETTINGS"},
    { IOCTL_RIL_SETDIALEDIDSTATUS,              "IOCTL_RIL_SETDIALEDIDSTATUS"},
    { IOCTL_RIL_GETHIDECONNECTEDIDSETTINGS,     "IOCTL_RIL_GETHIDECONNECTEDIDSETTINGS"},
    { IOCTL_RIL_SETHIDECONNECTEDIDSTATUS,       "IOCTL_RIL_SETHIDECONNECTEDIDSTATUS"},
    { IOCTL_RIL_GETCLOSEDGROUPSETTINGS,         "IOCTL_RIL_GETCLOSEDGROUPSETTINGS"},
    { IOCTL_RIL_SETCLOSEDGROUPSETTINGS,         "IOCTL_RIL_SETCLOSEDGROUPSETTINGS"},
    { IOCTL_RIL_GETCALLFORWARDINGSETTINGS,      "IOCTL_RIL_GETCALLFORWARDINGSETTINGS"},
    { IOCTL_RIL_ADDCALLFORWARDING,              "IOCTL_RIL_ADDCALLFORWARDING"},
    { IOCTL_RIL_REMOVECALLFORWARDING,           "IOCTL_RIL_REMOVECALLFORWARDING"},
    { IOCTL_RIL_SETCALLFORWARDINGSTATUS,        "IOCTL_RIL_SETCALLFORWARDINGSTATUS"},
    { IOCTL_RIL_GETCALLWAITINGSETTINGS,         "IOCTL_RIL_GETCALLWAITINGSETTINGS"},
    { IOCTL_RIL_SETCALLWAITINGSTATUS,           "IOCTL_RIL_SETCALLWAITINGSTATUS"},
    { IOCTL_RIL_SENDSUPSERVICEDATA,             "IOCTL_RIL_SENDSUPSERVICEDATA"},
    { IOCTL_RIL_CANCELSUPSERVICEDATASESSION,    "IOCTL_RIL_CANCELSUPSERVICEDATASESSION"},
    { IOCTL_RIL_GETCURRENTADDRESSID,            "IOCTL_RIL_GETCURRENTADDRESSID"},
    { IOCTL_RIL_SETCURRENTADDRESSID,            "IOCTL_RIL_SETCURRENTADDRESSID"},
    { IOCTL_RIL_DIAL,                           "IOCTL_RIL_DIAL"},
    { IOCTL_RIL_ANSWER,                         "IOCTL_RIL_ANSWER"},
    { IOCTL_RIL_HANGUP,                         "IOCTL_RIL_HANGUP"},
    { IOCTL_RIL_SENDDTMF,                       "IOCTL_RIL_SENDDTMF"},
    { IOCTL_RIL_SETDTMFMONITORING,              "IOCTL_RIL_SETDTMFMONITORING"},
#ifndef RILDRV_CE6
    { IOCTL_RIL_GETCALLLIST,                    "IOCTL_RIL_GETCALLLIST"},
    { IOCTL_RIL_GETLINESTATUS,                  "IOCTL_RIL_GETLINESTATUS"},
#endif
    { IOCTL_RIL_MANAGECALLS,                    "IOCTL_RIL_MANAGECALLS"},
    { IOCTL_RIL_TRANSFERCALL,                   "IOCTL_RIL_TRANSFERCALL"},
    { IOCTL_RIL_GETAUDIOGAIN,                   "IOCTL_RIL_GETAUDIOGAIN"},
    { IOCTL_RIL_SETAUDIOGAIN,                   "IOCTL_RIL_SETAUDIOGAIN"},
    { IOCTL_RIL_GETAUDIODEVICES,                "IOCTL_RIL_GETAUDIODEVICES"},
    { IOCTL_RIL_SETAUDIODEVICES,                "IOCTL_RIL_SETAUDIODEVICES"},
    { IOCTL_RIL_GETAUDIOMUTING,                 "IOCTL_RIL_GETAUDIOMUTING"},
    { IOCTL_RIL_SETAUDIOMUTING,                 "IOCTL_RIL_SETAUDIOMUTING"},
    { IOCTL_RIL_GETHSCSDOPTIONS,                "IOCTL_RIL_GETHSCSDOPTIONS"},
    { IOCTL_RIL_SETHSCSDOPTIONS,                "IOCTL_RIL_SETHSCSDOPTIONS"},
    { IOCTL_RIL_GETHSCSDCALLSETTINGS,           "IOCTL_RIL_GETHSCSDCALLSETTINGS"},
    { IOCTL_RIL_GETDATACOMPRESSION,             "IOCTL_RIL_GETDATACOMPRESSION"},
    { IOCTL_RIL_SETDATACOMPRESSION,             "IOCTL_RIL_SETDATACOMPRESSION"},
    { IOCTL_RIL_GETERRORCORRECTION,             "IOCTL_RIL_GETERRORCORRECTION"},
    { IOCTL_RIL_SETERRORCORRECTION,             "IOCTL_RIL_SETERRORCORRECTION"},
    { IOCTL_RIL_GETBEARERSERVICEOPTIONS,        "IOCTL_RIL_GETBEARERSERVICEOPTIONS"},
    { IOCTL_RIL_SETBEARERSERVICEOPTIONS,        "IOCTL_RIL_SETBEARERSERVICEOPTIONS"},
    { IOCTL_RIL_GETRLPOPTIONS,                  "IOCTL_RIL_GETRLPOPTIONS"},
    { IOCTL_RIL_SETRLPOPTIONS,                  "IOCTL_RIL_SETRLPOPTIONS"},
    { IOCTL_RIL_GETMSGSERVICEOPTIONS,           "IOCTL_RIL_GETMSGSERVICEOPTIONS"},
    { IOCTL_RIL_SETMSGSERVICEOPTIONS,           "IOCTL_RIL_SETMSGSERVICEOPTIONS"},
    { IOCTL_RIL_GETMSGCONFIG,                   "IOCTL_RIL_GETMSGCONFIG"},
    { IOCTL_RIL_SETMSGCONFIG,                   "IOCTL_RIL_SETMSGCONFIG"},
    { IOCTL_RIL_GETCBMSGCONFIG,                 "IOCTL_RIL_GETCBMSGCONFIG"},
    { IOCTL_RIL_SETCBMSGCONFIG,                 "IOCTL_RIL_SETCBMSGCONFIG"},
    { IOCTL_RIL_READMSG,                        "IOCTL_RIL_READMSG"},
    { IOCTL_RIL_DELETEMSG,                      "IOCTL_RIL_DELETEMSG"},
    { IOCTL_RIL_WRITEMSG,                       "IOCTL_RIL_WRITEMSG"},
    { IOCTL_RIL_SENDMSG,                        "IOCTL_RIL_SENDMSG"},
    { IOCTL_RIL_SENDSTOREDMSG,                  "IOCTL_RIL_SENDSTOREDMSG"},
    { IOCTL_RIL_SENDMSGACKNOWLEDGEMENT,         "IOCTL_RIL_SENDMSGACKNOWLEDGEMENT"},
    { IOCTL_RIL_GETUSERIDENTITY,                "IOCTL_RIL_GETUSERIDENTITY"},
    { IOCTL_RIL_GETPHONELOCKEDSTATE,            "IOCTL_RIL_GETPHONELOCKEDSTATE"},
    { IOCTL_RIL_UNLOCKPHONE,                    "IOCTL_RIL_UNLOCKPHONE"},
    { IOCTL_RIL_GETLOCKINGSTATUS,               "IOCTL_RIL_GETLOCKINGSTATUS"},
    { IOCTL_RIL_SETLOCKINGSTATUS,               "IOCTL_RIL_SETLOCKINGSTATUS"},
    { IOCTL_RIL_CHANGELOCKINGPASSWORD,          "IOCTL_RIL_CHANGELOCKINGPASSWORD"},
    { IOCTL_RIL_GETCALLBARRINGSTATUS,           "IOCTL_RIL_GETCALLBARRINGSTATUS"},
    { IOCTL_RIL_SETCALLBARRINGSTATUS,           "IOCTL_RIL_SETCALLBARRINGSTATUS"},
    { IOCTL_RIL_CHANGECALLBARRINGPASSWORD,      "IOCTL_RIL_CHANGECALLBARRINGPASSWORD"},
#if defined (IOCTL_RIL_CHANGECALLBARRINGPASSWORDEX)
    { IOCTL_RIL_CHANGECALLBARRINGPASSWORDEX,    "IOCTL_RIL_CHANGECALLBARRINGPASSWORDEX"},
#endif
    { IOCTL_RIL_GETEQUIPMENTINFO,               "IOCTL_RIL_GETEQUIPMENTINFO"},
    { IOCTL_RIL_GETEQUIPMENTSTATE,              "IOCTL_RIL_GETEQUIPMENTSTATE"},
    { IOCTL_RIL_SETEQUIPMENTSTATE,              "IOCTL_RIL_SETEQUIPMENTSTATE"},
    { IOCTL_RIL_GETPHONEBOOKOPTIONS,            "IOCTL_RIL_GETPHONEBOOKOPTIONS"},
    { IOCTL_RIL_SETPHONEBOOKOPTIONS,            "IOCTL_RIL_SETPHONEBOOKOPTIONS"},
    { IOCTL_RIL_READPHONEBOOKENTRIES,           "IOCTL_RIL_READPHONEBOOKENTRIES"},
    { IOCTL_RIL_WRITEPHONEBOOKENTRY,            "IOCTL_RIL_WRITEPHONEBOOKENTRY"},
    { IOCTL_RIL_DELETEPHONEBOOKENTRY,           "IOCTL_RIL_DELETEPHONEBOOKENTRY"},
    { IOCTL_RIL_SENDSIMCMD,                     "IOCTL_RIL_SENDSIMCMD"},
    { IOCTL_RIL_SENDRESTRICTEDSIMCMD,           "IOCTL_RIL_SENDRESTRICTEDSIMCMD"},
    { IOCTL_RIL_GETSIMRECORDSTATUS,             "IOCTL_RIL_GETSIMRECORDSTATUS"},
    { IOCTL_RIL_GETSIMTOOLKITPROFILE,           "IOCTL_RIL_GETSIMTOOLKITPROFILE"},
    { IOCTL_RIL_SETSIMTOOLKITPROFILE,           "IOCTL_RIL_SETSIMTOOLKITPROFILE"},
    { IOCTL_RIL_FETCHSIMTOOLKITCMD,             "IOCTL_RIL_FETCHSIMTOOLKITCMD"},
    { IOCTL_RIL_TERMINATESIMTOOLKITSESSION,     "IOCTL_RIL_TERMINATESIMTOOLKITSESSION"},
#ifdef RILDRV_WM5_WM6
    { IOCTL_RIL_SENDSIMTOOLKITCMDRESPONSE,      "IOCTL_RIL_SENDSIMTOOLKITCMDRESPONSE"},
    { IOCTL_RIL_SENDSIMTOOLKITEVENTDOWNLOAD,    "IOCTL_RIL_SENDSIMTOOLKITEVENTDOWNLOAD"},
#else
    { IOCTL_RIL_SENDSIMTOOLKITCMDRESPONSE,      "IOCTL_RIL_SENDSIMTOOLKITCMDRESPONSE"},
    { IOCTL_RIL_SENDSIMTOOLKITENVELOPECMD,      "IOCTL_RIL_SENDSIMTOOLKITENVELOPECMD"},
#endif
    { IOCTL_RIL_GETCOSTINFO,                    "IOCTL_RIL_GETCOSTINFO"},
    { IOCTL_RIL_SETCOSTINFO,                    "IOCTL_RIL_SETCOSTINFO"},
#ifndef RILDRV_CE6
    { IOCTL_RIL_GETSIGNALQUALITY,               "IOCTL_RIL_GETSIGNALQUALITY"},
#endif
#ifdef RILDRV_CE7
    { IOCTL_RIL_GETSIGNALQUALITY,               "IOCTL_RIL_GETSIGNALQUALITY"},
#endif
    { IOCTL_RIL_GETCELLTOWERINFO,               "IOCTL_RIL_GETCELLTOWERINFO"},
#if defined(IOCTL_RIL_GETPOSITIONINFO)
    { IOCTL_RIL_GETPOSITIONINFO,                "IOCTL_RIL_GETPOSITIONINFO"},
#endif
    { IOCTL_RIL_DEVSPECIFIC,                    "IOCTL_RIL_DEVSPECIFIC"},
    { IOCTL_RIL_GETDEVCAPS,                     "IOCTL_RIL_GETDEVCAPS"},
    { IOCTL_RIL_GETCCBSSTATUS,                  "IOCTL_RIL_GETCCBSSTATUS"},
    { IOCTL_RIL_CLEARCCBSREGISTRATION,          "IOCTL_RIL_CLEARCCBSREGISTRATION"},
    { IOCTL_RIL_GETSYSTEMTIME,                  "IOCTL_RIL_GETSYSTEMTIME"},
    { IOCTL_RIL_GETGPRSCONTEXTLIST,             "IOCTL_RIL_GETGPRSCONTEXTLIST"},
    { IOCTL_RIL_SETGPRSCONTEXT,                 "IOCTL_RIL_SETGPRSCONTEXT"},
    { IOCTL_RIL_DELETEGPRSCONTEXT,              "IOCTL_RIL_DELETEGPRSCONTEXT"},
    { IOCTL_RIL_GETREQUESTEDQUALITYOFSERVICELIST,"IOCTL_RIL_GETREQUESTEDQUALITYOFSERVICELIST"},
    { IOCTL_RIL_SETREQUESTEDQUALITYOFSERVICE,   "IOCTL_RIL_SETREQUESTEDQUALITYOFSERVICE"},
    { IOCTL_RIL_DELETEREQUESTEDQUALITYOFSERVICE,"IOCTL_RIL_DELETEREQUESTEDQUALITYOFSERVICE"},
    { IOCTL_RIL_GETMINIMUMQUALITYOFSERVICELIST, "IOCTL_RIL_GETMINIMUMQUALITYOFSERVICELIST"},
    { IOCTL_RIL_SETMINIMUMQUALITYOFSERVICE,     "IOCTL_RIL_SETMINIMUMQUALITYOFSERVICE"},
    { IOCTL_RIL_DELETEMINIMUMQUALITYOFSERVICE,  "IOCTL_RIL_DELETEMINIMUMQUALITYOFSERVICE"},
    { IOCTL_RIL_SETGPRSATTACHED,                "IOCTL_RIL_SETGPRSATTACHED"},
    { IOCTL_RIL_GETGPRSATTACHED,                "IOCTL_RIL_GETGPRSATTACHED"},
    { IOCTL_RIL_SETGPRSCONTEXTACTIVATED,        "IOCTL_RIL_SETGPRSCONTEXTACTIVATED"},
    { IOCTL_RIL_GETGPRSCONTEXTACTIVATEDLIST,    "IOCTL_RIL_GETGPRSCONTEXTACTIVATEDLIST"},
    { IOCTL_RIL_ENTERGPRSDATAMODE,              "IOCTL_RIL_ENTERGPRSDATAMODE"},
    { IOCTL_RIL_GETGPRSADDRESS,                 "IOCTL_RIL_GETGPRSADDRESS"},
    { IOCTL_RIL_GPRSANSWER,                     "IOCTL_RIL_GPRSANSWER"},
    { IOCTL_RIL_GETGPRSREGISTRATIONSTATUS,      "IOCTL_RIL_GETGPRSREGISTRATIONSTATUS"},
    { IOCTL_RIL_GETGPRSCLASS,                   "IOCTL_RIL_GETGPRSCLASS"},
    { IOCTL_RIL_SETGPRSCLASS,                   "IOCTL_RIL_SETGPRSCLASS"},
    { IOCTL_RIL_GETMOSMSSERVICE,                "IOCTL_RIL_GETMOSMSSERVICE"},
    { IOCTL_RIL_SETMOSMSSERVICE,                "IOCTL_RIL_SETMOSMSSERVICE"},
    { IOCTL_RIL_GETCURRENTSYSTEMTYPE,           "IOCTL_RIL_GETCURRENTSYSTEMTYPE"},
    { IOCTL_RIL_SENDFLASH,           "IOCTL_RIL_SENDFLASH"},
    { IOCTL_RIL_GETROAMINGMODE,           "IOCTL_RIL_GETROAMINGMODE"},
    { IOCTL_RIL_SETROAMINGMODE,           "IOCTL_RIL_SETROAMINGMODE"},
    { IOCTL_RIL_GETPREFERREDPRIVACYMODE,           "IOCTL_RIL_GETPREFERREDPRIVACYMODE"},
    { IOCTL_RIL_SETPREFERREDPRIVACYMODE,           "IOCTL_RIL_SETPREFERREDPRIVACYMODE"},
    { IOCTL_RIL_GETCURRENTPRIVACYSTATUS,           "IOCTL_RIL_GETCURRENTPRIVACYSTATUS"},
    { IOCTL_RIL_SENDAKEY,           "IOCTL_RIL_SENDAKEY"},
#if defined(RILDRV_WM5_WM6) || defined(RILDRV_WM7)
    { IOCTL_RIL_NDIS_SETGPRSCONTEXTACTIVATED,   "IOCTL_RIL_NDIS_SETGPRSCONTEXTACTIVATED"},
#endif
#ifdef RILDRV_WM5_WM6
    { IOCTL_RIL_GETCURRENTLOCATIONSTATUS,       "IOCTL_RIL_GETCURRENTLOCATIONSTATUS"},
    { IOCTL_RIL_GETCURRENTROAMINGSTATUS,        "IOCTL_RIL_GETCURRENTROAMINGSTATUS"},
#endif
#if defined (IOCTL_RIL_DATADORMANT)
    { IOCTL_RIL_DATADORMANT,                    "IOCTL_RIL_DATADORMANT"},
#endif
#if defined(IOCTL_RIL_GETSMSNLTABLELIST)
    { IOCTL_RIL_GETSMSNLTABLELIST,              "IOCTL_RIL_GETSMSNLTABLELIST"},
#endif
    { 0, "Unknwon IOCTL"}
};
#define NUM_ADDTRACEIOCTLS    (sizeof(g_oTableIOCTLs) / sizeof(ADDTRACE_NOTIFICATION))

ADDTRACE_NOTIFICATION g_oTableSIMFiles[] = {
    { 0x6FC5, "EF_PNN"},
    { 0x6FC6, "EF_OPL"},
    { 0x6F18, "EF_OPR"},
    { 0x6F05, "EF_SPN"},
    { 0x6FB7, "EF_ECC"},
    { 0x6F15, "EF_CSP"},
    { 0x6F3A, "EF_ADN"},
    { 0x6F40, "EF_MSISDN"},
    { 0x5F3A, "DF_PHONEBOOK"},
    { 0x5F50, "DF_GRAPHICS"},
    { 0x7F10, "DF_TELECOM"},
    { 0x7F20, "DF_GSM"},
    { 0x4F30, "EF_PBR"},
    { 0x4F20, "EF_IMG"},
    { 0x6F3B, "EF_FDN"},
    { 0x3F00, "MF_GSM"},
    { 0x2F05, "EF_ELP"},
    { 0x2F00, "EF_DIR"},
    { 0x2FE2, "EF_CCID"},
    { 0x6F16, "EF_CPHS_PHASE"},
    { 0x6F14, "EF_CPHS_OPN"},
    { 0x6F18, "EF_CPHS_OPNS"},
    { 0x6F17, "EF_CPHS_MAIL"},
    { 0x6F11, "EF_CPHS_VMI"},
    { 0x6F13, "EF_CPHS_CFF"},
    { 0x6F19, "EF_CPHS_INFO"},
    { 0x6F05, "EF_LP"},
    { 0x6F07, "EF_IMSI"},
    { 0x6F39, "EF_ACM"},
    { 0x6F37, "EF_ACMmax"},
    { 0x6F30, "EF_PLMNsel"},
    { 0x6F38, "EF_SST"},
    { 0x6F7B, "EF_FPMLN"},
    { 0x6F7E, "EF_LOCI"},
    { 0x6FCA, "EF_MWIS"},
    { 0x6F51, "EF_NIA"},
    { 0x6F53, "EF_LOCIGPRS"},
    { 0x6F49, "EF_SDN"},
    { 0x6FC7, "EF_MBDN"},
    { 0, "Unknwon SIM File"}
};
#define NUM_ADDTRACESIMFILES    (sizeof(g_oTableSIMFiles) / sizeof(ADDTRACE_NOTIFICATION))
#define MAX_SIMFILENAMELEN 20

#pragma warning ( push )
// Disable warning to avoid unnecessarily complicated ifdef-construct
#pragma warning ( disable : 4100 )
static void TraceDataBlock(char *szTitle, const BYTE* pBlob, DWORD dwSize)
{
  RILRetailTraceZone(ZONE_NOTIFICATION, (TEXT("RilDrv:  %a (size: %d)\r\n"), szTitle, dwSize));
  TCHAR   Buf[1024];
  TCHAR*  pBuf = Buf;
  BOOL    tr = FALSE;
  for (DWORD i = 1; i <= dwSize; i++) {
#ifdef RILDRV_CE6
    _stprintf_s(pBuf, 1024 - (pBuf - Buf), TEXT("0x%02X "), pBlob[i-1]);
#else
    _stprintf(pBuf, TEXT("0x%02X "), pBlob[i-1]);
#endif
    pBuf += 5;
    if (i && !(i % 16)) {
#ifdef RILDRV_CE6
      swprintf_s(pBuf, 1024 - (pBuf - Buf), TEXT("\r\n"));
#else
      swprintf(pBuf, TEXT("\r\n"));
#endif
      RILRetailTraceZone(ZONE_NOTIFICATION, (Buf));
      pBuf = Buf;
      tr = TRUE;
    } else {
      tr = FALSE;
    }
  }
  if (!tr) {
#ifdef RILDRV_CE6
    _stprintf_s(pBuf, 1024 - (pBuf - Buf), TEXT("\r\n"));
#else
    _stprintf(pBuf, TEXT("\r\n"));
#endif
    RILRetailTraceZone(ZONE_NOTIFICATION, (Buf));
  }
}
#pragma warning ( pop )

static BOOL TraceGetSIMFileName(DWORD dwFileID, char *szFileName, UINT uiLen)
{
    UINT iPosE = 0;
    BOOL bFound = FALSE;

    while (iPosE < NUM_ADDTRACESIMFILES) {
        if (dwFileID == (DWORD)g_oTableSIMFiles[iPosE].dwCode) {
            (void)strncpyz(szFileName, g_oTableSIMFiles[iPosE].pszText, uiLen);
            bFound = TRUE;
            break;
        }
        iPosE++;
    }
    return bFound;
}

#ifdef RILDRV_CE6
#pragma warning ( push )
// Disable unnecessary warning about using HRESULT in switch/case statement.
#pragma warning ( disable : 6221 )
#endif
void TraceIOCTLCall(HRESULT dwIOCTL, PBYTE pBufIn, DWORD dwLenIn)
{
    UINT iPos = 0;

    if ((g_dwDebugZones&ZONE_IOCTL) == 0)
        return;

    while (iPos < NUM_ADDTRACEIOCTLS) {
        if (dwIOCTL == g_oTableIOCTLs[iPos].dwCode)
            break;
        iPos++;
    }
    if (iPos >= NUM_ADDTRACEIOCTLS) {
        RILRetailTraceZone(ZONE_IOCTL, (TEXT("RilDrv: Call IOCTL: %d \r\n"), (dwIOCTL >> 2) & 0xFFF));
    }
    else {
        RILRetailTraceZone(ZONE_IOCTL, (TEXT("RilDrv: Call IOCTL: %a \r\n"), g_oTableIOCTLs[iPos].pszText));
        switch (dwIOCTL) {
            case IOCTL_RIL_ADDPREFERREDOPERATOR:
                if (dwLenIn >= sizeof(ADDPREFERREDOPERATOR_PARAMS))
                    RILRetailTraceZone(ZONE_IOCTL, (TEXT("RilDrv: ADDPREFERREDOPERATOR_PARAMS: dwIndex=%d; ronOperatorNames=\"%a\"\r\n"), ((ADDPREFERREDOPERATOR_PARAMS *)pBufIn)->dwIndex, ((ADDPREFERREDOPERATOR_PARAMS *)pBufIn)->ronOperatorNames.szNumName));
                break;
            case IOCTL_RIL_REMOVEPREFERREDOPERATOR:
            case IOCTL_RIL_SETCALLERIDSTATUS:
            case IOCTL_RIL_SETHIDEIDSTATUS:
            case IOCTL_RIL_SETDIALEDIDSTATUS:
            case IOCTL_RIL_SETHIDECONNECTEDIDSTATUS:
            case IOCTL_RIL_SETCURRENTADDRESSID:
            case IOCTL_RIL_SETAUDIOMUTING:
            case IOCTL_RIL_READMSG:
            case IOCTL_RIL_DELETEMSG:
            case IOCTL_RIL_SENDMSGACKNOWLEDGEMENT:
            case IOCTL_RIL_SETEQUIPMENTSTATE:
            case IOCTL_RIL_DELETEPHONEBOOKENTRY:
            case IOCTL_RIL_GETDEVCAPS:
            case IOCTL_RIL_GETCCBSSTATUS:
            case IOCTL_RIL_SETGPRSATTACHED:
            case IOCTL_RIL_GETGPRSADDRESS:
            case IOCTL_RIL_SETGPRSCLASS:
            case IOCTL_RIL_SETMOSMSSERVICE:
            case IOCTL_RIL_SETROAMINGMODE:
            case IOCTL_RIL_SETPREFERREDPRIVACYMODE:
                if (dwLenIn >= sizeof(DWORD))
                    RILRetailTraceZone(ZONE_NOTIFICATION, (TEXT("RilDrv: DWORD parameter: %d (0x%X)\r\n"), *((DWORD *)pBufIn), *((DWORD *)pBufIn)));
                break;
            case IOCTL_RIL_REGISTERONNETWORK:
                if (dwLenIn >= sizeof(REGISTERONNETWORK_PARAMS))
                    RILRetailTraceZone(ZONE_IOCTL, (TEXT("RilDrv: REGISTERONNETWORK_PARAMS: dwMode=%d; ronOperatorNames=\"%a\"\r\n"),
                                    ((REGISTERONNETWORK_PARAMS *)pBufIn)->dwMode,
                                    ((REGISTERONNETWORK_PARAMS *)pBufIn)->ronOperatorNames.szNumName));
                break;
            case IOCTL_RIL_SETCLOSEDGROUPSETTINGS:
                if (dwLenIn >= sizeof(RILCLOSEDGROUPSETTINGS))
                    RILRetailTraceZone(ZONE_IOCTL, (TEXT("RilDrv: RILCLOSEDGROUPSETTINGS: dwParams=0x%X; dwStatus=%d dwIndex=%d dwInfo=%d\r\n"),
                                    ((RILCLOSEDGROUPSETTINGS *)pBufIn)->dwParams, ((RILCLOSEDGROUPSETTINGS *)pBufIn)->dwStatus,
                                    ((RILCLOSEDGROUPSETTINGS *)pBufIn)->dwIndex, ((RILCLOSEDGROUPSETTINGS *)pBufIn)->dwInfo));
                break;
            case IOCTL_RIL_GETCALLFORWARDINGSETTINGS:
                if (dwLenIn >= sizeof(GETCALLFORWARDING_PARAMS))
                    RILRetailTraceZone(ZONE_IOCTL, (TEXT("RilDrv: GETCALLFORWARDING_PARAMS: dwReason=%d; dwInfoClasses=%d\r\n"),
                                    ((GETCALLFORWARDING_PARAMS *)pBufIn)->dwReason,
                                    ((GETCALLFORWARDING_PARAMS *)pBufIn)->dwInfoClasses));
                break;
            case IOCTL_RIL_ADDCALLFORWARDING:
                if (dwLenIn >= sizeof(ADDCALLFORWARDING_PARAMS))
                    RILRetailTraceZone(ZONE_IOCTL, (TEXT("RilDrv: ADDCALLFORWARDING_PARAMS: dwReason=%d; dwParams=%X; dwStatus=%d; dwInfoClasses=%d; wszAddress=\"%s\"; dwDelayTime=%d\r\n"),
                                    ((ADDCALLFORWARDING_PARAMS *)pBufIn)->dwReason,
                                    ((ADDCALLFORWARDING_PARAMS *)pBufIn)->rcfsSettings.dwParams,
                                    ((ADDCALLFORWARDING_PARAMS *)pBufIn)->rcfsSettings.dwStatus,
                                    ((ADDCALLFORWARDING_PARAMS *)pBufIn)->rcfsSettings.dwInfoClasses,
                                    ((ADDCALLFORWARDING_PARAMS *)pBufIn)->rcfsSettings.raAddress.wszAddress,
                                    ((ADDCALLFORWARDING_PARAMS *)pBufIn)->rcfsSettings.dwDelayTime));
                break;
            case IOCTL_RIL_REMOVECALLFORWARDING:
                if (dwLenIn >= sizeof(REMOVECALLFORWARDING_PARAMS))
                    RILRetailTraceZone(ZONE_IOCTL, (TEXT("RilDrv: REMOVECALLFORWARDING_PARAMS: dwReason=%d; dwInfoClasses=%d\r\n"),
                                    ((REMOVECALLFORWARDING_PARAMS *)pBufIn)->dwReason,
                                    ((REMOVECALLFORWARDING_PARAMS *)pBufIn)->dwInfoClasses));
                break;
            case IOCTL_RIL_SETCALLFORWARDINGSTATUS:
                if (dwLenIn >= sizeof(SETCALLFORWARDINGSTATUS_PARAMS))
                    RILRetailTraceZone(ZONE_IOCTL, (TEXT("RilDrv: SETCALLFORWARDINGSTATUS_PARAMS: dwReason=%d; dwInfoClasses=%d; dwStatus=%d\r\n"),
                                    ((SETCALLFORWARDINGSTATUS_PARAMS *)pBufIn)->dwReason,
                                    ((SETCALLFORWARDINGSTATUS_PARAMS *)pBufIn)->dwInfoClasses,
                                    ((SETCALLFORWARDINGSTATUS_PARAMS *)pBufIn)->dwStatus));
                break;
            case IOCTL_RIL_GETCALLWAITINGSETTINGS:
                if (dwLenIn >= sizeof(GETCALLWAITINGSTATUS_PARAMS))
                    RILRetailTraceZone(ZONE_IOCTL, (TEXT("RilDrv: GETCALLWAITINGSTATUS_PARAMS: dwInfoClasses=%d\r\n"),
                                    ((GETCALLWAITINGSTATUS_PARAMS *)pBufIn)->dwInfoClasses));
                break;
            case IOCTL_RIL_SETCALLWAITINGSTATUS:
                if (dwLenIn >= sizeof(SETCALLWAITINGSTATUS_PARAMS))
                    RILRetailTraceZone(ZONE_IOCTL, (TEXT("RilDrv: SETCALLWAITINGSTATUS_PARAMS: dwInfoClasses=%d; dwStatus=%d\r\n"),
                                    ((SETCALLWAITINGSTATUS_PARAMS *)pBufIn)->dwInfoClasses,
                                    ((SETCALLWAITINGSTATUS_PARAMS *)pBufIn)->dwStatus));
                break;
            case IOCTL_RIL_SENDSUPSERVICEDATA:
                TraceDataBlock("pBufIn", pBufIn, dwLenIn);
                break;
            case IOCTL_RIL_DIAL:
                if (dwLenIn >= sizeof(DIAL_PARAMS))
                    RILRetailTraceZone(ZONE_IOCTL, (TEXT("RilDrv: DIAL_PARAMS: szAddress=\"%a\"; dwType=%d; dwOptions=%d\r\n"),
                                    ((DIAL_PARAMS *)pBufIn)->szAddress, ((DIAL_PARAMS *)pBufIn)->dwType,
                                    ((DIAL_PARAMS *)pBufIn)->dwOptions));
                break;
            case IOCTL_RIL_SENDDTMF:
                if (dwLenIn >= sizeof(SENDDTMF_PARAMS))
                    RILRetailTraceZone(ZONE_IOCTL, (TEXT("RilDrv: SENDDTMF_PARAMS: szDTMF=\"%a\"; dwDuration=%d\r\n"),
                                    ((SENDDTMF_PARAMS *)pBufIn)->szDTMF,
                                    ((SENDDTMF_PARAMS *)pBufIn)->dwDuration));
                break;
            case IOCTL_RIL_MANAGECALLS:
                if (dwLenIn >= sizeof(MANAGECALLS_PARAMS))
                    RILRetailTraceZone(ZONE_IOCTL, (TEXT("RilDrv: MANAGECALLS_PARAMS: dwCommand=%d; dwID=%d\r\n"),
                                    ((MANAGECALLS_PARAMS *)pBufIn)->dwCommand,
                                    ((MANAGECALLS_PARAMS *)pBufIn)->dwID));
                break;
            case IOCTL_RIL_TRANSFERCALL:
                if (dwLenIn >= sizeof(TRANSFERCALL_PARAMS))
                    RILRetailTraceZone(ZONE_IOCTL, (TEXT("RilDrv: TRANSFERCALL_PARAMS: raAddress=\"%s\"; fSubAddress=%d\r\n"),
                                    ((TRANSFERCALL_PARAMS *)pBufIn)->raAddress.wszAddress,
                                    ((TRANSFERCALL_PARAMS *)pBufIn)->fSubAddress));
                break;
            case IOCTL_RIL_SETAUDIOGAIN:
                if (dwLenIn >= sizeof(RILGAININFO))
                    RILRetailTraceZone(ZONE_IOCTL, (TEXT("RilDrv: RILGAININFO: dwParams=0x%X; dwTxGain=0x%x dwRxGain=0x%x\r\n"),
                                    ((RILGAININFO *)pBufIn)->dwParams,
                                    ((RILGAININFO *)pBufIn)->dwTxGain,
                                    ((RILGAININFO *)pBufIn)->dwRxGain));
                break;
            case IOCTL_RIL_SETAUDIODEVICES:
                if (dwLenIn >= sizeof(RILAUDIODEVICEINFO))
                    RILRetailTraceZone(ZONE_IOCTL, (TEXT("RilDrv: RILAUDIODEVICEINFO: dwParams=0x%X; dwTxDevice=%d; dwRxDevice=%d\r\n"),
                                    ((RILAUDIODEVICEINFO *)pBufIn)->dwParams,
                                    ((RILAUDIODEVICEINFO *)pBufIn)->dwTxDevice,
                                    ((RILAUDIODEVICEINFO *)pBufIn)->dwRxDevice));
                break;
            case IOCTL_RIL_SETBEARERSERVICEOPTIONS:
                if (dwLenIn >= sizeof(RILBEARERSVCINFO))
                    RILRetailTraceZone(ZONE_IOCTL, (TEXT("RilDrv: RILBEARERSVCINFO: dwParams=0x%X; dwSpeed=%d; dwServiceName=%d; dwConnectionElement=%d\r\n"),
                                ((RILBEARERSVCINFO *)pBufIn)->dwParams,
                                ((RILBEARERSVCINFO *)pBufIn)->dwSpeed,
                                ((RILBEARERSVCINFO *)pBufIn)->dwServiceName,
                                ((RILBEARERSVCINFO *)pBufIn)->dwConnectionElement));
                break;
            case IOCTL_RIL_SETRLPOPTIONS:
                if (dwLenIn >= sizeof(RILRLPINFO))
                    RILRetailTraceZone(ZONE_IOCTL, (TEXT("RilDrv: RILRLPINFO: dwParams=0x%X; dwIWS=%d; dwMWS=%d; dwAckTimer=%d; dwRetransmissionAttempts=%d; dwVersion=%d; dwResequencingPeriod=%d\r\n"),
                                ((RILRLPINFO *)pBufIn)->dwParams,
                                ((RILRLPINFO *)pBufIn)->dwIWS,
                                ((RILRLPINFO *)pBufIn)->dwMWS,
                                ((RILRLPINFO *)pBufIn)->dwAckTimer,
                                ((RILRLPINFO *)pBufIn)->dwRetransmissionAttempts,
                                ((RILRLPINFO *)pBufIn)->dwVersion,
                                ((RILRLPINFO *)pBufIn)->dwResequencingPeriod));
                break;
            case IOCTL_RIL_SETMSGSERVICEOPTIONS:
                if (dwLenIn >= sizeof(RILMSGSERVICEINFO))
                    RILRetailTraceZone(ZONE_IOCTL, (TEXT("RilDrv: RILMSGSERVICEINFO: dwParams=0x%X; dwService=%d; dwMsgClasses=%d; dwReadLocation=%d; dwWriteLocation; dwStoreLocation=%d\r\n"),
                                ((RILMSGSERVICEINFO *)pBufIn)->dwParams,
                                ((RILMSGSERVICEINFO *)pBufIn)->dwService,
                                ((RILMSGSERVICEINFO *)pBufIn)->dwMsgClasses,
                                ((RILMSGSERVICEINFO *)pBufIn)->dwReadLocation,
                                ((RILMSGSERVICEINFO *)pBufIn)->dwWriteLocation,
                                ((RILMSGSERVICEINFO *)pBufIn)->dwStoreLocation));
                break;
            case IOCTL_RIL_SETMSGCONFIG:
                if (dwLenIn >= sizeof(RILMSGCONFIG))
                    RILRetailTraceZone(ZONE_IOCTL, (TEXT("RilDrv: RILMSGCONFIG: dwParams=0x%X; raSvcCtrAddress=%d\r\n"),
                                ((RILMSGCONFIG *)pBufIn)->dwParams,
                                ((RILMSGCONFIG *)pBufIn)->raSvcCtrAddress.wszAddress));
                break;
            case IOCTL_RIL_SETCBMSGCONFIG:
                if (dwLenIn >= sizeof(RILCBMSGCONFIG)+sizeof(RILRANGE))
                    RILRetailTraceZone(ZONE_IOCTL, (TEXT("RilDrv: RILCBMSGCONFIG: dwParams=0x%X; dwBroadcastMsgLangs=%d; fAccept=%d; rgrrBroadcastMsgIDs=%d,%d\r\n"),
                                ((RILCBMSGCONFIG *)pBufIn)->dwParams,
                                ((RILCBMSGCONFIG *)pBufIn)->dwBroadcastMsgLangs,
                                ((RILCBMSGCONFIG *)pBufIn)->fAccept,
                                ((RILCBMSGCONFIG *)pBufIn)->rgrrBroadcastMsgIDs[0].dwMinValue,
                                ((RILCBMSGCONFIG *)pBufIn)->rgrrBroadcastMsgIDs[0].dwMaxValue));
                break;
            case IOCTL_RIL_WRITEMSG:
                if (dwLenIn >= sizeof(WRITEMSG_PARAMS)) {
                    RILRetailTraceZone(ZONE_IOCTL, (TEXT("RilDrv: WRITEMSG_PARAMS: dwStatus=%d; rmMessagedwParams=0x%X; rmMessagedwType=%d; rmMessagedwFlags=0x%X\r\n"),
                                ((WRITEMSG_PARAMS *)pBufIn)->dwStatus,
                                ((WRITEMSG_PARAMS *)pBufIn)->rmMessage.dwParams,
                                ((WRITEMSG_PARAMS *)pBufIn)->rmMessage.dwType,
                                ((WRITEMSG_PARAMS *)pBufIn)->rmMessage.dwFlags));
                    if (((WRITEMSG_PARAMS *)pBufIn)->rmMessage.dwType == RIL_MSGTYPE_OUT_SUBMIT) {
                        RILRetailTraceZone(ZONE_IOCTL, (TEXT("RilDrv: WRITEMSG_PARAMS (2): dwProtocolID=%d; rmdDataCoding.dwType=%d; rmdDataCoding.dwFlags=%d; rmdDataCoding.dwMsgClass=%d; rmdDataCoding.dwAlphabet=%d; rmdDataCoding.dwLanguage=%d\r\n"),
                                ((WRITEMSG_PARAMS *)pBufIn)->rmMessage.msgOutSubmit.dwProtocolID,
                                ((WRITEMSG_PARAMS *)pBufIn)->rmMessage.msgOutSubmit.rmdDataCoding.dwType,
                                ((WRITEMSG_PARAMS *)pBufIn)->rmMessage.msgOutSubmit.rmdDataCoding.dwFlags,
                                ((WRITEMSG_PARAMS *)pBufIn)->rmMessage.msgOutSubmit.rmdDataCoding.dwMsgClass,
                                ((WRITEMSG_PARAMS *)pBufIn)->rmMessage.msgOutSubmit.rmdDataCoding.dwAlphabet,
                                ((WRITEMSG_PARAMS *)pBufIn)->rmMessage.msgOutSubmit.rmdDataCoding.dwLanguage));
                        if (((WRITEMSG_PARAMS *)pBufIn)->rmMessage.msgOutSubmit.cbHdrLength > 0)
                            TraceDataBlock("rgbHdr", ((WRITEMSG_PARAMS *)pBufIn)->rmMessage.msgOutSubmit.rgbHdr, ((WRITEMSG_PARAMS *)pBufIn)->rmMessage.msgOutSubmit.cbHdrLength);
                        if (((WRITEMSG_PARAMS *)pBufIn)->rmMessage.msgOutSubmit.cchMsgLength > 0)
                            TraceDataBlock("rgbMsg", ((WRITEMSG_PARAMS *)pBufIn)->rmMessage.msgOutSubmit.rgbMsg, ((WRITEMSG_PARAMS *)pBufIn)->rmMessage.msgOutSubmit.cchMsgLength);
                    }
                }
                break;
            case IOCTL_RIL_SENDMSG:
                if (dwLenIn >= sizeof(SENDMSG_PARAMS)) {
                    RILRetailTraceZone(ZONE_IOCTL, (TEXT("RilDrv: SENDMSG_PARAMS: dwOptions=%d; dwParams=0x%X; dwType=0x%x; dwFlags=0x%X\r\n"),
                                ((SENDMSG_PARAMS *)pBufIn)->dwOptions,
                                ((SENDMSG_PARAMS *)pBufIn)->rmMessage.dwParams,
                                ((SENDMSG_PARAMS *)pBufIn)->rmMessage.dwType,
                                ((SENDMSG_PARAMS *)pBufIn)->rmMessage.dwFlags));
                    if (((SENDMSG_PARAMS *)pBufIn)->rmMessage.dwType == RIL_MSGTYPE_OUT_SUBMIT) {
                        RILRetailTraceZone(ZONE_IOCTL, (TEXT("RilDrv: SENDMSG_PARAMS(2): dwProtocolID=%d; rmdDataCoding.dwType=%x; rmdDataCoding.dwFlags=%d; rmdDataCoding.dwMsgClass=%d; rmdDataCoding.dwAlphabet=%d; rmdDataCoding.dwLanguage=%d\r\n"),
                                ((SENDMSG_PARAMS *)pBufIn)->rmMessage.msgOutSubmit.dwProtocolID,
                                ((SENDMSG_PARAMS *)pBufIn)->rmMessage.msgOutSubmit.rmdDataCoding.dwType,
                                ((SENDMSG_PARAMS *)pBufIn)->rmMessage.msgOutSubmit.rmdDataCoding.dwFlags,
                                ((SENDMSG_PARAMS *)pBufIn)->rmMessage.msgOutSubmit.rmdDataCoding.dwMsgClass,
                                ((SENDMSG_PARAMS *)pBufIn)->rmMessage.msgOutSubmit.rmdDataCoding.dwAlphabet,
                                ((SENDMSG_PARAMS *)pBufIn)->rmMessage.msgOutSubmit.rmdDataCoding.dwLanguage));
                        if (((SENDMSG_PARAMS *)pBufIn)->rmMessage.msgOutSubmit.cbHdrLength > 0)
                            TraceDataBlock("rgbHdr", ((SENDMSG_PARAMS *)pBufIn)->rmMessage.msgOutSubmit.rgbHdr, ((SENDMSG_PARAMS *)pBufIn)->rmMessage.msgOutSubmit.cbHdrLength);
                        if (((SENDMSG_PARAMS *)pBufIn)->rmMessage.msgOutSubmit.cchMsgLength > 0)
                            TraceDataBlock("rgbMsg", ((SENDMSG_PARAMS *)pBufIn)->rmMessage.msgOutSubmit.rgbMsg, ((SENDMSG_PARAMS *)pBufIn)->rmMessage.msgOutSubmit.cchMsgLength);
                    }
                    else if (((SENDMSG_PARAMS *)pBufIn)->rmMessage.dwType == RIL_MSGTYPE_OUT_IS637SUBMIT) {
                        RILRetailTraceZone(ZONE_IOCTL, (TEXT("RilDrv: SENDMSG_PARAMS(2): bDigit=%d; dwTeleservice=%d; dwMsgPriority=%x; dwMsgPrivacy=%d; dwMsgID=%d; dwMsgLang=%d; dwMsgEncoding=%d\r\n"),
                                ((SENDMSG_PARAMS *)pBufIn)->rmMessage.msgIS637OutSubmit.bDigit,
                                ((SENDMSG_PARAMS *)pBufIn)->rmMessage.msgIS637OutSubmit.dwTeleservice,
                                ((SENDMSG_PARAMS *)pBufIn)->rmMessage.msgIS637OutSubmit.dwMsgPriority,
                                ((SENDMSG_PARAMS *)pBufIn)->rmMessage.msgIS637OutSubmit.dwMsgPrivacy,
                                ((SENDMSG_PARAMS *)pBufIn)->rmMessage.msgIS637OutSubmit.dwMsgID,
                                ((SENDMSG_PARAMS *)pBufIn)->rmMessage.msgIS637OutSubmit.dwMsgLang,
                                ((SENDMSG_PARAMS *)pBufIn)->rmMessage.msgIS637OutSubmit.dwMsgEncoding));
                        if (((SENDMSG_PARAMS *)pBufIn)->rmMessage.msgIS637OutSubmit.cchMsgLength > 0)
                            TraceDataBlock("rgbMsg", ((SENDMSG_PARAMS *)pBufIn)->rmMessage.msgIS637OutSubmit.rgbMsg, ((SENDMSG_PARAMS *)pBufIn)->rmMessage.msgIS637OutSubmit.cchMsgLength);
                    }
                }
                break;
            case IOCTL_RIL_SENDSTOREDMSG:
                if (dwLenIn >= sizeof(SENDSTOREDMSG_PARAMS))
                    RILRetailTraceZone(ZONE_IOCTL, (TEXT("RilDrv: SENDSTOREDMSG_PARAMS: dwIndex=%d; dwOptions=%d\r\n"),
                                ((SENDSTOREDMSG_PARAMS *)pBufIn)->dwIndex,
                                ((SENDSTOREDMSG_PARAMS *)pBufIn)->dwOptions));
                break;
            case IOCTL_RIL_UNLOCKPHONE:
                if (dwLenIn >= sizeof(UNLOCKPHONE_PARAMS))
#ifdef RIL_FILTER_PIN_IN_RETAIL_OUTPUT
                    RILRetailTraceZone(ZONE_IOCTL, (TEXT("RilDrv: UNLOCKPHONE_PARAMS: szPassword=<xxxx>; fNewPassword=%d; szNewPassword=<yyyy>\r\n"),
                                ((UNLOCKPHONE_PARAMS *)pBufIn)->fNewPassword));
#else
                    RILRetailTraceZone(ZONE_IOCTL, (TEXT("RilDrv: UNLOCKPHONE_PARAMS: szPassword=\"%a\"; fNewPassword=%d; szNewPassword=\"%a\"\r\n"),
                                ((UNLOCKPHONE_PARAMS *)pBufIn)->szPassword,
                                ((UNLOCKPHONE_PARAMS *)pBufIn)->fNewPassword,
                                ((UNLOCKPHONE_PARAMS *)pBufIn)->szNewPassword));
#endif
                break;
            case IOCTL_RIL_GETLOCKINGSTATUS:
                if (dwLenIn >= sizeof(GETLOCKINGSTATUS_PARAMS))
#ifdef RIL_FILTER_PIN_IN_RETAIL_OUTPUT
                    RILRetailTraceZone(ZONE_IOCTL, (TEXT("RilDrv: GETLOCKINGSTATUS_PARAMS: dwFacility=%d; fPassword=%d; szPassword=<xxx>\r\n"),
                                ((GETLOCKINGSTATUS_PARAMS *)pBufIn)->dwFacility,
                                ((GETLOCKINGSTATUS_PARAMS *)pBufIn)->fPassword));
#else
                    RILRetailTraceZone(ZONE_IOCTL, (TEXT("RilDrv: GETLOCKINGSTATUS_PARAMS: dwFacility=%d; fPassword=%d; szPassword=\"%a\"\r\n"),
                                ((GETLOCKINGSTATUS_PARAMS *)pBufIn)->dwFacility,
                                ((GETLOCKINGSTATUS_PARAMS *)pBufIn)->fPassword,
                                ((GETLOCKINGSTATUS_PARAMS *)pBufIn)->szPassword));
#endif
                break;
            case IOCTL_RIL_SETLOCKINGSTATUS:
                if (dwLenIn >= sizeof(SETLOCKINGSTATUS_PARAMS))
#ifdef RIL_FILTER_PIN_IN_RETAIL_OUTPUT
                    RILRetailTraceZone(ZONE_IOCTL, (TEXT("RilDrv: SETLOCKINGSTATUS_PARAMS: dwFacility=%d; fPassword=%d; szPassword=<xxx>; dwStatus=%d\r\n"),
                                ((SETLOCKINGSTATUS_PARAMS *)pBufIn)->dwFacility,
                                ((SETLOCKINGSTATUS_PARAMS *)pBufIn)->fPassword,
                                ((SETLOCKINGSTATUS_PARAMS *)pBufIn)->dwStatus));
#else
                    RILRetailTraceZone(ZONE_IOCTL, (TEXT("RilDrv: SETLOCKINGSTATUS_PARAMS: dwFacility=%d; fPassword=%d; szPassword=\"%a\"; dwStatus=%d\r\n"),
                                ((SETLOCKINGSTATUS_PARAMS *)pBufIn)->dwFacility,
                                ((SETLOCKINGSTATUS_PARAMS *)pBufIn)->fPassword,
                                ((SETLOCKINGSTATUS_PARAMS *)pBufIn)->szPassword,
                                ((SETLOCKINGSTATUS_PARAMS *)pBufIn)->dwStatus));
#endif
                break;
            case IOCTL_RIL_CHANGELOCKINGPASSWORD:
                if (dwLenIn >= sizeof(CHANGELOCKINGPASSWORD_PARAMS))
#ifdef RIL_FILTER_PIN_IN_RETAIL_OUTPUT
                    RILRetailTraceZone(ZONE_IOCTL, (TEXT("RilDrv: CHANGELOCKINGPASSWORD_PARAMS: dwFacility=%d; dwOldPasswordType=%d; szOldPassword=<xxxx>; szNewPassword=<yyyy>\r\n"),
                                ((CHANGELOCKINGPASSWORD_PARAMS *)pBufIn)->dwFacility,
                                ((CHANGELOCKINGPASSWORD_PARAMS *)pBufIn)->dwOldPasswordType));
#else
                    RILRetailTraceZone(ZONE_IOCTL, (TEXT("RilDrv: CHANGELOCKINGPASSWORD_PARAMS: dwFacility=%d; dwOldPasswordType=%d; szOldPassword=\"%a\"; szNewPassword=\"%a\"\r\n"),
                                ((CHANGELOCKINGPASSWORD_PARAMS *)pBufIn)->dwFacility,
                                ((CHANGELOCKINGPASSWORD_PARAMS *)pBufIn)->dwOldPasswordType,
                                ((CHANGELOCKINGPASSWORD_PARAMS *)pBufIn)->szOldPassword,
                                ((CHANGELOCKINGPASSWORD_PARAMS *)pBufIn)->szNewPassword));
#endif
                break;
            case IOCTL_RIL_GETCALLBARRINGSTATUS:
                if (dwLenIn >= sizeof(GETCALLBARRINGSTATUS_PARAMS))
#ifdef RIL_FILTER_PIN_IN_RETAIL_OUTPUT
                    RILRetailTraceZone(ZONE_IOCTL, (TEXT("RilDrv: GETCALLBARRINGSTATUS_PARAMS: dwType=%d; dwInfoClass=%d; fPassword=%d; szPassword=<xxxx>\r\n"),
                                ((GETCALLBARRINGSTATUS_PARAMS *)pBufIn)->dwType,
                                ((GETCALLBARRINGSTATUS_PARAMS *)pBufIn)->dwInfoClass,
                                ((GETCALLBARRINGSTATUS_PARAMS *)pBufIn)->fPassword));
#else
                    RILRetailTraceZone(ZONE_IOCTL, (TEXT("RilDrv: GETCALLBARRINGSTATUS_PARAMS: dwType=%d; dwInfoClass=%d; fPassword=%d; szPassword=\"%a\"\r\n"),
                                ((GETCALLBARRINGSTATUS_PARAMS *)pBufIn)->dwType,
                                ((GETCALLBARRINGSTATUS_PARAMS *)pBufIn)->dwInfoClass,
                                ((GETCALLBARRINGSTATUS_PARAMS *)pBufIn)->fPassword,
                                ((GETCALLBARRINGSTATUS_PARAMS *)pBufIn)->szPassword));
#endif
                break;
            case IOCTL_RIL_SETCALLBARRINGSTATUS:
                if (dwLenIn >= sizeof(SETCALLBARRINGSTATUS_PARAMS))
#ifdef RIL_FILTER_PIN_IN_RETAIL_OUTPUT
                    RILRetailTraceZone(ZONE_IOCTL, (TEXT("RilDrv: SETCALLBARRINGSTATUS_PARAMS: dwType=%d; dwInfoClass=%d; fPassword=%d; szPassword=<xxxx>; dwStatus=%d\r\n"),
                                ((SETCALLBARRINGSTATUS_PARAMS *)pBufIn)->dwType,
                                ((SETCALLBARRINGSTATUS_PARAMS *)pBufIn)->dwInfoClass,
                                ((SETCALLBARRINGSTATUS_PARAMS *)pBufIn)->fPassword,
                                ((SETCALLBARRINGSTATUS_PARAMS *)pBufIn)->dwStatus));
#else
                    RILRetailTraceZone(ZONE_IOCTL, (TEXT("RilDrv: SETCALLBARRINGSTATUS_PARAMS: dwType=%d; dwInfoClass=%d; fPassword=%d; szPassword=\"%a\"; dwStatus=%d\r\n"),
                                ((SETCALLBARRINGSTATUS_PARAMS *)pBufIn)->dwType,
                                ((SETCALLBARRINGSTATUS_PARAMS *)pBufIn)->dwInfoClass,
                                ((SETCALLBARRINGSTATUS_PARAMS *)pBufIn)->fPassword,
                                ((SETCALLBARRINGSTATUS_PARAMS *)pBufIn)->szPassword,
                                ((SETCALLBARRINGSTATUS_PARAMS *)pBufIn)->dwStatus));
#endif
                break;
            case IOCTL_RIL_CHANGECALLBARRINGPASSWORD:
                if (dwLenIn >= sizeof(CHANGECALLBARRINGPASSWORD_PARAMS))
#ifdef RIL_FILTER_PIN_IN_RETAIL_OUTPUT
                    RILRetailTraceZone(ZONE_IOCTL, (TEXT("RilDrv: CHANGECALLBARRINGPASSWORD_PARAMS: dwType=%d; szOldPassword=<xxxx>; szNewPassword=<yyyy>\r\n"),
                                ((CHANGECALLBARRINGPASSWORD_PARAMS *)pBufIn)->dwType));
#else
                    RILRetailTraceZone(ZONE_IOCTL, (TEXT("RilDrv: CHANGECALLBARRINGPASSWORD_PARAMS: dwType=%d; szOldPassword=\"%a\"; szNewPassword=\"%a\"\r\n"),
                                ((CHANGECALLBARRINGPASSWORD_PARAMS *)pBufIn)->dwType,
                                ((CHANGECALLBARRINGPASSWORD_PARAMS *)pBufIn)->szOldPassword,
                                ((CHANGECALLBARRINGPASSWORD_PARAMS *)pBufIn)->szNewPassword));
#endif
                break;
#if defined (IOCTL_RIL_CHANGECALLBARRINGPASSWORDEX)
            case IOCTL_RIL_CHANGECALLBARRINGPASSWORDEX:
                if (dwLenIn >= sizeof(CHANGECALLBARRINGPASSWORDEX_PARAMS))
#ifdef RIL_FILTER_PIN_IN_RETAIL_OUTPUT
                    RILRetailTraceZone(ZONE_IOCTL, (TEXT("RilDrv: CHANGECALLBARRINGPASSWORDEX_PARAMS: dwType=%d; szOldPassword=<xxxx>; szNewPassword=<yyyy>; szNewPasswordConfirm=<zzzz>\r\n"),
                                ((CHANGECALLBARRINGPASSWORDEX_PARAMS *)pBufIn)->dwType));
#else
                    RILRetailTraceZone(ZONE_IOCTL, (TEXT("RilDrv: CHANGECALLBARRINGPASSWORDEX_PARAMS: dwType=%d; szOldPassword=\"%a\"; szNewPassword=\"%a\"; szNewPasswordConfirm=\"%a\"\r\n"),
                                ((CHANGECALLBARRINGPASSWORDEX_PARAMS *)pBufIn)->dwType,
                                ((CHANGECALLBARRINGPASSWORDEX_PARAMS *)pBufIn)->szOldPassword,
                                ((CHANGECALLBARRINGPASSWORDEX_PARAMS *)pBufIn)->szNewPassword,
                                ((CHANGECALLBARRINGPASSWORDEX_PARAMS *)pBufIn)->szNewPasswordConfirm));
#endif
                break;
#endif
            case IOCTL_RIL_SETPHONEBOOKOPTIONS:
                if (dwLenIn >= sizeof(RILPHONEBOOKINFO))
                    RILRetailTraceZone(ZONE_IOCTL, (TEXT("RilDrv: RILPHONEBOOKINFO: dwParams=0x%X; dwStoreLocation=%d; dwUsed=%d; dwTotal=%d\r\n"),
                                ((RILPHONEBOOKINFO *)pBufIn)->dwParams,
                                ((RILPHONEBOOKINFO *)pBufIn)->dwStoreLocation,
                                ((RILPHONEBOOKINFO *)pBufIn)->dwUsed,
                                ((RILPHONEBOOKINFO *)pBufIn)->dwTotal));
                break;
            case IOCTL_RIL_READPHONEBOOKENTRIES:
                if (dwLenIn >= sizeof(READPHONEBOOKENTRIES_PARAMS))
                    RILRetailTraceZone(ZONE_IOCTL, (TEXT("RilDrv: READPHONEBOOKENTRIES_PARAMS: dwStartIndex=%d; dwEndIndex=%d\r\n"),
                                ((READPHONEBOOKENTRIES_PARAMS *)pBufIn)->dwStartIndex,
                                ((READPHONEBOOKENTRIES_PARAMS *)pBufIn)->dwEndIndex));
                break;
            case IOCTL_RIL_WRITEPHONEBOOKENTRY:
                if (dwLenIn >= sizeof(RILPHONEBOOKENTRY))
                    RILRetailTraceZone(ZONE_IOCTL, (TEXT("RilDrv: RILPHONEBOOKENTRY: dwParams=0x%X; dwIndex=%d; wszAddress=\"%s\"; wszText=\"%s\"\r\n"),
                                ((RILPHONEBOOKENTRY *)pBufIn)->dwParams,
                                ((RILPHONEBOOKENTRY *)pBufIn)->dwIndex,
                                ((RILPHONEBOOKENTRY *)pBufIn)->raAddress.wszAddress,
                                ((RILPHONEBOOKENTRY *)pBufIn)->wszText));
                break;
            case IOCTL_RIL_SENDSIMCMD:
                TraceDataBlock("pBufIn", pBufIn, dwLenIn);
                break;
            case IOCTL_RIL_SENDRESTRICTEDSIMCMD:
                if (dwLenIn >= sizeof(SENDRESTRICTEDSIMCMD_PARAMS)) {
                    char szFileName[MAX_SIMFILENAMELEN];

                    if (TraceGetSIMFileName(((SENDRESTRICTEDSIMCMD_PARAMS *)pBufIn)->rscpParameters.dwFileID, szFileName, MAX_SIMFILENAMELEN)) {
                        RILRetailTraceZone(ZONE_IOCTL, (TEXT("RilDrv: SENDRESTRICTEDSIMCMD_PARAMS: dwCommand=%d; dwFileID=%d (%a); dwParameter1=%d; dwParameter2=%d; dwParameter3=%d; dwParams=0x%X\r\n"),
                                ((SENDRESTRICTEDSIMCMD_PARAMS *)pBufIn)->dwCommand,
                                ((SENDRESTRICTEDSIMCMD_PARAMS *)pBufIn)->rscpParameters.dwFileID, szFileName,
                                ((SENDRESTRICTEDSIMCMD_PARAMS *)pBufIn)->rscpParameters.dwParameter1,
                                ((SENDRESTRICTEDSIMCMD_PARAMS *)pBufIn)->rscpParameters.dwParameter2,
                                ((SENDRESTRICTEDSIMCMD_PARAMS *)pBufIn)->rscpParameters.dwParameter3,
                                ((SENDRESTRICTEDSIMCMD_PARAMS *)pBufIn)->rscpParameters.dwParams));
                    }
                    else {
                        RILRetailTraceZone(ZONE_IOCTL, (TEXT("RilDrv: SENDRESTRICTEDSIMCMD_PARAMS: dwCommand=%d; dwFileID=%d; dwParameter1=%d; dwParameter2=%d; dwParameter3=%d; dwParams=0x%X\r\n"),
                                ((SENDRESTRICTEDSIMCMD_PARAMS *)pBufIn)->dwCommand,
                                ((SENDRESTRICTEDSIMCMD_PARAMS *)pBufIn)->rscpParameters.dwFileID,
                                ((SENDRESTRICTEDSIMCMD_PARAMS *)pBufIn)->rscpParameters.dwParameter1,
                                ((SENDRESTRICTEDSIMCMD_PARAMS *)pBufIn)->rscpParameters.dwParameter2,
                                ((SENDRESTRICTEDSIMCMD_PARAMS *)pBufIn)->rscpParameters.dwParameter3,
                                ((SENDRESTRICTEDSIMCMD_PARAMS *)pBufIn)->rscpParameters.dwParams));
                    }
                }
                break;
            case IOCTL_RIL_GETSIMRECORDSTATUS:
                if (dwLenIn >= sizeof(DWORD)) {
                    char szFileName[MAX_SIMFILENAMELEN];

                    if (TraceGetSIMFileName(*((DWORD *)pBufIn), szFileName, MAX_SIMFILENAMELEN)) {
                        RILRetailTraceZone(ZONE_NOTIFICATION, (TEXT("RilDrv: dwFileID: %d (%a)\r\n"), *((DWORD *)pBufIn), szFileName));
                    }
                    else {
                        RILRetailTraceZone(ZONE_NOTIFICATION, (TEXT("RilDrv: dwFileID: %d\r\n"), *((DWORD *)pBufIn)));
                    }
                }
                break;
            case IOCTL_RIL_SETSIMTOOLKITPROFILE:
                TraceDataBlock("pBufIn", pBufIn, dwLenIn);
#ifdef RILDRV_WM5_WM6
            case IOCTL_RIL_SENDSIMTOOLKITCMDRESPONSE:
                if (dwLenIn >= sizeof(SENDSIMTOOLKITCMDRESPONSE_PARAMS))
                    RILRetailTraceZone(ZONE_IOCTL, (TEXT("RilDrv: SENDSIMTOOLKITCMDRESPONSE_PARAMS: dwParams=0x%X; dwId=%d; dwTag=%d; dwType=%d; dwQualifier=%d; dwResponse=%d; dwAdditionalInfo=%d\r\n"),
                                ((SENDSIMTOOLKITCMDRESPONSE_PARAMS *)pBufIn)->rstrRsp.dwParams,
                                ((SENDSIMTOOLKITCMDRESPONSE_PARAMS *)pBufIn)->rstrRsp.dwId,
                                ((SENDSIMTOOLKITCMDRESPONSE_PARAMS *)pBufIn)->rstrRsp.dwTag,
                                ((SENDSIMTOOLKITCMDRESPONSE_PARAMS *)pBufIn)->rstrRsp.dwType,
                                ((SENDSIMTOOLKITCMDRESPONSE_PARAMS *)pBufIn)->rstrRsp.dwQualifier,
                                ((SENDSIMTOOLKITCMDRESPONSE_PARAMS *)pBufIn)->rstrRsp.dwResponse,
                                ((SENDSIMTOOLKITCMDRESPONSE_PARAMS *)pBufIn)->rstrRsp.dwAdditionalInfo));
                break;
            case IOCTL_RIL_SENDSIMTOOLKITEVENTDOWNLOAD:
                if (dwLenIn >= sizeof(SENDSIMTOOLKITEVENTDOWNLOAD_PARAMS)) {
                    RILRetailTraceZone(ZONE_IOCTL, (TEXT("RilDrv: SENDSIMTOOLKITEVENTDOWNLOAD_PARAMS: dwEvent=%d\r\n"),
                                ((SENDSIMTOOLKITEVENTDOWNLOAD_PARAMS *)pBufIn)->dwEvent));
                    TraceDataBlock("pBufIn", pBufIn+sizeof(DWORD), dwLenIn-sizeof(DWORD));
                }
                break;
#endif
            case IOCTL_RIL_DEVSPECIFIC:
                if (dwLenIn >= sizeof(DWORD))
                    RILRetailTraceZone(ZONE_IOCTL, (TEXT("RilDrv: dwCommand=0x%02X\r\n"), (*(DWORD*)pBufIn)));
                if (dwLenIn > sizeof(DWORD))
                    TraceDataBlock("pParam", pBufIn+sizeof(DWORD), dwLenIn-sizeof(DWORD));
                break;
            case IOCTL_RIL_SETGPRSCONTEXT:
                if (dwLenIn >= sizeof(RILGPRSCONTEXT))
                    RILRetailTraceZone(ZONE_IOCTL, (TEXT("RilDrv: RILGPRSCONTEXT: dwParams=0x%X; dwContextID=%d, dwProtocolType=%d; wszAccessPointName=\"%s\"; wszAddress=\"%s\"\r\n"),
                                ((RILGPRSCONTEXT *)pBufIn)->dwParams,
                                ((RILGPRSCONTEXT *)pBufIn)->dwContextID,
                                ((RILGPRSCONTEXT *)pBufIn)->dwProtocolType,
                                ((RILGPRSCONTEXT *)pBufIn)->wszAccessPointName,
                                ((RILGPRSCONTEXT *)pBufIn)->wszAddress));
                break;
            case IOCTL_RIL_SETREQUESTEDQUALITYOFSERVICE:
            case IOCTL_RIL_SETMINIMUMQUALITYOFSERVICE:
                if (dwLenIn >= sizeof(RILGPRSQOSPROFILE))
                    RILRetailTraceZone(ZONE_IOCTL, (TEXT("RilDrv: RILGPRSQOSPROFILE: dwParams=0x%X; dwContextID=%d; dwPrecedenceClass=%d; dwDelayClass=%d; dwReliabilityClass=%d; dwPeakThruClass=%d; dwMeanThruClass=%d\r\n"),
                                ((RILGPRSQOSPROFILE *)pBufIn)->dwContextID,
                                ((RILGPRSQOSPROFILE *)pBufIn)->dwContextID,
                                ((RILGPRSQOSPROFILE *)pBufIn)->dwPrecedenceClass,
                                ((RILGPRSQOSPROFILE *)pBufIn)->dwDelayClass,
                                ((RILGPRSQOSPROFILE *)pBufIn)->dwReliabilityClass,
                                ((RILGPRSQOSPROFILE *)pBufIn)->dwPeakThruClass,
                                ((RILGPRSQOSPROFILE *)pBufIn)->dwMeanThruClass));
                break;
            case IOCTL_RIL_SETGPRSCONTEXTACTIVATED:
                if (dwLenIn >= sizeof(SETGPRSCONTEXTACTIVATED_PARAMS))
                    RILRetailTraceZone(ZONE_IOCTL, (TEXT("RilDrv: SETGPRSCONTEXTACTIVATED_PARAMS: dwContextID=%d; fContextActivation=%d\r\n"),
                                ((SETGPRSCONTEXTACTIVATED_PARAMS *)pBufIn)->dwContextID,
                                ((SETGPRSCONTEXTACTIVATED_PARAMS *)pBufIn)->fContextActivation));
                break;
            case IOCTL_RIL_ENTERGPRSDATAMODE:
                if (dwLenIn >= sizeof(RILENTERGPRSDATAMODE) + sizeof(DWORD))
                    RILRetailTraceZone(ZONE_IOCTL, (TEXT("RilDrv: RILENTERGPRSDATAMODE: dwL2Protocol=%d; dwNumContexts=%d; dwContextID=%d\r\n"),
                                ((RILENTERGPRSDATAMODE *)pBufIn)->dwL2Protocol,
                                ((RILENTERGPRSDATAMODE *)pBufIn)->dwNumContexts,
                                ((RILENTERGPRSDATAMODE *)pBufIn)->dwContextID[0]));
                break;
            case IOCTL_RIL_SENDFLASH:
                if (dwLenIn >= sizeof(RILADDRESS) && pBufIn != NULL)
                    RILRetailTraceZone(ZONE_IOCTL, (TEXT("RilDrv: RILADDRESS: dwParams=%d; dwType=%d; dwNumPlan=%d wszAddress=\"%s\"\r\n"),
                                ((RILADDRESS *)pBufIn)->dwParams,
                                ((RILADDRESS *)pBufIn)->dwType,
                                ((RILADDRESS *)pBufIn)->dwNumPlan,
                                ((RILADDRESS *)pBufIn)->wszAddress));
                break;
            default:
                break;
        }
    }
}
#ifdef RILDRV_CE6
#pragma warning ( pop )
#endif

#pragma warning ( push )
// Disable warning to avoid unnecessarily complicated ifdef-construct
#pragma warning ( disable : 4100 )
void TraceIOCTLCallReturn(HRESULT dwIOCTL, HRESULT hr)
{
    UINT iPos = 0;

    if ((g_dwDebugZones&ZONE_IOCTL) == 0)
        return;

    while (iPos < NUM_ADDTRACEIOCTLS) {
        if (dwIOCTL == g_oTableIOCTLs[iPos].dwCode)
            break;
        iPos++;
    }
    if (iPos >= NUM_ADDTRACEIOCTLS) {
        if (SUCCEEDED(hr))
            RILRetailTraceZone(ZONE_IOCTL, (TEXT("RilDrv: IOCTL: %d ID: %d\r\n"), (dwIOCTL >> 2) & 0xFFF, hr));
        else
            RILRetailTraceZone(ZONE_IOCTL, (TEXT("RilDrv: IOCTL: %d call failed 0x%x\r\n"), (dwIOCTL >> 2) & 0xFFF, hr));
    }
    else {
        if (SUCCEEDED(hr)) {
            RILRetailTraceZone(ZONE_IOCTL, (TEXT("RilDrv: IOCTL: %a ID: %d\r\n"), g_oTableIOCTLs[iPos].pszText, hr));
        }
        else {
            UINT iPosE = 0;

            while (iPosE < NUM_ADDTRACEERRORCODES) {
                if (hr == (HRESULT)g_oTableErrCode[iPosE].dwCode)
                    break;
                iPosE++;
            }
            if (iPosE >= NUM_ADDTRACEERRORCODES)
                RILRetailTraceZone(ZONE_IOCTL, (TEXT("RilDrv: IOCTL: %a call failed 0x%x\r\n"), g_oTableIOCTLs[iPos].pszText, hr));
            else
                RILRetailTraceZone(ZONE_IOCTL, (TEXT("RilDrv: IOCTL: %a call failed %a (0x%x)\r\n"), g_oTableIOCTLs[iPos].pszText, g_oTableErrCode[iPosE].pszText, hr));
        }
    }
}

static void TraceIOCTLCallAsynchReturnOK(DWORD dwID, const APIID dwAPIID, const void* const pBlob, const UINT cbBlob)
{
    UINT iPos = 0;

    RILRetailTraceZone(ZONE_IOCTL, (TEXT("RilDrv: IOCTL Response ID: %d Code: RIL_RESULT_OK\r\n"), dwID));
    if (pBlob == NULL) {
        // If there is no data given, abort here.
        if (cbBlob > 0)
            RILRetailTraceZone(ZONE_IOCTL, (TEXT("RilDrv: Missing data in response.\r\n")));
        return;
    }
    switch (dwAPIID)
    {
#if defined(IOCTL_RIL_GETSMSNLTABLELIST)
        case IOCTL_RIL_GETSMSNLTABLELIST:
#endif
        case APIID_GETALLOPERATORSLIST:
            // This output is intentionally not traced.
            break;
        case APIID_GETAUDIOMUTING:
        case APIID_GETCALLBARRINGSTATUS:
        case APIID_GETCALLWAITINGSETTINGS:
        case APIID_GETCURRENTADDRESSID:
        case APIID_GETCURRENTSYSTEMTYPE:
        case APIID_GETGPRSATTACHED:
        case APIID_GETGPRSCLASS:
        case APIID_GETGPRSREGISTRATIONSTATUS:
        case APIID_GETLINESTATUS:
        case APIID_GETLOCKINGSTATUS:
        case APIID_GETMOSMSSERVICE:
        case APIID_GETPHONELOCKEDSTATE:
        case APIID_GETREGISTRATIONSTATUS:
        case APIID_SENDMSG:
        case APIID_SENDSTOREDMSG:
        case APIID_WRITEMSG:
        case APIID_GETPREFERREDPRIVACYMODE:
        case APIID_GETCURRENTPRIVACYSTATUS:
            if (cbBlob >= sizeof(DWORD))
                RILRetailTraceZone(ZONE_IOCTL, (TEXT("RilDrv: DWORD: %d (0x%X)\r\n"), *((DWORD *)pBlob), *((DWORD *)pBlob)));
            break;
        case APIID_GETAUDIODEVICES:
            if (cbBlob >= sizeof(RILAUDIODEVICEINFO))
                RILRetailTraceZone(ZONE_IOCTL, (TEXT("RilDrv: RILAUDIODEVICEINFO: dwParams=0x%X; dwTxDevice=%d; dwRxDevice=%d\r\n"),
                        ((RILAUDIODEVICEINFO *)pBlob)->dwParams,
                        ((RILAUDIODEVICEINFO *)pBlob)->dwTxDevice,
                        ((RILAUDIODEVICEINFO *)pBlob)->dwRxDevice));
            break;
        case APIID_GETAUDIOGAIN:
            if (cbBlob >= sizeof(RILGAININFO))
                RILRetailTraceZone(ZONE_IOCTL, (TEXT("RilDrv: RILGAININFO: dwParams=0x%X; dwTxGain=%d; dwRxGain=%d\r\n"),
                        ((RILGAININFO *)pBlob)->dwParams,
                        ((RILGAININFO *)pBlob)->dwTxGain,
                        ((RILGAININFO *)pBlob)->dwRxGain));
            break;
        case APIID_GETBEARERSERVICEOPTIONS:
            if (cbBlob >= sizeof(RILBEARERSVCINFO))
                RILRetailTraceZone(ZONE_IOCTL, (TEXT("RilDrv: RILBEARERSVCINFO: dwParams=0x%X; dwSpeed=%d; dwServiceName=%d; dwConnectionElement=%d\r\n"),
                        ((RILBEARERSVCINFO *)pBlob)->dwParams,
                        ((RILBEARERSVCINFO *)pBlob)->dwSpeed,
                        ((RILBEARERSVCINFO *)pBlob)->dwServiceName,
                        ((RILBEARERSVCINFO *)pBlob)->dwConnectionElement));
            break;
        case APIID_GETCALLERIDSETTINGS:
            if (cbBlob >= sizeof(RILCALLERIDSETTINGS))
                RILRetailTraceZone(ZONE_IOCTL, (TEXT("RilDrv: RILCALLERIDSETTINGS: dwParams=0x%X; dwStatus=%d; dwProvisioning=%d\r\n"),
                        ((RILCALLERIDSETTINGS *)pBlob)->dwParams,
                        ((RILCALLERIDSETTINGS *)pBlob)->dwStatus,
                        ((RILCALLERIDSETTINGS *)pBlob)->dwProvisioning));
            break;
        case APIID_GETCALLFORWARDINGSETTINGS:
            if (cbBlob >= sizeof(RILCALLFORWARDINGSETTINGS))
                RILRetailTraceZone(ZONE_IOCTL, (TEXT("RilDrv: RILCALLFORWARDINGSETTINGS: dwParams=0x%X; dwStatus=%d; dwInfoClasses=%d; raAddress=\"%s\";dwDelayTime=%d\r\n"),
                        ((RILCALLFORWARDINGSETTINGS *)pBlob)->dwParams,
                        ((RILCALLFORWARDINGSETTINGS *)pBlob)->dwStatus,
                        ((RILCALLFORWARDINGSETTINGS *)pBlob)->dwInfoClasses,
                        ((RILCALLFORWARDINGSETTINGS *)pBlob)->raAddress.wszAddress,
                        ((RILCALLFORWARDINGSETTINGS *)pBlob)->dwDelayTime));
            break;
        case APIID_GETCALLLIST:
            iPos = 0;
            while (cbBlob >= (iPos+1) * sizeof(RILCALLINFO)) {
                RILCALLINFO* pC = (RILCALLINFO*)pBlob;

                pC += iPos;
                if ((pC->dwParams & RIL_PARAM_CI_ADDRESS) && (pC->dwParams & RIL_PARAM_CI_DESCRIPTION))
                    RILRetailTraceZone(ZONE_IOCTL, (TEXT("RilDrv: RILCALLINFO: (%d) dwParams=0x%X; dwID=%d; dwDirection=%d; dwStatus=%d; dwType=%d; dwMultiparty=%d; raAddress=\"%s\"; wszDescription=\"%s\"\r\n"), iPos, pC->dwParams, pC->dwID, pC->dwDirection, pC->dwStatus, pC->dwType, pC->dwMultiparty, pC->raAddress.wszAddress, pC->wszDescription));
                else if (pC->dwParams & RIL_PARAM_CI_ADDRESS)
                    RILRetailTraceZone(ZONE_IOCTL, (TEXT("RilDrv: RILCALLINFO: (%d) dwParams=0x%X; dwID=%d; dwDirection=%d; dwStatus=%d; dwType=%d; dwMultiparty=%d; raAddress=\"%s\"\r\n"), iPos, pC->dwParams, pC->dwID, pC->dwDirection, pC->dwStatus, pC->dwType, pC->dwMultiparty, pC->raAddress.wszAddress));
                else
                    RILRetailTraceZone(ZONE_IOCTL, (TEXT("RilDrv: RILCALLINFO: (%d) dwParams=0x%X; dwID=%d; dwDirection=%d; dwStatus=%d; dwType=%d; dwMultiparty=%d\r\n"), iPos, pC->dwParams, pC->dwID, pC->dwDirection, pC->dwStatus, pC->dwType, pC->dwMultiparty));
                iPos++;
            }
            break;
        case APIID_GETCBMSGCONFIG:
            if (cbBlob >= sizeof(RILCBMSGCONFIG))
                RILRetailTraceZone(ZONE_IOCTL, (TEXT("RilDrv: RILCBMSGCONFIG: dwParams=0x%X; dwBroadcastMsgLangs=%d; fAccept=%d\r\n"),
                        ((RILCBMSGCONFIG *)pBlob)->dwParams,
                        ((RILCBMSGCONFIG *)pBlob)->dwBroadcastMsgLangs,
                        ((RILCBMSGCONFIG *)pBlob)->fAccept));
            break;
        case APIID_GETCELLTOWERINFO:
            if (cbBlob >= sizeof(RILCELLTOWERINFO))
                RILRetailTraceZone(ZONE_IOCTL, (TEXT("RilDrv: RILCELLTOWERINFO: dwParams=0x%X; dwMobileCountryCode=%d; dwMobileNetworkCode=%d; dwLocationAreaCode=%d; dwCellID=%d; dwBaseStationID=%d; dwBroadcastControlChannel=%d; dwRxLevel=%d; dwRxLevelFull=%d; dwRxLevelSub=%d; dwRxQuality=%d; dwRxQualityFull=%d; dwRxQualitySub=%d\r\n"),
                        ((RILCELLTOWERINFO *)pBlob)->dwParams,
                        ((RILCELLTOWERINFO *)pBlob)->dwMobileCountryCode,
                        ((RILCELLTOWERINFO *)pBlob)->dwMobileNetworkCode,
                        ((RILCELLTOWERINFO *)pBlob)->dwLocationAreaCode,
                        ((RILCELLTOWERINFO *)pBlob)->dwCellID,
                        ((RILCELLTOWERINFO *)pBlob)->dwBaseStationID,
                        ((RILCELLTOWERINFO *)pBlob)->dwBroadcastControlChannel,
                        ((RILCELLTOWERINFO *)pBlob)->dwRxLevel,
                        ((RILCELLTOWERINFO *)pBlob)->dwRxLevelFull,
                        ((RILCELLTOWERINFO *)pBlob)->dwRxLevelSub,
                        ((RILCELLTOWERINFO *)pBlob)->dwRxQuality,
                        ((RILCELLTOWERINFO *)pBlob)->dwRxQualityFull,
                        ((RILCELLTOWERINFO *)pBlob)->dwRxQualitySub));
            break;
#if defined(IOCTL_RIL_GETPOSITIONINFO)
        case APIID_GETPOSITIONINFO:
            if (cbBlob >= sizeof(RILPOSITIONINFO))
                if (((RILPOSITIONINFO *)pBlob)->dwType == RIL_POSITIONTYPE_GSM) {
#ifdef RILDRV_CE7
                    RILRetailTraceZone(ZONE_IOCTL, (TEXT("RilDrv: RILPOSITIONINFO: dwParams=0x%X; dwType=%d; dwMobileCountryCode=%d; dwMobileNetworkCode=%d; dwLocationAreaCode=%d; dwCellID=%d\r\n"),
                        ((RILPOSITIONINFO *)pBlob)->dwParams,
                        ((RILPOSITIONINFO *)pBlob)->dwType,
                        ((RILPOSITIONINFO *)pBlob)->positionInfoGSM.dwMobileCountryCode,
                        ((RILPOSITIONINFO *)pBlob)->positionInfoGSM.dwMobileNetworkCode,
                        ((RILPOSITIONINFO *)pBlob)->positionInfoGSM.dwLocationAreaCode,
                        ((RILPOSITIONINFO *)pBlob)->positionInfoGSM.dwCellID));
#else
                    RILRetailTraceZone(ZONE_IOCTL, (TEXT("RilDrv: RILPOSITIONINFO: dwParams=0x%X; dwType=%d; dwMobileCountryCode=%d; dwMobileNetworkCode=%d; dwLocationAreaCode=%d; dwCellID=%d; dwBaseStationID=%d; dwARFCN=%d; dwRxLevel=%d\r\n"),
                        ((RILPOSITIONINFO *)pBlob)->dwParams,
                        ((RILPOSITIONINFO *)pBlob)->dwType,
                        ((RILPOSITIONINFO *)pBlob)->positionInfoGSM.dwMobileCountryCode,
                        ((RILPOSITIONINFO *)pBlob)->positionInfoGSM.dwMobileNetworkCode,
                        ((RILPOSITIONINFO *)pBlob)->positionInfoGSM.dwLocationAreaCode,
                        ((RILPOSITIONINFO *)pBlob)->positionInfoGSM.dwCellID,
                        ((RILPOSITIONINFO *)pBlob)->positionInfoGSM.dwBaseStationID,
                        ((RILPOSITIONINFO *)pBlob)->positionInfoGSM.dwARFCN,
                        ((RILPOSITIONINFO *)pBlob)->positionInfoGSM.dwRxLevel));
#endif
                }
                else {
#ifdef RILDRV_CE7
                    RILRetailTraceZone(ZONE_IOCTL, (TEXT("RilDrv: RILPOSITIONINFO: dwParams=0x%X; dwType=%d; dwMobileCountryCode=%d; dwMobileNetworkCode=%d; dwCellID=%d; dwPrimaryScramblingCode=%d\r\n"),
                        ((RILPOSITIONINFO *)pBlob)->dwParams,
                        ((RILPOSITIONINFO *)pBlob)->dwType,
                        ((RILPOSITIONINFO *)pBlob)->positionInfoUMTS.dwMobileCountryCode,
                        ((RILPOSITIONINFO *)pBlob)->positionInfoUMTS.dwMobileNetworkCode,
                        ((RILPOSITIONINFO *)pBlob)->positionInfoUMTS.dwCellID,
                        ((RILPOSITIONINFO *)pBlob)->positionInfoUMTS.dwPrimaryScramblingCode));
#else
                    RILRetailTraceZone(ZONE_IOCTL, (TEXT("RilDrv: RILPOSITIONINFO: dwParams=0x%X; dwType=%d; dwMobileCountryCode=%d; dwMobileNetworkCode=%d; dwLocationAreaCode=%d; dwCellID=%d; dwPrimaryScramblingCode=%d; dwUARFCN=%d; dwRSCP=%d\r\n"),
                        ((RILPOSITIONINFO *)pBlob)->dwParams,
                        ((RILPOSITIONINFO *)pBlob)->dwType,
                        ((RILPOSITIONINFO *)pBlob)->positionInfoUMTS.dwMobileCountryCode,
                        ((RILPOSITIONINFO *)pBlob)->positionInfoUMTS.dwMobileNetworkCode,
                        ((RILPOSITIONINFO *)pBlob)->positionInfoUMTS.dwLocationAreaCode,
                        ((RILPOSITIONINFO *)pBlob)->positionInfoUMTS.dwCellID,
                        ((RILPOSITIONINFO *)pBlob)->positionInfoUMTS.dwPrimaryScramblingCode,
                        ((RILPOSITIONINFO *)pBlob)->positionInfoUMTS.dwUARFCN,
                        ((RILPOSITIONINFO *)pBlob)->positionInfoUMTS.dwRSCP));
#endif
                }
            break;
#endif
        case APIID_GETCLOSEDGROUPSETTINGS:
            if (cbBlob >= sizeof(RILCLOSEDGROUPSETTINGS))
                RILRetailTraceZone(ZONE_IOCTL, (TEXT("RilDrv: RILCLOSEDGROUPSETTINGS: dwParams=0x%X; dwStatus=%d; dwIndex=%d; dwInfo=%d\r\n"),
                        ((RILCLOSEDGROUPSETTINGS *)pBlob)->dwParams,
                        ((RILCLOSEDGROUPSETTINGS *)pBlob)->dwStatus,
                        ((RILCLOSEDGROUPSETTINGS *)pBlob)->dwIndex,
                        ((RILCLOSEDGROUPSETTINGS *)pBlob)->dwInfo));
            break;
        case APIID_GETCURRENTOPERATOR:
            if (cbBlob >= sizeof(RILOPERATORNAMES))
                RILRetailTraceZone(ZONE_IOCTL, (TEXT("RilDrv: RILOPERATORNAMES: dwParams=0x%X; szLongName=\"%a\"; szShortName=\"%a\"; szNumName=\"%a\"; szCountryCode=\"%a\"\r\n"),
                        ((RILOPERATORNAMES *)pBlob)->dwParams,
                        ((RILOPERATORNAMES *)pBlob)->szLongName,
                        ((RILOPERATORNAMES *)pBlob)->szShortName,
                        ((RILOPERATORNAMES *)pBlob)->szNumName,
                        ((RILOPERATORNAMES *)pBlob)->szCountryCode));
            break;
        case APIID_GETDIALEDIDSETTINGS:
            if (cbBlob >= sizeof(RILDIALEDIDSETTINGS))
                RILRetailTraceZone(ZONE_IOCTL, (TEXT("RilDrv: RILDIALEDIDSETTINGS: dwParams=0x%X; dwStatus=%d; dwProvisioning=%d\r\n"),
                        ((RILDIALEDIDSETTINGS *)pBlob)->dwParams,
                        ((RILDIALEDIDSETTINGS *)pBlob)->dwStatus,
                        ((RILDIALEDIDSETTINGS *)pBlob)->dwProvisioning));
            break;
        case APIID_GETEQUIPMENTINFO:
            if (cbBlob >= sizeof(RILEQUIPMENTINFO))
                RILRetailTraceZone(ZONE_IOCTL, (TEXT("RilDrv: RILEQUIPMENTINFO: dwParams=0x%X; szManufacturer=\"%a\"; szModel=\"%a\"; szRevision=\"%a\"; szSerialNumber=\"%a\"\r\n"),
                        ((RILEQUIPMENTINFO *)pBlob)->dwParams,
                        ((RILEQUIPMENTINFO *)pBlob)->szManufacturer,
                        ((RILEQUIPMENTINFO *)pBlob)->szModel,
                        ((RILEQUIPMENTINFO *)pBlob)->szRevision,
                        ((RILEQUIPMENTINFO *)pBlob)->szSerialNumber));
            break;
        case APIID_GETEQUIPMENTSTATE:
            if (cbBlob >= sizeof(RILEQUIPMENTSTATE))
                RILRetailTraceZone(ZONE_IOCTL, (TEXT("RilDrv: RILEQUIPMENTSTATE: dwParams=0x%X; dwRadioSupport=%d; dwEqState=%d; dwReadyState=%d\r\n"),
                        ((RILEQUIPMENTSTATE *)pBlob)->dwParams,
                        ((RILEQUIPMENTSTATE *)pBlob)->dwRadioSupport,
                        ((RILEQUIPMENTSTATE *)pBlob)->dwEqState,
                        ((RILEQUIPMENTSTATE *)pBlob)->dwReadyState));
            break;
        case APIID_GETGPRSCONTEXTACTIVATEDLIST:
            iPos = 0;
            while (cbBlob >= (iPos+1) * sizeof(RILGPRSCONTEXTACTIVATED)) {
                RILGPRSCONTEXTACTIVATED *pG = (RILGPRSCONTEXTACTIVATED*)pBlob;

                pG += iPos;
                RILRetailTraceZone(ZONE_IOCTL, (TEXT("RilDrv: RILGPRSCONTEXTACTIVATED: (%d) dwEvent=%d; dwContextID=%d; fActivated=%d\r\n"),
                        iPos, pG->dwEvent, pG->dwContextID, pG->fActivated));
                iPos++;
            }
            break;
        case APIID_GETGPRSCONTEXTLIST:
            iPos = 0;
            while (cbBlob >= (iPos+1) * sizeof(RILGPRSCONTEXT)) {
                RILGPRSCONTEXT *pG = (RILGPRSCONTEXT*)pBlob;

                pG += iPos;
                RILRetailTraceZone(ZONE_IOCTL, (TEXT("RilDrv: RILGPRSCONTEXT: (%d) dwParams=0x%X; dwContextID=%d; dwProtocolType=%d; wszAccessPointName=\"%s\"\r\n"),
                        iPos,pG->dwParams, pG->dwContextID, pG->dwProtocolType, pG->wszAccessPointName));
                iPos++;
            }
            break;
        case APIID_GETHIDECONNECTEDIDSETTINGS:
            if (cbBlob >= sizeof(RILHIDECONNECTEDIDSETTINGS))
                RILRetailTraceZone(ZONE_IOCTL, (TEXT("RilDrv: RILHIDECONNECTEDIDSETTINGS: dwParams=0x%X; dwStatus=%d; dwProvisioning=%d\r\n"),
                        ((RILHIDECONNECTEDIDSETTINGS *)pBlob)->dwParams,
                        ((RILHIDECONNECTEDIDSETTINGS *)pBlob)->dwStatus,
                        ((RILHIDECONNECTEDIDSETTINGS *)pBlob)->dwProvisioning));
            break;
        case APIID_GETHIDEIDSETTINGS:
            if (cbBlob >= sizeof(RILHIDEIDSETTINGS))
                RILRetailTraceZone(ZONE_IOCTL, (TEXT("RilDrv: RILHIDEIDSETTINGS: dwParams=0x%X; dwStatus=%d; dwProvisioning=%d\r\n"),
                        ((RILHIDEIDSETTINGS *)pBlob)->dwParams,
                        ((RILHIDEIDSETTINGS *)pBlob)->dwStatus,
                        ((RILHIDEIDSETTINGS *)pBlob)->dwProvisioning));
            break;
        case APIID_GETREQUESTEDQUALITYOFSERVICELIST:
        case APIID_GETMINIMUMQUALITYOFSERVICELIST:
            if (cbBlob >= sizeof(RILGPRSQOSPROFILE))
                RILRetailTraceZone(ZONE_IOCTL, (TEXT("RilDrv: RILGPRSQOSPROFILE: dwParams=0x%X; dwContextID=%d; dwPrecedenceClass=%d; dwDelayClass=%d; dwReliabilityClass=%d; dwPeakThruClass=%d; dwMeanThruClass=%d\r\n"),
                        ((RILGPRSQOSPROFILE *)pBlob)->dwParams,
                        ((RILGPRSQOSPROFILE *)pBlob)->dwContextID,
                        ((RILGPRSQOSPROFILE *)pBlob)->dwPrecedenceClass,
                        ((RILGPRSQOSPROFILE *)pBlob)->dwDelayClass,
                        ((RILGPRSQOSPROFILE *)pBlob)->dwReliabilityClass,
                        ((RILGPRSQOSPROFILE *)pBlob)->dwPeakThruClass,
                        ((RILGPRSQOSPROFILE *)pBlob)->dwMeanThruClass));
            break;
        case APIID_GETMSGCONFIG:
            if (cbBlob >= sizeof(RILMSGCONFIG))
                RILRetailTraceZone(ZONE_IOCTL, (TEXT("RilDrv: RILMSGCONFIG: dwParams=0x%X; raSvcCtrAddress=\"%s\"\r\n"),
                        ((RILMSGCONFIG *)pBlob)->dwParams,
                        ((RILMSGCONFIG *)pBlob)->raSvcCtrAddress.wszAddress));
            break;
        case APIID_GETMSGSERVICEOPTIONS:
            if (cbBlob >= sizeof(RILMSGSERVICEINFO))
                RILRetailTraceZone(ZONE_IOCTL, (TEXT("RilDrv: RILMSGSERVICEINFO: dwParams=0x%X; dwService=%d; dwMsgClasses=%d\r\n"),
                        ((RILMSGSERVICEINFO *)pBlob)->dwParams,
                        ((RILMSGSERVICEINFO *)pBlob)->dwService,
                        ((RILMSGSERVICEINFO *)pBlob)->dwMsgClasses));
                RILRetailTraceZone(ZONE_IOCTL, (TEXT("RilDrv: RILMSGSERVICEINFO: dwReadLocation=%d; dwReadUsed=%d; dwReadTotal=%d\r\n"),
                        ((RILMSGSERVICEINFO *)pBlob)->dwReadLocation,
                        ((RILMSGSERVICEINFO *)pBlob)->dwReadUsed,
                        ((RILMSGSERVICEINFO *)pBlob)->dwReadTotal));
                RILRetailTraceZone(ZONE_IOCTL, (TEXT("RilDrv: RILMSGSERVICEINFO: dwWriteLocation=%d; dwWriteUsed=%d; dwWriteTotal=%d\r\n"),
                        ((RILMSGSERVICEINFO *)pBlob)->dwWriteLocation,
                        ((RILMSGSERVICEINFO *)pBlob)->dwWriteUsed,
                        ((RILMSGSERVICEINFO *)pBlob)->dwWriteTotal));
                RILRetailTraceZone(ZONE_IOCTL, (TEXT("RilDrv: RILMSGSERVICEINFO: dwStoreLocation=%d; dwStoreUsed=%d; dwStoreTotal=%d\r\n"),
                        ((RILMSGSERVICEINFO *)pBlob)->dwStoreLocation,
                        ((RILMSGSERVICEINFO *)pBlob)->dwStoreUsed,
                        ((RILMSGSERVICEINFO *)pBlob)->dwStoreTotal));
            break;
        case APIID_GETOPERATORLIST:
        case APIID_GETPREFERREDOPERATORLIST:
            iPos = 0;
            while (cbBlob >= (iPos+1) * sizeof(RILOPERATORINFO)) {
                RILOPERATORINFO *pR = (RILOPERATORINFO *)pBlob;

                pR += iPos;
                RILRetailTraceZone(ZONE_IOCTL, (TEXT("RilDrv: RILOPERATORINFO: (%d) dwParams=0x%X; dwIndex=%d; dwStatus=%d; ronNames=\"%a\"\r\n"),
                        iPos, pR->dwParams, pR->dwIndex, pR->dwStatus, pR->ronNames.szLongName));
                iPos++;
            }
            break;
        case APIID_GETPHONEBOOKOPTIONS:
            if (cbBlob >= sizeof(RILPHONEBOOKINFO))
                RILRetailTraceZone(ZONE_IOCTL, (TEXT("RilDrv: RILPHONEBOOKINFO: dwParams=0x%X; dwStoreLocation=%d; dwUsed=%d; dwTotal=%d\r\n"),
                        ((RILPHONEBOOKINFO *)pBlob)->dwParams,
                        ((RILPHONEBOOKINFO *)pBlob)->dwStoreLocation,
                        ((RILPHONEBOOKINFO *)pBlob)->dwUsed,
                        ((RILPHONEBOOKINFO *)pBlob)->dwTotal));
            break;
        case APIID_GETRLPOPTIONS:
            if (cbBlob >= sizeof(RILRLPINFO))
                RILRetailTraceZone(ZONE_IOCTL, (TEXT("RilDrv: RILRLPINFO: dwParams=0x%X; dwIWS=%d; dwMWS=%d; dwAckTimer=%d; dwRetransmissionAttempts=%d\r\n"),
                        ((RILRLPINFO *)pBlob)->dwParams,
                        ((RILRLPINFO *)pBlob)->dwIWS,
                        ((RILRLPINFO *)pBlob)->dwMWS,
                        ((RILRLPINFO *)pBlob)->dwAckTimer,
                        ((RILRLPINFO *)pBlob)->dwRetransmissionAttempts));
            break;
        case APIID_GETSIGNALQUALITY:
            if (cbBlob >= sizeof(RILSIGNALQUALITY))
                RILRetailTraceZone(ZONE_IOCTL, (TEXT("RilDrv: RILSIGNALQUALITY: dwParams=0x%X; nSignalStrength=%d; nMinSignalStrength=%d; nMaxSignalStrength=%d; dwBitErrorRate=%d; nLowSignalStrength=%d; nHighSignalStrength=%d\r\n"),
                        ((RILSIGNALQUALITY *)pBlob)->dwParams,
                        ((RILSIGNALQUALITY *)pBlob)->nSignalStrength,
                        ((RILSIGNALQUALITY *)pBlob)->nMinSignalStrength,
                        ((RILSIGNALQUALITY *)pBlob)->nMaxSignalStrength,
                        ((RILSIGNALQUALITY *)pBlob)->dwBitErrorRate,
                        ((RILSIGNALQUALITY *)pBlob)->nLowSignalStrength,
                        ((RILSIGNALQUALITY *)pBlob)->nHighSignalStrength));
            break;
        case APIID_GETSIMRECORDSTATUS:
            if (cbBlob >= sizeof(RILSIMRECORDSTATUS))
                RILRetailTraceZone(ZONE_IOCTL, (TEXT("RilDrv: RILSIMRECORDSTATUS: dwParams=0x%X; dwRecordType=%d; dwItemCount=%d; dwSize=%d\r\n"),
                        ((RILSIMRECORDSTATUS *)pBlob)->dwParams,
                        ((RILSIMRECORDSTATUS *)pBlob)->dwRecordType,
                        ((RILSIMRECORDSTATUS *)pBlob)->dwItemCount,
                        ((RILSIMRECORDSTATUS *)pBlob)->dwSize));
            break;
        case APIID_GETSUBSCRIBERNUMBERS:
            iPos = 0;
            while (cbBlob >= (iPos+1) * sizeof(RILSUBSCRIBERINFO)) {
                RILSUBSCRIBERINFO *pS = (RILSUBSCRIBERINFO *)pBlob;

                pS += iPos;
                RILRetailTraceZone(ZONE_IOCTL, (TEXT("RilDrv: RILSUBSCRIBERINFO: (%d) dwParams=0x%X; raAddress=\"%s\"; wszDescription=\"%s\"\r\n"), iPos, pS->dwParams, pS->raAddress.wszAddress, pS->wszDescription));
                iPos++;
            }
            break;
        case APIID_READMSG:
            if (cbBlob >= sizeof(RILMESSAGEINFO)) {
                RILRetailTraceZone(ZONE_IOCTL, (TEXT("RilDrv: RILMESSAGEINFO: dwParams=0x%X; dwIndex=%d; dwStatus=%d\r\n"),
                        ((RILMESSAGEINFO *)pBlob)->dwParams,
                        ((RILMESSAGEINFO *)pBlob)->dwIndex,
                        ((RILMESSAGEINFO *)pBlob)->dwStatus));
                RILRetailTraceZone(ZONE_IOCTL, (TEXT("RilDrv: RILMESSAGE: rmMessage.dwType=0x%X; rmMessage.dwFlags=0x%X\r\n"),
                        ((RILMESSAGEINFO *)pBlob)->rmMessage.dwType,
                        ((RILMESSAGEINFO *)pBlob)->rmMessage.dwFlags));
                if (((RILMESSAGEINFO *)pBlob)->rmMessage.dwType ==  RIL_MSGTYPE_IN_DELIVER)
                {
                    RILRetailTraceZone(ZONE_IOCTL, (TEXT("RilDrv: RILMESSAGE: address = \"%s\"\r\n"), ((RILMESSAGEINFO *)pBlob)->rmMessage.msgInDeliver.raOrigAddress.wszAddress));
                    RILRetailTraceZone(ZONE_IOCTL, (TEXT("RilDrv: RILMESSAGE: protocol = %d\r\n"), ((RILMESSAGEINFO *)pBlob)->rmMessage.msgInDeliver.dwProtocolID));
                    RILRetailTraceZone(ZONE_IOCTL, (TEXT("RilDrv: RILMESSAGE: DCS type = %d\r\n"), ((RILMESSAGEINFO *)pBlob)->rmMessage.msgInDeliver.rmdDataCoding.dwType));
                    RILRetailTraceZone(ZONE_IOCTL, (TEXT("RilDrv: RILMESSAGE: DCS flags = 0x%X\r\n"), ((RILMESSAGEINFO *)pBlob)->rmMessage.msgInDeliver.rmdDataCoding.dwFlags));
                    RILRetailTraceZone(ZONE_IOCTL, (TEXT("RilDrv: RILMESSAGE: DCS class = %d\r\n"), ((RILMESSAGEINFO *)pBlob)->rmMessage.msgInDeliver.rmdDataCoding.dwMsgClass));
                    RILRetailTraceZone(ZONE_IOCTL, (TEXT("RilDrv: RILMESSAGE: DCS alphabet = %d\r\n"), ((RILMESSAGEINFO *)pBlob)->rmMessage.msgInDeliver.rmdDataCoding.dwAlphabet));
                    RILRetailTraceZone(ZONE_IOCTL, (TEXT("RilDrv: RILMESSAGE: msg length = %d\r\n"), ((RILMESSAGEINFO *)pBlob)->rmMessage.msgInDeliver.cchMsgLength));
                    TraceDataBlock("RILMESSAGE: rgbMsg", ((RILMESSAGEINFO *)pBlob)->rmMessage.msgInDeliver.rgbMsg, ((RILMESSAGEINFO *)pBlob)->rmMessage.msgInDeliver.cchMsgLength);
                }
            }
            break;
        case APIID_READPHONEBOOKENTRIES:
            iPos = 0;
            while (cbBlob >= (iPos+1) * sizeof(RILPHONEBOOKENTRY)) {
                RILPHONEBOOKENTRY *pP = (RILPHONEBOOKENTRY *)pBlob;

                pP += iPos;
                RILRetailTraceZone(ZONE_IOCTL, (TEXT("RilDrv: RILPHONEBOOKENTRY: (%d) dwParams=0x%X; dwIndex=%d; raAddress=\"%s\"; wszText=\"%s\"\r\n"),
                        iPos, pP->dwParams, pP->dwIndex, pP->raAddress.wszAddress, pP->wszText));
                iPos++;
            }
            break;
        case APIID_SENDRESTRICTEDSIMCMD:
            if (cbBlob >= sizeof(RILSIMRESPONSE))
                RILRetailTraceZone(ZONE_IOCTL, (TEXT("RilDrv: RILSIMRESPONSE: dwParams=0x%X; dwStatusWord1=%d; dwStatusWord2=%d\r\n"),
                        ((RILSIMRESPONSE *)pBlob)->dwParams,
                        ((RILSIMRESPONSE *)pBlob)->dwStatusWord1,
                        ((RILSIMRESPONSE *)pBlob)->dwStatusWord2));
            if (cbBlob > sizeof(RILSIMRESPONSE))
                TraceDataBlock("Return Data", (PBYTE)pBlob+sizeof(RILSIMRESPONSE), cbBlob-sizeof(RILSIMRESPONSE));
            break;
        default:
            if (cbBlob > 0)
                TraceDataBlock("Return Data", (PBYTE)pBlob, cbBlob);
            break;
    }
}

static void TraceIOCTLCallAsynchReturnError(DWORD dwID, const void* const pBlob, const UINT cbBlob)
{
    if (cbBlob >= sizeof(DWORD)) {
        HRESULT hr = *((HRESULT *)pBlob);
        UINT iPosE = 0;

        while (iPosE < NUM_ADDTRACEERRORCODES) {
            if (hr == g_oTableErrCode[iPosE].dwCode)
                break;
            iPosE++;
        }
        if (iPosE >= NUM_ADDTRACEERRORCODES)
            RILRetailTraceZone(ZONE_IOCTL, (TEXT("RilDrv: IOCTL Response ID: %d Code: RIL_RESULT_ERROR Error: 0x%X\r\n"), dwID, hr));
        else
            RILRetailTraceZone(ZONE_IOCTL, (TEXT("RilDrv: IOCTL Response ID: %d Code: RIL_RESULT_ERROR Error: %a (0x%X)\r\n"), dwID, g_oTableErrCode[iPosE].pszText, hr));
    }
    else {
        RILRetailTraceZone(ZONE_IOCTL, (TEXT("RilDrv: IOCTL Response ID: %d Code: RIL_RESULT_ERROR\r\n"), dwID));
    }
}
#pragma warning ( pop )

void TraceIOCTLCallAsynchReturn(DWORD dwID, const APIID dwAPIID, const DWORD dwResponseCode, const void* const pBlob, const UINT cbBlob)
{
    if ((g_dwDebugZones&ZONE_IOCTL) == 0)
        return;

    switch (dwResponseCode)
    {
        case RIL_RESULT_OK:
            TraceIOCTLCallAsynchReturnOK(dwID, dwAPIID, pBlob, cbBlob);
            break;
        case RIL_RESULT_ERROR:
            TraceIOCTLCallAsynchReturnError(dwID, pBlob, cbBlob);
            break;
        case RIL_RESULT_BUSY:
            RILRetailTraceZone(ZONE_IOCTL, (TEXT("RilDrv: IOCTL Response ID: %d Code: RIL_RESULT_BUSY\r\n"), dwID));
            break;
        case RIL_RESULT_NOCARRIER:
            RILRetailTraceZone(ZONE_IOCTL, (TEXT("RilDrv: IOCTL Response ID: %d Code: RIL_RESULT_NOCARRIER\r\n"), dwID));
            break;
        case RIL_RESULT_NODIALTONE:
            RILRetailTraceZone(ZONE_IOCTL, (TEXT("RilDrv: IOCTL Response ID: %d Code: RIL_RESULT_NODIALTONE\r\n"), dwID));
            break;
        case RIL_RESULT_NOANSWER:
            RILRetailTraceZone(ZONE_IOCTL, (TEXT("RilDrv: IOCTL Response ID: %d Code: RIL_RESULT_NOANSWER\r\n"), dwID));
            break;
#if defined(RIL_RESULT_CALLABORTED)
        case RIL_RESULT_CALLABORTED:
            RILRetailTraceZone(ZONE_IOCTL, (TEXT("RilDrv: IOCTL Response ID: %d Code: RIL_RESULT_CALLABORTED\r\n"), dwID));
            break;
#endif
#if defined(RIL_RESULT_CALLDROPPED)
        case RIL_RESULT_CALLDROPPED:
            RILRetailTraceZone(ZONE_IOCTL, (TEXT("RilDrv: IOCTL Response ID: %d Code: RIL_RESULT_CALLDROPPED\r\n"), dwID));
            break;
#endif
        default:
            RILRetailTraceZone(ZONE_IOCTL, (TEXT("RilDrv: IOCTL Response ID: %d Code: %d\r\n"), dwID, dwResponseCode));
            break;
    }
}

#ifdef RILDRV_CE6
#pragma warning ( push )
// Disable unnecessary warning about using HRESULT in switch/case statement.
#pragma warning ( disable : 6221 )
#endif
void TraceNotification(const CNotificationData *pNotification)
{
    HRESULT dwCode;
    UINT iPos = 0;

    if ((g_dwDebugZones&ZONE_NOTIFICATION) == 0)
        return;

    dwCode = pNotification->GetCode();
    while (iPos < NUM_ADDTRACENOTIFICATIONS) {
        if (dwCode == g_oTableNotifications[iPos].dwCode)
            break;
        iPos++;
    }
    if (iPos >= NUM_ADDTRACENOTIFICATIONS) {
        RILRetailTraceZone(ZONE_NOTIFICATION, (TEXT("RilDrv: Broadcast notification: 0x%x\r\n"), dwCode));
    }
    else {
        const void* pBlob= pNotification->GetBlob();
        UINT dwSize = pNotification->GetSize();

        RILRetailTraceZone(ZONE_NOTIFICATION, (TEXT("RilDrv: Broadcast notification: %a\r\n"), g_oTableNotifications[iPos].pszText));
        if (pBlob == NULL) {
            // If there is no data given, abort here.
            if (dwSize > 0)
                RILRetailTraceZone(ZONE_NOTIFICATION, (TEXT("RilDrv: Missing data in notification.\r\n")));
            return;
        }
        switch (dwCode) {
            case RIL_NOTIFY_RING:
                if (dwSize >= sizeof(RILRINGINFO))
                    RILRetailTraceZone(ZONE_NOTIFICATION, (TEXT("RilDrv: RILRINGINFO: dwParam=%X; dwCallType=%X dwAddressId=%d\r\n"), ((RILRINGINFO *)pBlob)->dwParams, ((RILRINGINFO *)pBlob)->dwCallType, ((RILRINGINFO *)pBlob)->dwAddressId));
                break;
            case RIL_NOTIFY_MESSAGE:
            case RIL_NOTIFY_BCMESSAGE:
            case RIL_NOTIFY_STATUSMESSAGE:
                if (dwSize >= sizeof(RILMESSAGE)) {
                    if (((RILMESSAGE *)pBlob)->dwType ==  RIL_MSGTYPE_IN_DELIVER)
                    {
                        RILRetailTraceZone(ZONE_NOTIFICATION, (TEXT("RilDrv: RILMESSAGE: msg type = RIL_MSGTYPE_IN_DELIVER (0x%X)\r\n"), ((RILMESSAGE *)pBlob)->dwType));
                        RILRetailTraceZone(ZONE_NOTIFICATION, (TEXT("RilDrv: RILMESSAGE: msg flags = 0x%X\r\n"), ((RILMESSAGE *)pBlob)->dwFlags));
                        RILRetailTraceZone(ZONE_NOTIFICATION, (TEXT("RilDrv: RILMESSAGE: address = \"%s\"\r\n"), ((RILMESSAGE *)pBlob)->msgInDeliver.raOrigAddress.wszAddress));
                        RILRetailTraceZone(ZONE_NOTIFICATION, (TEXT("RilDrv: RILMESSAGE: protocol = %d\r\n"), ((RILMESSAGE *)pBlob)->msgInDeliver.dwProtocolID));
                        RILRetailTraceZone(ZONE_NOTIFICATION, (TEXT("RilDrv: RILMESSAGE: DCS type = %d\r\n"), ((RILMESSAGE *)pBlob)->msgInDeliver.rmdDataCoding.dwType));
                        RILRetailTraceZone(ZONE_NOTIFICATION, (TEXT("RilDrv: RILMESSAGE: DCS flags = 0x%X\r\n"), ((RILMESSAGE *)pBlob)->msgInDeliver.rmdDataCoding.dwFlags));
                        RILRetailTraceZone(ZONE_NOTIFICATION, (TEXT("RilDrv: RILMESSAGE: DCS class = %d\r\n"), ((RILMESSAGE *)pBlob)->msgInDeliver.rmdDataCoding.dwMsgClass));
                        RILRetailTraceZone(ZONE_NOTIFICATION, (TEXT("RilDrv: RILMESSAGE: DCS alphabet = %d\r\n"), ((RILMESSAGE *)pBlob)->msgInDeliver.rmdDataCoding.dwAlphabet));
                        RILRetailTraceZone(ZONE_NOTIFICATION, (TEXT("RilDrv: RILMESSAGE: msg length = %d\r\n"), ((RILMESSAGE *)pBlob)->msgInDeliver.cchMsgLength));
                        TraceDataBlock("RILMESSAGE: rgbMsg", ((RILMESSAGE *)pBlob)->msgInDeliver.rgbMsg, ((RILMESSAGE *)pBlob)->msgInDeliver.cchMsgLength);
                    }
                    else if (((RILMESSAGE *)pBlob)->dwType ==  RIL_MSGTYPE_IN_IS637DELIVER)
                    {
                        RILRetailTraceZone(ZONE_NOTIFICATION, (TEXT("RilDrv: RILMESSAGE: msg type = RIL_MSGTYPE_IN_IS637DELIVER (0x%X)\r\n"), ((RILMESSAGE *)pBlob)->dwType));
                        RILRetailTraceZone(ZONE_NOTIFICATION, (TEXT("RilDrv: RILMESSAGE: msg flags = 0x%X\r\n"), ((RILMESSAGE *)pBlob)->dwFlags));
                        RILRetailTraceZone(ZONE_NOTIFICATION, (TEXT("RilDrv: RILMESSAGE: address = \"%s\"\r\n"), ((RILMESSAGE *)pBlob)->msgIS637InDeliver.raOrigAddress.wszAddress));
                        RILRetailTraceZone(ZONE_NOTIFICATION, (TEXT("RilDrv: RILMESSAGE: teleservice = %d\r\n"), ((RILMESSAGE *)pBlob)->msgIS637InDeliver.dwTeleservice));
                        RILRetailTraceZone(ZONE_NOTIFICATION, (TEXT("RilDrv: RILMESSAGE: msg ID = %d\r\n"), ((RILMESSAGE *)pBlob)->msgIS637InDeliver.dwMsgID));
                        RILRetailTraceZone(ZONE_NOTIFICATION, (TEXT("RilDrv: RILMESSAGE: display modes = 0x%X\r\n"), ((RILMESSAGE *)pBlob)->msgIS637InDeliver.dwMsgDisplayMode));
                        RILRetailTraceZone(ZONE_NOTIFICATION, (TEXT("RilDrv: RILMESSAGE: user ack = %d\r\n"), ((RILMESSAGE *)pBlob)->msgIS637InDeliver.bUserAckRequest));
                        RILRetailTraceZone(ZONE_NOTIFICATION, (TEXT("RilDrv: RILMESSAGE: priority = %d\r\n"), ((RILMESSAGE *)pBlob)->msgIS637InDeliver.dwMsgPriority));
                        RILRetailTraceZone(ZONE_NOTIFICATION, (TEXT("RilDrv: RILMESSAGE: privacy = %d\r\n"), ((RILMESSAGE *)pBlob)->msgIS637InDeliver.dwMsgPrivacy));
                        RILRetailTraceZone(ZONE_NOTIFICATION, (TEXT("RilDrv: RILMESSAGE: msg length = %d\r\n"), ((RILMESSAGE *)pBlob)->msgIS637InDeliver.cchMsgLength));
                        TraceDataBlock("RILMESSAGE: rgbMsg", ((RILMESSAGE *)pBlob)->msgIS637InDeliver.rgbMsg, ((RILMESSAGE *)pBlob)->msgIS637InDeliver.cchMsgLength);
                    }
                    else if (((RILMESSAGE *)pBlob)->dwType ==  RIL_MSGTYPE_IN_IS637STATUS)
                    {
                        RILRetailTraceZone(ZONE_NOTIFICATION, (TEXT("RilDrv: RILMESSAGE: msg type = RIL_MSGTYPE_IN_IS637STATUS (0x%X)\r\n"), ((RILMESSAGE *)pBlob)->dwType));
                        RILRetailTraceZone(ZONE_NOTIFICATION, (TEXT("RilDrv: RILMESSAGE: msg flags = 0x%X\r\n"), ((RILMESSAGE *)pBlob)->dwFlags));
                        RILRetailTraceZone(ZONE_NOTIFICATION, (TEXT("RilDrv: RILMESSAGE: address = \"%s\"\r\n"), ((RILMESSAGE *)pBlob)->msgIS637InStatus.raOrigAddress.wszAddress));
                        RILRetailTraceZone(ZONE_NOTIFICATION, (TEXT("RilDrv: RILMESSAGE: cause code = %d\r\n"), ((RILMESSAGE *)pBlob)->msgIS637InStatus.dwCauseCode));
                        RILRetailTraceZone(ZONE_NOTIFICATION, (TEXT("RilDrv: RILMESSAGE: user response code = %d\r\n"), ((RILMESSAGE *)pBlob)->msgIS637InStatus.dwUserResponseCode));
                        RILRetailTraceZone(ZONE_NOTIFICATION, (TEXT("RilDrv: RILMESSAGE: msg ID = %d\r\n"), ((RILMESSAGE *)pBlob)->msgIS637InStatus.dwMsgID));
                        RILRetailTraceZone(ZONE_NOTIFICATION, (TEXT("RilDrv: RILMESSAGE: reply sequence no = 0x%X\r\n"), ((RILMESSAGE *)pBlob)->msgIS637InStatus.dwReplySeqNumber));
                        RILRetailTraceZone(ZONE_NOTIFICATION, (TEXT("RilDrv: RILMESSAGE: msg status type = %d\r\n"), ((RILMESSAGE *)pBlob)->msgIS637InStatus.dwMsgStatusType));
                        RILRetailTraceZone(ZONE_NOTIFICATION, (TEXT("RilDrv: RILMESSAGE: language = %d\r\n"), ((RILMESSAGE *)pBlob)->msgIS637InStatus.dwMsgLang));
                        RILRetailTraceZone(ZONE_NOTIFICATION, (TEXT("RilDrv: RILMESSAGE: encoding = %d\r\n"), ((RILMESSAGE *)pBlob)->msgIS637InStatus.dwMsgEncoding));
                        RILRetailTraceZone(ZONE_NOTIFICATION, (TEXT("RilDrv: RILMESSAGE: msg length = %d\r\n"), ((RILMESSAGE *)pBlob)->msgIS637InStatus.cchMsgLength));
                        TraceDataBlock("RILMESSAGE: rgbMsg", ((RILMESSAGE *)pBlob)->msgIS637InDeliver.rgbMsg, ((RILMESSAGE *)pBlob)->msgIS637InStatus.cchMsgLength);
                    }
                    else {
                        RILRetailTraceZone(ZONE_NOTIFICATION, (TEXT("RilDrv: RILMESSAGE: msg type = 0x%X\r\n"), ((RILMESSAGE *)pBlob)->dwType));
                        RILRetailTraceZone(ZONE_NOTIFICATION, (TEXT("RilDrv: RILMESSAGE: msg flags = 0x%X\r\n"), ((RILMESSAGE *)pBlob)->dwFlags));
                    }
                }
                break;
            case RIL_NOTIFY_MSGSTORAGECHANGED:
                if (dwSize >= sizeof(RILMSGSTORAGEINFO))
                    RILRetailTraceZone(ZONE_NOTIFICATION, (TEXT("RilDrv: RILMSGSTORAGEINFO: dwParam=%X; dwReadLocation=%d; dwWriteLocation=%d; dwStoreLocation=%d\r\n"), ((RILMSGSTORAGEINFO *)pBlob)->dwParams, ((RILMSGSTORAGEINFO *)pBlob)->dwReadLocation, ((RILMSGSTORAGEINFO *)pBlob)->dwWriteLocation, ((RILMSGSTORAGEINFO *)pBlob)->dwStoreLocation));
                break;
            case RIL_NOTIFY_MESSAGE_IN_SIM:
            case RIL_NOTIFY_BCMESSAGE_IN_SIM:
            case RIL_NOTIFY_STATUSMESSAGE_IN_SIM:
                if (dwSize >= sizeof(RILMESSAGE_IN_SIM))
                    RILRetailTraceZone(ZONE_NOTIFICATION, (TEXT("RilDrv: RILMESSAGE_IN_SIM: dwParam=%X; dwLocation=%d; dwIndex=%d\r\n"), ((RILMESSAGE_IN_SIM *)pBlob)->dwParams, ((RILMESSAGE_IN_SIM *)pBlob)->dwLocation, ((RILMESSAGE_IN_SIM *)pBlob)->dwIndex));
                break;
            case RIL_NOTIFY_DISCONNECT:
            case RIL_NOTIFY_CALLMETER:
            case RIL_NOTIFY_REGSTATUSCHANGED:
            case RIL_NOTIFY_GPRSREGSTATUSCHANGED:
            case RIL_NOTIFY_SYSTEMCHANGED:
            case RIL_NOTIFY_SYSTEMCAPSCHANGED:
            case RIL_NOTIFY_PHONEBOOKENTRYSTORED:
            case RIL_NOTIFY_PHONEBOOKENTRYDELETED:
            case RIL_NOTIFY_PHONEBOOKSTORAGECHANGED:
            case RIL_NOTIFY_SIMTOOLKITCALLSETUP:
            case RIL_NOTIFY_RADIOPRESENCECHANGED:
            case RIL_NOTIFY_SIMSTATUSCHANGED:
            case RIL_NOTIFY_DEVSPECIFIC_EMERG_SHUTDOWN:
            case RIL_NOTIFY_DEVSPECIFIC_EMERG_SHUTDOWN_WARN:
            case RIL_NOTIFY_DEVSPECIFIC_NSMC_STATUS_CHANGE:
            case RIL_NOTIFY_DEVSPECIFIC_LAST_READYSTATE_MSG:
            case RIL_NOTIFY_DEVSPECIFIC_REGSTATUS_EX:
            case RIL_NOTIFY_DEVSPECIFIC_GPS_ACTIVITY:
            case RIL_NOTIFY_DEVSPECIFIC_FW_UPDATE_PROGRESS:
            case RIL_NOTIFY_DEVSPECIFIC_FW_UPDATE_END:
            case RIL_NOTIFY_DEVSPECIFIC_AUDIO_UPDATE_PROGRESS:
            case RIL_NOTIFY_DEVSPECIFIC_AUDIO_UPDATE_END:
            case RIL_NOTIFY_DEVSPECIFIC_CDMA_PRL_UPDATE_PROGRESS:
            case RIL_NOTIFY_DEVSPECIFIC_CDMA_PRL_UPDATE_END:
            case RIL_NOTIFY_DEVSPECIFIC_NWL_UPDATE_PROGRESS:
            case RIL_NOTIFY_DEVSPECIFIC_NWL_UPDATE_END:
            case RIL_NOTIFY_DEVSPECIFIC_CDMA_PRI_UPDATE_PROGRESS:
            case RIL_NOTIFY_DEVSPECIFIC_CDMA_PRI_UPDATE_END:
            case RIL_NOTIFY_DEVSPECIFIC_NVITEM_UPDATE_PROGRESS:
            case RIL_NOTIFY_DEVSPECIFIC_NVITEM_UPDATE_END:
#if defined(RIL_NOTIFY_GPRSATTACHED)
            case RIL_NOTIFY_GPRSATTACHED:
#endif
                if (dwSize >= sizeof(DWORD))
                    RILRetailTraceZone(ZONE_NOTIFICATION, (TEXT("RilDrv: DWORD parameter: %d (0x%X)\r\n"), *((DWORD *)pBlob), *((DWORD *)pBlob)));
                break;
            case RIL_NOTIFY_DEVSPECIFIC_CALL_RELEASE_CAUSE:
            case RIL_NOTIFY_DEVSPECIFIC_NETWORK_REJECT_CAUSE:
            case RIL_NOTIFY_DTMFSIGNAL:
                if (dwSize > 0)
                    RILRetailTraceZone(ZONE_NOTIFICATION, (TEXT("RilDrv: String parameter: %a\r\n"), (char *)pBlob));
                break;
            case RIL_NOTIFY_DEVSPECIFIC_FW_UPDATE_START:
            case RIL_NOTIFY_DEVSPECIFIC_AUDIO_UPDATE_START:
            case RIL_NOTIFY_DEVSPECIFIC_CDMA_PRL_UPDATE_START:
            case RIL_NOTIFY_DEVSPECIFIC_NWL_UPDATE_START:
            case RIL_NOTIFY_DEVSPECIFIC_CDMA_PRI_UPDATE_START:
            case RIL_NOTIFY_DEVSPECIFIC_NVITEM_UPDATE_START:
                if (dwSize > 0)
                    RILRetailTraceZone(ZONE_NOTIFICATION, (TEXT("RilDrv: String parameter: %s\r\n"), (WCHAR *)pBlob));
                break;
            case RIL_NOTIFY_LOCATIONUPDATE:
                if (dwSize >= sizeof(RILLOCATIONINFO))
                    RILRetailTraceZone(ZONE_NOTIFICATION, (TEXT("RilDrv: RILLOCATIONINFO: dwLocationAreaCode=%X dwAddressId = %X\r\n"),
                            ((RILLOCATIONINFO *)pBlob)->dwLocationAreaCode,
                            ((RILLOCATIONINFO *)pBlob)->dwCellID));
                break;
            case RIL_NOTIFY_CALLERID:
            case RIL_NOTIFY_DIALEDID:
                if (dwSize >= sizeof(RILREMOTEPARTYINFO))
                    RILRetailTraceZone(ZONE_NOTIFICATION, (TEXT("RilDrv: RILREMOTEPARTYINFO: dwParam=%X; raAddress=\"%s\" wszDescription=\"%s\"\r\n"),
                            ((RILREMOTEPARTYINFO *)pBlob)->dwParams,
                            ((RILREMOTEPARTYINFO *)pBlob)->raAddress.wszAddress,
                            ((RILREMOTEPARTYINFO *)pBlob)->wszDescription));
                break;
            case RIL_NOTIFY_CALLWAITING:
                if (dwSize >= sizeof(RILCALLWAITINGINFO))
                    RILRetailTraceZone(ZONE_NOTIFICATION, (TEXT("RilDrv: RILCALLWAITINGINFO: dwParam=%X; dwCallType=%X; dwAddressId=%X; raAddress=\"%s\" wszDescription=\"%s\"\r\n"),
                            ((RILCALLWAITINGINFO *)pBlob)->dwParams,
                            ((RILCALLWAITINGINFO *)pBlob)->dwCallType,
                            ((RILCALLWAITINGINFO *)pBlob)->dwAddressId,
                            ((RILCALLWAITINGINFO *)pBlob)->rrpiCallerInfo.raAddress.wszAddress,
                            ((RILCALLWAITINGINFO *)pBlob)->rrpiCallerInfo.wszDescription));
                break;
            case RIL_NOTIFY_SUPSERVICEDATA:
                if (dwSize >= sizeof(RILSUPSERVICEDATA)) {
                    RILRetailTraceZone(ZONE_NOTIFICATION, (TEXT("RilDrv: RILSUPSERVICEDATA: dwParam=%X; dwStatus=%X\r\n"),
                            ((RILSUPSERVICEDATA *)pBlob)->dwParams,
                            ((RILSUPSERVICEDATA *)pBlob)->dwStatus));
                    TraceDataBlock("RILSUPSERVICEDATA: pbData", ((RILSUPSERVICEDATA *)pBlob)->pbData, ((RILSUPSERVICEDATA *)pBlob)->cbSize - sizeof(RILSUPSERVICEDATA));
                }
                break;
            case RIL_NOTIFY_INTERMEDIATESS:
                if (dwSize >= sizeof(RILINTERMEDIATESSINFO))
                RILRetailTraceZone(ZONE_NOTIFICATION, (TEXT("RilDrv: RILINTERMEDIATESSINFO: dwParam=%X; dwNotificationCode=%X dwCallUserGroupIndex=%d\r\n"),
                            ((RILINTERMEDIATESSINFO *)pBlob)->dwParams,
                            ((RILINTERMEDIATESSINFO *)pBlob)->dwNotificationCode,
                            ((RILINTERMEDIATESSINFO *)pBlob)->dwCallUserGroupIndex));
                break;
            case RIL_NOTIFY_UNSOLICITEDSS:
                if (dwSize >= sizeof(RILUNSOLICITEDSSINFO))
                RILRetailTraceZone(ZONE_NOTIFICATION, (TEXT("RilDrv: RILUNSOLICITEDSSINFO: dwParam=%X; dwNotificationCode=%X dwCallUserGroupIndex=%d\r\n"),
                            ((RILUNSOLICITEDSSINFO *)pBlob)->dwParams,
                            ((RILUNSOLICITEDSSINFO *)pBlob)->dwNotificationCode,
                            ((RILUNSOLICITEDSSINFO *)pBlob)->dwCallUserGroupIndex));
                break;
#if defined (RIL_NOTIFY_GPRS_DISCONNECT)
            case RIL_NOTIFY_GPRS_DISCONNECT:
                if (dwSize >= sizeof(RILGPRSCONTEXTACTIVATED))
                RILRetailTraceZone(ZONE_NOTIFICATION, (TEXT("RilDrv: RILGPRSCONTEXTACTIVATED: dwContextID=%d dwEvent=%X fActivated=%d\r\n"),
                            ((RILGPRSCONTEXTACTIVATED *)pBlob)->dwContextID,
                            ((RILGPRSCONTEXTACTIVATED *)pBlob)->dwEvent,
                            ((RILGPRSCONTEXTACTIVATED *)pBlob)->fActivated));
                break;
#endif
            case RIL_NOTIFY_SIMTOOLKITCMD:
            case RIL_NOTIFY_SIMTOOLKITEVENT:
                TraceDataBlock("SIMTOOLKIT: pbData", (PBYTE)pBlob, dwSize);
                break;
            case RIL_NOTIFY_RADIOEQUIPMENTSTATECHANGED:
                if (dwSize >= sizeof(RILEQUIPMENTSTATE))
                    RILRetailTraceZone(ZONE_NOTIFICATION, (TEXT("RilDrv: RILEQUIPMENTSTATE: dwParam=%X; dwRadioSupport=%d dwEqState=%d dwReadyState=%d\r\n"),
                            ((RILEQUIPMENTSTATE *)pBlob)->dwParams,
                            ((RILEQUIPMENTSTATE *)pBlob)->dwRadioSupport,
                            ((RILEQUIPMENTSTATE *)pBlob)->dwEqState,
                            ((RILEQUIPMENTSTATE *)pBlob)->dwReadyState));
                break;
            case RIL_NOTIFY_SIGNALQUALITY:
                if (dwSize >= sizeof(RILSIGNALQUALITY))
                    RILRetailTraceZone(ZONE_NOTIFICATION, (TEXT("RilDrv: RILSIGNALQUALITY: dwParam=%X; nSignalStrength=%d nMinSignalStrength=%d nMaxSignalStrength=%d dwBitErrorRate=%d nLowSignalStrength=%d nHighSignalStrength=%d\r\n"),
                            ((RILSIGNALQUALITY *)pBlob)->dwParams,
                            ((RILSIGNALQUALITY *)pBlob)->nSignalStrength,
                            ((RILSIGNALQUALITY *)pBlob)->nMinSignalStrength,
                            ((RILSIGNALQUALITY *)pBlob)->nMaxSignalStrength,
                            ((RILSIGNALQUALITY *)pBlob)->dwBitErrorRate,
                            ((RILSIGNALQUALITY *)pBlob)->nLowSignalStrength,
                            ((RILSIGNALQUALITY *)pBlob)->nHighSignalStrength));
                break;
            case RIL_NOTIFY_DIAL:
                RILRetailTraceZone(ZONE_NOTIFICATION, (TEXT("RilDrv: RILDIALINFO: hrCmdId=%d dwCallId=%d\r\n"),
                            ((RILDIALINFO *)pBlob)->hrCmdId,
                            ((RILDIALINFO *)pBlob)->dwCallId));
                break;
            case RIL_NOTIFY_CALLPROGRESSINFO:
                RILRetailTraceZone(ZONE_NOTIFICATION, (TEXT("RilDrv: RILCALLINFO: Number=%d\r\n"), dwSize / sizeof(RILCALLINFO)));
                iPos = 0;
                while (dwSize >= (iPos+1) * sizeof(RILCALLINFO)) {
                    RILCALLINFO* pC = (RILCALLINFO*)pBlob;

                    pC += iPos;
                    if ((pC->dwParams & RIL_PARAM_CI_ADDRESS) && (pC->dwParams & RIL_PARAM_CI_DESCRIPTION))
                        RILRetailTraceZone(ZONE_IOCTL, (TEXT("RilDrv: RILCALLINFO: (%d) dwParams=0x%X; dwID=%d; dwDirection=%d; dwStatus=%d; dwType=%d; dwMultiparty=%d; raAddress=\"%s\"; wszDescription=\"%s\"\r\n"), iPos, pC->dwParams, pC->dwID, pC->dwDirection, pC->dwStatus, pC->dwType, pC->dwMultiparty, pC->raAddress.wszAddress, pC->wszDescription));
                    else if (pC->dwParams & RIL_PARAM_CI_ADDRESS)
                        RILRetailTraceZone(ZONE_IOCTL, (TEXT("RilDrv: RILCALLINFO: (%d) dwParams=0x%X; dwID=%d; dwDirection=%d; dwStatus=%d; dwType=%d; dwMultiparty=%d; raAddress=\"%s\"\r\n"), iPos, pC->dwParams, pC->dwID, pC->dwDirection, pC->dwStatus, pC->dwType, pC->dwMultiparty, pC->raAddress.wszAddress));
                    else
                        RILRetailTraceZone(ZONE_IOCTL, (TEXT("RilDrv: RILCALLINFO: (%d) dwParams=0x%X; dwID=%d; dwDirection=%d; dwStatus=%d; dwType=%d; dwMultiparty=%d\r\n"), iPos, pC->dwParams, pC->dwID, pC->dwDirection, pC->dwStatus, pC->dwType, pC->dwMultiparty));
                    iPos++;
                }
                break;
#if defined(RIL_NOTIFY_SIMSECURITYSTATUS)
            case RIL_NOTIFY_SIMSECURITYSTATUS:
                if (dwSize >= sizeof(RILSIMSECURITYSTATUS))
                    RILRetailTraceZone(ZONE_NOTIFICATION, (TEXT("RilDrv: RILSIMSECURITYSTATUS: dwLockedState=0x%X; dwSimSecurityState=0x%X\r\n"),
                            ((RILSIMSECURITYSTATUS *)pBlob)->dwLockedState,
                            ((RILSIMSECURITYSTATUS *)pBlob)->dwSimSecurityState));
                break;
#endif
#if defined(RIL_NOTIFY_NITZ)
            case RIL_NOTIFY_NITZ:
                if (dwSize >= sizeof(RILNITZINFO)) {
                    char szTime[25];
                    LPSYSTEMTIME pTime;

                    pTime = &((RILNITZINFO *)pBlob)->SysTime;
                    (void)_snprintfz(szTime, 25, "%d:%02d:%02d %d/%d/%d", pTime->wHour, pTime->wMinute, pTime->wSecond, pTime->wYear, pTime->wMonth, pTime->wDay);
                    RILRetailTraceZone(ZONE_NOTIFICATION, (TEXT("RilDrv: RILNITZINFO: dwParam=%X; dwNotificationCode=%X TimeZoneOffsetMinutes=%d DaylightSavingOffsetMinutes=%d SysTime=%a\r\n"),
                            ((RILNITZINFO *)pBlob)->dwParams,
                            ((RILNITZINFO *)pBlob)->dwNotificationCode,
                            ((RILNITZINFO *)pBlob)->TimeZoneOffsetMinutes,
                            ((RILNITZINFO *)pBlob)->DaylightSavingOffsetMinutes, szTime));
                }
                break;
#endif
            default:
                break;
        }
    }
   return;
}
#ifdef RILDRV_CE6
#pragma warning ( pop )
#endif
#else
void TraceNotification(const CNotificationData *pNotification)
{
    RILRetailTraceZone(ZONE_NOTIFICATION, (TEXT("RilDrv: Broadcast notification: 0x%x\r\n"), pNotification->GetCode()));
    return;
}

void TraceIOCTLCall(HRESULT dwIOCTL, PBYTE /*pBufIn*/, DWORD /*dwLenIn*/)
{
    RILRetailTraceZone(ZONE_IOCTL, (TEXT("RilDrv: Call IOCTL: %d \r\n"), (dwIOCTL >> 2) & 0xFFF));
}

void TraceIOCTLCallReturn(HRESULT dwIOCTL, HRESULT hr)
{
    if (SUCCEEDED(hr))
        RILRetailTraceZone(ZONE_IOCTL, (TEXT("RilDrv: IOCTL: %d ID: %d\r\n"), (dwIOCTL >> 2) & 0xFFF, hr));
    else
        RILRetailTraceZone(ZONE_IOCTL, (TEXT("RilDrv: IOCTL: %d call failed 0x%x\r\n"), (dwIOCTL >> 2) & 0xFFF, hr));
}

void TraceIOCTLCallAsynchReturn(DWORD dwID, const APIID /*dwAPIID*/, const DWORD dwResponseCode, const void* const /*pBlob*/, const UINT /*cbBlob*/)
{
     RILRetailTraceZone(ZONE_IOCTL, (TEXT("RilDrv: IOCTL Response ID: %d Code: %d\r\n"), dwID, dwResponseCode));
}
#endif

void TraceIOCTLCallSerialPort(BOOL fRet, BYTE* pBufOut, DWORD dwBytes)
{
    TCHAR szPort[MAX_PORT_NAME_LEN];

    memset(szPort, 0, MAX_PORT_NAME_LEN*sizeof(TCHAR));
    if (dwBytes < MAX_PORT_NAME_LEN)
        memcpy(szPort, pBufOut, dwBytes*sizeof(TCHAR));

    if (fRet)
        RILRetailTraceZone(ZONE_IOCTL, (TEXT("RilDrv: IOCTL: IOCTL_RIL_GETSERIALPORTHANDLEFROMCONTEXTID pbBufOut=%s\r\n"), szPort));
    else
        RILRetailTraceZone(ZONE_IOCTL, (TEXT("RilDrv: IOCTL: IOCTL_RIL_GETSERIALPORTHANDLEFROMCONTEXTID failed\r\n")));
}


#ifdef RILDRV_CE7
void TraceIOCTLGetSignalStrengthCE7(RILSIGNALQUALITY* pBufOut)
{
#ifdef RIL_ADDITIONAL_DEBUG_OUTPUT
    if (pBufOut != NULL)
        RILRetailTraceZone(ZONE_IOCTL, (TEXT("RilDrv: RILSIGNALQUALITY: dwParams=0x%X; nSignalStrength=%d; nMinSignalStrength=%d; nMaxSignalStrength=%d; dwBitErrorRate=%d; nLowSignalStrength=%d; nHighSignalStrength=%d\r\n"),
                pBufOut->dwParams,
                pBufOut->nSignalStrength,
                pBufOut->nMinSignalStrength,
                pBufOut->nMaxSignalStrength,
                pBufOut->dwBitErrorRate,
                pBufOut->nLowSignalStrength,
                pBufOut->nHighSignalStrength));
#endif
    if (pBufOut == NULL)
        RILRetailTraceZone(ZONE_IOCTL, (TEXT("RilDrv: Warning: IOCTL_RIL_GETSIGNALQUALITY without parameter\r\n")));
}
#endif
