Free Web Hosting by Netfirms
Web Hosting by Netfirms | Free Domain Names by Netfirms

;-netload.asm v0.3----------------------------------------------------------- ; x86 - Dos & Win32 - Assembly Language Programming ; ; ; ; Written by: John A Lyons (megablast) ; ; Email : asm@megablast.8k.com ; ; Page : http://asmsource.cjb.com ; ; Compiler : Masm32 v6.15 Microsoft Macro Assembler ; ; Tested : Win98SE,Win2000 ; ; Date : 11-Aug-2002 ; ; Purpose : Program that displays the net load in a graph, within a ; ; small window. Includes a menu to change the options. ; ; ; ; v0.1 : Basic features, including graph function and menu ; ; Graph has been majorly reworked to take up less time. ; ; Added tab box for options and about, plus some other things ; ; like statistics to come later. Will also add some more ; ; options. ; ; v0.2 : Added upload measure. ; ; 15Aug02 Added network statistics tab, which shows how long program ; ; has been running, and how much has been downloaded overall. ; ; Added show all, to show in every available desktop, if you ; ; use vwin, which you should! ; ; Made a number of other improvements, and fixed up some bugs. ; ; v0.3 : Added minimise when idle, which will hide the window when ; ; 19Aug02 no network activity is occuring. ; ; Added dodgy move, so the the window can be positioned ; ; anywhere. This does not work that well, need to try a better ; ; was of doing this. ; ; Having major problems with title-no title, so just switched ; ; to no title, and will worry about this later. ; ; Added commas to big numbers in the statistics box. ; ; Added interface info tab, which will show information about ; ; each interface, similar to tcptable. ; ; Moved about tab to the last tab, i think this makes more ; ; sense. ; ; Fixed up move, so that it records the position. This ensures ; ; that the menu will appear in the correct place. ; ; Added new window positioning options, which lets you choose ; ; whether you want the window in a set position, or free. ; ; Added interface info consisting of pull-down list of interfac-; ; es and variety of information about them, ripped from ; ; tcptable program. ; ; Added taskbar icon, and hide the window from the tasbar. Only ; ; problem is that popup window wont go away until an entry ; ; is chosen. Must be doing something wrong! ; ; Fixed up printing out date time, for network statistics. Will ; ; now show 6:04 rather than 6:4. ; ; Fixed up problem with changing adapters, creating a much ; ; smaller total down/up number. This is time consuming to ; ; check for properly, during the WM_TIMER event, but a quick ; ; fix works really well. ; ; ; ; ; ; This is a copy of the memload program, changed to measure ip stats. ; ; ; ; --------------------------------------------------------------------------- ; ; ; Lots of thanks to assembly community for your help! ; ; http://board.win32asmcommunity.net/ ; ; ; ; --------------------------------------------------------------------------- ;Distribution: You can freely use this code in your own applications, but ; ; you many not reproduce or publish this code on any web site, ; ; online service, or distribute as source on any media without ; ; express permission. For business or government use, you must ; ; contact the author at asm@megablast.8k.com. ; ;---------------------------------------------------------------------------; .386 .MODEL FLAT, STDCALL include windows.inc include user32.inc include kernel32.inc include comctl32.inc include gdi32.inc includelib kernel32.lib includelib user32.lib includelib comctl32.lib includelib gdi32.lib include shell32.inc includelib shell32.lib include advapi32.inc includelib advapi32.lib include iphlpapi.inc includelib iphlpapi.lib ; ---------- procedures declared later update proto :DWORD graph proto HyperLinkWndProc PROTO :HWND, :DWORD, :DWORD, :DWORD regget proto regstring:DWORD regset proto regstring:DWORD,number:DWORD .CONST IDI_ICON1 equ 5 WM_SHELLNOTIFY equ WM_USER+5 ;------------------------- buttons IDC_EXIT equ 3002 IDC_HIDE equ 3000 ;------------------------- timer ID_TIMER equ 400 ;------------------------- menu IDM_FAST equ 32000 IDM_SLOW equ 32001 IDM_EXIT equ 32003 IDM_ABOUT equ 32002 ;------------------------- dialog IDC_EDIT1 equ 1117 IDC_EDIT2 equ 1118 IDC_EDIT3 equ 1119 IDC_EDIT4 equ 1120 IDC_EDIT5 equ 1121 IDC_EDIT6 equ 1122 IDC_EDIT7 equ 1123 IDC_EDIT8 equ 1124 IDC_EDIT9 equ 1125 IDC_EDIT10 equ 1126 ;------------------------- Options IDC_OPTION equ 1012 IDC_SHOW equ 1013 IDC_TAB1 equ 1011 IDC_ALWAYS equ 2000 ;IDC_RADIO1 equ 2001 ;IDC_RADIO2 equ 2002 ;IDC_RADIO3 equ 2003 IDC_FAST equ 2001 IDC_MED equ 2002 IDC_SLOW equ 2003 IDC_update equ 2004 IDC_CHECK1 equ 1050 IDC_CHECK2 equ 1051 IDC_CHECK3 equ 1052 IDC_CHECK4 equ 1053 IDC_CHECK5 equ 1054 IDC_CHECK6 equ 1055 IDC_CHECK7 equ 1056 IDC_CHECK8 equ 1057 IDC_CHECK9 equ 1058 IDC_CHECK10 equ 1059 IDC_CHECK11 equ 1060 IDC_COMBO1 equ 1350 IDC_RADIO1 equ 1250 IDC_RADIO2 equ 1251 IDC_RADIO3 equ 1252 IDC_RADIO4 equ 1253 IDC_RADIO5 equ 1254 ;------------------------- About IDC_URL equ 9 IDI_CUR1 equ 101 IDI_BITMAP equ 102 IDC_OK equ 3003 FontName db "arial",0 netnum db "Down %lu b/Sec, Up %lu b/Sec",0 netnum2 db "Down %lu Kb/Sec Up %lu Kb/Sec",0 hundred dd 100 MainDlgName DB "MAINWINDOW",0 MainDlgName2 DB "MAINWINDOW2",0 aboutdialog DB "ABOUTDIALOG",0 optionsdialog db "OPTIONSTab",0 windowtitle db "Memory Load",0 num1 db "%%" ;used for printing out numbers num2 db "%lu",0 ;-------------------------------- Registry regstring1 db "xpos",0 regstring2 db "flags",0 regstring3 db "ypos",0 regheight db "height",0 regwidth db "width",0 subkeyname db "Software\" progname db "NetLoad",0 .DATA wmenu dd ? intflags dw 0 ;internal flags - only used in program, not saved count dd 0 hInstance HINSTANCE ? CommandLine LPSTR ? mem1 db "Load %%%lu",0 runcount1 db "RunCount %lu",0 buff db 256 dup(?) menuhand DWORD ? first BOOL FALSE note NOTIFYICONDATA <> ;used for taskicon ;------------------ Tabbed data hwndTab HANDLE ? Handles LABEL DWORD Child1hWnd HANDLE ? Child2hWnd HANDLE ? Child3hWnd HANDLE ? Child4hWnd HANDLE ? Child5hWnd HANDLE ? Child6hWnd HANDLE ? tabhandle dd ? starttab dd ? Child1Name DB "UDPDLG",0 Child4Name DB "ABOUTDIALOG",0 Child2Name DB "STATSDLG",0 Child3Name DB "InterfaceDLG",0 Child5Name db "UDPDLG",0 Child6Name db "UDPDLG",0 TabTitle1 DB "Display Options",0 TabTitle4 DB "About",0 TabTitle2 DB "Network Statistics",0 TabTitle3 DB "Interface Info",0 TabTitle5 db "ICMP In Info",0 TabTitle6 db "ICMP Out Info",0 ;------------------------- Options windowupdate BOOL TRUE ;------------------------- Popup Menu IDM_ONTOP equ 2 IDM_UPDATE equ 3 ;IDM_EXIT equ 1 ;IDM_ABOUT equ 4 options db "Options",0 pick1 db "Always On Top",0 pick2 db "Update Title",0 about db "About",0 exit db "Exit",0 mshow db "Show Graph",0 ;------------------------- About hover BOOL ? ;first BOOL FALSE szOpen db "open",0 hwndDlg dd 0 first2 BOOL FALSE hFinger dd ? orgStatic dd ? tabwin dd ? newload BOOL TRUE memoryload dd ? mainhwnd HANDLE ? ifhwnd HANDLE ? ItemStruct TC_ITEM WhichTabChosen DWORD ? ;-------------------------------- Graph graphload db 1001 dup(0) graphloady db 1001 dup(0) graphsize dd 0 graphstart dd 0 graphheight dd 0 graphwidth dd 0 hdc dd 0 graphscale dd 56 ;scale graph, 56=56k modem fonthand dd 0 oldhand dd 0 menucolour dd 0 menubrush HBRUSH ? menupenbrush HBRUSH ? redpenbrush HBRUSH ? grnpenbrush HBRUSH ? blkbrush HBRUSH ? blkpenbrush HBRUSH ? object HBRUSH ? graphrect dd 0 graphx dd 0 graphy dd 0 textsize dd 0 maxup dw 0 ;this is our biggest value so far lastfew dd 0ffffffffh ;this shows wether the last 12 values were 0 or not windowstyle dd 0 ;window style deskrect RECT <> ;-------------------------------- Registry winlength dd 0 xpos dd 0 ypos dd 0 xposnew dd 0 yposnew dd 0 flags dd 0 hBitmap dd ? IDB_MAIN equ 102 ;------------------- ip stuff ipstats dd 23 dup(0) ipdown dd ? ipup dd ? ipdowninit dd ? ipupinit dd ? tcphand dd 0 tcpmem dd 0 temp2 dd 0 starttime SYSTEMTIME <> ;time when program started starttick dword 0 datenum db "%lu:00 %lu-%lu-%lu",0 ;------------------- Interface stuff intcombobox dd 0 ;------------------- Taskbar Icon stuff icon dd 0 .CODE start: WinMain PROTO hInst:HINSTANCE,hPrevInst:HINSTANCE,CmdShow:SDWORD INVOKE GetModuleHandle, NULL MOV hInstance,EAX INVOKE WinMain, hInstance,NULL,SW_SHOWDEFAULT INVOKE ExitProcess,EAX WinMain proc hInst:HINSTANCE,hPrevInst:HINSTANCE,CmdShow:SDWORD MOV EAX, OFFSET DlgProc INVOKE DialogBoxParam, hInst, OFFSET MainDlgName,NULL,EAX,NULL mov eax,hInst mov hInstance,eax RET WinMain endp getif proc LOCAL reqsize:DWORD mov [reqsize],20240 invoke GetIfTable,[tcpmem],addr reqsize,FALSE mov esi,[tcpmem] mov ecx,[esi] or ecx,ecx jz noscan add esi,4 xor eax,eax xor edx,edx countall: add eax,[esi+552] add edx,[esi+576] add esi,604+256 loop countall noscan: ret getif endp updateload proc ;update our graph LOCAL upnum:byte push eax push edx lea esi,graphload mov ebx,edx mov ecx,[graphstart] ;rotating data entry positions cmp ecx,1000 je nomoreinc inc ecx jmp endcheck1 nomoreinc: xor ecx,ecx endcheck1: mov [graphstart],ecx mov edx,[graphsize] cmp edx,1000 je nomaths inc [graphsize] inc edx nomaths: add esi,ecx ;xor eax,eax ;mov al,dl ;mov [temp2],ecx ;mov bl,25 ;mov al,50 mov [esi],al ;store up and down values mov [esi+1001],bl mov [upnum],bl mov edi,edx inc edi test [intflags],1 ;are we hidden?? jz contup cmp al,0 je noupload and [intflags],-1-1 push eax push edi invoke ShowWindow,[mainhwnd],SW_RESTORE pop edi pop eax contup: mov ebx,[lastfew] ;check to see if we should minimise shl ebx,1 or al,al jz gotnone inc ebx gotnone: mov [lastfew],ebx or ebx,ebx jnz nomini1 test [flags],128 ;minimise when idle flag set jnz nomini1 or [intflags],1 ;set internal flag saying we are hidden invoke ShowWindow,[mainhwnd],SW_HIDE jmp noupload nomini1: mov ecx,[graphx] mov ebx,[graphy] cmp edi,ecx jbe xisok mov edi,ecx xisok: cmp edx,ecx ;check size of graph, do we scroll? jb noscroll push eax ;sub ecx,1 invoke BitBlt,hdc,1,1,ecx,ebx,hdc,2,1,SRCCOPY pop eax noscroll: test [flags],8 ;no download jnz goupload mul ebx div [hundred] push ebx cmp eax,ebx jbe subok1 mov eax,ebx subok1: sub ebx,eax inc ebx pop ecx ;inc ecx ;inc ecx mov eax,edi inc eax push edi invoke Rectangle,hdc,edi,ebx,eax,ecx;58 ;draw download line pop edi goupload: test [flags],16 ;no upload jnz noupload invoke SelectObject,hdc,[grnpenbrush] ;changepen mov ebx,[graphy] xor eax,eax mov al,[upnum] mul ebx div [hundred] push ebx cmp eax,ebx jbe subok2 mov eax,ebx subok2: sub ebx,eax inc ebx pop ecx mov eax,edi inc eax invoke Rectangle,hdc,edi,ebx,eax,ecx ;draw upload line invoke SelectObject,hdc,[redpenbrush] noupload: pop edx pop eax ret updateload endp showgraph proc invoke SelectObject,hdc,[blkpenbrush] push ebx push esi push edi ;invoke CreatePen,PS_SOLID,1,0ff0000h ;red ;invoke SelectObject,hdc,eax invoke SelectObject,hdc,[blkbrush] ;draw black rect for graph mov eax,[graphx] mov ecx,[graphy] add eax,2 add ecx,2+2 invoke Rectangle,hdc,0,0,eax,ecx invoke SelectObject,hdc,[menubrush] invoke SelectObject,hdc,[menupenbrush] mov edx,[graphx] ;draw grey for writing inc edx inc edx mov eax,[graphy] mov ecx,eax ;dec ecx add eax,15 invoke Rectangle,hdc,0,ecx,edx,eax invoke SelectObject,hdc,[redpenbrush] lea esi,graphload mov ecx,[graphx] mov eax,[graphsize] ;below screen width cmp eax,ecx jb noproblem mov ebx,[graphstart] ;adjust the start, so that it is screenwidth behind the start. cmp ebx,ecx ja moveitok add esi,1000 moveitok: add esi,ebx sub esi,ecx noproblem: mov ebx,[graphy] mov edi,1 redrawgraph: push ecx test [flags],8 ;no upload jnz goupload3 xor eax,eax mov al,[esi] ;draw download line mul ebx ;adjust our values to the graph height div [hundred] mov ecx,ebx ;is it too big? cmp eax,ebx jbe subok1 mov eax,ebx subok1: sub ecx,eax inc ecx mov edx,edi ;draw one line inc edx push edi invoke Rectangle,hdc,edi,ecx,edx,ebx;58 pop edi goupload3: test [flags],16 ;no upload jnz noupload3 invoke SelectObject,hdc,[grnpenbrush] ;changepen xor eax,eax mov al,[esi+1001] ;draw upload line mul ebx ;adjust our values to the graph height div [hundred] mov ecx,ebx ;is it too big? cmp eax,ebx jbe subok2 mov eax,ebx subok2: sub ecx,eax inc ecx mov edx,edi ;draw one line inc edx invoke Rectangle,hdc,edi,ecx,edx,ebx;58 invoke SelectObject,hdc,[redpenbrush] ;changepen noupload3: pop ecx inc edi inc esi cmp esi,offset graphload+1000 jbe esiok ;have we gone too far? sub esi,1000 ;yes - go back to beginning esiok: dec ecx or ecx,ecx jnz redrawgraph ;loop redrawgraph noredraw: test [flags],32 jz noshowcount2 mov ebx,[graphy] add ebx,2 invoke TextOut,hdc,7,ebx,ADDR buff+100,[textsize] noshowcount2: pop edi pop esi pop ebx xor eax,eax ret showgraph endp printeax proc ; prints the value in eax into the buff. push edx push eax push offset num2 push offset buff call wsprintfA add esp,0ch pop edx ret printeax endp DlgProc proc hWnd:HWND, uMsg:UINT, wParam:WPARAM, lParam:LPARAM LOCAL rect:RECT LOCAL Disp :DWORD LOCAL pKey :DWORD LOCAL Temp :DWORD LOCAL pt :POINT mov eax,uMsg ;handle timer event, put it first, since we ;want to handle it quickly. .if ax==WM_TIMER push ebx push edi push esi call getif ; mov eax,[ipup] ;test; ; add eax,4000 push edx push eax mov ecx,[ipup] ;when adapters change, we may have a ridiculous cmp eax,ecx ;value. A huge decrease will occur. When this jae isbigok ;happens, just set it to zero, and later the mov eax,ecx ;the recorded values will be reset. isbigok: sub eax,ecx mov ecx,[ipdown] cmp edx,ecx jae isbigok2 mov edx,ecx isbigok2: sub edx,ecx push edx ;straight to print routine push eax push eax ;adjust to scale and update our graph mov eax,edx xor edx,edx div [graphscale] mov edx,eax pop eax push edx xor edx,edx div [graphscale] pop edx call updateload test [flags],256 jz noconvert1 pop eax pop edx push ebx mov ebx,edx xor edx,edx mov ecx,1024 div ecx push eax mov eax,ebx xor edx,edx div ecx push eax push offset netnum2 push offset buff+100 call wsprintfA add esp,16 pop ebx ; mov esi,offset buff+100 ;finddot1: ; inc esi ; cmp [esi],byte ptr "." ; jne finddot1 ; ; mov cx,[esi-2] ; mov [esi-2],byte ptr "-" ; mov [esi-1],cx ; jmp noconvert2 noconvert1: ;push edx ;push eax push offset netnum push offset buff+100 call wsprintfA add esp,16 noconvert2: lea esi,buff+100 call countit mov [textsize],ecx test [flags],32 jz noshowcount1 mov ebx,[graphy] add ebx,2 invoke TextOut,hdc,7,ebx,ADDR buff+100,ecx noshowcount1: pop eax pop edx mov [ipup],eax mov [ipdown],edx invoke SetWindowText,[hWnd],addr buff+100 pop esi pop edi pop ebx xor eax,eax ret .elseif ax==WM_CLOSE bigclose: invoke Shell_NotifyIcon,NIM_DELETE,addr note invoke KillTimer,hWnd,ID_TIMER invoke GlobalFree,[tcphand] invoke DeleteObject,[blkbrush] ;delete all these GDI object invoke DeleteObject,[blkpenbrush] invoke DeleteObject,[menubrush] invoke DeleteObject,[menupenbrush] invoke DeleteObject,[redpenbrush] invoke DeleteObject,[grnpenbrush] invoke DeleteObject,[fonthand] invoke ReleaseDC,[hWnd],hdc invoke GetWindowRect,hWnd,ADDR rect mov eax,rect.top mov eax,rect.left mov eax,[flags] invoke regset,ADDR regstring2,eax mov eax,xpos cmp eax,0f000h ;get a ridiculous value ja nosetpos invoke regset,ADDR regstring1,eax mov eax,ypos invoke regset,ADDR regstring3,eax nosetpos: mov eax,[graphheight] invoke regset,ADDR regheight,eax mov eax,[graphwidth] invoke regset,ADDR regwidth,eax INVOKE ExitProcess,0 RET ;deal with a move .ELSEIF ax==WM_PAINT ;invoke ShowWindow,[mainhwnd],SW_RESTORE ;mov [lastfew],-1 ;and [intflags],-1-3 ;mov [intflags],0 ;not best way of doing this! redrawgraph2: call showgraph xor eax,eax ret .ELSEIF ax==WM_LBUTTONDOWN test [flags],512 jz nofreemove mov eax,[lParam] mov edx,eax and eax,0ffffh shr edx,16 mov [xposnew],eax mov [yposnew],edx or [intflags],2 nofreemove: xor eax,eax ret .ELSEIF ax==WM_LBUTTONUP mov [intflags],0 ;and [intflags],0ffffffffh-2 call updatepos xor eax,eax ret .elseif ax==WM_MOUSEMOVE test [intflags],2 jz nomove2 invoke GetWindowRect,mainhwnd,ADDR rect mov eax,[lParam] mov edx,eax and eax,0ffffh shr edx,16 add eax,rect.left add edx,rect.top sub eax,[xposnew] sub edx,[yposnew] invoke SetWindowPos,mainhwnd,0,eax,edx,0,0,SWP_NOZORDER+SWP_SHOWWINDOW+SWP_NOSIZE nomove2: xor eax,eax ret .ELSEIF ax==WM_MOVE test [intflags],2 jnz noonscreen2 call updatepos jmp redrawgraph2 noonscreen2: xor eax,eax ret .elseif ax==WM_WINDOWPOSCHANGED ;ensure that little window stays ontop test [flags],4 ;always showing? jz noonscreen test [intflags],1 ;are we hidden?? jnz noonscreen test [intflags],2 ;are we moving? jnz noonscreen invoke ShowWindow,[mainhwnd],SW_RESTORE noonscreen: xor eax,eax ret .elseif ax==WM_INITDIALOG ;first things to do, seutp icon ;read registry,set window pos, create invoke GetLocalTime,addr starttime ;menu,change system menu, and setup invoke GetTickCount ;timer event mov [starttick],eax push ebx ;mov [graphsize],990 ;mov [graphstart],990 invoke GlobalAlloc,GMEM_MOVEABLE,20480 ;need some memory for the table mov [tcphand],eax invoke GlobalLock,eax mov [tcpmem],eax call getif ;set up our total parameters mov [ipup],eax mov [ipdown],edx mov [ipdowninit],edx mov [ipupinit],eax invoke GetDC,[hWnd] ;open context to window mov [hdc],eax ;and setup fonts + cols. invoke CreateFont,8,5,0,0,400,0,0,0,OEM_CHARSET,\ OUT_DEFAULT_PRECIS,CLIP_DEFAULT_PRECIS,\ DEFAULT_QUALITY,DEFAULT_PITCH or FF_SCRIPT,\ ADDR FontName mov [fonthand],eax invoke SelectObject, hdc, eax mov [oldhand],eax invoke CreatePen,PS_SOLID,1,0h ;black pen mov [blkpenbrush],eax invoke CreatePen,PS_SOLID,1,0ff00h ;green pen mov [grnpenbrush],eax invoke CreatePen,PS_SOLID,1,0ffh ;red mov [redpenbrush],eax invoke SelectObject,hdc,eax mov object,eax invoke SetTextColor,hdc,0ffffffh ;change text color invoke GetSysColor,COLOR_MENU mov [menucolour],eax invoke SetBkColor,hdc,eax invoke CreatePen,PS_SOLID,1,[menucolour] mov [menupenbrush],eax invoke CreateSolidBrush,[menucolour] mov [menubrush],eax invoke CreateSolidBrush,0h ;black mov [blkbrush],eax invoke SelectObject,hdc,eax invoke LoadIcon, hInstance, IDI_ICON1 mov [icon],eax invoke SendMessage, hWnd, WM_SETICON, 1, eax invoke LoadBitmap,hInstance,IDB_MAIN mov hBitmap,eax mov eax,[hWnd] mov [mainhwnd],eax invoke GetWindowLong,[mainhwnd],GWL_STYLE mov [windowstyle],eax ;call adjusttitle2 ;retreive pos invoke regget,ADDR regstring1 cmp eax,NULL ;cant find regstring je newrun cmp eax,0f000h jb regisok1 mov [xpos],10 mov [ypos],10 jmp resetpos newrun: cmp eax,NULL jne regisok1 mov [count],0 mov ebx,50 mov eax,100 mov [graphwidth],eax mov [graphheight],ebx mov [flags],0;512+1+4 mov [xpos],10 mov [ypos],10 jmp regstuffend regisok1: mov xpos,eax invoke regget,ADDR regstring3 mov ypos,eax resetpos: invoke regget,ADDR regstring2 ;get flags mov [flags],eax ;retreive size invoke regget,ADDR regheight mov [graphheight],eax ;add eax,38 push eax invoke regget,ADDR regwidth pop ebx mov [graphwidth],eax ;add eax,19 regstuffend: invoke SetWindowPos,[mainhwnd],0,xpos,ypos,eax,ebx,SWP_NOZORDER+SWP_SHOWWINDOW invoke CreatePopupMenu mov [wmenu],eax invoke AppendMenu,wmenu,MF_STRING,-1,ADDR progname invoke AppendMenu,wmenu,MF_SEPARATOR,0,0 invoke AppendMenu,wmenu,MF_STRING,IDC_SHOW,ADDR mshow invoke AppendMenu,wmenu,MF_STRING,IDC_OPTION,ADDR options invoke AppendMenu,wmenu,MF_STRING,IDM_ONTOP,ADDR pick1 ;invoke AppendMenu,wmenu,MF_STRING,IDM_UPDATE,ADDR pick2 invoke AppendMenu,wmenu,MF_STRING,IDM_ABOUT,ADDR about invoke AppendMenu,wmenu,MF_SEPARATOR,0,0 invoke AppendMenu,wmenu,MF_STRING,IDM_EXIT,ADDR exit invoke CheckMenuItem,wmenu,IDM_UPDATE,MF_CHECKED invoke GetSystemMenu,hWnd,FALSE invoke AppendMenu,eax,MF_STRING,IDM_ABOUT,ADDR about call updatepos invoke SetTimer, mainhwnd, ID_TIMER, 1000, 0 pop ebx mov word ptr [buff+100],word ptr 30h ;menu item 0 mov eax,[Child1hWnd] mov [starttab],eax ;first tab mov WhichTabChosen,1 test [flags],1 ;is it always ontop jz gotontop2 invoke CheckMenuItem,wmenu,IDM_ONTOP,MF_CHECKED invoke SetWindowPos,[mainhwnd],HWND_TOPMOST,0,0,0,0,SWP_NOMOVE+SWP_NOSIZE gotontop2: ;invoke GetWindowLong,[mainhwnd],GWL_STYLE ;and eax,0ffffffffh-WS_CAPTION ;invoke SetWindowLong,[mainhwnd],GWL_STYLE,eax;WS_POPUP+WS_VISIBLE+WS_SIZEBOX+WS_CAPTION+WS_SYSMENU ;call updatepos ;invoke SetWindowLong,[mainhwnd],GWL_EXSTYLE,WS_EX_TOOLWINDOW push 0 push 0 push offset netnum push offset buff+100 call wsprintfA add esp,16 ;add on little icon mov note.cbSize,sizeof NOTIFYICONDATA push hWnd pop note.hwnd mov note.uID,1;IDI_TRAY mov note.uFlags,7;NIF_ICON+NIF_MESSAGE+NIF_TIP mov note.uCallbackMessage,WM_SHELLNOTIFY ;invoke LoadIcon,NULL,IDI_ICON1;IDI_APPLICATION;IDI_WINLOGO mov eax,icon mov note.hIcon,eax ;invoke lstrcpy,addr note.szTip,addr tooltip invoke Shell_NotifyIcon,NIM_ADD,addr note xor eax,eax ret ;deal with menu commands .ELSEIF ax==WM_COMMAND mov eax,wParam .IF lParam==0 .IF ax==IDM_ONTOP call flipontop .ELSEIF ax==IDM_UPDATE xor [windowupdate],1 cmp [windowupdate],TRUE je setupdate invoke SetWindowText,mainhwnd,ADDR windowtitle invoke CheckMenuItem,wmenu,IDM_UPDATE,MF_UNCHECKED jmp noupdate1 setupdate: mov [memoryload],0 invoke CheckMenuItem,wmenu,IDM_UPDATE,MF_CHECKED noupdate1: .ELSEIF ax==IDM_ABOUT goabout: mov WhichTabChosen,3 jmp gooptions .ELSEIF ax==IDC_SHOW ;show the graph mov [lastfew],-1 mov [intflags],0 ; not best way of doing this invoke ShowWindow,[mainhwnd],SW_SHOWDEFAULT xor eax,eax ret .ELSEIF ax==IDC_OPTION mov WhichTabChosen,0 gooptions: lea eax,OptionsDlgProc invoke CreateDialogParam,hInstance,addr optionsdialog,hWnd,eax,NULL mov hwndDlg,eax xor eax,eax ret .ELSEIF ax==IDM_EXIT jmp bigclose .ENDIF .ENDIF ;deal with command from system menu .ELSEIF ax==WM_SYSCOMMAND mov eax,wParam .IF ax==IDM_ABOUT jmp goabout .endif ;deal with clicks on taskbar icon .elseif eax==WM_SHELLNOTIFY mov rect.left,0 mov rect.right,0 mov rect.top,0 mov rect.bottom,0 .if wParam==1;IDI_TRAY mov eax,lParam .if ax==WM_RBUTTONDOWN invoke GetCursorPos,addr pt invoke TrackPopupMenu,wmenu,TPM_RIGHTALIGN,pt.x,pt.y,NULL,hWnd,ADDR rect xor eax,eax ret .elseif ax==WM_LBUTTONDOWN ;invoke GetCursorPos,addr pt ;invoke TrackPopupMenu,wmenu,TPM_RIGHTALIGN,pt.x,pt.y,NULL,hWnd,NULL .endif .endif ;when we need to repaint .elseif ax==WM_PAINT push ebx push edi push esi call graph ;test [flags],32 ;print the bottom line if chosen ;jz noshowcount3 ;lea esi,buff+100 ;call countit mov ebx,[graphy] add ebx,2 invoke TextOut,hdc,7,ebx,ADDR buff+100,5;ecx noshowcount3: pop esi pop edi pop ebx xor eax,eax ret .elseif ax==WM_SIZE ;someone trying to resize window, ;just stop them from making it too big. invoke GetWindowRect,mainhwnd,ADDR rect mov eax,rect.bottom sub eax,rect.top ;sub eax,38 mov [graphheight],eax mov eax,rect.right sub eax,rect.left ;sub eax,19 mov [graphwidth],eax cmp eax,300-9 ; is our window too big??? jb sizeok2 mov eax,[graphheight] ;add eax,38 invoke SetWindowPos,mainhwnd,0,xpos,ypos,299,eax,SWP_NOZORDER+SWP_SHOWWINDOW sizeok2: call updatepos jmp redrawgraph2 xor eax,eax ret ;popup menu .ELSEIF ax==WM_RBUTTONDOWN invoke ModifyMenu,wmenu,0,MF_BYPOSITION,-1,ADDR buff+100 mov edx,lParam mov ecx,edx and edx,0ffffh shr ecx,16 add edx,xpos add ecx,ypos add ecx,20 invoke TrackPopupMenu,wmenu,TPM_CENTERALIGN +TPM_LEFTBUTTON,edx,ecx,0,hWnd,NULL .endif xor eax,eax ret DlgProc endp updatepos proc ;get new position and window size LOCAL rect:RECT invoke GetWindowRect,mainhwnd,ADDR rect mov eax,rect.right sub eax,rect.left mov winlength,eax mov eax,rect.top mov ypos,eax mov ecx,rect.left mov xpos,ecx mov edx,rect.bottom sub edx,eax sub edx,38+1-4;-17 test [flags],64 ;does window have a title jnz notitle add edx,19 notitle: test [flags],32 ;no count displayed at bottom of screen jnz nocount3 add edx,8 nocount3: mov [graphy],edx mov edx,rect.right sub edx,ecx sub edx,10+1 mov [graphx],edx ret updatepos endp countit proc xor ecx,ecx findend1: inc ecx inc esi cmp [esi],byte ptr 0 jnz findend1 ret countit endp AboutDlgProc2 PROC hWnd:HWND,iMsg:DWORD,wParam:WPARAM, lParam:LPARAM LOCAL ps:PAINTSTRUCT LOCAL rect:RECT mov eax,iMsg .if eax==WM_INITDIALOG invoke GetDlgItem, [hWnd], IDC_URL invoke SetWindowLong, eax, GWL_WNDPROC, ADDR HyperLinkWndProc mov orgStatic,eax invoke LoadCursor,hInstance,IDI_CUR1 mov hFinger,eax xor eax,eax ret .ELSEIF eax == WM_CTLCOLORSTATIC ;invoke SendMessage,lParam,iMsg,wParam,lParam ;ret .elseif eax==WM_CLOSE aboutclose: invoke EndDialog,[tabhandle],NULL invoke DestroyWindow,[tabhandle] .elseif ax==WM_COMMAND .if ax==IDC_EXIT jmp aboutclose .endif .endif mov eax,TRUE ret AboutDlgProc2 endp HyperLinkWndProc PROC uses ebx, hWnd:DWORD,uMsg:DWORD,wParam:DWORD,lParam:DWORD LOCAL tmpFont :LOGFONT LOCAL rect:RECT LOCAL pt:POINT LOCAL ps:PAINTSTRUCT mov eax,uMsg .IF eax==WM_NCHITTEST mov eax, 1 ;We want to handle the non client hit test so we return true or 1 ret .ELSEIF eax == WM_CTLCOLORSTATIC push ebx push edx invoke SendMessage, hWnd, WM_GETFONT, 0, 0 mov edx,eax invoke GetObject, edx, sizeof LOGFONT, addr tmpFont mov tmpFont.lfUnderline, TRUE invoke CreateFontIndirect, addr tmpFont mov ebx,eax invoke SelectObject, wParam, ebx .if hover == FALSE invoke SetTextColor, wParam, Blue .else invoke SetTextColor, wParam,Red .endif invoke GetSysColor, COLOR_MENU invoke SetBkColor, wParam, eax invoke DeleteObject,ebx invoke GetStockObject, HOLLOW_BRUSH pop edx pop ebx ret .ELSEIF eax==WM_MOUSEMOVE invoke GetParent,hWnd push ebx mov ebx,eax invoke GetActiveWindow .if eax == ebx invoke GetCursorPos,addr pt invoke GetWindowRect,hWnd,addr rect invoke PtInRect,addr rect,pt.x,pt.y .if eax invoke GetCapture .if !eax invoke SetCapture,hWnd mov hover,TRUE invoke InvalidateRect,hWnd,FALSE,FALSE invoke SetCursor,hFinger .endif .else invoke GetCapture .if eax invoke ReleaseCapture mov hover,FALSE invoke InvalidateRect,hWnd,FALSE,FALSE .endif .endif .endif pop ebx xor eax,eax ret .ELSEIF eax==WM_LBUTTONDOWN invoke GetWindowText,hWnd,offset buff,sizeof buff ;change this for using a preset url invoke ShellExecute, NULL, offset szOpen, offset buff, NULL, NULL, SW_MAXIMIZE ;change this to represent your preset url mov hover,FALSE invoke InvalidateRect,hWnd,FALSE,FALSE invoke SendMessage, hWnd, WM_GETFONT, 0, 0 ;Get the defualt system font mov edx,eax ;store result invoke GetObject, edx, sizeof LOGFONT, addr tmpFont ;get our font into a logfont structure mov tmpFont.lfUnderline, TRUE ;under line the link invoke CreateFontIndirect, addr tmpFont ;Create the new font mov ebx,eax ;We need the return to free the memory later invoke SelectObject, wParam, ebx ;Select our control invoke SetTextColor, wParam, Blue ;change this to change the color of the link xor eax,eax ret .ENDIF invoke CallWindowProc, orgStatic, hWnd, uMsg, wParam, lParam ret HyperLinkWndProc endp regget proc regstring:DWORD LOCAL number:DWORD LOCAL Disp :DWORD LOCAL pKey :DWORD LOCAL Temp :DWORD mov Temp,4 invoke RegCreateKeyEx, HKEY_LOCAL_MACHINE,ADDR subkeyname, NULL, NULL,REG_OPTION_NON_VOLATILE,KEY_READ, NULL,addr pKey, addr Disp cmp eax,ERROR_SUCCESS jne regok1 invoke RegQueryValueEx, pKey, regstring,NULL, ADDR Disp, ADDR number, ADDR Temp cmp eax, ERROR_SUCCESS jne regok1 invoke RegCloseKey, pKey mov eax,number ret regok1: mov eax,NULL ret regget endp regset proc regstring:DWORD,number:DWORD LOCAL Disp :DWORD LOCAL pKey :DWORD LOCAL Temp :DWORD mov Temp,4 invoke RegCreateKeyEx, HKEY_LOCAL_MACHINE,ADDR subkeyname, NULL, NULL,REG_OPTION_NON_VOLATILE,KEY_WRITE, NULL, addr pKey, addr Disp cmp eax,ERROR_SUCCESS jne regok2 invoke RegSetValueEx, pKey, regstring,NULL, REG_DWORD_LITTLE_ENDIAN,ADDR number, Temp invoke RegCloseKey, pKey regok2: ret regset endp graph2 proc LOCAL ps:PAINTSTRUCT LOCAL hMemDC:HDC LOCAL rect:RECT ; invoke GetDC,mainhwnd ; mov hdc,eax ; mov edx,[graphwidth] ; add edx,7+4 ; mov ecx,[graphheight] ; add ecx,7+4 ; invoke Rectangle,hdc,0,0,edx,ecx ; invoke SelectObject,hdc,object ; invoke DeleteObject,eax ;push edi ;push esi mov ecx,[graphsize] cmp ecx,0 je noplay lea esi,graphload mov edi,1 ;top mov eax,[graphstart] ;where do we start the data or eax,eax jz startsimple mov ebx,[graphwidth] add ebx,9 cmp eax,ebx jb nojohn1 sub eax,ebx jmp gook1 nojohn1: add eax,300 sub eax,ebx gook1: add esi,eax jmp next2 startsimple: mov eax,[graphwidth] add eax,9 cmp ecx,eax jbe nextrect mov ebx,[graphsize] sub ebx,eax add esi,ebx next2: mov ecx,[graphwidth] add ecx,9 nextrect: xor eax,eax mov al,[esi] xor edx,edx mov ebx,[graphheight];52 add ebx,9-7 mul ebx xor edx,edx mov ebx,100 div ebx mov ebx,[graphheight];58 add ebx,10-7 cmp eax,ebx jbe subok1 mov eax,ebx subok1: sub ebx,eax mov eax,edi inc eax push esi push edi push ecx mov ecx,[graphheight] add ecx,6+4-7 invoke Rectangle,hdc,edi,ebx,eax,ecx;58 pop ecx pop edi pop esi inc esi inc edi lea eax,graphload add eax,300;[graphwidth];225 cmp esi,eax jb graphok lea esi,graphload graphok: loop nextrect noplay: ;pop esi ;pop edi ; invoke ReleaseDC,mainhwnd,hdc ret graph2 endp graph proc ret graph endp flipontop proc xor [flags],1 test [flags],1 jnz setontop invoke SetWindowPos,mainhwnd,HWND_NOTOPMOST,0,0,0,0,SWP_NOMOVE+SWP_NOSIZE invoke CheckMenuItem,wmenu,IDM_ONTOP,MF_UNCHECKED jmp clearontop setontop: invoke SetWindowPos,mainhwnd,HWND_TOPMOST,0,0,0,0,SWP_NOMOVE+SWP_NOSIZE invoke CheckMenuItem,wmenu,IDM_ONTOP,MF_CHECKED clearontop: ret flipontop endp OptionsDlgProc PROC hWnd:HWND,iMsg:DWORD,wParam:WPARAM, lParam:LPARAM ;----------------stats window mov eax,iMsg .if eax==WM_INITDIALOG mov eax,[hWnd] mov [tabhandle],eax INVOKE InitCommonControls INVOKE GetDlgItem,hWnd,IDC_TAB1 mov [hwndTab],eax mov ItemStruct.imask,TCIF_TEXT mov ItemStruct.lpReserved1,0 mov ItemStruct.lpReserved2,0 mov ItemStruct.pszText,OFFSET TabTitle1 mov ItemStruct.cchTextMax,sizeof TabTitle1 mov ItemStruct.iImage,0 mov ItemStruct.lParam,0 invoke SendMessage,hwndTab,TCM_INSERTITEM,0,OFFSET ItemStruct mov ItemStruct.pszText,OFFSET TabTitle2 mov ItemStruct.cchTextMax,sizeof TabTitle2 invoke SendMessage,hwndTab,TCM_INSERTITEM,1,OFFSET ItemStruct mov ItemStruct.pszText,OFFSET TabTitle3 mov ItemStruct.cchTextMax,sizeof TabTitle3 invoke SendMessage,hwndTab,TCM_INSERTITEM,2,OFFSET ItemStruct mov ItemStruct.pszText,OFFSET TabTitle4 mov ItemStruct.cchTextMax,sizeof TabTitle4 invoke SendMessage,hwndTab,TCM_INSERTITEM,3,OFFSET ItemStruct ; mov ItemStruct.pszText,OFFSET TabTitle5 ; mov ItemStruct.cchTextMax,sizeof TabTitle5 ; invoke SendMessage,hwndTab,TCM_INSERTITEM,4,OFFSET ItemStruct ; mov ItemStruct.pszText,OFFSET TabTitle6 ; mov ItemStruct.cchTextMax,sizeof TabTitle6 ; invoke SendMessage,hwndTab,TCM_INSERTITEM,5,OFFSET ItemStruct mov eax,offset TcpDlgProc invoke CreateDialogParam,hInstance,OFFSET Child1Name,hwndTab,eax,0 mov Child1hWnd,eax mov eax,offset StatsDlgProc invoke CreateDialogParam,hInstance,OFFSET Child2Name,hwndTab,eax,0 mov Child2hWnd,eax mov eax,offset IntDlgProc invoke CreateDialogParam,hInstance,OFFSET Child3Name,hwndTab,eax,0 mov Child3hWnd,eax mov eax,offset AboutDlgProc invoke CreateDialogParam,hInstance,OFFSET Child4Name,hwndTab,eax,0 mov Child4hWnd,eax mov eax,offset TcpDlgProc invoke CreateDialogParam,hInstance,OFFSET Child5Name,hwndTab,eax,0 mov Child5hWnd,eax mov eax,offset TcpDlgProc invoke CreateDialogParam,hInstance,OFFSET Child6Name,hwndTab,eax,0 mov Child6hWnd,eax ;mov [starttab],offset Child1hWnd ;first tab ;mov WhichTabChosen,1 push esi xor ecx,ecx mov ecx,[WhichTabChosen] shl ecx,2 lea esi,Child1hWnd add esi,ecx mov eax,[esi] mov [starttab],eax pop esi invoke ShowWindow,eax,SW_SHOWDEFAULT invoke SendMessage,[hwndTab],TCM_SETCURSEL,[WhichTabChosen],0 ret .elseif eax==WM_NOTIFY push ebx mov eax,lParam mov eax, (NMHDR PTR [eax]).code cmp eax, TCN_SELCHANGE jz ChangingTab jmp endnotify ChangingTab: mov EBX,WhichTabChosen mov eax,[Handles+EBX*4] invoke ShowWindow,eax,SW_HIDE invoke SendMessage,hwndTab,TCM_GETCURSEL,0,0 ; Ok which one is BEING chosen right now? mov WhichTabChosen,eax mov EBX,[Handles+eax*4] mov tabwin,ebx invoke ShowWindow,EBX,SW_SHOWDEFAULT endnotify: pop ebx xor eax,eax ret .elseif eax==WM_CLOSE aclose2: invoke EndDialog,hWnd,NULL invoke DestroyWindow,hWnd .elseif eax==WM_COMMAND push edx mov eax,wParam mov edx,eax shr edx,16 .if ax==IDC_OK jmp aclose2 .endif pop edx .else mov eax,FALSE ret .endif mov eax,TRUE ret OptionsDlgProc endp adjusttitle proc ;add or remove titlebar ret mov eax,[windowstyle] test [flags],64 ;do we have a titlebar? jz dotitle3 sub eax,WS_CAPTION ;remove title dotitle3: invoke SetWindowLong,[mainhwnd],GWL_STYLE,eax;WS_POPUP+WS_VISIBLE+WS_SIZEBOX+WS_CAPTION+WS_SYSMENU invoke ShowWindow,[mainhwnd],SW_RESTORE call updatepos call showgraph ret adjusttitle endp TcpDlgProc PROC hWnd:HWND,iMsg:DWORD,wParam:WPARAM, lParam:LPARAM ;----------------TCP Window mov eax,iMsg .if eax==WM_INITDIALOG test [flags],1 jz gotontop2 invoke CheckDlgButton,[hWnd],IDC_CHECK1,MF_CHECKED gotontop2: test [flags],4 jz noonscreen2 invoke CheckDlgButton,[hWnd],IDC_CHECK3,BST_CHECKED noonscreen2: test [flags],8 ;show download jnz nodl2 invoke CheckDlgButton,[hWnd],IDC_CHECK4,BST_CHECKED nodl2: test [flags],16 ;show upload jnz noul2 invoke CheckDlgButton,[hWnd],IDC_CHECK5,BST_CHECKED noul2: test [flags],32 ;show count at window bottom jz noco2 invoke CheckDlgButton,[hWnd],IDC_CHECK6,BST_CHECKED noco2: test [flags],64 ;show title jz noco3 invoke CheckDlgButton,[hWnd],IDC_CHECK7,BST_CHECKED noco3: test [flags],128 ;minimise when idle jnz nomwi2 invoke CheckDlgButton,[hWnd],IDC_CHECK8,BST_CHECKED nomwi2: test [flags],256 ;convert to kb/s jz nomwi2a invoke CheckDlgButton,[hWnd],IDC_CHECK9,BST_CHECKED nomwi2a: invoke GetDesktopWindow invoke GetWindowRect, eax,addr deskrect test [flags],512 ;set the correct radio buttons jz notfree invoke CheckRadioButton,[hWnd],IDC_RADIO1,IDC_RADIO5,IDC_RADIO1 jmp endradio1 notfree: mov eax,IDC_RADIO5 test [flags],1024 jz notleft sub eax,2 notleft: test [flags],2048 jz nottop dec eax nottop: invoke CheckRadioButton,[hWnd],IDC_RADIO1,IDC_RADIO5,eax endradio1: ret .elseif eax==WM_CLOSE aclose2: invoke EndDialog,[tabhandle],NULL invoke DestroyWindow,[tabhandle] .elseif eax==WM_COMMAND mov eax,wParam .if ax==IDC_OK jmp aclose2 .elseif ax==IDC_CHECK1 ;always ontop call flipontop ret .elseif ax==IDC_CHECK3 ;always onscreen xor [flags],4 xor eax,eax ret .elseif ax==IDC_CHECK4 ;no download xor [flags],8 call showgraph xor eax,eax ret .elseif ax==IDC_CHECK5 ;no upload xor [flags],16 call showgraph xor eax,eax ret .elseif ax==IDC_CHECK6 ;no count shown at bottom of window xor [flags],32 call updatepos call showgraph xor eax,eax ret .elseif ax==IDC_CHECK7 ;no title xor [flags],64 ;call adjusttitle xor eax,eax ret .elseif ax==IDC_CHECK8 ; minimise when idle xor [flags],128 mov [lastfew],-1 xor eax,eax ret .elseif ax==IDC_CHECK9 ;bytes to kbs xor [flags],256 call showgraph xor eax,eax ret .elseif ax==IDC_RADIO1 ;free move or [flags],512 and [flags],-1-1024-2048 ;invoke SetWindowPos,mainhwnd,0,eax,edx,0,0,SWP_NOZORDER+SWP_SHOWWINDOW+SWP_NOSIZE xor eax,eax ret .elseif ax==IDC_RADIO2 ;top right and [flags],-1-512 or [flags],1024+2048 invoke SetWindowPos,mainhwnd,0,10,10,0,0,SWP_NOZORDER+SWP_SHOWWINDOW+SWP_NOSIZE xor eax,eax ret .elseif ax==IDC_RADIO3 ;top left and [flags],-1-512-2048 or [flags],1024 mov eax,[deskrect.right] mov edx,[winlength] sub eax,10 sub eax,edx invoke SetWindowPos,mainhwnd,0,eax,10,0,0,SWP_NOZORDER+SWP_SHOWWINDOW+SWP_NOSIZE xor eax,eax ret .elseif ax==IDC_RADIO4 ;bottom left and [flags],-1-512-1024 or [flags],2048 mov edx,[deskrect.bottom] sub edx,100 invoke SetWindowPos,mainhwnd,0,10,edx,0,0,SWP_NOZORDER+SWP_SHOWWINDOW+SWP_NOSIZE xor eax,eax ret .elseif ax==IDC_RADIO5 ;bottom, right and [flags],-1-512-1024-2048 ;no flags mov eax,[deskrect.right] mov edx,[winlength] sub eax,10 sub eax,edx mov edx,[deskrect.bottom] sub edx,100 invoke SetWindowPos,mainhwnd,0,eax,edx,0,0,SWP_NOZORDER+SWP_SHOWWINDOW+SWP_NOSIZE xor eax,eax ret .endif xor eax,eax ret .else mov eax,FALSE ret .endif mov eax,TRUE ret TcpDlgProc endp Tcp2DlgProc PROC hWnd:HWND,iMsg:DWORD,wParam:WPARAM, lParam:LPARAM ;----------------TCP Window mov eax,iMsg .if eax==WM_INITDIALOG ret .elseif eax==WM_CLOSE aclose2: invoke EndDialog,[tabhandle],NULL invoke DestroyWindow,[tabhandle] .elseif eax==WM_COMMAND mov eax,wParam .if ax==IDC_OK jmp aclose2 .endif xor eax,eax ret .else mov eax,FALSE ret .endif mov eax,TRUE ret Tcp2DlgProc endp commaprinteax proc ;add commas to large numbers cmp eax,1000 ;<1000 has no commas jb noneed call printeax ;print out eax to buff push esi push ecx push edx lea esi,buff ;how many digits in number xor eax,eax findnum6: inc esi inc eax cmp [esi],byte ptr 0 jne findnum6 cmp eax,3 jbe fininum6 xor edx,edx ;how many commas to add mov ecx,3 div ecx or edx,edx ;no remainder - dec number of commas jnz morenum3 or ecx,ecx ;unless ecx is already 0 jz morenum3 dec ecx morenum3: mov edi,esi add edi,eax mov [edi],byte ptr 0 ;put 0 at end dec esi dec edi gocom2: mov ecx,3 ;count in groups of 3 gocom1: mov dl,[esi] ;copy numbers mov [edi],dl dec esi dec edi dec ecx or ecx,ecx jnz gocom1 mov [edi],byte ptr "," ;add comma dec edi dec eax or eax,eax ;til all numbers are gone jnz gocom2 fininum6: pop edx pop ecx pop esi ret noneed: call printeax ret commaprinteax endp printtime proc ;properly format time xor eax,eax mov ax,[esi+10] push eax mov ax,[esi] ;starttime.wYear push eax mov ax,[esi+2] ;starttime.wMonth push eax mov ax,[esi+6] ;starttime.wDay push eax mov ax,[esi+8] ;starttime.wHour push eax push offset datenum push offset buff call wsprintfA add esp,24 pop eax lea esi,buff ;print out minutes correctly find0: inc esi cmp [esi],byte ptr ":" jne find0 inc esi push esi cmp ax,10 jae nosmallnumber inc esi nosmallnumber: push eax push offset num2 push esi call wsprintfA add esp,12 pop esi add esi,2 mov [esi],byte ptr " " ret printtime endp StatsDlgProc PROC hWnd:HWND,iMsg:DWORD,wParam:WPARAM, lParam:LPARAM ;----------------TCP Window LOCAL newtime:SYSTEMTIME mov eax,iMsg .if eax==WM_INITDIALOG mov eax,[ipdown] ;printout initial stuff. call commaprinteax invoke SendDlgItemMessage, [hWnd], IDC_EDIT2, WM_SETTEXT, 0,ADDR buff mov eax,[ipup] call commaprinteax invoke SendDlgItemMessage, [hWnd], IDC_EDIT1, WM_SETTEXT, 0,ADDR buff mov eax,[ipdown] sub eax,[ipdowninit] call commaprinteax invoke SendDlgItemMessage, [hWnd], IDC_EDIT4, WM_SETTEXT, 0,ADDR buff mov eax,[ipup] sub eax,[ipupinit] call commaprinteax invoke SendDlgItemMessage, [hWnd], IDC_EDIT3, WM_SETTEXT, 0,ADDR buff ;mov esi,[tcpmem] ;mov eax,[esi] ;call printeax ;invoke SendDlgItemMessage, [hWnd], IDC_EDIT5, WM_SETTEXT, 0,ADDR buff lea esi,starttime call printtime invoke SendDlgItemMessage, [hWnd], IDC_EDIT5, WM_SETTEXT, 0,ADDR buff invoke GetLocalTime,addr newtime lea esi,newtime call printtime invoke SendDlgItemMessage, [hWnd], IDC_EDIT5+1, WM_SETTEXT, 0,ADDR buff invoke GetTickCount sub eax,[starttick] mov ecx,1000 mov edx,0 div ecx push eax call printeax invoke SendDlgItemMessage, [hWnd], IDC_EDIT5+2, WM_SETTEXT, 0,ADDR buff mov eax,[ipdown] sub eax,[ipdowninit] pop ecx xor edx,edx div ecx call commaprinteax invoke SendDlgItemMessage, [hWnd], IDC_EDIT8, WM_SETTEXT, 0,ADDR buff mov eax,[ipup] sub eax,[ipupinit] pop ecx xor edx,edx div ecx call commaprinteax invoke SendDlgItemMessage, [hWnd], IDC_EDIT9, WM_SETTEXT, 0,ADDR buff ret .elseif eax==WM_CLOSE aclose2: invoke EndDialog,[tabhandle],NULL invoke DestroyWindow,[tabhandle] .elseif eax==WM_COMMAND mov eax,wParam .if ax==IDC_OK jmp aclose2 .elseif ax==IDC_CHECK1 call flipontop ret .endif xor eax,eax ret .else mov eax,FALSE ret .endif mov eax,TRUE ret StatsDlgProc endp AboutDlgProc PROC hWnd:HWND,iMsg:DWORD,wParam:WPARAM, lParam:LPARAM ;----------------About Window mov eax,iMsg .if eax==WM_INITDIALOG invoke GetDlgItem, [hWnd], IDC_URL invoke SetWindowLong, eax, GWL_WNDPROC, ADDR HyperLinkWndProc mov orgStatic,eax invoke LoadCursor,hInstance,IDI_CUR1 mov hFinger,eax ret .elseif eax==WM_CLOSE aclose2: invoke EndDialog,[tabhandle],NULL invoke DestroyWindow,[tabhandle] .elseif eax==WM_COMMAND mov eax,wParam .if ax==IDC_OK jmp aclose2 .endif xor eax,eax ret .else mov eax,FALSE ret .endif mov eax,TRUE ret AboutDlgProc endp hex4 proc ;used to print mac address for if mov [edi],byte ptr 0 and ecx,0fh or ecx,ecx jz nosize goagain: mov al,[esi] mov ah,al shr ah,4 cmp ah,10 jb isanum add ah,"A"-"0"-10 isanum: add ah,"0" mov [edi],byte ptr ah inc edi and al,0fh cmp al,10 jb isanum2 add al,"A"-"0"-10 isanum2: add al,"0" mov [edi],byte ptr al inc edi mov [edi],byte ptr "-" inc edi inc esi loop goagain dec edi mov [edi],byte ptr 0 nosize: ret hex4 endp updateif proc mov ecx,860 xor edx,edx mul ecx add eax,4 mov esi,[tcpmem] add esi,eax push esi add esi,512 mov edx,IDC_EDIT1 mov ecx,21 fillintcp: push ecx push edx mov eax,[esi] call printeax invoke SendDlgItemMessage, [ifhwnd], edx,WM_SETTEXT, 0,ADDR buff pop edx pop ecx add esi,4 inc edx loop fillintcp pop esi mov edi,offset buff mov ecx,[esi+528] add esi,532 call hex4 invoke SendDlgItemMessage, [ifhwnd], IDC_EDIT2,WM_SETTEXT, 0,ADDR buff ret updateif endp IntDlgProc PROC hWnd:HWND,iMsg:DWORD,wParam:WPARAM, lParam:LPARAM ;----------------Interface Window LOCAL reqsize:DWORD mov eax,iMsg .if eax==WM_INITDIALOG invoke GetDlgItem, [hWnd],IDC_COMBO1 mov [intcombobox], eax mov eax,[hWnd] mov [ifhwnd],eax mov [reqsize],20240 invoke GetIfTable,[tcpmem],addr reqsize,FALSE mov esi,[tcpmem] mov ecx,[esi] or ecx,ecx jz noscan add esi,4 countall: push esi push ecx add esi,604 invoke SendMessage, [intcombobox], CB_ADDSTRING, 0, esi pop ecx pop esi add esi,604+256 loop countall noscan: invoke SendMessage, [intcombobox], CB_SETCURSEL , 0, 0 xor eax,eax call updateif xor eax,eax ret .elseif eax==WM_CLOSE aclose2: invoke EndDialog,[tabhandle],NULL invoke DestroyWindow,[tabhandle] .elseif eax==WM_COMMAND mov eax,wParam .if ax==IDC_OK jmp aclose2 .endif mov eax,wParam shr eax,16 .if ax==CBN_SELCHANGE invoke SendMessage, [intcombobox], CB_GETCURSEL , 0, 0 call updateif xor eax,eax ret .endif xor eax,eax ret .else mov eax,FALSE ret .endif ;mov eax,TRUE ret IntDlgProc endp END start