Sei sulla pagina 1di 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
td@crahkob.com
;==============================================================================
; 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

td_win32asm_710.asm
includelib comdlg32.lib
includelib wsock32.lib
includelib rasapi32.lib
;==============================================================================
; Declaration of used API functions,take a look into WIN32.HLP and *.inc files
;-----------------------------------------------------------------------------GetModuleHandleA
PROTO :DWORD
FindWindowA
PROTO :DWORD,:DWORD
LoadIconA
PROTO :DWORD,:DWORD
LoadCursorA
PROTO :DWORD,:DWORD
CreateSolidBrush
PROTO :DWORD
RegisterClassExA
PROTO :DWORD
CreateWindowExA
PROTO :DWORD,:DWORD,:DWORD,:DWORD,:DWORD,:DWORD,:DWORD,
:DWORD,:DWORD,:DWORD,:DWORD,:DWORD
ShowWindow
PROTO :DWORD,:DWORD
UpdateWindow
PROTO :DWORD
GetMessageA
PROTO :DWORD,:DWORD,:DWORD,:DWORD
PeekMessageA
PROTO :DWORD,:DWORD,:DWORD,:DWORD,:DWORD
TranslateMessage
PROTO :DWORD
DispatchMessageA
PROTO :DWORD
PostQuitMessage
PROTO :DWORD
DefWindowProcA
PROTO :DWORD,:DWORD,:DWORD,:DWORD
ExitProcess
PROTO :DWORD
DestroyWindow
PROTO :DWORD
MessageBoxA
PROTO :DWORD,:DWORD,:DWORD,:DWORD
SendMessageA
PROTO :DWORD,:DWORD,:DWORD,:DWORD
PostMessageA
PROTO :DWORD,:DWORD,:DWORD,:DWORD
InvalidateRect
PROTO :DWORD,:DWORD,:DWORD
LoadBitmapA
PROTO :DWORD,:DWORD
DeleteObject
PROTO :DWORD
SetWindowTextA
PROTO :DWORD,:DWORD
GetWindowTextA
PROTO :DWORD,:DWORD,:DWORD
SetFocus
PROTO :DWORD
EnableWindow
PROTO :DWORD,:DWORD
SetWindowLongA
PROTO :DWORD,:DWORD,:DWORD
RegisterHotKey
PROTO :DWORD,:DWORD,:DWORD,:DWORD
GetAsyncKeyState
PROTO :DWORD
LoadStringA
PROTO :DWORD,:DWORD,:DWORD,:DWORD
GetStockObject
PROTO :DWORD
Shell_NotifyIconA
PROTO :DWORD,:DWORD
SetForegroundWindow
PROTO :DWORD
MoveWindow
PROTO :DWORD,:DWORD,:DWORD,:DWORD,:DWORD,:DWORD
lstrcpyA
Sleep

PROTO :DWORD,:DWORD
PROTO :DWORD

CreatePopupMenu
AppendMenuA
GetCursorPos
TrackPopupMenuEx

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

ImageList_Create

PROTO :DWORD,:DWORD,:DWORD,:DWORD,:DWORD
Page 2

td_win32asm_710.asm
ImageList_Add

PROTO :DWORD,:DWORD,:DWORD

SetTimer
KillTimer

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

RasEnumEntriesA
RasGetEntryDialParamsA
RasEnumConnectionsA
RasGetConnectStatusA
RasDialA
RasHangUpA

PROTO
PROTO
PROTO
PROTO
PROTO
PROTO

InitCommonControls
CreateToolbarEx

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

GetLocalTime
GetDateFormatA
GetTimeFormatA

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

GlobalAlloc
GlobalLock
GlobalUnlock
GlobalFree

PROTO
PROTO
PROTO
PROTO

OpenClipboard
EmptyClipboard
SetClipboardData
CloseClipboard

PROTO :DWORD
PROTO
PROTO :DWORD,:DWORD
PROTO

WSAStartup
WSACleanup
socket
closesocket
connect
WSAAsyncSelect
WSAGetLastError
gethostname
gethostbyname
gethostbyaddr
inet_addr
inet_ntoa
htons

PROTO
PROTO
PROTO
PROTO
PROTO
PROTO
PROTO
PROTO
PROTO
PROTO
PROTO
PROTO
PROTO

LoadLibraryA
GetProcAddress
FreeLibrary

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

GetOpenFileNameA
GetSaveFileNameA
CreateFileA
SetFilePointer
ReadFile

PROTO
PROTO
PROTO
PROTO
PROTO

:DWORD,:DWORD,:DWORD,:DWORD,:DWORD
:DWORD,:DWORD,:DWORD
:DWORD,:DWORD,:DWORD
:DWORD,:DWORD
:DWORD,:DWORD,:DWORD,:DWORD,:DWORD,:DWORD
:DWORD

:DWORD,:DWORD
:DWORD
:DWORD
:DWORD

:DWORD,:DWORD
:DWORD,:DWORD,:DWORD
:DWORD
:DWORD,:DWORD,:DWORD
:DWORD,:DWORD,:DWORD,:DWORD
:DWORD,:DWORD
:DWORD
:DWORD,:DWORD,:DWORD
:DWORD
:DWORD
:DWORD

:DWORD
:DWORD
:DWORD,:DWORD,:DWORD,:DWORD,:DWORD,:DWORD,:DWORD
:DWORD,:DWORD,:DWORD,:DWORD
:DWORD,:DWORD,:DWORD,:DWORD,:DWORD
Page 3

WriteFile
CloseHandle

td_win32asm_710.asm
PROTO :DWORD,:DWORD,:DWORD,:DWORD,:DWORD
PROTO :DWORD

GetCurrentThread
SetThreadPriority
CreateThread
CloseHandle
ExitThread

PROTO
PROTO
PROTO
PROTO
PROTO

:DWORD,:DWORD
:DWORD,:DWORD,:DWORD,:DWORD,:DWORD,:DWORD
:DWORD
:DWORD

;==============================================================================
; .const
= the constants area starts here,constants are defined and fixed
;-----------------------------------------------------------------------------.const
; - Parameter MAIN WINDOW CallBack Procedure ( API=RegisterClassExA ) WP1_CallBack
equ [ebp+4]
;return address
WP1_hWnd
equ [ebp+8]
;handle of window who receives message
WP1_uMsg
equ [ebp+12]
;the message number
WP1_wParam
equ [ebp+16]
;extra info about the message
WP1_lParam
equ [ebp+20]
;extra info about the message
;==============================================================================
; .Data
= the data area starts here, datas are defined but not fixed
;-----------------------------------------------------------------------------.Data
MB1_Title
db "Only one Instance allowed",0
MB1_Text
db ">>> Hey, NetSpy is already running. <<<",0
MB2_Title
db "Error on I/O Operation",0
MB2_Text
db "This is not a NetSpy File.",0
MB18_Title
db "About NetSpy v0.07",0
MB18_Text
db "Done by Test Department.",13,10,13,10,"http://surf.to/TestD",0
AviName
db "TDAvi",0
;avi name in resource
IconName
db "TDIcon",0
;icon name in resource
Class
db "aeooarq2309erlo",0 ;name of my window class
WindowName
db "Test Department - http://surf.to/TestD
NetSpy",0
ProgramName
db "NetSpy v0.07",0
;tray name
class_SysListView32
db "SysListView32",0
;predefined class
class_SysAnimate32
db "SysAnimate32",0
;predefined class
class_COMBOBOX
db "COMBOBOX",0
;predefined class
class_STATIC
db "STATIC",0
;predefined class
class_LISTBOX
db "LISTBOX",0
;predefined class
class_EDIT
db "EDIT",0
;predefined class
class_BUTTON
db "BUTTON",0
;predefined class
name_Left
db "TDLeft",0
;left bitmap name in resource
name_Right
db "TDRight",0
;right bitmap name in resource
name_Logo
db "TDLogo",0
;title bitmap name in resource
name_Offline
db "Offline",0
name_Online
db "Online",0
name_Dialing
db "Dialing",0
TrayMenuItemRestore
db "Restore",0
TrayMenuItemExit
db "Exit",0
MainMenuItemCopy
db "Copy to Clipboard",0
MainMenuItemDeleteAll
db "Delete all entries",0
MainMenuItemCancel
db "Cancel",0
Page 4

td_win32asm_710.asm
PScanMenuItemAddItem
PScanMenuItemDelSel
PScanMenuItemDelAll
PScanMenuItemLoad
PScanMenuItemSave
PScanMenuItemCancel

db
db
db
db
db
db

"Add entry",0
"Delete selected entry",0
"Delete all entries",0
"Load Port List",0
"Save Port List",0
"Cancel",0

t_LibaryName
t_GetAdaptersInfo

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

;==========> convert Hex to ASCII string and vice versa


table_ASCII
db 48,49,50,51,52,53,54,55,56,57,65,66,67,68,69,70
table_HEX
db 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15
table_SHIFT
db 28,24,20,16,12,8,4,0
;==========> Date and Time, used by various functions
H0_Date
db "Local Date",0
H1_Time
db "Local Time",0
align 4
;==========> Startup
WsVersion
H0_Startup

dd 0101h
db "NetSpy

;==========> AutoSave
AutoSave_FileName
FileMark_Settings
File_Dummy

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

align 4
;==========> Settings
TimeOut
AutoLog
AutoSave
H0_Settings
H1_Settings
Bu_Settings
W0_Settings
W1_Settings
W2_Settings
W3_Settings
TimeOutMin
Enabled
Disabled

dd
dd
dd
db
db
db
db
db
db
db
db
db
db

2000
1
1
"NetSpy Program Settings",0
"Parameter",0
"Confirm Settings",0
"TimeOut in ms :",0
"TimeOut",0
"AutoLog",0
"AutoSave",0
"10",0
"enabled",0
"disabled",0

;==========> Lookup
H0_Lookup
H1_Lookup
E0_Lookup
Bu_Lookup
W0_Lookup

db
db
db
db
db

"Lookup",0
"Name / IP",0
"Name / IP not found",0
"Lookup",0
"Name / IP :",0

;minimum version requested


Startup",0

align 4
Page 5

td_win32asm_710.asm
;==========> Phonebook
Phonebook_Entries
Phonebook_Password
H0_Phonebook
H1_Phonebook
H2_Phonebook
H3_Phonebook
E0_Phonebook
Bu_Phonebook

dd
dd
db
db
db
db
db
db

0h
0h
"Phonebook",0
"Phone Number",0
"User Name",0
"Password",0
"Phonebook error",0
"Phonebook",0

align 4
;==========> RASDial
RASDial_hThread
RASDial_ThreadID
hrascon
flag_RASDialviaNumber
Flag_Dialing
H0_RASDial
H1_RASDial
H2_RASDial
H3_RASDial
H4_RASDial
E0_RASDial
Bu_RASDial
W0_RASDial
W1_RASDial
W2_RASDial
M0_RASDial
M1_RASDial
M2_RASDial
DialviaNumber

dd
dd
dd
dd
dd
db
db
db
db
db
db
db
db
db
db
db
db
db
db

0h
;thread handle
0h
;thread identifier
0h
0h
0h
"RASDial",0
"Phone Number",0
"User Name",0
"Password",0
"Status",0
"RASDial error",0
"RASDial",0
"Phone Number :",0
"User :",0
"Password :",0
"Dialing",0
"Connect",0
"Failure",0
"Dial via Phone Number",0

;==========> LocalHost
H0_LocalHost
H1_LocalHost
Bu_LocalHost

db "LocalHost",0
db "IP",0
db "Local Host",0

align 4
;==========> ActiveRAS
ActiveRAS_Connections
H0_ActiveRAS
E0_ActiveRAS
Bu_ActiveRAS

dd
db
db
db

align 4
;==========> PortScanner
PortScan_hThread
dd
PortScan_ThreadID
dd
Flag_PortScanAdd
dd
Flag_PortScanTimeOut
dd
Flag_PortScanList
dd
Flag_PortScanDir
dd
Flag_PortScanThread
dd

0h
"Active Modem RAS Connection",0
"No active modem connection",0
"Active RAS",0

0h
0h
0
1
1
1
0

;thread handle
;thread identifier

Page 6

Var_PortListItems
Var_PortListCurrentItem
Var_PortScanCurrentPort
Var_PortScanCounter
Var_PortScanStart
Var_PortScanEnd
Buf_PortScanList
X2_PortScan
X4_PortScan
X6_PortScan
H0_PortScan
H1_PortScan
H2_PortScan
H5_PortScan
E0_PortScan
Bu_PortScan
W1_PortScan
W2_PortScan
W3_PortScan
W4_PortScan
W5_PortScan
W6_PortScan
W7_PortScan
W8_PortPositiveList
M1_PortScan
M2_PortScan
EmptyPortScan
FileMark_PortList
PortFileFilter
PortFileDefExt
PortFileName
PortFileLoadT
PortFileSaveT

dd
dd
dd
dd
dd
dd
dd
db
db
db
db
db
db
db
db
db
db
db
db
db
db
db
db
db
db
db
db
db
db
db
db
db
db

td_win32asm_710.asm
6
0
0
0
1
200
100h dup (0h)
"a.b.c.d",0
"1",0
"200",0
"Port Scanner",0
"Port",0
"Status",0
"Port List",0
"Undefined error",0
"Scan Ports",0
"Name / IP :",0
104h dup (0)
"Start Port :",0
6 dup (0)
"End Port :",0
6 dup (0)
"Scan via Port List",0
"List TimeOuts",0
"Connectable",0
"Function arborted",0
0,0
21h,0BDh,68h,3Ch,0FBh,0B2h,06h,97h,0EAh,13h,70h,72h,74h,30h,30h,37h
"Port List Files (*.prt)",0,"*.prt",0,0
;file filter
"prt",0
;default extension for portlist file
104h dup(0),0
;buffer for filename
"Load Port List",0
;titel filebox
"Save Port List",0
;titel filebox

;==========> Get Adapters Info


M0_GAI
db "OTHER",0
M1_GAI
db "ETHERNET",0
M2_GAI
db "TOKEN_RING",0
M3_GAI
db "FDDI",0
M4_GAI
db "PPP",0
M5_GAI
db "LOOPBACK",0
M6_GAI
db "SLIP",0
M9_GAI
db "UNKNOWN",0
H0_GAI
H1_GAI
;H2_GAI
H3_GAI
H4_GAI
H5_GAI
H6_GAI
Bu_GAI
E0_GAI

db "Description",0
db "MAC address",0
db "Adapter Type",0
db "Current IP address",0
db "Subnet Mask",0
db "Standard Gateway",0
db "DHCP Server",0
db "Get Adapters Info",0
db "Network Interface Card not found",0
Page 7

td_win32asm_710.asm
;==========> Help
H0_Help
H1_Help
Bu_Help
M000_Help
M001_Help
versa.",0
M010_Help
M011_Help
M012_Help
M020_Help
M021_Help
M030_Help
M031_Help
M040_Help
M041_Help
choice.",0
M050_Help
M051_Help
save.",0
M052_Help
M060_Help
M061_Help
M180_Help
M181_Help
unique.",0
M182_Help
M190_Help
M191_Help
M192_Help
M1A0_Help
M1A1_Help
M1A2_Help
Speed, CPU).",0
M1A3_Help
M1B0_Help
M1B1_Help
disconnected.",0
M1B2_Help
MFFF_Help

db
db
db
db
db

"NetSpy Help",0
"Help",0
"About",0
"Lookup",0
" Resolves a Host Name (www.avaible.target.us) into a dotted (aaa.bbb.ccc.ddd) IP address and vice

db "Active Modem RAS Connections",0


db " Shows if there is an active call to a Remote Access Service server via a Phonebook entry.",0
db " It shows also if a Call via a Phonebook entry from outside NetSpy is performed.",0
db
db
db
db
db
db

"Local Host",0
" Get your local Host name and IP address.",0
"Local Phonebook",0
" Shows your local phonebook entries including the User Name and the Password (not on win2k).",0
"Dialup RAS",0
" You can dialup to a Remote Access Service server via a phonebook entry or to a RAS server of your

db "Port Scanner",0
db " Scans a port on a Host in the range you define or via a portlist which you can edit, load and
db
db
db
db
db

" The <Escape> key is the HotKey to abort scanning.",0


"Ping",0
" This function is not avaible yet.",0
"Get Adapters Info, enjoy this powerfull function",0
" It returns the Media Access Control address of your Network Interface Card. This value is worldwide

db
db
db
db
db
db
db

" Additionally you receive your current IP address, the SubNetMask, the default Gateway and more.",0
"General Help",0
" It could happened that this program needs some time to Startup. Kitty ...",0
" I know there is a lot of to do here ...",0
"Program Settings",0
" The AutoLog function is not included yet.",0
" The TimeOut value is used by the PortScanner function, set it (!) to your connection (WAN or LAN,

db " A good TimeOut value for a WAN (Internet) connection is 2000ms, or 20ms for a LAN.",0
db "Hang up RAS",0
db " Disconnects an active Modem RAS connection. Only Connections dialed up from NetSpy are
db " This function do not disconnect a RAS connection via a LAN (Local Area Network).",0
db 0,0,0

;==========> API GetLocalTime


DateFormatPic
db "dd' 'MMM' 'yyyy",0
TimeFormatPic
db "HH':'mm':'ss",0
;==========> API wsprintf
FormatControlString
db "%-01i",0
align 4
;==========> Log File - currently not included / disabled
FileHandle
dd 0h
Page 8

td_win32asm_710.asm
FileReturn
SaveFileN

dd 0h
db "netspy.log",0

TimerBufferSize
BufferSize
UtilityNr
Flag_Logo
Flag_Escape

dd
dd
dd
dd
dd

10000h
10000h
0FFh
0h
0h

;this parameters are changed after


;API call, set it to 10000h again
;current utility selected, 0FFh=no
;logo flag
;escape key flag

align 4
; - RECT structure - ( API=InvalidateRect ) rect_left
dd 04h
;repaint listview area only
rect_top
dd 03Ah
rect_right
dd 0266h
rect_bottom
dd 1B8h
align 4
; - RASDIALPARAMS structure - dial via phonebook entry
rasdial_dwSize
dd 41Ch
;strucsize = strucsize+3
rasdial_szEntryName
db 101h dup (0) ;RAS_MaxEntryName+1
rasdial_szPhoneNumber
db 81h dup (0) ;RAS_MaxPhoneNumber+1
rasdial_szCallbackNumber db 81h dup (0);RAS_MaxCallbackNumber+1
rasdial_szUserName
db 101h dup (0) ;UNLEN+1
rasdial_szPassword
db 101h dup (0) ;PWLEN+1
rasdial_szDomain
db 10h dup (0) ;DNLEN+1
db 03h dup (0) ;DUMMY because strucsize
align 4
; - RASDIALPARAMS structure - dial via phone number
rasdial_dwSizeNr
dd 41Ch
;strucsize = strucsize+3
rasdial_szEntryNameNr
db 101h dup (0) ;RAS_MaxEntryName+1
rasdial_szPhoneNumberNr db 81h dup (0) ;RAS_MaxPhoneNumber+1
rasdial_szCallbackNumberNr db 81h dup (0);RAS_MaxCallbackNumber+1
rasdial_szUserNameNr
db 101h dup (0) ;UNLEN+1
rasdial_szPasswordNr
db 101h dup (0) ;PWLEN+1
rasdial_szDomainNr
db 10h dup (0) ;DNLEN+1
db 03h dup (0) ;DUMMY because strucsize
align 4
; - RASENTRYNAME structure
rasentry_dwSize
dd
rasentry_szEntryName
db
db

108h
;strucsize = strucsize+3
101h dup (0) ;RAS_MaxEntryName+1
03h dup (0) ;DUMMY because strucsize

align 4
; - RASCONN structure rasconn_dwSize
dd 19Ch
rasconn_hrascon
dd 0h
rasconn_szEntryName
db 101h
rasconn_szDeviceType
db 11h
rasconn_szDeviceName
db 81h
db 01h

dup
dup
dup
dup

(0)
(0)
(0)
(0)

;strucsize = strucsize+1
;handle, remote access connection
;RAS_MaxEntryName+1
;RAS_MaxDeviceType+1;if WINVER>=0x400
;RAS_MaxDeviceName+1;if WINVER>=0x400
;DUMMY because strucsize
Page 9

td_win32asm_710.asm
align 4
; - RASCONNSTATUS structure rasstatus_dwSize
dd 0A0h
rasstatus_rasconnstate dd 0h
rasstatus_dwError
dd 0h
rasstatus_szDeviceType dd 11h
rasstatus_szDeviceName dd 81h
db 02h dup (0)
align 4
; - sockaddr_in structure sin_family
dw 0h
sin_port
dw 0h
sin_addr
dd 0h
sin_zero
db 8 dup (0)
align 4
; - OPENFILENAME Structure
lStructSize
dd
hwndOwner
dd
hInstance1
dd
lpstrFilter
dd
lpstrCustomFilter
dd
nMaxCustFilter
dd
nFilterIndex
dd
lpstrFile
dd
nMaxFile
dd
lpstrFileTitle
dd
nMaxFileTitle
dd
lpstrInitialDir
dd
lpstrTitle
dd
Flags
dd
nFileOffset
dw
nFileExtension
dw
lpstrDefExt
dd
lCustData
dd
lpfnHook
dd
lpTemplateName
dd

;strucsize = strucsize+2
;enumerator value
;indicates the reason for failure
;[RAS_MaxDeviceType + 1];
;[RAS_MaxDeviceName + 1];
;DUMMY because strucsize

;in_addr <>

( API=GetOpenFileNameA ) 0h
;the length in bytes of structure
0h
;Id window that owns dialog box
0h
;handle, our program id
0h
;pointer to string + filter
0h
;pointer to user defined filter
0h
;size bytes/characters of above
0h
;filter index of lpstrFilter
0h
;pointer initialize filename, 0=no
0h
;size bytes/characters of above
0h
;pointer title of the selected file
0h
;size of the lpstrFileTitle buffer
0h
;pointer string init file dir,0=default
0h
;pointer title of the box
0h
;the dialog box creation flags
0h
;offset filename in string lpstrFile
0h
;offset extension in string lpstrFile
0h
;? pointer default extension of file
0h
;?
0h
;? used if flag is OFN_ENABLETEMPLATE
0h
;? used if flag is OFN_ENABLETEMPLATE

align 4
; - TBBUTTON structure ( API=CreateToolbarEx ) - ARRAY !!!
iBitmap_s00
dd 0h
;zero-based index of button image
idCommand_s00
dd 0h
;ID or, if fsStyle=TBSTYLE_SEP, zero
fsState_s00
db 4h
;state flags, 4h=TBSTATE_ENABLED
fsStyle_s00
db 1h
;button style, 1h=TBSTYLE_SEP
bReserved_s00
db 2h dup (0)
;reserved bytes, error in WIN32.HLP ?
dwData_s00
dd 0h
;application-defined value
iString_s00
dd 0h
;zero-based index of button string
iBitmap_s01
dd 0h,0h
db 4h,1h,0h,0h
dd 0h,0h
iBitmap_s02
dd 0h,0h
db 4h,1h,0h,0h
dd 0h,0h
Page 10

td_win32asm_710.asm
iBitmap_s03
iBitmap_s04
iBitmap_s05
iBitmap_s06
iBitmap_s07
iBitmap_s08
iBitmap_s09
iBitmap_s10
iBitmap_s11
iBitmap_s12
iBitmap_s13
iBitmap_s14
iBitmap_900
iBitmap_901
iBitmap_902
iBitmap_903
iBitmap_904
iBitmap_905

dd
db
dd
dd
db
dd
dd
db
dd
dd
db
dd
dd
db
dd
dd
db
dd
dd
db
dd
dd
db
dd
dd
db
dd
dd
db
dd
dd
db
dd
dd
db
dd
dd
db
dd
dd
db
dd
dd
db
dd
dd
db
dd
dd
db
dd
dd
db

0h,0h
4h,1h,0h,0h
0h,0h
0h,0h
4h,1h,0h,0h
0h,0h
0h,0h
4h,1h,0h,0h
0h,0h
0h,0h
4h,1h,0h,0h
0h,0h
0h,0h
4h,1h,0h,0h
0h,0h
0h,0h
4h,1h,0h,0h
0h,0h
0h,0h
4h,1h,0h,0h
0h,0h
0h,0h
4h,1h,0h,0h
0h,0h
0h,0h
4h,1h,0h,0h
0h,0h
0h,0h
4h,1h,0h,0h
0h,0h
0h,0h
4h,1h,0h,0h
0h,0h
0h,0h
4h,1h,0h,0h
0h,0h
0h,900h
4h,0h,0h,0h
0h,0h
1h,901h
4h,0h,0h,0h
0h,0h
2h,902h
4h,0h,0h,0h
0h,0h
3h,903h
4h,0h,0h,0h
0h,0h
4h,904h
4h,0h,0h,0h
0h,0h
5h,905h
4h,0h,0h,0h
Page 11

td_win32asm_710.asm
iBitmap_906
iBitmap_907
iBitmap_908
iBitmap_909
iBitmap_90A
iBitmap_90B
iBitmap_90C
iBitmap_90D
iBitmap_s20
iBitmap_s21
iBitmap_s22
iBitmap_s23
iBitmap_s24
iBitmap_s25
iBitmap_s26
iBitmap_s27
iBitmap_s28
iBitmap_s29

dd
dd
db
dd
dd
db
dd
dd
db
dd
dd
db
dd
dd
db
dd
dd
db
dd
dd
db
dd
dd
db
dd
dd
db
dd
dd
db
dd
dd
db
dd
dd
db
dd
dd
db
dd
dd
db
dd
dd
db
dd
dd
db
dd
dd
db
dd
dd

0h,0h
6h,906h
4h,0h,0h,0h
0h,0h
7h,907h
4h,0h,0h,0h
0h,0h
8h,908h
4h,0h,0h,0h
0h,0h
9h,909h
4h,0h,0h,0h
0h,0h
0Ah,90Ah
4h,0h,0h,0h
0h,0h
0Bh,90Bh
4h,0h,0h,0h
0h,0h
0Ch,90Ch
4h,0h,0h,0h
0h,0h
0Dh,90Dh
24h,0h,0h,0h
0h,0h
0h,0h
4h,1h,0h,0h
0h,0h
0h,0h
4h,1h,0h,0h
0h,0h
0h,0h
4h,1h,0h,0h
0h,0h
0h,0h
4h,1h,0h,0h
0h,0h
0h,0h
4h,1h,0h,0h
0h,0h
0h,0h
4h,1h,0h,0h
0h,0h
0h,0h
4h,1h,0h,0h
0h,0h
0h,0h
4h,1h,0h,0h
0h,0h
0h,0h
4h,1h,0h,0h
0h,0h
0h,0h
Page 12

td_win32asm_710.asm
iBitmap_s30
iBitmap_s31
iBitmap_s32
iBitmap_s33
iBitmap_s34
iBitmap_90E
iBitmap_90F
iBitmap_910
iBitmap_911
iBitmap_912
iBitmap_913
iBitmap_914
iBitmap_915
iBitmap_916
iBitmap_917
iBitmap_918
iBitmap_919

db
dd
dd
db
dd
dd
db
dd
dd
db
dd
dd
db
dd
dd
db
dd
dd
db
dd
dd
db
dd
dd
db
dd
dd
db
dd
dd
db
dd
dd
db
dd
dd
db
dd
dd
db
dd
dd
db
dd
dd
db
dd
dd
db
dd
dd
db
dd

4h,1h,0h,0h
0h,0h
0h,0h
4h,1h,0h,0h
0h,0h
0h,0h
4h,1h,0h,0h
0h,0h
0h,0h
4h,1h,0h,0h
0h,0h
0h,0h
4h,1h,0h,0h
0h,0h
0h,0h
4h,1h,0h,0h
0h,0h
0Eh,90Eh
4h,0h,0h,0h
0h,0h
0Fh,90Fh
4h,0h,0h,0h
0h,0h
10h,910h
4h,0h,0h,0h
0h,0h
11h,911h
4h,0h,0h,0h
0h,0h
12h,912h
4h,0h,0h,0h
0h,0h
13h,913h
4h,0h,0h,0h
0h,0h
14h,914h
4h,0h,0h,0h
0h,0h
15h,915h
4h,0h,0h,0h
0h,0h
16h,916h
4h,0h,0h,0h
0h,0h
17h,917h
4h,0h,0h,0h
0h,0h
18h,918h
4h,0h,0h,0h
0h,0h
19h,919h
4h,0h,0h,0h
0h,0h
Page 13

td_win32asm_710.asm
iBitmap_91A
iBitmap_91B

dd
db
dd
dd
db
dd

1Ah,91Ah
4h,0h,0h,0h
0h,0h
1Bh,91Bh
4h,0h,0h,0h
0h,0h

;==============================================================================
; .Data?
= the data? area starts here, not defined and not fixed
;-----------------------------------------------------------------------------.data?
hWnd_Toolbar
dd ?
;handle toolbar
hWnd_Left
dd ?
;handle static window, left picture
hWnd_Right
dd ?
;handle static window, right picture
hWnd_LV_Startup
dd ?
;handle listview window
hWnd_LV_Phonebook
dd ?
;handle listview window
hWnd_LV_Lookup
dd ?
;handle listview window
hWnd_LV_LocalHost
dd ?
;handle listview window
hWnd_LV_ActiveRAS
dd ?
;handle listview window
hWnd_LV_RASDial
dd ?
;handle listview window
hWnd_LV_PortScan
dd ?
;handle listview window
hWnd_LV_PortList
dd ?
;handle listview window
hWnd_LV_GAI
dd ?
;handle listview window
hWnd_LV_Settings
dd ?
;handle listview window
hWnd_LV_Help
dd ?
;handle listview window
hWnd_GROUPBOX_Work
dd ?
;handle groupbox window, working area
hWnd_Work1
dd ?
;handle edit windows, working area
hWnd_Work2
dd ?
hWnd_Work3
dd ?
hWnd_Work4
dd ?
hWnd_Work5
dd ?
hWnd_Work6
dd ?
hWnd_Work7
dd ?
hWnd_Work8
dd ?
hWnd_Logo
dd ?
;handle static window, logo
hWnd_GROUPBOX_Button
dd ?
;handle groupbox window, button area
hWnd_Action
dd ?
;handle button window, action button
hWnd_GROUPBOX_LED
dd ?
;handle groupbox window, LED area
hWnd_LED
dd ?
;handle static window, LED area
hObj_Online
dd ?
;handle graphic object, LED online
hObj_Offline
dd ?
;handle graphic object, LED offline
hObj_Dialing
dd ?
;handle graphic object, LED dialing
hObj_Toolbar
dd ?
;handle graphic object, Toolbar
hWnd_GROUPBOX_Video
dd ?
;handle groupbox window, video area
hWnd_Animate
dd ?
;handle animate control window
hFont
dd ?
;handle Font
hTrayPopup
dd ?
;handle popup menu tray
hMainPopup
dd ?
;handle popup menu listview window
hPortListPopup
dd ?
;handle popup menu portlist
hImageList_Help
dd ?
;handle image list
h_Memory
p_Memory

dd ?
dd ?

;handle global memory object


;pointer global memory
Page 14

td_win32asm_710.asm
h_iphlpapiDLL
p_GetAdaptersInfo

dd ?
dd ?

;handle of library iphlpapi.dll


;pointer to function in DLL

socketDesc
IP

dd ?
dd ?

;socket descriptor
;IP

temp
counter
counter1

dd ?
dd ?
dd ?

;var, current listview handle


;var, temporary used
;var, temporary used

TimerBuffer
Buffer
SocketMsgBuffer
FileBuffer
MiscBuffer

db
db
db
db
db

10000h dup(?);buffer
10000h dup(?);buffer
104h dup(?) ;buffer
104h dup(?) ;filename buffer
104h dup(?) ;another buffer

align 4
; - WndClassEx Structure ( API=RegisterClassExA ) cbSize
dd ?
;size in bytes of this structure
style
dd ?
;window style
lpfnWndProc
dd ?
;address of user proc function
cbclsExtra
dd ?
;extra bytes to allocate set to 0
cbWndExtra
dd ?
;extra bytes class directive, rc file
hInstance
dd ?
;program handle(API=GetModuleHandleA)
hIcon
dd ?
;handle of icon (API=LoadIconA)
hcursor
dd ?
;handle of cursor (API=LoadCursor)
hbrBackground
dd ?
;background color, 0=transparent
lpszMenuName
dd ?
;name of menu class in resource file
lpszClassName
dd ?
;name of windows this window class
hIconSm
dd ?
;iconhandle 0=search in resource file
hdcDest
dd ?
;handle of dest. device context
align 4
; - Msg Structure ( API=GetMessageA ) - member POINT = POINT structure
hWnd
dd ?
;handle of window who receives message
message
dd ?
;the message number
wParam
dd ?
;extra info about the message
lParam
dd ?
;extra info about the message
time
dd ?
;time the message was posted
xpt
dd ?
;cursor x-position, POINT struc
ypt
dd ?
;cursor x-position, POINT struc
; - POINT Structure ( API=GetCursorPos ) point_xpt
dd ?
;cursor x-position, POINT struc
point_ypt
dd ?
;cursor x-position, POINT struc
align 4
; - NOTIFYICONDATA Structure ( API=Shell_NotifyIcon ) nid_cbSize
dd ?
;size of (NOTIFYICONDATA)
nid_hWnd
dd ?
;handle for icon notification messages
nid_uID
dd ?
;Application-defined ID taskbar icon
nid_uFlags
dd ?
;flags which structure data are valid
Page 15

nid_uCallbackMessage
nid_hIcon
nid_szTip

dd ?
dd ?
db 64 dup(?)

align 4
; - _LV_COLUMN structure LVC_mask
dd ?
LVC_fmt
dd ?
LVC_cx
dd ?
LVC_pszText
dd ?
LVC_cchTextMax
dd ?
LVC_iSubItem
dd ?
align 4
; - _LV_ITEM structure LVI_mask
dd ?
LVI_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 ?
wMonth
dw ?
wDayOfWeek
dw ?
wDay
dw ?
wHour
dw ?
wMinute
dw ?
wSecond
dw ?
wMilliseconds
dw ?

td_win32asm_710.asm
;identifier for notification messages
;handle icon to add, modify or delete
;tooltip text displays for taskbar icon

;look into Win32.hlp

;look into Win32.hlp

;look into Win32.hlp

align 4
; - WSADATA structure wsa_wVersion
dw ?
;look into Win32.hlp
wsa_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
;-----------------------------------------------------------------------------.Code
Main:
;==============================================================================
Page 16

td_win32asm_710.asm
; Always get your program ID first (API=GetModuleHandleA)
;-----------------------------------------------------------------------------push
0h
;lpModuleHandle, 0=get program handle
call
GetModuleHandleA
;- API Function mov
hInstance,eax
;return value in eax=handle of program
;==============================================================================
; FindWindow function retrieves the handle of the top-level window whose
; class name and window name match the specified strings, only one instance
;-----------------------------------------------------------------------------push
OFFSET WindowName
;lpWindowName, address of window name
push
OFFSET Class
;lpClassName, address of class name
call
FindWindowA
;- API Function cmp
eax,0h
je
RunPrg
;OK, no previous instance running
;-----------------------------------------------------------------------------; API "MessageBoxA" creates a message box
;-----------------------------------------------------------------------------push
10h
;uType,style,0=MB_OK Button,10h=MB_ICONSTOP
push
OFFSET MB1_Title
;lpCaption,pointer to title text
push
OFFSET MB1_Text
;lpText,pointer to text message box
push
eax
;handle of owner window
call
MessageBoxA
;- API Function jmp
ExitPrg
RunPrg:
;==============================================================================
; API "CreateToolbarEx" is part of common controls, force init...
;-----------------------------------------------------------------------------call
InitCommonControls
;- API Function ;==============================================================================
; API LoadLibraryA maps the specified exe or dll module into the address space
; of the calling process.
;-----------------------------------------------------------------------------push
OFFSET t_LibaryName
;lpLibFileName, pointer filename module
call
LoadLibraryA
;- API Function cmp
eax,0h
;check if return value 0h=ERROR
je
ExitPrg
mov
h_iphlpapiDLL,eax
;store handle of library in variable
;-----------------------------------------------------------------------------; API "GetProcAddress" gets the address of the specified function
;-----------------------------------------------------------------------------push
OFFSET t_GetAdaptersInfo
;pProcName, name of function
push
h_iphlpapiDLL
;hModule, handle to DLL module
call
GetProcAddress
;- API Function cmp
eax,0h
;check if return value 0h=ERROR
je
TerminatePrg
;if no error goto LABEL
mov
p_GetAdaptersInfo,eax
;store pointer to function in libary
;==============================================================================
; The API function "RegisterClassExA" registers a window class.
; This API needs a "WNDCLASSEX" structure so we fill it with correct values.
Page 17

td_win32asm_710.asm
;-----------------------------------------------------------------------------mov
cbSize,30h
;size in bytes of WNDCLASSEX structure
mov
style,3h
;window style
mov
lpfnWndProc,OFFSET WP1
;address of user lpfnWndProc function
mov
cbclsExtra,0h
;extra bytes to allocate set to 0
mov
cbWndExtra,0h
;class directive in rc file
mov
hbrBackground,10h
;background color
mov
lpszMenuName,0h
;menu name in resource file,0=no menu
mov
lpszClassName,OFFSET Class ;name of windows class
mov
hIconSm,0h
;iconhandle 0=search in rc file
;-----------------------------------------------------------------------------; API "LoadIconA" loads an icon defined in the resource file and stores the
; handle in the "WNDCLASSEX" structure
;-----------------------------------------------------------------------------push
OFFSET IconName
;icon-string or icon resource id
push
hInstance
;our program handle
call
LoadIconA
;- API Function mov
hIcon,eax
;store handle of newly loaded icon
;-----------------------------------------------------------------------------; API "LoadCursorA" loads a default system cursor, in this case we must set
; hInstance to 0 and lpCursorName to a default system cursor value, here 32512
; Then we store the cursor handle in the "WNDCLASSEX" structure
;-----------------------------------------------------------------------------push
32512
;lpCursorName, default value in dezimal
push
0h
;hInstance, 0=default system cursor
call
LoadCursorA
;- API Function mov
hcursor,eax
;store handle of the cursor
;-----------------------------------------------------------------------------; Now, after filled the "WNDCLASSEX" structure we call API "RegisterClassEx"
;-----------------------------------------------------------------------------push
OFFSET cbSize
;pointer to WNDCLASSEX structure
call
RegisterClassExA
;- API Function ;==============================================================================
; API "CreateWindowExA" creates an overlapped, pop-up, or child window with an
; extended style. The return value in EAX is the handle of the new window.
; This API sends a WM_CREATE message to the window procedure (WP1).
;-----------------------------------------------------------------------------push
0h
;lpParam, extra pointer data 0=no data
push
hInstance
;hInstance, handle of our program
push
0h
;hMenu, handle window menu 0=class menu
push
0h
;hWndParent, handle parent window 0=no
push
22Eh
;intnHeight, window height pixel
push
270h
;intnWidth, window width pixel
push
10h
;inty, vertical position window
push
60h
;intx, horizontal position window
push
04CA0000h
;dwStyle, look into WIN32.HLP
push
OFFSET WindowName
;lpWindowName, pointer to window name
push
OFFSET Class
;lpClassName, pointer to class name
push
0108h
;dwExStyle, extra window style 0=no
call
CreateWindowExA
;- API Function mov
hWnd,eax
;hwnd,return value=handle of window
Page 18

td_win32asm_710.asm
LoopGetMessage:
;==============================================================================
; API "GetMessageA" retrieves a message + places it in the specified structure.
;-----------------------------------------------------------------------------push
0h
;wMsgFilterMax, highest message value
push
0h
;wMsgFilterMin, lowest message value
push
0h
;hWnd, handle of window who gets msg.
push
OFFSET hWnd
;lpMsg, pointer to MSG structure
call
GetMessageA
;- API Function cmp
eax,0h
;check if return value=0 (exit)
je
TerminatePrg
;if return value is 0 goto LABEL
;==============================================================================
; API "TranslateMessage" translates virtual-key messages in character messages
;-----------------------------------------------------------------------------push
OFFSET hWnd
;lpMSG, pointer to msg structure
call
TranslateMessage
;- API Function - keyboard code
;==============================================================================
; API "DispatchMessageA" function dispatches a message to a window procedure.
;-----------------------------------------------------------------------------push
OFFSET hWnd
;lpMSG, pointer to msg structure
call
DispatchMessageA
;- API Function jmp
LoopGetMessage
;check for message again, goto LABEL
TerminatePrg:
;==============================================================================
; API FreeLibrary unmaps the modul from address space of the calling process
; Free the library if loaded (!) even if the called function not exist (!)
;-----------------------------------------------------------------------------push
h_iphlpapiDLL
;hLibModule, handle loaded lib. module
call
FreeLibrary
;- API Function ;==============================================================================
; API "WSACleanup" terminates use of the Windows Sockets DLL.
;-----------------------------------------------------------------------------call
WSACleanup
;- API Function ExitPrg:
;==============================================================================
; Next we terminate our program (API=ExitProcess)
;-----------------------------------------------------------------------------push
hInstance
;push our programm handle to exit
call
ExitProcess
;- API Function ;##############################################################################
; The Window Procedure (API=RegisterClassExA) for this registered window.
;-----------------------------------------------------------------------------WP1:
push
ebp
;create stack frame
mov
ebp,esp
pushad
;push all register to the stack
mov
eax,WP1_uMsg
;move the message number to eax
Page 19

td_win32asm_710.asm
;==============================================================================
; WM_CREATE (value=01h) message received ?
;-----------------------------------------------------------------------------WP1_uMsg_01h:
cmp
eax,1h
;check if WM_CREATE message recieved
jne
WP1_uMsg_02h
;if not goto LABEL
;-----------------------------------------------------------------------------; API "GetStockObject" gets a handle to predefined stock pens,brushes,fonts ...
;-----------------------------------------------------------------------------push
17
;fnObject, type of object, DEFAULT_GUI_FONT
call
GetStockObject
;- API Function mov
hFont,eax
;handle of font
;-----------------------------------------------------------------------------; API "RegisterHotKey" defines a hot key for the current thread
;-----------------------------------------------------------------------------push
1Bh
;uVirtKey, virtual-key code, VK_ESCAPE=1Bh
push
0h
;fuModifiers, key-modifier flags
push
0B00h
;idHotKey, identifier of hot key
push
WP1_hWnd
;hwnd, window receive hot-key notification
call
RegisterHotKey
;- API Function call
My_InitProgram
;- SubRoutine call
My_Create_MainWindow
;- SubRoutine call
My_Create_Logo
;- SubRoutine call
My_Create_LV_Startup
;- SubRoutine call
My_Create_LV_Phonebook
;- SubRoutine call
My_Create_LV_Lookup
;- SubRoutine call
My_Create_LV_LocalHost
;- SubRoutine call
My_Create_LV_ActiveRAS
;- SubRoutine call
My_Create_LV_RASDial
;- SubRoutine call
My_Create_LV_PortScan
;- SubRoutine call
My_Create_LV_GAI
;- SubRoutine call
My_Create_LV_Settings
;- SubRoutine call
My_Create_LV_Help
;- SubRoutine ;-----------------------------------------------------------------------------; API "WSAStartup" can thus be used for initialization purposes. (Wsock32.dll)
;-----------------------------------------------------------------------------push
OFFSET wsa_wVersion
;lpWSAData, pointer WSADATA data structure
push
WsVersion
;wVersionRequested, version Windows Sockets
call
WSAStartup
;- API Function mov
eax,0h
;get highest version DLL supports
mov
ax,wsa_wHighVersion
mov
counter,eax
;-----------------------------------------------------------------------------; API "WSACleanup" terminates use of the Windows Sockets DLL.
;-----------------------------------------------------------------------------call
WSACleanup
;- API Function ;-----------------------------------------------------------------------------; API "WSAStartup" can thus be used for initialization purposes. (Wsock32.dll)
;-----------------------------------------------------------------------------push
OFFSET wsa_wVersion
;lpWSAData, pointer WSADATA data structure
push
counter
;wVersionRequested, version Windows Sockets
call
WSAStartup
;- API Function Page 20

td_win32asm_710.asm
;-----------------------------------------------------------------------------; API "gethostbyname" gets host information corresponding to a host name.
;-----------------------------------------------------------------------------push
OFFSET W2_PortScan
;name, pointer to the name of the host
call
gethostbyname
;- API Function ;-----------------------------------------------------------------------------; API "gethostname" returns the standard host name for the local machine
;-----------------------------------------------------------------------------push
104h
;namelen, the length of the buffer
push
OFFSET Buffer
;name, pointer buffer receiving host name
call
gethostname
;- API Function cmp
eax,0h
;error ?
jne
WM_CREATE_Return
;-----------------------------------------------------------------------------; API "lstrcpyA" copy's a string from source to destination.
;-----------------------------------------------------------------------------push
OFFSET Buffer
;source address of string
push
OFFSET W2_PortScan
;destination address
call
lstrcpyA
;- API Function WM_CREATE_Return:
call
My_Run_Startup
;- SubRoutine ;-----------------------------------------------------------------------------; API "ShowWindow" function sets the specified window's show state.
;-----------------------------------------------------------------------------push
1h
;nCmdShow, show state 1=SW_NORMAL
push
WP1_hWnd
;hwnd, handle of window
call
ShowWindow
;- API Function ;-----------------------------------------------------------------------------; API "UpdateWindow" updates the area of the specified window by sending a
; WM_PAINT message to the window if the window's update region is not empty.
;-----------------------------------------------------------------------------push
WP1_hWnd
;hwnd, handle of window
call
UpdateWindow
;- API Function jmp
WP1_return
;==============================================================================
; WM_DESTROY (value=02h) message received ?
;-----------------------------------------------------------------------------WP1_uMsg_02h:
cmp
eax,2h
;check if value=2h (WM_DESTROY)
jne
WP1_uMsg_05h
;if not 2h go to LABEL
call
My_CleanSystem
;- SubRoutine ;-----------------------------------------------------------------------------; API "PostQuitMessage" indicates to Windows a request to terminate
;-----------------------------------------------------------------------------push
0h
;nExitCode, exit code=wParam
call
PostQuitMessage
;- API Function popad
;pop all register back from stack
xor
eax,eax
;set eax to 0 to exit our program
mov
esp,ebp
;delete stack frame
pop
ebp
ret
10h
;return and clear stack
Page 21

td_win32asm_710.asm
;==============================================================================
; WM_Size (value=05h) message, used to resize the window area
;-----------------------------------------------------------------------------WP1_uMsg_05h:
cmp
eax,05h
;check if WP_SIZE message recieved
jne
WP1_uMsg_0Fh
;if not goto label
;-----------------------------------------------------------------------------; API "SendMessageA" sends a message, TB_AUTOSIZE to fit toolbar and bitmaps
;-----------------------------------------------------------------------------push
0h
;lParam, second message parameter
push
0h
;wParam, first message parameter (ID)
push
421h
;uMsg, send TB_AUTOSIZE message
push
hWnd_Toolbar
;hwnd, handle of destination window
call
SendMessageA
;- API Function mov
eax,WP1_wParam
;extra info about message
cmp
ax,01h
;SIZE_MINIMIZED=1h
jne
WP1_return
;if not 1h goto LABEL
call
My_ScreenToTray
;- SubRoutine jmp
WP1_return
;==============================================================================
; WM_PAINT (value=0Fh) message, used to repaint the window area
;-----------------------------------------------------------------------------WP1_uMsg_0Fh:
cmp
eax,0Fh
;check if WM_PAINT message recieved
jne
WP1_uMsg_4Eh
;if not goto label
jmp

WP1_return

;==============================================================================
; WM_NOTIFY (value=4Eh) message, here used to show the toolbar tip !
; With a WM_NOTIFY message Windows gives you pointer to a NMHDR structure.
;-----------------------------------------------------------------------------WP1_uMsg_4Eh:
cmp
eax,4Eh
;check if WM_NOTIFY message recieved
jne
WP1_uMsg_7Eh
;if not goto label
mov
ebx,WP1_lParam
;pointer to struc, given by windows !
;-----------------------------------------------------------------------------; The NMHDR structure contains information about a notification message.
; The POINTER to this structure is specified as lParam member of WM_NOTIFY.
; This POINTER is given to us with the WM_NOTIFY message by Windows.
; hwndFrom = [WP1_lParam+0]
;handle to control sending message
; idFrom
= [WP1_lParam+4]
;identifier of control sending message
; code
= [WP1_lParam+8]
;notification code
;-----------------------------------------------------------------------------mov
eax,[ebx+0]
;get the handle of the control sending msg.
mov
temp,eax
;store ListView handle for future use
cmp
eax,hWnd_LV_Startup
;is control=ListView = Startup ?
je
Notify_LV_Main
;yes, goto ListView
cmp
eax,hWnd_LV_Lookup
;is control=ListView = Lookup ?
je
Notify_LV_Main
;yes, goto ListView
cmp
eax,hWnd_LV_Phonebook
;is control=ListView = Phonebook ?
Page 22

td_win32asm_710.asm
je
Notify_LV_Main
;yes, goto ListView
cmp
eax,hWnd_LV_LocalHost
;is control=ListView = LocalHost ?
je
Notify_LV_Main
;yes, goto ListView
cmp
eax,hWnd_LV_ActiveRAS
;is control=ListView = ActiveRAS ?
je
Notify_LV_Main
;yes, goto ListView
cmp
eax,hWnd_LV_RASDial
;is control=ListView = RASDIAL ?
je
Notify_LV_Main
;yes, goto ListView
cmp
eax,hWnd_LV_PortScan
;is control=ListView = PORTSCANNER ?
je
Notify_LV_Main
;yes, goto ListView
cmp
eax,hWnd_LV_GAI
;is control=ListView = NICMAC ?
je
Notify_LV_Main
;yes, goto ListView
cmp
eax,hWnd_LV_Settings
;is control=ListView = SETTINGS ?
je
Notify_LV_Main
;yes, goto ListView
cmp
eax,hWnd_LV_PortList
;is control=LISTVIEW = PORTSCANNER,PORTLIST
je
Notify_LV_PortList
;yes, goto ListView ==> (PORTLIST)
;-----------------------------------------------------------------------------; The TOOLTIPTEXT structure identifies a tool for which text is to be displayed
; and receives the text for the tool. We must fill it with the CORRECT values !
; hdr
= placeholder for NMHDR ;required for all WM_NOTIFY messages
; lpszText = [WP1_lParam+12]
;Pointer string or resource ID
; szText[80]= [WP1_lParam+16]
;buffer for text, alternate to lpszText
; hinst
= [WP1_lParam+20]
;handle instance, 0 if lpszText=pointer
; uFlags
= [WP1_lParam+24]
;Flag indicates how to interpret idFrom
;-----------------------------------------------------------------------------mov
eax,[ebx+8]
;move code ( NMHDR structure ) into eax
cmp
eax,0FFFFFDF8h
;check if code TTN_NEEDTEXT received
jne
WP1_return
;if not goto label
mov
eax,[ebx+4]
;move idFrom ( NMHDR structure ) to eax
cmp
eax,900h
;first identifier in TBBUTTON structure
jb
WP1_return
cmp
eax,91Bh
;last identifier in TBBUTTON structure
ja
WP1_return
mov
[ebx+12],eax
;store resource ID of tooltiptext
mov
eax,hInstance
mov
[ebx+20],eax
;store modul instance
jmp
WP1_return
;-----------------------------------------------------------------------------Notify_LV_Main:
;-----------------------------------------------------------------------------; The NM_LISTVIEW structure contains infos about a list view notification msg.
; hdr
= placeholder for NMHDR ;required for all WM_NOTIFY messages
; iItem
= [WP1_lParam+12]
;list view item, or -1 if not used
; iSubItem = [WP1_lParam+16]
;subitem, or zero if none
; uNewState = [WP1_lParam+20]
;new item state, if not used 0
; uOldState = [WP1_lParam+24]
;old item state, if not used 0
; uChanged = [WP1_lParam+28]
;item attributes that have changed
; ptAction = [WP1_lParam+32]
;location event occurred, xpos, POINT struc
;
= [WP1_lParam+36]
;location event occurred, ypos, POINT struc
; lParam
= [WP1_lParam+40]
;32 bit value of your choice
;-----------------------------------------------------------------------------mov
eax,[ebx+8]
;move code ( NMHDR structure ) into eax
cmp
eax,0FFFFFF94h
;is code LVN_FIRST | LVN_COLUMNCLICK
Page 23

td_win32asm_710.asm
jne
WP1_return
;if not skip
call
My_SetFocus_ListView
;- SubRoutine ;-----------------------------------------------------------------------------; API "SendMessageA" sends a message to the window
;-----------------------------------------------------------------------------push
1h
;lParam, LVNI_FOCUSED=1h, LVNI_SELECTED=2h
push
-1
;wParam,index item begin search or -1 first
push
100Ch
;uMsg, LVM_FIRST=1000h | LVM_GETNEXTITEM=12
push
temp
;hwnd, handle of destination window
call
SendMessageA
;- API Function mov
ecx,[ebx+16]
mov
LVI_iSubItem,ecx
mov
LVI_pszText,OFFSET Buffer
mov
LVI_cchTextMax,104h
;-----------------------------------------------------------------------------; API "SendMessageA" sends a message to the window
;-----------------------------------------------------------------------------push
OFFSET LVI_mask
;lParam, pcol, pointer LV_ITEM structure
push
eax
;wParam, Index of the list view item
push
102Dh
;uMsg, LVM_FIRST=1000h | LVM_GETITEMTEXT=45
push
temp
;hwnd, handle of destination window
call
SendMessageA
;- API Function cmp
eax,0h
;error ?, NULL string
je
WP1_return
;-----------------------------------------------------------------------------; API "GetCursorPos" retrieves the cursor's position, in screen coordinates.
;-----------------------------------------------------------------------------push
OFFSET xpt
;pointer to POINT structure
call
GetCursorPos
;- API Function ;-----------------------------------------------------------------------------; API "TrackPopupMenuEx" displays a floating pop-up menu at the specified
; location and tracks the selection of items on the pop-up menu.
; The floating pop-up menu can appear anywhere on the screen.
;-----------------------------------------------------------------------------push
0h
;lptpm,Pointer TPMPARAMS structure,0=no
push
WP1_hWnd
;hWnd, handle of owner window
push
ypt
;y, vertical position
push
xpt
;x, horizontal position
push
0h
;fuFlags, TPM_RIGHTALIGN=8,TPM_LEFTBUTTON=0
push
hMainPopup
;handle of popup menu
call
TrackPopupMenuEx
;- API Function jmp
WP1_return
Notify_LV_PortList:
mov
eax,[ebx+8]
;move code ( NMHDR structure ) into eax
cmp
eax,0FFFFFF94h
;is code LVN_FIRST | LVN_COLUMNCLICK
jne
PortList_LVN_BEGINLABELEDIT ;if not skip
call
My_SetFocus_ListView
;- SubRoutine ;-----------------------------------------------------------------------------; API "GetCursorPos" retrieves the cursor's position, in screen coordinates.
;-----------------------------------------------------------------------------push
OFFSET xpt
;pointer to POINT structure
call
GetCursorPos
;- API Function Page 24

td_win32asm_710.asm
;-----------------------------------------------------------------------------; API "TrackPopupMenuEx" displays a floating pop-up menu at the specified
; location and tracks the selection of items on the pop-up menu.
; The floating pop-up menu can appear anywhere on the screen.
;-----------------------------------------------------------------------------push
0h
;lptpm,Pointer TPMPARAMS structure,0=no
push
WP1_hWnd
;hWnd, handle of owner window
push
ypt
;y, vertical position
push
xpt
;x, horizontal position
push
0h
;fuFlags, TPM_RIGHTALIGN=8,TPM_LEFTBUTTON=0
push
hPortListPopup
;handle of popup menu
call
TrackPopupMenuEx
;- API Function jmp
WP1_return
PortList_LVN_BEGINLABELEDIT:
;-----------------------------------------------------------------------------; The LV_DISPINFO structure contains infos about a list view notification msg.
; hdr
= placeholder for NMHDR ;required for all WM_NOTIFY messages
; mask
= [WP1_lParam+12]
;bit flags, specify attributes of structure
; iItem
= [WP1_lParam+16]
;item that this structure refers to
; iSubItem = [WP1_lParam+20]
;subitem, or zero if none
; state
= [WP1_lParam+24]
;current state of the item
; statemask = [WP1_lParam+28]
;the valid states of the item
; pszText
= [WP1_lParam+32]
;pointer string that contains the item text
; cchTextMax= [WP1_lParam+36]
;size of buffer pointed to by the pszText
; iImage
= [WP1_lParam+40]
;index of list view item's icon in the icon
;-----------------------------------------------------------------------------mov
eax,[ebx+8]
;move code ( NMHDR structure ) into eax
cmp
eax,0FFFFFF97h
;is code LVN_FIRST | LVN_BEGINLABELEDIT
jne
PortList_LVN_ENDLABELEDIT
cmp
Var_PortListItems,100h
jae
PortList_LVN_ENDLABELEDIT_0
;-----------------------------------------------------------------------------; API "SendMessageA" sends a message to the window, get the selected handle
;-----------------------------------------------------------------------------push
0h
;lParam, set to 0
push
0h
;wParam, set to 0
push
1018h
;uMsg, LVM_FIRST | LVM_GETEDITCONTROL
push
hWnd_LV_PortList
;hwnd, handle of destination window
call
SendMessageA
;- API Function ;-----------------------------------------------------------------------------; API "SendMessageA" sends a message to the window, limit max. chars to enter
;-----------------------------------------------------------------------------push
0h
;lParam, not used, must be 0
push
5h
;wParam, cchMax, text length in characters
push
0C5h
;uMsg, EM_LIMITTEXT=EM_SETLIMITTEXT
push
eax
;hwnd, handle of destination window
call
SendMessageA
;- API Function jmp
WP1_return_0
;return FALSE to allow editing item
PortList_LVN_ENDLABELEDIT:
cmp
eax,0FFFFFF96h
jne
WP1_return

;is code LVN_FIRST | LVN_ENDLABELEDIT


Page 25

td_win32asm_710.asm
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 canceled
mov
eax,[ebx+32]
;check correct user input
mov
cl,[eax]
cmp
cl,20h
je
PortList_LVN_ENDLABELEDIT_0
cmp
cl,31h
jb
PortList_LVN_ENDLABELEDIT_0
cmp
cl,39h
ja
PortList_LVN_ENDLABELEDIT_0
inc
eax
mov
edx,0h
PortList_LVN_ENDLABELEDIT_Loop:
mov
cl,[eax]
cmp
cl,0h
je
PortList_LVN_ENDLABELEDIT_Save
cmp
cl,30h
jb
PortList_LVN_ENDLABELEDIT_0
cmp
cl,39h
ja
PortList_LVN_ENDLABELEDIT_0
inc
eax
inc
edx
cmp
edx,5h
jne
PortList_LVN_ENDLABELEDIT_Loop
PortList_LVN_ENDLABELEDIT_Save:
inc
edx
mov
counter1,edx
;length of text
mov
esi,[ebx+32]
;check correct value, >0, <65536
mov
eax,edx
push
ebx
call
My_StringDecNrtoHexDD
pop
ebx
cmp
edi,0h
je
PortList_LVN_ENDLABELEDIT_0
cmp
edi,65535
ja
PortList_LVN_ENDLABELEDIT_0
mov
Flag_PortScanAdd,0h
;value is correct
;-----------------------------------------------------------------------------; API "SendMessageA" sends a message to the window
;-----------------------------------------------------------------------------push
1h
;lParam, LVNI_FOCUSED=1h, LVNI_SELECTED=2h
push
-1
;wParam,index item begin search or -1 first
push
100Ch
;uMsg, LVM_FIRST=1000h | LVM_GETNEXTITEM=12
push
temp
;hwnd, handle of destination window
call
SendMessageA
;- API Function push
eax
;save EAX for future use
mov
edx,4h
mul
edx
mov
counter,eax
;item index in EAX
mov
eax,counter1
mov
esi,[ebx+32]
;get pointer to the currently edited text
call
My_StringDecNrtoHexDD
;- SubRoutine Page 26

td_win32asm_710.asm
mov
eax,OFFSET Buf_PortScanList
add
eax,counter
mov
[eax],edi
;-----------------------------------------------------------------------------; API "SendMessageA" sends a message to the window
;-----------------------------------------------------------------------------push
0h
;lParam, set to 0
push
0h
;wParam, set to 0
push
1004h
;uMsg, LVM_FIRST=1000h | LVM_GETITEMCOUNT=4
push
temp
;hwnd, handle of destination window
call
SendMessageA
;- API Function dec
eax
pop
ebx
;restore pushed value
cmp
eax,ebx
ja
WP1_return_1
inc
Var_PortListItems
jmp
WP1_return_1
PortList_LVN_ENDLABELEDIT_0:
cmp
Flag_PortScanAdd,1h
jne
WP1_return_0
mov
Flag_PortScanAdd,0h
;-----------------------------------------------------------------------------; API "SendMessageA" sends a message to the window
;-----------------------------------------------------------------------------push
0
;lParam, set to 0
push
[ebx+16]
;wParam, Index of the list view item
push
1008h
;uMsg, LVM_FIRST=1000h | LVM_DELETEITEM=8
push
temp
;hwnd, handle of destination window
call
SendMessageA
;- API Function jmp
WP1_return_0
;==============================================================================
; WM_DISPLAYCHANGE (value=7Eh) message, used to repaint the window area
;-----------------------------------------------------------------------------WP1_uMsg_7Eh:
cmp
eax,7Eh
;check if WM_DISPLAYCHANGE message recieved
jne
WP1_uMsg_111h
;if not goto label
;-----------------------------------------------------------------------------; API "MoveWindow" changes the position and dimensions of the STATIC window.
; Remember that I assign a region to the STATIC window handle on WM_CREATE.
;-----------------------------------------------------------------------------push
01h
;bRepaint, repaint flag
push
226h
;nHeight, height
push
270h
;nWidth, width
push
10h
;Y, vertical position
push
60h
;X, horizontal position
push
WP1_hWnd
;hWnd, handle of window
call
MoveWindow
;- API Function jmp
WP1_return
;==============================================================================
; WM_COMMAND (value=111h) message recieved ?
;-----------------------------------------------------------------------------Page 27

td_win32asm_710.asm
WP1_uMsg_111h:
cmp
eax,111h
jne
WP1_uMsg_112h
mov
eax,WP1_wParam

;check if WM_COMMAND message recieved


;if not goto label
;extra info about the message in ax

WP1_wParam_04F0h:
cmp
ax,04F0h
jne
WP1_wParam_04F1h
call
My_TrayToScreen
jmp
WP1_return

;is it tray popup menu item 04F0h = Restore


;if not 01h goto LABEL
;-SubRoutine ;

WP1_wParam_04F1h:
cmp
ax,04F1h
;is it tray popup menu item 04F1h = Exit
jne
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_DELETE
call
Shell_NotifyIconA
;- API Function ;-----------------------------------------------------------------------------; API "DestroyWindow" destroys the main program
;-----------------------------------------------------------------------------push
WP1_hWnd
;hMenu, handle of main window
call
DestroyWindow
;- API Function jmp
WP1_return
;
;-----------------------------------------------------------------------------; Check if toolbar button clicked (values 900h - 91Bh)
;-----------------------------------------------------------------------------WP1_uMsg_111h_900h:
cmp
ax,900h
;LOOKUP
jne
WP1_uMsg_111h_901h
cmp
UtilityNr,00h
;still active ?
je
WP1_return
call
My_Init_Lookup
;- SubRoutine mov
UtilityNr,00h
jmp
WP1_return
WP1_uMsg_111h_901h:
cmp
ax,901h
jne
WP1_uMsg_111h_902h
cmp
UtilityNr,01h
je
WP1_return
call
My_Init_ActiveRAS
mov
UtilityNr,01h
jmp
WP1_return
WP1_uMsg_111h_902h:
cmp
ax,902h
jne
WP1_uMsg_111h_903h
cmp
UtilityNr,02h
je
WP1_return

;ACTIVE RAS
;still active ?
;- SubRoutine -

;LOCALHOSTNAME
;still active ?
Page 28

td_win32asm_710.asm
call
mov
jmp

My_Init_Local
UtilityNr,02h
WP1_return

WP1_uMsg_111h_903h:
cmp
ax,903h
jne
WP1_uMsg_111h_904h
cmp
UtilityNr,03h
je
WP1_return
call
My_Init_Phonebook
mov
UtilityNr,03h
jmp
WP1_return
WP1_uMsg_111h_904h:
cmp
ax,904h
jne
WP1_uMsg_111h_905h
cmp
UtilityNr,04h
je
WP1_return
call
My_Init_RASDial
mov
UtilityNr,04h
jmp
WP1_return
WP1_uMsg_111h_905h:
cmp
ax,905h
jne
WP1_uMsg_111h_918h
cmp
UtilityNr,05h
je
WP1_return
call
My_Init_PortScan
mov
UtilityNr,05h
jmp
WP1_return
WP1_uMsg_111h_918h:
cmp
ax,918h
jne
WP1_uMsg_111h_919h
cmp
UtilityNr,18h
je
WP1_return
call
My_Init_GAI
mov
UtilityNr,18h
jmp
WP1_return
WP1_uMsg_111h_919h:
cmp
ax,919h
jne
WP1_uMsg_111h_91Ah
cmp
UtilityNr,19h
je
WP1_return
call
My_Init_Help
mov
UtilityNr,19h
jmp
WP1_return
WP1_uMsg_111h_91Ah:
cmp
ax,91Ah
jne
WP1_uMsg_111h_91Bh
cmp
UtilityNr,1Ah

;- SubRoutine -

;PHONEBOOK
;still active ?
;- SubRoutine -

;RASDIAL
;still active ?
;- SubRoutine -

;PORTSCAN
;still active ?
;- SubRoutine -

;GETADAPTERSINFO
;still active ?
;- SubRoutine -

;Help
;still active ?
;- SubRoutine -

;Settings
;still active ?
Page 29

td_win32asm_710.asm
je
call
mov
jmp

WP1_return
My_Init_Settings
UtilityNr,1Ah
WP1_return

;- SubRoutine -

WP1_uMsg_111h_91Bh:
cmp
ax,91Bh
;Hang up RAS
jne
WP1_uMsg_111h_627h
;-----------------------------------------------------------------------------; API "RasHangUp" terminates a remote access connection.
;-----------------------------------------------------------------------------push
hrascon
;hrasconn, handle RAS connection to hang up
call
RasHangUpA
;- API Function mov
hrascon,0h
;clear hrascon
;-----------------------------------------------------------------------------; API "Sleep" suspends the execution of current thread for a specified interval
;-----------------------------------------------------------------------------push
3000
;cMilliseconds, sleep time in milliseconds
call
Sleep
;- API Function jmp
WP1_return
;-----------------------------------------------------------------------------; Check if BS_AUTOCHECKBOX (Scan Ports via Port List) selected
;-----------------------------------------------------------------------------WP1_uMsg_111h_627h:
cmp
ax,627h
;AUTOCHECKBOX id
jne
WP1_uMsg_111h_628h
xor
Flag_PortScanList,1h
;toggle flag
;-----------------------------------------------------------------------------; API "EnableWindow" enables or disables input to specified window or control.
;-----------------------------------------------------------------------------push
Flag_PortScanList
;bEnable, flag enabling or disabling input
push
hWnd_LV_PortList
;hWnd, handle of window
call
EnableWindow
;- API Function xor
Flag_PortScanList,1h
;toggle flag
push
Flag_PortScanList
;bEnable, flag enabling or disabling input
push
hWnd_Work4
;hWnd, handle of window
call
EnableWindow
;- API Function push
Flag_PortScanList
;bEnable, flag enabling or disabling input
push
hWnd_Work6
;hWnd, handle of window
call
EnableWindow
;- API Function xor
Flag_PortScanList,1h
;toggle flag
jmp
WP1_return
;-----------------------------------------------------------------------------; Check if BS_AUTOCHECKBOX (Positive List) selected
;-----------------------------------------------------------------------------WP1_uMsg_111h_628h:
cmp
ax,628h
;AUTOCHECKBOX id
jne
WP1_uMsg_111h_651h
xor
Flag_PortScanTimeOut,1h
;toggle flag
jmp
WP1_return
Page 30

td_win32asm_710.asm
;-----------------------------------------------------------------------------; Check if CBN_SELCHANGE from combobox received (Dial up RAS)
;-----------------------------------------------------------------------------WP1_uMsg_111h_651h:
cmp
ax,651h
;combobox id
jne
WP1_uMsg_111h_2000h
mov
counter,4h
mov
rasdial_szPhoneNumber,0h
mov
flag_RASDialviaNumber,0h
;-----------------------------------------------------------------------------; API "SetWindowTextA" set's the text of the specified window's title bar.
;-----------------------------------------------------------------------------push
0h
;lpsz, address of string
push
hWnd_Work3
;hwnd, handle of window or control
call
SetWindowTextA
;- API Function push
0h
;lpsz, address of string
push
hWnd_Work5
;hwnd, handle of window or control
call
SetWindowTextA
;- API Function push
0h
;lpsz, address of string
push
hWnd_Work7
;hwnd, handle of window or control
call
SetWindowTextA
;- API Function ;-----------------------------------------------------------------------------; API "SendMessageA" sends a CB_GETCURSEL message
;-----------------------------------------------------------------------------push
0h
;lParam, not used must be zero
push
0h
;wParam, not used must be zero
push
147h
;uMsg, CB_GETCURSEL
push
hWnd_Work1
;hwnd, handle of destination window
call
SendMessageA
;- API Function cmp
eax,0h
;Dial via phone number ?
ja
My_ComboBox_Text
mov
flag_RASDialviaNumber,1h
;-----------------------------------------------------------------------------; API "EnableWindow" enables or disables input to specified window or control.
;-----------------------------------------------------------------------------push
1h
;bEnable, flag enabling or disabling input
push
hWnd_Work3
;hWnd, handle of window
call
EnableWindow
;- API Function jmp
WP1_return
My_ComboBox_Text:
dec
eax
mov
ebx,108h
mul
ebx
add
counter,eax
;-----------------------------------------------------------------------------; API "lstrcpyA" copies a string to a buffer
;-----------------------------------------------------------------------------mov
ebx,OFFSET Buffer
add
ebx,counter
push
ebx
;lpString2, address of string to copy
push
OFFSET rasdial_szEntryName ;lpString1, address of buffer
call
lstrcpyA
;- API Function ;-----------------------------------------------------------------------------Page 31

td_win32asm_710.asm
; API "RasGetEntryDialParams" retrieves information for a phonebook entry
;-----------------------------------------------------------------------------push
OFFSET Phonebook_Password
;lpfPassword, if password was retrieved = 1
push
OFFSET rasdial_dwSize
;lprasdialparams, pointer to a structure
push
0h
;lpszPhonebook, currently ignored
call
RasGetEntryDialParamsA
;- API Function ;-----------------------------------------------------------------------------; API "SetWindowTextA" set's the text of the specified window's title bar.
;-----------------------------------------------------------------------------push
OFFSET rasdial_szEntryName ;lpsz, address of string
push
hWnd_Work1
;hwnd, handle of window or control
call
SetWindowTextA
;- API Function push
OFFSET rasdial_szPhoneNumber;lpsz, address of string
push
hWnd_Work3
;hwnd, handle of window or control
call
SetWindowTextA
;- API Function push
OFFSET rasdial_szUserName
;lpsz, address of string
push
hWnd_Work5
;hwnd, handle of window or control
call
SetWindowTextA
;- API Function push
OFFSET rasdial_szPassword
;lpsz, address of string
push
hWnd_Work7
;hwnd, handle of window or control
call
SetWindowTextA
;- API Function ;-----------------------------------------------------------------------------; API "EnableWindow" enables or disables input to specified window or control.
;-----------------------------------------------------------------------------push
0h
;bEnable, flag enabling or disabling input
push
hWnd_Work3
;hWnd, handle of window
call
EnableWindow
;- API Function jmp
WP1_return
WP1_uMsg_111h_2000h:
;-----------------------------------------------------------------------------; Check if item in floating popup menu selected, MAIN LISTVIEW WINDOW
;-----------------------------------------------------------------------------cmp
ax,2000h
;check if Copy to Clipboard choosen
jne
WP1_uMsg_111h_2001h
;if not skip
call
My_Clipboard
;- SubRoutine jmp
WP1_return
WP1_uMsg_111h_2001h:
cmp
ax,2001h
;check if delete all entries choosen
jne
WP1_uMsg_111h_2010h
;if not skip
call
My_SetFocus_ListView
;- SubRoutine call
My_LVM_DELETEALLITEMS
;- SubRoutine jmp
WP1_return
WP1_uMsg_111h_2010h:
;-----------------------------------------------------------------------------; Check if item in floating popup menu selected, PORTLIST LISTVIEW WINDOW
;-----------------------------------------------------------------------------cmp
ax,2010h
;check if add entry choosen
jne
WP1_uMsg_111h_2011h
;if not skip
cmp
Var_PortListItems,100h
;max entries in portlist !
jae
WP1_return
mov
Flag_PortScanAdd,1h
Page 32

td_win32asm_710.asm
call
My_SetFocus_ListView
;- SubRoutine mov
ebx,OFFSET EmptyPortScan
call
My_LVM_INSERTITEM
;- SubRoutine ;-----------------------------------------------------------------------------; API "SendMessageA" sends a message to the window
;-----------------------------------------------------------------------------push
0h
;lParam, set to 0
push
0h
;wParam, set to 0
push
1004h
;uMsg, LVM_FIRST=1000h | LVM_GETITEMCOUNT=4
push
temp
;hwnd, handle of destination window
call
SendMessageA
;- API Function dec
eax
mov
counter,eax
call
My_SetFocus_ListView
;- SubRoutine push
0h
;lParam, set to 0
push
counter
;wParam, iItem, item index
push
1017h
;uMsg, LVM_FIRST=1000h | LVM_EDITLABEL=23
push
temp
;hwnd, handle of destination window
call
SendMessageA
;- API Function jmp
WP1_return
WP1_uMsg_111h_2011h:
cmp
ax,2011h
;check if delete selected entry choosen
jne
WP1_uMsg_111h_2012h
;if not skip
call
My_SetFocus_ListView
;- SubRoutine ;-----------------------------------------------------------------------------; API "SendMessageA" sends a message to the window
;-----------------------------------------------------------------------------push
1h
;lParam, LVNI_FOCUSED=1h, LVNI_SELECTED=2h
push
-1
;wParam,index item begin search or -1 first
push
100Ch
;uMsg, LVM_FIRST=1000h | LVM_GETNEXTITEM=12
push
temp
;hwnd, handle of destination window
call
SendMessageA
;- API Function cmp
eax,-1
;if no item avaible
je
WP1_return
;-----------------------------------------------------------------------------; API "SendMessageA" sends a message to the window
;-----------------------------------------------------------------------------push
0
;lParam, set to 0
push
eax
;wParam, Index of the list view item
push
1008h
;uMsg, LVM_FIRST=1000h | LVM_DELETEITEM=8
push
temp
;hwnd, handle of destination window
call
SendMessageA
;- API Function ;-----------------------------------------------------------------------------; API "SendMessageA" sends a message to the window
;-----------------------------------------------------------------------------push
0h
;lParam, set to 0
push
0h
;wParam, set to 0
push
1004h
;uMsg, LVM_FIRST=1000h | LVM_GETITEMCOUNT=4
push
temp
;hwnd, handle of destination window
call
SendMessageA
;- API Function mov
counter,eax
dec
counter
mov
counter1,0h
Page 33

td_win32asm_710.asm
cmp
eax,0h
jne
WP1_uMsg_111h_2011h_Save
mov
Var_PortListItems,0h
jmp
WP1_return
WP1_uMsg_111h_2011h_Save:
mov
LVI_iSubItem,0h
mov
LVI_pszText,OFFSET Buffer
mov
LVI_cchTextMax,6h
;-----------------------------------------------------------------------------; API "SendMessageA" sends a message to the window
;-----------------------------------------------------------------------------push
OFFSET LVI_mask
;lParam, pcol, pointer LV_ITEM structure
push
counter1
;wParam, Index of the list view item
push
102Dh
;uMsg, LVM_FIRST=1000h | LVM_GETITEMTEXT=45
push
temp
;hwnd, handle of destination window
call
SendMessageA
;- API Function mov
esi,OFFSET Buffer
;get pointer to the currently edited text
call
My_StringDecNrtoHexDD
;- SubRoutine mov
eax,counter1
mov
edx,4h
mul
edx
mov
edx,OFFSET Buf_PortScanList
add
edx,eax
mov
[edx],edi
inc
counter1
mov
eax,counter1
cmp
eax,counter
jbe
WP1_uMsg_111h_2011h_Save
dec
Var_PortListItems
jmp
WP1_return
WP1_uMsg_111h_2012h:
cmp
ax,2012h
;check if delete all entries choosen
jne
WP1_uMsg_111h_2013h
;if not skip
call
My_SetFocus_ListView
;- SubRoutine ;-----------------------------------------------------------------------------; API "SendMessageA" sends a message to the window
;-----------------------------------------------------------------------------push
0h
;lParam, set to 0
push
0h
;wParam, set to 0
push
1009h
;uMsg,LVM_FIRST=1000h|LVM_DELETEALLITEMS=9
push
temp
;hwnd, handle of destination window
call
SendMessageA
;- API Function mov
Var_PortListItems,0h
jmp
WP1_return
WP1_uMsg_111h_2013h:
cmp
ax,2013h
jne
WP1_uMsg_111h_2014h
mov
lStructSize,4Ch
mov
eax,WP1_hWnd
mov
hwndOwner,eax
mov
eax,hInstance
mov
hInstance1,eax

;check if delete all entries choosen


;if not skip
;length in bytes of structure
;id window that owns dialog box
;handle, our program id
Page 34

td_win32asm_710.asm
mov
lpstrFilter,OFFSET PortFileFilter;pointer to string + filter, 0=no
mov
lpstrCustomFilter,0h
;pointer to user defined filter
mov
nMaxCustFilter,0h
;size bytes/characters of above
mov
nFilterIndex,0h
;filter index of lpstrFilter
mov
lpstrFile,OFFSET PortFileName;pointer initialize filename, 0=no
mov
nMaxFile,104h
;max size bytes/characters of above
mov
lpstrFileTitle,0h
;pointer title of the selected file
mov
nMaxFileTitle,0h
;size of the lpstrFileTitle buffer
mov
lpstrInitialDir,0h
;pointer string init file dir,0=default
mov
lpstrTitle,OFFSET PortFileLoadT;pointer title of the box
mov
Flags,00281804h
;the dialog box creation flags
mov
nFileOffset,0h
;offset filename in string lpstrFile
mov
nFileExtension,0h
;offset extension in string lpstrFile
mov
lpstrDefExt,OFFSET PortFileDefExt;pointer default extension of file, 0=no
mov
lCustData,0h
;?
mov
lpfnHook,0h
;? used if flag is OFN_ENABLETEMPLATE
mov
lpTemplateName,0h
;? used if flag is OFN_ENABLETEMPLATE
push
OFFSET lStructSize
;pointer to OPENFILENAME Structure
call
GetOpenFileNameA
;- API Function cmp
eax,1h
;1h=no error
jne
WP1_uMsg_111h_2013h_Return
;-----------------------------------------------------------------------------; API "CreateFileA" creates or opens a file, returns a handle to access object.
;-----------------------------------------------------------------------------push
0h
;hTemplateFile,
push
80h
;dwFlagsAndAttributes, normal = 80h
push
3h
;dwCreationDistribution, OPEN_EXISTING=3h
push
0h
;lpSecurityAttributes,
push
0h
;dwShareMode,
push
80000000h
;dwDesiredAccess, GENERIC_READ
push
OFFSET PortFileName
;lpFileName,pointer to filename
call
CreateFileA
;- API Function cmp
eax,-1
;INVALID_HANDLE_VALUE = -1
je
WP1_uMsg_111h_2013h_Return
mov
FileHandle,eax
;store handle in variable
;-----------------------------------------------------------------------------; API "ReadFile" reads data from a file ==> Mark
;-----------------------------------------------------------------------------push
0h
;lpOverlapped, structure overlapped I/O
push
OFFSET FileReturn
;lpNumberOfBytesWritten,
push
10h
;nNumberOfBytesToWrite, bytes to read
push
OFFSET Buffer
;lpBuffer, address data read from file
push
FileHandle
;hFile, handle of file to write to
call
ReadFile
;- API Function mov
ecx,0h
;check if it is a correct netspy prt file
mov
esi,OFFSET Buffer
mov
edi,OFFSET FileMark_PortList
My_PortList_CheckMark:
mov
al,[esi]
mov
ah,[edi]
cmp
al,ah
je
My_PortList_CheckMark_OK
;-----------------------------------------------------------------------------Page 35

td_win32asm_710.asm
; API "MessageBoxA" creates a message box if choosen file is not a NetSpy file
;-----------------------------------------------------------------------------push
30h
;uType, 0=MB_OK, 30h=MB_ICONEXCLAMATION
push
OFFSET MB2_Title
;lpCaption,pointer to title text
push
OFFSET MB2_Text
;lpText,pointer to text message box
push
WP1_hWnd
;handle of owner window
call
MessageBoxA
;- API Function jmp
WP1_uMsg_111h_2013h_Return
My_PortList_CheckMark_OK:
inc
esi
inc
edi
inc
ecx
cmp
ecx,10h
jne
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 write
push
OFFSET Var_PortListItems
;lpBuffer, address data write to file
push
FileHandle
;hFile, handle of file to write to
call
ReadFile
;- API Function push
0h
push
OFFSET FileReturn
push
0Ch
push
OFFSET File_Dummy
push
FileHandle
call
ReadFile
;- API Function push
0h
push
OFFSET FileReturn
push
400h
push
OFFSET Buf_PortScanList
push
FileHandle
call
ReadFile
;- API Function mov
ecx,Var_PortListItems
cmp
ecx,0h
je
WP1_uMsg_111h_2013h_Return
mov
eax,hWnd_LV_PortList
mov
temp,eax
call
My_LVM_DELETEALLITEMS
;- SubRoutine mov
ecx,Var_PortListItems
mov
counter,ecx
;fill portlist
mov
ebx,OFFSET Buf_PortScanList
PortScan_FillList:
mov
esi,[ebx]
push
ebx
call
My_HexDDtoStringDec
mov
ebx,OFFSET Buffer
call
My_LVM_INSERTITEM
;- SubRoutine pop
ebx
add
ebx,4h
dec
counter
Page 36

td_win32asm_710.asm
jne
PortScan_FillList
WP1_uMsg_111h_2013h_Return:
;-----------------------------------------------------------------------------; API "CloseHandle" closes an open object handle.
;-----------------------------------------------------------------------------push
FileHandle
;hObject, handle of object to close
call
CloseHandle
;- API Function jmp
WP1_return
WP1_uMsg_111h_2014h:
cmp
ax,2014h
;check if delete all entries choosen
jne
WP1_uMsg_111h_3000h
;if not skip
mov
lStructSize,4Ch
;length in bytes of structure
mov
eax,WP1_hWnd
mov
hwndOwner,eax
;id window that owns dialog box
mov
eax,hInstance
mov
hInstance1,eax
;handle, our program id
mov
lpstrFilter,OFFSET PortFileFilter;pointer to string + filter, 0=no
mov
lpstrCustomFilter,0h
;pointer to user defined filter
mov
nMaxCustFilter,0h
;size bytes/characters of above
mov
nFilterIndex,0h
;filter index of lpstrFilter
mov
lpstrFile,OFFSET PortFileName;pointer initialize filename, 0=no
mov
nMaxFile,104h
;max size bytes/characters of above
mov
lpstrFileTitle,0h
;pointer title of the selected file
mov
nMaxFileTitle,0h
;size of the lpstrFileTitle buffer
mov
lpstrInitialDir,0h
;pointer string init file dir,0=default
mov
lpstrTitle,OFFSET PortFileSaveT;pointer title of the box
mov
Flags,00281804h
;the dialog box creation flags
mov
nFileOffset,0h
;offset filename in string lpstrFile
mov
nFileExtension,0h
;offset extension in string lpstrFile
mov
lpstrDefExt,OFFSET PortFileDefExt;pointer default extension of file, 0=no
mov
lCustData,0h
;?
mov
lpfnHook,0h
;? used if flag is OFN_ENABLETEMPLATE
mov
lpTemplateName,0h
;? used if flag is OFN_ENABLETEMPLATE
push
OFFSET lStructSize
;pointer to OPENFILENAME Structure
call
GetSaveFileNameA
;- API Function cmp
eax,1h
;1h=no error
jne
WP1_uMsg_111h_2014h_Return
;-----------------------------------------------------------------------------; API "CreateFileA" creates or opens a file, returns a handle to access object.
;-----------------------------------------------------------------------------push
0h
;hTemplateFile,
push
80h
;dwFlagsAndAttributes, normal = 80h
push
2h
;dwCreationDistribution, CREATE_ALWAYS=2h
push
0h
;lpSecurityAttributes,
push
0h
;dwShareMode,
push
40000000h
;dwDesiredAccess, GENERIC_WRITE
push
OFFSET PortFileName
;lpFileName,pointer to filename
call
CreateFileA
;- API Function cmp
eax,-1
;INVALID_HANDLE_VALUE = -1
je
WP1_uMsg_111h_2014h_Return
mov
FileHandle,eax
;store handle in variable
;-----------------------------------------------------------------------------Page 37

td_win32asm_710.asm
; API "WriteFile" writes data to a file
;-----------------------------------------------------------------------------push
0h
;lpOverlapped, structure overlapped I/O
push
OFFSET FileReturn
;lpNumberOfBytesWritten,
push
10h
;nNumberOfBytesToWrite, bytes to write
push
OFFSET FileMark_PortList
;lpBuffer, address data write to file
push
FileHandle
;hFile, handle of file to write to
call
WriteFile
;- API Function push
0h
push
OFFSET FileReturn
push
4h
push
OFFSET Var_PortListItems
push
FileHandle
call
WriteFile
push
0h
push
OFFSET FileReturn
push
0Ch
push
OFFSET File_Dummy
push
FileHandle
call
WriteFile
;- API Function push
0h
push
OFFSET FileReturn
push
400h
push
OFFSET Buf_PortScanList
push
FileHandle
call
WriteFile
;- API Function WP1_uMsg_111h_2014h_Return:
;-----------------------------------------------------------------------------; API "CloseHandle" closes an open object handle.
;-----------------------------------------------------------------------------push
FileHandle
;hObject, handle of object to close
call
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_return
cmp
UtilityNr,00h
;is choosen utility LOOKUP ?
jne
Start_UtilityNr01
call
My_Run_Lookup
;- SubRoutine jmp
WP1_return
Start_UtilityNr01:
cmp
UtilityNr,01h
jne
Start_UtilityNr02
call
My_Run_ActiveRAS
jmp
WP1_return

;is choosen utility ACTIVE RAS ?

Start_UtilityNr02:
cmp
UtilityNr,02h

;is choosen utility LOCALHOST ?

;- SubRoutine -

Page 38

td_win32asm_710.asm
jne
call
jmp

Start_UtilityNr03
My_Run_Local
WP1_return

;- SubRoutine -

Start_UtilityNr03:
cmp
UtilityNr,03h
jne
Start_UtilityNr04
call
My_Run_Phonebook
jmp
WP1_return

;is choosen utility PHONEBOOK ?

Start_UtilityNr04:
cmp
UtilityNr,04h
jne
Start_UtilityNr05
call
My_Run_RASDial
jmp
WP1_return

;is choosen utility RASDIAL ?

Start_UtilityNr05:
cmp
UtilityNr,05h
jne
Start_UtilityNr18
call
My_Run_PortScan
jmp
WP1_return

;is choosen utility PORTSCAN ?

Start_UtilityNr18:
cmp
UtilityNr,18h
jne
Start_UtilityNr19
call
My_Run_GAI
jmp
WP1_return

;is choosen utility GETADAPTERSINFO ?

Start_UtilityNr19:
cmp
UtilityNr,19h
jne
Start_UtilityNr1A
call
My_Run_Help
jmp
WP1_return

;is choosen utility HELP ?

Start_UtilityNr1A:
cmp
UtilityNr,1Ah
jne
Start_UtilityNr1B
call
My_Run_Settings
jmp
WP1_return

;is choosen utility SETTINGS ?

Start_UtilityNr1B:
jmp
WP1_return

;is choosen utility 'xyz' ?

;- SubRoutine -

;- SubRoutine -

;- SubRoutine -

;- SubRoutine -

;- SubRoutine -

;- SubRoutine -

;==============================================================================
; WM_SYSCOMMAND (value=112h) message recieved ?
;-----------------------------------------------------------------------------WP1_uMsg_112h:
cmp
eax,112h
;check if WM_COMMAND message recieved
jne
WP1_uMsg_113h
;if not goto label
mov
eax,WP1_wParam
;extra info about the message
cmp
eax,0F060h
;SC_CLOSE=0F060h received ?
jne
WP1_return
;
call
My_CleanSystem
;- SubRoutine Page 39

td_win32asm_710.asm
jmp

WP1_return

;==============================================================================
; WM_TIMER (value=113h) message received ?
;-----------------------------------------------------------------------------WP1_uMsg_113h:
cmp
eax,113h
;check if WM_TIMER message recieved
jne
WP1_uMsg_312h
;if not goto label
mov
ax,WP1_wParam
;get timer id
cmp
ax,70h
je
Timer_70h
jmp
WP1_return
Timer_70h:
cmp
Flag_Dialing,1h
je
Timer_LED_Dialing
;-----------------------------------------------------------------------------; API "RasGetConnectStatus" retrieves information on the current status of the
; specified remote access connection
;-----------------------------------------------------------------------------push
OFFSET rasstatus_dwSize
;lprasconnstatus,buffer receive status data
push
hrascon
;hrasconn,handle RAS connection of interest
call
RasGetConnectStatusA
;- API Function cmp
eax,0h
;error ?
jne
Timer_RasEnumConnections
cmp
rasstatus_rasconnstate,2001h;RASCS_Disconnected ?, line is busy or so
jne
Timer_RasEnumConnections
;-----------------------------------------------------------------------------; API "RasHangUp" terminates a remote access connection.
;-----------------------------------------------------------------------------push
hrascon
;hrasconn, handle RAS connection to hang up
call
RasHangUpA
;- API Function mov
hrascon,0h
;clear hrascon
;-----------------------------------------------------------------------------; API "Sleep" suspends the execution of current thread for a specified interval
;-----------------------------------------------------------------------------push
3000
;cMilliseconds, sleep time in milliseconds
call
Sleep
;- API Function Timer_RasEnumConnections:
mov
TimerBufferSize,10000h
mov
eax,OFFSET TimerBuffer
mov
ebx,19Ch
mov
[eax],ebx
;-----------------------------------------------------------------------------; API "RasEnumConnections" lists all active Remote Access Service connections.
;-----------------------------------------------------------------------------push
OFFSET ActiveRAS_Connections;lpcConnections, # connections written buff
push
OFFSET TimerBufferSize
;lpcb, size in bytes of buffer
push
eax
;lprasconn, buffer receive connections data
call
RasEnumConnectionsA
;- API Function cmp
ActiveRAS_Connections,0h
je
Timer_LED_Offline
cmp
ActiveRAS_Connections,1h
Page 40

td_win32asm_710.asm
jae
Timer_LED_Online
jmp
WP1_return
Timer_LED_Offline:
;-----------------------------------------------------------------------------; API "SendMessageA" sends a message to the window
;-----------------------------------------------------------------------------push
hObj_Offline
;lParam, hImage, handle of the image
push
0h
;wParam, fImageType, IMAGE_BITMAP
push
172h
;uMsg, message to send ( STM_SETIMAGE )
push
hWnd_LED
;hwnd, handle of destination window
call
SendMessageA
;- API Function jmp
WP1_return
Timer_LED_Online:
;-----------------------------------------------------------------------------; API "SendMessageA" sends a message to the window
;-----------------------------------------------------------------------------push
hObj_Online
;lParam, hImage, handle of the image
push
0h
;wParam, fImageType, IMAGE_BITMAP
push
172h
;uMsg, message to send ( STM_SETIMAGE )
push
hWnd_LED
;hwnd, handle of destination window
call
SendMessageA
;- API Function jmp
WP1_return
Timer_LED_Dialing:
;-----------------------------------------------------------------------------; API "SendMessageA" sends a message to the window
;-----------------------------------------------------------------------------push
hObj_Dialing
;lParam, hImage, handle of the image
push
0h
;wParam, fImageType, IMAGE_BITMAP
push
172h
;uMsg, message to send ( STM_SETIMAGE )
push
hWnd_LED
;hwnd, handle of destination window
call
SendMessageA
;- API Function jmp
WP1_return
;==============================================================================
; WM_HOTKEY (value=312h) message received ?
;-----------------------------------------------------------------------------WP1_uMsg_312h:
cmp
eax,312h
;check if WM_HOTKEY message recieved
jne
WP1_uMsg_4FFh
;if not goto label
cmp
UtilityNr,05h
;is current utility PORTSCANNER ?
jne
WP1_return
;if not skip
mov
Flag_Escape,1h
;set escape key flag
jmp
WP1_return
;==============================================================================
; WM_USER (value=4FFh) message recieved ? We define this value above in WM_SIZE
;-----------------------------------------------------------------------------WP1_uMsg_4FFh:
cmp
eax,4FFh
;check if WM_USER message recieved
jne
WP1_uMsg_1000h
;if not goto label
mov
eax,WP1_wParam
cmp
ax,04FEh
;our tray icon's ID
jne
WP1_return
Page 41

td_win32asm_710.asm
mov
eax,WP1_lParam
;
cmp
eax,204h
;mouse message, WM_RBUTTONDOWN = 204h
jne
WP1_return
;goto LABEL
;-----------------------------------------------------------------------------; API "GetCursorPos" retrieves the cursor's position, in screen coordinates.
;-----------------------------------------------------------------------------push
OFFSET point_xpt
;pointer to POINT structure
call
GetCursorPos
;- API Function ;-----------------------------------------------------------------------------; API "SetForegroundWindow" puts the thread that created the specified window
; into the foreground and activates the window. Keyboard input is directed to
; the window, and various visual cues are changed for the user.
;-----------------------------------------------------------------------------push
WP1_hWnd
;
call
SetForegroundWindow
;- API Function ;-----------------------------------------------------------------------------; API "TrackPopupMenuEx" displays a floating pop-up menu at the specified
; location and tracks the selection of items on the pop-up menu.
; The floating pop-up menu can appear anywhere on the screen.
;-----------------------------------------------------------------------------push
0h
;lptpm,Pointer TPMPARAMS structure,0=no
push
WP1_hWnd
;hWnd, handle of owner window
push
point_ypt
;y, vertical position
push
point_xpt
;x, horizontal position
push
0Ah
;fuFlags,TPM_RIGHTALIGN,TPM_RIGHTBUTTON
push
hTrayPopup
;handle of popup menu
call
TrackPopupMenuEx
;- API Function ;-----------------------------------------------------------------------------; API "PostMessage" places (posts) a message into the window message queue.
;-----------------------------------------------------------------------------push
0h
;lParam, second message parameter
push
0h
;wParam, first message parameter
push
0h
;uMsg, message to post, 0h=WM_Null
push
WP1_hWnd
;hwnd, handle of destination window
call
PostMessageA
;- API Function - prevents error
jmp
WP1_return
;
;==============================================================================
; WM_USER+x (value=1000h) message from socket received ?
;-----------------------------------------------------------------------------WP1_uMsg_1000h:
cmp
eax,1000h
;check if WM_USER+x message recieved
jne
WP1_return
;if not goto label
mov
eax,WP1_lParam
cmp
ax,10h
;FD_CONNECT ?
jne
WP1_return
shr
eax,10h
;get error value if one
cmp
ax,0h
;0=no error
jne
WP1_return
mov
Flag_PortScanThread,1h
;set flag
jmp
WP1_return
;==============================================================================
Page 42

td_win32asm_710.asm
; API "DefWindowProcA" calls the window procedure to provide default processing
; for any window messages that an application does not process.
; This function ensures that every message is processed.
; It is called with the same parameters received by the window procedure.
;-----------------------------------------------------------------------------WP1_return:
popad
;pop all register from stack
push
WP1_lParam
;extra info about the message
push
WP1_wParam
;extra info about the message
push
WP1_uMsg
;the message number
push
WP1_hWnd
;handle of window who receives message
call
DefWindowProcA
;- API Function mov
esp,ebp
;delete stack frame
pop
ebp
ret
10h
;return and clear stack
;==============================================================================
; Leaving the window procedure returning TRUE (1) or FALSE (0) in EAX.
;-----------------------------------------------------------------------------WP1_return_0:
popad
;pop all register from stack
mov
eax,0h
;set EAX to FALSE (0)
mov
esp,ebp
;delete stack frame
pop
ebp
ret
10h
;return and clear stack
WP1_return_1:
popad
;pop all register from stack
mov
eax,1h
;set EAX to TRUE (1)
mov
esp,ebp
;delete stack frame
pop
ebp
ret
10h
;return and clear stack
;##############################################################################
;******************************************************************************
; My own subroutine(s) for a compacter code resist here ...
;-----------------------------------------------------------------------------My_CleanSystem:
;-----------------------------------------------------------------------------; API "DeleteObject" deletes a bitmap freeing all associated system resources
;-----------------------------------------------------------------------------push
hObj_Online
;hObject, handle of graphic object
call
DeleteObject
;- API Function ;-----------------------------------------------------------------------------; API "DeleteObject" deletes a bitmap freeing all associated system resources
;-----------------------------------------------------------------------------push
hObj_Offline
;hObject, handle of graphic object
call
DeleteObject
;- API Function ;-----------------------------------------------------------------------------; API "DeleteObject" deletes a bitmap freeing all associated system resources
;-----------------------------------------------------------------------------push
hObj_Dialing
;hObject, handle of graphic object
call
DeleteObject
;- API Function ;-----------------------------------------------------------------------------Page 43

td_win32asm_710.asm
; API "KillTimer" destroys the specified timer.
;-----------------------------------------------------------------------------push
70h
;uIDEvent, timer identifier
push
WP1_hWnd
;hWnd, handle window that installed timer
call
KillTimer
;- API Function ;-----------------------------------------------------------------------------; API "RasHangUp" terminates a potentiel remote access connection, for SECURITY
;-----------------------------------------------------------------------------push
hrascon
;hrasconn, handle RAS connection to hang up
call
RasHangUpA
;- API Function ;-----------------------------------------------------------------------------; API "closesocket" closes a socket.
;-----------------------------------------------------------------------------push
socketDesc
;s, a descriptor identifying a socket
call
closesocket
;- API Function ;-----------------------------------------------------------------------------; API "Sleep" suspends the execution of current thread for a specified interval
;-----------------------------------------------------------------------------push
100
;cMilliseconds, sleep time in milliseconds
call
Sleep
;- API Function call
My_AutoSave
;- SubRoutine ret
;******************************************************************************
;@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
; This Subroutines are used on WM_CREATE, create main window, toolbar ...
;@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
My_InitProgram:
;-----------------------------------------------------------------------------; Init Program
;-----------------------------------------------------------------------------mov
ebx,OFFSET Buf_PortScanList ;default portlist
mov
ecx,21
mov
[ebx+00],ecx
mov
ecx,80
mov
[ebx+04],ecx
mov
ecx,137
mov
[ebx+08],ecx
mov
ecx,138
mov
[ebx+12],ecx
mov
ecx,139
mov
[ebx+16],ecx
mov
ecx,31337
mov
[ebx+20],ecx
;-----------------------------------------------------------------------------; API "lstrcpyA" copy's a string from source to destination.
;-----------------------------------------------------------------------------push
OFFSET X2_PortScan
;source address of string
push
OFFSET W2_PortScan
;destination address
call
lstrcpyA
;- API Function ;-----------------------------------------------------------------------------; API "lstrcpyA" copy's a string from source to destination.
;-----------------------------------------------------------------------------Page 44

td_win32asm_710.asm
push
OFFSET X4_PortScan
;source address of string
push
OFFSET W4_PortScan
;destination address
call
lstrcpyA
;- API Function ;-----------------------------------------------------------------------------; API "lstrcpyA" copy's a string from source to destination.
;-----------------------------------------------------------------------------push
OFFSET X6_PortScan
;source address of string
push
OFFSET W6_PortScan
;destination address
call
lstrcpyA
;- API Function call
My_AutoLoad
;- SubRoutine ret
My_Create_MainWindow:
;-----------------------------------------------------------------------------; API "CreateWindowExA" creates a window with a predefined class name (STATIC).
;-----------------------------------------------------------------------------push
0h
;lpParam, extra pointer data 0=no data
push
hInstance
;hInstance, handle of our program
push
500h
;hMenu, the child-window ID
push
WP1_hWnd
;hWndParent, handle parent window 0=no
push
0h
;intnHeight, window height pixel
push
0h
;intnWidth, window width pixel
push
4h
;inty, vertical position window
push
4h
;intx, horizontal position window
push
5000000Eh
;dwStyle, SS_BITMAP = 0Eh
push
OFFSET name_Left
;lpWindowName, pointer to window name
push
OFFSET class_STATIC
;lpClassName, pointer to class name
push
300h
;dwExStyle, look WIN32.HLP + windows.inc
call
CreateWindowExA
;- API Function mov
hWnd_Left,eax
;hwnd, return value=handle of window
;-----------------------------------------------------------------------------; API "CreateWindowExA" creates a window with a predefined class name (STATIC).
;-----------------------------------------------------------------------------push
0h
;lpParam, extra pointer data 0=no data
push
hInstance
;hInstance, handle of our program
push
510h
;hMenu, the child-window ID
push
WP1_hWnd
;hWndParent, handle parent window 0=no
push
0h
;intnHeight, window height pixel
push
0h
;intnWidth, window width pixel
push
4h
;inty, vertical position window
push
1F4h
;intx, horizontal position window
push
5000000Eh
;dwStyle, SS_BITMAP = 0Eh
push
OFFSET name_Right
;lpWindowName, pointer to window name
push
OFFSET class_STATIC
;lpClassName, pointer to class name
push
300h
;dwExStyle, look WIN32.HLP + windows.inc
call
CreateWindowExA
;- API Function mov
hWnd_Right,eax
;hwnd, return value=handle of window
;-----------------------------------------------------------------------------; API "CreateToolbarExA" creates a child window ( TOOLBAR ).
; Set "uStructSize" to 14h, not 12h because bReserved bytes, bug in WIN32.HLP ?
; Take a look to TBBUTTON structure in the .DATA area above.
; Parameter "ws" defines the child windows style, it also enables tooltiptext.
; In "wID" we PUSH the ID of the child window ( a value of your your choice ).
Page 45

td_win32asm_710.asm
; Take a look into WIN32.HLP ( CreateToolbarEx ) and Windows.inc.
;-----------------------------------------------------------------------------push
14h
;uStructSize,size TBBUTTON structure
push
14h
;dyBitmap,height pixels of the images
push
14h
;dxBitmap,width pixels of the images
push
0h
;dyButton,height pixels of the buttons
push
0h
;dxButton,width, 0=default
push
58
;iNumButtons,Number buttons in toolbar
push
OFFSET iBitmap_s00
;lpButtons,pointer TBBUTTON structure
push
0200h
;wBMID,ID for the bitmap resource
push
hInstance
;hBMInst,instance bitmap resource
push
1
;nBitmaps,number of button image file
push
520h
;wID,control identifier for toolbar
push
54000101h
;ws, TBSTYLE_TOOLTIPS | CCS_TOP
push
WP1_hWnd
;hwnd,handle owner window 0=no owner
call
CreateToolbarEx
;- API Function mov
hWnd_Toolbar,eax
;handle of toolbar child window
;-----------------------------------------------------------------------------; API "CreateWindowExA" creates a window with a predefined class (BUTTON)
;-----------------------------------------------------------------------------push
0h
;lpParam, extra pointer data 0=no data
push
hInstance
;hInstance, handle of our program
push
530h
;hMenu, the child-window ID
push
WP1_hWnd
;hWndParent, handle parent window 0=no
push
54h
;intnHeight, window height pixel
push
1A0h
;intnWidth, window width pixel
push
1B5h
;inty, vertical position window
push
4h
;intx, horizontal position window
push
50000007h
;dwStyle, style ( BS_GROUPBOX )
push
0h
;lpWindowName, pointer to window name
push
OFFSET class_BUTTON
;lpClassName, pointer to class name
push
0h
;dwExStyle,
call
CreateWindowExA
;- API Function mov
hWnd_GROUPBOX_Work,eax
;return gvalue=handle of window
;-----------------------------------------------------------------------------; API "CreateWindowExA" creates a window with a predefined class (BUTTON)
;-----------------------------------------------------------------------------push
0h
;lpParam, extra pointer data 0=no data
push
hInstance
;hInstance, handle of our program
push
540h
;hMenu, the child-window ID
push
WP1_hWnd
;hWndParent, handle parent window 0=no
push
38h
;intnHeight, window height pixel
push
0BEh
;intnWidth, window width pixel
push
1D1h
;inty, vertical position window
push
1A8h
;intx, horizontal position window
push
50000007h
;dwStyle, style ( BS_GROUPBOX )
push
0h
;lpWindowName, pointer to window name
push
OFFSET class_BUTTON
;lpClassName, pointer to class name
push
0h
;dwExStyle,
call
CreateWindowExA
;- API Function mov
hWnd_GROUPBOX_Button,eax
;return gvalue=handle of window
;-----------------------------------------------------------------------------; API "CreateWindowExA" creates a window with a predefined class name (BUTTON)
Page 46

td_win32asm_710.asm
;-----------------------------------------------------------------------------push
0h
;lpParam, extra pointer data 0=no data
push
hInstance
;hInstance, handle of our program
push
3000h
;hMenu, the child-window ID
push
WP1_hWnd
;hWndParent, handle parent window 0=no
push
26h
;intnHeight, window height pixel
push
0B2h
;intnWidth, window width pixel
push
1DEh
;inty, vertical position window
push
1AEh
;intx, horizontal position window
push
58000000h
;dwStyle, style ( BS_PUSHBUTTON )
push
0h
;lpWindowName, pointer to window name
push
OFFSET class_BUTTON
;lpClassName, pointer to class name
push
300h
;dwExStyle,
call
CreateWindowExA
;- API Function mov
hWnd_Action,eax
;return value=handle of window
;-----------------------------------------------------------------------------; API "CreateWindowExA" creates a window with a predefined class (BUTTON)
;-----------------------------------------------------------------------------push
0h
;lpParam, extra pointer data 0=no data
push
hInstance
;hInstance, handle of our program
push
550h
;hMenu, the child-window ID
push
WP1_hWnd
;hWndParent, handle parent window 0=no
push
1Ch
;intnHeight, window height pixel
push
09Dh
;intnWidth, window width pixel
push
1B5h
;inty, vertical position window
push
1A8h
;intx, horizontal position window
push
50000007h
;dwStyle, style ( BS_GROUPBOX )
push
0h
;lpWindowName, pointer to window name
push
OFFSET class_BUTTON
;lpClassName, pointer to class name
push
0h
;dwExStyle,
call
CreateWindowExA
;- API Function mov
hWnd_GROUPBOX_Video,eax
;return gvalue=handle of window
;-----------------------------------------------------------------------------; API "CreateWindowExA" creates a window with a predefined class name (ANIMATE)
;-----------------------------------------------------------------------------push
0h
;lpParam, extra pointer data 0=no data
push
hInstance
;hInstance, handle of our program
push
551h
;hMenu, the child-window ID
push
WP1_hWnd
;hWndParent, handle parent window 0=no
push
0h
;intnHeight, window height pixel
push
0h
;intnWidth, window width pixel
push
1C3h
;inty, vertical position window
push
1AEh
;intx, horizontal position window
push
50000000h
;dwStyle, ACS_AUTOPLAY=4, ACS_TRANSPARENT=2
push
0h
;lpWindowName, pointer to window name
push
OFFSET class_SysAnimate32
;lpClassName, pointer to class name
push
0h
;dwExStyle,
call
CreateWindowExA
;- API Function mov
hWnd_Animate,eax
;return value=handle of window
;-----------------------------------------------------------------------------; API "SendMessageA" sends a message to the Window
;-----------------------------------------------------------------------------push
OFFSET AviName
;lParam, pointer to avi name in resource
Page 47

td_win32asm_710.asm
push
0h
;wParam, not used, must be zero
push
1124
;uMsg, ACM_OPEN = WM_USER(400h)+100
push
hWnd_Animate
;hwnd, handle of destination window
call
SendMessageA
;- API Function ;-----------------------------------------------------------------------------; You must not call this if you choose ACS_AUTOPLAY
;-----------------------------------------------------------------------------push
0h
;lParam, word, 0h=end with first frame
;
word, 0h=start with first frame
push
0h
;wParam, cRepeat, -1 = indefinitely
push
1125
;uMsg, ACM_PLAY = WM_USER(400h)+101
push
hWnd_Animate
;hwnd, handle of destination window
call
SendMessageA
;- API Function ;-----------------------------------------------------------------------------; API "CreateWindowExA" creates a window with a predefined class (BUTTON)
;-----------------------------------------------------------------------------push
0h
;lpParam, extra pointer data 0=no data
push
hInstance
;hInstance, handle of our program
push
560h
;hMenu, the child-window ID
push
WP1_hWnd
;hWndParent, handle parent window 0=no
push
1Ch
;intnHeight, window height pixel
push
01Ah
;intnWidth, window width pixel
push
1B5h
;inty, vertical position window
push
24Ch
;intx, horizontal position window
push
50000007h
;dwStyle, style ( BS_GROUPBOX )
push
0h
;lpWindowName, pointer to window name
push
OFFSET class_BUTTON
;lpClassName, pointer to class name
push
0h
;dwExStyle,
call
CreateWindowExA
;- API Function mov
hWnd_GROUPBOX_LED,eax
;return gvalue=handle of window
;-----------------------------------------------------------------------------; API "CreateWindowExA" creates a window with a predefined class name (STATIC)
;-----------------------------------------------------------------------------push
0h
;lpParam, extra pointer data 0=no data
push
hInstance
;hInstance, handle of our program
push
561h
;hMenu, the child-window ID
push
WP1_hWnd
;hWndParent, handle parent window 0=no
push
0h
;intnHeight, window height pixel
push
0h
;intnWidth, window width pixel
push
1C2h
;inty, vertical position window
push
254h
;intx, horizontal position window
push
5000000Eh
;dwStyle, SS_BITMAP = 0Eh
push
OFFSET name_Offline
;lpWindowName, pointer to window name
push
OFFSET class_STATIC
;lpClassName, pointer to class name
push
0h
;dwExStyle,
call
CreateWindowExA
;- API Function mov
hWnd_LED,eax
;return value=handle of window
;-----------------------------------------------------------------------------; API "SendMessageA" sends a message to the window
;-----------------------------------------------------------------------------push
0h
;lParam, not used, must be zero
push
0h
;wParam, fImageType, IMAGE_BITMAP
push
173h
;uMsg, message to send ( STM_GETIMAGE )
Page 48

td_win32asm_710.asm
push
hWnd_LED
;hwnd, handle of destination window
call
SendMessageA
;- API Function mov
hObj_Offline,eax
;handle of current static bitmap
;-----------------------------------------------------------------------------; API "LoadBitmap" loads the bitmap resource from a module's executable file.
;-----------------------------------------------------------------------------push
OFFSET name_Online
;lpBitmapName, bitmap resource ID
push
hInstance
;hInstance, handle of modul instance
call
LoadBitmapA
;- API Function mov
hObj_Online,eax
;handle of bitmap graphic
;-----------------------------------------------------------------------------; API "LoadBitmap" loads the bitmap resource from a module's executable file.
;-----------------------------------------------------------------------------push
OFFSET name_Dialing
;lpBitmapName, bitmap resource ID
push
hInstance
;hInstance, handle of modul instance
call
LoadBitmapA
;- API Function mov
hObj_Dialing,eax
;handle of bitmap graphic
;-----------------------------------------------------------------------------; API "CreatePopupMenu" creates an empty popup menu
;-----------------------------------------------------------------------------call
CreatePopupMenu
;- API Function mov
hTrayPopup,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 TrayMenuItemRestore ;lpNewItem, menu item content
push
04F0h
;uIDNewItem,menu item id or menu handle
push
0h
;uFlags, menu item flags, 0h=MF_STRING
push
hTrayPopup
;hMenu, handle of popup menu
call
AppendMenuA
;- API Function push
0h
push
0h
push
800h
;uFlags, menu item flags, 800h=MF_SEPARATOR
push
hTrayPopup
call
AppendMenuA
;- API Function push
OFFSET TrayMenuItemExit
push
04F1h
push
0h
push
hTrayPopup
call
AppendMenuA
;- API Function ;-----------------------------------------------------------------------------; API "CreatePopupMenu" creates an empty popup menu
;-----------------------------------------------------------------------------call
CreatePopupMenu
;- API Function mov
hMainPopup,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 MainMenuItemCopy
;lpNewItem, menu item content
push
2000h
;uIDNewItem,menu item id or menu handle
push
0h
;uFlags, menu item flags, 0h=MF_STRING
Page 49

td_win32asm_710.asm
push
hMainPopup
;hMenu, handle of popup menu
call
AppendMenuA
;- API Function push
OFFSET MainMenuItemDeleteAll
push
2001h
push
0h
push
hMainPopup
call
AppendMenuA
;- API Function push
0h
push
0h
push
800h
;uFlags, menu item flags, 800h=MF_SEPARATOR
push
hMainPopup
call
AppendMenuA
;- API Function push
OFFSET MainMenuItemCancel
push
2009h
push
0h
push
hMainPopup
call
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 content
push
2010h
;uIDNewItem,menu item id or menu handle
push
0h
;uFlags, menu item flags, 0h=MF_STRING
push
hPortListPopup
;hMenu, handle of popup menu
call
AppendMenuA
;- API Function push
OFFSET PScanMenuItemDelSel
push
2011h
push
0h
push
hPortListPopup
call
AppendMenuA
;- API Function push
OFFSET PScanMenuItemDelAll
push
2012h
push
0h
push
hPortListPopup
call
AppendMenuA
;- API Function push
0h
push
0h
push
800h
;uFlags, menu item flags, 800h=MF_SEPARATOR
push
hPortListPopup
call
AppendMenuA
;- API Function push
OFFSET PScanMenuItemLoad
push
2013h
push
0h
push
hPortListPopup
call
AppendMenuA
;- API Function push
OFFSET PScanMenuItemSave
push
2014h
Page 50

td_win32asm_710.asm
push
0h
push
hPortListPopup
call
AppendMenuA
;- API Function push
0h
push
0h
push
800h
;uFlags, menu item flags, 800h=MF_SEPARATOR
push
hPortListPopup
call
AppendMenuA
;- API Function push
OFFSET PScanMenuItemCancel
push
2019h
push
0h
push
hPortListPopup
call
AppendMenuA
;- API Function ;-----------------------------------------------------------------------------; API "SetTimer" creates a timer with the specified time-out value
;-----------------------------------------------------------------------------push
0h
;tmprc, address timer procedure,0=this
push
80h
;uTimeout, time-out value milliseconds
push
70h
;idTimer, timer identifier, nonzero
push
WP1_hWnd
;hwnd, handle of window for timer msg.
call
SetTimer
;- API Function ret
My_Create_Logo:
cmp
Flag_Logo,1h
;check flag
je
My_CreateLogo_return
;-----------------------------------------------------------------------------; API "CreateWindowExA" creates a window with a predefined class name (STATIC).
;-----------------------------------------------------------------------------push
0h
;lpParam, extra pointer data 0=no data
push
hInstance
;hInstance, handle of our program
push
560h
;hMenu, the child-window ID
push
WP1_hWnd
;hWndParent, handle parent window 0=no
push
0h
;intnHeight, window height pixel
push
0h
;intnWidth, window width pixel
push
1C2h
;inty, vertical position window
push
8h
;intx, horizontal position window
push
5000000Eh
;dwStyle, SS_BITMAP = 0Eh
push
OFFSET name_Logo
;lpWindowName, pointer to window name
push
OFFSET class_STATIC
;lpClassName, pointer to class name
push
0h
;dwExStyle, look WIN32.HLP + windows.inc
call
CreateWindowExA
;- API Function mov
hWnd_Logo,eax
;hwnd, return value=handle of window
mov
Flag_Logo,1h
;set flag
My_CreateLogo_return:
ret
My_Create_LV_Startup:
;-----------------------------------------------------------------------------; API "CreateWindowExA" creates a window, predefined class name (SysListView32)
;-----------------------------------------------------------------------------push
0h
;lpParam, extra pointer data 0=no data
push
hInstance
;hInstance, handle of our program
Page 51

td_win32asm_710.asm
push
600h
;hMenu, the child-window ID
push
WP1_hWnd
;hWndParent, handle parent window 0=no
push
17Eh
;intnHeight, window height pixel
push
262h
;intnWidth, window width pixel
push
3Ah
;inty, vertical position window
push
4h
;intx, horizontal position window
push
50000005h
;dwStyle, LVS_SINGLESEL=4h|LVS_REPORT=1h
push
0h
;lpWindowName, pointer to window name
push
OFFSET class_SysListView32 ;lpClassName, pointer to class name
push
300h
;dwExStyle, look WIN32.HLP + windows.inc
call
CreateWindowExA
;- API Function mov
hWnd_LV_Startup,eax
;hwnd, return value=handle of window
mov
temp,eax
;
call
My_LVM_SETCOLOR
;- SubRoutine mov
LVC_mask,7h
;LVCF_WIDTH=2h, LVCF_TEXT=4h, LVCF_FMT=1h
mov
LVC_fmt,0h
;LVCFMT_LEFT=0h
mov
LVC_cx,1BEh
;width of the column, in pixels
mov
LVC_pszText,OFFSET H0_Startup;pointer to text
;-----------------------------------------------------------------------------; API "SendMessageA" sends a message to the window
;-----------------------------------------------------------------------------push
OFFSET LVC_mask
;lParam, pcol, pointer LV_COLUMN structure
push
0h
;wParam, iCol, index of the new column
push
101Bh
;uMsg,LVM_FIRST=1000h | LVM_INSERTCOLUMN=27
push
hWnd_LV_Startup
;hwnd, handle of destination window
call
SendMessageA
;- API Function mov
LVC_cx,048h
;width of the column, in pixels
mov
LVC_pszText,OFFSET H0_Date ;pointer to text
;-----------------------------------------------------------------------------; API "SendMessageA" sends a message to the window
;-----------------------------------------------------------------------------push
OFFSET LVC_mask
;lParam, pcol, pointer LV_COLUMN structure
push
1h
;wParam, iCol, index of the new column
push
101Bh
;uMsg,LVM_FIRST=1000h | LVM_INSERTCOLUMN=27
push
hWnd_LV_Startup
;hwnd, handle of destination window
call
SendMessageA
;- API Function mov
LVC_cx,048h
;width of the column, in pixels
mov
LVC_pszText,OFFSET H1_Time ;pointer to text
;-----------------------------------------------------------------------------; API "SendMessageA" sends a message to the window
;-----------------------------------------------------------------------------push
OFFSET LVC_mask
;lParam, pcol, pointer LV_COLUMN structure
push
2h
;wParam, iCol, index of the new column
push
101Bh
;uMsg,LVM_FIRST=1000h | LVM_INSERTCOLUMN=27
push
hWnd_LV_Startup
;hwnd, handle of destination window
call
SendMessageA
;- API Function ret
My_Create_LV_Phonebook:
;-----------------------------------------------------------------------------; API "CreateWindowExA" creates a window, predefined class name (SysListView32)
;-----------------------------------------------------------------------------push
0h
;lpParam, extra pointer data 0=no data
Page 52

td_win32asm_710.asm
push
hInstance
;hInstance, handle of our program
push
610h
;hMenu, the child-window ID
push
WP1_hWnd
;hWndParent, handle parent window 0=no
push
17Eh
;intnHeight, window height pixel
push
262h
;intnWidth, window width pixel
push
3Ah
;inty, vertical position window
push
4h
;intx, horizontal position window
push
40000005h
;dwStyle, LVS_SINGLESEL=4h | LVS_REPORT=1h
push
0h
;lpWindowName, pointer to window name
push
OFFSET class_SysListView32 ;lpClassName, pointer to class name
push
300h
;dwExStyle, look WIN32.HLP + windows.inc
call
CreateWindowExA
;- API Function mov
hWnd_LV_Phonebook,eax
;hwnd, return value=handle of window
mov
temp,eax
call
My_LVM_SETCOLOR
;- SubRoutine mov
LVC_mask,7h
;LVCF_WIDTH=2h, LVCF_TEXT=4h, LVCF_FMT=1h
mov
LVC_fmt,0h
;LVCFMT_LEFT=0h
mov
LVC_cx,0A0h
;width of the column, in pixels
mov
LVC_pszText,OFFSET H0_Phonebook;pointer to text
;-----------------------------------------------------------------------------; API "SendMessageA" sends a message to the window
;-----------------------------------------------------------------------------push
OFFSET LVC_mask
;lParam, pcol, pointer LV_COLUMN structure
push
0h
;wParam, iCol, index of the new column
push
101Bh
;uMsg,LVM_FIRST=1000h | LVM_INSERTCOLUMN=27
push
hWnd_LV_Phonebook
;hwnd, handle of destination window
call
SendMessageA
;- API Function mov
LVC_cx,06Eh
;width of the column, in pixels
mov
LVC_pszText,OFFSET H1_Phonebook;pointer to text
;-----------------------------------------------------------------------------; API "SendMessageA" sends a message to the window
;-----------------------------------------------------------------------------push
OFFSET LVC_mask
;lParam, pcol, pointer LV_COLUMN structure
push
1h
;wParam, iCol, index of the new column
push
101Bh
;uMsg,LVM_FIRST=1000h | LVM_INSERTCOLUMN=27
push
hWnd_LV_Phonebook
;hwnd, handle of destination window
call
SendMessageA
;- API Function mov
LVC_cx,058h
;width of the column, in pixels
mov
LVC_pszText,OFFSET H2_Phonebook;pointer to text
;-----------------------------------------------------------------------------; API "SendMessageA" sends a message to the window
;-----------------------------------------------------------------------------push
OFFSET LVC_mask
;lParam, pcol, pointer LV_COLUMN structure
push
2h
;wParam, iCol, index of the new column
push
101Bh
;uMsg,LVM_FIRST=1000h | LVM_INSERTCOLUMN=27
push
hWnd_LV_Phonebook
;hwnd, handle of destination window
call
SendMessageA
;- API Function mov
LVC_cx,058h
;width of the column, in pixels
mov
LVC_pszText,OFFSET H3_Phonebook;pointer to text
;-----------------------------------------------------------------------------; API "SendMessageA" sends a message to the window
;-----------------------------------------------------------------------------push
OFFSET LVC_mask
;lParam, pcol, pointer LV_COLUMN structure
Page 53

td_win32asm_710.asm
push
3h
;wParam, iCol, index of the new column
push
101Bh
;uMsg,LVM_FIRST=1000h | LVM_INSERTCOLUMN=27
push
hWnd_LV_Phonebook
;hwnd, handle of destination window
call
SendMessageA
;- API Function mov
LVC_cx,048h
;width of the column, in pixels
mov
LVC_pszText,OFFSET H0_Date ;pointer to text
;-----------------------------------------------------------------------------; API "SendMessageA" sends a message to the window
;-----------------------------------------------------------------------------push
OFFSET LVC_mask
;lParam, pcol, pointer LV_COLUMN structure
push
4h
;wParam, iCol, index of the new column
push
101Bh
;uMsg,LVM_FIRST=1000h | LVM_INSERTCOLUMN=27
push
hWnd_LV_Phonebook
;hwnd, handle of destination window
call
SendMessageA
;- API Function mov
LVC_cx,048h
;width of the column, in pixels
mov
LVC_pszText,OFFSET H1_Time ;pointer to text
;-----------------------------------------------------------------------------; API "SendMessageA" sends a message to the window
;-----------------------------------------------------------------------------push
OFFSET LVC_mask
;lParam, pcol, pointer LV_COLUMN structure
push
5h
;wParam, iCol, index of the new column
push
101Bh
;uMsg,LVM_FIRST=1000h | LVM_INSERTCOLUMN=27
push
hWnd_LV_Phonebook
;hwnd, handle of destination window
call
SendMessageA
;- API Function ret
My_Create_LV_Lookup:
;-----------------------------------------------------------------------------; API "CreateWindowExA" creates a window, predefined class name (SysListView32)
;-----------------------------------------------------------------------------push
0h
;lpParam, extra pointer data 0=no data
push
hInstance
;hInstance, handle of our program
push
620h
;hMenu, the child-window ID
push
WP1_hWnd
;hWndParent, handle parent window 0=no
push
17Eh
;intnHeight, window height pixel
push
262h
;intnWidth, window width pixel
push
3Ah
;inty, vertical position window
push
4h
;intx, horizontal position window
push
40000005h
;dwStyle, LVS_SINGLESEL=4h|LVS_REPORT=1h
push
0h
;lpWindowName, pointer to window name
push
OFFSET class_SysListView32 ;lpClassName, pointer to class name
push
300h
;dwExStyle, look WIN32.HLP + windows.inc
call
CreateWindowExA
;- API Function mov
hWnd_LV_Lookup,eax
;hwnd, return value=handle of window
mov
temp,eax
call
My_LVM_SETCOLOR
;- SubRoutine mov
LVC_mask,7h
;LVCF_WIDTH=2h, LVCF_TEXT=4h, LVCF_FMT=1h
mov
LVC_fmt,0h
;LVCFMT_LEFT=0h
mov
LVC_cx,0DFh
;width of the column, in pixels
mov
LVC_pszText,OFFSET H0_Lookup;pointer to text
;-----------------------------------------------------------------------------; API "SendMessageA" sends a message to the window
;-----------------------------------------------------------------------------Page 54

td_win32asm_710.asm
push
OFFSET LVC_mask
;lParam, pcol, pointer LV_COLUMN structure
push
0h
;wParam, iCol, index of the new column
push
101Bh
;uMsg,LVM_FIRST=1000h | LVM_INSERTCOLUMN=27
push
hWnd_LV_Lookup
;hwnd, handle of destination window
call
SendMessageA
;- API Function mov
LVC_cx,0DFh
;width of the column, in pixels
mov
LVC_pszText,OFFSET H1_Lookup;pointer to text
;-----------------------------------------------------------------------------; API "SendMessageA" sends a message to the window
;-----------------------------------------------------------------------------push
OFFSET LVC_mask
;lParam, pcol, pointer LV_COLUMN structure
push
1h
;wParam, iCol, index of the new column
push
101Bh
;uMsg,LVM_FIRST=1000h | LVM_INSERTCOLUMN=27
push
hWnd_LV_Lookup
;hwnd, handle of destination window
call
SendMessageA
;- API Function mov
LVC_cx,048h
;width of the column, in pixels
mov
LVC_pszText,OFFSET H0_Date ;pointer to text
;-----------------------------------------------------------------------------; API "SendMessageA" sends a message to the window
;-----------------------------------------------------------------------------push
OFFSET LVC_mask
;lParam, pcol, pointer LV_COLUMN structure
push
2h
;wParam, iCol, index of the new column
push
101Bh
;uMsg,LVM_FIRST=1000h | LVM_INSERTCOLUMN=27
push
hWnd_LV_Lookup
;hwnd, handle of destination window
call
SendMessageA
;- API Function mov
LVC_cx,048h
;width of the column, in pixels
mov
LVC_pszText,OFFSET H1_Time ;pointer to text
;-----------------------------------------------------------------------------; API "SendMessageA" sends a message to the window
;-----------------------------------------------------------------------------push
OFFSET LVC_mask
;lParam, pcol, pointer LV_COLUMN structure
push
3h
;wParam, iCol, index of the new column
push
101Bh
;uMsg,LVM_FIRST=1000h | LVM_INSERTCOLUMN=27
push
hWnd_LV_Lookup
;hwnd, handle of destination window
call
SendMessageA
;- API Function ret
My_Create_LV_LocalHost:
;-----------------------------------------------------------------------------; API "CreateWindowExA" creates a window, predefined class name (SysListView32)
;-----------------------------------------------------------------------------push
0h
;lpParam, extra pointer data 0=no data
push
hInstance
;hInstance, handle of our program
push
630h
;hMenu, the child-window ID
push
WP1_hWnd
;hWndParent, handle parent window 0=no
push
17Eh
;intnHeight, window height pixel
push
262h
;intnWidth, window width pixel
push
3Ah
;inty, vertical position window
push
4h
;intx, horizontal position window
push
40000005h
;dwStyle, LVS_SINGLESEL=4h|LVS_REPORT=1h
push
0h
;lpWindowName, pointer to window name
push
OFFSET class_SysListView32 ;lpClassName, pointer to class name
push
300h
;dwExStyle, look WIN32.HLP + windows.inc
Page 55

td_win32asm_710.asm
call
CreateWindowExA
;- API Function mov
hWnd_LV_LocalHost,eax
;hwnd, return value=handle of window
mov
temp,eax
call
My_LVM_SETCOLOR
;- SubRoutine mov
LVC_mask,7h
;LVCF_WIDTH=2h, LVCF_TEXT=4h, LVCF_FMT=1h
mov
LVC_fmt,0h
;LVCFMT_LEFT=0h
mov
LVC_cx,0DFh
;width of the column, in pixels
mov
LVC_pszText,OFFSET H0_LocalHost;pointer to text
;-----------------------------------------------------------------------------; API "SendMessageA" sends a message to the window
;-----------------------------------------------------------------------------push
OFFSET LVC_mask
;lParam, pcol, pointer LV_COLUMN structure
push
0h
;wParam, iCol, index of the new column
push
101Bh
;uMsg,LVM_FIRST=1000h | LVM_INSERTCOLUMN=27
push
hWnd_LV_LocalHost
;hwnd, handle of destination window
call
SendMessageA
;- API Function mov
LVC_cx,0DFh
;width of the column, in pixels
mov
LVC_pszText,OFFSET H1_LocalHost;pointer to text
;-----------------------------------------------------------------------------; API "SendMessageA" sends a message to the window
;-----------------------------------------------------------------------------push
OFFSET LVC_mask
;lParam, pcol, pointer LV_COLUMN structure
push
1h
;wParam, iCol, index of the new column
push
101Bh
;uMsg,LVM_FIRST=1000h | LVM_INSERTCOLUMN=27
push
hWnd_LV_LocalHost
;hwnd, handle of destination window
call
SendMessageA
;- API Function mov
LVC_cx,048h
;width of the column, in pixels
mov
LVC_pszText,OFFSET H0_Date ;pointer to text
;-----------------------------------------------------------------------------; API "SendMessageA" sends a message to the window
;-----------------------------------------------------------------------------push
OFFSET LVC_mask
;lParam, pcol, pointer LV_COLUMN structure
push
2h
;wParam, iCol, index of the new column
push
101Bh
;uMsg,LVM_FIRST=1000h | LVM_INSERTCOLUMN=27
push
hWnd_LV_LocalHost
;hwnd, handle of destination window
call
SendMessageA
;- API Function mov
LVC_cx,048h
;width of the column, in pixels
mov
LVC_pszText,OFFSET H1_Time ;pointer to text
;-----------------------------------------------------------------------------; API "SendMessageA" sends a message to the window
;-----------------------------------------------------------------------------push
OFFSET LVC_mask
;lParam, pcol, pointer LV_COLUMN structure
push
3h
;wParam, iCol, index of the new column
push
101Bh
;uMsg,LVM_FIRST=1000h | LVM_INSERTCOLUMN=27
push
hWnd_LV_LocalHost
;hwnd, handle of destination window
call
SendMessageA
;- API Function ret
My_Create_LV_ActiveRAS:
;-----------------------------------------------------------------------------; API "CreateWindowExA" creates a window, predefined class name (SysListView32)
;-----------------------------------------------------------------------------push
0h
;lpParam, extra pointer data 0=no data
Page 56

td_win32asm_710.asm
push
hInstance
;hInstance, handle of our program
push
640h
;hMenu, the child-window ID
push
WP1_hWnd
;hWndParent, handle parent window 0=no
push
17Eh
;intnHeight, window height pixel
push
262h
;intnWidth, window width pixel
push
3Ah
;inty, vertical position window
push
4h
;intx, horizontal position window
push
40000005h
;dwStyle, LVS_SINGLESEL=4h|LVS_REPORT=1h
push
0h
;lpWindowName, pointer to window name
push
OFFSET class_SysListView32 ;lpClassName, pointer to class name
push
300h
;dwExStyle, look WIN32.HLP + windows.inc
call
CreateWindowExA
;- API Function mov
hWnd_LV_ActiveRAS,eax
;hwnd, return value=handle of window
mov
temp,eax
call
My_LVM_SETCOLOR
;- SubRoutine mov
LVC_mask,7h
;LVCF_WIDTH=2h, LVCF_TEXT=4h, LVCF_FMT=1h
mov
LVC_fmt,0h
;LVCFMT_LEFT=0h
mov
LVC_cx,1BEh
;width of the column, in pixels
mov
LVC_pszText,OFFSET H0_ActiveRAS;pointer to text
;-----------------------------------------------------------------------------; API "SendMessageA" sends a message to the window
;-----------------------------------------------------------------------------push
OFFSET LVC_mask
;lParam, pcol, pointer LV_COLUMN structure
push
0h
;wParam, iCol, index of the new column
push
101Bh
;uMsg,LVM_FIRST=1000h | LVM_INSERTCOLUMN=27
push
hWnd_LV_ActiveRAS
;hwnd, handle of destination window
call
SendMessageA
;- API Function mov
LVC_cx,048h
;width of the column, in pixels
mov
LVC_pszText,OFFSET H0_Date ;pointer to text
;-----------------------------------------------------------------------------; API "SendMessageA" sends a message to the window
;-----------------------------------------------------------------------------push
OFFSET LVC_mask
;lParam, pcol, pointer LV_COLUMN structure
push
1h
;wParam, iCol, index of the new column
push
101Bh
;uMsg,LVM_FIRST=1000h | LVM_INSERTCOLUMN=27
push
hWnd_LV_ActiveRAS
;hwnd, handle of destination window
call
SendMessageA
;- API Function mov
LVC_cx,048h
;width of the column, in pixels
mov
LVC_pszText,OFFSET H1_Time ;pointer to text
;-----------------------------------------------------------------------------; API "SendMessageA" sends a message to the window
;-----------------------------------------------------------------------------push
OFFSET LVC_mask
;lParam, pcol, pointer LV_COLUMN structure
push
2h
;wParam, iCol, index of the new column
push
101Bh
;uMsg,LVM_FIRST=1000h | LVM_INSERTCOLUMN=27
push
hWnd_LV_ActiveRAS
;hwnd, handle of destination window
call
SendMessageA
;- API Function ret
My_Create_LV_RASDial:
;-----------------------------------------------------------------------------; API "CreateWindowExA" creates a window, predefined class name (SysListView32)
;-----------------------------------------------------------------------------Page 57

td_win32asm_710.asm
push
0h
;lpParam, extra pointer data 0=no data
push
hInstance
;hInstance, handle of our program
push
650h
;hMenu, the child-window ID
push
WP1_hWnd
;hWndParent, handle parent window 0=no
push
17Eh
;intnHeight, window height pixel
push
262h
;intnWidth, window width pixel
push
3Ah
;inty, vertical position window
push
4h
;intx, horizontal position window
push
40000005h
;dwStyle, LVS_SINGLESEL=4h | LVS_REPORT=1h
push
0h
;lpWindowName, pointer to window name
push
OFFSET class_SysListView32 ;lpClassName, pointer to class name
push
300h
;dwExStyle, look WIN32.HLP + windows.inc
call
CreateWindowExA
;- API Function mov
hWnd_LV_RASDial,eax
;hwnd, return value=handle of window
mov
temp,eax
;
call
My_LVM_SETCOLOR
;- SubRoutine mov
LVC_mask,7h
;LVCF_WIDTH=2h, LVCF_TEXT=4h, LVCF_FMT=1h
mov
LVC_fmt,0h
;LVCFMT_LEFT=0h
mov
LVC_cx,0A0h
;width of the column, in pixels
mov
LVC_pszText,OFFSET H0_RASDial;pointer to text
;-----------------------------------------------------------------------------; API "SendMessageA" sends a message to the window
;-----------------------------------------------------------------------------push
OFFSET LVC_mask
;lParam, pcol, pointer LV_COLUMN structure
push
0h
;wParam, iCol, index of the new column
push
101Bh
;uMsg,LVM_FIRST=1000h | LVM_INSERTCOLUMN=27
push
hWnd_LV_RASDial
;hwnd, handle of destination window
call
SendMessageA
;- API Function mov
LVC_cx,05Ah
;width of the column, in pixels
mov
LVC_pszText,OFFSET H1_RASDial;pointer to text
;-----------------------------------------------------------------------------; API "SendMessageA" sends a message to the window
;-----------------------------------------------------------------------------push
OFFSET LVC_mask
;lParam, pcol, pointer LV_COLUMN structure
push
1h
;wParam, iCol, index of the new column
push
101Bh
;uMsg,LVM_FIRST=1000h | LVM_INSERTCOLUMN=27
push
hWnd_LV_RASDial
;hwnd, handle of destination window
call
SendMessageA
;- API Function mov
LVC_cx,04Ah
;width of the column, in pixels
mov
LVC_pszText,OFFSET H2_RASDial;pointer to text
;-----------------------------------------------------------------------------; API "SendMessageA" sends a message to the window
;-----------------------------------------------------------------------------push
OFFSET LVC_mask
;lParam, pcol, pointer LV_COLUMN structure
push
2h
;wParam, iCol, index of the new column
push
101Bh
;uMsg,LVM_FIRST=1000h | LVM_INSERTCOLUMN=27
push
hWnd_LV_RASDial
;hwnd, handle of destination window
call
SendMessageA
;- API Function mov
LVC_cx,04Ah
;width of the column, in pixels
mov
LVC_pszText,OFFSET H3_RASDial;pointer to text
;-----------------------------------------------------------------------------; API "SendMessageA" sends a message to the window
;-----------------------------------------------------------------------------Page 58

td_win32asm_710.asm
push
OFFSET LVC_mask
;lParam, pcol, pointer LV_COLUMN structure
push
3h
;wParam, iCol, index of the new column
push
101Bh
;uMsg,LVM_FIRST=1000h | LVM_INSERTCOLUMN=27
push
hWnd_LV_RASDial
;hwnd, handle of destination window
call
SendMessageA
;- API Function mov
LVC_cx,38h
;width of the column, in pixels
mov
LVC_pszText,OFFSET H4_RASDial;pointer to text
;-----------------------------------------------------------------------------; API "SendMessageA" sends a message to the window
;-----------------------------------------------------------------------------push
OFFSET LVC_mask
;lParam, pcol, pointer LV_COLUMN structure
push
4h
;wParam, iCol, index of the new column
push
101Bh
;uMsg,LVM_FIRST=1000h | LVM_INSERTCOLUMN=27
push
hWnd_LV_RASDial
;hwnd, handle of destination window
call
SendMessageA
;- API Function mov
LVC_cx,048h
;width of the column, in pixels
mov
LVC_pszText,OFFSET H0_Date ;pointer to text
;-----------------------------------------------------------------------------; API "SendMessageA" sends a message to the window
;-----------------------------------------------------------------------------push
OFFSET LVC_mask
;lParam, pcol, pointer LV_COLUMN structure
push
5h
;wParam, iCol, index of the new column
push
101Bh
;uMsg,LVM_FIRST=1000h | LVM_INSERTCOLUMN=27
push
hWnd_LV_RASDial
;hwnd, handle of destination window
call
SendMessageA
;- API Function mov
LVC_cx,040h
;width of the column, in pixels
mov
LVC_pszText,OFFSET H1_Time ;pointer to text
;-----------------------------------------------------------------------------; API "SendMessageA" sends a message to the window
;-----------------------------------------------------------------------------push
OFFSET LVC_mask
;lParam, pcol, pointer LV_COLUMN structure
push
6h
;wParam, iCol, index of the new column
push
101Bh
;uMsg,LVM_FIRST=1000h | LVM_INSERTCOLUMN=27
push
hWnd_LV_RASDial
;hwnd, handle of destination window
call
SendMessageA
;- API Function ret
My_Create_LV_PortScan:
;-----------------------------------------------------------------------------; API "CreateWindowExA" creates a window, predefined class name (SysListView32)
;-----------------------------------------------------------------------------push
0h
;lpParam, extra pointer data 0=no data
push
hInstance
;hInstance, handle of our program
push
660h
;hMenu, the child-window ID
push
WP1_hWnd
;hWndParent, handle parent window 0=no
push
17Eh
;intnHeight, window height pixel
push
262h
;intnWidth, window width pixel
push
3Ah
;inty, vertical position window
push
4h
;intx, horizontal position window
push
40000005h
;dwStyle, LVS_SINGLESEL=4h | LVS_REPORT=1h
push
0h
;lpWindowName, pointer to window name
push
OFFSET class_SysListView32 ;lpClassName, pointer to class name
push
300h
;dwExStyle, look WIN32.HLP + windows.inc
Page 59

td_win32asm_710.asm
call
CreateWindowExA
;- API Function mov
hWnd_LV_PortScan,eax
;hwnd, return value=handle of window
mov
temp,eax
;
call
My_LVM_SETCOLOR
;- SubRoutine mov
LVC_mask,7h
;LVCF_WIDTH=2h, LVCF_TEXT=4h, LVCF_FMT=1h
mov
LVC_fmt,0h
;LVCFMT_LEFT=0h
mov
LVC_cx,0DAh
;width of the column, in pixels
mov
LVC_pszText,OFFSET H0_PortScan;pointer to text
;-----------------------------------------------------------------------------; API "SendMessageA" sends a message to the window
;-----------------------------------------------------------------------------push
OFFSET LVC_mask
;lParam, pcol, pointer LV_COLUMN structure
push
0h
;wParam, iCol, index of the new column
push
101Bh
;uMsg,LVM_FIRST=1000h | LVM_INSERTCOLUMN=27
push
hWnd_LV_PortScan
;hwnd, handle of destination window
call
SendMessageA
;- API Function mov
LVC_cx,050h
;width of the column, in pixels
mov
LVC_pszText,OFFSET H1_PortScan;pointer to text
;-----------------------------------------------------------------------------; API "SendMessageA" sends a message to the window
;-----------------------------------------------------------------------------push
OFFSET LVC_mask
;lParam, pcol, pointer LV_COLUMN structure
push
1h
;wParam, iCol, index of the new column
push
101Bh
;uMsg,LVM_FIRST=1000h | LVM_INSERTCOLUMN=27
push
hWnd_LV_PortScan
;hwnd, handle of destination window
call
SendMessageA
;- API Function mov
LVC_cx,094h
;width of the column, in pixels
mov
LVC_pszText,OFFSET H2_PortScan;pointer to text
;-----------------------------------------------------------------------------; API "SendMessageA" sends a message to the window
;-----------------------------------------------------------------------------push
OFFSET LVC_mask
;lParam, pcol, pointer LV_COLUMN structure
push
2h
;wParam, iCol, index of the new column
push
101Bh
;uMsg,LVM_FIRST=1000h | LVM_INSERTCOLUMN=27
push
hWnd_LV_PortScan
;hwnd, handle of destination window
call
SendMessageA
;- API Function mov
LVC_cx,048h
;width of the column, in pixels
mov
LVC_pszText,OFFSET H0_Date ;pointer to text
;-----------------------------------------------------------------------------; API "SendMessageA" sends a message to the window
;-----------------------------------------------------------------------------push
OFFSET LVC_mask
;lParam, pcol, pointer LV_COLUMN structure
push
3h
;wParam, iCol, index of the new column
push
101Bh
;uMsg,LVM_FIRST=1000h | LVM_INSERTCOLUMN=27
push
hWnd_LV_PortScan
;hwnd, handle of destination window
call
SendMessageA
;- API Function mov
LVC_cx,048h
;width of the column, in pixels
mov
LVC_pszText,OFFSET H1_Time ;pointer to text
;-----------------------------------------------------------------------------; API "SendMessageA" sends a message to the window
;-----------------------------------------------------------------------------push
OFFSET LVC_mask
;lParam, pcol, pointer LV_COLUMN structure
push
4h
;wParam, iCol, index of the new column
Page 60

push
push
call
ret

101Bh
hWnd_LV_PortScan
SendMessageA

td_win32asm_710.asm
;uMsg,LVM_FIRST=1000h | LVM_INSERTCOLUMN=27
;hwnd, handle of destination window
;- API Function -

My_Create_LV_Settings:
;-----------------------------------------------------------------------------; API "CreateWindowExA" creates a window, predefined class name (SysListView32)
;-----------------------------------------------------------------------------push
0h
;lpParam, extra pointer data 0=no data
push
hInstance
;hInstance, handle of our program
push
670h
;hMenu, the child-window ID
push
WP1_hWnd
;hWndParent, handle parent window 0=no
push
17Eh
;intnHeight, window height pixel
push
262h
;intnWidth, window width pixel
push
3Ah
;inty, vertical position window
push
4h
;intx, horizontal position window
push
40000005h
;dwStyle, LVS_SINGLESEL=4h|LVS_REPORT=1h
push
0h
;lpWindowName, pointer to window name
push
OFFSET class_SysListView32 ;lpClassName, pointer to class name
push
300h
;dwExStyle, look WIN32.HLP + windows.inc
call
CreateWindowExA
;- API Function mov
hWnd_LV_Settings,eax
;hwnd, return value=handle of window
mov
temp,eax
call
My_LVM_SETCOLOR
;- SubRoutine mov
LVC_mask,7h
;LVCF_WIDTH=2h, LVCF_TEXT=4h, LVCF_FMT=1h
mov
LVC_fmt,0h
;LVCFMT_LEFT=0h
mov
LVC_cx,0DFh
;width of the column, in pixels
mov
LVC_pszText,OFFSET H0_Settings;pointer to text
;-----------------------------------------------------------------------------; API "SendMessageA" sends a message to the window
;-----------------------------------------------------------------------------push
OFFSET LVC_mask
;lParam, pcol, pointer LV_COLUMN structure
push
0h
;wParam, iCol, index of the new column
push
101Bh
;uMsg,LVM_FIRST=1000h | LVM_INSERTCOLUMN=27
push
hWnd_LV_Settings
;hwnd, handle of destination window
call
SendMessageA
;- API Function mov
LVC_cx,0DFh
;width of the column, in pixels
mov
LVC_pszText,OFFSET H1_Settings;pointer to text
;-----------------------------------------------------------------------------; API "SendMessageA" sends a message to the window
;-----------------------------------------------------------------------------push
OFFSET LVC_mask
;lParam, pcol, pointer LV_COLUMN structure
push
1h
;wParam, iCol, index of the new column
push
101Bh
;uMsg,LVM_FIRST=1000h | LVM_INSERTCOLUMN=27
push
hWnd_LV_Settings
;hwnd, handle of destination window
call
SendMessageA
;- API Function mov
LVC_cx,048h
;width of the column, in pixels
mov
LVC_pszText,OFFSET H0_Date ;pointer to text
;-----------------------------------------------------------------------------; API "SendMessageA" sends a message to the window
;-----------------------------------------------------------------------------push
OFFSET LVC_mask
;lParam, pcol, pointer LV_COLUMN structure
Page 61

td_win32asm_710.asm
push
2h
;wParam, iCol, index of the new column
push
101Bh
;uMsg,LVM_FIRST=1000h | LVM_INSERTCOLUMN=27
push
hWnd_LV_Settings
;hwnd, handle of destination window
call
SendMessageA
;- API Function mov
LVC_cx,048h
;width of the column, in pixels
mov
LVC_pszText,OFFSET H1_Time ;pointer to text
;-----------------------------------------------------------------------------; API "SendMessageA" sends a message to the window
;-----------------------------------------------------------------------------push
OFFSET LVC_mask
;lParam, pcol, pointer LV_COLUMN structure
push
3h
;wParam, iCol, index of the new column
push
101Bh
;uMsg,LVM_FIRST=1000h | LVM_INSERTCOLUMN=27
push
hWnd_LV_Settings
;hwnd, handle of destination window
call
SendMessageA
;- API Function ret
My_Create_LV_GAI:
;-----------------------------------------------------------------------------; API "CreateWindowExA" creates a window, predefined class name (SysListView32)
;-----------------------------------------------------------------------------push
0h
;lpParam, extra pointer data 0=no data
push
hInstance
;hInstance, handle of our program
push
680h
;hMenu, the child-window ID
push
WP1_hWnd
;hWndParent, handle parent window 0=no
push
17Eh
;intnHeight, window height pixel
push
262h
;intnWidth, window width pixel
push
3Ah
;inty, vertical position window
push
4h
;intx, horizontal position window
push
40000005h
;dwStyle, LVS_SINGLESEL=4h|LVS_REPORT=1h
push
0h
;lpWindowName, pointer to window name
push
OFFSET class_SysListView32 ;lpClassName, pointer to class name
push
300h
;dwExStyle, look WIN32.HLP + windows.inc
call
CreateWindowExA
;- API Function mov
hWnd_LV_GAI,eax
;hwnd, return value=handle of window
mov
temp,eax
;
call
My_LVM_SETCOLOR
;- SubRoutine mov
LVC_mask,7h
;LVCF_WIDTH=2h, LVCF_TEXT=4h, LVCF_FMT=1h
mov
LVC_fmt,0h
;LVCFMT_LEFT=0h
mov
LVC_cx,088h
;width of the column, in pixels
mov
LVC_pszText,OFFSET H0_GAI
;pointer to text
;-----------------------------------------------------------------------------; API "SendMessageA" sends a message to the window
;-----------------------------------------------------------------------------push
OFFSET LVC_mask
;lParam, pcol, pointer LV_COLUMN structure
push
0h
;wParam, iCol, index of the new column
push
101Bh
;uMsg,LVM_FIRST=1000h | LVM_INSERTCOLUMN=27
push
hWnd_LV_GAI
;hwnd, handle of destination window
call
SendMessageA
;- API Function mov
LVC_cx,070h
;width of the column, in pixels
mov
LVC_pszText,OFFSET H1_GAI
;pointer to text
;-----------------------------------------------------------------------------; API "SendMessageA" sends a message to the window
;-----------------------------------------------------------------------------Page 62

td_win32asm_710.asm
push
OFFSET LVC_mask
;lParam, pcol, pointer LV_COLUMN structure
push
1h
;wParam, iCol, index of the new column
push
101Bh
;uMsg,LVM_FIRST=1000h | LVM_INSERTCOLUMN=27
push
hWnd_LV_GAI
;hwnd, handle of destination window
call
SendMessageA
;- API Function mov
LVC_cx,070h
;width of the column, in pixels
mov
LVC_pszText,OFFSET H3_GAI
;pointer to text
;-----------------------------------------------------------------------------; API "SendMessageA" sends a message to the window
;-----------------------------------------------------------------------------push
OFFSET LVC_mask
;lParam, pcol, pointer LV_COLUMN structure
push
2h
;wParam, iCol, index of the new column
push
101Bh
;uMsg,LVM_FIRST=1000h | LVM_INSERTCOLUMN=27
push
hWnd_LV_GAI
;hwnd, handle of destination window
call
SendMessageA
;- API Function mov
LVC_cx,070h
;width of the column, in pixels
mov
LVC_pszText,OFFSET H4_GAI
;pointer to text
;-----------------------------------------------------------------------------; API "SendMessageA" sends a message to the window
;-----------------------------------------------------------------------------push
OFFSET LVC_mask
;lParam, pcol, pointer LV_COLUMN structure
push
3h
;wParam, iCol, index of the new column
push
101Bh
;uMsg,LVM_FIRST=1000h | LVM_INSERTCOLUMN=27
push
hWnd_LV_GAI
;hwnd, handle of destination window
call
SendMessageA
;- API Function mov
LVC_cx,070h
;width of the column, in pixels
mov
LVC_pszText,OFFSET H5_GAI
;pointer to text
;-----------------------------------------------------------------------------; API "SendMessageA" sends a message to the window
;-----------------------------------------------------------------------------push
OFFSET LVC_mask
;lParam, pcol, pointer LV_COLUMN structure
push
4h
;wParam, iCol, index of the new column
push
101Bh
;uMsg,LVM_FIRST=1000h | LVM_INSERTCOLUMN=27
push
hWnd_LV_GAI
;hwnd, handle of destination window
call
SendMessageA
;- API Function mov
LVC_cx,070h
;width of the column, in pixels
mov
LVC_pszText,OFFSET H6_GAI
;pointer to text
;-----------------------------------------------------------------------------; API "SendMessageA" sends a message to the window
;-----------------------------------------------------------------------------push
OFFSET LVC_mask
;lParam, pcol, pointer LV_COLUMN structure
push
5h
;wParam, iCol, index of the new column
push
101Bh
;uMsg,LVM_FIRST=1000h | LVM_INSERTCOLUMN=27
push
hWnd_LV_GAI
;hwnd, handle of destination window
call
SendMessageA
;- API Function ret
My_Create_LV_Help:
;-----------------------------------------------------------------------------; API "CreateWindowExA" creates a window, predefined class name (SysListView32)
;-----------------------------------------------------------------------------push
0h
;lpParam, extra pointer data 0=no data
push
hInstance
;hInstance, handle of our program
Page 63

td_win32asm_710.asm
push
690h
;hMenu, the child-window ID
push
WP1_hWnd
;hWndParent, handle parent window 0=no
push
17Eh
;intnHeight, window height pixel
push
262h
;intnWidth, window width pixel
push
3Ah
;inty, vertical position window
push
4h
;intx, horizontal position window
push
40000105h
;dwStyle, LVS_SINGLESEL=4h|LVS_REPORT=1h
push
0h
;lpWindowName, pointer to window name
push
OFFSET class_SysListView32 ;lpClassName, pointer to class name
push
300h
;dwExStyle, look WIN32.HLP + windows.inc
call
CreateWindowExA
;- API Function mov
hWnd_LV_Help,eax
;hwnd, return value=handle of window
mov
temp,eax
call
My_LVM_SETCOLOR
;- SubRoutine mov
LVC_mask,7h
;LVCF_WIDTH=2h, LVCF_TEXT=4h, LVCF_FMT=1h
mov
LVC_fmt,0h
;LVCFMT_LEFT=0h
mov
LVC_cx,24Ch
;width of the column, in pixels
mov
LVC_pszText,OFFSET H0_Help ;pointer to text
;-----------------------------------------------------------------------------; API "SendMessageA" sends a message to the window
;-----------------------------------------------------------------------------push
OFFSET LVC_mask
;lParam, pcol, pointer LV_COLUMN structure
push
0h
;wParam, iCol, index of the new column
push
101Bh
;uMsg,LVM_FIRST=1000h | LVM_INSERTCOLUMN=27
push
hWnd_LV_Help
;hwnd, handle of destination window
call
SendMessageA
;- API Function ;-----------------------------------------------------------------------------; API "ImageList_Create" creates a new image list.
;-----------------------------------------------------------------------------push
28
;cGrow, number of images list can grow
push
28
;cInitial, number of images on initially
push
0008h
;flags, ILC_COLOR8=0008h
push
20
;cy, height of my bitmap
push
20
;cx, width of one bitmap
call
ImageList_Create
;- API Function mov
hImageList_Help,eax
;
;-----------------------------------------------------------------------------; API "LoadBitmap" loads the bitmap resource from a module's executable file.
;-----------------------------------------------------------------------------push
512
;lpBitmapName, bitmap resource ID
push
hInstance
;hInstance, handle of modul instance
call
LoadBitmapA
;- API Function mov
hObj_Toolbar,eax
;handle of bitmap graphic
;-----------------------------------------------------------------------------; API "ImageList_Add" adds an image or images to an image list.
;-----------------------------------------------------------------------------push
0h
;hbmMask, handle bitmap containing the mask
push
hObj_Toolbar
;hbmImage, handle bitmap containing the image
push
hImageList_Help
;himl, handle to the image list
call
ImageList_Add
;- API Function ;-----------------------------------------------------------------------------; API "DeleteObject" deletes a bitmap freeing all associated system resources
;-----------------------------------------------------------------------------Page 64

td_win32asm_710.asm
push
hObj_Toolbar
;hObject, handle of graphic object
call
DeleteObject
;- API Function ;-----------------------------------------------------------------------------; API "SendMessageA" sends a message to the window
;-----------------------------------------------------------------------------push
hImageList_Help
;lParam, himl, handle image list to assign
push
1h
;wParam, iImageList, type, LVSIL_SMALL=1h
push
1003h
;uMsg,LVM_FIRST=1000h | LVM_SETIMAGELIST=3h
push
hWnd_LV_Help
;hwnd, handle of destination window
call
SendMessageA
;- API Function mov
LVI_iImage,19h
mov
ebx,OFFSET M190_Help
call
My_LVM_INSERTITEM_IMAGE
;- SubRoutine mov
LVI_iImage,99h
mov
ebx,OFFSET M191_Help
call
My_LVM_INSERTITEM_IMAGE
;- SubRoutine mov
LVI_iImage,99h
mov
ebx,OFFSET M192_Help
call
My_LVM_INSERTITEM_IMAGE
;- SubRoutine mov
LVI_iImage,99h
mov
ebx,OFFSET MFFF_Help
call
My_LVM_INSERTITEM_IMAGE
;- SubRoutine mov
LVI_iImage,0h
mov
ebx,OFFSET M000_Help
call
My_LVM_INSERTITEM_IMAGE
;- SubRoutine mov
LVI_iImage,99h
mov
ebx,OFFSET M001_Help
call
My_LVM_INSERTITEM_IMAGE
;- SubRoutine mov
LVI_iImage,99h
mov
ebx,OFFSET MFFF_Help
call
My_LVM_INSERTITEM_IMAGE
;- SubRoutine mov
LVI_iImage,1h
mov
ebx,OFFSET M010_Help
call
My_LVM_INSERTITEM_IMAGE
;- SubRoutine mov
LVI_iImage,99h
mov
ebx,OFFSET M011_Help
call
My_LVM_INSERTITEM_IMAGE
;- SubRoutine mov
LVI_iImage,99h
mov
ebx,OFFSET M012_Help
call
My_LVM_INSERTITEM_IMAGE
;- SubRoutine mov
LVI_iImage,99h
mov
ebx,OFFSET MFFF_Help
call
My_LVM_INSERTITEM_IMAGE
;- SubRoutine mov
LVI_iImage,2h
mov
ebx,OFFSET M020_Help
call
My_LVM_INSERTITEM_IMAGE
;- SubRoutine mov
LVI_iImage,99h
mov
ebx,OFFSET M021_Help
call
My_LVM_INSERTITEM_IMAGE
;- SubRoutine mov
LVI_iImage,99h
mov
ebx,OFFSET MFFF_Help
call
My_LVM_INSERTITEM_IMAGE
;- SubRoutine mov
LVI_iImage,3h
Page 65

td_win32asm_710.asm
mov
call
mov
mov
call
mov
mov
call
mov
mov
call
mov
mov
call
mov
mov
call
mov
mov
call
mov
mov
call
mov
mov
call
mov
mov
call
mov
mov
call
mov
mov
call
mov
mov
call
mov
mov
call
mov
mov
call
mov
mov
call
mov
mov
call
mov
mov
call

ebx,OFFSET M030_Help
My_LVM_INSERTITEM_IMAGE
LVI_iImage,99h
ebx,OFFSET M031_Help
My_LVM_INSERTITEM_IMAGE
LVI_iImage,99h
ebx,OFFSET MFFF_Help
My_LVM_INSERTITEM_IMAGE
LVI_iImage,4h
ebx,OFFSET M040_Help
My_LVM_INSERTITEM_IMAGE
LVI_iImage,99h
ebx,OFFSET M041_Help
My_LVM_INSERTITEM_IMAGE
LVI_iImage,99h
ebx,OFFSET MFFF_Help
My_LVM_INSERTITEM_IMAGE
LVI_iImage,5h
ebx,OFFSET M050_Help
My_LVM_INSERTITEM_IMAGE
LVI_iImage,99h
ebx,OFFSET M051_Help
My_LVM_INSERTITEM_IMAGE
LVI_iImage,99h
ebx,OFFSET M052_Help
My_LVM_INSERTITEM_IMAGE
LVI_iImage,99h
ebx,OFFSET MFFF_Help
My_LVM_INSERTITEM_IMAGE
LVI_iImage,6h
ebx,OFFSET M060_Help
My_LVM_INSERTITEM_IMAGE
LVI_iImage,99h
ebx,OFFSET M061_Help
My_LVM_INSERTITEM_IMAGE
LVI_iImage,99h
ebx,OFFSET MFFF_Help
My_LVM_INSERTITEM_IMAGE
LVI_iImage,18h
ebx,OFFSET M180_Help
My_LVM_INSERTITEM_IMAGE
LVI_iImage,99h
ebx,OFFSET M181_Help
My_LVM_INSERTITEM_IMAGE
LVI_iImage,99h
ebx,OFFSET M182_Help
My_LVM_INSERTITEM_IMAGE
LVI_iImage,99h
ebx,OFFSET MFFF_Help
My_LVM_INSERTITEM_IMAGE
LVI_iImage,1Ah
ebx,OFFSET M1A0_Help
My_LVM_INSERTITEM_IMAGE

;- SubRoutine ;- SubRoutine ;- SubRoutine ;- SubRoutine ;- SubRoutine ;- SubRoutine ;- SubRoutine ;- SubRoutine ;- SubRoutine ;- SubRoutine ;- SubRoutine ;- SubRoutine ;- SubRoutine ;- SubRoutine ;- SubRoutine ;- SubRoutine ;- SubRoutine ;- SubRoutine Page 66

td_win32asm_710.asm
mov
mov
call
mov
mov
call
mov
mov
call
mov
mov
call
mov
mov
call
mov
mov
call
mov
mov
call
mov
mov
call
ret

LVI_iImage,99h
ebx,OFFSET M1A1_Help
My_LVM_INSERTITEM_IMAGE
LVI_iImage,99h
ebx,OFFSET M1A2_Help
My_LVM_INSERTITEM_IMAGE
LVI_iImage,99h
ebx,OFFSET M1A3_Help
My_LVM_INSERTITEM_IMAGE
LVI_iImage,99h
ebx,OFFSET MFFF_Help
My_LVM_INSERTITEM_IMAGE
LVI_iImage,1Bh
ebx,OFFSET M1B0_Help
My_LVM_INSERTITEM_IMAGE
LVI_iImage,99h
ebx,OFFSET M1B1_Help
My_LVM_INSERTITEM_IMAGE
LVI_iImage,99h
ebx,OFFSET M1B2_Help
My_LVM_INSERTITEM_IMAGE
LVI_iImage,99h
ebx,OFFSET MFFF_Help
My_LVM_INSERTITEM_IMAGE

;- SubRoutine ;- SubRoutine ;- SubRoutine ;- SubRoutine ;- SubRoutine ;- SubRoutine ;- SubRoutine ;- SubRoutine -

;@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
; This Subroutines are used on Startup or if we choose a function from toolbar
;@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
My_Run_Startup:
mov
eax,hWnd_LV_Startup
mov
temp,eax
mov
ebx,OFFSET wsa_szDescription;lParam, lpsz, address of string to add
call
My_LVM_INSERTITEM
;- SubRoutine call
My_GetLocalTime
;- SubRoutine call
My_GetDateFormat
;- SubRoutine mov
ebx,OFFSET Buffer
mov
LVI_iSubItem,1h
call
My_LVM_SETITEM
;- SubRoutine call
My_GetTimeFormat
;- SubRoutine mov
ebx,OFFSET Buffer
;lParam, lpsz, address of string to add
mov
LVI_iSubItem,2h
call
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

td_win32asm_710.asm
; API "SetWindowLong" changes an attribute of the specified window.
;-----------------------------------------------------------------------------push
50000005h
;lNewLong, new value, WS_CHILD
push
-16
;nIndex, offset value to set, GWL_STYLE
push
hWnd_LV_Phonebook
;hwnd, handle of window
call
SetWindowLongA
;- API Function ;-----------------------------------------------------------------------------; API "SetWindowTextA" set's the text of the specified window's title bar.
;-----------------------------------------------------------------------------push
OFFSET Bu_Phonebook
;lpsz, address of string
push
hWnd_Action
;hwnd, handle of window or control
call
SetWindowTextA
;- API Function call
My_Create_Logo
;- SubRoutine call
My_InvalidateRect
;- SubRoutine call
My_SetFocus_Action
;- SubRoutine ret
My_Run_Phonebook:
mov
rasdial_dwSize,041Ch
;reset structure members
mov
rasdial_szEntryName,0h
mov
rasdial_szPhoneNumber,0h
mov
rasdial_szCallbackNumber,0h
mov
rasdial_szUserName,0h
mov
rasdial_szPassword,0h
mov
rasdial_szDomain,0h
mov
eax,hWnd_LV_Phonebook
mov
temp,eax
mov
BufferSize,10000h
mov
counter,4h
call
My_EnableWindow0
;- SubRoutine ;-----------------------------------------------------------------------------; API "RasEnumEntries" lists all entry names in a remote access phonebook.
;-----------------------------------------------------------------------------mov
ebx,OFFSET Buffer
;get pointer to array of RASENTRYNAME struc
mov
eax,00000108h
;size in bytes of one RASENTRYNAME struc
mov
[ebx],eax
;set size in bytes of RASENTRYNAME struc
push
OFFSET Phonebook_Entries
;lpcEntries, # entries written to buffer
push
OFFSET BufferSize
;lpcb, size in bytes of buffer
push
ebx
;lprasentryname, buffer receive entries
push
0h
;lpszPhonebook, set to 0
push
0h
;reserved, must be NULL
call
RasEnumEntriesA
;- API Function mov
ebx,OFFSET E0_Phonebook
cmp
Phonebook_Entries,0h
je
My_Run_Phonebook_Error
cmp
eax,0
;error ?
je
My_Run_Phonebook_NextEntry
My_Run_Phonebook_Error:
call
My_LVM_INSERTITEM
;- SubRoutine jmp
My_Run_Phonebook_Result
My_Run_Phonebook_NextEntry:
;-----------------------------------------------------------------------------; API "lstrcpyA" copies a string to a buffer
Page 68

td_win32asm_710.asm
;-----------------------------------------------------------------------------mov
ebx,OFFSET Buffer
add
ebx,counter
push
ebx
;lpString2, address of string to copy
push
OFFSET rasdial_szEntryName ;lpString1, address of buffer
call
lstrcpyA
;- API Function ;-----------------------------------------------------------------------------; API "RasGetEntryDialParams" retrieves information for a phonebook entry
;-----------------------------------------------------------------------------push
OFFSET Phonebook_Password
;lpfPassword, if password was retrieved = 1
push
OFFSET rasdial_dwSize
;lprasdialparams, pointer to a structure
push
0h
;lpszPhonebook, currently ignored
call
RasGetEntryDialParamsA
;- API Function mov
ebx,OFFSET rasdial_szEntryName
call
My_LVM_INSERTITEM
;- SubRoutine mov
LVI_iSubItem,1h
mov
ebx,OFFSET rasdial_szPhoneNumber
call
My_LVM_SETITEM
;- SubRoutine mov
LVI_iSubItem,2h
mov
ebx,OFFSET rasdial_szUserName
call
My_LVM_SETITEM
;- SubRoutine mov
LVI_iSubItem,3h
mov
ebx,OFFSET rasdial_szPassword
call
My_LVM_SETITEM
;- SubRoutine call
My_GetLocalTime
;- SubRoutine call
My_GetDateFormat
;- SubRoutine mov
ebx,OFFSET Buffer
mov
LVI_iSubItem,4h
call
My_LVM_SETITEM
;- SubRoutine call
My_GetTimeFormat
;- SubRoutine mov
ebx,OFFSET Buffer
;lParam, lpsz, address of string to add
mov
LVI_iSubItem,5h
call
My_LVM_SETITEM
;- SubRoutine add
counter,108h
dec
Phonebook_Entries
jne
My_Run_Phonebook_NextEntry
My_Run_Phonebook_Result:
call
My_EnableWindow1
;- SubRoutine call
My_LVM_SETITEMSTATE
;- SubRoutine call
My_SetFocus_ListView
;- SubRoutine ret
;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
My_Init_Lookup:
call
My_DestroyWindow
;- SubRoutine call
My_SetWindowLongA_0
;- SubRoutine ;-----------------------------------------------------------------------------; API "SetWindowLong" changes an attribute of the specified window.
;-----------------------------------------------------------------------------push
50000005h
;lNewLong, new value, WS_CHILD | WS_VISIBLE
push
-16
;nIndex, offset value to set, GWL_STYLE
push
hWnd_LV_Lookup
;hwnd, handle of window
Page 69

td_win32asm_710.asm
call
SetWindowLongA
;- API Function ;-----------------------------------------------------------------------------; API "CreateWindowExA" creates a window with a predefined class name (STATIC).
;-----------------------------------------------------------------------------push
0h
;lpParam, extra pointer data 0=no data
push
hInstance
;hInstance, handle of our program
push
621h
;hMenu, the child-window ID
push
WP1_hWnd
;hWndParent, handle parent window 0=no
push
12h
;intnHeight, window height pixel
push
42h
;intnWidth, window width pixel
push
1C2h
;inty, vertical position window
push
0Ah
;intx, horizontal position window
push
50000000h
;dwStyle, SS_LEFT = 0h
push
OFFSET W0_Lookup
;lpWindowName, pointer to window name
push
OFFSET class_STATIC
;lpClassName, pointer to class name
push
1h
;dwExStyle, look WIN32.HLP + windows.inc
call
CreateWindowExA
;- API Function mov
hWnd_Work1,eax
;hwnd, return value=handle of window
call
My_WM_SETFONT
;- SubRoutine ;-----------------------------------------------------------------------------; API "CreateWindowExA" creates a window with a predefined class name (Edit)
;-----------------------------------------------------------------------------push
0h
;lpParam, extra pointer data 0=no data
push
hInstance
;hInstance, handle of our program
push
622h
;hMenu, the child-window ID
push
WP1_hWnd
;hWndParent, handle parent window 0=no
push
14h
;intnHeight, window height pixel
push
192h
;intnWidth, window width pixel
push
1D8h
;inty, vertical position window
push
0Ah
;intx, horizontal position window
push
50000000h
;dwStyle, ES_LEFT = 0h
push
0h
;lpWindowName, pointer to window name
push
OFFSET class_EDIT
;lpClassName, pointer to class name
push
300h
;dwExStyle, look WIN32.HLP + windows.inc
call
CreateWindowExA
;- API Function mov
hWnd_Work2,eax
;hwnd, return value=handle of window
call
My_WM_SETFONT
;- SubRoutine ;-----------------------------------------------------------------------------; API "SetWindowTextA" set's the text of the specified window's title bar.
;-----------------------------------------------------------------------------push
OFFSET Bu_Lookup
;lpsz, address of string
push
hWnd_Action
;hwnd, handle of window or control
call
SetWindowTextA
;- API Function ;-----------------------------------------------------------------------------; API "EnableWindow" enables or disables input to specified window or control.
;-----------------------------------------------------------------------------push
1h
;bEnable, flag enabling or disabling input
push
hWnd_Action
;hWnd, handle of window
call
EnableWindow
;- API Function call
My_InvalidateRect
;- SubRoutine call
My_SetFocus_EDIT
;- SubRoutine ret
Page 70

td_win32asm_710.asm
My_Run_Lookup:
mov
eax,hWnd_LV_Lookup
mov
temp,eax
;-----------------------------------------------------------------------------; API "GetWindowText" copies the text of the specified window's title bar into
; a buffer. If the window is a control, the text of the control is copied.
;-----------------------------------------------------------------------------push
104h
;nMaxCount,max number of characters to copy
push
OFFSET Buffer
;lpString, address of buffer for text
push
hWnd_Work2
;hWnd, handle window or control with text
call
GetWindowTextA
;- API Function cmp
eax,0h
;error ?
je
My_Run_Lookup_Return
call
My_EnableWindow0
;- SubRoutine mov
ebx,OFFSET Buffer
call
My_LVM_INSERTITEM
;- SubRoutine ;-----------------------------------------------------------------------------; API "inet_addr" converts a string containing a dotted address into an in_addr.
;-----------------------------------------------------------------------------push
OFFSET Buffer
;cp, string, Internet standard "." notation
call
inet_addr
;- API Function mov
IP,eax
cmp
eax,0FFFFFFFFh
;error ?, INADDR_NONE
je
My_Run_Lookup_Name
;-----------------------------------------------------------------------------; API "gethostbyaddr" gets host information corresponding to an address.
;-----------------------------------------------------------------------------push
2h
;type, type address, which must be PF_INET
push
4h
;len, length address, must be 4 for PF_INET
push
OFFSET IP
;addr, pointer address, network byte order
call
gethostbyaddr
;- API Function cmp
eax,0h
;error ?
je
My_Run_Lookup_WSAError
mov
ebx,[eax]
;get h_name from hostent structure
jmp
My_Run_Lookup_Result
My_Run_Lookup_Name:
;-----------------------------------------------------------------------------; API "gethostbyname" gets host information corresponding to a host name.
;-----------------------------------------------------------------------------push
OFFSET Buffer
;name, pointer to the name of the host
call
gethostbyname
;- API Function cmp
eax,0h
;error ?
je
My_Run_Lookup_WSAError
mov
eax,[eax+12]
;get h_addr_list from hostent structure
mov
eax,[eax]
;get far pointer
mov
ebx,[eax]
;get far pointer
;-----------------------------------------------------------------------------; API "inet_ntoa" converts a network address into a string in dotted format
;-----------------------------------------------------------------------------push
ebx
;in, struc represents Internet host address
call
inet_ntoa
;- API Function mov
ebx,eax
cmp
eax,0h
;error ?
Page 71

td_win32asm_710.asm
jne
My_Run_Lookup_Result
My_Run_Lookup_WSAError:
;-----------------------------------------------------------------------------; API "WSAGetLastError" gets error status for the last operation which failed
;-----------------------------------------------------------------------------call
WSAGetLastError
;- API Function mov
counter,eax
;store error value
;-----------------------------------------------------------------------------; API "LoadString" loads a string resource from the executable file associated
; with a specified module, copies the string into a buffer, and appends a
; terminating null character.
;-----------------------------------------------------------------------------push
104h
;nBufferMax, size of buffer
push
OFFSET Buffer
;lpBuffer, address of buffer for resource
push
counter
;uID, resource identifier
push
hInstance
;hInstance, handle module containing string
call
LoadStringA
;- API Function mov
ebx,OFFSET Buffer
My_Run_Lookup_Result:
mov
LVI_iSubItem,1h
call
My_LVM_SETITEM
;- SubRoutine call
My_GetLocalTime
;- SubRoutine call
My_GetDateFormat
;- SubRoutine mov
ebx,OFFSET Buffer
mov
LVI_iSubItem,2h
call
My_LVM_SETITEM
;- SubRoutine call
My_GetTimeFormat
;- SubRoutine mov
ebx,OFFSET Buffer
;lParam, lpsz, address of string to add
mov
LVI_iSubItem,3h
call
My_LVM_SETITEM
;- SubRoutine call
My_EnableWindow1
;- SubRoutine call
My_LVM_SETITEMSTATE
;- SubRoutine call
My_SetFocus_ListView
;- SubRoutine My_Run_Lookup_Return:
ret
;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
My_Init_Local:
call
My_DestroyWindow1
;- SubRoutine call
My_SetWindowLongA_0
;- SubRoutine ;-----------------------------------------------------------------------------; API "SetWindowLong" changes an attribute of the specified window.
;-----------------------------------------------------------------------------push
50000005h
;lNewLong, new value, WS_CHILD | WS_VISIBLE
push
-16
;nIndex, offset value to set, GWL_STYLE
push
hWnd_LV_LocalHost
;hwnd, handle of window
call
SetWindowLongA
;- API Function ;-----------------------------------------------------------------------------; API "SetWindowTextA" set's the text of the specified window's title bar.
;-----------------------------------------------------------------------------push
OFFSET Bu_LocalHost
;lpsz, address of string
push
hWnd_Action
;hwnd, handle of window or control
Page 72

td_win32asm_710.asm
call
call
call
call
ret

SetWindowTextA
My_Create_Logo
My_InvalidateRect
My_SetFocus_Action

;;;;-

API Function SubRoutine SubRoutine SubRoutine -

My_Run_Local:
mov
eax,hWnd_LV_LocalHost
mov
temp,eax
call
My_EnableWindow0
;- SubRoutine ;-----------------------------------------------------------------------------; API "gethostname" returns the standard host name for the local machine
;-----------------------------------------------------------------------------push
104h
;namelen, the length of the buffer
push
OFFSET Buffer
;name, pointer buffer receiving host name
call
gethostname
;- API Function cmp
eax,0h
;error ?
jne
My_Run_Local_Return
mov
ebx,OFFSET Buffer
call
My_LVM_INSERTITEM
;- SubRoutine
;-----------------------------------------------------------------------------; API "gethostbyname" gets host information corresponding to a host name.
;-----------------------------------------------------------------------------push
OFFSET Buffer
;name, pointer to the name of the host
call
gethostbyname
;- API Function cmp
eax,0h
;error ?
je
My_Run_Local_WSAError
mov
eax,[eax+12]
;get h_addr_list from hostent structure
mov
eax,[eax]
;get far pointer
mov
ebx,[eax]
;get far pointer
;-----------------------------------------------------------------------------; API "inet_ntoa" converts a network address into a string in dotted format
;-----------------------------------------------------------------------------push
ebx
;in, struc represents Internet host address
call
inet_ntoa
;- API Function mov
ebx,eax
cmp
eax,0h
;error ?
jne
My_Run_Local_Result
My_Run_Local_WSAError:
;-----------------------------------------------------------------------------; API "WSAGetLastError" gets error status for the last operation which failed
;-----------------------------------------------------------------------------call
WSAGetLastError
;- API Function mov
counter,eax
;store error value
;-----------------------------------------------------------------------------; API "LoadString" loads a string resource from the executable file associated
; with a specified module, copies the string into a buffer, and appends a
; terminating null character.
;-----------------------------------------------------------------------------push
60h
;nBufferMax, size of buffer
push
OFFSET Buffer
;lpBuffer, address of buffer for resource
push
counter
;uID, resource identifier
push
hInstance
;hInstance, handle module containing string
Page 73

td_win32asm_710.asm
call
LoadStringA
mov
ebx,OFFSET Buffer
My_Run_Local_Result:
mov
LVI_iSubItem,1h
call
My_LVM_SETITEM
call
My_GetLocalTime
call
My_GetDateFormat
mov
ebx,OFFSET Buffer
mov
LVI_iSubItem,2h
call
My_LVM_SETITEM
call
My_GetTimeFormat
mov
ebx,OFFSET Buffer
mov
LVI_iSubItem,3h
call
My_LVM_SETITEM
My_Run_Local_Return:
call
My_EnableWindow1
call
My_LVM_SETITEMSTATE
call
My_SetFocus_ListView
ret

;- API Function -

;- SubRoutine ;- SubRoutine ;- SubRoutine ;- SubRoutine ;- SubRoutine ;lParam, lpsz, address of string to add
;- SubRoutine ;- SubRoutine ;- SubRoutine ;- SubRoutine -

;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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_CHILD
push
-16
;nIndex, offset value to set, GWL_STYLE
push
hWnd_LV_ActiveRAS
;hwnd, handle of window
call
SetWindowLongA
;- API Function ;-----------------------------------------------------------------------------; API "SetWindowTextA" set's the text of the specified window's title bar.
;-----------------------------------------------------------------------------push
OFFSET Bu_ActiveRAS
;lpsz, address of string
push
hWnd_Action
;hwnd, handle of window or control
call
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_ActiveRAS
mov
temp,eax
call
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.asm
push
OFFSET rasstatus_dwSize
;lprasconnstatus,buffer receive status data
push
hrascon
;hrasconn,handle RAS connection of interest
call
RasGetConnectStatusA
;- API Function mov
ebx,OFFSET DialviaNumber
cmp
rasstatus_rasconnstate,2
;RASCS_ConnectDevice ? = are we online
je
My_Run_ActiveRAS_Return
mov
ebx,OFFSET E0_ActiveRAS
;pointer to error message
jmp
My_Run_ActiveRAS_Return
My_Run_ActiveRAS_Entry:
mov
BufferSize,10000h
mov
counter,8h
mov
eax,OFFSET Buffer
mov
ebx,19Ch
mov
[eax],ebx
;-----------------------------------------------------------------------------; API "RasEnumConnections" lists all active Remote Access Service connections.
;-----------------------------------------------------------------------------push
OFFSET ActiveRAS_Connections;lpcConnections, # connections written buff
push
OFFSET BufferSize
;lpcb, size in bytes of buffer
push
OFFSET Buffer
;lprasconn, buffer receive connections data
call
RasEnumConnectionsA
;- API Function mov
ebx,OFFSET E0_ActiveRAS
;pointer to error message
cmp
eax,0h
;error ?
jne
My_Run_ActiveRAS_Return
cmp
ActiveRAS_Connections,0h
je
My_Run_ActiveRAS_Return
My_Run_ActiveRAS_Enum:
mov
ebx,OFFSET Buffer
add
ebx,counter
call
My_LVM_INSERTITEM
;- SubRoutine call
My_GetLocalTime
;- SubRoutine call
My_GetDateFormat
;- SubRoutine mov
ebx,OFFSET Buffer
mov
LVI_iSubItem,1h
call
My_LVM_SETITEM
;- SubRoutine call
My_GetTimeFormat
;- SubRoutine mov
ebx,OFFSET Buffer
;lParam, lpsz, address of string to add
mov
LVI_iSubItem,2h
call
My_LVM_SETITEM
;- SubRoutine add
counter,19Ch
dec
ActiveRAS_Connections
jne
My_Run_ActiveRAS_Enum
jmp
My_Run_ActiveRAS_Done
My_Run_ActiveRAS_Return:
call
My_LVM_INSERTITEM
;- SubRoutine call
My_GetLocalTime
;- SubRoutine call
My_GetDateFormat
;- SubRoutine mov
ebx,OFFSET Buffer
mov
LVI_iSubItem,1h
call
My_LVM_SETITEM
;- SubRoutine call
My_GetTimeFormat
;- SubRoutine mov
ebx,OFFSET Buffer
;lParam, lpsz, address of string to add
mov
LVI_iSubItem,2h
Page 75

td_win32asm_710.asm
call
My_LVM_SETITEM
My_Run_ActiveRAS_Done:
call
My_EnableWindow1
call
My_LVM_SETITEMSTATE
call
My_SetFocus_ListView
ret

;- SubRoutine ;- SubRoutine ;- SubRoutine ;- SubRoutine -

;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
My_Init_RASDial:
call
My_DestroyWindow
;- SubRoutine call
My_SetWindowLongA_0
;- SubRoutine ;-----------------------------------------------------------------------------; API "SetWindowLong" changes an attribute of the specified window.
;-----------------------------------------------------------------------------push
50000005h
;lNewLong, new value, WS_CHILD | WS_VISIBLE
push
-16
;nIndex, offset value to set, GWL_STYLE
push
hWnd_LV_RASDial
;hwnd, handle of window
call
SetWindowLongA
;- API Function ;-----------------------------------------------------------------------------; API "CreateWindowExA" creates a window with a predefined class name (STATIC).
;-----------------------------------------------------------------------------push
0h
;lpParam, extra pointer data 0=no data
push
hInstance
;hInstance, handle of our program
push
651h
;hMenu, the child-window ID
push
WP1_hWnd
;hWndParent, handle parent window 0=no
push
58h
;intnHeight, window height pixel
push
196h
;intnWidth, window width pixel
push
1C2h
;inty, vertical position window
push
08h
;intx, horizontal position window
push
50200003h
;dwStyle, WS_VSCROLL
push
0h
;lpWindowName, pointer to window name
push
OFFSET class_COMBOBOX
;lpClassName, pointer to class name
push
300h
;dwExStyle, look WIN32.HLP + windows.inc
call
CreateWindowExA
;- API Function mov
hWnd_Work1,eax
;hwnd, return value=handle of window
call
My_WM_SETFONT
;- SubRoutine ;-----------------------------------------------------------------------------; API "SendMessageA" sends a CB_INSERTSTRING to the combo box
;-----------------------------------------------------------------------------push
OFFSET DialviaNumber
;lParam, lpsz, address of string to insert
push
0h
;wParam, index, item index
push
14Ah
;uMsg, CB_INSERTSTRING
push
hWnd_Work1
;hwnd, handle of destination window
call
SendMessageA
;- API Function ;-----------------------------------------------------------------------------; API "CreateWindowExA" creates a window with a predefined class name (STATIC)
;-----------------------------------------------------------------------------push
0h
;lpParam, extra pointer data 0=no data
push
hInstance
;hInstance, handle of our program
push
652h
;hMenu, the child-window ID
push
WP1_hWnd
;hWndParent, handle parent window 0=no
push
12h
;intnHeight, window height pixel
Page 76

td_win32asm_710.asm
push
054h
;intnWidth, window width pixel
push
1DBh
;inty, vertical position window
push
08h
;intx, horizontal position window
push
50000000h
;dwStyle, ES_LEFT = 0h
push
OFFSET W0_RASDial
;lpWindowName, pointer to window name
push
OFFSET class_STATIC
;lpClassName, pointer to class name
push
1h
;dwExStyle, look WIN32.HLP + windows.inc
call
CreateWindowExA
;- API Function mov
hWnd_Work2,eax
;hwnd, return value=handle of window
call
My_WM_SETFONT
;- SubRoutine ;-----------------------------------------------------------------------------; API "CreateWindowExA" creates a window with a predefined class name (Edit)
;-----------------------------------------------------------------------------push
0h
;lpParam, extra pointer data 0=no data
push
hInstance
;hInstance, handle of our program
push
653h
;hMenu, the child-window ID
push
WP1_hWnd
;hWndParent, handle parent window 0=no
push
14h
;intnHeight, window height pixel
push
13Eh
;intnWidth, window width pixel
push
1DAh
;inty, vertical position window
push
60h
;intx, horizontal position window
push
58002000h
;dwStyle, ES_LEFT = 0h | ES_NUMBER = 2000h
push
0h
;lpWindowName, pointer to window name
push
OFFSET class_EDIT
;lpClassName, pointer to class name
push
300h
;dwExStyle, look WIN32.HLP + windows.inc
call
CreateWindowExA
;- API Function mov
hWnd_Work3,eax
;hwnd, return value=handle of window
call
My_WM_SETFONT
;- SubRoutine ;-----------------------------------------------------------------------------; API "CreateWindowExA" creates a window with a predefined class name (STATIC)
;-----------------------------------------------------------------------------push
0h
;lpParam, extra pointer data 0=no data
push
hInstance
;hInstance, handle of our program
push
654h
;hMenu, the child-window ID
push
WP1_hWnd
;hWndParent, handle parent window 0=no
push
12h
;intnHeight, window height pixel
push
24h
;intnWidth, window width pixel
push
1F2h
;inty, vertical position window
push
38h
;intx, horizontal position window
push
50000000h
;dwStyle, ES_LEFT = 0h
push
OFFSET W1_RASDial
;lpWindowName, pointer to window name
push
OFFSET class_STATIC
;lpClassName, pointer to class name
push
1h
;dwExStyle, look WIN32.HLP + windows.inc
call
CreateWindowExA
;- API Function mov
hWnd_Work4,eax
;hwnd, return value=handle of window
call
My_WM_SETFONT
;- SubRoutine ;-----------------------------------------------------------------------------; API "CreateWindowExA" creates a window with a predefined class name (Edit)
;-----------------------------------------------------------------------------push
0h
;lpParam, extra pointer data 0=no data
push
hInstance
;hInstance, handle of our program
push
655h
;hMenu, the child-window ID
push
WP1_hWnd
;hWndParent, handle parent window 0=no
Page 77

td_win32asm_710.asm
push
14h
;intnHeight, window height pixel
push
7Ch
;intnWidth, window width pixel
push
1F1h
;inty, vertical position window
push
60h
;intx, horizontal position window
push
50000000h
;dwStyle, ES_LEFT = 0h
push
0h
;lpWindowName, pointer to window name
push
OFFSET class_EDIT
;lpClassName, pointer to class name
push
300h
;dwExStyle, look WIN32.HLP + windows.inc
call
CreateWindowExA
;- API Function mov
hWnd_Work5,eax
;hwnd, return value=handle of window
call
My_WM_SETFONT
;- SubRoutine ;-----------------------------------------------------------------------------; API "CreateWindowExA" creates a window with a predefined class name (STATIC)
;-----------------------------------------------------------------------------push
0h
;lpParam, extra pointer data 0=no data
push
hInstance
;hInstance, handle of our program
push
656h
;hMenu, the child-window ID
push
WP1_hWnd
;hWndParent, handle parent window 0=no
push
12h
;intnHeight, window height pixel
push
03Ch
;intnWidth, window width pixel
push
1F2h
;inty, vertical position window
push
0E2h
;intx, horizontal position window
push
50000000h
;dwStyle, ES_LEFT = 0h
push
OFFSET W2_RASDial
;lpWindowName, pointer to window name
push
OFFSET class_STATIC
;lpClassName, pointer to class name
push
1h
;dwExStyle, look WIN32.HLP + windows.inc
call
CreateWindowExA
;- API Function mov
hWnd_Work6,eax
;hwnd, return value=handle of window
call
My_WM_SETFONT
;- SubRoutine ;-----------------------------------------------------------------------------; API "CreateWindowExA" creates a window with a predefined class name (Edit)
;-----------------------------------------------------------------------------push
0h
;lpParam, extra pointer data 0=no data
push
hInstance
;hInstance, handle of our program
push
657h
;hMenu, the child-window ID
push
WP1_hWnd
;hWndParent, handle parent window 0=no
push
14h
;intnHeight, window height pixel
push
7Ch
;intnWidth, window width pixel
push
1F1h
;inty, vertical position window
push
122h
;intx, horizontal position window
push
50000000h
;dwStyle, ES_LEFT = 0h
push
0h
;lpWindowName, pointer to window name
push
OFFSET class_EDIT
;lpClassName, pointer to class name
push
300h
;dwExStyle, look WIN32.HLP + windows.inc
call
CreateWindowExA
;- API Function mov
hWnd_Work7,eax
;hwnd, return value=handle of window
call
My_WM_SETFONT
;- SubRoutine mov
BufferSize,10000h
mov
counter,4h
mov
counter1,1h
;-----------------------------------------------------------------------------; API "RasEnumEntries" lists all entry names in a remote access phonebook.
;-----------------------------------------------------------------------------Page 78

td_win32asm_710.asm
mov
ebx,OFFSET Buffer
;get pointer to array of RASENTRYNAME struc
mov
eax,00000108h
;size in bytes of one RASENTRYNAME struc
mov
[ebx],eax
;set size in bytes of RASENTRYNAME struc
push
OFFSET Phonebook_Entries
;lpcEntries, # entries written to buffer
push
OFFSET BufferSize
;lpcb, size in bytes of buffer
push
ebx
;lprasentryname, buffer receive entries
push
0h
;lpszPhonebook, set to 0
push
0h
;reserved, must be NULL
call
RasEnumEntriesA
;- API Function mov
ebx,0h
;set item index to 0, if no entry avaible
cmp
Phonebook_Entries,0h
;no phonebook entry avaible ?
je
My_Init_RASDial_CB_SETCURSEL
cmp
eax,0
;error ?
jne
My_Init_RASDial_CB_SETCURSEL
My_Init_RASDial_CB_INSERTSTR:
mov
ebx,OFFSET Buffer
add
ebx,counter
;-----------------------------------------------------------------------------; API "SendMessageA" sends a CB_INSERTSTRING to the combo box
;-----------------------------------------------------------------------------push
ebx
;lParam, lpsz, address of string to insert
push
counter1
;wParam, index, item index
push
14Ah
;uMsg, CB_INSERTSTRING
push
hWnd_Work1
;hwnd, handle of destination window
call
SendMessageA
;- API Function add
counter,108h
inc
counter1
dec
Phonebook_Entries
jne
My_Init_RASDial_CB_INSERTSTR
mov
ebx,1h
;set item index to 1, entry is avaible
My_Init_RASDial_CB_SETCURSEL:
;-----------------------------------------------------------------------------; API "SendMessageA" sends a CB_SETCURSEL to the combo box
;-----------------------------------------------------------------------------push
0h
;lParam, not used must be zero
push
ebx
;wParam, index, item index
push
14Eh
;uMsg, CB_SETCURSEL
push
hWnd_Work1
;hwnd, handle of destination window
call
SendMessageA
;- API Function ;-----------------------------------------------------------------------------; API "SendMessageA" sends a WM_COMMAND message
;-----------------------------------------------------------------------------push
hWnd_Work1
;lParam, handle of combo box
push
0651h
;wParam, identifier of combo box
push
111h
;uMsg, WM_COMMAND
push
WP1_hWnd
;hwnd, handle of destination window
call
SendMessageA
;- API Function ;-----------------------------------------------------------------------------; API "SetWindowTextA" set's the text of the specified window's title bar.
;-----------------------------------------------------------------------------push
OFFSET Bu_RASDial
;lpsz, address of string
push
hWnd_Action
;hwnd, handle of window or control
call
SetWindowTextA
;- API Function Page 79

td_win32asm_710.asm
;-----------------------------------------------------------------------------; API "EnableWindow" enables or disables input to specified window or control.
;-----------------------------------------------------------------------------push
1h
;bEnable, flag enabling or disabling input
push
hWnd_Action
;hWnd, handle of window
call
EnableWindow
;- API Function call
My_InvalidateRect
;- SubRoutine ;-----------------------------------------------------------------------------; API "SetFocus" sets the keyboard focus to the specified window.
;-----------------------------------------------------------------------------push
hWnd_Work3
;hwnd, handle of window to receive focus
call
SetFocus
;- API Function ret
My_Run_RASDial:
;-----------------------------------------------------------------------------; API "CreateThread" creates a thread to execute
;-----------------------------------------------------------------------------push
OFFSET RASDial_ThreadID
;lpThreadId, address of returned thread id
push
0h
;dwCreationFlags, creation flags
push
WP1_hWnd
;lpParameter, argument for new thread
push
OFFSET My_Thread_RASDial
;lpStartAddress, address of thread function
push
0h
;dwStackSize, init thread stack size, in db
push
0h
;lpThreadAttributes, address security attr.
call
CreateThread
;- API Function mov
RASDial_hThread,eax
;thread handle
;-----------------------------------------------------------------------------; SetThreadPriority function sets the priority value for the specified thread.
;-----------------------------------------------------------------------------push
2
;nPriority, THREAD_PRIORITY_HIGHEST=2
push
RASDial_hThread
;hThread, handle to the thread
call
SetThreadPriority
;- API Function ;-----------------------------------------------------------------------------; API "CloseHandle" closes an open object handle
;-----------------------------------------------------------------------------push
RASDial_ThreadID
;hObject, handle of object to close
call
CloseHandle
;- API Function ret
My_Thread_RASDial:
push
ebp
;create stack frame
mov
ebp,esp
pushad
mov
eax,hWnd_LV_RASDial
mov
temp,eax
cmp
hrascon,0h
;check if previous RASDial connect
jne
My_Run_RASDial_Return
mov
Flag_Dialing,1h
;set to 1, before calling API RaSDial
cmp
flag_RASDialviaNumber,1h
je
My_Run_RASDial_Number
;-----------------------------------------------------------------------------; API "GetWindowText" copies the text of the specified window's title bar into
; a buffer. If the window is a control, the text of the control is copied.
Page 80

td_win32asm_710.asm
;-----------------------------------------------------------------------------push
101h
;nMaxCount,max number of characters to copy
push
OFFSET rasdial_szEntryName ;lpString, address of buffer for text
push
hWnd_Work1
;hWnd, handle window or control with text
call
GetWindowTextA
;- API Function mov
rasdial_szPhoneNumber,0h
push
101h
;nMaxCount,max number of characters to copy
push
OFFSET rasdial_szUserName
;lpString, address of buffer for text
push
hWnd_Work5
;hWnd, handle window or control with text
call
GetWindowTextA
;- API Function push
101h
;nMaxCount,max number of characters to copy
push
OFFSET rasdial_szPassword
;lpString, address of buffer for text
push
hWnd_Work7
;hWnd, handle window or control with text
call
GetWindowTextA
;- API Function mov
ebx,OFFSET rasdial_szEntryName
call
My_LVM_INSERTITEM
;- SubRoutine mov
LVI_iSubItem,1h
mov
ebx,OFFSET rasdial_szPhoneNumber
call
My_LVM_SETITEM
;- SubRoutine mov
LVI_iSubItem,2h
mov
ebx,OFFSET rasdial_szUserName
call
My_LVM_SETITEM
;- SubRoutine mov
LVI_iSubItem,3h
mov
ebx,OFFSET rasdial_szPassword
call
My_LVM_SETITEM
;- SubRoutine mov
LVI_iSubItem,4h
mov
ebx,OFFSET M0_RASDial
call
My_LVM_SETITEM
;- SubRoutine call
My_GetLocalTime
;- SubRoutine call
My_GetDateFormat
;- SubRoutine mov
ebx,OFFSET Buffer
mov
LVI_iSubItem,5h
call
My_LVM_SETITEM
;- SubRoutine call
My_GetTimeFormat
;- SubRoutine mov
ebx,OFFSET Buffer
;lParam, lpsz, address of string to add
mov
LVI_iSubItem,6h
call
My_LVM_SETITEM
;- SubRoutine call
My_LVM_SETITEMSTATE
;- SubRoutine call
My_SetFocus_ListView
;- SubRoutine call
My_EnableWindow0
;- SubRoutine mov
hrascon,0h
;set to 0, before calling API RaSDial
;-----------------------------------------------------------------------------; API "RasDial" establishes a Remote Access Service (RAS) connection between a
; RAS client and a RAS server. Includes callback and user authentication infos.
;-----------------------------------------------------------------------------push
OFFSET hrascon
;lphRasConn, pointer receive connect handle
push
0h
;lpvNotifier, handler for RasDial events
push
0h
;dwNotifierType, type RasDial event handler
push
OFFSET rasdial_dwSize
;lpRasDialParams, calling parameters data
push
0h
;lpszPhonebook,path/filename phonebook file
push
0h
;lpRasDialExtensions,funct. extensions data
call
RasDialA
;- API Function mov
ebx,OFFSET M1_RASDial
Page 81

td_win32asm_710.asm
cmp
eax,0
;0h=no error
je
My_Run_RASDial_GoOut
;-----------------------------------------------------------------------------; API "RasHangUp" terminates a remote access connection.
;-----------------------------------------------------------------------------push
hrascon
;hrasconn, handle RAS connection to hang up
call
RasHangUpA
;- API Function mov
hrascon,0h
;clear hrascon
mov
ebx,OFFSET M2_RASDial
jmp
My_Run_RASDial_GoOut
My_Run_RASDial_Number:
;-----------------------------------------------------------------------------; API "GetWindowText" copies the text of the specified window's title bar into
; a buffer. If the window is a control, the text of the control is copied.
;-----------------------------------------------------------------------------mov
rasdial_szEntryNameNr,0h
;lpString1, address of buffer
push
81h
;nMaxCount,max number of characters to copy
push
OFFSET rasdial_szPhoneNumberNr;lpString, address of buffer for text
push
hWnd_Work3
;hWnd, handle window or control with text
call
GetWindowTextA
;- API Function cmp
eax,0h
je
My_Run_RASDial_Return
push
101h
;nMaxCount,max number of characters to copy
push
OFFSET rasdial_szUserNameNr ;lpString, address of buffer for text
push
hWnd_Work5
;hWnd, handle window or control with text
call
GetWindowTextA
;- API Function push
101h
;nMaxCount,max number of characters to copy
push
OFFSET rasdial_szPasswordNr ;lpString, address of buffer for text
push
hWnd_Work7
;hWnd, handle window or control with text
call
GetWindowTextA
;- API Function mov
ebx,OFFSET DialviaNumber
call
My_LVM_INSERTITEM
;- SubRoutine mov
LVI_iSubItem,1h
mov
ebx,OFFSET rasdial_szPhoneNumberNr
call
My_LVM_SETITEM
;- SubRoutine mov
LVI_iSubItem,2h
mov
ebx,OFFSET rasdial_szUserNameNr
call
My_LVM_SETITEM
;- SubRoutine mov
LVI_iSubItem,3h
mov
ebx,OFFSET rasdial_szPasswordNr
call
My_LVM_SETITEM
;- SubRoutine mov
LVI_iSubItem,4h
mov
ebx,OFFSET M0_RASDial
call
My_LVM_SETITEM
;- SubRoutine call
My_GetLocalTime
;- SubRoutine call
My_GetDateFormat
;- SubRoutine mov
ebx,OFFSET Buffer
mov
LVI_iSubItem,5h
call
My_LVM_SETITEM
;- SubRoutine call
My_GetTimeFormat
;- SubRoutine mov
ebx,OFFSET Buffer
;lParam, lpsz, address of string to add
mov
LVI_iSubItem,6h
Page 82

td_win32asm_710.asm
call
My_LVM_SETITEM
;- SubRoutine call
My_LVM_SETITEMSTATE
;- SubRoutine call
My_SetFocus_ListView
;- SubRoutine call
My_EnableWindow0
;- SubRoutine mov
hrascon,0h
;set to 0, before calling API RaSDial
;-----------------------------------------------------------------------------; API "RasDial" establishes a Remote Access Service (RAS) connection between a
; RAS client and a RAS server. Includes callback and user authentication infos.
;-----------------------------------------------------------------------------push
OFFSET hrascon
;lphRasConn, pointer receive connect handle
push
0h
;lpvNotifier, handler for RasDial events
push
0h
;dwNotifierType, type RasDial event handler
push
OFFSET rasdial_dwSizeNr
;lpRasDialParams, calling parameters data
push
0h
;lpszPhonebook,path/filename phonebook file
push
0h
;lpRasDialExtensions,funct. extensions data
call
RasDialA
;- API Function mov
ebx,OFFSET M1_RASDial
cmp
eax,0
;0h=no error
je
My_Run_RASDial_GoOut
;-----------------------------------------------------------------------------; API "RasHangUp" terminates a remote access connection.
;-----------------------------------------------------------------------------push
hrascon
;hrasconn, handle RAS connection to hang up
call
RasHangUpA
;- API Function mov
hrascon,0h
;clear hrascon
mov
ebx,OFFSET M2_RASDial
My_Run_RASDial_GoOut:
mov
Flag_Dialing,0h
;clear Flag
mov
LVI_iSubItem,4h
call
My_LVM_SETITEM
;- SubRoutine call
My_EnableWindow1
;- SubRoutine call
My_LVM_SETITEMSTATE
;- SubRoutine call
My_SetFocus_ListView
;- SubRoutine My_Run_RASDial_Return:
;-----------------------------------------------------------------------------; API "ExitThread" ends a thread
;-----------------------------------------------------------------------------push
0h
;dwExitCode, exit code for this thread
call
ExitThread
;- API Function popad
xor
eax,eax
mov
esp,ebp
;delete stack frame
pop
ebp
ret
4h
;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
My_Init_PortScan:
call
My_DestroyWindow
;- SubRoutine call
My_SetWindowLongA_0
;- SubRoutine ;-----------------------------------------------------------------------------; API "SetWindowLong" changes an attribute of the specified window.
;-----------------------------------------------------------------------------Page 83

td_win32asm_710.asm
push
50000005h
;lNewLong, new value, WS_CHILD | WS_VISIBLE
push
-16
;nIndex, offset value to set, GWL_STYLE
push
hWnd_LV_PortScan
;hwnd, handle of window
call
SetWindowLongA
;- API Function ;-----------------------------------------------------------------------------; API "CreateWindowExA" creates a window with a predefined class name (STATIC).
;-----------------------------------------------------------------------------push
0h
;lpParam, extra pointer data 0=no data
push
hInstance
;hInstance, handle of our program
push
621h
;hMenu, the child-window ID
push
WP1_hWnd
;hWndParent, handle parent window 0=no
push
12h
;intnHeight, window height pixel
push
40h
;intnWidth, window width pixel
push
1C4h
;inty, vertical position window
push
0Ah
;intx, horizontal position window
push
50000000h
;dwStyle, SS_LEFT = 0h
push
OFFSET W1_PortScan
;lpWindowName, pointer to window name
push
OFFSET class_STATIC
;lpClassName, pointer to class name
push
1h
;dwExStyle, look WIN32.HLP + windows.inc
call
CreateWindowExA
;- API Function mov
hWnd_Work1,eax
;hwnd, return value=handle of window
call
My_WM_SETFONT
;- SubRoutine ;-----------------------------------------------------------------------------; API "CreateWindowExA" creates a window with a predefined class name (EDIT)
;-----------------------------------------------------------------------------push
0h
;lpParam, extra pointer data 0=no data
push
hInstance
;hInstance, handle of our program
push
622h
;hMenu, the child-window ID
push
WP1_hWnd
;hWndParent, handle parent window 0=no
push
14h
;intnHeight, window height pixel
push
0E4h
;intnWidth, window width pixel
push
1C3h
;inty, vertical position window
push
04Ch
;intx, horizontal position window
push
50000080h
;dwStyle, ES_LEFT=0h | ES_AUTOHSCROLL=80h
push
OFFSET W2_PortScan
;lpWindowName, pointer to window name
push
OFFSET class_EDIT
;lpClassName, pointer to class name
push
300h
;dwExStyle, look WIN32.HLP + windows.inc
call
CreateWindowExA
;- API Function mov
hWnd_Work2,eax
;hwnd, return value=handle of window
call
My_WM_SETFONT
;- SubRoutine ;-----------------------------------------------------------------------------; API "CreateWindowExA" creates a window with a predefined class name (STATIC).
;-----------------------------------------------------------------------------push
0h
;lpParam, extra pointer data 0=no data
push
hInstance
;hInstance, handle of our program
push
623h
;hMenu, the child-window ID
push
WP1_hWnd
;hWndParent, handle parent window 0=no
push
12h
;intnHeight, window height pixel
push
40h
;intnWidth, window width pixel
push
1DBh
;inty, vertical position window
push
0Ah
;intx, horizontal position window
push
50000000h
;dwStyle, SS_LEFT = 0h
push
OFFSET W3_PortScan
;lpWindowName, pointer to window name
Page 84

td_win32asm_710.asm
push
OFFSET class_STATIC
;lpClassName, pointer to class name
push
1h
;dwExStyle, look WIN32.HLP + windows.inc
call
CreateWindowExA
;- API Function mov
hWnd_Work3,eax
;hwnd, return value=handle of window
call
My_WM_SETFONT
;- SubRoutine ;-----------------------------------------------------------------------------; API "CreateWindowExA" creates a window with a predefined class name (EDIT)
;-----------------------------------------------------------------------------push
0h
;lpParam, extra pointer data 0=no data
push
hInstance
;hInstance, handle of our program
push
624h
;hMenu, the child-window ID
push
WP1_hWnd
;hWndParent, handle parent window 0=no
push
14h
;intnHeight, window height pixel
push
028h
;intnWidth, window width pixel
push
1DAh
;inty, vertical position window
push
04Ch
;intx, horizontal position window
push
50002000h
;dwStyle, ES_LEFT = 0h | ES_NUMBER = 2000h
push
OFFSET W4_PortScan
;lpWindowName, pointer to window name
push
OFFSET class_EDIT
;lpClassName, pointer to class name
push
300h
;dwExStyle, look WIN32.HLP + windows.inc
call
CreateWindowExA
;- API Function mov
hWnd_Work4,eax
;hwnd, return value=handle of window
call
My_WM_SETFONT
;- SubRoutine ;-----------------------------------------------------------------------------; API "CreateWindowExA" creates a window with a predefined class name (STATIC).
;-----------------------------------------------------------------------------push
0h
;lpParam, extra pointer data 0=no data
push
hInstance
;hInstance, handle of our program
push
625h
;hMenu, the child-window ID
push
WP1_hWnd
;hWndParent, handle parent window 0=no
push
12h
;intnHeight, window height pixel
push
40h
;intnWidth, window width pixel
push
1F2h
;inty, vertical position window
push
0Ah
;intx, horizontal position window
push
50000000h
;dwStyle, SS_LEFT = 0h
push
OFFSET W5_PortScan
;lpWindowName, pointer to window name
push
OFFSET class_STATIC
;lpClassName, pointer to class name
push
1h
;dwExStyle, look WIN32.HLP + windows.inc
call
CreateWindowExA
;- API Function mov
hWnd_Work5,eax
;hwnd, return value=handle of window
call
My_WM_SETFONT
;- SubRoutine ;-----------------------------------------------------------------------------; API "CreateWindowExA" creates a window with a predefined class name (EDIT)
;-----------------------------------------------------------------------------push
0h
;lpParam, extra pointer data 0=no data
push
hInstance
;hInstance, handle of our program
push
626h
;hMenu, the child-window ID
push
WP1_hWnd
;hWndParent, handle parent window 0=no
push
14h
;intnHeight, window height pixel
push
028h
;intnWidth, window width pixel
push
1F1h
;inty, vertical position window
push
04Ch
;intx, horizontal position window
push
50002000h
;dwStyle, ES_LEFT = 0h | ES_NUMBER = 2000h
Page 85

td_win32asm_710.asm
push
OFFSET W6_PortScan
;lpWindowName, pointer to window name
push
OFFSET class_EDIT
;lpClassName, pointer to class name
push
300h
;dwExStyle, look WIN32.HLP + windows.inc
call
CreateWindowExA
;- API Function mov
hWnd_Work6,eax
;hwnd, return value=handle of window
call
My_WM_SETFONT
;- SubRoutine ;-----------------------------------------------------------------------------; API "CreateWindowExA" creates a window with a predefined class name (BUTTON)
;-----------------------------------------------------------------------------push
0h
;lpParam, extra pointer data 0=no data
push
hInstance
;hInstance, handle of our program
push
627h
;hMenu, the child-window ID
push
WP1_hWnd
;hWndParent, handle parent window 0=no
push
12h
;intnHeight, window height pixel
push
070h
;intnWidth, window width pixel
push
1DCh
;inty, vertical position window
push
0C0h
;intx, horizontal position window
push
50000003h
;dwStyle, style ( BS_AUTOCHECKBOX )
push
OFFSET W7_PortScan
;lpWindowName, pointer to window name
push
OFFSET class_BUTTON
;lpClassName, pointer to class name
push
1h
;dwExStyle,
call
CreateWindowExA
;- API Function mov
hWnd_Work7,eax
;return value=handle of window
call
My_WM_SETFONT
;- SubRoutine ;-----------------------------------------------------------------------------; API "SendMessageA" sends a BM_SETCHECK message
;-----------------------------------------------------------------------------push
0h
;lParam, not used must be zero
push
Flag_PortScanList
;wParam,fcheck,0=BST_UNCHECKED,1=BST_CHECKED
push
0F1h
;uMsg, BM_SETCHECK
push
hWnd_Work7
;hwnd, handle of destination window
call
SendMessageA
;- API Function ;-----------------------------------------------------------------------------; API "CreateWindowExA" creates a window with a predefined class name (BUTTON)
;-----------------------------------------------------------------------------push
0h
;lpParam, extra pointer data 0=no data
push
hInstance
;hInstance, handle of our program
push
628h
;hMenu, the child-window ID
push
WP1_hWnd
;hWndParent, handle parent window 0=no
push
12h
;intnHeight, window height pixel
push
070h
;intnWidth, window width pixel
push
1F2h
;inty, vertical position window
push
0C0h
;intx, horizontal position window
push
50000003h
;dwStyle, style ( BS_AUTOCHECKBOX )
push
OFFSET W8_PortPositiveList ;lpWindowName, pointer to window name
push
OFFSET class_BUTTON
;lpClassName, pointer to class name
push
1h
;dwExStyle,
call
CreateWindowExA
;- API Function mov
hWnd_Work8,eax
;return value=handle of window
call
My_WM_SETFONT
;- SubRoutine ;-----------------------------------------------------------------------------; API "SendMessageA" sends a BM_SETCHECK message
;-----------------------------------------------------------------------------Page 86

td_win32asm_710.asm
push
0h
;lParam, not used must be zero
push
Flag_PortScanTimeOut
;wParam,fcheck,0=BST_UNCHECKED,1=BST_CHECKED
push
0F1h
;uMsg, BM_SETCHECK
push
hWnd_Work8
;hwnd, handle of destination window
call
SendMessageA
;- API Function ;-----------------------------------------------------------------------------; API "CreateWindowExA" creates a window, predefined class name (SysListView32)
;-----------------------------------------------------------------------------push
0h
;lpParam, extra pointer data 0=no data
push
hInstance
;hInstance, handle of our program
push
628h
;hMenu, the child-window ID
push
WP1_hWnd
;hWndParent, handle parent window 0=no
push
40h
;intnHeight, window height pixel
push
60h
;intnWidth, window width pixel
push
1C3h
;inty, vertical position window
push
140h
;intx, horizontal position window
push
58000205h
;dwStyle, LVS_SINGLESEL=4h | LVS_REPORT=1h
push
0h
;lpWindowName, pointer to window name
push
OFFSET class_SysListView32 ;lpClassName, pointer to class name
push
300h
;dwExStyle, look WIN32.HLP + windows.inc
call
CreateWindowExA
;- API Function mov
hWnd_LV_PortList,eax
;hwnd, return value=handle of window
mov
temp,eax
call
My_LVM_SETCOLOR
;- SubRoutine mov
LVC_mask,7h
;LVCF_WIDTH=2h, LVCF_TEXT=4h, LVCF_FMT=1h
mov
LVC_fmt,0h
;LVCFMT_LEFT=0h
mov
LVC_cx,04Ah
;width of the column, in pixels
mov
LVC_pszText,OFFSET H5_PortScan;pointer to text
;-----------------------------------------------------------------------------; API "SendMessageA" sends a message to the window
;-----------------------------------------------------------------------------push
OFFSET LVC_mask
;lParam, pcol, pointer LV_COLUMN structure
push
0h
;wParam, iCol, index of the new column
push
101Bh
;uMsg,LVM_FIRST=1000h | LVM_INSERTCOLUMN=27
push
temp
;hwnd, handle of destination window
call
SendMessageA
;- API Function mov
ecx,Var_PortListItems
cmp
ecx,0h
je
My_Init_PortScan_FillListEnd
mov
counter,ecx
;fill portlist
mov
ebx,OFFSET Buf_PortScanList
My_Init_PortScan_FillList:
mov
esi,[ebx]
push
ebx
call
My_HexDDtoStringDec
mov
ebx,OFFSET Buffer
call
My_LVM_INSERTITEM
;- SubRoutine pop
ebx
add
ebx,4h
dec
counter
jne
My_Init_PortScan_FillList
My_Init_PortScan_FillListEnd:
;-----------------------------------------------------------------------------Page 87

td_win32asm_710.asm
; API "EnableWindow" enables or disables input to specified window or control.
;-----------------------------------------------------------------------------push
Flag_PortScanList
;bEnable, flag enabling or disabling input
push
hWnd_LV_PortList
;hWnd, handle of window
call
EnableWindow
;- API Function xor
Flag_PortScanList,1h
;toggle flag
push
Flag_PortScanList
;bEnable, flag enabling or disabling input
push
hWnd_Work4
;hWnd, handle of window
call
EnableWindow
;- API Function push
Flag_PortScanList
;bEnable, flag enabling or disabling input
push
hWnd_Work6
;hWnd, handle of window
call
EnableWindow
;- API Function xor
Flag_PortScanList,1h
;toggle flag
;-----------------------------------------------------------------------------; API "SetWindowTextA" set's the text of the specified window's title bar.
;-----------------------------------------------------------------------------push
OFFSET Bu_PortScan
;lpsz, address of string
push
hWnd_Action
;hwnd, handle of window or control
call
SetWindowTextA
;- API Function ;-----------------------------------------------------------------------------; API "EnableWindow" enables or disables input to specified window or control.
;-----------------------------------------------------------------------------push
1h
;bEnable, flag enabling or disabling input
push
hWnd_Action
;hWnd, handle of window
call
EnableWindow
;- API Function call
My_InvalidateRect
;- SubRoutine call
My_SetFocus_EDIT
;- SubRoutine ret
My_Run_PortScan:
;-----------------------------------------------------------------------------; API "GetWindowText" copies the text of the specified window's title bar into
; a buffer. If the window is a control, the text of the control is copied.
;-----------------------------------------------------------------------------push
104h
;nMaxCount,max number of characters to copy
push
OFFSET W2_PortScan
;lpString, address of buffer for text
push
hWnd_Work2
;hWnd, handle window or control with text
call
GetWindowTextA
;- API Function cmp
eax,0h
;error ?
je
My_Run_PortScan_Return
;nothing to do, name / IP field is empty
cmp
Flag_PortScanList,1h
;scanning via portlist choosen ?
jne
My_Run_PortScan_Area
;if not skip portlist
mov
mov
cmp
je
mov
mov
mov
jmp

eax,hWnd_LV_PortScan
temp,eax
Var_PortListItems,0h
My_Run_PortScan_Return
eax,Var_PortListItems
Var_PortScanCounter,eax
Var_PortListCurrentItem,0h
My_Run_PortScanGo

;port list is empty, so skip

My_Run_PortScan_Area:
Page 88

td_win32asm_710.asm
mov
Flag_PortScanDir,1
mov
Var_PortScanCounter,1
;-----------------------------------------------------------------------------; API "GetWindowText" copies the text of the specified window's title bar into
; a buffer. If the window is a control, the text of the control is copied.
;-----------------------------------------------------------------------------push
6h
;nMaxCount,max number of characters to copy
push
OFFSET W4_PortScan
;lpString, address of buffer for text
push
hWnd_Work4
;hWnd, handle window or control with text
call
GetWindowTextA
;- API Function cmp
eax,0h
;error ?
je
My_Run_PortScan_Return
;nothing to do, start port field is empty
mov
esi,OFFSET W4_PortScan
;pointer to ascii buffer
call
My_StringDecNrtoHexDD
;convert number to hex doubleword
cmp
edi,65535
;ports up to 65535 are allowed
ja
My_Run_PortScan_Return
mov
Var_PortScanStart,edi
;start port
;-----------------------------------------------------------------------------; API "GetWindowText" copies the text of the specified window's title bar into
; a buffer. If the window is a control, the text of the control is copied.
;-----------------------------------------------------------------------------push
6h
;nMaxCount,max number of characters to copy
push
OFFSET W6_PortScan
;lpString, address of buffer for text
push
hWnd_Work6
;hWnd, handle window or control with text
call
GetWindowTextA
;- API Function cmp
eax,0h
;error ?
je
My_Run_PortScan_Return
;nothing to do, end port field is empty
mov
esi,OFFSET W6_PortScan
;pointer to ascii buffer
call
My_StringDecNrtoHexDD
;convert number to hex doubleword
cmp
edi,65535
;ports up to 65535 are allowed
ja
My_Run_PortScan_Return
mov
Var_PortScanEnd,edi
;end port
mov
eax,edi
sub
eax,Var_PortScanStart
mov
Var_PortScanCounter,eax
inc
Var_PortScanCounter
cmp
edi,Var_PortScanStart
jae
My_Run_PortScanGo
mov
eax,Var_PortScanStart
sub
eax,edi
mov
Var_PortScanCounter,eax
inc
Var_PortScanCounter
mov
Flag_PortScanDir,0
My_Run_PortScanGo:
call
My_SetFocus_ListView
;- SubRoutine call
My_EnableWindow0
;- SubRoutine mov
Flag_Escape,0h
;reset escape key flag
mov
Flag_PortScanThread,0h
;reset flag
;-----------------------------------------------------------------------------; API "CreateThread" creates a thread to execute
;-----------------------------------------------------------------------------push
OFFSET PortScan_ThreadID
;lpThreadId, address of returned thread id
push
0h
;dwCreationFlags, creation flags
Page 89

td_win32asm_710.asm
push
WP1_hWnd
;lpParameter, argument for new thread
push
OFFSET My_Thread_PortScan
;lpStartAddress, address of thread function
push
0h
;dwStackSize, init thread stack size, in db
push
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=15
push
PortScan_hThread
;hThread, handle to the thread
call
SetThreadPriority
;- API Function ;-----------------------------------------------------------------------------; API "CloseHandle" closes an open object handle
;-----------------------------------------------------------------------------push
PortScan_ThreadID
;hObject, handle of object to close
call
CloseHandle
;- API Function My_Run_PortScan_Return:
ret
My_Thread_PortScan:
;##############################################################################
; The Thread for the PortScanner function
;##############################################################################
push
ebp
;create stack frame
mov
ebp,esp
pushad
mov
eax,hWnd_LV_PortScan
mov
temp,eax
mov
edi,Var_PortScanStart
mov
Var_PortScanCurrentPort,edi
cmp
Flag_PortScanList,1h
;scan via portlist ?
jne
My_Thread_PortScan_Loop
mov
eax,OFFSET Buf_PortScanList
mov
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_End
mov
Flag_PortScanThread,0h
mov
edi,Var_PortScanStart
cmp
Flag_PortScanList,1h
;scan via portlist ?
jne
My_Thread_PortScan_htons
mov
eax,Var_PortListCurrentItem
mov
edx,4h
mul
edx
mov
ecx,OFFSET Buf_PortScanList
mov
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

td_win32asm_710.asm
;-----------------------------------------------------------------------------push
edi
;hostshort,16-bit number in host byte order
call
htons
;- API Function mov
sin_port,ax
;return value in TCP/IP network byte order
;-----------------------------------------------------------------------------; API "inet_addr" converts a string containing a dotted address into an in_addr.
;-----------------------------------------------------------------------------push
OFFSET W2_PortScan
;cp, string, Internet standard "." notation
call
inet_addr
;- API Function cmp
eax,0FFFFFFFFh
;error ?, INADDR_NONE
jne
My_Thread_PortScan_Socket
;-----------------------------------------------------------------------------; API "gethostbyname" gets host information corresponding to a host name.
;-----------------------------------------------------------------------------push
OFFSET W2_PortScan
;name, pointer to the name of the host
call
gethostbyname
;- API Function cmp
eax,0h
;error ?
je
My_Thread_PortScan_WSAError
mov
eax,[eax+12]
;get h_addr_list from hostent structure
mov
eax,[eax]
;get far pointer
mov
eax,[eax]
;get far pointer
My_Thread_PortScan_Socket:
mov
sin_addr,eax
;binary value from Internet address given
mov
sin_family,2h
;AF_INET
;-----------------------------------------------------------------------------; API "socket" creates a socket which is bound to a specific service provider.
;-----------------------------------------------------------------------------push
0h
;protocol, used with the socket, set to 0
push
1h
;type, specifica. for socket, SOCK_STREAM=1
push
2h
;af, address family specification,AF_INET=2
call
socket
;- API Function cmp
eax,0FFFFFFFFh
;error ?
je
My_Thread_PortScan_WSAError
mov
socketDesc,eax
;return value
;-----------------------------------------------------------------------------; API "WSAAsyncSelect" requests Windows notification network events for socket
;-----------------------------------------------------------------------------push
10h
;lEvent, bitmask network events, FD_CONNECT
push
1000h
;wMsg, message when event occurs, WM_USER+x
push
WP1_hWnd
;hWnd, window which should receive message
push
socketDesc
;s, socket descriptor
call
WSAAsyncSelect
; API Function cmp
eax,0h
;error ?
jne
My_Thread_PortScan_WSAError
;-----------------------------------------------------------------------------; API "connect" establishes a connection to a peer.
;-----------------------------------------------------------------------------push
16
;namelen, the length of the name
push
OFFSET sin_family
;name, the name of the peer to be connected
push
socketDesc
;s,descriptor identifying unconnected socket
call
connect
;- API Function My_Thread_PortScan_WSAError:
;-----------------------------------------------------------------------------Page 91

td_win32asm_710.asm
; API "WSAGetLastError" gets error status for the last operation which failed
;-----------------------------------------------------------------------------call
WSAGetLastError
;- API Function mov
counter,eax
;store error value
cmp
eax,10035
;WSAEWOULDBLOCK
jne
My_Thread_PortScan_Next
;-----------------------------------------------------------------------------; API "Sleep" suspends the execution of current thread for a specified interval
;-----------------------------------------------------------------------------push
TimeOut
;timeout in ms
call
Sleep
;- API Function cmp
Flag_PortScanThread,1h
je
My_Thread_PortScan_Next
mov
counter,12000
;<<< User defined Timeout >>>
My_Thread_PortScan_Next:
mov
ebx,OFFSET W2_PortScan
call
My_LVM_INSERTITEM
;- SubRoutine mov
esi,Var_PortScanCurrentPort
call
My_HexDDtoStringDec
mov
ebx,OFFSET Buffer
mov
LVI_iSubItem,1h
call
My_LVM_SETITEM
;- SubRoutine ;-----------------------------------------------------------------------------; API "LoadString" loads a string resource from the executable file associated
; with a specified module, copies the string into a buffer, and appends a
; terminating null character.
;-----------------------------------------------------------------------------push
104h
;nBufferMax, size of buffer
push
OFFSET Buffer
;lpBuffer, address of buffer for resource
push
counter
;uID, resource identifier
push
hInstance
;hInstance, handle module containing string
call
LoadStringA
;- API Function mov
ebx,OFFSET Buffer
cmp
Flag_PortScanThread,1h
jne
My_Thread_PortScan_Next1
mov
ebx,OFFSET M1_PortScan
;pointer to connect message
My_Thread_PortScan_Next1:
mov
LVI_iSubItem,2h
call
My_LVM_SETITEM
;- SubRoutine call
My_GetLocalTime
;- SubRoutine call
My_GetDateFormat
;- SubRoutine mov
ebx,OFFSET Buffer
mov
LVI_iSubItem,3h
call
My_LVM_SETITEM
;- SubRoutine call
My_GetTimeFormat
;- SubRoutine mov
ebx,OFFSET Buffer
;lParam, lpsz, address of string to add
mov
LVI_iSubItem,4h
call
My_LVM_SETITEM
;- SubRoutine call
My_LVM_ENJUREVISIBLE
;- SubRoutine ;-----------------------------------------------------------------------------; API "closesocket" closes a socket
;-----------------------------------------------------------------------------push
socketDesc
;socket descriptor
Page 92

td_win32asm_710.asm
call
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_REMOVE
push
1000h
;uMsgFilterMax, last message
push
1000h
;uMsgFilterMin, first message
push
WP1_hWnd
;hWnd, handle of window
push
OFFSET hWnd
;lpMsg, address of structure for message
call
PeekMessageA
;- API Function cmp
Flag_PortScanThread,1h
je
My_Thread_PortScan_Calc
cmp
counter,11001
;WSAHOST_NOT_FOUND
je
My_Thread_PortScan_End
cmp
Flag_PortScanTimeOut,1h
je
My_Thread_PortScan_Calc
cmp
counter,12000
;<<< User defined Timeout >>>
jne
My_Thread_PortScan_Calc
call
My_LVM_DELETEITEM
My_Thread_PortScan_Calc:
inc
Var_PortScanStart
cmp
Flag_PortScanDir,1
je
My_Thread_PortScan_Calc1
dec
Var_PortScanStart
dec
Var_PortScanStart
My_Thread_PortScan_Calc1:
inc
Var_PortListCurrentItem
dec
Var_PortScanCounter
cmp
Var_PortScanCounter,0h
jne
My_Thread_PortScan_Loop
My_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 thread
call
ExitThread
;- API Function popad
xor
eax,eax
mov
esp,ebp
;delete stack frame
pop
ebp
ret
4h
;##############################################################################
;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
My_Init_GAI:
call
My_DestroyWindow1
;- SubRoutine call
My_SetWindowLongA_0
;- SubRoutine ;-----------------------------------------------------------------------------Page 93

td_win32asm_710.asm
; API "SetWindowLong" changes an attribute of the specified window.
;-----------------------------------------------------------------------------push
50000005h
;lNewLong, new value, WS_CHILD | WS_VISIBLE
push
-16
;nIndex, offset value to set, GWL_STYLE
push
hWnd_LV_GAI
;hwnd, handle of window
call
SetWindowLongA
;- API Function ;-----------------------------------------------------------------------------; API "SetWindowTextA" set's the text of the specified window's title bar.
;-----------------------------------------------------------------------------push
OFFSET Bu_GAI
;lpsz, address of string
push
hWnd_Action
;hwnd, handle of window or control
call
SetWindowTextA
;- API Function call
My_Create_Logo
;- SubRoutine call
My_InvalidateRect
;- SubRoutine call
My_SetFocus_Action
;- SubRoutine ret
My_Run_GAI:
;-----------------------------------------------------------------------------; API "GetAdaptersInfo" is the most powerfull API I encounter this year !
;-----------------------------------------------------------------------------mov
eax,hWnd_LV_GAI
mov
temp,eax
call
My_EnableWindow0
;- SubRoutine mov
BufferSize,10000h
push
OFFSET BufferSize
;pOutBufLen, size of data returned
push
OFFSET Buffer
;INFO pAdapterInfo, buffer to receive data
call
[p_GetAdaptersInfo]
;- API Function cmp
eax,0h
;0h=ERROR_SUCCESS=no error
jne
My_Run_GAI_Return
mov
ebx,OFFSET Buffer
mov
counter1,ebx
My_Run_GAI_Loop:
mov
ebx,counter1
;IP_ADAPTER_INFO, Description
add
ebx,268
;
call
My_LVM_INSERTITEM
;- SubRoutine mov
ebx,counter1
;IP_ADAPTER_INFO, Address[MAX_ADAPTER_ADDRESS_LENGTH]
add
ebx,404
;
call
My_GAI_MAC
;- SubRoutine mov
ebx,counter1
;IP_ADAPTER_INFO, CurrentIpAddress
add
ebx,432
;
mov
LVI_iSubItem,2h
call
My_LVM_SETITEM
;- SubRoutine mov
ebx,counter1
;IP_ADAPTER_INFO, SubNetMask
add
ebx,448
;
mov
LVI_iSubItem,3h
call
My_LVM_SETITEM
;- SubRoutine mov
ebx,counter1
;IP_ADAPTER_INFO, Standard Gateway
add
ebx,472
;
mov
LVI_iSubItem,4h
call
My_LVM_SETITEM
;- SubRoutine mov
ebx,counter1
;IP_ADAPTER_INFO, DHCP Server
add
ebx,512
;
Page 94

td_win32asm_710.asm
mov
LVI_iSubItem,5h
call
My_LVM_SETITEM
mov
ebx,counter1
mov
eax,[ebx]
mov
counter1,eax
cmp
eax,0h
jne
My_Run_GAI_Loop
My_Run_GAI_Return:
call
My_EnableWindow1
call
My_LVM_SETITEMSTATE
call
My_SetFocus_ListView
ret

;- SubRoutine -

;end of list ?
;loop
;- SubRoutine ;- SubRoutine ;- SubRoutine -

;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
My_Init_Settings:
call
My_DestroyWindow
;- SubRoutine call
My_SetWindowLongA_0
;- SubRoutine mov
eax,hWnd_LV_Settings
mov
temp,eax
;call
My_LVM_DELETEALLITEMS
;- SubRoutine ;-----------------------------------------------------------------------------; API "SetWindowLong" changes an attribute of the specified window.
;-----------------------------------------------------------------------------push
50000005h
;lNewLong, new value, WS_CHILD
push
-16
;nIndex, offset value to set, GWL_STYLE
push
hWnd_LV_Settings
;hwnd, handle of window
call
SetWindowLongA
;- API Function ;-----------------------------------------------------------------------------; API "CreateWindowExA" creates a window with a predefined class name (STATIC).
;-----------------------------------------------------------------------------push
0h
;lpParam, extra pointer data 0=no data
push
hInstance
;hInstance, handle of our program
push
661h
;hMenu, the child-window ID
push
WP1_hWnd
;hWndParent, handle parent window 0=no
push
12h
;intnHeight, window height pixel
push
52h
;intnWidth, window width pixel
push
1C4h
;inty, vertical position window
push
0Ah
;intx, horizontal position window
push
50000000h
;dwStyle, SS_LEFT = 0h
push
OFFSET W0_Settings
;lpWindowName, pointer to window name
push
OFFSET class_STATIC
;lpClassName, pointer to class name
push
1h
;dwExStyle, look WIN32.HLP + windows.inc
call
CreateWindowExA
;- API Function mov
hWnd_Work1,eax
;hwnd, return value=handle of window
call
My_WM_SETFONT
;- SubRoutine ;-----------------------------------------------------------------------------; API "CreateWindowExA" creates a window with a predefined class name (EDIT)
;-----------------------------------------------------------------------------push
0h
;lpParam, extra pointer data 0=no data
push
hInstance
;hInstance, handle of our program
push
662h
;hMenu, the child-window ID
push
WP1_hWnd
;hWndParent, handle parent window 0=no
Page 95

td_win32asm_710.asm
push
14h
;intnHeight, window height pixel
push
20h
;intnWidth, window width pixel
push
1C3h
;inty, vertical position window
push
60h
;intx, horizontal position window
push
50002000h
;dwStyle, ES_LEFT=0h | ES_NUMBER =2000h
push
0h
;lpWindowName, pointer to window name
push
OFFSET class_EDIT
;lpClassName, pointer to class name
push
300h
;dwExStyle, look WIN32.HLP + windows.inc
call
CreateWindowExA
;- API Function mov
hWnd_Work2,eax
;hwnd, return value=handle of window
call
My_WM_SETFONT
;- SubRoutine mov
esi,TimeOut
call
My_HexDDtoStringDec
;- SubRoutine ;-----------------------------------------------------------------------------; API "SetWindowTextA" set's the text of the specified window.
;-----------------------------------------------------------------------------push
OFFSET Buffer
;lpsz, address of string
push
hWnd_Work2
;hwnd, handle of window or control
call
SetWindowTextA
;- API Function ;-----------------------------------------------------------------------------; API "CreateWindowExA" creates a window with a predefined class name (BUTTON)
;-----------------------------------------------------------------------------push
0h
;lpParam, extra pointer data 0=no data
push
hInstance
;hInstance, handle of our program
push
663h
;hMenu, the child-window ID
push
WP1_hWnd
;hWndParent, handle parent window 0=no
push
12h
;intnHeight, window height pixel
push
4Eh
;intnWidth, window width pixel
push
1C4h
;inty, vertical position window
push
150h
;intx, horizontal position window
push
50000003h
;dwStyle, style ( BS_AUTOCHECKBOX )
push
OFFSET W2_Settings
;lpWindowName, pointer to window name
push
OFFSET class_BUTTON
;lpClassName, pointer to class name
push
1h
;dwExStyle,
call
CreateWindowExA
;- API Function mov
hWnd_Work3,eax
;return value=handle of window
call
My_WM_SETFONT
;- SubRoutine ;-----------------------------------------------------------------------------; API "SendMessageA" sends a message to the window
;-----------------------------------------------------------------------------push
0h
;lParam, not used, must be 0
push
AutoLog
;wParam,
push
0F1h
;uMsg, BM_SETCHECK
push
hWnd_Work3
;hwnd, handle of destination window
call
SendMessageA
;- API Function My_Init_Settings_Work4:
;-----------------------------------------------------------------------------; API "CreateWindowExA" creates a window with a predefined class name (BUTTON)
;-----------------------------------------------------------------------------push
0h
;lpParam, extra pointer data 0=no data
push
hInstance
;hInstance, handle of our program
push
664h
;hMenu, the child-window ID
push
WP1_hWnd
;hWndParent, handle parent window 0=no
Page 96

td_win32asm_710.asm
push
12h
;intnHeight, window height pixel
push
4Eh
;intnWidth, window width pixel
push
1DAh
;inty, vertical position window
push
150h
;intx, horizontal position window
push
50000003h
;dwStyle, style ( BS_AUTOCHECKBOX )
push
OFFSET W3_Settings
;lpWindowName, pointer to window name
push
OFFSET class_BUTTON
;lpClassName, pointer to class name
push
1h
;dwExStyle,
call
CreateWindowExA
;- API Function mov
hWnd_Work4,eax
;return value=handle of window
call
My_WM_SETFONT
;- SubRoutine ;-----------------------------------------------------------------------------; API "SendMessageA" sends a message to the window
;-----------------------------------------------------------------------------push
0h
;lParam, not used, must be 0
push
AutoSave
;wParam,
push
0F1h
;uMsg, BM_SETCHECK
push
hWnd_Work4
;hwnd, handle of destination window
call
SendMessageA
;- API Function My_Init_Settings_Action:
;-----------------------------------------------------------------------------; API "SetWindowTextA" set's the text of the specified window.
;-----------------------------------------------------------------------------push
OFFSET Bu_Settings
;lpsz, address of string
push
hWnd_Action
;hwnd, handle of window or control
call
SetWindowTextA
;- API Function call
My_InvalidateRect
;- SubRoutine call
My_SetFocus_Action
;- SubRoutine ret
My_Run_Settings:
mov
eax,hWnd_LV_Settings
;
mov
temp,eax
;
call
My_EnableWindow0
;- SubRoutine ;-----------------------------------------------------------------------------; API "GetWindowTextA" get's the text of the specified window.
;-----------------------------------------------------------------------------push
5h
;nMaxCount,max number of characters to copy
push
OFFSET Buffer
;lpString, address of buffer for text
push
hWnd_Work2
;hWnd, handle window or control with text
call
GetWindowTextA
;- API Function cmp
eax,0h
;error ?
je
My_Run_Settings_TimeOutMin
mov
esi,OFFSET Buffer
call
My_StringDecNrtoHexDD
cmp
edi,10
;value above or equal 10ms ?
jae
My_Run_Settings_TimeOut
My_Run_Settings_TimeOutMin:
;-----------------------------------------------------------------------------; API "SetWindowTextA" set's the text of the specified window.
;-----------------------------------------------------------------------------push
OFFSET TimeOutMin
;lpsz, address of string
push
hWnd_Work2
;hwnd, handle of window or control
Page 97

td_win32asm_710.asm
call
SetWindowTextA
;- API Function ;-----------------------------------------------------------------------------; API "GetWindowTextA" get's the text of the specified window.
;-----------------------------------------------------------------------------push
5h
;nMaxCount,max number of characters to copy
push
OFFSET Buffer
;lpString, address of buffer for text
push
hWnd_Work2
;hWnd, handle window or control with text
call
GetWindowTextA
;- API Function mov
edi,10
;minimum timeout value=10ms
My_Run_Settings_TimeOut:
mov
TimeOut,edi
mov
ebx,OFFSET W1_Settings
call
My_LVM_INSERTITEM
;- SubRoutine mov
LVI_iSubItem,1h
mov
ebx,OFFSET Buffer
call
My_LVM_SETITEM
;- SubRoutine call
My_GetLocalTime
;- SubRoutine call
My_GetDateFormat
;- SubRoutine mov
ebx,OFFSET Buffer
mov
LVI_iSubItem,2h
call
My_LVM_SETITEM
;- SubRoutine call
My_GetTimeFormat
;- SubRoutine mov
ebx,OFFSET Buffer
;lParam, lpsz, address of string to add
mov
LVI_iSubItem,3h
call
My_LVM_SETITEM
;- SubRoutine ;-----------------------------------------------------------------------------; API "SendMessageA" sends a message to the window
;-----------------------------------------------------------------------------push
0h
;lParam, not used, must be 0
push
0h
;wParam, not used, must be 0
push
0F0h
;uMsg, BM_GETCHECK
push
hWnd_Work3
;hwnd, handle of destination window
call
SendMessageA
;- API Function mov
AutoLog,eax
;EAX=checkstate, 0=unchecked, 1=checked
mov
ebx,OFFSET W2_Settings
;
call
My_LVM_INSERTITEM
;- SubRoutine mov
LVI_iSubItem,1h
mov
ebx,OFFSET Enabled
cmp
AutoLog,1h
je
My_Run_Settings_AutoLog1
mov
ebx,OFFSET Disabled
My_Run_Settings_AutoLog1:
call
My_LVM_SETITEM
;- SubRoutine call
My_GetLocalTime
;- SubRoutine call
My_GetDateFormat
;- SubRoutine mov
ebx,OFFSET Buffer
mov
LVI_iSubItem,2h
call
My_LVM_SETITEM
;- SubRoutine call
My_GetTimeFormat
;- SubRoutine mov
ebx,OFFSET Buffer
;lParam, lpsz, address of string to add
mov
LVI_iSubItem,3h
call
My_LVM_SETITEM
;- SubRoutine ;-----------------------------------------------------------------------------Page 98

td_win32asm_710.asm
; API "SendMessageA" sends a message to the window
;-----------------------------------------------------------------------------push
0h
;lParam, not used, must be 0
push
0h
;wParam, not used, must be 0
push
0F0h
;uMsg, BM_GETCHECK
push
hWnd_Work4
;hwnd, handle of destination window
call
SendMessageA
;- API Function mov
AutoSave,eax
;EAX=checkstate, 0=unchecked, 1=checked
mov
ebx,OFFSET W3_Settings
call
My_LVM_INSERTITEM
;- SubRoutine mov
LVI_iSubItem,1h
mov
ebx,OFFSET Enabled
cmp
AutoSave,1h
je
My_Run_Settings_AutoSave1
mov
ebx,OFFSET Disabled
My_Run_Settings_AutoSave1:
call
My_LVM_SETITEM
;- SubRoutine call
My_GetLocalTime
;- SubRoutine call
My_GetDateFormat
;- SubRoutine mov
ebx,OFFSET Buffer
mov
LVI_iSubItem,2h
call
My_LVM_SETITEM
;- SubRoutine call
My_GetTimeFormat
;- SubRoutine mov
ebx,OFFSET Buffer
;lParam, lpsz, address of string to add
mov
LVI_iSubItem,3h
call
My_LVM_SETITEM
;- SubRoutine My_Run_Settings_Return:
call
My_EnableWindow1
;- SubRoutine call
My_LVM_SETITEMSTATE
;- SubRoutine call
My_SetFocus_ListView
;- SubRoutine ret
;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
My_Init_Help:
call
My_DestroyWindow1
;- SubRoutine call
My_SetWindowLongA_0
;- SubRoutine ;-----------------------------------------------------------------------------; API "SetWindowLong" changes an attribute of the specified window.
;-----------------------------------------------------------------------------push
50000105h
;lNewLong, new value, WS_CHILD
push
-16
;nIndex, offset value to set, GWL_STYLE
push
hWnd_LV_Help
;hwnd, handle of window
call
SetWindowLongA
;- API Function ;-----------------------------------------------------------------------------; API "SetWindowTextA" set's the text of the specified window's title bar.
;-----------------------------------------------------------------------------push
OFFSET Bu_Help
;lpsz, address of string
push
hWnd_Action
;hwnd, handle of window or control
call
SetWindowTextA
;- API Function call
My_Create_Logo
;- SubRoutine call
My_InvalidateRect
;- SubRoutine call
My_SetFocus_Action
;- SubRoutine Page 99

td_win32asm_710.asm
ret
My_Run_Help:
;-----------------------------------------------------------------------------; API "MessageBoxA" creates a message box ...
;-----------------------------------------------------------------------------push
40h
;uType,style,MB_ICONINFORMATION=40h,0=MB_OK Button
push
OFFSET MB18_Title
;lpCaption,pointer to title text
push
OFFSET MB18_Text
;lpText,pointer to text message box
push
WP1_hWnd
;handle of owner window
call
MessageBoxA
;- API Function 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,eax
dec
ecx
add
esi,ecx
mov
edi,0h
mov
eax,1
My_StringDecNrtoHexDD_Loop:
mov
bl,[esi]
and
bl,0Fh
je
My_StringDecNrtoHexDD_Next
My_StringDecNrtoHexDD_Inc:
add
edi,eax
dec
bl
jne
My_StringDecNrtoHexDD_Inc
My_StringDecNrtoHexDD_Next:
mov
edx,10
mul
edx
dec
esi
dec
ecx
cmp
ecx,0FFFFFFFFh
jne
My_StringDecNrtoHexDD_Loop
ret
My_HexDBtoStringHex:
;-----------------------------------------------------------------------------; Converts a 8 bit value in AL into an ascii hexadecimal string to OFFSET EDX
;-----------------------------------------------------------------------------mov
ah,al
;prepare calculation
shr
ah,4h
and
al,0Fh
mov
ecx,0h
Page 100

td_win32asm_710.asm
mov
esi,OFFSET table_HEX
mov
edi,OFFSET table_ASCII
push
esi
push
edi
My_HexDBtoStringHexNext47:
cmp
ah,[esi]
je
My_HexDBtoStringHexOK47
inc
esi
inc
edi
inc
ch
cmp
ch,10h
jne
My_HexDBtoStringHexNext47
My_HexDBtoStringHexOK47:
mov
ch,[edi]
mov
[edx],ch
inc
edx
pop
edi
pop
esi
My_HexDBtoStringHexNext03:
cmp
al,[esi]
je
My_HexDBtoStringHexOK03
inc
esi
inc
edi
inc
cl
cmp
cl,10h
jne
My_HexDBtoStringHexNext03
My_HexDBtoStringHexOK03:
mov
cl,[edi]
mov
[edx],cl
ret

;calculate bits 4-7

;store result
;inc pointer buffer
;restore pointer tables
;calculate bits 0-3

;store result

My_HexDDtoStringHex:
;-----------------------------------------------------------------------------; Converts a 32 bit value in ESI into an ascii hexadecimal string to OFFSET EDI
;-----------------------------------------------------------------------------mov
counter1,0h
My_HexDDtoStringHex_Next:
mov
counter,0h
My_HexDDtoStringHex_Loop:
mov
edx,OFFSET table_HEX
add
edx,counter
mov
ebx,OFFSET table_ASCII
add
ebx,counter
mov
eax,OFFSET table_SHIFT
add
eax,counter1
mov
cl,[eax]
inc
counter
cmp
counter,11h
jae
My_HexDDtoStringHex_return
mov
eax,esi
shr
eax,cl
and
eax,15
cmp
al,[edx]
Page 101

td_win32asm_710.asm
jne
My_HexDDtoStringHex_Loop
mov
dl,[ebx]
mov
[edi],dl
inc
edi
inc
counter1
cmp
counter1,8h
jne
My_HexDDtoStringHex_Next
My_HexDDtoStringHex_return:
ret
My_HexDDtoStringDec:
;-----------------------------------------------------------------------------; Converts a 32 bit value in ESI into an ascii decimal string to OFFSET Buffer
;-----------------------------------------------------------------------------push
esi
;argument
push
OFFSET FormatControlString ;lpFmt, address of format-control string
push
OFFSET Buffer
;lpOut, address of buffer for output
call
wsprintf
;- API function pop
eax
;clear stack, because C function, sorry !
pop
eax
pop
eax
ret
My_ScreenToTray:
;-----------------------------------------------------------------------------; Sends Window to Tray
;-----------------------------------------------------------------------------mov
nid_cbSize,58h
;size of NOTIFYCONDATA structure
mov
eax,WP1_hWnd
mov
nid_hWnd,eax
;handle of window
mov
nid_uID,04FEh
;icon ID, a free value of your choice
mov
nid_uFlags,7h
;NIF_ICON=2h,NIF_MESSAGE=1h,NIF_TIP=4h
mov
nid_uCallbackMessage,4FFh
;message send to window on mouse events
mov
eax,hIcon
;we use the same icon handle loaded
mov
nid_hIcon,eax
;for the main window
;-----------------------------------------------------------------------------; API "lstrcpyA" copy's a string from source to destination.
;-----------------------------------------------------------------------------push
OFFSET ProgramName
;source address of icon tip string
push
OFFSET nid_szTip
;destination address in structure
call
lstrcpyA
;- API Function ;-----------------------------------------------------------------------------; API "ShowWindow" function sets the specified window's show state.
;-----------------------------------------------------------------------------push
0h
;nCmdShow, show state 0h=SW_HIDE
push
WP1_hWnd
;hWnd, handle of window
call
ShowWindow
;- API Function ;-----------------------------------------------------------------------------; API "Shell_NotifyIconA" here sends a msg. to the system to add a taskbar icon
;-----------------------------------------------------------------------------push
OFFSET nid_cbSize
;pnid, address of NOTIFYCONDATA struc.
push
0h
;dwMessage, NIM_ADD=0h
call
Shell_NotifyIconA
;- API Function Page 102

td_win32asm_710.asm
ret
My_TrayToScreen:
;-----------------------------------------------------------------------------; 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_DELETE
call
Shell_NotifyIconA
;- API Function ;-----------------------------------------------------------------------------; API "ShowWindow" function sets the specified window's show state.
;-----------------------------------------------------------------------------push
9h
;nCmdShow, show state 9=SW_RESTORE
push
WP1_hWnd
;hwnd, handle of window
call
ShowWindow
;- API Function ret
My_AdapterType:
;-----------------------------------------------------------------------------;
;-----------------------------------------------------------------------------mov
al,[ebx]
cmp
al,0
jne
AdapterType1
mov
ebx,OFFSET M0_GAI
jmp
AdapterType_Result
AdapterType1:
cmp
al,1
jne
AdapterType2
mov
ebx,OFFSET M1_GAI
jmp
AdapterType_Result
AdapterType2:
cmp
al,2
jne
AdapterType3
mov
ebx,OFFSET M2_GAI
jmp
AdapterType_Result
AdapterType3:
cmp
al,3
jne
AdapterType4
mov
ebx,OFFSET M3_GAI
jmp
AdapterType_Result
AdapterType4:
cmp
al,4
jne
AdapterType5
mov
ebx,OFFSET M4_GAI
jmp
AdapterType_Result
AdapterType5:
cmp
al,5
jne
AdapterType6
mov
ebx,OFFSET M5_GAI
jmp
AdapterType_Result
AdapterType6:
cmp
al,6
Page 103

td_win32asm_710.asm
jne
AdapterType9
mov
ebx,OFFSET M6_GAI
jmp
AdapterType_Result
AdapterType9:
mov
ebx,OFFSET M9_GAI
AdapterType_Result:
call
My_LVM_INSERTITEM
ret

;- SubRoutine -

My_GAI_MAC:
;-----------------------------------------------------------------------------;
;-----------------------------------------------------------------------------mov
al,[ebx]
;get byte value, converting to ASCII starts here
mov
edx,OFFSET MiscBuffer
call
My_HexDBtoStringHex
;- SubRoutine mov
al,[ebx+1]
mov
edx,OFFSET MiscBuffer+3
call
My_HexDBtoStringHex
;- SubRoutine mov
al,[ebx+2]
mov
edx,OFFSET MiscBuffer+6
call
My_HexDBtoStringHex
;- SubRoutine mov
al,[ebx+3]
mov
edx,OFFSET MiscBuffer+9
call
My_HexDBtoStringHex
;- SubRoutine mov
al,[ebx+4]
mov
edx,OFFSET MiscBuffer+12
call
My_HexDBtoStringHex
;- SubRoutine mov
al,[ebx+5]
mov
edx,OFFSET MiscBuffer+15
call
My_HexDBtoStringHex
;- SubRoutine mov
ax,002Dh
;insert ascii "-"
mov
edx,OFFSET MiscBuffer+2
mov
[edx],al
add
edx,3h
mov
[edx],al
add
edx,3h
mov
[edx],al
add
edx,3h
mov
[edx],al
add
edx,3h
mov
[edx],al
add
edx,3h
mov
[edx],ah
;insert terminating 0, converting to ASCII ends here
mov
ebx,OFFSET MiscBuffer
mov
LVI_iSubItem,1h
call
My_LVM_SETITEM
ret
My_GetLocalTime:
;-----------------------------------------------------------------------------; API "GetLocalTime" retrieves the current local date and time.
;-----------------------------------------------------------------------------Page 104

push
call
ret

OFFSET wYear
GetLocalTime

td_win32asm_710.asm
;lpSystemTime, address system time struc
;- API Function -

My_GetDateFormat:
;-----------------------------------------------------------------------------; API "GetDateFormat" formats a date as a date string for a specified locale.
; The function formats either a specified date or the local system date.
;-----------------------------------------------------------------------------push
104h
;cchDate, size of buffer
push
OFFSET Buffer
;lpDateStr, buffer for formatted string
push
OFFSET DateFormatPic
;lpFormat, date format string
push
OFFSET wYear
;lpDate, date to be formatted
push
0h
;dwFlags, flags specifying function options
push
0000h
;Locale, LOCALE_USER_DEFAULT = 0000h
call
GetDateFormatA
;- API Function ret
My_GetTimeFormat:
;-----------------------------------------------------------------------------; API "GetTimeFormat" formats a time as a time string for a specified locale.
; The function formats either a specified time or the local system time.
;-----------------------------------------------------------------------------push
104h
;cchTime, size in bytes of the buffer
push
OFFSET Buffer
;lpTimeStr, buffer storing formatted string
push
OFFSET TimeFormatPic
;lpFormat, time format string
push
OFFSET wYear
;lpTime, time to be formatted
push
8h
;dwFlags, TIME_FORCE24HOURFORMAT = 8h
push
0000h
;Locale, LOCALE_USER_DEFAULT = 0000h
call
GetTimeFormatA
;- API Function ret
My_WM_SETFONT:
;-----------------------------------------------------------------------------; API "SendMessageA" sends a WM_SETFONT message to the specified window
;-----------------------------------------------------------------------------push
1h
;lParam, redraw flag
push
hFont
;wParam, hfont, handle of font
push
30h
;uMsg, WM_SETFONT
push
eax
;hwnd, handle of destination window
call
SendMessageA
;- API Function ret
My_EnableWindow0:
;-----------------------------------------------------------------------------; API "EnableWindow" enables or disables input to specified window or control.
;-----------------------------------------------------------------------------push
0h
;bEnable, flag enabling or disabling input
push
WP1_hWnd
;hWnd, handle of window
call
EnableWindow
;- API Function ;-----------------------------------------------------------------------------; Send ACM_PLAY message to the animate control
;-----------------------------------------------------------------------------Page 105

push

0FFFF0000h

push
push
push
call
ret

0FFFFFFFFh
1125
hWnd_Animate
SendMessageA

td_win32asm_710.asm
;lParam, 0FFFFh=end with last frame (-1)
;
0000h=start with first frame
;wParam, cRepeat, -1 = indefinitely
;uMsg, ACM_PLAY = WM_USER(400h)+101
;hwnd, handle of destination window
;- API Function -

My_EnableWindow1:
;-----------------------------------------------------------------------------; API "EnableWindow" enables or disables input to specified window or control.
;-----------------------------------------------------------------------------push
1h
;bEnable, flag enabling or disabling input
push
WP1_hWnd
;hWnd, handle of window
call
EnableWindow
;- API Function ;-----------------------------------------------------------------------------; Send ACM_PLAY message to the animate control
;-----------------------------------------------------------------------------push
0h
;lParam, word, 0h=end with frame 0
;
word, 0h=start with frame 0
push
0h
;wParam, cRepeat, -1 = indefinitely
push
1125
;uMsg, ACM_PLAY = WM_USER(400h)+101
push
hWnd_Animate
;hwnd, handle of destination window
call
SendMessageA
;- API Function ret
My_LVM_SETCOLOR:
;-----------------------------------------------------------------------------; API "SendMessageA" sends a message to the window
;-----------------------------------------------------------------------------push
0h
;lParam, coplor
push
0h
;wParam, set to 0
push
1001h
;uMsg, LVM_FIRST=1000h | LVM_SETBKCOLOR=1
push
temp
;hwnd, handle of destination window
call
SendMessageA
;- API Function push
0h
;lParam, color
push
0h
;wParam, set to 0
push
1026h
;uMsg,LVM_FIRST=1000h|LVM_SETTEXTBKCOLOR=38
push
temp
;hwnd, handle of destination window
call
SendMessageA
;- API Function push
00000D6FFh
;lParam, color
push
0h
;wParam, set to 0
push
1024h
;uMsg, LVM_FIRST=1000h|LVM_SETTEXTCOLOR=36
push
temp
;hwnd, handle of destination window
call
SendMessageA
;- API Function ret
My_LVM_DELETEALLITEMS:
;-----------------------------------------------------------------------------; API "SendMessageA" sends a message to the window
;-----------------------------------------------------------------------------push
0h
;lParam, set to 0
push
0h
;wParam, set to 0
Page 106

push
push
call
ret

1009h
temp
SendMessageA

td_win32asm_710.asm
;uMsg,LVM_FIRST=1000h|LVM_DELETEALLITEMS=9
;hwnd, handle of destination window
;- API Function -

My_LVM_INSERTITEM:
mov
LVI_mask,1h
;LVIF_TEXT=1h
mov
LVI_pszText,ebx
;pointer to text
mov
LVI_iSubItem,0h
;-----------------------------------------------------------------------------; API "SendMessageA" sends a message to the window
;-----------------------------------------------------------------------------push
0h
;lParam, set to 0
push
0h
;wParam, set to 0
push
1004h
;uMsg, LVM_FIRST=1000h | LVM_GETITEMCOUNT=4
push
temp
;hwnd, handle of destination window
call
SendMessageA
;- API Function mov
LVI_iItem,eax
;return value=number of items
;-----------------------------------------------------------------------------; API "SendMessageA" sends a message to the window
;-----------------------------------------------------------------------------push
OFFSET LVI_mask
;lParam, pcol, pointer LV_ITEM structure
push
0h
;wParam, set to 0
push
1007h
;uMsg, LVM_FIRST=1000h | LVM_INSERTITEM=7
push
temp
;hwnd, handle of destination window
call
SendMessageA
;- API Function ret
My_LVM_INSERTITEM_IMAGE:
mov
LVI_mask,3h
;LVIF_TEXT=1h, LVIF_IMAGE=2h
mov
LVI_pszText,ebx
;pointer to text
mov
LVI_iSubItem,0h
;-----------------------------------------------------------------------------; API "SendMessageA" sends a message to the window
;-----------------------------------------------------------------------------push
0h
;lParam, set to 0
push
0h
;wParam, set to 0
push
1004h
;uMsg, LVM_FIRST=1000h | LVM_GETITEMCOUNT=4
push
temp
;hwnd, handle of destination window
call
SendMessageA
;- API Function mov
LVI_iItem,eax
;return value=number of items
;-----------------------------------------------------------------------------; API "SendMessageA" sends a message to the window
;-----------------------------------------------------------------------------push
OFFSET LVI_mask
;lParam, pcol, pointer LV_ITEM structure
push
0h
;wParam, set to 0
push
1007h
;uMsg, LVM_FIRST=1000h | LVM_INSERTITEM=7
push
temp
;hwnd, handle of destination window
call
SendMessageA
;- API Function ret
My_LVM_DELETEITEM:
;-----------------------------------------------------------------------------Page 107

td_win32asm_710.asm
; API "SendMessageA" sends a message to the window
;-----------------------------------------------------------------------------push
0h
;lParam, set to 0
push
0h
;wParam, set to 0
push
1004h
;uMsg, LVM_FIRST=1000h | LVM_GETITEMCOUNT=4
push
temp
;hwnd, handle of destination window
call
SendMessageA
;- API Function dec
eax
;-----------------------------------------------------------------------------; API "SendMessageA" sends a message to the window
;-----------------------------------------------------------------------------push
0h
;lParam, set to 0
push
eax
;wParam, iItem
push
1008h
;uMsg, LVM_FIRST=1000h | LVM_DELETETITEM=8
push
temp
;hwnd, handle of destination window
call
SendMessageA
;- API Function ret
My_LVM_SETITEM:
mov
LVI_mask,1h
;LVIF_TEXT=1h
mov
LVI_pszText,ebx
;pointer to text
;-----------------------------------------------------------------------------; API "SendMessageA" sends a message to the window
;-----------------------------------------------------------------------------push
0h
;lParam, set to 0
push
0h
;wParam, set to 0
push
1004h
;uMsg, LVM_FIRST=1000h | LVM_GETITEMCOUNT=4
push
temp
;hwnd, handle of destination window
call
SendMessageA
;- API Function -1
dec
eax
mov
LVI_iItem,eax
;-----------------------------------------------------------------------------; API "SendMessageA" sends a message to the window
;-----------------------------------------------------------------------------push
OFFSET LVI_mask
;lParam, pointer to LV_ITEM structure
push
0h
;wParam, set to 0
push
1006h
;uMsg, LVM_FIRST=1000h | LVM_SETITEM=6
push
temp
;hwnd, handle of destination window
call
SendMessageA
;- API Function ret
My_LVM_ENJUREVISIBLE:
;-----------------------------------------------------------------------------; API "SendMessageA" sends a message to the window
;-----------------------------------------------------------------------------push
0h
;lParam, set to 0
push
0h
;wParam, set to 0
push
1004h
;uMsg, LVM_FIRST=1000h | LVM_GETITEMCOUNT=4
push
temp
;hwnd, handle of destination window
call
SendMessageA
;- API Function dec
eax
;-----------------------------------------------------------------------------; API "SendMessageA" sends a message to the window
Page 108

td_win32asm_710.asm
;-----------------------------------------------------------------------------push
0h
;lParam, fPartialOK, TRUE or FALSE
push
eax
;wParam, i, index of the list view item
push
1013h
;uMsg, LVM_FIRST=1000h|LVM_ENSUREVISIBLE=19
push
temp
;hwnd, handle of destination window
call
SendMessageA
;- API Function ret
My_LVM_SETITEMSTATE:
;-----------------------------------------------------------------------------; API "SendMessageA" sends a message to the window
;-----------------------------------------------------------------------------push
0h
;lParam, set to 0
push
0h
;wParam, set to 0
push
1004h
;uMsg, LVM_FIRST=1000h | LVM_GETITEMCOUNT=4
push
temp
;hwnd, handle of destination window
call
SendMessageA
;- API Function dec
eax
push
eax
;store eax
;-----------------------------------------------------------------------------; API "SendMessageA" sends a message to the window
;-----------------------------------------------------------------------------push
0h
;lParam, fPartialOK, TRUE or FALSE
push
eax
;wParam, i, index of the list view item
push
1013h
;uMsg, LVM_FIRST=1000h|LVM_ENSUREVISIBLE=19
push
temp
;hwnd, handle of destination window
call
SendMessageA
;- API Function mov
LVI_state,3h
mov
LVI_stateMask,3h
;-----------------------------------------------------------------------------; API "SendMessageA" sends a message to the window
;-----------------------------------------------------------------------------pop
eax
;restore eax
push
OFFSET LVI_mask
;lParam, pointer to LV_ITEM structure
push
eax
;wParam, index of the list view item
push
102Bh
;uMsg,LVM_FIRST=1000h | LVM_SETITEMSTATE=43
push
temp
;hwnd, handle of destination window
call
SendMessageA
;- API Function ret
My_InvalidateRect:
;-----------------------------------------------------------------------------; API "InvalidateRect" adds a rectangle to specified window's update region.
; This function performs a WM_PAINT message.
;-----------------------------------------------------------------------------push
0h
;bErase, erase-background flag
push
OFFSET rect_left
;lpRect, rect structure, 0h=client area
push
WP1_hWnd
;hWnd, handle window update region
call
InvalidateRect
;- API Function ret
My_SetFocus_EDIT:
;-----------------------------------------------------------------------------Page 109

td_win32asm_710.asm
; API "SetFocus" sets the keyboard focus to the specified window.
;-----------------------------------------------------------------------------push
hWnd_Work2
;hwnd, handle of window to receive focus
call
SetFocus
;- API Function ret
My_SetFocus_Action:
;-----------------------------------------------------------------------------; API "EnableWindow" enables or disables input to specified window or control.
;-----------------------------------------------------------------------------push
1h
;bEnable, flag enabling or disabling input
push
hWnd_Action
;hWnd, handle of window
call
EnableWindow
;- API Function ;-----------------------------------------------------------------------------; API "SetFocus" sets the keyboard focus to the specified window.
;-----------------------------------------------------------------------------push
hWnd_Action
;hwnd, handle of window to receive focus
call
SetFocus
;- API Function ret
My_DestroyWindow:
;-----------------------------------------------------------------------------; API "DestroyWindow" function destroys the given window
;-----------------------------------------------------------------------------push
hWnd_Logo
;hwnd, handle of window to destroy
call
DestroyWindow
;- API Function mov
Flag_Logo,0h
;reset flag
My_DestroyWindow1:
push
hWnd_Work1
;hwnd, handle of window to destroy
call
DestroyWindow
;- API Function push
hWnd_Work2
;hwnd, handle of window to destroy
call
DestroyWindow
;- API Function push
hWnd_Work3
;hwnd, handle of window to destroy
call
DestroyWindow
;- API Function push
hWnd_Work4
;hwnd, handle of window to destroy
call
DestroyWindow
;- API Function push
hWnd_Work5
;hwnd, handle of window to destroy
call
DestroyWindow
;- API Function push
hWnd_Work6
;hwnd, handle of window to destroy
call
DestroyWindow
;- API Function push
hWnd_Work7
;hwnd, handle of window to destroy
call
DestroyWindow
;- API Function push
hWnd_Work8
;hwnd, handle of window to destroy
call
DestroyWindow
;- API Function push
hWnd_LV_PortList
;hwnd, handle of window to destroy
call
DestroyWindow
;- API Function ret
My_Clipboard:
;-----------------------------------------------------------------------------; API "CloseClipboard" closes the clipboard.
;-----------------------------------------------------------------------------call
CloseClipboard
;- API Function Page 110

td_win32asm_710.asm
;-----------------------------------------------------------------------------; API "OpenClipboard" opens the clipboard for examination and prevents other
; applications from modifying the clipboard content.
;-----------------------------------------------------------------------------push
WP1_hWnd
;hwnd, handle of window opening clipboard
call
OpenClipboard
;- API Function cmp
eax,0h
;error ?
je
Error_Clipboard
;-----------------------------------------------------------------------------; API "GlobalAlloc" allocates the specified number of bytes
;-----------------------------------------------------------------------------push
104h
;dwBytes,number of bytes to allocate
push
2h
;uFlags, alloc attributes, GMEM_MOVEABLE=2h
call
GlobalAlloc
;- API Function mov
h_Memory,eax
;store handle memory in variable
;-----------------------------------------------------------------------------; API "GlobalLock" locks a global memory object and returns a pointer.
;-----------------------------------------------------------------------------push
h_Memory
;hMem, handle of the global memory object
call
GlobalLock
;- API Function mov
p_Memory,eax
;pointer to global memory
;-----------------------------------------------------------------------------; API "lstrcpyA" copies a string to a buffer
;-----------------------------------------------------------------------------push
OFFSET Buffer
;lpString2, address of string to copy
push
eax
;lpString1, address of buffer
call
lstrcpyA
;- API Function ;-----------------------------------------------------------------------------; API "EmptyClipboard" empties clipboard and frees handles to data in clipboard
;-----------------------------------------------------------------------------call
EmptyClipboard
;- API Function ;-----------------------------------------------------------------------------; API "GlobalUnlock" decrements the lock count associated with a memory object
; that was allocated with the GMEM_MOVEABLE flag.
;-----------------------------------------------------------------------------push
h_Memory
;hMem, handle to the global memory object
call
GlobalUnlock
;- API Function ;-----------------------------------------------------------------------------; API "SetClipboardData" places data on clipboard in specified clipboard format
;-----------------------------------------------------------------------------push
h_Memory
;hData, data handle
push
1h
;uFormat, clipboard format, CF_TEXT=1h
call
SetClipboardData
;- API Function ;-----------------------------------------------------------------------------; API "CloseClipboard" closes the clipboard.
;-----------------------------------------------------------------------------call
CloseClipboard
;- API Function Error_Clipboard:
ret
My_MessageBox:
;-----------------------------------------------------------------------------; API "MessageBoxA" creates a message box ...
Page 111

td_win32asm_710.asm
;-----------------------------------------------------------------------------push
0h
;uType, style, 0=MB_OK Button
push
OFFSET MB1_Title
;lpCaption,pointer to title text
push
OFFSET MB1_Text
;lpText,pointer to text message box
push
WP1_hWnd
;handle of owner window
call
MessageBoxA
;- API Function ret
My_SetFocus_ListView:
;-----------------------------------------------------------------------------; API "SetFocus" sets the keyboard focus to the specified window.
;-----------------------------------------------------------------------------push
temp
;hwnd, handle of window to receive focus
call
SetFocus
;- API Function ;-----------------------------------------------------------------------------; API "SendMessageA" sends a message to the window
;-----------------------------------------------------------------------------push
1h
;lParam, LVNI_FOCUSED=1h, LVNI_SELECTED=2h
push
-1
;wParam,index item begin search or -1 first
push
100Ch
;uMsg, LVM_FIRST=1000h | LVM_GETNEXTITEM=12
push
temp
;hwnd, handle of destination window
call
SendMessageA
;- API Function ;-----------------------------------------------------------------------------; API "SendMessageA" sends a message to the window
;-----------------------------------------------------------------------------push
0h
;lParam, fPartialOK, TRUE or FALSE
push
eax
;wParam, i, index of the list view item
push
1013h
;uMsg, LVM_FIRST=1000h|LVM_ENSUREVISIBLE=19
push
temp
;hwnd, handle of destination window
call
SendMessageA
;- API Function ret
My_SetWindowLongA_0:
;-----------------------------------------------------------------------------; API "SetWindowLong" changes an attribute of the specified window.
;-----------------------------------------------------------------------------push
40000005h
;lNewLong, new value, WS_CHILD
push
-16
;nIndex, offset value to set, GWL_STYLE
push
hWnd_LV_Startup
;hwnd, handle of window
call
SetWindowLongA
;- API Function push
40000005h
;lNewLong, new value, WS_CHILD
push
-16
;nIndex, offset value to set, GWL_STYLE
push
hWnd_LV_Phonebook
;hwnd, handle of window
call
SetWindowLongA
;- API Function push
40000005h
;lNewLong, new value, WS_CHILD
push
-16
;nIndex, offset value to set, GWL_STYLE
push
hWnd_LV_Lookup
;hwnd, handle of window
call
SetWindowLongA
;- API Function push
40000005h
;lNewLong, new value, WS_CHILD
push
-16
;nIndex, offset value to set, GWL_STYLE
push
hWnd_LV_LocalHost
;hwnd, handle of window
call
SetWindowLongA
;- API Function push
40000005h
;lNewLong, new value, WS_CHILD
Page 112

push
push
call
push
push
push
call
push
push
push
call
push
push
push
call
push
push
push
call
push
push
push
call
ret

-16
hWnd_LV_ActiveRAS
SetWindowLongA
40000005h
-16
hWnd_LV_RASDial
SetWindowLongA
40000005h
-16
hWnd_LV_PortScan
SetWindowLongA
40000005h
-16
hWnd_LV_GAI
SetWindowLongA
40000005h
-16
hWnd_LV_Settings
SetWindowLongA
40000005h
-16
hWnd_LV_Help
SetWindowLongA

td_win32asm_710.asm
;nIndex, offset value to set, GWL_STYLE
;hwnd, handle of window
;- API Function ;lNewLong, new value, WS_CHILD
;nIndex, offset value to set, GWL_STYLE
;hwnd, handle of window
;- API Function ;lNewLong, new value, WS_CHILD
;nIndex, offset value to set, GWL_STYLE
;hwnd, handle of window
;- API Function ;lNewLong, new value, WS_CHILD
;nIndex, offset value to set, GWL_STYLE
;hwnd, handle of window
;- API Function ;lNewLong, new value, WS_CHILD
;nIndex, offset value to set, GWL_STYLE
;hwnd, handle of window
;- API Function ;lNewLong, new value, WS_CHILD
;nIndex, offset value to set, GWL_STYLE
;hwnd, handle of window
;- API Function -

My_AutoSave:
cmp
AutoSave,1h
;autosave enabeled ?
jne
My_AutoSave_Return
;if not skip
;-----------------------------------------------------------------------------; API "CreateFileA" creates or opens a file, returns a handle to access object.
;-----------------------------------------------------------------------------push
0h
;hTemplateFile,
push
80h
;dwFlagsAndAttributes, normal = 80h
push
2h
;dwCreationDistribution, CREATE_ALWAYS=2h
push
0h
;lpSecurityAttributes,
push
0h
;dwShareMode,
push
40000000h
;dwDesiredAccess, GENERIC_WRITE
push
OFFSET AutoSave_FileName
;lpFileName,pointer to filename
call
CreateFileA
;- API Function cmp
eax,-1
;INVALID_HANDLE_VALUE = -1
je
My_AutoSave_Return
mov
FileHandle,eax
;store handle in variable
;-----------------------------------------------------------------------------; API "WriteFile" writes data to a file
;-----------------------------------------------------------------------------push
0h
;lpOverlapped, structure overlapped I/O
push
OFFSET FileReturn
;lpNumberOfBytesWritten,
push
10h
;nNumberOfBytesToWrite, bytes to write
push
OFFSET FileMark_Settings
;lpBuffer, address data write to file
push
FileHandle
;hFile, handle of file to write to
call
WriteFile
;- API Function push
0h
push
OFFSET FileReturn
Page 113

td_win32asm_710.asm
push
4h
push
OFFSET AutoLog
push
FileHandle
call
WriteFile
;- API Function push
0h
push
OFFSET FileReturn
push
4h
push
OFFSET AutoSave
push
FileHandle
call
WriteFile
;- API Function push
0h
push
OFFSET FileReturn
push
4h
push
OFFSET TimeOut
push
FileHandle
call
WriteFile
;- API Function push
0h
push
OFFSET FileReturn
push
4h
push
OFFSET Var_PortListItems
push
FileHandle
call
WriteFile
;- API Function push
0h
push
OFFSET FileReturn
push
0E0h
push
OFFSET File_Dummy
push
FileHandle
call
WriteFile
;- API Function push
0h
push
OFFSET FileReturn
push
400h
push
OFFSET Buf_PortScanList
push
FileHandle
call
WriteFile
;- API Function My_AutoSave_Return:
;-----------------------------------------------------------------------------; API "CloseHandle" closes an open object handle.
;-----------------------------------------------------------------------------push
FileHandle
;hObject, handle of object to close
call
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 = 80h
push
3h
;dwCreationDistribution, OPEN_EXISTING=3h
push
0h
;lpSecurityAttributes,
push
0h
;dwShareMode,
push
80000000h
;dwDesiredAccess, GENERIC_READ
push
OFFSET AutoSave_FileName
;lpFileName,pointer to filename
Page 114

td_win32asm_710.asm
call
CreateFileA
;- API Function cmp
eax,-1
;INVALID_HANDLE_VALUE = -1
je
My_AutoLoad_Return
;
mov
FileHandle,eax
;store handle in variable
;-----------------------------------------------------------------------------; API "ReadFile" reads data from a file ==> Mark
;-----------------------------------------------------------------------------push
0h
;lpOverlapped, structure overlapped I/O
push
OFFSET FileReturn
;lpNumberOfBytesWritten,
push
10h
;nNumberOfBytesToWrite, bytes to read
push
OFFSET Buffer
;lpBuffer, address data read from file
push
FileHandle
;hFile, handle of file to write to
call
ReadFile
;- API Function mov
ecx,0h
;check if it is a correct netspy set file
mov
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/O
push
OFFSET FileReturn
;lpNumberOfBytesWritten,
push
4h
;nNumberOfBytesToWrite, bytes to write
push
OFFSET AutoLog
;lpBuffer, address data write to file
push
FileHandle
;hFile, handle of file to write to
call
ReadFile
;- API Function push
0h
push
OFFSET FileReturn
push
4h
push
OFFSET AutoSave
push
FileHandle
call
ReadFile
push
0h
push
OFFSET FileReturn
push
4h
push
OFFSET TimeOut
push
FileHandle
call
ReadFile
;- API Function push
0h
push
OFFSET FileReturn
push
4h
push
OFFSET Var_PortListItems
push
FileHandle
call
ReadFile
;- API Function Page 115

td_win32asm_710.asm
push
0h
push
OFFSET FileReturn
push
0E0h
push
OFFSET File_Dummy
push
FileHandle
call
ReadFile
;- API Function push
0h
push
OFFSET FileReturn
push
400h
push
OFFSET Buf_PortScanList
push
FileHandle
call
ReadFile
;- API Function My_AutoLoad_Return:
;-----------------------------------------------------------------------------; API "CloseHandle" closes an open object handle.
;-----------------------------------------------------------------------------push
FileHandle
;hObject, handle of object to close
call
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

Potrebbero piacerti anche