break; } case topicGetWindowInfo: {          do {  nsCOMPtr<nsIDOMWindowInternal> navWin; GetMostRecentWindow( NS_LITERAL_STRING( "navigator:browser" ).get(), getter_AddRefs( navWin ) ); if ( !navWin ) {  break; }  nsCOMPtr<nsIDOMWindow> content; navWin->GetContent( getter_AddRefs( content ) ); if ( !content ) { break; }  nsCOMPtr<nsIDOMWindowInternal> internalContent( do_QueryInterface( content ) ); if ( !internalContent ) { break; }  nsCOMPtr<nsIDOMLocation> location; internalContent->GetLocation( getter_AddRefs( location ) ); if ( !location ) { break; }  nsAutoString url; if ( NS_FAILED( location->GetHref( url ) ) ) { break; }  escapeQuotes( url );   nsCOMPtr<nsIScriptGlobalObject> scrGlobalObj( do_QueryInterface( internalContent ) ); if ( !scrGlobalObj ) { break; }  nsCOMPtr<nsIDocShell> docShell; scrGlobalObj->GetDocShell( getter_AddRefs( docShell ) ); if ( !docShell ) { break; }  nsCOMPtr<nsIBaseWindow> baseWindow( do_QueryInterface( docShell ) ); if ( !baseWindow ) { break; }  nsXPIDLString title; if(!baseWindow) { break; } baseWindow->GetTitle(getter_Copies(title));  escapeQuotes( title );    nsCAutoString   outpt( NS_LITERAL_CSTRING("\"") );   outpt.Append( NS_LossyConvertUCS2toASCII( url ) );   outpt.Append( NS_LITERAL_CSTRING("\",\"") );  outpt.Append( NS_LossyConvertUCS2toASCII( title.get() ));  outpt.Append( NS_LITERAL_CSTRING( "\",\"\"" ));      result = CreateDDEData( (LPBYTE)(const char*)outpt.get(), outpt.Length() + 1 ); #ifdef MOZ_DEBUG_DDE printf( "WWW_GetWindowInfo->%s\n", outpt.get() ); #endif } while ( PR_FALSE );
nsNativeAppSupportWin::HandleDDENotification( UINT uType,       // transaction type                                              UINT uFmt,        // clipboard data format                                              HCONV hconv,      // handle to the conversation                                              HSZ hsz1,         // handle to a string                                              HSZ hsz2,         // handle to a string                                              HDDEDATA hdata,   // handle to a global memory object                                              ULONG dwData1,    // transaction-specific data                                              ULONG dwData2 ) { // transaction-specific data#if MOZ_DEBUG_DDE    printf( "DDE: uType  =%s\n",      uTypeDesc( uType ).get() );    printf( "     uFmt   =%u\n",      (unsigned)uFmt );    printf( "     hconv  =%08x\n",    (int)hconv );    printf( "     hsz1   =%08x:%s\n", (int)hsz1, hszValue( mInstance, hsz1 ).get() );    printf( "     hsz2   =%08x:%s\n", (int)hsz2, hszValue( mInstance, hsz2 ).get() );    printf( "     hdata  =%08x\n",    (int)hdata );    printf( "     dwData1=%08x\n",    (int)dwData1 );    printf( "     dwData2=%08x\n",    (int)dwData2 );#endif    HDDEDATA result = 0;    if ( uType & XCLASS_BOOL ) {        switch ( uType ) {            case XTYP_CONNECT:                // Make sure its for our service/topic.                if ( FindTopic( hsz1 ) != -1 ) {                    // We support this connection.                    result = (HDDEDATA)1;                }                break;            case XTYP_CONNECT_CONFIRM:                // We don't care about the conversation handle, at this point.                result = (HDDEDATA)1;                break;        }    } else if ( uType & XCLASS_DATA ) {        if ( uType == XTYP_REQUEST ) {            switch ( FindTopic( hsz1 ) ) {                case topicOpenURL: {                    // Open a given URL...                    nsCString url = ParseDDEArg( hsz2, 0 );                    // Make it look like command line args.                    url.Insert( "mozilla -url ", 0 );#if MOZ_DEBUG_DDE                    printf( "Handling dde XTYP_REQUEST request: [%s]...\n", url.get() );#endif                    // Now handle it.                    HandleRequest( LPBYTE( url.get() ), PR_FALSE );                    // Return pseudo window ID.                    result = CreateDDEData( 1 );                    break;                }                case topicActivate: {                    // Activate a Nav window...                    nsCString windowID = ParseDDEArg( hsz2, 0 );                    // 4294967295 is decimal for 0xFFFFFFFF which is also a                    //   correct value to do that Activate last window stuff                    if ( windowID.Equals( "-1" ) ||                         windowID.Equals( "4294967295" ) ) {                        // We only support activating the most recent window (or a new one).                        ActivateLastWindow();                        // Return pseudo window ID.                        result = CreateDDEData( 1 );                    }                    break;                }                case topicVersion: {                    // Return version.  We're restarting at 1.0!                    DWORD version = 1 << 16; // "1.0"                    result = CreateDDEData( version );                    break;                }                case topicRegisterViewer: {                    // Register new viewer (not implemented).                    result = CreateDDEData( PR_FALSE );                    break;                }                case topicUnRegisterViewer: {                    // Unregister new viewer (not implemented).                    result = CreateDDEData( PR_FALSE );                    break;                }                default:                    break;            }        } else if ( uType & XTYP_POKE ) {            switch ( FindTopic( hsz1 ) ) {                case topicCancelProgress: {                    // "Handle" progress cancel (actually, pretty much ignored).                    result = (HDDEDATA)DDE_FACK;                    break;                }                default:                    break;            }        }    } else if ( uType & XCLASS_FLAGS ) {        if ( uType == XTYP_EXECUTE ) {            // Prove that we received the request.            DWORD bytes;            LPBYTE request = DdeAccessData( hdata, &bytes );#if MOZ_DEBUG_DDE            printf( "Handling dde request: [%s]...\n", (char*)request );#endif            HandleRequest( request );            // Release the data.            DdeUnaccessData( hdata );            result = (HDDEDATA)DDE_FACK;        } else {            result = (HDDEDATA)DDE_FNOTPROCESSED;        }    } else if ( uType & XCLASS_NOTIFICATION ) {    }#if MOZ_DEBUG_DDE    printf( "DDE result=%d (0x%08X)\n", (int)result, (int)result );#endif    return result;}