Valhalla Legends Forums Archive | Assembly Language (any cpu) | hi I am new need help coding in asm?

AuthorMessageTime
Atlas99
hi I need some help coding Editbox for ip and port
so I can type in server ip and port number and also hostname in editbox for each 1..?
I been looking for a tut to show me how to use edit boxes for ip and port and hostname and I have not come across any thing to guide me in the process of finishing my program.
now the tools I am using is Masm32 QEDITOR to code in.
I am not using Visual basic 6.0 or visual Studio C++ .NET..
even though I have those tools.
So if you have any suggestion can you make sure it is in coding in QEDITOR asm langue please?
so I can get a better idea on what to use for opcodes and registers and so on..
thanks
September 25, 2003, 2:51 AM
iago
I would recommend using c++. :-P
September 25, 2003, 3:50 AM
TheMinistered
I suggest www.win32asm.cjb.net... you should find some good tutorials there. You probably want to start out basic and just code some neat little useless things to get use to asm. Once you feel like you have a good handle on asm, then get a few tutorials on winsock & asm. You should find the winsock & asm tutorials there too.
September 25, 2003, 6:37 AM
Adron
Use DialogBox or CreateWindow to create your windows. If you use CreateWindow, note that you need to write a message loop too.
September 25, 2003, 6:48 PM
St0rm.iD
Well, you could try coding it in C++ and see what assembly it generates.
September 25, 2003, 7:23 PM
Atlas99
[quote author=TheMinistered link=board=7;threadid=2816;start=0#msg22136 date=1064471867]
I suggest www.win32asm.cjb.net... you should find some good tutorials there. You probably want to start out basic and just code some neat little useless things to get use to asm. Once you feel like you have a good handle on asm, then get a few tutorials on winsock & asm. You should find the winsock & asm tutorials there too.
[/quote]

well I already have learned a bit of asm from Icezlion tuts.
I am using winsock but I didnt see any thing there about using editboxes and using the Ipcontrol with it.
so when i use the editboxes for port and ip I can type in the ip address and port number for complete connection.
and I am not sure if I should use hostname in a editbox as well.
but my main goal is to get an idea how to code the editboxes using ip and port ..
I have not came across a tut yet using ip or port.
and in Icezlion tut there is nothing there using ip or port configureation..
so I am not sure what to use for that type of code config, for it..
September 26, 2003, 11:41 AM
Adron
Did you look up the dialog box apis in win32?
September 26, 2003, 3:33 PM
Atlas99
[quote author=Adron link=board=7;threadid=2816;start=0#msg22245 date=1064590413]
Did you look up the dialog box apis in win32?
[/quote]

well let me see if I can define my question more clear..
I now how to call the IDC_EDIT boxes for the dialog.
what my inqueery is to what would I have to use to get the .elseif eax==IDC_EDIT1
<invoke ?? >
Im not sure what to use for invoke call function for say IP addres EDITbox ID statement.
and what to really use for
.elseif eax==IDC_EDIT2
<invoke ??> for port call connection statment..
that portion of the coding in asm I am at a lost for coding..
Im not sure that to use so I want be using the data register's

.data
hostname db " ",0
IPaddress dd " ",0
Port dd " ",0

Im still a bit lost on that portion of coding in asm using dialog application template.
and I asure you I did practice a bit in icezlion tut from tutorial 1 through to 12 tut.
so I now some of it for basics.
So I know how to dialog tamplates and how to create and call my own dialog in asm QEDITOR.
I guess I still need to get used to it more.
but theres not tomuch out there using QEDITOR asm32.
I wish there was more things out there for this tool and coding in asm.
I beleive I got most of it work okay.
I just want to make sure of my self and get a bit help on the invoke calls for the EDITboxes.

maybe my code may help out a bit more to see if any you can help me configure it correctely ?

.486
.model flat, stdcall ;32 bit memory model
option casemap :none ;case sensitive

include /masm32/include/windows.inc
include /masm32/include/user32.inc
include /masm32/include/kernel32.inc
include /masm32/include/ws2_32.inc
include /masm32/include/wsock32.inc

includelib /masm32/lib/kernel32.lib
includelib /masm32/lib/user32.lib
includelib /masm32/lib/ws2_32.lib
includelib /masm32/lib/wsock32.lib

DlgProc         PROTO   :HWND,:UINT,:WPARAM,:LPARAM

.const
IDD_DIALOG1                        equ 101
IDC_BTN1 equ 1002
IDC_Quit equ 1003
IDC_EDIT1 equ 2
IDC_EDIT2 equ 3
IDC_EDIT3 equ 4




WM_SOCKET equ WM_USER + 100
MAXSIZE equ 297
MEMSIZE equ 3,119,892







.data
ClassName db "test",0
AppName db "test",0
Caption db "test",0
Text db "Winsock",0
Buffer db "00000000 01 03 44 40 0B 0F 02 E8 76 04 C3 CA FA 15 C4 FF"
db "00000010 21 48 C3 05 92 5D 26 C3 00 00 9C C2 40 69 BA 44"
db "00000020 6C 04 96 00 00 00 00 00 5E 81 28 BF 00 00 00 00"
db "00000030 F4 B8 40 3F FD 01 64 0F 00 41 00 00 31 08 00 00"
db "00000040 27 02 00 00 32 08 00 00"



Flag db "ACK+PSH"


hostname db " ",0
IPaddress dd " ",0
Port dd " ",0 <---do have to use this if using EDITboxes



.data?
hInstance         dd ?
hWnd            dd ?
hLib dd ?
sock SOCKET ?
wsadata WSADATA <>
sa sockaddr_in <>
saSize dd ?
hMemory dd ?
buffer dd ? ; address of the memory block
available_data dd ?
actual_data_read dd ?
hwndEdit HWND ?


.code

start:

   invoke GetModuleHandle,NULL
   mov      hInstance,eax
   invoke WSAStartup, 200h,addr wsadata
invoke DialogBoxParam,hInstance,IDD_DIALOG1,NULL,addr DlgProc,NULL
invoke GetDlgItem,IDD_DIALOG1,IDC_EDIT1
invoke SetFocus,eax
invoke GetDlgItem,IDD_DIALOG1,IDC_EDIT2
invoke SetFocus,eax
invoke GetDlgItem,IDD_DIALOG1,IDC_EDIT3
invoke SetFocus,eax



   invoke ExitProcess,0



DlgProc proc hWin:HWND,uMsg:UINT,wParam:WPARAM,lParam:LPARAM

   mov      eax,uMsg
   .if eax==WM_INITDIALOG

      push hWin
      
   .elseif eax==WM_COMMAND
    push wParam
    pop eax
      mov      eax,wParam
      and      eax,0FFFFh
      .if eax==IDC_Quit
invoke ExitProcess,0


.elseif eax==IDC_BTN1
      


invoke WSAAsyncSelect,socket,AF_INET,SOCK_STREAM,IPPROTO_TCP ;creates TCP socket
invoke ioctlsocket, socket, FIONREAD, addr available_data
mov sock,eax
      mov sa.sin_family, AF_INET
      invoke htons, Port
      mov sa.sin_port,ax
invoke inet_addr, addr IPaddress
      mov sa.sin_addr,eax
      mov saSize, sizeof sa ;everything above this just fills in the struct info
invoke GlobalAlloc, GHND, available_data
mov hMemory,eax
invoke GlobalLock, eax
mov buffer,eax
invoke recv, socket, buffer, available_data, 279
mov actual_data_read, eax
invoke inet_addr, addr hostname

invoke WSAAsyncSelect,socket,AF_INET,SOCK_DGRAM,IPPROTO_UDP ;creates UDP socket
invoke ioctlsocket, socket, FIONREAD, addr available_data
mov sock,eax
      mov sa.sin_family, AF_INET
      invoke htons, Port
      mov sa.sin_port,ax
invoke inet_addr, addr IPaddress
      mov sa.sin_addr,eax
      mov saSize, sizeof sa ;everything above this just fills in the struct info
invoke GlobalAlloc, GHND, available_data
mov hMemory,eax
invoke GlobalLock, eax
mov buffer,eax
invoke recv, socket, buffer, available_data, 279
mov actual_data_read, eax
invoke inet_addr, addr hostname



      invoke connect,sock,addr sa, addr saSize ;connects to socket
      




    invoke send,sock,offset Buffer, sizeof Buffer, 297 ;send data

    invoke recv,sock,offset Buffer, sizeof Buffer, 297 ;recv data


.elseif eax==IDC_EDIT1
invoke inet_addr, addr IPaddress

Is this correct?? ^
      
      .elseif eax==IDC_EDIT2
invoke htons, Port



      .endif
      

   .elseif eax==WM_CLOSE


    invoke WSACleanup ;cleans up Winsock
invoke GlobalUnlock, buffer
invoke GlobalFree, hMemory
invoke EndDialog,hWin,0
invoke ExitProcess,0

   .else
      mov      eax,FALSE
      ret
   .endif
   mov      eax,TRUE
   ret

DlgProc endp

end start


I aslo have 1 more question too..
I been trying to add a hotkey EDitbox to my program.
I tried using one of Icezlion tut for hotkey and looked over thier source code for it as well and well I just couldnt seem to get the hotkey to work my project..
I tried using two types of method for hotkey and still No luck in getting to work with the program.
I fixed most of the errors it came up with, but the last 1 was invoke not in control block or some thing like that..
does any one have a suggestion or some thing I can use for a hotkey??




September 26, 2003, 7:49 PM

Search