+ All Categories
Home > Documents > Td Win32asm 710.Asm

Td Win32asm 710.Asm

Date post: 04-Mar-2016
Category:
Upload: z4rm4r
View: 10 times
Download: 0 times
Share this document with a friend
Description:
TestDepartment assembly programming low level
116
7/21/2019 Td Win32asm 710.Asm http://slidepdf.com/reader/full/td-win32asm-710asm 1/116 td_win32asm_710.asm ;============================================================================== ; Test Department's WINDOWS 32 BIT x86 ASSEMBLY example 710 ;============================================================================== ;============================================================================== ; ==> Part 710 : NetSpy utility v0.07 >>> USE IT ON YOUR OWN RISC <<< ;------------------------------------------------------------------------------ ; Hi folks, ; ; Major changes since NetSpy v0.05 : ; =================================== ; Program stays on top now : increases speed for my PI 233 MHz. ; Lookup function : improved. ; Phonebook / Dial function : entry deleted, fixed now, I'm very sorry ! ; PortScanner function : code cosmetic, improved, much better now. ; GetAdapterStatus : new powerfull function, replaces NICMAC function. ; Settings : the AutoLog function is not included now ... ; ; you must connected to the world wide web to get the program to full work. ; The Network must be installed, at least you need 1 success connection. ; If you have any Bug Reports, Tips, Sources, Doc's or Wishes please email me. ; ; Information: ; ------------- ; dw_Size parameter of the RASDIALPARAMS structure is 041Ch, not 0419h ! ; dw_Size parameter of the RASENTRYNAME structure is 0108h, not 0105h ! ; dw_Size parameter of the RASCONN structure is 019Ch, not 019Bh ! ; dw_Size parameter of the RASCONNSTATUS structure is 00A0h, not 009Eh ! ; ; You see this structures are doubleword aligned. ; ; ; spy vs. spy ... ; ; ; Test Department [email protected] ;============================================================================== ; Assembler directives ;------------------------------------------------------------------------------ .386 ; specifies the processor our program want run on .Model Flat ,StdCall ; Flat for Win9x (32 Bit), Calling Convention option casemap:none ; case sensitive ! ;============================================================================== ; Include all files where API functins resist you want use, set correct path ;------------------------------------------------------------------------------ include D:\Masm32\include\windows.inc includelib kernel32.lib includelib user32.lib includelib shell32.lib includelib gdi32.lib includelib comctl32.lib Page 1
Transcript
Page 1: Td Win32asm 710.Asm

7/21/2019 Td Win32asm 710.Asm

http://slidepdf.com/reader/full/td-win32asm-710asm 1/116

td_win32asm_710.asm;==============================================================================; Test Department's WINDOWS 32 BIT x86 ASSEMBLY example 710;==============================================================================

;==============================================================================; ==> Part 710 : NetSpy utility v0.07 >>> USE IT ON YOUR OWN RISC <<<;------------------------------------------------------------------------------

; Hi folks,;; Major changes since NetSpy v0.05 :; ===================================; Program stays on top now : increases speed for my PI 233 MHz.; Lookup function : improved.; Phonebook / Dial function : entry deleted, fixed now, I'm very sorry !; PortScanner function : code cosmetic, improved, much better now.; GetAdapterStatus : new powerfull function, replaces NICMAC function.; Settings : the AutoLog function is not included now ...

;; you must connected to the world wide web to get the program to full work.; The Network must be installed, at least you need 1 success connection.; If you have any Bug Reports, Tips, Sources, Doc's or Wishes please email me.;; Information:; -------------; dw_Size parameter of the RASDIALPARAMS structure is 041Ch, not 0419h !; dw_Size parameter of the RASENTRYNAME structure is 0108h, not 0105h !; dw_Size parameter of the RASCONN structure is 019Ch, not 019Bh !; dw_Size parameter of the RASCONNSTATUS structure is 00A0h, not 009Eh !

;; You see this structures are doubleword aligned.;;; spy vs. spy ...;;; Test Department [email protected]

;==============================================================================

; Assembler directives;------------------------------------------------------------------------------.386 ; specifies the processor our program want run on.Model Flat ,StdCall ; Flat for Win9x (32 Bit), Calling Conventionoption casemap:none ; case sensitive !

;==============================================================================; Include all files where API functins resist you want use, set correct path;------------------------------------------------------------------------------include D:\Masm32\include\windows.incincludelib kernel32.lib

includelib user32.libincludelib shell32.libincludelib gdi32.libincludelib comctl32.lib

Page 1

Page 2: Td Win32asm 710.Asm

7/21/2019 Td Win32asm 710.Asm

http://slidepdf.com/reader/full/td-win32asm-710asm 2/116

td_win32asm_710.asmincludelib comdlg32.libincludelib wsock32.libincludelib rasapi32.lib

;==============================================================================; Declaration of used API functions,take a look into WIN32.HLP and *.inc files;------------------------------------------------------------------------------

GetModuleHandleA PROTO :DWORDFindWindowA PROTO :DWORD,:DWORDLoadIconA PROTO :DWORD,:DWORDLoadCursorA PROTO :DWORD,:DWORDCreateSolidBrush PROTO :DWORDRegisterClassExA PROTO :DWORDCreateWindowExA PROTO :DWORD,:DWORD,:DWORD,:DWORD,:DWORD,:DWORD,:DWORD,  :DWORD,:DWORD,:DWORD,:DWORD,:DWORDShowWindow PROTO :DWORD,:DWORDUpdateWindow PROTO :DWORD

GetMessageA PROTO :DWORD,:DWORD,:DWORD,:DWORDPeekMessageA PROTO :DWORD,:DWORD,:DWORD,:DWORD,:DWORDTranslateMessage PROTO :DWORDDispatchMessageA PROTO :DWORDPostQuitMessage PROTO :DWORDDefWindowProcA PROTO :DWORD,:DWORD,:DWORD,:DWORDExitProcess PROTO :DWORDDestroyWindow PROTO :DWORDMessageBoxA PROTO :DWORD,:DWORD,:DWORD,:DWORDSendMessageA PROTO :DWORD,:DWORD,:DWORD,:DWORDPostMessageA PROTO :DWORD,:DWORD,:DWORD,:DWORD

InvalidateRect PROTO :DWORD,:DWORD,:DWORDLoadBitmapA PROTO :DWORD,:DWORDDeleteObject PROTO :DWORDSetWindowTextA PROTO :DWORD,:DWORDGetWindowTextA PROTO :DWORD,:DWORD,:DWORDSetFocus PROTO :DWORDEnableWindow PROTO :DWORD,:DWORDSetWindowLongA PROTO :DWORD,:DWORD,:DWORDRegisterHotKey PROTO :DWORD,:DWORD,:DWORD,:DWORDGetAsyncKeyState PROTO :DWORD

LoadStringA PROTO :DWORD,:DWORD,:DWORD,:DWORDGetStockObject PROTO :DWORDShell_NotifyIconA PROTO :DWORD,:DWORDSetForegroundWindow PROTO :DWORDMoveWindow PROTO :DWORD,:DWORD,:DWORD,:DWORD,:DWORD,:DWORD

lstrcpyA PROTO :DWORD,:DWORDSleep PROTO :DWORD

CreatePopupMenu PROTOAppendMenuA PROTO :DWORD,:DWORD,:DWORD,:DWORD

GetCursorPos PROTO :DWORDTrackPopupMenuEx PROTO :DWORD,:DWORD,:DWORD,:DWORD,:DWORD,:DWORD

ImageList_Create PROTO :DWORD,:DWORD,:DWORD,:DWORD,:DWORD

Page 2

Page 3: Td Win32asm 710.Asm

7/21/2019 Td Win32asm 710.Asm

http://slidepdf.com/reader/full/td-win32asm-710asm 3/116

td_win32asm_710.asmImageList_Add PROTO :DWORD,:DWORD,:DWORD

SetTimer PROTO :DWORD,:DWORD,:DWORD,:DWORDKillTimer PROTO :DWORD,:DWORD

RasEnumEntriesA PROTO :DWORD,:DWORD,:DWORD,:DWORD,:DWORDRasGetEntryDialParamsA PROTO :DWORD,:DWORD,:DWORD

RasEnumConnectionsA PROTO :DWORD,:DWORD,:DWORDRasGetConnectStatusA PROTO :DWORD,:DWORDRasDialA PROTO :DWORD,:DWORD,:DWORD,:DWORD,:DWORD,:DWORDRasHangUpA PROTO :DWORD

InitCommonControls PROTOCreateToolbarEx PROTO :DWORD,:DWORD,:DWORD,:DWORD,:DWORD,:DWORD,:DWORD,  :DWORD,:DWORD,:DWORD,:DWORD,:DWORD,:DWORD

GetLocalTime PROTO :DWORD

GetDateFormatA PROTO :DWORD,:DWORD,:DWORD,:DWORD,:DWORD,:DWORDGetTimeFormatA PROTO :DWORD,:DWORD,:DWORD,:DWORD,:DWORD,:DWORD

GlobalAlloc PROTO :DWORD,:DWORDGlobalLock PROTO :DWORDGlobalUnlock PROTO :DWORDGlobalFree PROTO :DWORD

OpenClipboard PROTO :DWORDEmptyClipboard PROTOSetClipboardData PROTO :DWORD,:DWORD

CloseClipboard PROTO

WSAStartup PROTO :DWORD,:DWORDWSACleanup PROTOsocket PROTO :DWORD,:DWORD,:DWORDclosesocket PROTO :DWORDconnect PROTO :DWORD,:DWORD,:DWORDWSAAsyncSelect PROTO :DWORD,:DWORD,:DWORD,:DWORDWSAGetLastError PROTOgethostname PROTO :DWORD,:DWORD

gethostbyname PROTO :DWORDgethostbyaddr PROTO :DWORD,:DWORD,:DWORDinet_addr PROTO :DWORDinet_ntoa PROTO :DWORDhtons PROTO :DWORD

LoadLibraryA PROTO :DWORDGetProcAddress PROTO :DWORD,:DWORDFreeLibrary PROTO :DWORD

GetOpenFileNameA PROTO :DWORD

GetSaveFileNameA PROTO :DWORDCreateFileA PROTO :DWORD,:DWORD,:DWORD,:DWORD,:DWORD,:DWORD,:DWORDSetFilePointer PROTO :DWORD,:DWORD,:DWORD,:DWORDReadFile PROTO :DWORD,:DWORD,:DWORD,:DWORD,:DWORD

Page 3

Page 4: Td Win32asm 710.Asm

7/21/2019 Td Win32asm 710.Asm

http://slidepdf.com/reader/full/td-win32asm-710asm 4/116

Page 5: Td Win32asm 710.Asm

7/21/2019 Td Win32asm 710.Asm

http://slidepdf.com/reader/full/td-win32asm-710asm 5/116

td_win32asm_710.asmPScanMenuItemAddItem db "Add entry",0PScanMenuItemDelSel db "Delete selected entry",0PScanMenuItemDelAll db "Delete all entries",0PScanMenuItemLoad db "Load Port List",0PScanMenuItemSave db "Save Port List",0PScanMenuItemCancel db "Cancel",0

t_LibaryName db "iphlpapi.dll",0t_GetAdaptersInfo db "GetAdaptersInfo",0

;==========> convert Hex to ASCII string and vice versatable_ASCII db 48,49,50,51,52,53,54,55,56,57,65,66,67,68,69,70table_HEX db 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15table_SHIFT db 28,24,20,16,12,8,4,0

;==========> Date and Time, used by various functionsH0_Date db "Local Date",0

H1_Time db "Local Time",0align 4;==========> StartupWsVersion dd 0101h ;minimum version requestedH0_Startup db "NetSpy Startup",0

;==========> AutoSaveAutoSave_FileName db "netspy.set",0FileMark_Settings db 21h,0BDh,68h,3Ch,0FBh,0B2h,06h,97h,0EAh,13h,73h,65h,74h,30h,30h,37hFile_Dummy db 0E0h dup (0)

align 4;==========> SettingsTimeOut dd 2000AutoLog dd 1AutoSave dd 1H0_Settings db "NetSpy Program Settings",0H1_Settings db "Parameter",0Bu_Settings db "Confirm Settings",0W0_Settings db "TimeOut in ms :",0

W1_Settings db "TimeOut",0W2_Settings db "AutoLog",0W3_Settings db "AutoSave",0TimeOutMin db "10",0Enabled db "enabled",0Disabled db "disabled",0

;==========> LookupH0_Lookup db "Lookup",0H1_Lookup db "Name / IP",0E0_Lookup db "Name / IP not found",0

Bu_Lookup db "Lookup",0W0_Lookup db "Name / IP :",0

align 4

Page 5

Page 6: Td Win32asm 710.Asm

7/21/2019 Td Win32asm 710.Asm

http://slidepdf.com/reader/full/td-win32asm-710asm 6/116

td_win32asm_710.asm;==========> PhonebookPhonebook_Entries dd 0hPhonebook_Password dd 0hH0_Phonebook db "Phonebook",0H1_Phonebook db "Phone Number",0H2_Phonebook db "User Name",0H3_Phonebook db "Password",0

E0_Phonebook db "Phonebook error",0Bu_Phonebook db "Phonebook",0

align 4;==========> RASDialRASDial_hThread dd 0h ;thread handleRASDial_ThreadID dd 0h ;thread identifierhrascon dd 0hflag_RASDialviaNumber dd 0hFlag_Dialing dd 0h

H0_RASDial db "RASDial",0H1_RASDial db "Phone Number",0H2_RASDial db "User Name",0H3_RASDial db "Password",0H4_RASDial db "Status",0E0_RASDial db "RASDial error",0Bu_RASDial db "RASDial",0W0_RASDial db "Phone Number :",0W1_RASDial db "User :",0W2_RASDial db "Password :",0M0_RASDial db "Dialing",0

M1_RASDial db "Connect",0M2_RASDial db "Failure",0DialviaNumber db "Dial via Phone Number",0

;==========> LocalHostH0_LocalHost db "LocalHost",0H1_LocalHost db "IP",0Bu_LocalHost db "Local Host",0

align 4

;==========> ActiveRASActiveRAS_Connections dd 0hH0_ActiveRAS db "Active Modem RAS Connection",0E0_ActiveRAS db "No active modem connection",0Bu_ActiveRAS db "Active RAS",0

align 4;==========> PortScannerPortScan_hThread dd 0h ;thread handlePortScan_ThreadID dd 0h ;thread identifierFlag_PortScanAdd dd 0

Flag_PortScanTimeOut dd 1Flag_PortScanList dd 1Flag_PortScanDir dd 1Flag_PortScanThread dd 0

Page 6

Page 7: Td Win32asm 710.Asm

7/21/2019 Td Win32asm 710.Asm

http://slidepdf.com/reader/full/td-win32asm-710asm 7/116

td_win32asm_710.asmVar_PortListItems dd 6Var_PortListCurrentItem dd 0Var_PortScanCurrentPort dd 0Var_PortScanCounter dd 0Var_PortScanStart dd 1Var_PortScanEnd dd 200Buf_PortScanList dd 100h dup (0h)

X2_PortScan db "a.b.c.d",0X4_PortScan db "1",0X6_PortScan db "200",0H0_PortScan db "Port Scanner",0H1_PortScan db "Port",0H2_PortScan db "Status",0H5_PortScan db "Port List",0E0_PortScan db "Undefined error",0Bu_PortScan db "Scan Ports",0W1_PortScan db "Name / IP :",0W2_PortScan db 104h dup (0)W3_PortScan db "Start Port :",0W4_PortScan db 6 dup (0)W5_PortScan db "End Port :",0W6_PortScan db 6 dup (0)W7_PortScan db "Scan via Port List",0W8_PortPositiveList db "List TimeOuts",0M1_PortScan db "Connectable",0M2_PortScan db "Function arborted",0EmptyPortScan db 0,0FileMark_PortList db 21h,0BDh,68h,3Ch,0FBh,0B2h,06h,97h,0EAh,13h,70h,72h,74h,30h,30h,37h

PortFileFilter db "Port List Files (*.prt)",0,"*.prt",0,0 ;file filterPortFileDefExt db "prt",0 ;default extension for portlist filePortFileName db 104h dup(0),0 ;buffer for filenamePortFileLoadT db "Load Port List",0 ;titel fileboxPortFileSaveT db "Save Port List",0 ;titel filebox

;==========> Get Adapters InfoM0_GAI db "OTHER",0M1_GAI db "ETHERNET",0M2_GAI db "TOKEN_RING",0

M3_GAI db "FDDI",0M4_GAI db "PPP",0M5_GAI db "LOOPBACK",0M6_GAI db "SLIP",0M9_GAI db "UNKNOWN",0

H0_GAI db "Description",0H1_GAI db "MAC address",0;H2_GAI db "Adapter Type",0H3_GAI db "Current IP address",0H4_GAI db "Subnet Mask",0

H5_GAI db "Standard Gateway",0H6_GAI db "DHCP Server",0Bu_GAI db "Get Adapters Info",0E0_GAI db "Network Interface Card not found",0

Page 7

Page 8: Td Win32asm 710.Asm

7/21/2019 Td Win32asm 710.Asm

http://slidepdf.com/reader/full/td-win32asm-710asm 8/116

Page 9: Td Win32asm 710.Asm

7/21/2019 Td Win32asm 710.Asm

http://slidepdf.com/reader/full/td-win32asm-710asm 9/116

td_win32asm_710.asmFileReturn dd 0hSaveFileN db "netspy.log",0

TimerBufferSize dd 10000h ;this parameters are changed afterBufferSize dd 10000h ;API call, set it to 10000h againUtilityNr dd 0FFh ;current utility selected, 0FFh=noFlag_Logo dd 0h ;logo flag

Flag_Escape dd 0h ;escape key flag

align 4; - RECT structure - ( API=InvalidateRect ) -rect_left dd 04h ;repaint listview area onlyrect_top dd 03Ahrect_right dd 0266hrect_bottom dd 1B8h

align 4; - RASDIALPARAMS structure - dial via phonebook entryrasdial_dwSize dd 41Ch ;strucsize = strucsize+3rasdial_szEntryName db 101h dup (0) ;RAS_MaxEntryName+1rasdial_szPhoneNumber db 81h dup (0) ;RAS_MaxPhoneNumber+1rasdial_szCallbackNumber db 81h dup (0);RAS_MaxCallbackNumber+1rasdial_szUserName db 101h dup (0) ;UNLEN+1rasdial_szPassword db 101h dup (0) ;PWLEN+1rasdial_szDomain db 10h dup (0) ;DNLEN+1  db 03h dup (0) ;DUMMY because strucsize

align 4

; - RASDIALPARAMS structure - dial via phone numberrasdial_dwSizeNr dd 41Ch ;strucsize = strucsize+3rasdial_szEntryNameNr db 101h dup (0) ;RAS_MaxEntryName+1rasdial_szPhoneNumberNr db 81h dup (0) ;RAS_MaxPhoneNumber+1rasdial_szCallbackNumberNr db 81h dup (0);RAS_MaxCallbackNumber+1rasdial_szUserNameNr db 101h dup (0) ;UNLEN+1rasdial_szPasswordNr db 101h dup (0) ;PWLEN+1rasdial_szDomainNr db 10h dup (0) ;DNLEN+1  db 03h dup (0) ;DUMMY because strucsize

align 4; - RASENTRYNAME structure -rasentry_dwSize dd 108h ;strucsize = strucsize+3rasentry_szEntryName db 101h dup (0) ;RAS_MaxEntryName+1  db 03h dup (0) ;DUMMY because strucsize

align 4; - RASCONN structure -rasconn_dwSize dd 19Ch ;strucsize = strucsize+1rasconn_hrascon dd 0h ;handle, remote access connectionrasconn_szEntryName db 101h dup (0) ;RAS_MaxEntryName+1

rasconn_szDeviceType db 11h dup (0) ;RAS_MaxDeviceType+1;if WINVER>=0x400rasconn_szDeviceName db 81h dup (0) ;RAS_MaxDeviceName+1;if WINVER>=0x400db 01h dup (0) ;DUMMY because strucsize

Page 9

Page 10: Td Win32asm 710.Asm

7/21/2019 Td Win32asm 710.Asm

http://slidepdf.com/reader/full/td-win32asm-710asm 10/116

Page 11: Td Win32asm 710.Asm

7/21/2019 Td Win32asm 710.Asm

http://slidepdf.com/reader/full/td-win32asm-710asm 11/116

td_win32asm_710.asmiBitmap_s03 dd 0h,0h  db 4h,1h,0h,0h  dd 0h,0hiBitmap_s04 dd 0h,0h  db 4h,1h,0h,0h  dd 0h,0hiBitmap_s05 dd 0h,0h

  db 4h,1h,0h,0h  dd 0h,0hiBitmap_s06 dd 0h,0h  db 4h,1h,0h,0h  dd 0h,0hiBitmap_s07 dd 0h,0h  db 4h,1h,0h,0h  dd 0h,0hiBitmap_s08 dd 0h,0h  db 4h,1h,0h,0h  dd 0h,0hiBitmap_s09 dd 0h,0h  db 4h,1h,0h,0h  dd 0h,0hiBitmap_s10 dd 0h,0h  db 4h,1h,0h,0h  dd 0h,0hiBitmap_s11 dd 0h,0h  db 4h,1h,0h,0h  dd 0h,0hiBitmap_s12 dd 0h,0h

  db 4h,1h,0h,0h  dd 0h,0hiBitmap_s13 dd 0h,0h  db 4h,1h,0h,0h  dd 0h,0hiBitmap_s14 dd 0h,0h  db 4h,1h,0h,0h  dd 0h,0hiBitmap_900 dd 0h,900h  db 4h,0h,0h,0h  dd 0h,0hiBitmap_901 dd 1h,901h  db 4h,0h,0h,0h  dd 0h,0hiBitmap_902 dd 2h,902h  db 4h,0h,0h,0h  dd 0h,0hiBitmap_903 dd 3h,903h  db 4h,0h,0h,0h  dd 0h,0hiBitmap_904 dd 4h,904h

  db 4h,0h,0h,0h  dd 0h,0hiBitmap_905 dd 5h,905h  db 4h,0h,0h,0h

Page 11

Page 12: Td Win32asm 710.Asm

7/21/2019 Td Win32asm 710.Asm

http://slidepdf.com/reader/full/td-win32asm-710asm 12/116

td_win32asm_710.asm  dd 0h,0hiBitmap_906 dd 6h,906h  db 4h,0h,0h,0h  dd 0h,0hiBitmap_907 dd 7h,907h  db 4h,0h,0h,0h  dd 0h,0h

iBitmap_908 dd 8h,908h  db 4h,0h,0h,0h  dd 0h,0hiBitmap_909 dd 9h,909h  db 4h,0h,0h,0h  dd 0h,0hiBitmap_90A dd 0Ah,90Ah  db 4h,0h,0h,0h  dd 0h,0hiBitmap_90B dd 0Bh,90Bh  db 4h,0h,0h,0h  dd 0h,0hiBitmap_90C dd 0Ch,90Ch  db 4h,0h,0h,0h  dd 0h,0hiBitmap_90D dd 0Dh,90Dh  db 24h,0h,0h,0h  dd 0h,0hiBitmap_s20 dd 0h,0h  db 4h,1h,0h,0h  dd 0h,0h

iBitmap_s21 dd 0h,0h  db 4h,1h,0h,0h  dd 0h,0hiBitmap_s22 dd 0h,0h  db 4h,1h,0h,0h  dd 0h,0hiBitmap_s23 dd 0h,0h  db 4h,1h,0h,0h  dd 0h,0hiBitmap_s24 dd 0h,0h  db 4h,1h,0h,0h  dd 0h,0hiBitmap_s25 dd 0h,0h  db 4h,1h,0h,0h  dd 0h,0hiBitmap_s26 dd 0h,0h  db 4h,1h,0h,0h  dd 0h,0hiBitmap_s27 dd 0h,0h  db 4h,1h,0h,0h  dd 0h,0h

iBitmap_s28 dd 0h,0h  db 4h,1h,0h,0h  dd 0h,0hiBitmap_s29 dd 0h,0h

Page 12

Page 13: Td Win32asm 710.Asm

7/21/2019 Td Win32asm 710.Asm

http://slidepdf.com/reader/full/td-win32asm-710asm 13/116

td_win32asm_710.asm  db 4h,1h,0h,0h  dd 0h,0hiBitmap_s30 dd 0h,0h  db 4h,1h,0h,0h  dd 0h,0hiBitmap_s31 dd 0h,0h  db 4h,1h,0h,0h

  dd 0h,0hiBitmap_s32 dd 0h,0h  db 4h,1h,0h,0h  dd 0h,0hiBitmap_s33 dd 0h,0h  db 4h,1h,0h,0h  dd 0h,0hiBitmap_s34 dd 0h,0h  db 4h,1h,0h,0h  dd 0h,0hiBitmap_90E dd 0Eh,90Eh  db 4h,0h,0h,0h  dd 0h,0hiBitmap_90F dd 0Fh,90Fh  db 4h,0h,0h,0h  dd 0h,0hiBitmap_910 dd 10h,910h  db 4h,0h,0h,0h  dd 0h,0hiBitmap_911 dd 11h,911h  db 4h,0h,0h,0h

  dd 0h,0hiBitmap_912 dd 12h,912h  db 4h,0h,0h,0h  dd 0h,0hiBitmap_913 dd 13h,913h  db 4h,0h,0h,0h  dd 0h,0hiBitmap_914 dd 14h,914h  db 4h,0h,0h,0h  dd 0h,0hiBitmap_915 dd 15h,915h  db 4h,0h,0h,0h  dd 0h,0hiBitmap_916 dd 16h,916h  db 4h,0h,0h,0h  dd 0h,0hiBitmap_917 dd 17h,917h  db 4h,0h,0h,0h  dd 0h,0hiBitmap_918 dd 18h,918h  db 4h,0h,0h,0h

  dd 0h,0hiBitmap_919 dd 19h,919h  db 4h,0h,0h,0h  dd 0h,0h

Page 13

Page 14: Td Win32asm 710.Asm

7/21/2019 Td Win32asm 710.Asm

http://slidepdf.com/reader/full/td-win32asm-710asm 14/116

Page 15: Td Win32asm 710.Asm

7/21/2019 Td Win32asm 710.Asm

http://slidepdf.com/reader/full/td-win32asm-710asm 15/116

Page 16: Td Win32asm 710.Asm

7/21/2019 Td Win32asm 710.Asm

http://slidepdf.com/reader/full/td-win32asm-710asm 16/116

td_win32asm_710.asmnid_uCallbackMessage dd ? ;identifier for notification messagesnid_hIcon dd ? ;handle icon to add, modify or deletenid_szTip db 64 dup(?) ;tooltip text displays for taskbar icon

align 4; - _LV_COLUMN structure -LVC_mask dd ? ;look into Win32.hlp

LVC_fmt dd ?LVC_cx dd ?LVC_pszText dd ?LVC_cchTextMax dd ?LVC_iSubItem dd ?

align 4; - _LV_ITEM structure -LVI_mask dd ? ;look into Win32.hlpLVI_iItem dd ?LVI_iSubItem dd ?LVI_state dd ?LVI_stateMask dd ?LVI_pszText dd ?LVI_cchTextMax dd ?LVI_iImage dd ?LVI_lParam dd ?

align 4; - _SYSTEMTIME sructure -wYear dw ? ;look into Win32.hlp

wMonth dw ?wDayOfWeek dw ?wDay dw ?wHour dw ?wMinute dw ?wSecond dw ?wMilliseconds dw ?

align 4; - WSADATA structure -wsa_wVersion dw ? ;look into Win32.hlpwsa_wHighVersion dw ?wsa_szDescription db 101h dup (?)wsa_szSystemStatus db 81h dup (?)wsa_iMaxSockets dw ?wsa_iMaxUdpDg dw ?wsa_lpVendorInfo dd ?

;==============================================================================; .CODE = our code area starts here Main = label of our program code;------------------------------------------------------------------------------

.CodeMain:

;==============================================================================

Page 16

Page 17: Td Win32asm 710.Asm

7/21/2019 Td Win32asm 710.Asm

http://slidepdf.com/reader/full/td-win32asm-710asm 17/116

Page 18: Td Win32asm 710.Asm

7/21/2019 Td Win32asm 710.Asm

http://slidepdf.com/reader/full/td-win32asm-710asm 18/116

Page 19: Td Win32asm 710.Asm

7/21/2019 Td Win32asm 710.Asm

http://slidepdf.com/reader/full/td-win32asm-710asm 19/116

Page 20: Td Win32asm 710.Asm

7/21/2019 Td Win32asm 710.Asm

http://slidepdf.com/reader/full/td-win32asm-710asm 20/116

Page 21: Td Win32asm 710.Asm

7/21/2019 Td Win32asm 710.Asm

http://slidepdf.com/reader/full/td-win32asm-710asm 21/116

Page 22: Td Win32asm 710.Asm

7/21/2019 Td Win32asm 710.Asm

http://slidepdf.com/reader/full/td-win32asm-710asm 22/116

Page 23: Td Win32asm 710.Asm

7/21/2019 Td Win32asm 710.Asm

http://slidepdf.com/reader/full/td-win32asm-710asm 23/116

Page 24: Td Win32asm 710.Asm

7/21/2019 Td Win32asm 710.Asm

http://slidepdf.com/reader/full/td-win32asm-710asm 24/116

Page 25: Td Win32asm 710.Asm

7/21/2019 Td Win32asm 710.Asm

http://slidepdf.com/reader/full/td-win32asm-710asm 25/116

td_win32asm_710.asmmov cl [ebx+32] ;get pszText member of LP DISPINFO struc

Page 26: Td Win32asm 710.Asm

7/21/2019 Td Win32asm 710.Asm

http://slidepdf.com/reader/full/td-win32asm-710asm 26/116

mov cl,[ebx+32] ;get pszText member of LP_DISPINFO struc.cmp cl,0h ;is it 0 ?je PortList_LVN_ENDLABELEDIT_0 ;return FALSE if editing is canceledmov eax,[ebx+32] ;check correct user inputmov cl,[eax]cmp cl,20hje PortList_LVN_ENDLABELEDIT_0cmp cl,31hjb PortList_LVN_ENDLABELEDIT_0cmp cl,39hja PortList_LVN_ENDLABELEDIT_0inc eaxmov edx,0hPortList_LVN_ENDLABELEDIT_Loop:mov cl,[eax]cmp cl,0hje PortList_LVN_ENDLABELEDIT_Savecmp cl,30h

jb PortList_LVN_ENDLABELEDIT_0cmp cl,39hja PortList_LVN_ENDLABELEDIT_0inc eaxinc edxcmp edx,5hjne PortList_LVN_ENDLABELEDIT_LoopPortList_LVN_ENDLABELEDIT_Save:inc edxmov counter1,edx ;length of text

mov esi,[ebx+32] ;check correct value, >0, <65536mov eax,edxpush ebxcall My_StringDecNrtoHexDDpop ebxcmp edi,0hje PortList_LVN_ENDLABELEDIT_0cmp edi,65535ja PortList_LVN_ENDLABELEDIT_0mov Flag_PortScanAdd,0h ;value is correct;------------------------------------------------------------------------------

; API "SendMessageA" sends a message to the window;------------------------------------------------------------------------------push 1h ;lParam, LVNI_FOCUSED=1h, LVNI_SELECTED=2hpush -1 ;wParam,index item begin search or -1 firstpush 100Ch ;uMsg, LVM_FIRST=1000h | LVM_GETNEXTITEM=12push temp ;hwnd, handle of destination windowcall SendMessageA ;- API Function -push eax ;save EAX for future usemov edx,4hmul edx

mov counter,eax ;item index in EAXmov eax,counter1mov esi,[ebx+32] ;get pointer to the currently edited textcall My_StringDecNrtoHexDD ;- SubRoutine -

Page 26

Page 27: Td Win32asm 710.Asm

7/21/2019 Td Win32asm 710.Asm

http://slidepdf.com/reader/full/td-win32asm-710asm 27/116

td_win32asm_710.asmWP1_uMsg_111h:

Page 28: Td Win32asm 710.Asm

7/21/2019 Td Win32asm 710.Asm

http://slidepdf.com/reader/full/td-win32asm-710asm 28/116

_ g_cmp eax,111h ;check if WM_COMMAND message recievedjne WP1_uMsg_112h ;if not goto labelmov eax,WP1_wParam ;extra info about the message in ax

WP1_wParam_04F0h:cmp ax,04F0h ;is it tray popup menu item 04F0h = Restorejne WP1_wParam_04F1h ;if not 01h goto LABELcall My_TrayToScreen ;-SubRoutine -jmp WP1_return ;

WP1_wParam_04F1h:cmp ax,04F1h ;is it tray popup menu item 04F1h = Exitjne WP1_uMsg_111h_900h ;;------------------------------------------------------------------------------; API "Shell_NotifyIconA" here deletes the icon from the taskbar;------------------------------------------------------------------------------push OFFSET nid_cbSize ;pnid, pointer NOTIFYICONDATA structure

push 2h ;dwMessage, ID msg. send, 2h=NIM_DELETEcall Shell_NotifyIconA ;- API Function -;------------------------------------------------------------------------------; API "DestroyWindow" destroys the main program;------------------------------------------------------------------------------push WP1_hWnd ;hMenu, handle of main windowcall DestroyWindow ;- API Function -jmp WP1_return ;

;------------------------------------------------------------------------------; Check if toolbar button clicked (values 900h - 91Bh);------------------------------------------------------------------------------WP1_uMsg_111h_900h:cmp ax,900h ;LOOKUPjne WP1_uMsg_111h_901hcmp UtilityNr,00h ;still active ?je WP1_returncall My_Init_Lookup ;- SubRoutine -mov UtilityNr,00hjmp WP1_return

WP1_uMsg_111h_901h:cmp ax,901h ;ACTIVE RASjne WP1_uMsg_111h_902hcmp UtilityNr,01h ;still active ?je WP1_returncall My_Init_ActiveRAS ;- SubRoutine -mov UtilityNr,01hjmp WP1_return

WP1_uMsg_111h_902h:cmp ax,902h ;LOCALHOSTNAMEjne WP1_uMsg_111h_903hcmp UtilityNr,02h ;still active ?je WP1_return

Page 28

td_win32asm_710.asmcall My_Init_Local ;- SubRoutine -

Page 29: Td Win32asm 710.Asm

7/21/2019 Td Win32asm 710.Asm

http://slidepdf.com/reader/full/td-win32asm-710asm 29/116

ymov UtilityNr,02hjmp WP1_return

WP1_uMsg_111h_903h:cmp ax,903h ;PHONEBOOKjne WP1_uMsg_111h_904hcmp UtilityNr,03h ;still active ?je WP1_returncall My_Init_Phonebook ;- SubRoutine -mov UtilityNr,03hjmp WP1_return

WP1_uMsg_111h_904h:cmp ax,904h ;RASDIALjne WP1_uMsg_111h_905hcmp UtilityNr,04h ;still active ?je WP1_return

call My_Init_RASDial ;- SubRoutine -mov UtilityNr,04hjmp WP1_return

WP1_uMsg_111h_905h:cmp ax,905h ;PORTSCANjne WP1_uMsg_111h_918hcmp UtilityNr,05h ;still active ?je WP1_returncall My_Init_PortScan ;- SubRoutine -mov UtilityNr,05hjmp WP1_return

WP1_uMsg_111h_918h:cmp ax,918h ;GETADAPTERSINFOjne WP1_uMsg_111h_919hcmp UtilityNr,18h ;still active ?je WP1_returncall My_Init_GAI ;- SubRoutine -mov UtilityNr,18hjmp WP1_return

WP1_uMsg_111h_919h:cmp ax,919h ;Helpjne WP1_uMsg_111h_91Ahcmp UtilityNr,19h ;still active ?je WP1_returncall My_Init_Help ;- SubRoutine -mov UtilityNr,19hjmp WP1_return

WP1_uMsg_111h_91Ah:cmp ax,91Ah ;Settingsjne WP1_uMsg_111h_91Bhcmp UtilityNr,1Ah ;still active ?

Page 29

Page 30: Td Win32asm 710.Asm

7/21/2019 Td Win32asm 710.Asm

http://slidepdf.com/reader/full/td-win32asm-710asm 30/116

Page 31: Td Win32asm 710.Asm

7/21/2019 Td Win32asm 710.Asm

http://slidepdf.com/reader/full/td-win32asm-710asm 31/116

Page 32: Td Win32asm 710.Asm

7/21/2019 Td Win32asm 710.Asm

http://slidepdf.com/reader/full/td-win32asm-710asm 32/116

Page 33: Td Win32asm 710.Asm

7/21/2019 Td Win32asm 710.Asm

http://slidepdf.com/reader/full/td-win32asm-710asm 33/116

td_win32asm_710.asmcmp eax,0hjne WP1 uMsg 111h 2011h Save

Page 34: Td Win32asm 710.Asm

7/21/2019 Td Win32asm 710.Asm

http://slidepdf.com/reader/full/td-win32asm-710asm 34/116

jne WP1_uMsg_111h_2011h_Savemov Var_PortListItems,0hjmp WP1_returnWP1_uMsg_111h_2011h_Save:mov LVI_iSubItem,0hmov LVI_pszText,OFFSET Buffermov LVI_cchTextMax,6h;------------------------------------------------------------------------------; API "SendMessageA" sends a message to the window;------------------------------------------------------------------------------push OFFSET LVI_mask ;lParam, pcol, pointer LV_ITEM structurepush counter1 ;wParam, Index of the list view itempush 102Dh ;uMsg, LVM_FIRST=1000h | LVM_GETITEMTEXT=45push temp ;hwnd, handle of destination windowcall SendMessageA ;- API Function -mov esi,OFFSET Buffer ;get pointer to the currently edited textcall My_StringDecNrtoHexDD ;- SubRoutine -

mov eax,counter1mov edx,4hmul edxmov edx,OFFSET Buf_PortScanListadd edx,eaxmov [edx],ediinc counter1mov eax,counter1cmp eax,counterjbe WP1_uMsg_111h_2011h_Savedec Var_PortListItemsjmp WP1_returnWP1_uMsg_111h_2012h:cmp ax,2012h ;check if delete all entries choosenjne WP1_uMsg_111h_2013h ;if not skipcall My_SetFocus_ListView ;- SubRoutine -;------------------------------------------------------------------------------; API "SendMessageA" sends a message to the window;------------------------------------------------------------------------------push 0h ;lParam, set to 0push 0h ;wParam, set to 0

push 1009h ;uMsg,LVM_FIRST=1000h|LVM_DELETEALLITEMS=9push temp ;hwnd, handle of destination windowcall SendMessageA ;- API Function -mov Var_PortListItems,0hjmp WP1_return

WP1_uMsg_111h_2013h:cmp ax,2013h ;check if delete all entries choosenjne WP1_uMsg_111h_2014h ;if not skipmov lStructSize,4Ch ;length in bytes of structuremov eax,WP1_hWndmov hwndOwner,eax ;id window that owns dialog boxmov eax,hInstancemov hInstance1,eax ;handle, our program id

Page 34

Page 35: Td Win32asm 710.Asm

7/21/2019 Td Win32asm 710.Asm

http://slidepdf.com/reader/full/td-win32asm-710asm 35/116

td_win32asm_710.asm; API "MessageBoxA" creates a message box if choosen file is not a NetSpy file;------------------------------------------------------------------------------

h h h

Page 36: Td Win32asm 710.Asm

7/21/2019 Td Win32asm 710.Asm

http://slidepdf.com/reader/full/td-win32asm-710asm 36/116

push 30h ;uType, 0=MB_OK, 30h=MB_ICONEXCLAMATIONpush OFFSET MB2_Title ;lpCaption,pointer to title textpush OFFSET MB2_Text ;lpText,pointer to text message boxpush WP1_hWnd ;handle of owner windowcall MessageBoxA ;- API Function -jmp WP1_uMsg_111h_2013h_Return

My_PortList_CheckMark_OK:inc esiinc ediinc ecxcmp ecx,10hjne My_PortList_CheckMark;------------------------------------------------------------------------------; API "ReadFile" reads data from a file;------------------------------------------------------------------------------push 0h ;lpOverlapped, structure overlapped I/O

push OFFSET FileReturn ;lpNumberOfBytesWritten,push 4h ;nNumberOfBytesToWrite, bytes to writepush OFFSET Var_PortListItems ;lpBuffer, address data write to filepush FileHandle ;hFile, handle of file to write tocall ReadFile ;- API Function -push 0hpush OFFSET FileReturnpush 0Chpush OFFSET File_Dummypush FileHandlecall ReadFile ;- API Function -

push 0hpush OFFSET FileReturnpush 400hpush OFFSET Buf_PortScanListpush FileHandlecall ReadFile ;- API Function -mov ecx,Var_PortListItemscmp ecx,0hje WP1_uMsg_111h_2013h_Returnmov eax,hWnd_LV_PortList

mov temp,eaxcall My_LVM_DELETEALLITEMS ;- SubRoutine -mov ecx,Var_PortListItemsmov counter,ecx ;fill portlistmov ebx,OFFSET Buf_PortScanListPortScan_FillList:mov esi,[ebx]push ebxcall My_HexDDtoStringDecmov ebx,OFFSET Buffercall My_LVM_INSERTITEM ;- SubRoutine -pop ebxadd ebx,4hdec counter

Page 36

Page 37: Td Win32asm 710.Asm

7/21/2019 Td Win32asm 710.Asm

http://slidepdf.com/reader/full/td-win32asm-710asm 37/116

td_win32asm_710.asm; API "WriteFile" writes data to a file;------------------------------------------------------------------------------push 0h ;lpOverlapped structure overlapped I/O

Page 38: Td Win32asm 710.Asm

7/21/2019 Td Win32asm 710.Asm

http://slidepdf.com/reader/full/td-win32asm-710asm 38/116

push 0h ;lpOverlapped, structure overlapped I/Opush OFFSET FileReturn ;lpNumberOfBytesWritten,push 10h ;nNumberOfBytesToWrite, bytes to writepush OFFSET FileMark_PortList ;lpBuffer, address data write to filepush FileHandle ;hFile, handle of file to write tocall WriteFile ;- API Function -

push 0hpush OFFSET FileReturnpush 4hpush OFFSET Var_PortListItemspush FileHandlecall WriteFilepush 0hpush OFFSET FileReturnpush 0Chpush OFFSET File_Dummy

push FileHandlecall WriteFile ;- API Function -push 0hpush OFFSET FileReturnpush 400hpush OFFSET Buf_PortScanListpush FileHandlecall WriteFile ;- API Function -WP1_uMsg_111h_2014h_Return:;------------------------------------------------------------------------------; API "CloseHandle" closes an open object handle.

;------------------------------------------------------------------------------push FileHandle ;hObject, handle of object to closecall CloseHandle ;- API Function -jmp WP1_return

;------------------------------------------------------------------------------; Check if action button clicked (value 3000h);------------------------------------------------------------------------------WP1_uMsg_111h_3000h:cmp ax,3000h ;ACTION button clicked ?

jne WP1_returncmp UtilityNr,00h ;is choosen utility LOOKUP ?jne Start_UtilityNr01call My_Run_Lookup ;- SubRoutine -jmp WP1_return

Start_UtilityNr01: ;is choosen utility ACTIVE RAS ?cmp UtilityNr,01hjne Start_UtilityNr02call My_Run_ActiveRAS ;- SubRoutine -jmp WP1_return

Start_UtilityNr02: ;is choosen utility LOCALHOST ?cmp UtilityNr,02h

Page 38

td_win32asm_710.asmjne Start_UtilityNr03call My_Run_Local ;- SubRoutine -jmp WP1 return

Page 39: Td Win32asm 710.Asm

7/21/2019 Td Win32asm 710.Asm

http://slidepdf.com/reader/full/td-win32asm-710asm 39/116

jmp WP1_return

Start_UtilityNr03: ;is choosen utility PHONEBOOK ?cmp UtilityNr,03hjne Start_UtilityNr04call My_Run_Phonebook ;- SubRoutine -

jmp WP1_return

Start_UtilityNr04: ;is choosen utility RASDIAL ?cmp UtilityNr,04hjne Start_UtilityNr05call My_Run_RASDial ;- SubRoutine -jmp WP1_return

Start_UtilityNr05: ;is choosen utility PORTSCAN ?cmp UtilityNr,05h

jne Start_UtilityNr18call My_Run_PortScan ;- SubRoutine -jmp WP1_return

Start_UtilityNr18: ;is choosen utility GETADAPTERSINFO ?cmp UtilityNr,18hjne Start_UtilityNr19call My_Run_GAI ;- SubRoutine -jmp WP1_return

Start_UtilityNr19: ;is choosen utility HELP ?

cmp UtilityNr,19hjne Start_UtilityNr1Acall My_Run_Help ;- SubRoutine -jmp WP1_return

Start_UtilityNr1A: ;is choosen utility SETTINGS ?cmp UtilityNr,1Ahjne Start_UtilityNr1Bcall My_Run_Settings ;- SubRoutine -jmp WP1_return

Start_UtilityNr1B: ;is choosen utility 'xyz' ?jmp WP1_return

;==============================================================================; WM_SYSCOMMAND (value=112h) message recieved ?;------------------------------------------------------------------------------WP1_uMsg_112h:cmp eax,112h ;check if WM_COMMAND message recievedjne WP1_uMsg_113h ;if not goto labelmov eax,WP1_wParam ;extra info about the message

cmp eax,0F060h ;SC_CLOSE=0F060h received ?jne WP1_return ;call My_CleanSystem ;- SubRoutine -

Page 39

Page 40: Td Win32asm 710.Asm

7/21/2019 Td Win32asm 710.Asm

http://slidepdf.com/reader/full/td-win32asm-710asm 40/116

Page 41: Td Win32asm 710.Asm

7/21/2019 Td Win32asm 710.Asm

http://slidepdf.com/reader/full/td-win32asm-710asm 41/116

Page 42: Td Win32asm 710.Asm

7/21/2019 Td Win32asm 710.Asm

http://slidepdf.com/reader/full/td-win32asm-710asm 42/116

Page 43: Td Win32asm 710.Asm

7/21/2019 Td Win32asm 710.Asm

http://slidepdf.com/reader/full/td-win32asm-710asm 43/116

Page 44: Td Win32asm 710.Asm

7/21/2019 Td Win32asm 710.Asm

http://slidepdf.com/reader/full/td-win32asm-710asm 44/116

Page 45: Td Win32asm 710.Asm

7/21/2019 Td Win32asm 710.Asm

http://slidepdf.com/reader/full/td-win32asm-710asm 45/116

Page 46: Td Win32asm 710.Asm

7/21/2019 Td Win32asm 710.Asm

http://slidepdf.com/reader/full/td-win32asm-710asm 46/116

Page 47: Td Win32asm 710.Asm

7/21/2019 Td Win32asm 710.Asm

http://slidepdf.com/reader/full/td-win32asm-710asm 47/116

Page 48: Td Win32asm 710.Asm

7/21/2019 Td Win32asm 710.Asm

http://slidepdf.com/reader/full/td-win32asm-710asm 48/116

Page 49: Td Win32asm 710.Asm

7/21/2019 Td Win32asm 710.Asm

http://slidepdf.com/reader/full/td-win32asm-710asm 49/116

td_win32asm_710.asmpush hMainPopup ;hMenu, handle of popup menucall AppendMenuA ;- API Function -push OFFSET MainMenuItemDeleteAllpush 2001h

h 0h

Page 50: Td Win32asm 710.Asm

7/21/2019 Td Win32asm 710.Asm

http://slidepdf.com/reader/full/td-win32asm-710asm 50/116

push 0hpush hMainPopupcall AppendMenuA ;- API Function -push 0h

push 0hpush 800h ;uFlags, menu item flags, 800h=MF_SEPARATORpush hMainPopupcall AppendMenuA ;- API Function -push OFFSET MainMenuItemCancelpush 2009hpush 0hpush hMainPopupcall AppendMenuA ;- API Function -;------------------------------------------------------------------------------; API "CreatePopupMenu" creates an empty popup menu;------------------------------------------------------------------------------call CreatePopupMenu ;- API Function -mov hPortListPopup,eax ;return value=handle of popup menu;------------------------------------------------------------------------------; API "AppendMenuA" appends a new menu item to the end of the specified menu; uIDNewItem --> menu items ID's are a free value of your choice;------------------------------------------------------------------------------push OFFSET PScanMenuItemAddItem ;lpNewItem, menu item contentpush 2010h ;uIDNewItem,menu item id or menu handlepush 0h ;uFlags, menu item flags, 0h=MF_STRING

push hPortListPopup ;hMenu, handle of popup menucall AppendMenuA ;- API Function -push OFFSET PScanMenuItemDelSelpush 2011hpush 0hpush hPortListPopupcall AppendMenuA ;- API Function -push OFFSET PScanMenuItemDelAllpush 2012hpush 0hpush hPortListPopupcall AppendMenuA ;- API Function -push 0hpush 0hpush 800h ;uFlags, menu item flags, 800h=MF_SEPARATORpush hPortListPopupcall AppendMenuA ;- API Function -push OFFSET PScanMenuItemLoadpush 2013hpush 0hpush hPortListPopup

call AppendMenuA ;- API Function -push OFFSET PScanMenuItemSavepush 2014h

Page 50

Page 51: Td Win32asm 710.Asm

7/21/2019 Td Win32asm 710.Asm

http://slidepdf.com/reader/full/td-win32asm-710asm 51/116

Page 52: Td Win32asm 710.Asm

7/21/2019 Td Win32asm 710.Asm

http://slidepdf.com/reader/full/td-win32asm-710asm 52/116

Page 53: Td Win32asm 710.Asm

7/21/2019 Td Win32asm 710.Asm

http://slidepdf.com/reader/full/td-win32asm-710asm 53/116

Page 54: Td Win32asm 710.Asm

7/21/2019 Td Win32asm 710.Asm

http://slidepdf.com/reader/full/td-win32asm-710asm 54/116

Page 55: Td Win32asm 710.Asm

7/21/2019 Td Win32asm 710.Asm

http://slidepdf.com/reader/full/td-win32asm-710asm 55/116

Page 56: Td Win32asm 710.Asm

7/21/2019 Td Win32asm 710.Asm

http://slidepdf.com/reader/full/td-win32asm-710asm 56/116

Page 57: Td Win32asm 710.Asm

7/21/2019 Td Win32asm 710.Asm

http://slidepdf.com/reader/full/td-win32asm-710asm 57/116

Page 58: Td Win32asm 710.Asm

7/21/2019 Td Win32asm 710.Asm

http://slidepdf.com/reader/full/td-win32asm-710asm 58/116

Page 59: Td Win32asm 710.Asm

7/21/2019 Td Win32asm 710.Asm

http://slidepdf.com/reader/full/td-win32asm-710asm 59/116

Page 60: Td Win32asm 710.Asm

7/21/2019 Td Win32asm 710.Asm

http://slidepdf.com/reader/full/td-win32asm-710asm 60/116

Page 61: Td Win32asm 710.Asm

7/21/2019 Td Win32asm 710.Asm

http://slidepdf.com/reader/full/td-win32asm-710asm 61/116

Page 62: Td Win32asm 710.Asm

7/21/2019 Td Win32asm 710.Asm

http://slidepdf.com/reader/full/td-win32asm-710asm 62/116

Page 63: Td Win32asm 710.Asm

7/21/2019 Td Win32asm 710.Asm

http://slidepdf.com/reader/full/td-win32asm-710asm 63/116

Page 64: Td Win32asm 710.Asm

7/21/2019 Td Win32asm 710.Asm

http://slidepdf.com/reader/full/td-win32asm-710asm 64/116

td_win32asm_710.asmpush hObj_Toolbar ;hObject, handle of graphic objectcall DeleteObject ;- API Function -;------------------------------------------------------------------------------; API "SendMessageA" sends a message to the window;------------------------------------------------------------------------------push hImageList_Help ;lParam, himl, handle image list to assignpush 1h ;wParam iImageList type LVSIL SMALL=1h

Page 65: Td Win32asm 710.Asm

7/21/2019 Td Win32asm 710.Asm

http://slidepdf.com/reader/full/td-win32asm-710asm 65/116

push 1h ;wParam, iImageList, type, LVSIL_SMALL=1hpush 1003h ;uMsg,LVM_FIRST=1000h | LVM_SETIMAGELIST=3hpush hWnd_LV_Help ;hwnd, handle of destination windowcall SendMessageA ;- API Function -mov LVI_iImage,19hmov ebx,OFFSET M190_Helpcall My_LVM_INSERTITEM_IMAGE ;- SubRoutine -mov LVI_iImage,99hmov ebx,OFFSET M191_Helpcall My_LVM_INSERTITEM_IMAGE ;- SubRoutine -mov LVI_iImage,99hmov ebx,OFFSET M192_Helpcall My_LVM_INSERTITEM_IMAGE ;- SubRoutine -

mov LVI_iImage,99hmov ebx,OFFSET MFFF_Helpcall My_LVM_INSERTITEM_IMAGE ;- SubRoutine -mov LVI_iImage,0hmov ebx,OFFSET M000_Helpcall My_LVM_INSERTITEM_IMAGE ;- SubRoutine -mov LVI_iImage,99hmov ebx,OFFSET M001_Helpcall My_LVM_INSERTITEM_IMAGE ;- SubRoutine -mov LVI_iImage,99hmov ebx,OFFSET MFFF_Helpcall My_LVM_INSERTITEM_IMAGE ;- SubRoutine -mov LVI_iImage,1hmov ebx,OFFSET M010_Helpcall My_LVM_INSERTITEM_IMAGE ;- SubRoutine -mov LVI_iImage,99hmov ebx,OFFSET M011_Helpcall My_LVM_INSERTITEM_IMAGE ;- SubRoutine -mov LVI_iImage,99hmov ebx,OFFSET M012_Helpcall My_LVM_INSERTITEM_IMAGE ;- SubRoutine -

mov LVI_iImage,99hmov ebx,OFFSET MFFF_Helpcall My_LVM_INSERTITEM_IMAGE ;- SubRoutine -mov LVI_iImage,2hmov ebx,OFFSET M020_Helpcall My_LVM_INSERTITEM_IMAGE ;- SubRoutine -mov LVI_iImage,99hmov ebx,OFFSET M021_Helpcall My_LVM_INSERTITEM_IMAGE ;- SubRoutine -mov LVI_iImage,99hmov ebx,OFFSET MFFF_Helpcall My_LVM_INSERTITEM_IMAGE ;- SubRoutine -mov LVI_iImage,3h

Page 65

td_win32asm_710.asmmov ebx,OFFSET M030_Helpcall My_LVM_INSERTITEM_IMAGE ;- SubRoutine -mov LVI_iImage,99hmov ebx,OFFSET M031_Helpcall My_LVM_INSERTITEM_IMAGE ;- SubRoutine -mov LVI_iImage,99hmov ebx OFFSET MFFF Help

Page 66: Td Win32asm 710.Asm

7/21/2019 Td Win32asm 710.Asm

http://slidepdf.com/reader/full/td-win32asm-710asm 66/116

mov ebx,OFFSET MFFF_Helpcall My_LVM_INSERTITEM_IMAGE ;- SubRoutine -mov LVI_iImage,4hmov ebx,OFFSET M040_Helpcall My_LVM_INSERTITEM_IMAGE ;- SubRoutine -mov LVI_iImage,99hmov ebx,OFFSET M041_Helpcall My_LVM_INSERTITEM_IMAGE ;- SubRoutine -mov LVI_iImage,99hmov ebx,OFFSET MFFF_Helpcall My_LVM_INSERTITEM_IMAGE ;- SubRoutine -mov LVI_iImage,5hmov ebx,OFFSET M050_Help

call My_LVM_INSERTITEM_IMAGE ;- SubRoutine -mov LVI_iImage,99hmov ebx,OFFSET M051_Helpcall My_LVM_INSERTITEM_IMAGE ;- SubRoutine -mov LVI_iImage,99hmov ebx,OFFSET M052_Helpcall My_LVM_INSERTITEM_IMAGE ;- SubRoutine -mov LVI_iImage,99hmov ebx,OFFSET MFFF_Helpcall My_LVM_INSERTITEM_IMAGE ;- SubRoutine -mov LVI_iImage,6hmov ebx,OFFSET M060_Helpcall My_LVM_INSERTITEM_IMAGE ;- SubRoutine -mov LVI_iImage,99hmov ebx,OFFSET M061_Helpcall My_LVM_INSERTITEM_IMAGE ;- SubRoutine -mov LVI_iImage,99hmov ebx,OFFSET MFFF_Helpcall My_LVM_INSERTITEM_IMAGE ;- SubRoutine -mov LVI_iImage,18hmov ebx,OFFSET M180_Help

call My_LVM_INSERTITEM_IMAGE ;- SubRoutine -mov LVI_iImage,99hmov ebx,OFFSET M181_Helpcall My_LVM_INSERTITEM_IMAGE ;- SubRoutine -mov LVI_iImage,99hmov ebx,OFFSET M182_Helpcall My_LVM_INSERTITEM_IMAGE ;- SubRoutine -mov LVI_iImage,99hmov ebx,OFFSET MFFF_Helpcall My_LVM_INSERTITEM_IMAGE ;- SubRoutine -mov LVI_iImage,1Ahmov ebx,OFFSET M1A0_Helpcall My_LVM_INSERTITEM_IMAGE ;- SubRoutine -

Page 66

td_win32asm_710.asmmov LVI_iImage,99hmov ebx,OFFSET M1A1_Helpcall My_LVM_INSERTITEM_IMAGE ;- SubRoutine -mov LVI_iImage,99hmov ebx,OFFSET M1A2_Helpcall My_LVM_INSERTITEM_IMAGE ;- SubRoutine -mov LVI iImage,99h

Page 67: Td Win32asm 710.Asm

7/21/2019 Td Win32asm 710.Asm

http://slidepdf.com/reader/full/td-win32asm-710asm 67/116

mov LVI_iImage,99hmov ebx,OFFSET M1A3_Helpcall My_LVM_INSERTITEM_IMAGE ;- SubRoutine -mov LVI_iImage,99hmov ebx,OFFSET MFFF_Helpcall My_LVM_INSERTITEM_IMAGE ;- SubRoutine -mov LVI_iImage,1Bhmov ebx,OFFSET M1B0_Helpcall My_LVM_INSERTITEM_IMAGE ;- SubRoutine -mov LVI_iImage,99hmov ebx,OFFSET M1B1_Helpcall My_LVM_INSERTITEM_IMAGE ;- SubRoutine -mov LVI_iImage,99h

mov ebx,OFFSET M1B2_Helpcall My_LVM_INSERTITEM_IMAGE ;- SubRoutine -mov LVI_iImage,99hmov ebx,OFFSET MFFF_Helpcall My_LVM_INSERTITEM_IMAGE ;- SubRoutine -ret

;@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@; This Subroutines are used on Startup or if we choose a function from toolbar;@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@My_Run_Startup:mov eax,hWnd_LV_Startupmov temp,eaxmov ebx,OFFSET wsa_szDescription;lParam, lpsz, address of string to addcall My_LVM_INSERTITEM ;- SubRoutine -call My_GetLocalTime ;- SubRoutine -call My_GetDateFormat ;- SubRoutine -mov ebx,OFFSET Buffermov LVI_iSubItem,1hcall My_LVM_SETITEM ;- SubRoutine -call My_GetTimeFormat ;- SubRoutine -

mov ebx,OFFSET Buffer ;lParam, lpsz, address of string to addmov LVI_iSubItem,2hcall My_LVM_SETITEM ;- SubRoutine -call My_LVM_SETITEMSTATE ;- SubRoutine -call My_SetFocus_ListView ;- SubRoutine -ret

;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

My_Init_Phonebook:call My_DestroyWindow1 ;- SubRoutine -call My_SetWindowLongA_0 ;- SubRoutine -;------------------------------------------------------------------------------

Page 67

Page 68: Td Win32asm 710.Asm

7/21/2019 Td Win32asm 710.Asm

http://slidepdf.com/reader/full/td-win32asm-710asm 68/116

Page 69: Td Win32asm 710.Asm

7/21/2019 Td Win32asm 710.Asm

http://slidepdf.com/reader/full/td-win32asm-710asm 69/116

Page 70: Td Win32asm 710.Asm

7/21/2019 Td Win32asm 710.Asm

http://slidepdf.com/reader/full/td-win32asm-710asm 70/116

Page 71: Td Win32asm 710.Asm

7/21/2019 Td Win32asm 710.Asm

http://slidepdf.com/reader/full/td-win32asm-710asm 71/116

Page 72: Td Win32asm 710.Asm

7/21/2019 Td Win32asm 710.Asm

http://slidepdf.com/reader/full/td-win32asm-710asm 72/116

Page 73: Td Win32asm 710.Asm

7/21/2019 Td Win32asm 710.Asm

http://slidepdf.com/reader/full/td-win32asm-710asm 73/116

td_win32asm_710.asmcall LoadStringA ;- API Function -mov ebx,OFFSET BufferMy_Run_Local_Result:mov LVI_iSubItem,1hcall My_LVM_SETITEM ;- SubRoutine -call My_GetLocalTime ;- SubRoutine -call My_GetDateFormat ;- SubRoutine -mov ebx,OFFSET Buffer

Page 74: Td Win32asm 710.Asm

7/21/2019 Td Win32asm 710.Asm

http://slidepdf.com/reader/full/td-win32asm-710asm 74/116

mov ebx,OFFSET Buffermov LVI_iSubItem,2h

call My_LVM_SETITEM ;- SubRoutine -call My_GetTimeFormat ;- SubRoutine -mov ebx,OFFSET Buffer ;lParam, lpsz, address of string to addmov LVI_iSubItem,3hcall My_LVM_SETITEM ;- SubRoutine -My_Run_Local_Return:call My_EnableWindow1 ;- SubRoutine -call My_LVM_SETITEMSTATE ;- SubRoutine -call My_SetFocus_ListView ;- SubRoutine -ret

;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

My_Init_ActiveRAS:call My_DestroyWindow1 ;- SubRoutine -call My_SetWindowLongA_0 ;- SubRoutine -;------------------------------------------------------------------------------; API "SetWindowLong" changes an attribute of the specified window.;------------------------------------------------------------------------------push 50000005h ;lNewLong, new value, WS_CHILDpush -16 ;nIndex, offset value to set, GWL_STYLE

push hWnd_LV_ActiveRAS ;hwnd, handle of windowcall SetWindowLongA ;- API Function -;------------------------------------------------------------------------------; API "SetWindowTextA" set's the text of the specified window's title bar.;------------------------------------------------------------------------------push OFFSET Bu_ActiveRAS ;lpsz, address of stringpush hWnd_Action ;hwnd, handle of window or controlcall SetWindowTextA ;- API Function -call My_Create_Logo ;- SubRoutine -call My_InvalidateRect ;- SubRoutine -

call My_SetFocus_Action ;- SubRoutine -ret

My_Run_ActiveRAS:mov eax,hWnd_LV_ActiveRASmov temp,eaxcall My_EnableWindow0 ;- SubRoutine -cmp flag_RASDialviaNumber,1h ;dial via phone number ?jne My_Run_ActiveRAS_Entry;------------------------------------------------------------------------------; API "RasGetConnectStatus" retrieves information on the current status of the; specified remote access connection;------------------------------------------------------------------------------

Page 74

td_win32asm_710.asmpush OFFSET rasstatus_dwSize ;lprasconnstatus,buffer receive status datapush hrascon ;hrasconn,handle RAS connection of interestcall RasGetConnectStatusA ;- API Function -mov ebx,OFFSET DialviaNumbercmp rasstatus_rasconnstate,2 ;RASCS_ConnectDevice ? = are we onlineje My_Run_ActiveRAS_Returnmov ebx,OFFSET E0_ActiveRAS ;pointer to error messagejmp My_Run_ActiveRAS_Return

Page 75: Td Win32asm 710.Asm

7/21/2019 Td Win32asm 710.Asm

http://slidepdf.com/reader/full/td-win32asm-710asm 75/116

j p yMy_Run_ActiveRAS_Entry:

mov BufferSize,10000hmov counter,8hmov eax,OFFSET Buffermov ebx,19Chmov [eax],ebx;------------------------------------------------------------------------------; API "RasEnumConnections" lists all active Remote Access Service connections.;------------------------------------------------------------------------------push OFFSET ActiveRAS_Connections;lpcConnections, # connections written buffpush OFFSET BufferSize ;lpcb, size in bytes of buffer

push OFFSET Buffer ;lprasconn, buffer receive connections datacall RasEnumConnectionsA ;- API Function -mov ebx,OFFSET E0_ActiveRAS ;pointer to error messagecmp eax,0h ;error ?jne My_Run_ActiveRAS_Returncmp ActiveRAS_Connections,0hje My_Run_ActiveRAS_ReturnMy_Run_ActiveRAS_Enum:mov ebx,OFFSET Bufferadd ebx,countercall My_LVM_INSERTITEM ;- SubRoutine -

call My_GetLocalTime ;- SubRoutine -call My_GetDateFormat ;- SubRoutine -mov ebx,OFFSET Buffermov LVI_iSubItem,1hcall My_LVM_SETITEM ;- SubRoutine -call My_GetTimeFormat ;- SubRoutine -mov ebx,OFFSET Buffer ;lParam, lpsz, address of string to addmov LVI_iSubItem,2hcall My_LVM_SETITEM ;- SubRoutine -add counter,19Ch

dec ActiveRAS_Connectionsjne My_Run_ActiveRAS_Enumjmp My_Run_ActiveRAS_DoneMy_Run_ActiveRAS_Return:call My_LVM_INSERTITEM ;- SubRoutine -call My_GetLocalTime ;- SubRoutine -call My_GetDateFormat ;- SubRoutine -mov ebx,OFFSET Buffermov LVI_iSubItem,1hcall My_LVM_SETITEM ;- SubRoutine -call My_GetTimeFormat ;- SubRoutine -

mov ebx,OFFSET Buffer ;lParam, lpsz, address of string to addmov LVI_iSubItem,2h

Page 75

Page 76: Td Win32asm 710.Asm

7/21/2019 Td Win32asm 710.Asm

http://slidepdf.com/reader/full/td-win32asm-710asm 76/116

Page 77: Td Win32asm 710.Asm

7/21/2019 Td Win32asm 710.Asm

http://slidepdf.com/reader/full/td-win32asm-710asm 77/116

Page 78: Td Win32asm 710.Asm

7/21/2019 Td Win32asm 710.Asm

http://slidepdf.com/reader/full/td-win32asm-710asm 78/116

Page 79: Td Win32asm 710.Asm

7/21/2019 Td Win32asm 710.Asm

http://slidepdf.com/reader/full/td-win32asm-710asm 79/116

Page 80: Td Win32asm 710.Asm

7/21/2019 Td Win32asm 710.Asm

http://slidepdf.com/reader/full/td-win32asm-710asm 80/116

Page 81: Td Win32asm 710.Asm

7/21/2019 Td Win32asm 710.Asm

http://slidepdf.com/reader/full/td-win32asm-710asm 81/116

Page 82: Td Win32asm 710.Asm

7/21/2019 Td Win32asm 710.Asm

http://slidepdf.com/reader/full/td-win32asm-710asm 82/116

Page 83: Td Win32asm 710.Asm

7/21/2019 Td Win32asm 710.Asm

http://slidepdf.com/reader/full/td-win32asm-710asm 83/116

Page 84: Td Win32asm 710.Asm

7/21/2019 Td Win32asm 710.Asm

http://slidepdf.com/reader/full/td-win32asm-710asm 84/116

Page 85: Td Win32asm 710.Asm

7/21/2019 Td Win32asm 710.Asm

http://slidepdf.com/reader/full/td-win32asm-710asm 85/116

Page 86: Td Win32asm 710.Asm

7/21/2019 Td Win32asm 710.Asm

http://slidepdf.com/reader/full/td-win32asm-710asm 86/116

Page 87: Td Win32asm 710.Asm

7/21/2019 Td Win32asm 710.Asm

http://slidepdf.com/reader/full/td-win32asm-710asm 87/116

Page 88: Td Win32asm 710.Asm

7/21/2019 Td Win32asm 710.Asm

http://slidepdf.com/reader/full/td-win32asm-710asm 88/116

Page 89: Td Win32asm 710.Asm

7/21/2019 Td Win32asm 710.Asm

http://slidepdf.com/reader/full/td-win32asm-710asm 89/116

td_win32asm_710.asmpush WP1_hWnd ;lpParameter, argument for new threadpush OFFSET My_Thread_PortScan ;lpStartAddress, address of thread functionpush 0h ;dwStackSize, init thread stack size, in dbpush 0h ;lpThreadAttributes, address security attr.call CreateThread ;- API Function -mov PortScan_hThread,eax ;thread handle;------------------------------------------------------------------------------; SetThreadPriority function sets the priority value for the specified thread.;------------------------------------------------------------------------------

push 15 ;nPriority THREAD PRIORITY TIME CRITICAL=15h P tS hTh d hTh d h dl t th th d

Page 90: Td Win32asm 710.Asm

7/21/2019 Td Win32asm 710.Asm

http://slidepdf.com/reader/full/td-win32asm-710asm 90/116

push 15 ;nPriority,THREAD_PRIORITY_TIME_CRITICAL=15push PortScan_hThread ;hThread, handle to the threadcall SetThreadPriority ;- API Function -;------------------------------------------------------------------------------; API "CloseHandle" closes an open object handle;------------------------------------------------------------------------------push PortScan_ThreadID ;hObject, handle of object to closecall CloseHandle ;- API Function -My_Run_PortScan_Return:ret

My_Thread_PortScan:;##############################################################################; The Thread for the PortScanner function;##############################################################################push ebp ;create stack framemov ebp,esppushadmov eax,hWnd_LV_PortScanmov temp,eaxmov edi,Var_PortScanStart

mov Var_PortScanCurrentPort,edicmp Flag_PortScanList,1h ;scan via portlist ?jne My_Thread_PortScan_Loopmov eax,OFFSET Buf_PortScanListmov edi,[eax]mov Var_PortScanCurrentPort,edi

My_Thread_PortScan_Loop: ;HERE THE PORTSCANNER LOOP STARTS !!!cmp Flag_Escape,1h ;escape key pressed ?je My_Thread_PortScan_Endmov Flag_PortScanThread,0hmov edi,Var_PortScanStartcmp Flag_PortScanList,1h ;scan via portlist ?jne My_Thread_PortScan_htonsmov eax,Var_PortListCurrentItemmov edx,4hmul edxmov ecx,OFFSET Buf_PortScanListmov edi,[ecx+eax]My_Thread_PortScan_htons:mov Var_PortScanCurrentPort,edi

;------------------------------------------------------------------------------; API "htons" converts a u_short from host to TCP/IP network byte order

Page 90

Page 91: Td Win32asm 710.Asm

7/21/2019 Td Win32asm 710.Asm

http://slidepdf.com/reader/full/td-win32asm-710asm 91/116

Page 92: Td Win32asm 710.Asm

7/21/2019 Td Win32asm 710.Asm

http://slidepdf.com/reader/full/td-win32asm-710asm 92/116

td_win32asm_710.asmcall closesocket ;- API Function -;------------------------------------------------------------------------------; API "PeekMessage" checks a thread message queue for a message and places the; message (if any) in the specified structure. Here clear message queue.;------------------------------------------------------------------------------push 1h ;wRemoveMsg, removal flags, PM_REMOVEpush 1000h ;uMsgFilterMax, last messagepush 1000h ;uMsgFilterMin, first messagepush WP1_hWnd ;hWnd, handle of window

push OFFSET hWnd ;lpMsg, address of structure for messagecall PeekMessageA ;- API Function -

Page 93: Td Win32asm 710.Asm

7/21/2019 Td Win32asm 710.Asm

http://slidepdf.com/reader/full/td-win32asm-710asm 93/116

p ; p g, gcall PeekMessageA ; API Function cmp Flag_PortScanThread,1hje My_Thread_PortScan_Calccmp counter,11001 ;WSAHOST_NOT_FOUNDje My_Thread_PortScan_Endcmp Flag_PortScanTimeOut,1hje My_Thread_PortScan_Calccmp counter,12000 ;<<< User defined Timeout >>>jne My_Thread_PortScan_Calccall My_LVM_DELETEITEM

My_Thread_PortScan_Calc:inc Var_PortScanStartcmp Flag_PortScanDir,1je My_Thread_PortScan_Calc1dec Var_PortScanStartdec Var_PortScanStartMy_Thread_PortScan_Calc1:inc Var_PortListCurrentItemdec Var_PortScanCountercmp Var_PortScanCounter,0h

jne My_Thread_PortScan_LoopMy_Thread_PortScan_End:call My_LVM_SETITEMSTATE ;- SubRoutine -call My_SetFocus_ListView ;- SubRoutine -call My_EnableWindow1 ;- SubRoutine -;------------------------------------------------------------------------------; API "ExitThread" ends a thread;------------------------------------------------------------------------------push 0h ;dwExitCode, exit code for this threadcall ExitThread ;- API Function -popad

xor eax,eaxmov esp,ebp ;delete stack framepop ebpret 4h;##############################################################################

;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

My_Init_GAI:call My_DestroyWindow1 ;- SubRoutine -

call My_SetWindowLongA_0 ;- SubRoutine -;------------------------------------------------------------------------------

Page 93

Page 94: Td Win32asm 710.Asm

7/21/2019 Td Win32asm 710.Asm

http://slidepdf.com/reader/full/td-win32asm-710asm 94/116

Page 95: Td Win32asm 710.Asm

7/21/2019 Td Win32asm 710.Asm

http://slidepdf.com/reader/full/td-win32asm-710asm 95/116

Page 96: Td Win32asm 710.Asm

7/21/2019 Td Win32asm 710.Asm

http://slidepdf.com/reader/full/td-win32asm-710asm 96/116

Page 97: Td Win32asm 710.Asm

7/21/2019 Td Win32asm 710.Asm

http://slidepdf.com/reader/full/td-win32asm-710asm 97/116

Page 98: Td Win32asm 710.Asm

7/21/2019 Td Win32asm 710.Asm

http://slidepdf.com/reader/full/td-win32asm-710asm 98/116

Page 99: Td Win32asm 710.Asm

7/21/2019 Td Win32asm 710.Asm

http://slidepdf.com/reader/full/td-win32asm-710asm 99/116

td_win32asm_710.asmret

My_Run_Help:;------------------------------------------------------------------------------; API "MessageBoxA" creates a message box ...;------------------------------------------------------------------------------push 40h ;uType,style,MB_ICONINFORMATION=40h,0=MB_OK Buttonpush OFFSET MB18_Title ;lpCaption,pointer to title textpush OFFSET MB18_Text ;lpText,pointer to text message box

push WP1_hWnd ;handle of owner windowcall MessageBoxA ;- API Function -ret

Page 100: Td Win32asm 710.Asm

7/21/2019 Td Win32asm 710.Asm

http://slidepdf.com/reader/full/td-win32asm-710asm 100/116

ret

;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

;@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@; This Subroutines are used from several functions and for several reasons !!!;@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@My_StringDecNrtoHexDD:;------------------------------------------------------------------------------

; Converts a DECIMAL NUMBER STRING (OFFSET ESI) with max. Character (EAX) into; a 32 Bit value in EDI.;------------------------------------------------------------------------------mov ecx,eaxdec ecxadd esi,ecxmov edi,0hmov eax,1My_StringDecNrtoHexDD_Loop:mov bl,[esi]

and bl,0Fhje My_StringDecNrtoHexDD_NextMy_StringDecNrtoHexDD_Inc:add edi,eaxdec bljne My_StringDecNrtoHexDD_IncMy_StringDecNrtoHexDD_Next:mov edx,10mul edxdec esidec ecx

cmp ecx,0FFFFFFFFhjne My_StringDecNrtoHexDD_Loopret

My_HexDBtoStringHex:;------------------------------------------------------------------------------; Converts a 8 bit value in AL into an ascii hexadecimal string to OFFSET EDX;------------------------------------------------------------------------------mov ah,al ;prepare calculationshr ah,4h

and al,0Fhmov ecx,0h

Page 100

td_win32asm_710.asmmov esi,OFFSET table_HEXmov edi,OFFSET table_ASCIIpush esipush ediMy_HexDBtoStringHexNext47: ;calculate bits 4-7cmp ah,[esi]je My_HexDBtoStringHexOK47inc esiinc ediinc chcmp ch,10hjne My_HexDBtoStringHexNext47

Page 101: Td Win32asm 710.Asm

7/21/2019 Td Win32asm 710.Asm

http://slidepdf.com/reader/full/td-win32asm-710asm 101/116

j y_ gMy_HexDBtoStringHexOK47: ;store resultmov ch,[edi]mov [edx],chinc edx ;inc pointer bufferpop edi ;restore pointer tablespop esiMy_HexDBtoStringHexNext03: ;calculate bits 0-3cmp al,[esi]

je My_HexDBtoStringHexOK03inc esiinc ediinc clcmp cl,10hjne My_HexDBtoStringHexNext03My_HexDBtoStringHexOK03: ;store resultmov cl,[edi]mov [edx],clret

My_HexDDtoStringHex:;------------------------------------------------------------------------------; Converts a 32 bit value in ESI into an ascii hexadecimal string to OFFSET EDI;------------------------------------------------------------------------------mov counter1,0hMy_HexDDtoStringHex_Next:mov counter,0hMy_HexDDtoStringHex_Loop:mov edx,OFFSET table_HEXadd edx,counter

mov ebx,OFFSET table_ASCIIadd ebx,countermov eax,OFFSET table_SHIFTadd eax,counter1mov cl,[eax]inc countercmp counter,11hjae My_HexDDtoStringHex_returnmov eax,esishr eax,cl

and eax,15cmp al,[edx]

Page 101

Page 102: Td Win32asm 710.Asm

7/21/2019 Td Win32asm 710.Asm

http://slidepdf.com/reader/full/td-win32asm-710asm 102/116

td_win32asm_710.asmret

My_TrayToScreen:;------------------------------------------------------------------------------; API "Shell_NotifyIconA" here deletes the icon from the taskbar;------------------------------------------------------------------------------push OFFSET nid_cbSize ;pnid, pointer NOTIFYICONDATA structurepush 2h ;dwMessage, ID msg. send, 2h=NIM_DELETEcall Shell_NotifyIconA ;- API Function -;------------------------------------------------------------------------------; API "ShowWindow" function sets the specified window's show state.;------------------------------------------------------------------------------

h 9h C dSh h 9 S S O

Page 103: Td Win32asm 710.Asm

7/21/2019 Td Win32asm 710.Asm

http://slidepdf.com/reader/full/td-win32asm-710asm 103/116

push 9h ;nCmdShow, show state 9=SW_RESTOREpush WP1_hWnd ;hwnd, handle of windowcall ShowWindow ;- API Function -ret

My_AdapterType:;------------------------------------------------------------------------------;

;------------------------------------------------------------------------------mov al,[ebx]cmp al,0jne AdapterType1mov ebx,OFFSET M0_GAIjmp AdapterType_ResultAdapterType1:cmp al,1jne AdapterType2mov ebx,OFFSET M1_GAIjmp AdapterType_ResultAdapterType2:cmp al,2jne AdapterType3mov ebx,OFFSET M2_GAIjmp AdapterType_ResultAdapterType3:cmp al,3jne AdapterType4mov ebx,OFFSET M3_GAIjmp AdapterType_Result

AdapterType4:cmp al,4jne AdapterType5mov ebx,OFFSET M4_GAIjmp AdapterType_ResultAdapterType5:cmp al,5jne AdapterType6mov ebx,OFFSET M5_GAIjmp AdapterType_ResultAdapterType6:cmp al,6

Page 103

td_win32asm_710.asmjne AdapterType9mov ebx,OFFSET M6_GAIjmp AdapterType_ResultAdapterType9:mov ebx,OFFSET M9_GAIAdapterType_Result:call My_LVM_INSERTITEM ;- SubRoutine -ret

My_GAI_MAC:;------------------------------------------------------------------------------;;

Page 104: Td Win32asm 710.Asm

7/21/2019 Td Win32asm 710.Asm

http://slidepdf.com/reader/full/td-win32asm-710asm 104/116

;------------------------------------------------------------------------------mov al,[ebx] ;get byte value, converting to ASCII starts heremov edx,OFFSET MiscBuffercall My_HexDBtoStringHex ;- SubRoutine -mov al,[ebx+1]mov edx,OFFSET MiscBuffer+3call My_HexDBtoStringHex ;- SubRoutine -mov al,[ebx+2]

mov edx,OFFSET MiscBuffer+6call My_HexDBtoStringHex ;- SubRoutine -mov al,[ebx+3]mov edx,OFFSET MiscBuffer+9call My_HexDBtoStringHex ;- SubRoutine -mov al,[ebx+4]mov edx,OFFSET MiscBuffer+12call My_HexDBtoStringHex ;- SubRoutine -mov al,[ebx+5]mov edx,OFFSET MiscBuffer+15call My_HexDBtoStringHex ;- SubRoutine -mov ax,002Dh ;insert ascii "-"mov edx,OFFSET MiscBuffer+2mov [edx],aladd edx,3hmov [edx],aladd edx,3hmov [edx],aladd edx,3hmov [edx],aladd edx,3h

mov [edx],aladd edx,3hmov [edx],ah ;insert terminating 0, converting to ASCII ends heremov ebx,OFFSET MiscBuffermov LVI_iSubItem,1hcall My_LVM_SETITEMret

My_GetLocalTime:;------------------------------------------------------------------------------; API "GetLocalTime" retrieves the current local date and time.;------------------------------------------------------------------------------

Page 104

Page 105: Td Win32asm 710.Asm

7/21/2019 Td Win32asm 710.Asm

http://slidepdf.com/reader/full/td-win32asm-710asm 105/116

Page 106: Td Win32asm 710.Asm

7/21/2019 Td Win32asm 710.Asm

http://slidepdf.com/reader/full/td-win32asm-710asm 106/116

Page 107: Td Win32asm 710.Asm

7/21/2019 Td Win32asm 710.Asm

http://slidepdf.com/reader/full/td-win32asm-710asm 107/116

Page 108: Td Win32asm 710.Asm

7/21/2019 Td Win32asm 710.Asm

http://slidepdf.com/reader/full/td-win32asm-710asm 108/116

Page 109: Td Win32asm 710.Asm

7/21/2019 Td Win32asm 710.Asm

http://slidepdf.com/reader/full/td-win32asm-710asm 109/116

Page 110: Td Win32asm 710.Asm

7/21/2019 Td Win32asm 710.Asm

http://slidepdf.com/reader/full/td-win32asm-710asm 110/116

Page 111: Td Win32asm 710.Asm

7/21/2019 Td Win32asm 710.Asm

http://slidepdf.com/reader/full/td-win32asm-710asm 111/116

Page 112: Td Win32asm 710.Asm

7/21/2019 Td Win32asm 710.Asm

http://slidepdf.com/reader/full/td-win32asm-710asm 112/116

Page 113: Td Win32asm 710.Asm

7/21/2019 Td Win32asm 710.Asm

http://slidepdf.com/reader/full/td-win32asm-710asm 113/116

td_win32asm_710.asmpush 4hpush OFFSET AutoLogpush FileHandlecall WriteFile ;- API Function -push 0hpush OFFSET FileReturnpush 4hpush OFFSET AutoSavepush FileHandlecall WriteFile ;- API Function -

push 0hpush OFFSET FileReturnpush 4hpush OFFSET TimeOut

Page 114: Td Win32asm 710.Asm

7/21/2019 Td Win32asm 710.Asm

http://slidepdf.com/reader/full/td-win32asm-710asm 114/116

ppush FileHandlecall WriteFile ;- API Function -push 0hpush OFFSET FileReturnpush 4hpush OFFSET Var_PortListItems

push FileHandlecall WriteFile ;- API Function -push 0hpush OFFSET FileReturnpush 0E0hpush OFFSET File_Dummypush FileHandlecall WriteFile ;- API Function -push 0hpush OFFSET FileReturnpush 400h

push OFFSET Buf_PortScanListpush FileHandlecall WriteFile ;- API Function -My_AutoSave_Return:;------------------------------------------------------------------------------; API "CloseHandle" closes an open object handle.;------------------------------------------------------------------------------push FileHandle ;hObject, handle of object to closecall CloseHandle ;- API Function -ret

My_AutoLoad:;------------------------------------------------------------------------------; API "CreateFileA" creates or opens a file, returns a handle to access object.;------------------------------------------------------------------------------push 0h ;hTemplateFile,push 80h ;dwFlagsAndAttributes, normal = 80hpush 3h ;dwCreationDistribution, OPEN_EXISTING=3hpush 0h ;lpSecurityAttributes,push 0h ;dwShareMode,push 80000000h ;dwDesiredAccess, GENERIC_READ

push OFFSET AutoSave_FileName ;lpFileName,pointer to filenamePage 114

td_win32asm_710.asmcall CreateFileA ;- API Function -cmp eax,-1 ;INVALID_HANDLE_VALUE = -1je My_AutoLoad_Return ;mov FileHandle,eax ;store handle in variable;------------------------------------------------------------------------------; API "ReadFile" reads data from a file ==> Mark;------------------------------------------------------------------------------push 0h ;lpOverlapped, structure overlapped I/Opush OFFSET FileReturn ;lpNumberOfBytesWritten,push 10h ;nNumberOfBytesToWrite, bytes to read

push OFFSET Buffer ;lpBuffer, address data read from filepush FileHandle ;hFile, handle of file to write tocall ReadFile ;- API Function -mov ecx,0h ;check if it is a correct netspy set file

Page 115: Td Win32asm 710.Asm

7/21/2019 Td Win32asm 710.Asm

http://slidepdf.com/reader/full/td-win32asm-710asm 115/116

pymov esi,OFFSET Buffer ;mov edi,OFFSET FileMark_Settings;My_AutoLoad_CheckMark:mov al,[esi] ;mov ah,[edi] ;cmp al,ah ;

jne My_AutoLoad_Return ;inc esi ;inc edi ;inc ecx ;cmp ecx,10h ;jne My_AutoLoad_CheckMark ;;------------------------------------------------------------------------------; API "ReadFile" reads data from a file;------------------------------------------------------------------------------push 0h ;lpOverlapped, structure overlapped I/Opush OFFSET FileReturn ;lpNumberOfBytesWritten,

push 4h ;nNumberOfBytesToWrite, bytes to writepush OFFSET AutoLog ;lpBuffer, address data write to filepush FileHandle ;hFile, handle of file to write tocall ReadFile ;- API Function -push 0hpush OFFSET FileReturnpush 4hpush OFFSET AutoSavepush FileHandlecall ReadFile

push 0hpush OFFSET FileReturnpush 4hpush OFFSET TimeOutpush FileHandlecall ReadFile ;- API Function -push 0hpush OFFSET FileReturnpush 4hpush OFFSET Var_PortListItemspush FileHandle

call ReadFile ;- API Function -Page 115

td_win32asm_710.asmpush 0hpush OFFSET FileReturnpush 0E0hpush OFFSET File_Dummypush FileHandlecall ReadFile ;- API Function -push 0hpush OFFSET FileReturnpush 400hpush OFFSET Buf_PortScanList

push FileHandlecall ReadFile ;- API Function -My_AutoLoad_Return:;------------------------------------------------------------------------------

" l dl " l bj h dl

Page 116: Td Win32asm 710.Asm

7/21/2019 Td Win32asm 710.Asm

http://slidepdf.com/reader/full/td-win32asm-710asm 116/116

; API "CloseHandle" closes an open object handle.;------------------------------------------------------------------------------push FileHandle ;hObject, handle of object to closecall CloseHandle ;- API Function -ret

;==============================================================================; end Main = end of our program code;------------------------------------------------------------------------------end Main ;end of our program code, entry point

;==============================================================================; To create the exe file use this commands with your Microsoft Assembler/Linker;------------------------------------------------------------------------------; ml.exe /c /coff td_win32asm_710.asm ;asm command; rc.exe /v rsrc.rc ;rc command; cvtres.exe /machine:ix86 rsrc.res

; link.exe /subsystem:windows td_win32asm_710.obj rsrc.obj ;link command;==============================================================================

Page 116


Recommended