I ask you for a help to finish this version ,please


.386
.model flat, stdcall
option casemap :none

; #########################################################################


include \masm32\include\windows.inc



include \masm32\include\user32.inc
include \masm32\include\kernel32.inc
include \MASM32\INCLUDE\gdi32.inc
includelib \masm32\lib\wsock32.lib
include \masm32\include\wsock32.inc
includelib \masm32\lib\user32.lib
includelib \masm32\lib\kernel32.lib
includelib \MASM32\LIB\gdi32.lib
; #########################################################################



szText MACRO Name, Text:VARARG
LOCAL lbl
jmp lbl
Name db Text,0
lbl:
ENDM



m2m MACRO M1, M2
push M2
pop M1
ENDM



return MACRO arg
mov eax, arg
ret
ENDM

; #########################################################################


WinMain PROTO :DWORD,:DWORD,:DWORD,:DWORD
WndProc PROTO :DWORD,:DWORD,:DWORD,:DWORD
TopXY PROTO :DWORD,:DWORD
EditControl PROTO :DWORD,:DWORD,:DWORD,:DWORD,:DWORD,:DWORD
EditSl PROTO :DWORD,:DWORD,:DWORD,:DWORD,:DWORD,:DWORD,:DWORD
PushButton PROTO :DWORD,:DWORD,:DWORD,:DWORD,:DWORD,:DWORD,:DWORD
; -------------------------------------------------------------------------
midstr PROTO :DWORD,:DWORD,:DWORD,:DWORD

; ?????????????????????????????????????????????????????????????????????????

.const

BUFFER_SIZE equ 512
ABCDES equ 256
WM_SOCKET equ WM_USER+100
riched1 equ <anytext>
edit_font equ <SYSTEM_FIXED_FONT>

; ?????????????????????????????????????????????????????????????????????????

.data
szDisplayName db "IrcTotaly",0
CommandLine dd 0
hWnd dd 0
hInstance dd 0
hRichEd dd ?
HText dd ?
hBouton dd ?
; -------------------------------------------------------------------------
hostname db "your waiter IRC ",0
Port dd 6667
sin sockaddr_in <>
wsadata WSADATA <>
; -------------------------------------------------------------------------
nick db "NICK Brandy ",10
user db "USER IrcTotaly ",30,"nick.com",30," ",30,"Charlie",30," :Masm32 Client irc by Fr_Masm_Nb",10
ping db "PING :",0
pong db "PONG ",0
Etat dd 0
Confirm db 10
; ?????????????????????????????????????????????????????????????????????????

.data?

sock dd ?
Dialogue db 256 dup(?)
Buffer1 db 512 dup(?)
Buffer2 db 512 dup(?)
Buffer3 db 512 dup(?)
Buffer4 db 512 dup(?)

.code



start:
invoke GetModuleHandle, NULL
mov hInstance, eax

invoke GetCommandLine
mov CommandLine, eax

invoke WinMain,hInstance,NULL,CommandLine,SW_SHOWDEFAULT

invoke ExitProcess,eax

; #########################################################################

WinMain proc hInst :DWORD,
hPrevInst :DWORD,
CmdLine :DWORD,
CmdShow :DWORD


LOCAL wc :WNDCLASSEX
LOCAL msg :MSG

LOCAL Wwd :DWORD
LOCAL Wht :DWORD
LOCAL Wtx :DWORD
LOCAL Wty :DWORD

szText szClassName,"Generic_Class"



mov wc.cbSize, sizeof WNDCLASSEX
mov wc.style, CS_HREDRAW or CS_VREDRAW \
or CS_BYTEALIGNWINDOW
mov wc.lpfnWndProc, offset WndProc ; address of WndProc
mov wc.cbClsExtra, NULL
mov wc.cbWndExtra, NULL
m2m wc.hInstance, hInst ; instance handle
mov wc.hbrBackground, COLOR_BTNFACE+1 ; system color
mov wc.lpszMenuName, NULL
mov wc.lpszClassName, offset szClassName ; window class name
invoke LoadIcon,hInst,500 ; icon ID ; resource icon
mov wc.hIcon, eax
invoke LoadCursor,NULL,IDC_ARROW ; system cursor
mov wc.hCursor, eax
mov wc.hIconSm, 0

invoke RegisterClassEx, ADDR wc ; register the window class



mov Wwd, 550
mov Wht, 350

invoke GetSystemMetrics,SM_CXSCREEN ; get screen width in pixels
invoke TopXY,Wwd,eax
mov Wtx, eax

invoke GetSystemMetrics,SM_CYSCREEN ; get screen height in pixels
invoke TopXY,Wht,eax
mov Wty, eax


invoke CreateWindowEx,WS_EX_OVERLAPPEDWINDOW,
ADDR szClassName,
ADDR szDisplayName,
WS_OVERLAPPEDWINDOW,
Wtx,Wty,Wwd,Wht,
NULL,NULL,
hInst,NULL

mov hWnd,eax ; copy return value into handle DWORD



invoke ShowWindow,hWnd,SW_SHOWNORMAL
invoke UpdateWindow,hWnd


StartLoop:
invoke GetMessage,ADDR msg,NULL,0,0 ; get each message
cmp eax, 0 ; exit if GetMessage()
je ExitLoop ; returns zero
invoke TranslateMessage, ADDR msg ; translate it
invoke DispatchMessage, ADDR msg ; send it to message proc
jmp StartLoop
ExitLoop:

return msg.wParam

WinMain endp

; #########################################################################

WndProc proc hWin :DWORD,
uMsg :DWORD,
wParam :DWORD,
lParam :DWORD



.if uMsg == WM_COMMAND




.if wParam == 1000
invoke SendMessage,hWin,WM_SYSCOMMAND,SC_CLOSE,NULL
.elseif wParam == 500

invoke closesocket,sock
invoke WSAStartup, 101h,addr wsadata
invoke socket,PF_INET,SOCK_STREAM,0
mov sock,eax
mov sin.sin_family, AF_INET
invoke htons, Port ; pour r?seau
mov sin.sin_port,ax
invoke gethostbyname, addr hostname
mov eax,
mov eax,
mov eax,
mov sin.sin_addr,eax
invoke WSAAsyncSelect, sock, hWin,WM_SOCKET, FD_ACCEPT+FD_READ+FD_CONNECT+FD_CLOSE
invoke connect,sock,addr sin,sizeof sin

.endif



.elseif uMsg == WM_CREATE


IFDEF riched1
szText ReDLL,"RICHED32.DLL"
ELSE
szText ReDLL,"RICHED20.DLL"
ENDIF


invoke LoadLibrary,ADDR ReDLL

invoke EditControl,hWin,0,0,400,250,800
mov hRichEd, eax

invoke EditSl,0,0,250,400,20,hWin,700
mov HText, eax
szText BoutonTexte,"Connection"
invoke PushButton,ADDR BoutonTexte,hWin,410,10,100,18,500
mov hBouton,eax


.elseif uMsg == WM_CLOSE


szText TheText,"Please Confirm Exit"
invoke MessageBox,hWin,ADDR TheText,ADDR szDisplayName,MB_YESNO
.if eax == IDNO
return 0
.endif


.elseif uMsg==WM_SOCKET

mov eax,lParam

.if ax==FD_READ

invoke RtlZeroMemory, addr Buffer1, BUFFER_SIZE
invoke recv, sock, addr Buffer1, BUFFER_SIZE, 0

; -------------------------------------------------------------

invoke SendMessage,hRichEd,WM_SETTEXT,0,ADDR Buffer1

; -------------------------------------------------------------

; ?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?

invoke RtlZeroMemory, addr Buffer2, BUFFER_SIZE
invoke lstrcpyn,ADDR Buffer2,ADDR Buffer1,SIZEOF ping
invoke lstrcmpi,ADDR Buffer2,ADDR ping
or eax,eax
jnz Bon
;TRAITEMENT DE PING
invoke RtlZeroMemory, addr Buffer3, BUFFER_SIZE


mov Etat,0
xor edx,edx
xor ecx,ecx
Label_2:

mov al,byte ptr

.if al==':'
mov Etat,5
.endif

.if Etat == 5
mov byte ptr,al
inc edx
.endif

inc ecx
cmp al,0
jne Label_2




invoke RtlZeroMemory, addr Buffer4, BUFFER_SIZE
invoke lstrcat, addr Buffer4,addr pong
invoke lstrcat, addr Buffer4,addr Buffer3
invoke lstrcat, addr Buffer4,addr Confirm
invoke send,sock,ADDR Buffer4,SIZEOF Buffer4,0
; ?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?

Bon:






.elseif ax==FD_CONNECT
invoke send,sock,ADDR nick,SIZEOF nick,0
invoke send,sock,ADDR user,SIZEOF user,0
.elseif ax==FD_CLOSE
invoke closesocket,sock

.endif



.elseif uMsg == WM_DESTROY


invoke PostQuitMessage,NULL
return 0
.endif

invoke DefWindowProc,hWin,uMsg,wParam,lParam


ret

WndProc endp

; ########################################################################

TopXY proc wDim:DWORD, sDim:DWORD


shr sDim, 1 ; divide screen dimension by 2
shr wDim, 1 ; divide window dimension by 2
mov eax, wDim ; copy window dimension into eax
sub sDim, eax ; sub half win dimension from half screen dimension

return sDim

TopXY endp

; ########################################################################

EditControl proc hParent:DWORD, x:DWORD, y:DWORD, wd:DWORD, ht:DWORD, ID:DWORD

LOCAL hEdit:DWORD
LOCAL hFont:DWORD


IFDEF riched1
szText EditMl,"RICHEDIT"
ELSE
szText EditMl,"RichEdit20a"
ENDIF



invoke CreateWindowEx,0,ADDR EditMl,0,
WS_VISIBLE or \
WS_CHILDWINDOW or WS_CLIPSIBLINGS or \
ES_MULTILINE or \
ES_NOHIDESEL or ES_AUTOVSCROLL,
x,y,wd,ht,hParent,ID,hInstance,NULL








mov hEdit, eax

;invoke SetWindowLong,hEdit,GWL_WNDPROC,hEditProc
;mov lpfnhEditProc, eax

invoke GetStockObject,edit_font
invoke SendMessage,hEdit,WM_SETFONT,eax,0

invoke SendMessage,hEdit,EM_EXLIMITTEXT,0,100000000
invoke SendMessage,hEdit,EM_SETOPTIONS,ECOOP_XOR,ECO_SELECTIONBAR

mov eax, hEdit
ret

EditControl endp

; ?????????????????????????????????????????????????????????????????????????


EditSl proc szMsg:DWORD,a:DWORD,b:DWORD,
wd:DWORD,ht:DWORD,hParent:DWORD,ID:DWORD


LOCAL hndle:DWORD

szText slEdit,"EDIT"

invoke CreateWindowEx,WS_EX_CLIENTEDGE,ADDR slEdit,szMsg,
WS_VISIBLE or WS_CHILDWINDOW or \
ES_AUTOHSCROLL or ES_NOHIDESEL,
a,b,wd,ht,hParent,ID,hInstance,NULL


ret

EditSl endp

; ?????????????????????????????????????????????????????????????????????????


PushButton proc lpText:DWORD,hParent:DWORD,
a:DWORD,b:DWORD,wd:DWORD,ht:DWORD,ID:DWORD


LOCAL hndle:DWORD

szText btnClass,"BUTTON"

invoke CreateWindowEx,0,
ADDR btnClass,lpText,
WS_CHILD or WS_VISIBLE,
a,b,wd,ht,hParent,ID,
hInstance,NULL



ret

PushButton endp

; ?????????????????????????????????????????????????????????????????????????


midstr proc source:DWORD, substring:DWORD, stPos:DWORD, ln:DWORD
push esi
push edi
cld
mov esi, source
mov edi, substring
add esi, stPos
mov ecx, ln
rep movsb
mov al, 0
stosb
pop edi
pop esi
ret
midstr endp

end start
Posted on 2005-02-08 07:31:50 by Fr_MasM_Nb
What do you need help with? I do not believe anybody is going to finish something for you, you will not learn that way.
Posted on 2005-02-08 21:32:05 by gorshing
I will help you finish your project on a per-bug basis.
Nobody will run with the ball just because you dropped it.
Ask for specific things and you will receive them.
Posted on 2005-02-08 22:07:20 by Homer
Fr_MasM_Nb Code Warrior:
hello,

I want to learn your code, ML passed. but rc file has't been given. I don't know what your code to do.

regards.
Posted on 2005-02-09 07:24:39 by dcskm4200
.elseif uMsg==WM_SOCKET

mov eax,lParam

.if ax==FD_READ



invoke RtlZeroMemory, addr Buffer1, 256
invoke recv, sock, addr Buffer1,256, 0


mov al,byte ptr
cmp al,'P'
jne NoPing
mov al,byte ptr
cmp al,'I'
jne NoPing
mov al,byte ptr
cmp al,'N'
jne NoPing
mov al,byte ptr
cmp al,'G'
jne NoPing
mov al,byte ptr
cmp al,' '
jne NoPing
mov al,byte ptr
cmp al,':'
jne NoPing

mov byte ptr,'O'
mov byte ptr,'N'
mov byte ptr,'G'

Invoke send,sock,addr Buffer1,256,0
invoke Beep,455,20

NoPing:








push -1
push -1
invoke SendMessage,hRichEd,EM_EXSETSEL,0,esp
invoke SendMessage,hRichEd,EM_REPLACESEL,FALSE,addr Buffer1
invoke SendMessage,hRichEd,EM_SCROLLCARET,0,0
invoke UpdateWindow,hRichEd
add esp,2*4





; ?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?








.elseif ax==FD_CONNECT
invoke send,sock,ADDR nick,SIZEOF nick,0
invoke send,sock,ADDR user,SIZEOF user,0
Posted on 2005-02-19 04:52:42 by Fr_MasM_Nb
Fr_MasM_Nb,

What are you trying to do or rather what help you need? If you are just pasting codes here, then this thread will be locked.
Posted on 2005-02-19 05:36:23 by roticv
I seek a help to treat the requetes waiter IRC
Posted on 2005-02-19 06:35:23 by Fr_MasM_Nb
I see I see.

What command do you need help in? I see that you have fixed the PING/PONG msg.
Posted on 2005-02-19 09:47:00 by roticv
I need assistance for the requete:

:nickname!guest@2021957900.fr PRIVMSG #channel :08,03What time is it? -- --------> Buffer2 db 256 dup(?)


how to make to find and treat PRIVMSG?

xor edx,edx
Label:
mov al,byte ptr
cmp al,'P'
jnz Label

The method below does not go....
I am lost, thank you to bring a help to me .
Posted on 2005-02-20 13:05:47 by Fr_MasM_Nb
xor edx, edx
dec ecx

Label:
inc edx
mov al,byte ptr
cmp al,'P'
jnz Label

;)
Posted on 2005-02-20 14:31:23 by JimmyClif