memspy/Driver/Kernel/Source/SubChannels/MemSpyDriverLogChanContainers.cpp
branchRCL_3
changeset 49 7fdc9a71d314
parent 44 52e343bb8f80
child 59 8ad140f3dd41
equal deleted inserted replaced
46:e26895079d7c 49:7fdc9a71d314
   144         // We are enumerating an entire container - not a thread-specific request
   144         // We are enumerating an entire container - not a thread-specific request
   145         const TObjectType type = ObjectTypeFromMemSpyContainerType( params.iContainer );
   145         const TObjectType type = ObjectTypeFromMemSpyContainerType( params.iContainer );
   146 
   146 
   147         DObjectCon* container = Kern::Containers()[type];
   147         DObjectCon* container = Kern::Containers()[type];
   148         container->Wait();
   148         container->Wait();
   149         NKern::LockSystem();
       
   150 
   149 
   151         const TInt count = container->Count();
   150         const TInt count = container->Count();
   152         for(TInt i=0; i<count; i++)
   151         for(TInt i=0; i<count; i++)
   153             {
   152             {
   154             DObject* object = (*container)[ i ];
   153             DObject* object = (*container)[ i ];
   156                 {
   155                 {
   157                 AddTempHandle( object );
   156                 AddTempHandle( object );
   158                 }
   157                 }
   159             }
   158             }
   160 
   159 
   161         NKern::UnlockSystem();
       
   162         container->Signal();
   160         container->Signal();
   163 
       
   164     	NKern::ThreadLeaveCS();
   161     	NKern::ThreadLeaveCS();
   165         }
   162         }
   166     else
   163     else
   167         {
   164         {
   168         // Are we dealing with threads or processes?
   165         // Are we dealing with threads or processes?
   212                 {
   209                 {
   213 	            NKern::ThreadEnterCS();
   210 	            NKern::ThreadEnterCS();
   214 
   211 
   215                 // Iterate through each handle in the thread/process and add it to the temp handles container if
   212                 // Iterate through each handle in the thread/process and add it to the temp handles container if
   216                 // the handle is of the correct type.
   213                 // the handle is of the correct type.
   217                 MemSpyObjectIx_Wait( handles );
   214 
   218 
   215 				MemSpyObjectIx_HandleLookupLock();
   219 	            TInt handleCount = handles->Count();
   216 				const TInt handleCount = handles->Count();
       
   217 				MemSpyObjectIx_HandleLookupUnlock();
   220                 TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetContainerHandles - %d handles in index...", handleCount ));
   218                 TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetContainerHandles - %d handles in index...", handleCount ));
   221 
   219 
   222                 for( TInt handleIndex=0; handleIndex<handleCount; handleIndex++ )
   220                 for( TInt handleIndex=0; handleIndex<handleCount; handleIndex++ )
   223     	            {
   221     	            {
   224     	            // Get a handle from the container...
   222     	            // Get a handle from the container...
   225                     NKern::LockSystem();
   223 					MemSpyObjectIx_HandleLookupLock();
   226     	            DObject* objectToSearchFor = (*handles)[ handleIndex ];
   224 					if (handleIndex >= handles->Count()) break; // Count may have changed in the meantime
   227                     NKern::UnlockSystem();
   225     				DObject* objectToSearchFor = (*handles)[ handleIndex ];
       
   226 					if (objectToSearchFor && objectToSearchFor->Open() != KErrNone) objectToSearchFor = NULL;
       
   227 					MemSpyObjectIx_HandleLookupUnlock();
   228         
   228         
   229                     if  ( objectToSearchFor != NULL )
   229                     if (objectToSearchFor && OSAdaption().DThread().GetObjectType(*objectToSearchFor) == ObjectTypeFromMemSpyContainerType(params.iContainer))
   230                         {
   230                         {
   231                         // Check to see if this object is of the specified type. We can use quick mode
   231                         // Found a match in the specified container. Write the object's handle (aka the object address)
   232                         // because we know the object is valid since it's registered as a handle of the
   232                         // back to the client address space
   233                         // thread/process.
   233                         AddTempHandle( objectToSearchFor );
   234                         DObject* matchResult = CheckIfObjectIsInContainer( params.iContainer, objectToSearchFor, ETrue );
       
   235                         if  ( matchResult )
       
   236                             {
       
   237                             // Found a match in the specified container. Write the object's handle (aka the object address)
       
   238                             // back to the client address space
       
   239                             AddTempHandle( matchResult );
       
   240                             }
       
   241                         }
   234                         }
       
   235 					if (objectToSearchFor) objectToSearchFor->Close(NULL);
   242     	            }
   236     	            }
   243 
   237 
   244                 MemSpyObjectIx_Signal( handles );
       
   245                 NKern::ThreadLeaveCS();
   238                 NKern::ThreadLeaveCS();
   246                 }
   239                 }
   247 
   240 
   248             // Done with this now.
   241             // Done with this now.
   249             CloseTempObject();
   242             CloseTempObject();
   305 
   298 
   306 	NKern::ThreadEnterCS();
   299 	NKern::ThreadEnterCS();
   307 
   300 
   308     // First, locate the specific DObject in question. Cast the handle, but don't use the object...
   301     // First, locate the specific DObject in question. Cast the handle, but don't use the object...
   309     DObject* handleAsObject = (DObject*) params.iHandle;
   302     DObject* handleAsObject = (DObject*) params.iHandle;
   310     handleAsObject = CheckIfObjectIsInContainer( params.iType, handleAsObject );
   303     handleAsObject = CheckedOpen(params.iType, handleAsObject);
   311     if  ( handleAsObject != NULL )
   304     if  ( handleAsObject != NULL )
   312         {
   305         {
   313         // We found the right object. First get generic info.
   306         // We found the right object. First get generic info.
   314         handleAsObject->FullName( params.iName );
   307         handleAsObject->FullName( params.iName );
   315         handleAsObject->Name( params.iNameDetail );
   308         handleAsObject->Name( params.iNameDetail );
   316         
   309         
   317         NKern::LockSystem();
   310         // Using threadAddaption to fetch generic info.
   318         r = handleAsObject->Open();
   311         // Implementations of following get functions are actually in DMemSpyDriverOSAdaptionDObject
   319         NKern::UnlockSystem();
   312         // so it does not matter what adaption to use for generic info.
   320         //
   313         DMemSpyDriverOSAdaptionDThread& threadAddaption = OSAdaption().DThread();
   321         if  ( r == KErrNone )
   314         params.iAccessCount = threadAddaption.GetAccessCount( *handleAsObject );
   322             {
   315         params.iUniqueID = threadAddaption.GetUniqueID( *handleAsObject );
   323             // Using threadAddaption to fetch generic info.
   316         params.iProtection = threadAddaption.GetProtection( *handleAsObject );
   324             // Implementations of following get functions are actually in DMemSpyDriverOSAdaptionDObject
   317         params.iAddressOfKernelOwner = threadAddaption.GetAddressOfKernelOwner( *handleAsObject );
   325             // so it does not matter what adaption to use for generic info.
       
   326             DMemSpyDriverOSAdaptionDThread& threadAddaption = OSAdaption().DThread();
       
   327             params.iAccessCount = threadAddaption.GetAccessCount( *handleAsObject );
       
   328             params.iUniqueID = threadAddaption.GetUniqueID( *handleAsObject );
       
   329             params.iProtection = threadAddaption.GetProtection( *handleAsObject );
       
   330             params.iAddressOfKernelOwner = threadAddaption.GetAddressOfKernelOwner( *handleAsObject );
       
   331             //
       
   332             handleAsObject->Close( NULL );
       
   333             }
       
   334         
   318         
   335         // Get type-specific info.
   319         // Get type-specific info.
   336         if  ( params.iType == EMemSpyDriverContainerTypeThread )
   320         if  ( params.iType == EMemSpyDriverContainerTypeThread )
   337             {
   321             {
   338 	        TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetGenericHandleInfo() - EMemSpyDriverContainerTypeThread" ));
   322 	        TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetGenericHandleInfo() - EMemSpyDriverContainerTypeThread" ));
   339 
   323 
   340             DThread* object = (DThread*) handleAsObject;
   324             DThread* object = (DThread*) handleAsObject;
   341 	        NKern::LockSystem();
   325             DMemSpyDriverOSAdaptionDThread& threadAdaption = OSAdaption().DThread();
   342             r = object->Open();
   326             //
   343     	    NKern::UnlockSystem();
   327             params.iId = threadAdaption.GetId( *object );
   344             //
   328             params.iPriority = threadAdaption.GetPriority( *object );
   345             if  ( r == KErrNone )
   329             params.iAddressOfOwningProcess = threadAdaption.GetAddressOfOwningProcess( *object );
       
   330             threadAdaption.GetNameOfOwningProcess( *object, params.iNameOfOwner );
       
   331             }
       
   332         else if ( params.iType == EMemSpyDriverContainerTypeProcess )
       
   333             {
       
   334 	        TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetGenericHandleInfo() - EMemSpyDriverContainerTypeProcess" ));
       
   335 
       
   336             DProcess* object = (DProcess*) handleAsObject;
       
   337             DMemSpyDriverOSAdaptionDProcess& processAdaption = OSAdaption().DProcess();
       
   338             //
       
   339             params.iId = processAdaption.GetId( *object );
       
   340             //
       
   341             params.iPriority = processAdaption.GetPriority( *object );
       
   342             params.iAddressOfOwningProcess = processAdaption.GetAddressOfOwningProcess( *object );
       
   343             params.iCreatorId = processAdaption.GetCreatorId( *object );
       
   344             params.iSecurityZone = processAdaption.GetSecurityZone( *object );
       
   345             params.iAttributes = processAdaption.GetAttributes( *object );
       
   346             params.iAddressOfDataBssStackChunk = processAdaption.GetAddressOfDataBssStackChunk( *object );
       
   347             }
       
   348         else if ( params.iType == EMemSpyDriverContainerTypeChunk )
       
   349             {
       
   350 	        TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetGenericHandleInfo() - EMemSpyDriverContainerTypeChunk" ));
       
   351 
       
   352             DChunk* object = (DChunk*) handleAsObject;
       
   353             DMemSpyDriverOSAdaptionDChunk& ca = OSAdaption().DChunk();
       
   354             //
       
   355             params.iSize = ca.GetSize( *object );
       
   356             params.iId = ca.GetOwningProcessId( *object );
       
   357             params.iAddressOfOwningProcess = ca.GetAddressOfOwningProcess( *object );
       
   358             params.iMaxSize = ca.GetMaxSize( *object );
       
   359             params.iBottom = ca.GetBottom( *object );
       
   360             params.iTop = ca.GetTop( *object );
       
   361             params.iAttributes = ca.GetAttributes( *object );
       
   362             params.iStartPos = ca.GetStartPos( *object );
       
   363             params.iControllingOwner = ca.GetControllingOwnerId( *object );
       
   364             params.iRestrictions = ca.GetRestrictions( *object );
       
   365             params.iMapAttr = ca.GetMapAttr( *object );
       
   366             params.iChunkType = ca.GetType( *object );
       
   367             ca.GetNameOfOwningProcess( *object, params.iNameOfOwner );
       
   368             }
       
   369         else if ( params.iType == EMemSpyDriverContainerTypeLibrary )
       
   370             {
       
   371 	        TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetGenericHandleInfo() - EMemSpyDriverContainerTypeLibrary" ));
       
   372 
       
   373 	        Kern::AccessCode();
       
   374             //
       
   375             DLibrary* object = (DLibrary*) handleAsObject;
       
   376             DMemSpyDriverOSAdaptionDCodeSeg& csa = OSAdaption().DCodeSeg();
       
   377             DCodeSeg* codeSeg = csa.GetCodeSeg( *object );
       
   378             params.iAddressOfCodeSeg = (TUint8*)codeSeg;
       
   379             params.iMapCount = csa.GetMapCount( *object );
       
   380             params.iState = csa.GetState( *object );
       
   381             //
       
   382             if  ( codeSeg )
   346                 {
   383                 {
   347                 DMemSpyDriverOSAdaptionDThread& threadAdaption = OSAdaption().DThread();
   384                 params.iSize = csa.GetSize( *codeSeg );
   348                 //
       
   349                 params.iId = threadAdaption.GetId( *object );
       
   350                 params.iPriority = threadAdaption.GetPriority( *object );
       
   351                 params.iAddressOfOwningProcess = threadAdaption.GetAddressOfOwningProcess( *object );
       
   352                 threadAdaption.GetNameOfOwningProcess( *object, params.iNameOfOwner );
       
   353                 //
       
   354                 object->Close( NULL );
       
   355                 }
   385                 }
   356             }
   386             else
   357         else if ( params.iType == EMemSpyDriverContainerTypeProcess )
       
   358             {
       
   359 	        TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetGenericHandleInfo() - EMemSpyDriverContainerTypeProcess" ));
       
   360 
       
   361             DProcess* object = (DProcess*) handleAsObject;
       
   362 	        NKern::LockSystem();
       
   363             r = object->Open();
       
   364     	    NKern::UnlockSystem();
       
   365             //
       
   366             if  ( r == KErrNone )
       
   367                 {
   387                 {
   368                 DMemSpyDriverOSAdaptionDProcess& processAdaption = OSAdaption().DProcess();
   388                 r = KErrNotFound;
   369                 //
       
   370                 params.iId = processAdaption.GetId( *object );
       
   371                 //
       
   372                 params.iPriority = processAdaption.GetPriority( *object );
       
   373                 params.iAddressOfOwningProcess = processAdaption.GetAddressOfOwningProcess( *object );
       
   374                 params.iCreatorId = processAdaption.GetCreatorId( *object );
       
   375                 params.iSecurityZone = processAdaption.GetSecurityZone( *object );
       
   376                 params.iAttributes = processAdaption.GetAttributes( *object );
       
   377                 params.iAddressOfDataBssStackChunk = processAdaption.GetAddressOfDataBssStackChunk( *object );
       
   378                 //
       
   379                 object->Close( NULL );
       
   380                 }
   389                 }
   381             }
       
   382         else if ( params.iType == EMemSpyDriverContainerTypeChunk )
       
   383             {
       
   384 	        TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetGenericHandleInfo() - EMemSpyDriverContainerTypeChunk" ));
       
   385 
       
   386             DChunk* object = (DChunk*) handleAsObject;
       
   387 	        NKern::LockSystem();
       
   388             r = object->Open();
       
   389     	    NKern::UnlockSystem();
       
   390             //
       
   391             if  ( r == KErrNone )
       
   392                 {
       
   393                 DMemSpyDriverOSAdaptionDChunk& ca = OSAdaption().DChunk();
       
   394                 //
       
   395                 params.iSize = ca.GetSize( *object );
       
   396                 params.iId = ca.GetOwningProcessId( *object );
       
   397                 params.iAddressOfOwningProcess = ca.GetAddressOfOwningProcess( *object );
       
   398                 params.iMaxSize = ca.GetMaxSize( *object );
       
   399                 params.iBottom = ca.GetBottom( *object );
       
   400                 params.iTop = ca.GetTop( *object );
       
   401                 params.iAttributes = ca.GetAttributes( *object );
       
   402                 params.iStartPos = ca.GetStartPos( *object );
       
   403                 params.iControllingOwner = ca.GetControllingOwnerId( *object );
       
   404                 params.iRestrictions = ca.GetRestrictions( *object );
       
   405                 params.iMapAttr = ca.GetMapAttr( *object );
       
   406                 params.iChunkType = ca.GetType( *object );
       
   407                 ca.GetNameOfOwningProcess( *object, params.iNameOfOwner );
       
   408                 //
       
   409                 object->Close( NULL );
       
   410                 }
       
   411             }
       
   412         else if ( params.iType == EMemSpyDriverContainerTypeLibrary )
       
   413             {
       
   414 	        TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetGenericHandleInfo() - EMemSpyDriverContainerTypeLibrary" ));
       
   415 
       
   416 	        Kern::AccessCode();
       
   417             //
       
   418             DLibrary* object = (DLibrary*) handleAsObject;
       
   419 	        NKern::LockSystem();
       
   420             r = object->Open();
       
   421     	    NKern::UnlockSystem();
       
   422             //
       
   423             if  ( r == KErrNone )
       
   424                 {
       
   425                 DMemSpyDriverOSAdaptionDCodeSeg& csa = OSAdaption().DCodeSeg();
       
   426                 DCodeSeg* codeSeg = csa.GetCodeSeg( *object );
       
   427                 params.iAddressOfCodeSeg = (TUint8*)codeSeg;
       
   428                 params.iMapCount = csa.GetMapCount( *object );
       
   429                 params.iState = csa.GetState( *object );
       
   430                 //
       
   431                 if  ( codeSeg )
       
   432                     {
       
   433                     params.iSize = csa.GetSize( *codeSeg );
       
   434                     }
       
   435                 else
       
   436                     {
       
   437                     r = KErrNotFound;
       
   438                     }
       
   439                 //
       
   440                 object->Close( NULL );
       
   441                 }
       
   442             //
   390             //
   443 	        Kern::EndAccessCode();
   391 	        Kern::EndAccessCode();
   444             }
   392             }
   445         else if ( params.iType == EMemSpyDriverContainerTypeSemaphore )
   393         else if ( params.iType == EMemSpyDriverContainerTypeSemaphore )
   446             {
   394             {
   447 	        TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetGenericHandleInfo() - EMemSpyDriverContainerTypeSemaphore" ));
   395 	        TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetGenericHandleInfo() - EMemSpyDriverContainerTypeSemaphore" ));
   448 
   396 
   449             DSemaphore* object = (DSemaphore*) handleAsObject;
   397             DSemaphore* object = (DSemaphore*) handleAsObject;
   450 	        NKern::LockSystem();
   398             DMemSpyDriverOSAdaptionDSemaphore& sa = OSAdaption().DSemaphore();
   451             r = object->Open();
   399             params.iCount = sa.GetCount( *object );
   452     	    NKern::UnlockSystem();
   400             params.iResetting = sa.GetResetting( *object );
   453             //
       
   454             if  ( r == KErrNone )
       
   455                 {
       
   456                 DMemSpyDriverOSAdaptionDSemaphore& sa = OSAdaption().DSemaphore();
       
   457                 params.iCount = sa.GetCount( *object );
       
   458                 params.iResetting = sa.GetResetting( *object );
       
   459                 //
       
   460                 object->Close( NULL );
       
   461                 }
       
   462             }
   401             }
   463         else if ( params.iType == EMemSpyDriverContainerTypeMutex )
   402         else if ( params.iType == EMemSpyDriverContainerTypeMutex )
   464             {
   403             {
   465 	        TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetGenericHandleInfo() - EMemSpyDriverContainerTypeMutex" ));
   404 	        TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetGenericHandleInfo() - EMemSpyDriverContainerTypeMutex" ));
   466 
   405 
   467             DMutex* object = (DMutex*) handleAsObject;
   406             DMutex* object = (DMutex*) handleAsObject;
   468 	        NKern::LockSystem();
   407             DMemSpyDriverOSAdaptionDMutex& ma = OSAdaption().DMutex();
   469             r = object->Open();
   408             //
   470     	    NKern::UnlockSystem();
   409             params.iCount = ma.GetHoldCount( *object );
   471             //
   410             params.iWaitCount = ma.GetWaitCount( *object );
   472             if  ( r == KErrNone )
   411             params.iResetting = ma.GetResetting( *object );
   473                 {
   412             params.iOrder = ma.GetOrder( *object );
   474                 DMemSpyDriverOSAdaptionDMutex& ma = OSAdaption().DMutex();
       
   475                 //
       
   476                 params.iCount = ma.GetHoldCount( *object );
       
   477                 params.iWaitCount = ma.GetWaitCount( *object );
       
   478                 params.iResetting = ma.GetResetting( *object );
       
   479                 params.iOrder = ma.GetOrder( *object );
       
   480                 //
       
   481                 object->Close( NULL );
       
   482                 }
       
   483             }
   413             }
   484         else if ( params.iType == EMemSpyDriverContainerTypeTimer )
   414         else if ( params.iType == EMemSpyDriverContainerTypeTimer )
   485             {
   415             {
   486 	        TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetGenericHandleInfo() - EMemSpyDriverContainerTypeTimer" ));
   416 	        TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetGenericHandleInfo() - EMemSpyDriverContainerTypeTimer" ));
   487 
   417 
   488             // Get timer properties
   418             // Get timer properties
   489             DTimer* object = (DTimer*) handleAsObject;
   419             DTimer* object = (DTimer*) handleAsObject;
   490 	        NKern::LockSystem();
   420             DMemSpyDriverOSAdaptionDTimer& ta = OSAdaption().DTimer();
   491             r = object->Open();
   421             //
   492     	    NKern::UnlockSystem();
   422             params.iTimerType = MapToMemSpyTimerType( ta.GetType( *object ) );
   493             //
   423             params.iTimerState = MapToMemSpyTimerState( ta.GetState( *object ) );
   494             if  ( r == KErrNone )
   424             }
       
   425         else if ( params.iType == EMemSpyDriverContainerTypeServer )
       
   426             {
       
   427 	        TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetGenericHandleInfo() - EMemSpyDriverContainerTypeServer" ));
       
   428 
       
   429             DServer* object = (DServer*) handleAsObject;
       
   430             DMemSpyDriverOSAdaptionDServer& sa = OSAdaption().DServer();
       
   431             //
       
   432             params.iCount = sa.GetSessionCount( *object );
       
   433             params.iId = sa.GetOwningThreadId( *object );
       
   434             params.iSessionType = sa.GetSessionType( *object );
       
   435             params.iAddressOfOwningThread = sa.GetAddressOfOwningThread( *object );
       
   436             sa.GetNameOfOwningThread( *object, params.iNameOfOwner );
       
   437             }
       
   438         else if ( params.iType == EMemSpyDriverContainerTypeSession )
       
   439             {
       
   440 	        TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetGenericHandleInfo() - EMemSpyDriverContainerTypeSession" ));
       
   441 
       
   442             DSession* object = (DSession*) handleAsObject;
       
   443             DMemSpyDriverOSAdaptionDServer& serverAdaption = OSAdaption().DServer();
       
   444             DMemSpyDriverOSAdaptionDSession& sessionAdaption = OSAdaption().DSession();
       
   445 
       
   446             params.iName.Zero();
       
   447 
       
   448             TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetGenericHandleInfo() - getting session type..." ));
       
   449             params.iSessionType = sessionAdaption.GetSessionType( *object );
       
   450             params.iAddressOfServer = sessionAdaption.GetAddressOfServer( *object );
       
   451             params.iTotalAccessCount = sessionAdaption.GetTotalAccessCount( *object );
       
   452             params.iSvrSessionType = sessionAdaption.GetSessionType( *object );
       
   453             params.iMsgCount = sessionAdaption.GetMsgCount( *object );
       
   454             params.iMsgLimit = sessionAdaption.GetMsgLimit( *object );
       
   455             
       
   456             // Its more useful in this instance, if the name object
       
   457             // points to the server which the session is connected to
       
   458             // (rather than displaying a process-local name).
       
   459             DServer* server = (DServer*)CheckedOpen(EMemSpyDriverContainerTypeServer, sessionAdaption.GetServer( *object ));
       
   460 	        TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetGenericHandleInfo() - getting full name, server: 0x%08x", server ));
       
   461             //
       
   462             if  ( server )
   495                 {
   463                 {
   496                 DMemSpyDriverOSAdaptionDTimer& ta = OSAdaption().DTimer();
   464                 server->FullName( params.iName );
   497                 //
   465 
   498                 params.iTimerType = MapToMemSpyTimerType( ta.GetType( *object ) );
   466                 // Continue as normal for other items
   499                 params.iTimerState = MapToMemSpyTimerState( ta.GetState( *object ) );
   467 	            TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetGenericHandleInfo() - server: 0x%08x, server->iOwningThread: 0x%08x", server, server->iOwningThread ));
   500                 //
   468                 DThread* owningThread = serverAdaption.GetOwningThread( *server );
   501                 object->Close( NULL );
   469                 if  ( owningThread )
       
   470                     {
       
   471 	                TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetGenericHandleInfo() - getting server thread id..." ));
       
   472                     params.iId = serverAdaption.GetOwningThreadId( *server );
       
   473                     }
       
   474 
       
   475                 server->Close(NULL);
   502                 }
   476                 }
   503             }
   477             }
   504         else if ( params.iType == EMemSpyDriverContainerTypeServer )
       
   505             {
       
   506 	        TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetGenericHandleInfo() - EMemSpyDriverContainerTypeServer" ));
       
   507 
       
   508             DServer* object = (DServer*) handleAsObject;
       
   509 	        NKern::LockSystem();
       
   510             r = object->Open();
       
   511     	    NKern::UnlockSystem();
       
   512             //
       
   513             if  ( r == KErrNone )
       
   514                 {
       
   515                 DMemSpyDriverOSAdaptionDServer& sa = OSAdaption().DServer();
       
   516                 //
       
   517                 params.iCount = sa.GetSessionCount( *object );
       
   518                 params.iId = sa.GetOwningThreadId( *object );
       
   519                 params.iSessionType = sa.GetSessionType( *object );
       
   520                 params.iAddressOfOwningThread = sa.GetAddressOfOwningThread( *object );
       
   521                 sa.GetNameOfOwningThread( *object, params.iNameOfOwner );
       
   522                 //
       
   523                 object->Close( NULL );
       
   524                 }
       
   525             }
       
   526         else if ( params.iType == EMemSpyDriverContainerTypeSession )
       
   527             {
       
   528 	        TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetGenericHandleInfo() - EMemSpyDriverContainerTypeSession" ));
       
   529 
       
   530             DSession* object = (DSession*) handleAsObject;
       
   531 	        NKern::LockSystem();
       
   532             r = object->Open();
       
   533     	    NKern::UnlockSystem();
       
   534             //
       
   535 	        TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetGenericHandleInfo() - open error: %d", r ));
       
   536             if  ( r == KErrNone )
       
   537                 {
       
   538                 DMemSpyDriverOSAdaptionDServer& serverAdaption = OSAdaption().DServer();
       
   539                 DMemSpyDriverOSAdaptionDSession& sessionAdaption = OSAdaption().DSession();
       
   540 
       
   541                 params.iName.Zero();
       
   542 
       
   543                 TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetGenericHandleInfo() - getting session type..." ));
       
   544                 params.iSessionType = sessionAdaption.GetSessionType( *object );
       
   545                 params.iAddressOfServer = sessionAdaption.GetAddressOfServer( *object );
       
   546                 params.iTotalAccessCount = sessionAdaption.GetTotalAccessCount( *object );
       
   547                 params.iSvrSessionType = sessionAdaption.GetSessionType( *object );
       
   548                 params.iMsgCount = sessionAdaption.GetMsgCount( *object );
       
   549                 params.iMsgLimit = sessionAdaption.GetMsgLimit( *object );
       
   550                 
       
   551                 // Its more useful in this instance, if the name object
       
   552                 // points to the server which the session is connected to
       
   553                 // (rather than displaying a process-local name).
       
   554                 DServer* server = sessionAdaption.GetServer( *object );
       
   555 	            TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetGenericHandleInfo() - getting full name, server: 0x%08x", server ));
       
   556                 //
       
   557                 if  ( server )
       
   558                     {
       
   559 	                NKern::LockSystem();
       
   560                     r = server->Open();
       
   561      	            NKern::UnlockSystem();
       
   562 
       
   563                     if  ( r == KErrNone )
       
   564                         {
       
   565                         server->FullName( params.iName );
       
   566  
       
   567                         // Continue as normal for other items
       
   568 	                    TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetGenericHandleInfo() - server: 0x%08x, server->iOwningThread: 0x%08x", server, server->iOwningThread ));
       
   569                         DThread* owningThread = serverAdaption.GetOwningThread( *server );
       
   570                         if  ( owningThread )
       
   571                             {
       
   572 	                        TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetGenericHandleInfo() - getting server thread id..." ));
       
   573                             params.iId = serverAdaption.GetOwningThreadId( *server );
       
   574                             }
       
   575 
       
   576                         server->Close( NULL );
       
   577                         }
       
   578                     }
       
   579 
       
   580                 TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetGenericHandleInfo() - closing session object..." ));
       
   581                 object->Close( NULL );
       
   582                 }
       
   583             }
       
   584         else if ( params.iType == EMemSpyDriverContainerTypeLogicalDevice )
   478         else if ( params.iType == EMemSpyDriverContainerTypeLogicalDevice )
   585             {
   479             {
   586 	        TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetGenericHandleInfo() - EMemSpyDriverContainerTypeLogicalDevice" ));
   480 	        TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetGenericHandleInfo() - EMemSpyDriverContainerTypeLogicalDevice" ));
   587 
   481 
   588             DLogicalDevice* object = (DLogicalDevice*) handleAsObject;
   482             DLogicalDevice* object = (DLogicalDevice*) handleAsObject;
   589 	        NKern::LockSystem();
   483             DMemSpyDriverOSAdaptionDLogicalDevice& lda = OSAdaption().DLogicalDevice();
   590             r = object->Open();
   484             params.iOpenChannels = lda.GetOpenChannels( *object );
   591     	    NKern::UnlockSystem();
   485             params.iVersion = lda.GetVersion( *object );
   592             //
   486             params.iParseMask = lda.GetParseMask( *object );
   593             if  ( r == KErrNone )
   487             params.iUnitsMask = lda.GetUnitsMask( *object );
   594                 {
       
   595                 DMemSpyDriverOSAdaptionDLogicalDevice& lda = OSAdaption().DLogicalDevice();
       
   596                 params.iOpenChannels = lda.GetOpenChannels( *object );
       
   597                 params.iVersion = lda.GetVersion( *object );
       
   598                 params.iParseMask = lda.GetParseMask( *object );
       
   599                 params.iUnitsMask = lda.GetUnitsMask( *object );
       
   600                 //
       
   601                 object->Close( NULL );
       
   602                 }
       
   603             }
   488             }
   604         else if ( params.iType == EMemSpyDriverContainerTypePhysicalDevice )
   489         else if ( params.iType == EMemSpyDriverContainerTypePhysicalDevice )
   605             {
   490             {
   606 	        TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetGenericHandleInfo() - EMemSpyDriverContainerTypePhysicalDevice" ));
   491 	        TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetGenericHandleInfo() - EMemSpyDriverContainerTypePhysicalDevice" ));
   607 	        
   492 	        
   608 	        DPhysicalDevice* object = (DPhysicalDevice*) handleAsObject;
   493 	        DPhysicalDevice* object = (DPhysicalDevice*) handleAsObject;
   609             NKern::LockSystem();
   494             DMemSpyDriverOSAdaptionDPhysicalDevice& pda = OSAdaption().DPhysicalDevice();
   610             r = object->Open();
   495             params.iVersion = pda.GetVersion( *object );
   611             NKern::UnlockSystem();
   496             params.iUnitsMask = pda.GetUnitsMask( *object );
   612             //
   497             params.iAddressOfCodeSeg = pda.GetAddressOfCodeSeg( *object );
   613             if  ( r == KErrNone )
       
   614                 {
       
   615                 DMemSpyDriverOSAdaptionDPhysicalDevice& pda = OSAdaption().DPhysicalDevice();
       
   616                 params.iVersion = pda.GetVersion( *object );
       
   617                 params.iUnitsMask = pda.GetUnitsMask( *object );
       
   618                 params.iAddressOfCodeSeg = pda.GetAddressOfCodeSeg( *object );
       
   619                 //
       
   620                 object->Close( NULL );
       
   621                 }
       
   622             }
   498             }
   623         else if ( params.iType == EMemSpyDriverContainerTypeLogicalChannel )
   499         else if ( params.iType == EMemSpyDriverContainerTypeLogicalChannel )
   624             {
   500             {
   625 	        TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetGenericHandleInfo() - EMemSpyDriverContainerTypeLogicalChannel" ));
   501 	        TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetGenericHandleInfo() - EMemSpyDriverContainerTypeLogicalChannel" ));
   626             }
   502             }
   627         else if ( params.iType == EMemSpyDriverContainerTypeChangeNotifier )
   503         else if ( params.iType == EMemSpyDriverContainerTypeChangeNotifier )
   628             {
   504             {
   629 	        TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetGenericHandleInfo() - EMemSpyDriverContainerTypeChangeNotifier" ));
   505 	        TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetGenericHandleInfo() - EMemSpyDriverContainerTypeChangeNotifier" ));
   630 
   506 
   631 	        DChangeNotifier* object = (DChangeNotifier*) handleAsObject;
   507 	        DChangeNotifier* object = (DChangeNotifier*) handleAsObject;
   632             NKern::LockSystem();
   508             DMemSpyDriverOSAdaptionDChangeNotifier& cna = OSAdaption().DChangeNotifier();
   633             r = object->Open();
   509             params.iChanges = cna.GetChanges( *object );
   634             NKern::UnlockSystem();
   510             params.iAddressOfOwningThread = cna.GetAddressOfOwningThread( *object );
   635             //
   511             cna.GetNameOfOwningThread( *object, params.iNameOfOwner );
   636             if  ( r == KErrNone )
       
   637                 {
       
   638                 DMemSpyDriverOSAdaptionDChangeNotifier& cna = OSAdaption().DChangeNotifier();
       
   639                 params.iChanges = cna.GetChanges( *object );
       
   640                 params.iAddressOfOwningThread = cna.GetAddressOfOwningThread( *object );
       
   641                 cna.GetNameOfOwningThread( *object, params.iNameOfOwner );
       
   642                 //
       
   643                 object->Close( NULL );
       
   644                 }
       
   645             }
   512             }
   646         else if ( params.iType == EMemSpyDriverContainerTypeUndertaker )
   513         else if ( params.iType == EMemSpyDriverContainerTypeUndertaker )
   647             {
   514             {
   648 	        TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetGenericHandleInfo() - EMemSpyDriverContainerTypeUndertaker" ));
   515 	        TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetGenericHandleInfo() - EMemSpyDriverContainerTypeUndertaker" ));
   649 	        
   516 	        
   650             DUndertaker* object = (DUndertaker*) handleAsObject;
   517             DUndertaker* object = (DUndertaker*) handleAsObject;
   651             NKern::LockSystem();
   518             DMemSpyDriverOSAdaptionDUndertaker& uta = OSAdaption().DUndertaker();
   652             r = object->Open();
   519             params.iAddressOfOwningThread = uta.GetAddressOfOwningThread( *object );
   653             NKern::UnlockSystem();
   520             uta.GetNameOfOwningThread( *object, params.iNameOfOwner );
   654             //
       
   655             if  ( r == KErrNone )
       
   656                 {
       
   657                 DMemSpyDriverOSAdaptionDUndertaker& uta = OSAdaption().DUndertaker();
       
   658                 params.iAddressOfOwningThread = uta.GetAddressOfOwningThread( *object );
       
   659                 uta.GetNameOfOwningThread( *object, params.iNameOfOwner );
       
   660                 //
       
   661                 object->Close( NULL );
       
   662                 }
       
   663             }
   521             }
   664         else if ( params.iType == EMemSpyDriverContainerTypeMsgQueue )
   522         else if ( params.iType == EMemSpyDriverContainerTypeMsgQueue )
   665             {
   523             {
   666 	        TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetGenericHandleInfo() - EMemSpyDriverContainerTypeMsgQueue" ));
   524 	        TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetGenericHandleInfo() - EMemSpyDriverContainerTypeMsgQueue" ));
   667             }
   525             }
   672         else if ( params.iType == EMemSpyDriverContainerTypeCondVar )
   530         else if ( params.iType == EMemSpyDriverContainerTypeCondVar )
   673             {
   531             {
   674 	        TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetGenericHandleInfo() - EMemSpyDriverContainerTypeCondVar" ));
   532 	        TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetGenericHandleInfo() - EMemSpyDriverContainerTypeCondVar" ));
   675 	        
   533 	        
   676             DCondVar* object = (DCondVar*) handleAsObject;
   534             DCondVar* object = (DCondVar*) handleAsObject;
   677             NKern::LockSystem();
   535             DMemSpyDriverOSAdaptionDCondVar& cva = OSAdaption().DCondVar();
   678             r = object->Open();
   536             params.iResetting = cva.GetResetting( *object );
   679             NKern::UnlockSystem();
   537             params.iAddressOfOwningThread = cva.GetAddressOfMutex( *object );
   680             //
   538             cva.GetNameOfMutex( *object, params.iNameOfOwner );
   681             if  ( r == KErrNone )
   539             params.iWaitCount = cva.GetWaitCount( *object );
   682                 {
       
   683                 DMemSpyDriverOSAdaptionDCondVar& cva = OSAdaption().DCondVar();
       
   684                 params.iResetting = cva.GetResetting( *object );
       
   685                 params.iAddressOfOwningThread = cva.GetAddressOfMutex( *object );
       
   686                 cva.GetNameOfMutex( *object, params.iNameOfOwner );
       
   687                 params.iWaitCount = cva.GetWaitCount( *object );
       
   688                 //
       
   689                 object->Close( NULL );
       
   690                 }
       
   691             }
   540             }
   692         else
   541         else
   693             {
   542             {
   694 	        TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetGenericHandleInfo() - KErrNotSupported" ));
   543 	        TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetGenericHandleInfo() - KErrNotSupported" ));
   695             r = KErrNotSupported;
   544             r = KErrNotSupported;
   696             }
   545             }
       
   546 		handleAsObject->Close(NULL);
   697         }
   547         }
   698     else
   548     else
   699         {
   549         {
   700         TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetGenericHandleInfo - couldn not find object => KErrNotFound"));
   550         TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetGenericHandleInfo - couldn not find object => KErrNotFound"));
   701         r = KErrNotFound;
   551         r = KErrNotFound;
   879 
   729 
   880     TInt r = KErrNotFound;
   730     TInt r = KErrNotFound;
   881 	NKern::ThreadEnterCS();
   731 	NKern::ThreadEnterCS();
   882 
   732 
   883     // First, locate the specific DObject in question. Cast the handle, but don't use the object...
   733     // First, locate the specific DObject in question. Cast the handle, but don't use the object...
   884     // NB: This claims the system lock
   734     DObject* object = CheckedOpen(EMemSpyDriverContainerTypePropertyRef, aHandle);
   885     DObject* object = CheckIfObjectIsInContainer( EMemSpyDriverContainerTypePropertyRef, aHandle );
       
   886     TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetPAndSInfo() - handle search returned: 0x%08x", object ));
   735     TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetPAndSInfo() - handle search returned: 0x%08x", object ));
   887 
   736 
   888     if  ( object != NULL )
   737     if  ( object != NULL )
   889         {
   738         {
   890         NKern::LockSystem();
   739         NKern::LockSystem(); // Keep this, the DPropertyRef APIs use it -TomS
   891 
   740 
   892         DMemSpyDriverOSAdaptionDPropertyRef& pra = OSAdaption().DPropertyRef();
   741         DMemSpyDriverOSAdaptionDPropertyRef& pra = OSAdaption().DPropertyRef();
   893         const TBool isReady = pra.GetIsReady( *object );
   742         const TBool isReady = pra.GetIsReady( *object );
   894         TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetPAndSInfo() - isReady: %d", isReady ));
   743         TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetPAndSInfo() - isReady: %d", isReady ));
   895 
   744 
   911             {
   760             {
   912             r = KErrNotReady;
   761             r = KErrNotReady;
   913             }
   762             }
   914 
   763 
   915         NKern::UnlockSystem();
   764         NKern::UnlockSystem();
       
   765 		object->Close(NULL);
   916         }
   766         }
   917 
   767 
   918     NKern::ThreadLeaveCS();
   768     NKern::ThreadLeaveCS();
   919 
   769 
   920     TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetPAndSInfo() - END - r: %d", r));
   770     TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetPAndSInfo() - END - r: %d", r));
   937     
   787     
   938     const TInt maxCount = params.iMaxCount;
   788     const TInt maxCount = params.iMaxCount;
   939     NKern::ThreadEnterCS();
   789     NKern::ThreadEnterCS();
   940     
   790     
   941     DObject* condVarHandle = (DObject*) params.iCondVarHandle;
   791     DObject* condVarHandle = (DObject*) params.iCondVarHandle;
   942     condVarHandle = CheckIfObjectIsInContainer( EMemSpyDriverContainerTypeCondVar, condVarHandle );
   792     condVarHandle = CheckedOpen(EMemSpyDriverContainerTypeCondVar, condVarHandle);
   943     if  ( condVarHandle == NULL )
   793     if  ( condVarHandle == NULL )
   944         {
   794         {
   945         Kern::Printf("DMemSpyDriverLogChanMisc::GetCondVarSuspThrs() - END - condVar not found");
   795         Kern::Printf("DMemSpyDriverLogChanMisc::GetCondVarSuspThrs() - END - condVar not found");
   946         NKern::ThreadLeaveCS();
   796         NKern::ThreadLeaveCS();
   947         return KErrNotFound;
   797         return KErrNotFound;
   948         }
   798         }
   949     
   799     
   950     ResetTempHandles();
   800     ResetTempHandles();
   951         
   801         
   952     DCondVar* condVar = (DCondVar*) params.iCondVarHandle;;
   802     DCondVar* condVar = (DCondVar*) condVarHandle;
   953     
   803     
   954     NKern::LockSystem();
   804     NKern::LockSystem(); // Keep this, needed for iterating suspended queue -TomS
   955 
   805 
   956     // Iterate through suspended threads, writing back thread pointer (handle)
   806     // Iterate through suspended threads, writing back thread pointer (handle)
   957     // to client
   807     // to client
   958     SDblQue& suspQueue = condVarAdaption.GetSuspendedQ( *condVar );
   808     SDblQue& suspQueue = condVarAdaption.GetSuspendedQ( *condVar );
   959     SDblQueLink* anchor = &suspQueue.iA;
   809     SDblQueLink* anchor = &suspQueue.iA;
  1001             {
   851             {
  1002             r = finalWrite;
   852             r = finalWrite;
  1003             }
   853             }
  1004         }
   854         }
  1005 
   855 
       
   856 	condVarHandle->Close(NULL);
  1006     NKern::ThreadLeaveCS();
   857     NKern::ThreadLeaveCS();
  1007 
   858 
  1008     TRACE( Kern::Printf("DMemSpyDriverLogChanMisc::GetCondVarSuspThrs() - END - r: %d", r));
   859     TRACE( Kern::Printf("DMemSpyDriverLogChanMisc::GetCondVarSuspThrs() - END - r: %d", r));
  1009     return r;
   860     return r;
  1010     }
   861     }
  1024     DMemSpyDriverOSAdaptionDThread& threadAdaption = OSAdaption().DThread();
   875     DMemSpyDriverOSAdaptionDThread& threadAdaption = OSAdaption().DThread();
  1025 
   876 
  1026     NKern::ThreadEnterCS();
   877     NKern::ThreadEnterCS();
  1027 
   878 
  1028     DObject* threadHandle = (DObject*) aThreadHandle;
   879     DObject* threadHandle = (DObject*) aThreadHandle;
  1029     threadHandle = CheckIfObjectIsInContainer( EMemSpyDriverContainerTypeThread, threadHandle );
   880     threadHandle = CheckedOpen(EMemSpyDriverContainerTypeThread, threadHandle);
  1030     if  ( threadHandle == NULL )
   881     if  ( threadHandle == NULL )
  1031         {
   882         {
  1032         Kern::Printf("DMemSpyDriverLogChanMisc::GetCondVarSuspThrInfo() - END - thread not found");
   883         Kern::Printf("DMemSpyDriverLogChanMisc::GetCondVarSuspThrInfo() - END - thread not found");
  1033         NKern::ThreadLeaveCS();
   884         NKern::ThreadLeaveCS();
  1034         return KErrNotFound;
   885         return KErrNotFound;
  1041     if  ( r == KErrNone )
   892     if  ( r == KErrNone )
  1042         {
   893         {
  1043         r = Kern::ThreadRawWrite( &ClientThread(), aParams, &params, sizeof(TMemSpyDriverCondVarSuspendedThreadInfo) );
   894         r = Kern::ThreadRawWrite( &ClientThread(), aParams, &params, sizeof(TMemSpyDriverCondVarSuspendedThreadInfo) );
  1044         }
   895         }
  1045     
   896     
       
   897 	threadHandle->Close(NULL);
  1046     NKern::ThreadLeaveCS();
   898     NKern::ThreadLeaveCS();
  1047     
   899     
  1048     TRACE( Kern::Printf("DMemSpyDriverLogChanMisc::GetCondVarSuspThrInfo() - END - r: %d", r));
   900     TRACE( Kern::Printf("DMemSpyDriverLogChanMisc::GetCondVarSuspThrInfo() - END - r: %d", r));
  1049     return r;
   901     return r;
  1050     }
   902     }
  1104         MemSpyObjectIx* handles = threadAdaption.GetHandles( *thread );
   956         MemSpyObjectIx* handles = threadAdaption.GetHandles( *thread );
  1105         TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::SearchThreadsFor - handles: 0x%08x", handles ));
   957         TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::SearchThreadsFor - handles: 0x%08x", handles ));
  1106 
   958 
  1107         if  ( handles != NULL )
   959         if  ( handles != NULL )
  1108             {
   960             {
  1109             MemSpyObjectIx_Wait( handles );
   961             TBool found = handles->Find( aHandleToLookFor );
  1110             //
   962 	        if (found)
  1111             TInt searchResult = handles->At( aHandleToLookFor );
       
  1112 	        if  ( searchResult != KErrNotFound )
       
  1113 		        {
   963 		        {
  1114                 TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::SearchThreadsFor - found handle match in [%O]", thread ));
   964                 TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::SearchThreadsFor - found handle match in [%O]", thread ));
  1115                 aStream.WriteUint32( (TUint32) thread );
   965                 aStream.WriteUint32( (TUint32) thread );
  1116                 ++matches;
   966                 ++matches;
  1117 		        }
   967 		        }
  1118             //
       
  1119             MemSpyObjectIx_Signal( handles );
       
  1120             }
   968             }
  1121         }
   969         }
  1122 
   970 
  1123     // Finished with thread/process container.
   971     // Finished with thread/process container.
  1124     container->Signal();
   972     container->Signal();
  1149         MemSpyObjectIx* handles = processAdaption.GetHandles( *process );
   997         MemSpyObjectIx* handles = processAdaption.GetHandles( *process );
  1150         TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::SearchProcessFor - handles: 0x%08x", handles ));
   998         TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::SearchProcessFor - handles: 0x%08x", handles ));
  1151 
   999 
  1152         if  ( handles != NULL )
  1000         if  ( handles != NULL )
  1153             {
  1001             {
  1154             MemSpyObjectIx_Wait( handles );
  1002             TBool found = handles->Find( aHandleToLookFor );
  1155             //
  1003 	        if  ( found )
  1156             TInt searchResult = handles->At( aHandleToLookFor );
       
  1157 	        if  ( searchResult != KErrNotFound )
       
  1158 		        {
  1004 		        {
  1159                 TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::SearchProcessFor - found handle match in [%O]", process ));
  1005                 TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::SearchProcessFor - found handle match in [%O]", process ));
  1160                 aStream.WriteUint32( (TUint32) process );
  1006                 aStream.WriteUint32( (TUint32) process );
  1161                 ++matches;
  1007                 ++matches;
  1162 		        }
  1008 		        }
  1163             //
       
  1164             MemSpyObjectIx_Signal( handles );
       
  1165             }
  1009             }
  1166         }
  1010         }
  1167 
  1011 
  1168     // Finished with thread/process container.
  1012     // Finished with thread/process container.
  1169     container->Signal();
  1013     container->Signal();