@@ -583,25 +583,16 @@ INT_PTR CALLBACK TracertDlgProc(
583
583
584
584
if (uMsg == WM_DESTROY )
585
585
{
586
- context -> OutputHandle = NULL ;
587
-
588
586
PhSaveListViewColumnsToSetting (SETTING_NAME_TRACERT_COLUMNS , context -> OutputHandle );
589
587
PhSaveWindowPlacementToSetting (SETTING_NAME_TRACERT_WINDOW_POSITION , SETTING_NAME_TRACERT_WINDOW_SIZE , hwndDlg );
590
588
591
- PhSaveWindowPlacementToSetting (
592
- SETTING_NAME_PING_WINDOW_POSITION ,
593
- SETTING_NAME_PING_WINDOW_SIZE ,
594
- hwndDlg
595
- );
596
-
597
- if (context -> IconHandle )
598
- DestroyIcon (context -> IconHandle );
599
-
600
589
if (context -> FontHandle )
601
590
DeleteObject (context -> FontHandle );
602
591
603
592
PhDeleteLayoutManager (& context -> LayoutManager );
604
593
594
+ context -> OutputHandle = NULL ;
595
+
605
596
RemoveProp (hwndDlg , L"Context" );
606
597
PhFree (context );
607
598
@@ -616,78 +607,49 @@ INT_PTR CALLBACK TracertDlgProc(
616
607
{
617
608
case WM_INITDIALOG :
618
609
{
619
- PH_RECTANGLE windowRectangle ;
620
610
HANDLE dialogThread ;
611
+
612
+ PhCenterWindow (hwndDlg , GetParent (hwndDlg ));
613
+ CommonSetWindowIcon (hwndDlg );
614
+
615
+ Static_SetText (hwndDlg ,
616
+ PhaFormatString (L"Tracing %s..." , context -> IpAddressString )-> Buffer
617
+ );
618
+ Static_SetText (GetDlgItem (hwndDlg , IDC_STATUS ),
619
+ PhaFormatString (L"Tracing route to %s with %lu bytes of data..." , context -> IpAddressString , PhGetIntegerSetting (SETTING_NAME_PING_SIZE ))-> Buffer
620
+ );
621
621
622
622
context -> WindowHandle = hwndDlg ;
623
- context -> OutputHandle = GetDlgItem (hwndDlg , IDC_NETOUTPUTEDIT );
623
+ context -> OutputHandle = GetDlgItem (hwndDlg , IDC_LIST_TRACERT );
624
624
context -> MaxPingTimeout = PhGetIntegerSetting (SETTING_NAME_PING_MINIMUM_SCALING );
625
-
626
- windowRectangle .Position = PhGetIntegerPairSetting (SETTING_NAME_TRACERT_WINDOW_POSITION );
627
- windowRectangle .Size = PhGetScalableIntegerPairSetting (SETTING_NAME_TRACERT_WINDOW_SIZE , TRUE).Pair ;
628
-
629
- // Create the font handle.
630
625
context -> FontHandle = CommonCreateFont (-15 , GetDlgItem (hwndDlg , IDC_STATUS ));
631
626
632
- // Load the Process Hacker icon.
633
- context -> IconHandle = (HICON )LoadImage (
634
- NtCurrentPeb ()-> ImageBaseAddress ,
635
- MAKEINTRESOURCE (PHAPP_IDI_PROCESSHACKER ),
636
- IMAGE_ICON ,
637
- GetSystemMetrics (SM_CXICON ),
638
- GetSystemMetrics (SM_CYICON ),
639
- LR_SHARED
640
- );
641
-
642
- // Set window icon.
643
- if (context -> IconHandle )
644
- SendMessage (hwndDlg , WM_SETICON , ICON_SMALL , (LPARAM )context -> IconHandle );
645
-
646
627
PhSetListViewStyle (context -> OutputHandle , FALSE, TRUE);
647
628
PhSetControlTheme (context -> OutputHandle , L"explorer" );
648
629
PhAddListViewColumn (context -> OutputHandle , 0 , 0 , 0 , LVCFMT_RIGHT , 30 , L"TTL" );
630
+
649
631
for (UINT i = 0 ; i < MAX_PINGS ; i ++ )
650
632
PhAddListViewColumn (context -> OutputHandle , i + 1 , i + 1 , i + 1 , LVCFMT_RIGHT , 50 , L"Time" );
633
+
651
634
PhAddListViewColumn (context -> OutputHandle , IP_ADDRESS_COLUMN , IP_ADDRESS_COLUMN , IP_ADDRESS_COLUMN , LVCFMT_LEFT , 120 , L"IP Address" );
652
635
PhAddListViewColumn (context -> OutputHandle , HOSTNAME_COLUMN , HOSTNAME_COLUMN , HOSTNAME_COLUMN , LVCFMT_LEFT , 240 , L"Hostname" );
653
- PhSetExtendedListView (context -> OutputHandle );
654
-
655
636
PhLoadListViewColumnsFromSetting (SETTING_NAME_TRACERT_COLUMNS , context -> OutputHandle );
637
+ PhSetExtendedListView (context -> OutputHandle );
656
638
657
639
PhInitializeLayoutManager (& context -> LayoutManager , hwndDlg );
658
640
PhAddLayoutItem (& context -> LayoutManager , context -> OutputHandle , NULL , PH_ANCHOR_ALL );
659
641
PhAddLayoutItem (& context -> LayoutManager , GetDlgItem (hwndDlg , IDC_STATUS ), NULL , PH_ANCHOR_TOP | PH_ANCHOR_LEFT | PH_ANCHOR_RIGHT );
660
-
661
- // Load window settings.
662
- if (windowRectangle .Position .X == 0 || windowRectangle .Position .Y == 0 )
663
- {
664
- PhCenterWindow (hwndDlg , GetParent (hwndDlg ));
665
- }
666
- else
667
- {
668
- PhLoadWindowPlacementFromSetting (SETTING_NAME_PING_WINDOW_POSITION , SETTING_NAME_PING_WINDOW_SIZE , hwndDlg );
669
- }
670
-
671
-
672
- Static_SetText (context -> WindowHandle ,
673
- PhaFormatString (L"Tracing %s..." , context -> IpAddressString )-> Buffer
674
- );
675
- Static_SetText (GetDlgItem (hwndDlg , IDC_STATUS ),
676
- PhaFormatString (L"Tracing route to %s with %lu bytes of data..." , context -> IpAddressString , PhGetIntegerSetting (SETTING_NAME_PING_SIZE ))-> Buffer
677
- );
642
+ PhLoadWindowPlacementFromSetting (SETTING_NAME_TRACERT_WINDOW_POSITION , SETTING_NAME_TRACERT_WINDOW_SIZE , hwndDlg );
678
643
679
644
if (dialogThread = PhCreateThread (0 , NetworkTracertThreadStart , (PVOID )context ))
680
- {
681
645
NtClose (dialogThread );
682
- }
683
646
}
684
647
break ;
685
648
case WM_COMMAND :
686
649
{
687
650
switch (GET_WM_COMMAND_ID (wParam , lParam ))
688
651
{
689
652
case IDCANCEL :
690
- case IDOK :
691
653
DestroyWindow (hwndDlg );
692
654
break ;
693
655
}
@@ -709,12 +671,12 @@ INT_PTR CALLBACK TracertDlgProc(
709
671
L"*"
710
672
);
711
673
712
- TracertAppendText (
713
- context ,
714
- error -> LvItemIndex ,
715
- IP_ADDRESS_COLUMN ,
716
- TracertGetErrorMessage (error -> LastErrorCode )-> Buffer
717
- );
674
+ // TracertAppendText(
675
+ // context,
676
+ // error->LvItemIndex,
677
+ // IP_ADDRESS_COLUMN,
678
+ // TracertGetErrorMessage(error->LastErrorCode)->Buffer
679
+ // );
718
680
}
719
681
else
720
682
{
@@ -749,26 +711,22 @@ INT_PTR CALLBACK TracertDlgProc(
749
711
break ;
750
712
case NTM_RECEIVEDFINISH :
751
713
{
752
- PPH_STRING windowText = PhGetWindowText ( context -> WindowHandle ) ;
714
+ PPH_STRING windowText ;
753
715
754
- if (windowText )
716
+ if (windowText = PH_AUTO ( PhGetWindowText ( context -> WindowHandle )) )
755
717
{
756
718
Static_SetText (
757
719
context -> WindowHandle ,
758
720
PhaFormatString (L"%s complete." , windowText -> Buffer )-> Buffer
759
721
);
760
- PhDereferenceObject (windowText );
761
722
}
762
723
763
- windowText = PhGetWindowText (GetDlgItem (hwndDlg , IDC_STATUS ));
764
-
765
- if (windowText )
724
+ if (windowText = PH_AUTO (PhGetWindowText (GetDlgItem (hwndDlg , IDC_STATUS ))))
766
725
{
767
726
Static_SetText (
768
727
GetDlgItem (hwndDlg , IDC_STATUS ),
769
728
PhaFormatString (L"%s complete." , windowText -> Buffer )-> Buffer
770
729
);
771
- PhDereferenceObject (windowText );
772
730
}
773
731
}
774
732
break ;
0 commit comments