none
application crashed ( ril.dll related) RRS feed

  • 问题

  • ####code snippet#### 
     HINSTANCE m_hRilDll = LoadLibrary(L"ril.dll");
     if(m_hRilDll != NULL){
      RIL_Initialize= (PFRIL_Initialize)GetProcAddress(m_hRilDll, L"RIL_Initialize");
      RIL_Deinitialize= (PFRIL_Deinitialize)GetProcAddress(m_hRilDll, L"RIL_Deinitialize");
      RIL_GetRegistrationStatus= (PFRIL_GetRegistrationStatus)GetProcAddress(m_hRilDll, L"RIL_GetRegistrationStatus");
            RIL_GetCellTowerInfo= (PFRIL_GetCellTowerInfo)GetProcAddress(m_hRilDll, L"RIL_GetCellTowerInfo");
      RIL_DevSpecific= (PFRIL_DevSpecific)GetProcAddress(m_hRilDll, L"RIL_DevSpecific");
      if( RIL_Initialize == NULL ){
       rilResult +=_T("RIL_Initialize is not loaded.\r\n");
      }
      if( RIL_Deinitialize == NULL ){
       rilResult += _T("RIL_Deinitialize is not loaded.\r\n");
      }
      if( RIL_GetRegistrationStatus == NULL) {
       rilResult += _T("RIL_GetRegistrationStatus is not loaded.\r\n");
      }
      if( RIL_GetCellTowerInfo == NULL) {
       rilResult += _T("RIL_GetCellTowerInfo is not loaded.\r\n");
      }
      if( RIL_DevSpecific == NULL) {
       rilResult += _T("RIL_DevSpecific is not loaded.\r\n");
      }
     }else{
      rilResult += _T("ril.dll is not loaded.\r\n");
     }
     
     // Initialize the RIL layer 
     HRESULT hresult = RIL_Initialize(1,ResultCallback,NotifyCallback,
            0xFF0000,(DWORD)this,&m_hRIL);
     
     if(hresult < 0)        <- the returned hrseult = 0, and access violation happens here
     {
      m_hRIL = NULL;
     
      AfxMessageBox(TEXT("Failed to initialize RIL"));
     }
    #########################
     
    Load module: Celluar_autoAccessor.exe
    Load module: commctrl.dll.0804.MUI
    Load module: commctrl.dll
    Load module: aygshell.dll
    Load module: ossvcs.dll
    Load module: OLEAUT32.dll
    Load module: ole32.dll
    Load module: coredll.dll
    Load module: PACKAGEINFOAPI.dll
    Unload module: PACKAGEINFOAPI.dll
    +OALIoCtlHalGetDeviceInfo(...)
    -OALIoCtlHalGetDeviceInfo(rc = 1)
    Platform Type : SmartPhone
    Load module: gbime2.dll
    Load module: GBChinaPRCRes.dll
    Load module: cellcore.dll
    Load module: ril.dll
    Load module: custsat.dll
    Prefetch Abort: Thread=8210dad8 Proc=804def80 'Celluar_autoAccessor.exe'
    AKY=01000001 PC=8010cba0(NK.EXE+0x0000cba0) RA=02e27614(ril.dll+0x00006614) BVA=8010cba0 FSR=000004f0
    Unhandled exception at 0x8010cba0 in Celluar_autoAccessor.exe: 0xC0000005: Access violation reading location 0x8010cba0.
    The thread 0xe3e1e0da has exited with code -1073741819 (0xc0000005).
    The program '[0x822209AE] Celluar_autoAccessor.exe' has exited with code 1067 (0x42b).
    2010年6月9日 9:05

答案

全部回复

  • 你好,

    我在Cingular8125上测试过,可以运行,代码在版主的Blog上可以下载到:http://www.cnblogs.com/fox23/archive/2008/12/24/windows-mobile-ril-in-compact-framework.html

    我看了一下你的代码,是不是初始化函数的参数不一样导致的:

    HRESULT hresult = RIL_Initialize(1,ResultCallback,NotifyCallback,0xFF0000,(DWORD)this,&m_hRIL);

    建议你先测试一下版主的Blog上的代码,然后再比较自己的代码,进行检查。


    施炯
    2010年6月10日 3:21
    版主
  • 还有一个问题,设备是否是手机,如果是模拟器,没有真实的SIM和基站信息,也会报错。
    Please remember to mark the replies as answers if they help and unmark them if they provide no help
    2010年6月10日 7:59
    版主
  • 非常感谢你们的帮助回复!

    确实如你们所言,是在  HRESULT hresult = RIL_Initialize(1,ResultCallback,NotifyCallback,0x00FF0000,NULL,&m_hRIL);
    调用的时候发生问题,0x8010cba0 是函数NotifyCallback 的入口地址。

    有一个很奇怪的现象,就是如果重新定义一个
     RILNOTIFYCALLBACK NotifyCallback2;

    并把其函数实现体置空,用该函数替换RIL_Initialize 中的NotifyCallback, 发现NotifyCallback2的入口地址也变成了0x8010cba0

    相关函数申明,实现和调用请看下面的代码段,如需要整体代码,请告知,我会邮件你。再次感谢你的帮助~

    typedef HRESULT (*PFRIL_Initialize)(DWORD dwIndex, RILRESULTCALLBACK pfnResult, RILNOTIFYCALLBACK pfnNotify, DWORD dwNotificationClasses, DWORD dwParam, HANDLE *hRil);
    typedef HRESULT (*PFRIL_Deinitialize)(HANDLE hRil);
    typedef HRESULT (*PFRIL_GetRegistrationStatus)(HANDLE hRil);
    typedef HRESULT (*PFRIL_GetCellTowerInfo)(HANDLE hRil);
    typedef HRESULT (*PFRIL_DevSpecific)(HANDLE hRil, BYTE*buf, int size);
    
    //function definition in the Diaglog class
    	PFRIL_Deinitialize RIL_Deinitialize;
    	PFRIL_Initialize RIL_Initialize;
    	PFRIL_GetRegistrationStatus RIL_GetRegistrationStatus;
    	PFRIL_GetCellTowerInfo RIL_GetCellTowerInfo;
    	PFRIL_DevSpecific RIL_DevSpecific;
    
    	RILRESULTCALLBACK ResultCallback;
    	RILNOTIFYCALLBACK NotifyCallback;
    	RILNOTIFYCALLBACK NotifyCallback2;
    
    //ril.dll load and interface initializing
    	HINSTANCE m_hRilDll = LoadLibrary(L"ril.dll");
    	if(m_hRilDll != NULL){
    		RIL_Initialize= (PFRIL_Initialize)GetProcAddress(m_hRilDll, L"RIL_Initialize");
    		RIL_Deinitialize= (PFRIL_Deinitialize)GetProcAddress(m_hRilDll, L"RIL_Deinitialize");
    		RIL_GetRegistrationStatus= (PFRIL_GetRegistrationStatus)GetProcAddress(m_hRilDll, L"RIL_GetRegistrationStatus");
        RIL_GetCellTowerInfo= (PFRIL_GetCellTowerInfo)GetProcAddress(m_hRilDll, L"RIL_GetCellTowerInfo");
    		RIL_DevSpecific= (PFRIL_DevSpecific)GetProcAddress(m_hRilDll, L"RIL_DevSpecific");
    		if( RIL_Initialize == NULL ){
    			rilResult +=_T("RIL_Initialize is not loaded.\r\n");
    		}
    		if( RIL_Deinitialize == NULL ){
    			rilResult += _T("RIL_Deinitialize is not loaded.\r\n");
    		}
    		if( RIL_GetRegistrationStatus == NULL) {
    			rilResult += _T("RIL_GetRegistrationStatus is not loaded.\r\n");
    		}
    		if( RIL_GetCellTowerInfo == NULL) {
    			rilResult += _T("RIL_GetCellTowerInfo is not loaded.\r\n");
    		}
    		if( RIL_DevSpecific == NULL) {
    			rilResult += _T("RIL_DevSpecific is not loaded.\r\n");
    		}
    	}else{
    		rilResult += _T("ril.dll is not loaded.\r\n");
    	}
    	cell_info_txt.SetWindowText(rilResult);
    
    	// Initialize the RIL layer	
    	HRESULT	hresult = RIL_Initialize(1,ResultCallback,NotifyCallback2,0x00FF0000,NULL,&m_hRIL);
    
    	if(hresult < 0)
    	{
    		m_hRIL	= NULL;
    
    		AfxMessageBox(TEXT("Failed to initialize RIL"));
    	}
    	else
    	{
    		m_hCellInfoResult		= RIL_GetCellTowerInfo(m_hRIL);
    	}
    
    // function implementation
    
    void CALLBACK NotifyCallback(DWORD dwCode,const void *lpData,DWORD cbData, DWORD dwParam){...}
    
    void CALLBACK ResultCallback(DWORD dwCode,HRESULT hrCmdID,const void *lpData,DWORD cbData,DWORD dwParam){...}
    
    void CALLBACK NotifyCallback2(DWORD dwCode,const void *lpData,DWORD cbData, DWORD dwParam)
    {}
    

     

    2010年6月12日 4:28
  • 是用手机做的测试~

    2010年6月12日 5:25
  • 在班主的代码中关于RIL_Initialize调用的代码是,它对RILNOTIFYCALLBACK参数置成了空。

    问题也确实是出在RIL_Initialize,但还是看不出来具体是哪?

    #############
                celltowerinfo = "";

                hRes = RIL_Initialize(1,                                        // RIL port 1
                                      new RILRESULTCALLBACK(rilResultCallback), // 返回调用结果的回调函数
                                      null,  0, 0,                                     
                                      out hRil);                                //返回RIL实例的handle
    #############

    2010年6月12日 5:30