connectivitylayer/isce/p2papi_dll/src/p2pif.cpp
changeset 9 8486d82aef45
parent 0 63b37f68c1ce
equal deleted inserted replaced
8:6295dc2169f3 9:8486d82aef45
   105     TInt loadStatus( User::LoadLogicalDevice( KP2PDriverLddBinaryName ) );
   105     TInt loadStatus( User::LoadLogicalDevice( KP2PDriverLddBinaryName ) );
   106     C_TRACE( ( _T( "RP2PIf::Open devicedriver loaded %d" ), loadStatus ) );
   106     C_TRACE( ( _T( "RP2PIf::Open devicedriver loaded %d" ), loadStatus ) );
   107     ASSERT_PANIC_ALWAYS( ( KErrNone == loadStatus || KErrAlreadyExists == loadStatus), EP2PApiDriverLoadFailed );
   107     ASSERT_PANIC_ALWAYS( ( KErrNone == loadStatus || KErrAlreadyExists == loadStatus), EP2PApiDriverLoadFailed );
   108     TInt error( KErrInUse );
   108     TInt error( KErrInUse );
   109     C_TRACE( ( _T( "RP2PIf::Open ldd" ) ) );
   109     C_TRACE( ( _T( "RP2PIf::Open ldd" ) ) );
   110     TBuf8<KInfoLength> info;
   110     HBufC8* buffer = NULL;
       
   111     TRAPD( err, buffer = HBufC8::NewL( KInfoLength ) );        
       
   112     ASSERT_PANIC_ALWAYS( err == KErrNone, KErrNoMemory );
       
   113         
       
   114     TPtr8 info = buffer->Des();
   111     info.Append( aP2PProtocolId );
   115     info.Append( aP2PProtocolId );
   112     // TODO: check wrong usage of driver load differently than from here
   116     //  check wrong usage of driver load differently than from here
   113     // KErrPermissionDenied( no capabilities) ,  KErrNotSupported (Wrong protocol id), KErrGeneral (DThread::Open), 
   117     // KErrPermissionDenied( no capabilities) ,  KErrNotSupported (Wrong protocol id), KErrGeneral (DThread::Open), 
   114     // KErrAlreadyExists same object had opened the interface with some other protocolid
   118     // KErrAlreadyExists same object had opened the interface with some other protocolid
   115     error = DoCreate( KP2PDriverName, 
   119     error = DoCreate( KP2PDriverName, 
   116                       TVersion(), 
   120                       TVersion(), 
   117                       KNullUnit, 
   121                       KNullUnit, 
   118                       NULL, 
   122                       NULL, 
   119                       &info, 
   123                       &info, 
   120                       aType );
   124                       aType );
       
   125     delete buffer;
   121     if( KErrNone != error )
   126     if( KErrNone != error )
   122         {
   127         {
   123         C_TRACE( ( _T( "RP2PIf::Open 0x%x failed 0x%x error %d" ), this, aP2PProtocolId, error ) );
   128         C_TRACE( ( _T( "RP2PIf::Open 0x%x failed 0x%x error %d" ), this, aP2PProtocolId, error ) );
   124         TRequestStatus* ptrStatus = &aStatus;
   129         TRequestStatus* ptrStatus = &aStatus;
   125         User::RequestComplete( ptrStatus, error );
   130         User::RequestComplete( ptrStatus, error );