Subversion Repositories Kolibri OS

Rev

Rev 1832 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1832 Rev 1833
Line 6... Line 6...
6
; e-mail:       lv4evil@ya.ru
6
; e-mail:       lv4evil@ya.ru
Line 7... Line 7...
7
 
7
 
8
 
8
 
9
; <--- include all MeOS stuff --->
9
; <--- include all MeOS stuff --->
10
include "lang.inc"
10
include "lang.inc"
11
include "MACROS.INC"
11
include "../../../macros.inc"
12
purge mov
12
purge mov
13
;include "ASCL9/ascl.inc"
13
;include "ASCL9/ascl.inc"
Line 76... Line 76...
76
 
76
 
77
  key:				   ; key event handler
77
  key:				   ; key event handler
78
    mov     eax, 2		   ;   get key code
78
    mov     eax, 2		   ;   get key code
Line 79... Line 79...
79
    int     0x40
79
    int     0x40
80
 
80
 
Line 81... Line 81...
81
    cmp ah, 0Dh                    ; à®¡¥« - ®â¯à ¢¨âì á®®¡é¥­¨¥
81
    cmp ah, 0Dh 		   ; à®¡¥« - ®â¯à ¢¨âì á®®¡é¥­¨¥
Line 90... Line 90...
90
  button:			   ; button event handler
90
  button:			   ; button event handler
91
    mov     eax, 17		   ;   get button identifier
91
    mov     eax, 17		   ;   get button identifier
92
    int     0x40
92
    int     0x40
Line 93... Line 93...
93
 
93
 
94
    cmp     ah, 2
94
    cmp     ah, 2
Line 95... Line 95...
95
    jz      connect
95
    jz	    connect
96
 
96
 
Line 97... Line 97...
97
    cmp     ah, 3
97
    cmp     ah, 3
98
    jz      disconnect
98
    jz	    disconnect
Line 99... Line 99...
99
 
99
 
100
    cmp     ah, 4
100
    cmp     ah, 4
101
    jz      send
101
    jz	    send
102
 
102
 
Line 225... Line 225...
225
    ; ‘¬¥­  㨭 
225
    ; ‘¬¥­  㨭 
226
    ;mov al, [inputbuff+2]
226
    ;mov al, [inputbuff+2]
227
    ;cmp al, 20h
227
    ;cmp al, 20h
228
    ;jz sd_use_kl
228
    ;jz sd_use_kl
229
    mov al, [inputbuff+3]
229
    mov al, [inputbuff+3]
230
    cmp al, 20h            ; à®¡¥«
230
    cmp al, 20h 	   ; à®¡¥«
231
    jz sd_use_kl
231
    jz sd_use_kl
232
    ;
232
    ;
233
    ; ˆé¥¬ ¯¥à¢ë© ¯à®¡¥«, ¨¬ ¤®«¦¥­ § ª®­ç¨âìáï 㨭
233
    ; ˆé¥¬ ¯¥à¢ë© ¯à®¡¥«, ¨¬ ¤®«¦¥­ § ª®­ç¨âìáï 㨭
234
    ;
234
    ;
235
    xor ecx, ecx
235
    xor ecx, ecx
236
  sd_loop:
236
  sd_loop:
237
    mov al, [inputbuff+ecx]
237
    mov al, [inputbuff+ecx]
238
    cmp al, 20h
238
    cmp al, 20h
239
    jz sd_space
239
    jz sd_space
240
    cmp al, 0
240
    cmp al, 0
241
    jz  wait_event
241
    jz	wait_event
242
    inc ecx
242
    inc ecx
243
    jmp sd_loop
243
    jmp sd_loop
Line 244... Line 244...
244
 
244
 
245
  sd_space:
245
  sd_space:
Line 257... Line 257...
257
 
257
 
258
  sd_use_kl:
258
  sd_use_kl:
259
    lea eax, [inputbuff+1]
259
    lea eax, [inputbuff+1]
260
    mov [inputbuff+3], byte 0
260
    mov [inputbuff+3], byte 0
261
    call ascitoint
261
    call ascitoint
262
    lea eax, [eax-1]    ; ’.ª. ¢ Š‹ ®âáç¥â á 0
262
    lea eax, [eax-1]	; ’.ª. ¢ Š‹ ®âáç¥â á 0
Line 263... Line 263...
263
    mov [curruser], al
263
    mov [curruser], al
264
    
264
    
Line 400... Line 400...
400
    ;
400
    ;
401
    ; „ ­­ë¥ ¯à¨­ïâë
401
    ; „ ­­ë¥ ¯à¨­ïâë
402
    ;
402
    ;
403
    rs_data_end:
403
    rs_data_end:
404
    mov [hrf], 0
404
    mov [hrf], 0
405
    write_debug 'Some data recived'
405
    write_debug 'Some data received'
406
    ;
406
    ;
407
    ;
407
    ;
408
    ;
408
    ;
409
    cmp [login], 0
409
    cmp [login], 0
410
    jz rs_login
410
    jz rs_login
Line 430... Line 430...
430
    ;
430
    ;
431
    ;  ‘«¨èª®¬ ¡®«ì让 ¯ ª¥â!
431
    ;  ‘«¨èª®¬ ¡®«ì让 ¯ ª¥â!
432
    ;
432
    ;
433
    rs_big_flap:
433
    rs_big_flap:
Line 434... Line 434...
434
 
434
 
435
    write_debug 'Too BIG FLAP Recived'
435
    write_debug 'Too BIG FLAP Received'
Line 436... Line 436...
436
    mov [hrf], 0
436
    mov [hrf], 0
437
 
437
 
438
    mov ecx, [socket]
438
    mov ecx, [socket]
Line 463... Line 463...
463
  jmp wait_event
463
  jmp wait_event
Line 464... Line 464...
464
 
464
 
465
; ‘®¥¤¨­¥­¨¥ á á¥à¢¥à®¬, ¢®§¢à é ¥â ¢ eax - åí­¤« ᮪¥â 
465
; ‘®¥¤¨­¥­¨¥ á á¥à¢¥à®¬, ¢®§¢à é ¥â ¢ eax - åí­¤« ᮪¥â 
466
; ¯¥à¥¤ ¥¬ ¢ ¥ å IP  ¤à¥á á¥à¢¥à 
466
; ¯¥à¥¤ ¥¬ ¢ ¥ å IP  ¤à¥á á¥à¢¥à 
467
; ¢ ebx - ¯®àâ
467
; ¢ ebx - ¯®àâ
468
  srv_connect:  
468
  srv_connect:	
469
    push ecx 
469
    push ecx 
470
    push edx 
470
    push edx 
471
    push esi 
471
    push esi 
472
    push edi
472
    push edi
Line 473... Line 473...
473
    push ebx
473
    push ebx
474
    
474
    
475
    mov esi, eax             ; IP - ¢ esi
475
    mov esi, eax	     ; IP - ¢ esi
Line 476... Line 476...
476
    ; find free port
476
    ; find free port
477
    mov    ecx, 1000	     ; Ž¯à¥¤¥«ï¥¬ «®ª «ì­ë© ¯®àâ, ­ ç¨­ ¥¬ á 1000
477
    mov    ecx, 1000	     ; Ž¯à¥¤¥«ï¥¬ «®ª «ì­ë© ¯®àâ, ­ ç¨­ ¥¬ á 1000
Line 520... Line 520...
520
 
520
 
521
 
521
 
522
    ;cmp eax,-1
522
    ;cmp eax,-1
523
    ;jnz fin
523
    ;jnz fin
524
    ;delay 100
524
    ;delay 100
525
    write_debug	'CONNECTION FAILED'                   ;®¤ª«î祭¨¥ ­¥ 㤠«®áì
525
    write_debug 'CONNECTION FAILED'		      ;®¤ª«î祭¨¥ ­¥ 㤠«®áì
526
    jmp @f
526
    jmp @f
Line 527... Line 527...
527
    ;connrcted:  
527
    ;connrcted:  
Line 539... Line 539...
539
 
539
 
540
;
540
;
541
; --> ecx socket handle
541
; --> ecx socket handle
542
;
542
;
543
  buff db 1024 dup 0
543
  buff db 1024 dup 0
544
  lbuff db 8 dup 0 	 ; „«ï 1 ¯ ª¥â  ®â á¥à¢¥à 
544
  lbuff db 8 dup 0	 ; „«ï 1 ¯ ª¥â  ®â á¥à¢¥à 
545
  srv_login:
545
  srv_login:
546
    pushf
546
    pushf
547
    push eax
547
    push eax
548
    push ebx
548
    push ebx
Line 565... Line 565...
565
    ;
565
    ;
566
    movzx eax, [rflap.wDs]
566
    movzx eax, [rflap.wDs]
567
    cmp eax, 4
567
    cmp eax, 4
568
    jnz l_len_err
568
    jnz l_len_err
569
    mov eax, dword [mbuff]
569
    mov eax, dword [mbuff]
570
    cmp eax, 01000000h      ; 00 00 00 01
570
    cmp eax, 01000000h	    ; 00 00 00 01
571
    jnz l_data_err
571
    jnz l_data_err
572
    ;
572
    ;
573
    ;”®à¬¨à㥬 ¯ ª¥â ¤«ï ᮥ¤¨­¥­¨ï
573
    ;”®à¬¨à㥬 ¯ ª¥â ¤«ï ᮥ¤¨­¥­¨ï
574
    ;
574
    ;
575
    ;mov [flap.bId], FLAP_ID
575
    ;mov [flap.bId], FLAP_ID
Line 578... Line 578...
578
    mov eax, 26
578
    mov eax, 26
579
    mov ebx, 9
579
    mov ebx, 9
580
    int 40h
580
    int 40h
581
    mov [seq], ax
581
    mov [seq], ax
Line 582... Line 582...
582
 
582
 
583
    mov [flap.wSn], ax      ; Sequence number
583
    mov [flap.wSn], ax	    ; Sequence number
584
    ;mov [buff],0
584
    ;mov [buff],0
585
    ;mov [buff+1],0
585
    ;mov [buff+1],0
586
    ;mov [buff+2],0
586
    ;mov [buff+2],0
587
    mov dword [buff], 0x01000000 ;login Protokol version  00 00 00 01
587
    mov dword [buff], 0x01000000 ;login Protokol version  00 00 00 01
Line 591... Line 591...
591
    mov eax, UIN
591
    mov eax, UIN
592
    call strlen
592
    call strlen
593
    mov [buff+6], ah
593
    mov [buff+6], ah
594
    mov [buff+7], al ; Length of UIN 
594
    mov [buff+7], al ; Length of UIN 
595
    mov edx, eax
595
    mov edx, eax
596
    add edx, 7                 ; ¢ edx ¤«¨­  § ¯®«­¥­­®£® ¡ãä¥à 
596
    add edx, 7		       ; ¢ edx ¤«¨­  § ¯®«­¥­­®£® ¡ãä¥à 
Line 597... Line 597...
597
    
597
    
Line 598... Line 598...
598
    mov ecx, eax              ;„«¨­  áâப¨
598
    mov ecx, eax	      ;„«¨­  áâப¨
599
 
599
 
Line 600... Line 600...
600
    mov eax, UIN
600
    mov eax, UIN
Line 601... Line 601...
601
    lea ebx, [buff+8]         ; + à §¬¥à ¤ ­­ëå ¢ ¡ãä¥à¥ + 1 
601
    lea ebx, [buff+8]	      ; + à §¬¥à ¤ ­­ëå ¢ ¡ãä¥à¥ + 1 
Line 610... Line 610...
610
    call strlen
610
    call strlen
611
    mov word [buff+edx+4], ax  ; Length of pass
611
    mov word [buff+edx+4], ax  ; Length of pass
Line 612... Line 612...
612
 
612
 
613
    add edx, 4
613
    add edx, 4
614
    mov ebx, buff
614
    mov ebx, buff
615
    add ebx, edx               ; ­ §­ ç¥­¨¥
615
    add ebx, edx	       ; ­ §­ ç¥­¨¥
616
    add edx, eax               ; ‘®å࠭塞 ¢ EDX ¤«¨­ã § ¯®«­¥­­®£® ¡ãä­à 
616
    add edx, eax	       ; ‘®å࠭塞 ¢ EDX ¤«¨­ã § ¯®«­¥­­®£® ¡ãä­à 
617
    mov ecx, eax               ; „«¨­  áâப¨
617
    mov ecx, eax	       ; „«¨­  áâப¨
618
    mov eax, PASS              ; ˆáâ®ç­¨ª
618
    mov eax, PASS	       ; ˆáâ®ç­¨ª
619
    inc ebx
619
    inc ebx
Line 620... Line 620...
620
    call strcpy
620
    call strcpy
621
    
621
    
Line 714... Line 714...
714
    mov [flap.wDs], dx ; Data size
714
    mov [flap.wDs], dx ; Data size
715
    mov eax, flap
715
    mov eax, flap
716
    mov ebx, buff
716
    mov ebx, buff
717
    call sendflap
717
    call sendflap
718
    cmp eax, 0
718
    cmp eax, 0
719
    jnz l_fin           ; ¥ãᯥå
719
    jnz l_fin		; ¥ãᯥå
720
    jmp l_end
720
    jmp l_end
Line 721... Line 721...
721
    
721
    
722
 
722
 
Line 733... Line 733...
733
    xor ebx, ebx
733
    xor ebx, ebx
Line 734... Line 734...
734
 
734
 
735
   uin_loop:
735
   uin_loop:
736
    xor eax, eax
736
    xor eax, eax
737
    mov ax, word [mbuff+ebx]
737
    mov ax, word [mbuff+ebx]
738
    cmp ax, 0100h              ;  00 01 TLV.Type UIN
738
    cmp ax, 0100h	       ;  00 01 TLV.Type UIN
739
    jz l_uin_ok                  ;  ’¥¯¥àì á¥à¢¥à ¯¥à¥¤ ¥â ¥é¥ ¤ ­­ë¥ ¯à¨ ᮥ¤¨­¥­¨¨,   ¯®â®¬ ®¯ïâì
739
    jz l_uin_ok 		 ;  ’¥¯¥àì á¥à¢¥à ¯¥à¥¤ ¥â ¥é¥ ¤ ­­ë¥ ¯à¨ ᮥ¤¨­¥­¨¨,   ¯®â®¬ ®¯ïâì
740
    add ebx, 5                         ; â®â ¦¥ TLV 1
740
    add ebx, 5			       ; â®â ¦¥ TLV 1
741
    cmp ebx, 5
741
    cmp ebx, 5
742
    ja l_tlvt_err
742
    ja l_tlvt_err
Line 747... Line 747...
747
 
747
 
748
 
748
 
749
  l_uin_ok:
749
  l_uin_ok:
750
    mov eax, ebx
750
    mov eax, ebx
751
    xor ebx, ebx
751
    xor ebx, ebx
752
    mov bl, [mbuff+eax+3]           ;
752
    mov bl, [mbuff+eax+3]	    ;
753
    mov bh, [mbuff+eax+2]           ;  „«¨­  ¤ ­­ëå
753
    mov bh, [mbuff+eax+2]	    ;  „«¨­  ¤ ­­ëå
754
    ;
754
    ;
Line 755... Line 755...
755
    ;  UIN ®ª  ­¥ ¯à®¢¥àï¥âáï
755
    ;  UIN ®ª  ­¥ ¯à®¢¥àï¥âáï
756
    ;
756
    ;
757
    
757
    
758
 
758
 
759
    lea ebx, [ebx+eax+4]
759
    lea ebx, [ebx+eax+4]
760
    mov ax, word [mbuff+ebx]
760
    mov ax, word [mbuff+ebx]
761
    cmp ax, 0500h             ; 00 05 Bos address
761
    cmp ax, 0500h	      ; 00 05 Bos address
762
    jz l_all_ok
762
    jz l_all_ok
763
    cmp ax, 0400h             ; UIN incorrect
763
    cmp ax, 0400h	      ; UIN incorrect
764
    jz l_uin_err
764
    jz l_uin_err
765
    cmp ax, 0800h
765
    cmp ax, 0800h
766
    jz l_pass_err
766
    jz l_pass_err
Line 767... Line 767...
767
    jmp l_tlvt_err
767
    jmp l_tlvt_err
768
    ;
768
    ;
769
    ; ¥á«¨ ­¥¢¥à­ë© UIN/ ¯ à®«ì, ¯®«ãç ¥¬ TLV.TYPE 4/8 
769
    ; ¥á«¨ ­¥¢¥à­ë© UIN/ ¯ à®«ì, ¯®«ãç ¥¬ TLV.TYPE 4/8 
770
    ;
770
    ;
Line 771... Line 771...
771
 
771
 
772
    l_all_ok:
772
    l_all_ok:
773
    xor ecx, ecx
773
    xor ecx, ecx
774
    mov cl, [mbuff+ebx+3]       ;length
774
    mov cl, [mbuff+ebx+3]	;length
775
    mov ch, [mbuff+ebx+2]       ;
775
    mov ch, [mbuff+ebx+2]	;
776
    
776
    
777
    lea eax, [mbuff+ebx+4]
777
    lea eax, [mbuff+ebx+4]
778
    push ebx
778
    push ebx
779
    mov ebx, bos_address
779
    mov ebx, bos_address
780
    call strcpy
780
    call strcpy
781
    pop ebx
781
    pop ebx
Line 782... Line 782...
782
    add ebx, ecx
782
    add ebx, ecx
783
    lea ebx, [ebx+4]                ;  §¬¥à § £®«®¢ª                 
783
    lea ebx, [ebx+4]		    ;  §¬¥à § £®«®¢ª                 
784
    ;         
784
    ;         
785
    ; cookie
785
    ; cookie
786
    ;
786
    ;
787
    ;write_debug 'Login Cookie'
787
    ;write_debug 'Login Cookie'
788
 
788
 
789
    xor eax, eax
789
    xor eax, eax
790
    mov ax, word [mbuff+ebx]
790
    mov ax, word [mbuff+ebx]
791
    cmp ax, 0600h                  ; TLV.Type cookie
791
    cmp ax, 0600h		   ; TLV.Type cookie
792
    jnz l_tlvt_err
792
    jnz l_tlvt_err
793
    mov cl, [mbuff+ebx+3]           ;
793
    mov cl, [mbuff+ebx+3]	    ;
794
    mov ch, [mbuff+ebx+2]           ; Length
794
    mov ch, [mbuff+ebx+2]	    ; Length
795
    mov [cookie_len], cx
795
    mov [cookie_len], cx
796
    lea eax, [mbuff+ebx+4]
796
    lea eax, [mbuff+ebx+4]
797
    push ebx
797
    push ebx
798
    mov ebx, srv_cookie
798
    mov ebx, srv_cookie
799
    call strcpy
799
    call strcpy
Line 812... Line 812...
812
    ;mov ebx, 8
812
    ;mov ebx, 8
813
    ;int 40h
813
    ;int 40h
Line 814... Line 814...
814
 
814
 
815
 
815
 
816
 
816
 
Line 817... Line 817...
817
                        
817
			
818
    mov eax, bos_address
818
    mov eax, bos_address
819
    call ip_parser
819
    call ip_parser
820
    
820
    
821
    call htonl
821
    call htonl
822
    data_debug 'BOS Address: ', eax
822
    data_debug 'BOS Address: ', eax
823
    data_debug 'BOS Port: ', ebx
823
    data_debug 'BOS Port: ', ebx
824
    mov [bos_ip], eax       
824
    mov [bos_ip], eax	    
825
    mov [bos_port], ebx     
825
    mov [bos_port], ebx     
Line 826... Line 826...
826
    call srv_connect
826
    call srv_connect
827
    mov [login], 1                ; ‘®¥¤¨­¥­¨¥ á ®á­®¢­ë¬ á¥à¢¥à®¬ ãáâ ­®¢«¥­®
827
    mov [login], 1		  ; ‘®¥¤¨­¥­¨¥ á ®á­®¢­ë¬ á¥à¢¥à®¬ ãáâ ­®¢«¥­®
828
    ;mov [socket], eax
828
    ;mov [socket], eax
Line 844... Line 844...
844
    l_data_err:
844
    l_data_err:
845
    write_debug 'LOGIN DATA MISMATCH'
845
    write_debug 'LOGIN DATA MISMATCH'
846
    jmp l_fin
846
    jmp l_fin
Line 847... Line 847...
847
 
847
 
848
    l_len_err:
848
    l_len_err:
849
    write_debug 'RECIVED DATA LENGTH MISMATCH'
849
    write_debug 'RECEIVED DATA LENGTH MISMATCH'
Line 850... Line 850...
850
    jmp l_fin
850
    jmp l_fin
851
 
851
 
852
    l_tlvt_err:
852
    l_tlvt_err:
Line 856... Line 856...
856
    l_ch_err:
856
    l_ch_err:
857
    write_debug 'FLAP CHANNEL MISMATCH'
857
    write_debug 'FLAP CHANNEL MISMATCH'
858
    jmp l_fin
858
    jmp l_fin
Line 859... Line 859...
859
 
859
 
860
    l_flap_err:
860
    l_flap_err:
Line 861... Line 861...
861
    write_debug 'FLAP ID MISMATCH / RECIVE ERROR'
861
    write_debug 'FLAP ID MISMATCH / RECEIVE ERROR'
Line 862... Line 862...
862
 
862
 
863
    l_fin:
863
    l_fin:
Line 870... Line 870...
870
    l_end:
870
    l_end:
871
    pop edx
871
    pop edx
872
    ;pop ecx
872
    ;pop ecx
873
    pop ebx
873
    pop ebx
874
    pop eax
874
    pop eax
875
    popf                          
875
    popf			  
876
  ret                
876
  ret		     
Line 877... Line 877...
877
 
877
 
878
;
878
;
879
; Length of string
879
; Length of string
880
; input eax = offset string
880
; input eax = offset string
Line 888... Line 888...
888
    xor ecx, ecx
888
    xor ecx, ecx
Line 889... Line 889...
889
 
889
 
890
    loop_s:
890
    loop_s:
891
    mov cl, [eax+ebx]
891
    mov cl, [eax+ebx]
892
    cmp ecx,0
892
    cmp ecx,0
893
    jz  nl
893
    jz	nl
894
    inc ebx
894
    inc ebx
Line 895... Line 895...
895
    jmp loop_s
895
    jmp loop_s
896
 
896
 
Line 914... Line 914...
914
    xor ecx, ecx
914
    xor ecx, ecx
915
    xor ebx, ebx
915
    xor ebx, ebx
Line 916... Line 916...
916
 
916
 
917
    loop_r:
917
    loop_r:
918
    mov bl, [eax+ecx] ;‘¨¬¢®« ¨§ ¬ áᨢ  ¯ à®«ï
918
    mov bl, [eax+ecx] ;‘¨¬¢®« ¨§ ¬ áᨢ  ¯ à®«ï
919
    cmp bl, 0         ;Š®­¥æ áâப¨
919
    cmp bl, 0	      ;Š®­¥æ áâப¨
Line 920... Line 920...
920
    jz r_fin
920
    jz r_fin
921
    
921
    
922
    xor bl, [ROASTING_ARRAY+ecx]
922
    xor bl, [ROASTING_ARRAY+ecx]
Line 1003... Line 1003...
1003
    push ebx
1003
    push ebx
1004
    push ecx
1004
    push ecx
Line 1005... Line 1005...
1005
 
1005
 
Line 1006... Line 1006...
1006
    xor edx, edx
1006
    xor edx, edx
1007
 
1007
 
Line 1008... Line 1008...
1008
    mov dl, [eax]          ; ID byte
1008
    mov dl, [eax]	   ; ID byte
1009
    mov [sbuff], dl
1009
    mov [sbuff], dl
Line 1010... Line 1010...
1010
 
1010
 
1011
    mov dl, [eax+1]        ; FLAP channel
1011
    mov dl, [eax+1]	   ; FLAP channel
1012
    mov [sbuff+1], dl
1012
    mov [sbuff+1], dl
1013
 
1013
 
Line 1014... Line 1014...
1014
    mov dl, [eax+2]        ; FLAP datagramm seq number
1014
    mov dl, [eax+2]	   ; FLAP datagramm seq number
1015
    mov [sbuff+3], dl      ; ¬¥­ï¥¬ ¬¥áâ ¬¨ ¡ ©âë ¤«ï ¯¥à¥¤ ç¨ ¯® á¥â¨
1015
    mov [sbuff+3], dl	   ; ¬¥­ï¥¬ ¬¥áâ ¬¨ ¡ ©âë ¤«ï ¯¥à¥¤ ç¨ ¯® á¥â¨
1016
    mov dl, [eax+3]
1016
    mov dl, [eax+3]
1017
    mov [sbuff+2], dl
1017
    mov [sbuff+2], dl
1018
 
1018
 
Line 1019... Line 1019...
1019
    mov dl, [eax+4]        ; FLAP data size
1019
    mov dl, [eax+4]	   ; FLAP data size
1020
    mov [sbuff+5], dl
1020
    mov [sbuff+5], dl
1021
    mov dl, [eax+5]
1021
    mov dl, [eax+5]
1022
    mov [sbuff+4], dl
1022
    mov [sbuff+4], dl
1023
    mov dx, word [eax+4]
1023
    mov dx, word [eax+4]
Line 1024... Line 1024...
1024
 
1024
 
Line 1025... Line 1025...
1025
    xchg ecx, edx           ; ecx - size edx - handle
1025
    xchg ecx, edx	    ; ecx - size edx - handle
1026
    mov eax, ebx            ; data
1026
    mov eax, ebx	    ; data
1027
    mov ebx, sbuff          ; dest
1027
    mov ebx, sbuff	    ; dest
1028
    add ebx, 6              ; + header size
1028
    add ebx, 6		    ; + header size
1029
    call strcpy
1029
    call strcpy
1030
 
1030
 
1031
    xchg ecx, edx           ; ecx - handle, edx - data size
1031
    xchg ecx, edx	    ; ecx - handle, edx - data size
1032
 
1032
 
1033
    s_wait:
1033
    s_wait:
1034
    mov eax, 53             ; à®¢¥à塞 á®áâ®ï­¨¥ ᮪¥â . …᫨ ᮥ¤¨¥­¨¥
1034
    mov eax, 53 	    ; à®¢¥à塞 á®áâ®ï­¨¥ ᮪¥â . …᫨ ᮥ¤¨¥­¨¥
Line 1035... Line 1035...
1035
    mov ebx, 6              ; ãáâ ­®¢«¥­® - ¯®áë« ¥¬ ¡ãä¥à, ¥á«¨ ᮪¥â § ªàëâ, ã室¨¬
1035
    mov ebx, 6		    ; ãáâ ­®¢«¥­® - ¯®áë« ¥¬ ¡ãä¥à, ¥á«¨ ᮪¥â § ªàëâ, ã室¨¬
1036
    int 40h
1036
    int 40h
1037
    cmp eax, TCB_ESTABLISHED ; ãáâ ­®¢«¥­®
1037
    cmp eax, TCB_ESTABLISHED ; ãáâ ­®¢«¥­®
1038
    jz s_est
1038
    jz s_est
Line 1039... Line 1039...
1039
    cmp eax, TCB_CLOSED 
1039
    cmp eax, TCB_CLOSED 
1040
    jz s_fin
1040
    jz s_fin
1041
    cmp eax, 12            ;  “ ¬¥­ï â ª®¥ ¡ë«®, ª®£¤  ᮥ¤¨­¥­¨¥ ãáâ ­ ¢«¨¢ «®áì á ¯ãáâ®â®© :-)
1041
    cmp eax, 12 	   ;  “ ¬¥­ï â ª®¥ ¡ë«®, ª®£¤  ᮥ¤¨­¥­¨¥ ãáâ ­ ¢«¨¢ «®áì á ¯ãáâ®â®© :-)
1042
    jnc s_fin              ;
1042
    jnc s_fin		   ;
1043
 
1043
 
1044
    
1044
    
1045
    mov eax, 5
1045
    mov eax, 5
Line 1046... Line 1046...
1046
    mov ebx, 1
1046
    mov ebx, 1
1047
    int 40h                ; †¤¥¬
1047
    int 40h		   ; †¤¥¬
1048
    jmp s_wait
1048
    jmp s_wait
Line 1271... Line 1271...
1271
  srv_disconnect:
1271
  srv_disconnect:
1272
    pushf
1272
    pushf
1273
    push eax
1273
    push eax
1274
    push ebx
1274
    push ebx
1275
    mov [flap.bId], FLAP_ID
1275
    mov [flap.bId], FLAP_ID
1276
    mov [flap.bCh], 4      ;Disconnect
1276
    mov [flap.bCh], 4	   ;Disconnect
1277
    xor eax, eax
1277
    xor eax, eax
1278
    mov ax, [seq]
1278
    mov ax, [seq]
1279
    mov [flap.wSn], ax
1279
    mov [flap.wSn], ax
1280
    mov [flap.wDs], 0
1280
    mov [flap.wDs], 0
1281
    mov eax, flap
1281
    mov eax, flap
Line 1337... Line 1337...
1337
    mov eax, par_buff
1337
    mov eax, par_buff
1338
    call ascitoint
1338
    call ascitoint
Line 1339... Line 1339...
1339
 
1339
 
Line 1340... Line 1340...
1340
    ;data_debug 'Debug eax: ', eax
1340
    ;data_debug 'Debug eax: ', eax
1341
 
1341
 
1342
    cmp ecx, 0       ; ¥ ¬®¦¥â ­ ç¨­ âìáï á â®çª¨
1342
    cmp ecx, 0	     ; ¥ ¬®¦¥â ­ ç¨­ âìáï á â®çª¨
1343
    jz ip_err
1343
    jz ip_err
1344
    shl esi, 8       ; ‘¤¢¨£ ¥¬ ¯à¥¤ë¤ã騩 ¡ ©â
1344
    shl esi, 8	     ; ‘¤¢¨£ ¥¬ ¯à¥¤ë¤ã騩 ¡ ©â
1345
    add esi, eax
1345
    add esi, eax
1346
    inc ecx
1346
    inc ecx
Line 1347... Line 1347...
1347
    xor edx, edx     ; ‘ç¥â稪 ¡ãä¥à  = 0
1347
    xor edx, edx     ; ‘ç¥â稪 ¡ãä¥à  = 0
1348
    jmp ip_loop
1348
    jmp ip_loop
1349
 
1349
 
Line 1350... Line 1350...
1350
 
1350
 
1351
    ip_colon:         ; : ‚ áâப¥  ¤à¥á 
1351
    ip_colon:	      ; : ‚ áâப¥  ¤à¥á 
1352
    inc edi           ; ë«® :
1352
    inc edi	      ; ë«® :
1353
    jmp ip_dot
1353
    jmp ip_dot
1354
    
1354
    
1355
    ip_end_str:
1355
    ip_end_str:
1356
    cmp edi, 1
1356
    cmp edi, 1
1357
    jz @f
1357
    jz @f
1358
                          ; : ¥ ¡ë«®
1358
			  ; : ¥ ¡ë«®
1359
    mov [par_buff+edx], 0 ; Š®­¥æ áâப¨
1359
    mov [par_buff+edx], 0 ; Š®­¥æ áâப¨
1360
    mov eax, par_buff
1360
    mov eax, par_buff
1361
    call ascitoint
1361
    call ascitoint
Line 1362... Line 1362...
1362
    shl esi, 8       ; ‘¤¢¨£ ¥¬ ¯à¥¤ë¤ã騩 ¡ ©â
1362
    shl esi, 8	     ; ‘¤¢¨£ ¥¬ ¯à¥¤ë¤ã騩 ¡ ©â
1363
    add esi, eax
1363
    add esi, eax
1364
    ;mov eax, esi     ; IP ¢ 16 à¨ç­®© ä®à¬¥
1364
    ;mov eax, esi     ; IP ¢ 16 à¨ç­®© ä®à¬¥
1365
    ;xor ebx, ebx    ; ®¬¥à  ¯®àâ  ­¥â
1365
    ;xor ebx, ebx    ; ®¬¥à  ¯®àâ  ­¥â
1366
    jmp ip_end
1366
    jmp ip_end
1367
 
1367
 
Line 1403... Line 1403...
1403
    ;xor esi, esi
1403
    ;xor esi, esi
1404
    xor edi, edi
1404
    xor edi, edi
Line 1405... Line 1405...
1405
   
1405
   
1406
    ati_loop:
1406
    ati_loop:
1407
    mov bl, [eax+ecx]
1407
    mov bl, [eax+ecx]
1408
    cmp bl, 0         ; Š®­¥æ áâப¨
1408
    cmp bl, 0	      ; Š®­¥æ áâப¨
1409
    jz ati_str_end
1409
    jz ati_str_end
1410
    cmp bl, 39h
1410
    cmp bl, 39h
1411
    ja ati_err        ; ¥ æ¨äà 
1411
    ja ati_err	      ; ¥ æ¨äà 
1412
    cmp bl, 30h
1412
    cmp bl, 30h
Line 1413... Line 1413...
1413
    jb ati_err
1413
    jb ati_err
1414
 
1414
 
Line 1422... Line 1422...
1422
    
1422
    
1423
    ati_loop2:
1423
    ati_loop2:
1424
    cmp edx, ecx
1424
    cmp edx, ecx
1425
    jz ati_all
1425
    jz ati_all
1426
    push eax
1426
    push eax
1427
    sub eax, edx              ; ‚ëç¥áâì áç¥â稪 
1427
    sub eax, edx	      ; ‚ëç¥áâì áç¥â稪 
1428
    movzx ebx, byte [eax]     ; ‚ bl ᨬ¢®«
1428
    movzx ebx, byte [eax]     ; ‚ bl ᨬ¢®«
1429
    ;pop eax
1429
    ;pop eax
Line 1430... Line 1430...
1430
    sub bl, 30h       ; ‚ëç¨á«ï¥¬ 10â¨ç­ãî æ¨äàã
1430
    sub bl, 30h       ; ‚ëç¨á«ï¥¬ 10â¨ç­ãî æ¨äàã
Line 1490... Line 1490...
1490
    push esi
1490
    push esi
1491
    push edi
1491
    push edi
1492
    push ebx
1492
    push ebx
1493
    push edx
1493
    push edx
1494
    ;xor ebx, ebx
1494
    ;xor ebx, ebx
1495
    mov esi, ecx            ; 奭¤« ᮪¥â 
1495
    mov esi, ecx	    ; 奭¤« ᮪¥â 
1496
    mov edi, ebx            ; “ª § â¥«ì ­  ¤ ­­ë¥
1496
    mov edi, ebx	    ; “ª § â¥«ì ­  ¤ ­­ë¥
Line 1497... Line 1497...
1497
 
1497
 
1498
    xor ebx, ebx
1498
    xor ebx, ebx
1499
    mov bl, [eax]           ;
1499
    mov bl, [eax]	    ;
1500
    mov [snac_buff+1], bl   ; Family ID
1500
    mov [snac_buff+1], bl   ; Family ID
1501
    mov bl, [eax+1]         ; Š®­¢¥àâ¨àã¥âáï ¢ BigEndian
1501
    mov bl, [eax+1]	    ; Š®­¢¥àâ¨àã¥âáï ¢ BigEndian
Line 1502... Line 1502...
1502
    mov [snac_buff], bl     ;
1502
    mov [snac_buff], bl     ;
1503
 
1503
 
1504
    mov bl, [eax+2]         ;
1504
    mov bl, [eax+2]	    ;
1505
    mov [snac_buff+3], bl   ; Subtype ID
1505
    mov [snac_buff+3], bl   ; Subtype ID
Line 1506... Line 1506...
1506
    mov bl, [eax+3]         ;
1506
    mov bl, [eax+3]	    ;
1507
    mov [snac_buff+2], bl   ;
1507
    mov [snac_buff+2], bl   ;
1508
    
1508
    
1509
    mov bl, [eax+4]         ;
1509
    mov bl, [eax+4]	    ;
Line 1510... Line 1510...
1510
    mov [snac_buff+5], bl   ;
1510
    mov [snac_buff+5], bl   ;
1511
    mov bl, [eax+5]         ; Flags
1511
    mov bl, [eax+5]	    ; Flags
1512
    mov [snac_buff+4], bl   ;
1512
    mov [snac_buff+4], bl   ;
1513
 
1513
 
1514
    mov bl, [eax+6]         ;
1514
    mov bl, [eax+6]	    ;
1515
    mov [snac_buff+9], bl   ;
1515
    mov [snac_buff+9], bl   ;
1516
    mov bl, [eax+7]         ;
1516
    mov bl, [eax+7]	    ;
1517
    mov [snac_buff+8], bl   ;
1517
    mov [snac_buff+8], bl   ;
Line 1518... Line 1518...
1518
    mov bl, [eax+8]         ; Reqest ID
1518
    mov bl, [eax+8]	    ; Reqest ID
Line 1519... Line 1519...
1519
    mov [snac_buff+7], bl   ;
1519
    mov [snac_buff+7], bl   ;
1520
    mov bl, [eax+9]         ;
1520
    mov bl, [eax+9]	    ;
1521
    mov [snac_buff+6], bl   ;
1521
    mov [snac_buff+6], bl   ;
1522
 
1522
 
Line 1523... Line 1523...
1523
    lea ebx, [snac_buff+10]                              
1523
    lea ebx, [snac_buff+10]				 
1524
  
1524
  
1525
    mov eax, edi            ; “ª § â¥«ì ­  ¤ ­­ë¥
1525
    mov eax, edi	    ; “ª § â¥«ì ­  ¤ ­­ë¥
1526
    ;add ebx, 10             ; + à §¬¥à § £®«®¢ª  SNAC
1526
    ;add ebx, 10             ; + à §¬¥à § £®«®¢ª  SNAC
1527
    mov ecx, edx            ; à §¬¥à ¤ ­­ëå
1527
    mov ecx, edx	    ; à §¬¥à ¤ ­­ëå
1528
    call strcpy
1528
    call strcpy
1529
 
1529
 
1530
 
1530
 
1531
    mov ecx, esi            ; •¥­¤« ᮪¥â 
1531
    mov ecx, esi	    ; •¥­¤« ᮪¥â 
1532
    mov [flap.bId], FLAP_ID
1532
    mov [flap.bId], FLAP_ID
1533
    mov [flap.bCh], 2       ; Š ­ « ¤«ï ¯®á뫪¨ SNAC
1533
    mov [flap.bCh], 2	    ; Š ­ « ¤«ï ¯®á뫪¨ SNAC
1534
    xor ebx, ebx
1534
    xor ebx, ebx
Line 1592... Line 1592...
1592
    ;
1592
    ;
1593
    ; Ž¯à¥¤¥«ï¥¬ ⨯ ¯à¨­ï⮣® FLAP
1593
    ; Ž¯à¥¤¥«ï¥¬ ⨯ ¯à¨­ï⮣® FLAP
1594
    ;
1594
    ;
1595
    xor ebx, ebx
1595
    xor ebx, ebx
1596
    mov bl, [rflap.bCh]
1596
    mov bl, [rflap.bCh]
1597
    cmp bl, 1                ; “áâ ­®¢ª  ᮥ¤¨­¥­¨ï
1597
    cmp bl, 1		     ; “áâ ­®¢ª  ᮥ¤¨­¥­¨ï
1598
    jz  m_login
1598
    jz	m_login
1599
    cmp bl, 2
1599
    cmp bl, 2
1600
    jz m_snac                ; ®«ã祭 SNAC
1600
    jz m_snac		     ; ®«ã祭 SNAC
1601
    cmp bl, 3
1601
    cmp bl, 3
1602
    jz m_flap_err            ; FLAP-level error
1602
    jz m_flap_err	     ; FLAP-level error
1603
    cmp bl, 4
1603
    cmp bl, 4
1604
    jz m_close_conn          ; ‡ ªàë⨥ ᮥ¤¨­¥­¨ï
1604
    jz m_close_conn	     ; ‡ ªàë⨥ ᮥ¤¨­¥­¨ï
1605
    cmp bl, 5
1605
    cmp bl, 5
1606
    jz m_keep_alive          ;
1606
    jz m_keep_alive	     ;
1607
    ;
1607
    ;
1608
    ; Ž¡à ¡®âª  à áᮥ¤¨­¥­¨ï
1608
    ; Ž¡à ¡®âª  à áᮥ¤¨­¥­¨ï
1609
    ;
1609
    ;
1610
  m_close_conn:
1610
  m_close_conn:
1611
    write_debug 'Another Computer Use YOUR UIN!'
1611
    write_debug 'Another Computer is Useing YOUR UIN!'
1612
    call srv_disconnect
1612
    call srv_disconnect
1613
    call closesocket
1613
    call closesocket
1614
    jmp m_fin
1614
    jmp m_fin
1615
    ;
1615
    ;
1616
    ; ®¡à ¡®âª  ᮥ¤¨­¥­¨ï
1616
    ; ®¡à ¡®âª  ᮥ¤¨­¥­¨ï
Line 1620... Line 1620...
1620
    ; ¯à®¢¥à塞 ¢¥àá¨î ¯à®â®ª®« 
1620
    ; ¯à®¢¥à塞 ¢¥àá¨î ¯à®â®ª®« 
1621
    ;
1621
    ;
1622
    xor eax, eax
1622
    xor eax, eax
1623
    mov al, [mbuff+3]
1623
    mov al, [mbuff+3]
1624
    cmp eax, 1
1624
    cmp eax, 1
1625
    jnz m_login_other    ; ¥ ¯®¤å®¤¨â
1625
    jnz m_login_other	 ; ¥ ¯®¤å®¤¨â
Line 1626... Line 1626...
1626
 
1626
 
1627
 
1627
 
1628
    ;
1628
    ;
Line 1638... Line 1638...
1638
    ;
1638
    ;
1639
    mov [flap.bCh], 1
1639
    mov [flap.bCh], 1
1640
    mov [flap.wSn], ax
1640
    mov [flap.wSn], ax
1641
    xor eax, eax
1641
    xor eax, eax
1642
    mov ax, [cookie_len]
1642
    mov ax, [cookie_len]
1643
    add eax, 8            ; TLV len + protocol version len
1643
    add eax, 8		  ; TLV len + protocol version len
1644
    mov [flap.wDs], ax
1644
    mov [flap.wDs], ax
1645
    mov dword [buff], 01000000h  ; 00 00 00 01 ®¬¥à ¯à®â®ª®« 
1645
    mov dword [buff], 01000000h  ; 00 00 00 01 ®¬¥à ¯à®â®ª®« 
1646
    mov word [buff+4], 0600h     ; 00 06   TLV.Type
1646
    mov word [buff+4], 0600h	 ; 00 06   TLV.Type
Line 1647... Line 1647...
1647
 
1647
 
1648
    mov ax, [cookie_len]
1648
    mov ax, [cookie_len]
1649
    mov [buff+6], ah             ;
1649
    mov [buff+6], ah		 ;
Line 1650... Line 1650...
1650
    mov [buff+7], al             ; TLV.Length
1650
    mov [buff+7], al		 ; TLV.Length
Line 1651... Line 1651...
1651
 
1651
 
1652
    mov edx, ecx                 ; edx <-- socket handle
1652
    mov edx, ecx		 ; edx <-- socket handle
1653
 
1653
 
1654
    mov ecx, eax                 ; ecx <-- cookie len
1654
    mov ecx, eax		 ; ecx <-- cookie len
Line 1655... Line 1655...
1655
    mov eax, srv_cookie          ; Src
1655
    mov eax, srv_cookie 	 ; Src
1656
    lea ebx, [buff+8]
1656
    lea ebx, [buff+8]
1657
    call strcpy
1657
    call strcpy
1658
    
1658
    
1659
    mov ecx, edx                 ; ecx <-- socket handle
1659
    mov ecx, edx		 ; ecx <-- socket handle
Line 1690... Line 1690...
1690
    xor edx, edx
1690
    xor edx, edx
1691
    mov bx, [rsnac.wFid]
1691
    mov bx, [rsnac.wFid]
1692
    mov dx, [rsnac.wSid]
1692
    mov dx, [rsnac.wSid]
Line 1693... Line 1693...
1693
 
1693
 
1694
    cmp bx, 1
1694
    cmp bx, 1
1695
    jz m_snac_1              ;Generic service controls
1695
    jz m_snac_1 	     ;Generic service controls
1696
    cmp bx, 2
1696
    cmp bx, 2
1697
    jz m_snac_2              ;Location services
1697
    jz m_snac_2 	     ;Location services
1698
    cmp bx, 3
1698
    cmp bx, 3
1699
    jz m_snac_3              ;Buddy List management service
1699
    jz m_snac_3 	     ;Buddy List management service
1700
    cmp bx, 4
1700
    cmp bx, 4
1701
    jz m_snac_4              ;ICBM (messages) service
1701
    jz m_snac_4 	     ;ICBM (messages) service
1702
    cmp bx, 9
1702
    cmp bx, 9
1703
    jz m_snac_9              ;Privacy management service
1703
    jz m_snac_9 	     ;Privacy management service
1704
    cmp bx, 015h
1704
    cmp bx, 015h
1705
    jz m_snac_15             ;ICQ specific extensions service
1705
    jz m_snac_15	     ;ICQ specific extensions service
1706
    cmp bx, 013h
1706
    cmp bx, 013h
Line 1707... Line 1707...
1707
    jz m_snac_13             ;Server Side Information (SSI) service
1707
    jz m_snac_13	     ;Server Side Information (SSI) service
1708
    
1708
    
1709
    jmp m_other_snac
1709
    jmp m_other_snac
1710
    ;
1710
    ;
Line 1725... Line 1725...
1725
    jz m_snac_1_1
1725
    jz m_snac_1_1
1726
    jmp m_snac_1_other
1726
    jmp m_snac_1_other
1727
    ;
1727
    ;
1728
    ; Rate limits information response
1728
    ; Rate limits information response
1729
    ;
1729
    ;
1730
  m_snac_1_7:              ; Žâ¢¥ç ¥¬
1730
  m_snac_1_7:		   ; Žâ¢¥ç ¥¬
1731
    mov [ssnac.wFid], 1    ; Family
1731
    mov [ssnac.wFid], 1    ; Family
1732
    mov [ssnac.wSid], 8    ; Subtype
1732
    mov [ssnac.wSid], 8    ; Subtype
1733
    mov [ssnac.dRi], 8
1733
    mov [ssnac.dRi], 8
1734
    mov word [buff], 0100h   ; 0001
1734
    mov word [buff], 0100h   ; 0001
1735
    mov word [buff+2], 0200h ; 0002
1735
    mov word [buff+2], 0200h ; 0002
1736
    mov word [buff+4], 0300h ; 0003
1736
    mov word [buff+4], 0300h ; 0003
1737
    mov word [buff+6], 0400h ; 0004
1737
    mov word [buff+6], 0400h ; 0004
1738
    mov word [buff+8], 0500h ; 0005
1738
    mov word [buff+8], 0500h ; 0005
1739
    mov eax, ssnac
1739
    mov eax, ssnac
1740
    mov ebx, buff
1740
    mov ebx, buff
1741
    mov edx, 10              ;  §¬¥à ¤ ­­ëå
1741
    mov edx, 10 	     ;  §¬¥à ¤ ­­ëå
1742
    call sendsnac
1742
    call sendsnac
1743
    ;
1743
    ;
1744
    ; Client ask server location service limitations
1744
    ; Client ask server location service limitations
1745
    ;
1745
    ;
1746
    mov [ssnac.wFid], 2    ; Family
1746
    mov [ssnac.wFid], 2    ; Family
Line 1760... Line 1760...
1760
    ;
1760
    ;
1761
    ;  Server sends supported services list
1761
    ;  Server sends supported services list
1762
    ;
1762
    ;
Line 1763... Line 1763...
1763
 
1763
 
1764
    ;
1764
    ;
1765
    ;   SNAC(01,17)	  
1765
    ;   SNAC(01,17)       
1766
    ;   Client ask for services version numbers
1766
    ;   Client ask for services version numbers
1767
    ;
1767
    ;
1768
    mov [ssnac.wFid], 1    ; Family
1768
    mov [ssnac.wFid], 1    ; Family
1769
    mov [ssnac.wSid], 17h    ; Subtype
1769
    mov [ssnac.wSid], 17h    ; Subtype
1770
    mov [ssnac.dRi], 17h
1770
    mov [ssnac.dRi], 17h
1771
    ;
1771
    ;
1772
    ;   ‘¯¨á®ª á¥à¢¨á®¢, ª®â®àë¥ ­ ¬ ­ã¦­ë
1772
    ;   ‘¯¨á®ª á¥à¢¨á®¢, ª®â®àë¥ ­ ¬ ­ã¦­ë
1773
    ;
1773
    ;
1774
    ;    xx xx	 	word	 	family number #1
1774
    ;    xx xx          word            family number #1
1775
    ;    xx xx	 	word	 	family version
1775
    ;    xx xx          word            family version
1776
    ;      ...	 	 ...	 	 ...
1776
    ;      ...           ...             ...
Line 1777... Line 1777...
1777
    ;
1777
    ;
1778
 
1778
 
1779
    ;
1779
    ;
Line 1879... Line 1879...
1879
 
1879
 
Line 1880... Line 1880...
1880
    jmp m_fin
1880
    jmp m_fin
1881
 
1881
 
1882
 
1882
 
Line 1883... Line 1883...
1883
  m_snac_1_other:
1883
  m_snac_1_other:
Line 1932... Line 1932...
1932
    pop ecx
1932
    pop ecx
Line 1933... Line 1933...
1933
 
1933
 
1934
 
1934
 
1935
    mov eax, ssnac
1935
    mov eax, ssnac
1936
    mov ebx, buff
1936
    mov ebx, buff
Line 1937... Line 1937...
1937
    mov edx, C_LEN+4            ; „«¨­  ¤ ­­ëå+à §¬¥à § £®«®¢ª  TLV
1937
    mov edx, C_LEN+4		; „«¨­  ¤ ­­ëå+à §¬¥à § £®«®¢ª  TLV
1938
    call sendsnac
1938
    call sendsnac
1939
 
1939
 
Line 1980... Line 1980...
1980
    ;
1980
    ;
1981
    ; Client ask server for ICBM service parameters
1981
    ; Client ask server for ICBM service parameters
1982
    ;
1982
    ;
1983
    mov [ssnac.wFid], 4    ; Family
1983
    mov [ssnac.wFid], 4    ; Family
1984
    mov [ssnac.wSid], 4    ; Subtype
1984
    mov [ssnac.wSid], 4    ; Subtype
1985
    mov [ssnac.dRi], 4     ; request-id
1985
    mov [ssnac.dRi], 4	   ; request-id
1986
    mov eax, ssnac
1986
    mov eax, ssnac
1987
    mov ebx, buff
1987
    mov ebx, buff
1988
    xor edx, edx
1988
    xor edx, edx
1989
    call sendsnac
1989
    call sendsnac
Line 1997... Line 1997...
1997
    ;
1997
    ;
1998
  m_snac_3_b:
1998
  m_snac_3_b:
1999
    ;
1999
    ;
2000
    ; ˆ§ ¢á¥© ¨­ä®à¬ æ¨¨ ¯®ª  ­ã¦¥­ ⮫쪮 áâ âãá
2000
    ; ˆ§ ¢á¥© ¨­ä®à¬ æ¨¨ ¯®ª  ­ã¦¥­ ⮫쪮 áâ âãá
2001
    ;
2001
    ;
2002
    xor edx, edx           ; ‘ç¥â稪
2002
    xor edx, edx	   ; ‘ç¥â稪
2003
    xor ecx, ecx
2003
    xor ecx, ecx
2004
    xor eax, eax
2004
    xor eax, eax
2005
    cld             ; ‚ ­ ¯à ¢«¥­¨¨ 㢥«¨ç¥­¨ï  ¤à¥á®¢
2005
    cld 	    ; ‚ ­ ¯à ¢«¥­¨¨ 㢥«¨ç¥­¨ï  ¤à¥á®¢
Line 2006... Line 2006...
2006
 
2006
 
2007
    dec edx
2007
    dec edx
2008
  m_snac_3_b_loop:
2008
  m_snac_3_b_loop:
2009
    inc edx
2009
    inc edx
2010
    cmp edx, UINS
2010
    cmp edx, UINS
Line 2011... Line 2011...
2011
    jnc m_snac_3_b_end     ;>=
2011
    jnc m_snac_3_b_end	   ;>=
2012
 
2012
 
2013
    mov cl, [mbuff+10]     ; „«¨­  “ˆ
2013
    mov cl, [mbuff+10]	   ; „«¨­  “ˆ
2014
    mov eax, ecx
2014
    mov eax, ecx
2015
    mov edi, UIN_LEN
2015
    mov edi, UIN_LEN
2016
    imul edi ,edx
2016
    imul edi ,edx
Line 2021... Line 2021...
2021
    jnz m_snac_3_b_loop
2021
    jnz m_snac_3_b_loop
2022
    ;
2022
    ;
2023
    ; UIN Ž¯à¥¤¥«¥­
2023
    ; UIN Ž¯à¥¤¥«¥­
2024
    ;
2024
    ;
Line 2025... Line 2025...
2025
 
2025
 
2026
    lea ecx, [eax+10+11]           ; +sizeof SNAC_head + offset #2 TLV
2026
    lea ecx, [eax+10+11]	   ; +sizeof SNAC_head + offset #2 TLV
2027
    mov ax, word [mbuff+ecx]            ;#2 TLV.Type
2027
    mov ax, word [mbuff+ecx]		;#2 TLV.Type
2028
    cmp ax, 0C00h                  ;dc info (optional)
2028
    cmp ax, 0C00h		   ;dc info (optional)
2029
    jz m_snac_3_b_dc
2029
    jz m_snac_3_b_dc
2030
    cmp ax, 0A00h                  ;external ip address
2030
    cmp ax, 0A00h		   ;external ip address
2031
    jz m_snac_3_b_extip
2031
    jz m_snac_3_b_extip
Line 2032... Line 2032...
2032
    jmp m_snac_3_b_bad_tlv
2032
    jmp m_snac_3_b_bad_tlv
Line 2040... Line 2040...
2040
  m_snac_3_b_extip:
2040
  m_snac_3_b_extip:
2041
    ;
2041
    ;
2042
    ; ˆ íâ®â :-)
2042
    ; ˆ íâ®â :-)
2043
    lea ecx, [ecx+8]
2043
    lea ecx, [ecx+8]
2044
    mov ax, word [mbuff+ecx]
2044
    mov ax, word [mbuff+ecx]
2045
    cmp ax, 0600h                 ;TLV.Type(0x0A) - external ip address
2045
    cmp ax, 0600h		  ;TLV.Type(0x0A) - external ip address
2046
    jz m_snac_3_b_status
2046
    jz m_snac_3_b_status
2047
    jmp m_snac_3_b_bad_tlv
2047
    jmp m_snac_3_b_bad_tlv
Line 2048... Line 2048...
2048
 
2048
 
2049
  m_snac_3_b_status:
2049
  m_snac_3_b_status:
Line 2083... Line 2083...
2083
 
2083
 
2084
    dec edx
2084
    dec edx
2085
    m_snac_3_c_loop:
2085
    m_snac_3_c_loop:
2086
    inc edx
2086
    inc edx
2087
    cmp edx, UINS
2087
    cmp edx, UINS
Line 2088... Line 2088...
2088
    jnc m_snac_3_b_end     ;>=
2088
    jnc m_snac_3_b_end	   ;>=
2089
 
2089
 
2090
    mov cl, [mbuff+10]     ; „«¨­  “ˆ
2090
    mov cl, [mbuff+10]	   ; „«¨­  “ˆ
2091
    mov edi, UIN_LEN
2091
    mov edi, UIN_LEN
2092
    imul edi ,edx
2092
    imul edi ,edx
2093
    lea edi, [uins+edi]    
2093
    lea edi, [uins+edi]    
Line 2113... Line 2113...
2113
 
2113
 
2114
 
2114
 
2115
 
2115
 
Line 2116... Line 2116...
2116
 
2116
 
2117
  m_snac_3_other:
2117
  m_snac_3_other:
Line 2140... Line 2140...
2140
    ;
2140
    ;
2141
    ;  Client change default ICBM parameters command
2141
    ;  Client change default ICBM parameters command
2142
    ;
2142
    ;
2143
    mov [ssnac.wFid], 4    ; Family
2143
    mov [ssnac.wFid], 4    ; Family
2144
    mov [ssnac.wSid], 2    ; Subtype
2144
    mov [ssnac.wSid], 2    ; Subtype
2145
    mov [ssnac.dRi], 2     ; request-id
2145
    mov [ssnac.dRi], 2	   ; request-id
Line 2146... Line 2146...
2146
 
2146
 
2147
    mov eax, ICBM_PARAMS
2147
    mov eax, ICBM_PARAMS
2148
    mov ebx, buff
2148
    mov ebx, buff
2149
    push ecx
2149
    push ecx
Line 2159... Line 2159...
2159
    ;
2159
    ;
2160
    ;   Client ask server PRM service limitations
2160
    ;   Client ask server PRM service limitations
2161
    ;
2161
    ;
2162
    mov [ssnac.wFid], 9    ; Family
2162
    mov [ssnac.wFid], 9    ; Family
2163
    mov [ssnac.wSid], 2    ; Subtype
2163
    mov [ssnac.wSid], 2    ; Subtype
2164
    mov [ssnac.dRi], 2     ; request-id
2164
    mov [ssnac.dRi], 2	   ; request-id
2165
    mov eax, ssnac
2165
    mov eax, ssnac
2166
    mov ebx, buff
2166
    mov ebx, buff
2167
    xor edx, edx
2167
    xor edx, edx
2168
    call sendsnac
2168
    call sendsnac
Line 2176... Line 2176...
2176
  m_snac_4_7:
2176
  m_snac_4_7:
2177
    ;
2177
    ;
2178
    ;  Ž¯à¥¤¥«ï¥¬ ⨯ á®®¡é¥­¨ï ¯® ¯®«î message channel
2178
    ;  Ž¯à¥¤¥«ï¥¬ ⨯ á®®¡é¥­¨ï ¯® ¯®«î message channel
2179
    ;
2179
    ;
2180
    xor eax, eax
2180
    xor eax, eax
2181
    mov ax, word [mbuff+10+8]           ; +10 - à §¬¥à SNAC
2181
    mov ax, word [mbuff+10+8]		; +10 - à §¬¥à SNAC
2182
                                        ; +8 ᬥ饭¨¥ ¤® message channel
2182
					; +8 ᬥ饭¨¥ ¤® message channel
2183
    cmp ax, 0100h                       ; 00 01 
2183
    cmp ax, 0100h			; 00 01 
2184
    jz m_snac_ch1
2184
    jz m_snac_ch1
2185
    cmp ax, 0200h
2185
    cmp ax, 0200h
2186
    jz m_snac_ch2
2186
    jz m_snac_ch2
2187
    cmp ax, 0400h
2187
    cmp ax, 0400h
2188
    jz m_snac_ch4
2188
    jz m_snac_ch4
Line 2193... Line 2193...
2193
  m_snac_ch1:
2193
  m_snac_ch1:
2194
    ;
2194
    ;
2195
    ; ’.ª ¢ ®ç¥à¥¤­®© à § ®¯¨á ­¨¥ ¯à®â®ª®«  ­¥ ᮢ¯ ¤ ¥â á ॠ«ì­®áâìî
2195
    ; ’.ª ¢ ®ç¥à¥¤­®© à § ®¯¨á ­¨¥ ¯à®â®ª®«  ­¥ ᮢ¯ ¤ ¥â á ॠ«ì­®áâìî
2196
    ; à §¡¨à ¥¬ ¢á¥ TLV ¯® ¯®à浪ã
2196
    ; à §¡¨à ¥¬ ¢á¥ TLV ¯® ¯®à浪ã
Line 2197... Line 2197...
2197
 
2197
 
2198
    mov eax, dword [mbuff+10]          ; cookie
2198
    mov eax, dword [mbuff+10]	       ; cookie
2199
    mov [msg_cookie1], eax
2199
    mov [msg_cookie1], eax
2200
    mov eax, dword [mbuff+10+4]
2200
    mov eax, dword [mbuff+10+4]
Line 2201... Line 2201...
2201
    mov [msg_cookie2], eax             ; ˆá¯®«ì§ãîâáï ¤«ï ¯®â¢¥à¦¤¥­¨ï ¯à¨¥¬  á®®¡é¥­¨©
2201
    mov [msg_cookie2], eax	       ; ˆá¯®«ì§ãîâáï ¤«ï ¯®â¢¥à¦¤¥­¨ï ¯à¨¥¬  á®®¡é¥­¨©
2202
 
2202
 
Line 2203... Line 2203...
2203
    mov al, [mbuff+10+10]              ; Sender UIN length
2203
    mov al, [mbuff+10+10]	       ; Sender UIN length
2204
    mov [ui.bUinLength], al
2204
    mov [ui.bUinLength], al
Line 2205... Line 2205...
2205
 
2205
 
2206
    push ecx
2206
    push ecx
2207
    movzx ecx, al
2207
    movzx ecx, al
Line 2208... Line 2208...
2208
 
2208
 
Line 2209... Line 2209...
2209
    lea eax, [mbuff+10+11]             ; UIN string 
2209
    lea eax, [mbuff+10+11]	       ; UIN string 
Line 2210... Line 2210...
2210
    lea ebx, [ui.bUin]                 ; Dest
2210
    lea ebx, [ui.bUin]		       ; Dest
2211
    call strcpy
2211
    call strcpy
2212
 
2212
 
2213
    lea ecx, [ecx+10+15]               ; ¯¥à¢ë© TLV
2213
    lea ecx, [ecx+10+15]	       ; ¯¥à¢ë© TLV
2214
    
2214
    
2215
 
2215
 
2216
 m_snac_ch1_loop:
2216
 m_snac_ch1_loop:
2217
 
2217
 
2218
    movzx eax, word [mbuff+ecx]
2218
    movzx eax, word [mbuff+ecx]
2219
    cmp eax, 0100h                     ;TLV.Type(0x01) - user class
2219
    cmp eax, 0100h		       ;TLV.Type(0x01) - user class
2220
    jz m_snac_ch1_1
2220
    jz m_snac_ch1_1
2221
    cmp eax, 0600h                     ;TLV.Type(0x06) - user status
2221
    cmp eax, 0600h		       ;TLV.Type(0x06) - user status
2222
    jz m_snac_ch1_6
2222
    jz m_snac_ch1_6
2223
    cmp eax, 0800h                     ; Unknown type
2223
    cmp eax, 0800h		       ; Unknown type
2224
    jz m_snac_ch1_8
2224
    jz m_snac_ch1_8
2225
    cmp eax, 0500h                     ; Unknown type
2225
    cmp eax, 0500h		       ; Unknown type
2226
    jz m_snac_ch1_5
2226
    jz m_snac_ch1_5
2227
    cmp eax, 0F00h                     ; TLV.Type(0x0f) - user idle time
2227
    cmp eax, 0F00h		       ; TLV.Type(0x0f) - user idle time
Line 2228... Line 2228...
2228
    jz m_snac_ch1_f
2228
    jz m_snac_ch1_f
2229
    cmp eax, 0300h                     ; TLV.Type(0x03) - account creation time
2229
    cmp eax, 0300h		       ; TLV.Type(0x03) - account creation time
2230
    jz m_snac_ch1_3
2230
    jz m_snac_ch1_3
Line 2231... Line 2231...
2231
    cmp eax, 0400h                     ; TLV.Type(0x04) - automated response flag
2231
    cmp eax, 0400h		       ; TLV.Type(0x04) - automated response flag
2232
    jz m_snac_ch1_4
2232
    jz m_snac_ch1_4
2233
    cmp eax, 0200h                     ; TLV.Type(0x02) - message data
2233
    cmp eax, 0200h		       ; TLV.Type(0x02) - message data
2234
    jz m_snac_ch1_mess
2234
    jz m_snac_ch1_mess
2235
    jmp m_snac_msg_tlv_err
2235
    jmp m_snac_msg_tlv_err
Line 2236... Line 2236...
2236
 
2236
 
Line 2237... Line 2237...
2237
    ;
2237
    ;
2238
    ; ‚®§¬®¦­®, ¤®¯®«­¨â¥«ì­ ï ¨¨ä®à¬ æ¨ï ¡ã¤¥â ®¡à ¡ â뢠âìáï
2238
    ; ‚®§¬®¦­®, ¤®¯®«­¨â¥«ì­ ï ¨¨ä®à¬ æ¨ï ¡ã¤¥â ®¡à ¡ â뢠âìáï
2239
    ; ­® ¯®ª  ­¥â 
2239
    ; ­® ¯®ª  ­¥â 
Line 2240... Line 2240...
2240
 
2240
 
2241
  m_snac_ch1_1:
2241
  m_snac_ch1_1:
2242
    movzx eax, word [mbuff+ecx+2]       ; TLV.Length
2242
    movzx eax, word [mbuff+ecx+2]	; TLV.Length
2243
    call ntohs
2243
    call ntohs
2244
    lea ecx, [eax+ecx+4]
2244
    lea ecx, [eax+ecx+4]
Line 2245... Line 2245...
2245
    jmp m_snac_ch1_loop
2245
    jmp m_snac_ch1_loop
Line 2246... Line 2246...
2246
 
2246
 
2247
  m_snac_ch1_6:
2247
  m_snac_ch1_6:
2248
 
2248
 
2249
    mov eax, dword [mbuff+ecx+4]            ; User status
2249
    mov eax, dword [mbuff+ecx+4]	    ; User status
2250
    call ntohl
2250
    call ntohl
Line 2251... Line 2251...
2251
    mov [ui.dUserStatus], eax
2251
    mov [ui.dUserStatus], eax
2252
 
2252
 
2253
 
2253
 
2254
    movzx eax, word [mbuff+ecx+2]       ; TLV.Length
2254
    movzx eax, word [mbuff+ecx+2]	; TLV.Length
2255
    call ntohs
2255
    call ntohs
Line 2256... Line 2256...
2256
    lea ecx, [eax+ecx+4]
2256
    lea ecx, [eax+ecx+4]
2257
    ;
2257
    ;
2258
    ; 
2258
    ; 
2259
   
2259
   
2260
    
2260
    
Line 2261... Line 2261...
2261
    jmp m_snac_ch1_loop
2261
    jmp m_snac_ch1_loop
2262
 
2262
 
2263
  m_snac_ch1_8:
2263
  m_snac_ch1_8:
2264
    movzx eax, word [mbuff+ecx+2]       ; TLV.Length
2264
    movzx eax, word [mbuff+ecx+2]	; TLV.Length
2265
    call ntohs
2265
    call ntohs
Line 2294... Line 2294...
2294
 
2294
 
2295
  m_snac_ch1_mess:
2295
  m_snac_ch1_mess:
2296
    ;
2296
    ;
2297
    ;
2297
    ;
2298
    movzx eax, word [mbuff+ecx+4]    ;
2298
    movzx eax, word [mbuff+ecx+4]    ;
2299
    cmp eax, 0105h                   ; 05 fragment identifier (array of required capabilities)
2299
    cmp eax, 0105h		     ; 05 fragment identifier (array of required capabilities)
Line 2300... Line 2300...
2300
    jnz m_snac_ch1_fr_err            ; 01 fragment version
2300
    jnz m_snac_ch1_fr_err	     ; 01 fragment version
2301
 
2301
 
Line 2302... Line 2302...
2302
    movzx eax, word [mbuff+ecx+6]    ; Length
2302
    movzx eax, word [mbuff+ecx+6]    ; Length
Line 2303... Line 2303...
2303
    call ntohs
2303
    call ntohs
2304
 
2304
 
2305
    lea ecx, [ecx+eax+8]             ; à®¯ã᪠¥¬  byte array of required capabilities (1 - text)
2305
    lea ecx, [ecx+eax+8]	     ; à®¯ã᪠¥¬  byte array of required capabilities (1 - text)
Line 2306... Line 2306...
2306
 
2306
 
2307
    movzx eax, word [mbuff+ecx]      ; 	fragment identifier (message text)
2307
    movzx eax, word [mbuff+ecx]      ;  fragment identifier (message text)
2308
    cmp eax, 0101h                   ;  fragment version
2308
    cmp eax, 0101h		     ;  fragment version
Line 2309... Line 2309...
2309
    jnz m_snac_ch1_fr_err
2309
    jnz m_snac_ch1_fr_err
2310
 
2310
 
Line 2311... Line 2311...
2311
    movzx eax, word [mbuff+ecx+2]    ; TLV Length
2311
    movzx eax, word [mbuff+ecx+2]    ; TLV Length
2312
    call ntohs
2312
    call ntohs
Line 2313... Line 2313...
2313
    xchg eax, ecx
2313
    xchg eax, ecx
Line 2392... Line 2392...
2392
    mov eax, dword [mbuff+10]
2392
    mov eax, dword [mbuff+10]
2393
    mov [msg_cookie1], eax
2393
    mov [msg_cookie1], eax
2394
    mov eax, dword [mbuff+10+4]
2394
    mov eax, dword [mbuff+10+4]
2395
    mov [msg_cookie2], eax
2395
    mov [msg_cookie2], eax
Line 2396... Line 2396...
2396
 
2396
 
2397
    mov al, [mbuff+10+10]              ; Sender UIN length
2397
    mov al, [mbuff+10+10]	       ; Sender UIN length
Line 2398... Line 2398...
2398
    mov [ui.bUinLength], al
2398
    mov [ui.bUinLength], al
2399
 
2399
 
Line 2400... Line 2400...
2400
    push ecx
2400
    push ecx
2401
    movzx ecx, al
2401
    movzx ecx, al
2402
 
2402
 
Line 2403... Line 2403...
2403
    lea eax, [mbuff+10+11]             ; UIN string 
2403
    lea eax, [mbuff+10+11]	       ; UIN string 
2404
    lea ebx, [ui.bUin]                 ; Dest
2404
    lea ebx, [ui.bUin]		       ; Dest
Line 2411... Line 2411...
2411
 
2411
 
2412
    mov eax, [msg_cookie1]
2412
    mov eax, [msg_cookie1]
2413
    mov dword [buff], eax
2413
    mov dword [buff], eax
2414
    mov eax, [msg_cookie2]
2414
    mov eax, [msg_cookie2]
2415
    mov dword [buff+4], eax
2415
    mov dword [buff+4], eax
Line 2416... Line 2416...
2416
    mov word [buff+8], 0200h      ; Channel 2
2416
    mov word [buff+8], 0200h	  ; Channel 2
2417
 
2417
 
2418
    mov al, [ui.bUinLength]
2418
    mov al, [ui.bUinLength]
2419
    mov [buff+10], al
2419
    mov [buff+10], al
2420
    lea eax, [ui.bUin]
2420
    lea eax, [ui.bUin]
2421
    lea ebx, [buff+11]
2421
    lea ebx, [buff+11]
Line 2422... Line 2422...
2422
    call strcpy
2422
    call strcpy
2423
    lea ecx, [ecx+11]
2423
    lea ecx, [ecx+11]
Line 2424... Line 2424...
2424
 
2424
 
2425
    mov word [buff+ecx], 0100h    ; reason code (1 - unsupported channel, 2 - busted payload, 3 - channel specific)
2425
    mov word [buff+ecx], 0100h	  ; reason code (1 - unsupported channel, 2 - busted payload, 3 - channel specific)
2426
    mov edx, ecx
2426
    mov edx, ecx
Line 2445... Line 2445...
2445
 
2445
 
Line 2446... Line 2446...
2446
    jmp m_fin
2446
    jmp m_fin
2447
 
2447
 
2448
 
2448
 
Line 2449... Line 2449...
2449
  m_snac_4_other:
2449
  m_snac_4_other:
Line 2494... Line 2494...
2494
    mov [ssnac.wSid], 0Eh    ; Subtype
2494
    mov [ssnac.wSid], 0Eh    ; Subtype
2495
    mov [ssnac.dRi], 0Eh     ; request-id
2495
    mov [ssnac.dRi], 0Eh     ; request-id
Line 2496... Line 2496...
2496
 
2496
 
2497
    mov eax, ssnac
2497
    mov eax, ssnac
2498
    mov ebx, buff
2498
    mov ebx, buff
2499
    xor edx, edx             ; TLV head len
2499
    xor edx, edx	     ; TLV head len
Line 2500... Line 2500...
2500
    call sendsnac
2500
    call sendsnac
2501
 
2501
 
2502
 
2502
 
2503
    ;
2503
    ;
2504
    ; Client sends its DC info and status to server
2504
    ; Client sends its DC info and status to server
2505
    ;
2505
    ;
Line 2506... Line 2506...
2506
    mov [ssnac.wFid], 1  ; Family
2506
    mov [ssnac.wFid], 1  ; Family
2507
    mov [ssnac.wSid], 1Eh    ; Subtype
2507
    mov [ssnac.wSid], 1Eh    ; Subtype
2508
    mov [ssnac.dRi], 1Eh     ; request-id
2508
    mov [ssnac.dRi], 1Eh     ; request-id
2509
 
2509
 
2510
    mov [buff], 0           ;  TLV type 06
2510
    mov [buff], 0	    ;  TLV type 06
2511
    mov [buff+1], 6h        ;
2511
    mov [buff+1], 6h	    ;
2512
    mov [buff+2], 0         ;  TLV data length
2512
    mov [buff+2], 0	    ;  TLV data length
2513
    mov [buff+3], 4         ;
2513
    mov [buff+3], 4	    ;
2514
    ;
2514
    ;
Line 2520... Line 2520...
2520
    mov [status], ax
2520
    mov [status], ax
2521
    mov word [buff+6], ax
2521
    mov word [buff+6], ax
Line 2522... Line 2522...
2522
 
2522
 
2523
    mov eax, ssnac
2523
    mov eax, ssnac
2524
    mov ebx, buff
2524
    mov ebx, buff
2525
    mov edx, 8           ; TLV head len+ data len
2525
    mov edx, 8		 ; TLV head len+ data len
Line 2526... Line 2526...
2526
    call sendsnac
2526
    call sendsnac
2527
 
2527
 
Line 2560... Line 2560...
2560
 
2560
 
2561
    mov eax, UIN
2561
    mov eax, UIN
2562
    call ascitoint
2562
    call ascitoint
Line 2563... Line 2563...
2563
    mov dword [buff+6], eax
2563
    mov dword [buff+6], eax
2564
 
2564
 
2565
    mov word [buff+12], 0102h   ; request sequence number (incrementing)
2565
    mov word [buff+12], 0102h	; request sequence number (incrementing)
2566
    mov word [buff+14], 0424h   ; META_SET_PERMS_USERINFO
2566
    mov word [buff+14], 0424h	; META_SET_PERMS_USERINFO
2567
    mov [buff+16], 1            ; authorization (1-required, 0-not required)
2567
    mov [buff+16], 1		; authorization (1-required, 0-not required)
2568
    mov [buff+17], byte 0       ; webaware (0-no, 1-yes)
2568
    mov [buff+17], byte 0	; webaware (0-no, 1-yes)
Line 2569... Line 2569...
2569
    mov [buff+18], 1             ; dc_perms (0-any, 1-contact, 2-authorization)
2569
    mov [buff+18], 1		 ; dc_perms (0-any, 1-contact, 2-authorization)
2570
    mov [buff+19], 0            ;unknown
2570
    mov [buff+19], 0		;unknown
2571
 
2571
 
Line 2577... Line 2577...
2577
    ;
2577
    ;
2578
    ; Client READY command
2578
    ; Client READY command
2579
    ;
2579
    ;
2580
    mov [ssnac.wFid], 1  ; Family
2580
    mov [ssnac.wFid], 1  ; Family
2581
    mov [ssnac.wSid], 2    ; Subtype
2581
    mov [ssnac.wSid], 2    ; Subtype
2582
    mov [ssnac.dRi], 2     ; request-id
2582
    mov [ssnac.dRi], 2	   ; request-id
Line 2583... Line 2583...
2583
 
2583
 
2584
    mov eax, FAMILY_ARR
2584
    mov eax, FAMILY_ARR
2585
    mov ebx, buff
2585
    mov ebx, buff
2586
    push ecx
2586
    push ecx
Line 2597... Line 2597...
2597
    ;
2597
    ;
2598
    ; ‡ ¯à è¨¢ ¥¬ offline á®®¡é¥­¨ï
2598
    ; ‡ ¯à è¨¢ ¥¬ offline á®®¡é¥­¨ï
2599
    ;
2599
    ;
2600
    mov [ssnac.wFid], 15h  ; Family
2600
    mov [ssnac.wFid], 15h  ; Family
2601
    mov [ssnac.wSid], 2    ; Subtype
2601
    mov [ssnac.wSid], 2    ; Subtype
2602
    mov [ssnac.dRi], 2     ; request-id
2602
    mov [ssnac.dRi], 2	   ; request-id
Line 2603... Line 2603...
2603
 
2603
 
2604
    mov word [buff], 0100h      ;  TLV type 01
2604
    mov word [buff], 0100h	;  TLV type 01
2605
    mov word [buff+2], 0A00h    ;  00 0a „«¨­ 
2605
    mov word [buff+2], 0A00h	;  00 0a „«¨­ 
2606
    mov word [buff+4], 0008h    ;  08 00
2606
    mov word [buff+4], 0008h	;  08 00
2607
    mov eax, UIN
2607
    mov eax, UIN
2608
    call ascitoint
2608
    call ascitoint
Line 2609... Line 2609...
2609
    mov dword [buff+6], eax
2609
    mov dword [buff+6], eax
Line 2629... Line 2629...
2629
    mov [login], 2
2629
    mov [login], 2
Line 2630... Line 2630...
2630
 
2630
 
Line 2631... Line 2631...
2631
    jmp m_fin
2631
    jmp m_fin
2632
 
2632
 
2633
  m_snac_9_other:
2633
  m_snac_9_other:
Line 2634... Line 2634...
2634
    write_debug 'Unknown SNAC Family 9 Recived'
2634
    write_debug 'Unknown SNAC Family 9 Received'
2635
    jmp m_fin
2635
    jmp m_fin
Line 2653... Line 2653...
2653
    ;
2653
    ;
2654
    ; Ž¡à ¡®âª¨ ¯®ª  ­¥â
2654
    ; Ž¡à ¡®âª¨ ¯®ª  ­¥â
2655
    ;
2655
    ;
Line 2656... Line 2656...
2656
 
2656
 
2657
    ;
2657
    ;
2658
    ;  SNAC(13,05)	  Client check if its local SSI copy is up-to-date
2658
    ;  SNAC(13,05)        Client check if its local SSI copy is up-to-date
2659
    ;
2659
    ;
2660
    mov [ssnac.wFid], 13h  ; Family
2660
    mov [ssnac.wFid], 13h  ; Family
2661
    mov [ssnac.wSid], 5    ; Subtype
2661
    mov [ssnac.wSid], 5    ; Subtype
2662
    mov [ssnac.dRi], 5     ; request-id
2662
    mov [ssnac.dRi], 5	   ; request-id
2663
    mov eax, ssnac
2663
    mov eax, ssnac
2664
    ;  3D E7 48 17
2664
    ;  3D E7 48 17
2665
    mov [buff], 03Dh      ;
2665
    mov [buff], 03Dh	  ;
2666
    mov [buff+1], 0E7h    ;   	modification date/time of client local SSI copy
2666
    mov [buff+1], 0E7h	  ;     modification date/time of client local SSI copy
2667
    mov [buff+2], 48h     ;
2667
    mov [buff+2], 48h	  ;
2668
    mov [buff+3], 17h     ;
2668
    mov [buff+3], 17h	  ;
2669
    ; 00 10
2669
    ; 00 10
2670
    mov [buff+4], 00      ;
2670
    mov [buff+4], 00	  ;
Line 2671... Line 2671...
2671
    mov [buff+5], 10h     ;  	number of items in client local SSI copy
2671
    mov [buff+5], 10h	  ;     number of items in client local SSI copy
2672
    
2672
    
2673
    mov ebx, buff
2673
    mov ebx, buff
Line 2687... Line 2687...
2687
    ;
2687
    ;
2688
    ;  Client activates server SSI data
2688
    ;  Client activates server SSI data
2689
    ;
2689
    ;
2690
    mov [ssnac.wFid], 13h  ; Family
2690
    mov [ssnac.wFid], 13h  ; Family
2691
    mov [ssnac.wSid], 7    ; Subtype
2691
    mov [ssnac.wSid], 7    ; Subtype
2692
    mov [ssnac.dRi], 7     ; request-id
2692
    mov [ssnac.dRi], 7	   ; request-id
2693
    mov eax, ssnac
2693
    mov eax, ssnac
2694
    mov ebx, buff
2694
    mov ebx, buff
2695
    xor edx, edx
2695
    xor edx, edx
2696
    call sendsnac
2696
    call sendsnac
Line 2704... Line 2704...
2704
    ;
2704
    ;
2705
    mov [ssnac.wFid], 1  ; Family
2705
    mov [ssnac.wFid], 1  ; Family
2706
    mov [ssnac.wSid], 1Eh    ; Subtype
2706
    mov [ssnac.wSid], 1Eh    ; Subtype
2707
    mov [ssnac.dRi], 1Eh     ; request-id
2707
    mov [ssnac.dRi], 1Eh     ; request-id
Line 2708... Line 2708...
2708
 
2708
 
2709
    mov [buff], 0           ;  TLV type 06
2709
    mov [buff], 0	    ;  TLV type 06
2710
    mov [buff+1], 6h        ;
2710
    mov [buff+1], 6h	    ;
2711
    mov [buff+2], 0         ;  TLV data length
2711
    mov [buff+2], 0	    ;  TLV data length
2712
    mov [buff+3], 4         ;
2712
    mov [buff+3], 4	    ;
2713
    ;
2713
    ;
2714
    ;
2714
    ;
2715
    mov ax, STATUS_DCDISABLED  ; DC disabled
2715
    mov ax, STATUS_DCDISABLED  ; DC disabled
2716
    call htons
2716
    call htons
Line 2719... Line 2719...
2719
    mov [status], ax
2719
    mov [status], ax
2720
    mov word [buff+6], ax
2720
    mov word [buff+6], ax
Line 2721... Line 2721...
2721
 
2721
 
2722
    mov eax, ssnac
2722
    mov eax, ssnac
2723
    mov ebx, buff
2723
    mov ebx, buff
2724
    mov edx, 8           ; TLV head len+ data len
2724
    mov edx, 8		 ; TLV head len+ data len
Line 2725... Line 2725...
2725
    call sendsnac
2725
    call sendsnac
2726
 
2726
 
2727
    ;
2727
    ;
2728
    ; Client READY command
2728
    ; Client READY command
2729
    ;
2729
    ;
2730
    mov [ssnac.wFid], 1  ; Family
2730
    mov [ssnac.wFid], 1  ; Family
Line 2731... Line 2731...
2731
    mov [ssnac.wSid], 2    ; Subtype
2731
    mov [ssnac.wSid], 2    ; Subtype
2732
    mov [ssnac.dRi], 2     ; request-id
2732
    mov [ssnac.dRi], 2	   ; request-id
2733
 
2733
 
2734
    mov eax, FAMILY_ARR
2734
    mov eax, FAMILY_ARR
Line 2747... Line 2747...
2747
    ;
2747
    ;
2748
    ; ‡ ¯à è¨¢ ¥¬ offline á®®¡é¥­¨ï
2748
    ; ‡ ¯à è¨¢ ¥¬ offline á®®¡é¥­¨ï
2749
    ;
2749
    ;
2750
    mov [ssnac.wFid], 15h  ; Family
2750
    mov [ssnac.wFid], 15h  ; Family
2751
    mov [ssnac.wSid], 2    ; Subtype
2751
    mov [ssnac.wSid], 2    ; Subtype
2752
    mov [ssnac.dRi], 2     ; request-id
2752
    mov [ssnac.dRi], 2	   ; request-id
Line 2753... Line 2753...
2753
 
2753
 
2754
    mov word [buff], 0100h      ;  TLV type 01
2754
    mov word [buff], 0100h	;  TLV type 01
2755
    mov word [buff+2], 0A00h    ;  00 0a „«¨­ 
2755
    mov word [buff+2], 0A00h	;  00 0a „«¨­ 
2756
    mov word [buff+4], 0008h    ;  08 00
2756
    mov word [buff+4], 0008h	;  08 00
2757
    mov eax, UIN
2757
    mov eax, UIN
2758
    call ascitoint
2758
    call ascitoint
Line 2759... Line 2759...
2759
    mov dword [buff+6], eax
2759
    mov dword [buff+6], eax
Line 2770... Line 2770...
2770
 
2770
 
Line 2771... Line 2771...
2771
 
2771
 
2772
    jmp m_fin
2772
    jmp m_fin
2773
 
2773
 
Line 2800... Line 2800...
2800
 
2800
 
Line 2801... Line 2801...
2801
    ;write_debug 'SNAC 15, 3'
2801
    ;write_debug 'SNAC 15, 3'
2802
 
2802
 
2803
    xor eax, eax
2803
    xor eax, eax
2804
    mov ax, word [mbuff+10]  ; + SNAC.head size
2804
    mov ax, word [mbuff+10]  ; + SNAC.head size
Line 2805... Line 2805...
2805
    cmp ax, 0100h            ; 00 01 TLV type
2805
    cmp ax, 0100h	     ; 00 01 TLV type
2806
    jnz m_snac_tlv_err
2806
    jnz m_snac_tlv_err
2807
 
2807
 
2808
    mov ax, word [mbuff+10+10]
2808
    mov ax, word [mbuff+10+10]
2809
    cmp ax, 0041h             ; Offline Message
2809
    cmp ax, 0041h	      ; Offline Message
2810
    jz m_snac_offline_mes
2810
    jz m_snac_offline_mes
2811
    cmp ax, 0042h             ; End messages
2811
    cmp ax, 0042h	      ; End messages
Line 2812... Line 2812...
2812
    jz m_snac_offline_end
2812
    jz m_snac_offline_end
2813
    cmp ax, 07DAh
2813
    cmp ax, 07DAh
Line 2814... Line 2814...
2814
    jz m_snac_meta_data
2814
    jz m_snac_meta_data
2815
 
2815
 
2816
 
2816
 
2817
    write_debug 'Unknown Subtype SNAC (15,3)'
2817
    write_debug 'Unknown Subtype SNAC (15,3)'
2818
    jmp m_fin
2818
    jmp m_fin
2819
 
2819
 
2820
  m_snac_offline_mes:
2820
  m_snac_offline_mes:
2821
    mov eax, MESS                      ;
2821
    mov eax, MESS		       ;
Line 2822... Line 2822...
2822
    call strlen                        ;  ‚뢮¤¨¬ áâபã á á®®¡é¥­¨¥¬ ® ®â¯à ¢¨â¥«¥ ¨ ¢à¥¬¥­¨ ®â¯à ¢ª¨
2822
    call strlen 		       ;  ‚뢮¤¨¬ áâபã á á®®¡é¥­¨¥¬ ® ®â¯à ¢¨â¥«¥ ¨ ¢à¥¬¥­¨ ®â¯à ¢ª¨
2823
    push ecx                           ;
2823
    push ecx			       ;
2824
    mov ecx, eax                   ;
2824
    mov ecx, eax		   ;
Line 2825... Line 2825...
2825
    mov eax, MESS
2825
    mov eax, MESS
2826
    mov ebx, buff
2826
    mov ebx, buff
2827
    call strcpy
2827
    call strcpy
Line 2828... Line 2828...
2828
 
2828
 
2829
    mov eax, dword [mbuff+14+10]          ; Sender UIN
2829
    mov eax, dword [mbuff+14+10]	  ; Sender UIN
2830
    lea ebx, [buff+ecx]                ; ®á«¥ áâà®çª¨ ® á®®¡é¥­¨¨
2830
    lea ebx, [buff+ecx] 	       ; ®á«¥ áâà®çª¨ ® á®®¡é¥­¨¨
Line 2831... Line 2831...
2831
    call int2strd
2831
    call int2strd
2832
 
2832
 
2833
    lea ebx, [ebx+eax]
2833
    lea ebx, [ebx+eax]
Line 2834... Line 2834...
2834
    mov [ebx], byte ' '
2834
    mov [ebx], byte ' '
2835
    inc ebx
2835
    inc ebx
Line 2836... Line 2836...
2836
 
2836
 
2837
                                       ; + „«¨­  UIN
2837
				       ; + „«¨­  UIN
2838
    movzx eax, byte [mbuff+21+10]         ; Day
2838
    movzx eax, byte [mbuff+21+10]	  ; Day
Line 2839... Line 2839...
2839
    call int2strd
2839
    call int2strd
2840
 
2840
 
Line 2841... Line 2841...
2841
    lea ebx, [ebx+eax]
2841
    lea ebx, [ebx+eax]
2842
    mov [ebx], byte '.'
2842
    mov [ebx], byte '.'
2843
    inc ebx
2843
    inc ebx
Line 2844... Line 2844...
2844
 
2844
 
2845
    
2845
    
Line 2846... Line 2846...
2846
    movzx eax, byte [mbuff+20+10]         ;Mounth
2846
    movzx eax, byte [mbuff+20+10]	  ;Mounth
2847
    call int2strd
2847
    call int2strd
2848
 
2848
 
Line 2849... Line 2849...
2849
    lea ebx, [ebx+eax]
2849
    lea ebx, [ebx+eax]
2850
    mov [ebx], byte ' '
2850
    mov [ebx], byte ' '
2851
    inc ebx
2851
    inc ebx
Line 2852... Line 2852...
2852
 
2852
 
Line 2853... Line 2853...
2853
    movzx eax, [mbuff+22+10]              ; Hour
2853
    movzx eax, [mbuff+22+10]		  ; Hour
2854
    call int2strd
2854
    call int2strd
2855
 
2855
 
2856
    lea ebx, [ebx+eax]
2856
    lea ebx, [ebx+eax]
Line 2857... Line 2857...
2857
    mov [ebx], byte ':'
2857
    mov [ebx], byte ':'
Line 2858... Line 2858...
2858
    inc ebx
2858
    inc ebx
2859
 
2859
 
Line 2860... Line 2860...
2860
    movzx eax, [mbuff+23+10]              ; Minute
2860
    movzx eax, [mbuff+23+10]		  ; Minute
Line 2861... Line 2861...
2861
    call int2strd
2861
    call int2strd
Line 2862... Line 2862...
2862
 
2862
 
Line 2896... Line 2896...
2896
    ;
2896
    ;
2897
    mov [ssnac.wFid], 15h  ; Family
2897
    mov [ssnac.wFid], 15h  ; Family
2898
    mov [ssnac.wSid], 2    ; Subtype
2898
    mov [ssnac.wSid], 2    ; Subtype
2899
    mov [ssnac.dRi], 0602h     ; request-id
2899
    mov [ssnac.dRi], 0602h     ; request-id
Line 2900... Line 2900...
2900
 
2900
 
2901
    mov word [buff], 0100h     ;  00 01	TLV.Type(1) - encapsulated META_DATA1
2901
    mov word [buff], 0100h     ;  00 01 TLV.Type(1) - encapsulated META_DATA1
2902
    mov word [buff+2], 0A00h   ;  00 0A	TLV.Length
2902
    mov word [buff+2], 0A00h   ;  00 0A TLV.Length
2903
    mov word [buff+4], 0008h   ;  08 00	data chunk size (TLV.Length-2)
2903
    mov word [buff+4], 0008h   ;  08 00 data chunk size (TLV.Length-2)
2904
    mov eax, UIN
2904
    mov eax, UIN
2905
    call ascitoint
2905
    call ascitoint
2906
    mov dword [buff+6], eax    ; xx xx xx xx (LE) client uin
2906
    mov dword [buff+6], eax    ; xx xx xx xx (LE) client uin
2907
    mov word [buff+10], 003Eh  ; 3E 00	(LE) data type: delete offline msgs request cmd
2907
    mov word [buff+10], 003Eh  ; 3E 00  (LE) data type: delete offline msgs request cmd
Line 2908... Line 2908...
2908
    mov word [buff+12], 0007h  ;  xx xx	(LE) request sequence number
2908
    mov word [buff+12], 0007h  ;  xx xx (LE) request sequence number
2909
 
2909
 
2910
    mov edx, 14                ;  §¬¥à ¤ ­­ëå
2910
    mov edx, 14 	       ;  §¬¥à ¤ ­­ëå
2911
    mov eax, ssnac
2911
    mov eax, ssnac
Line 2922... Line 2922...
2922
  m_snac_meta_data:
2922
  m_snac_meta_data:
2923
    ;
2923
    ;
2924
    ; Ž¯à¥¤¥«ï¥¬ ®ç¥à¥¤­®© ¯®¤â¨¯ :-)
2924
    ; Ž¯à¥¤¥«ï¥¬ ®ç¥à¥¤­®© ¯®¤â¨¯ :-)
2925
    ;
2925
    ;
2926
    mov ax, word [mbuff+10+14]
2926
    mov ax, word [mbuff+10+14]
2927
    cmp ax, 0104h                   ;data subtype: META_SHORT_USERINFO
2927
    cmp ax, 0104h		    ;data subtype: META_SHORT_USERINFO
2928
    jz m_snac_short_userinfo
2928
    jz m_snac_short_userinfo
2929
    cmp ax, 00C8h
2929
    cmp ax, 00C8h
2930
    jz m_snac_basic_userinfo        ;data subtype: META_BASIC_USERINFO
2930
    jz m_snac_basic_userinfo	    ;data subtype: META_BASIC_USERINFO
2931
    write_debug 'Unknown META DATA subtype'
2931
    write_debug 'Unknown META DATA subtype'
2932
    jmp m_fin
2932
    jmp m_fin
Line 2933... Line 2933...
2933
 
2933
 
2934
 
2934
 
2935
 
2935
 
2936
  m_snac_short_userinfo:
2936
  m_snac_short_userinfo:
2937
    ;
2937
    ;
2938
    ; ˆ§ ¢á¥© ¨­ä®à¬ æ¨¨ ¯®ª  ­ã¦¥­ ⮫쪮 ­¨ª
2938
    ; ˆ§ ¢á¥© ¨­ä®à¬ æ¨¨ ¯®ª  ­ã¦¥­ ⮫쪮 ­¨ª
2939
    ;
2939
    ;
Line 2940... Line 2940...
2940
    mov al, [mbuff+10+16]
2940
    mov al, [mbuff+10+16]
2941
     cmp al, 0Ah                    ;success byte
2941
     cmp al, 0Ah		    ;success byte
2942
     jnz m_fin
2942
     jnz m_fin
2943
 
2943
 
2944
     movzx eax, word [mbuff+10+12]  ;request sequence number
2944
     movzx eax, word [mbuff+10+12]  ;request sequence number
2945
     ;
2945
     ;
2946
     ; ‚ § ¯à®á¥ ï ¨á¯®«ì§®¢ « ¯®à浪®¢ë© ­®¬¥à î§¥à  ¢ Š‹
2946
     ; ‚ § ¯à®á¥ ï ¨á¯®«ì§®¢ « ¯®à浪®¢ë© ­®¬¥à î§¥à  ¢ Š‹
2947
     lea ebx, [mbuff+10+19]         ;nickname string
2947
     lea ebx, [mbuff+10+19]	    ;nickname string
2948
     ; „«¨­  áâப¨ ­¥ ­ã¦­ , â.ª. áâப  Null-Terminated
2948
     ; „«¨­  áâப¨ ­¥ ­ã¦­ , â.ª. áâப  Null-Terminated
Line 2961... Line 2961...
2961
  ; ⪠SIQ ­  § ¯à®á ª®à®âª®© ¨­äë ®â¢¥ç ¥â 
2961
  ; ⪠SIQ ­  § ¯à®á ª®à®âª®© ¨­äë ®â¢¥ç ¥â 
2962
  ; ¯ ª¥â®¬ ¡ §®¢®© ¨­ä®à¬ æ¨¨, ॠ«¨§ãî ¯®ª  ⮫쪮 ¥£®
2962
  ; ¯ ª¥â®¬ ¡ §®¢®© ¨­ä®à¬ æ¨¨, ॠ«¨§ãî ¯®ª  ⮫쪮 ¥£®
2963
  ;
2963
  ;
2964
  m_snac_basic_userinfo:
2964
  m_snac_basic_userinfo:
2965
     mov al, [mbuff+10+16]
2965
     mov al, [mbuff+10+16]
2966
     cmp al, 0Ah                    ;success byte
2966
     cmp al, 0Ah		    ;success byte
2967
     jnz m_fin
2967
     jnz m_fin
Line 2968... Line 2968...
2968
 
2968
 
2969
     movzx eax, word [mbuff+10+12]  ;request sequence number
2969
     movzx eax, word [mbuff+10+12]  ;request sequence number
2970
     ;
2970
     ;
2971
     ; ‚ § ¯à®á¥ ï ¨á¯®«ì§®¢ « ¯®à浪®¢ë© ­®¬¥à î§¥à  ¢ Š‹
2971
     ; ‚ § ¯à®á¥ ï ¨á¯®«ì§®¢ « ¯®à浪®¢ë© ­®¬¥à î§¥à  ¢ Š‹
2972
     lea ebx, [mbuff+10+19]         ;nickname string
2972
     lea ebx, [mbuff+10+19]	    ;nickname string
2973
     ; „«¨­  áâப¨ ­¥ ­ã¦­ , â.ª. áâப  Null-Terminated
2973
     ; „«¨­  áâப¨ ­¥ ­ã¦­ , â.ª. áâப  Null-Terminated
2974
     ;Ž¯à¥¤¥«ï¥¬ áâ âãá
2974
     ;Ž¯à¥¤¥«ï¥¬ áâ âãá
2975
     mov ecx, 4
2975
     mov ecx, 4
2976
     imul ecx, eax
2976
     imul ecx, eax
Line 2988... Line 2988...
2988
    jmp m_fin
2988
    jmp m_fin
Line 2989... Line 2989...
2989
    
2989
    
Line 2990... Line 2990...
2990
 
2990
 
Line 2991... Line 2991...
2991
  m_snac_15_other:
2991
  m_snac_15_other:
Line 2992... Line 2992...
2992
 
2992
 
2993
    write_debug 'Unknown SNAC Family 15 Recived'
2993
    write_debug 'Unknown SNAC Family 15 Received'
2994
 
2994
 
Line 2995... Line 2995...
2995
    jmp m_fin
2995
    jmp m_fin
Line 3067... Line 3067...
3067
  snacpar:
3067
  snacpar:
3068
    pushf
3068
    pushf
3069
    push ecx
3069
    push ecx
3070
    ;push edx
3070
    ;push edx
Line 3071... Line 3071...
3071
 
3071
 
3072
    mov cl, [ebx+1]     ; Family (service) id number ¬« ¤è¨© ¡ ©â
3072
    mov cl, [ebx+1]	; Family (service) id number ¬« ¤è¨© ¡ ©â
3073
    mov ch, [ebx]       ; áâ à訩
3073
    mov ch, [ebx]	; áâ à訩
Line 3074... Line 3074...
3074
    mov word [eax], cx
3074
    mov word [eax], cx
3075
 
3075
 
3076
    mov cl, [ebx+3]     ; Family subtype id number
3076
    mov cl, [ebx+3]	; Family subtype id number
Line 3077... Line 3077...
3077
    mov ch, [ebx+2]     ;
3077
    mov ch, [ebx+2]	;
3078
    mov word [eax+2], cx
3078
    mov word [eax+2], cx
3079
 
3079
 
3080
    mov cl, [ebx+5]      ; SNAC flags
3080
    mov cl, [ebx+5]	 ; SNAC flags
3081
    mov ch, [ebx+4]      ;
3081
    mov ch, [ebx+4]	 ;
3082
    mov word [eax+4], cx ;
3082
    mov word [eax+4], cx ;
3083
                           
3083
			   
3084
    mov cl, [ebx+7]         ;
3084
    mov cl, [ebx+7]	    ;
3085
    mov ch, [ebx+6]         ;
3085
    mov ch, [ebx+6]	    ;
3086
    mov word [eax+8], cx    ; SNAC request id
3086
    mov word [eax+8], cx    ; SNAC request id
Line 3087... Line 3087...
3087
    mov cl, [ebx+8]         ;
3087
    mov cl, [ebx+8]	    ;
3088
    mov ch, [ebx+7]         ;
3088
    mov ch, [ebx+7]	    ;
Line 3089... Line 3089...
3089
    mov word [eax+6], cx    ;
3089
    mov word [eax+6], cx    ;
3090
    
3090
    
Line 3149... Line 3149...
3149
    mov eax, ebx
3149
    mov eax, ebx
3150
    lea ebx, [buff+11]
3150
    lea ebx, [buff+11]
3151
    call strcpy
3151
    call strcpy
3152
    lea ecx, [ecx+11]
3152
    lea ecx, [ecx+11]
Line 3153... Line 3153...
3153
 
3153
 
Line 3154... Line 3154...
3154
    mov word [buff+ecx], 0200h    ;  	TLV.Type(0x02) - message data
3154
    mov word [buff+ecx], 0200h	  ;     TLV.Type(0x02) - message data
3155
    
3155
    
Line 3156... Line 3156...
3156
    ;push ecx                      ;
3156
    ;push ecx                      ;
Line 3157... Line 3157...
3157
                                   ; TLV.Length
3157
				   ; TLV.Length
Line 3158... Line 3158...
3158
 
3158
 
Line 3159... Line 3159...
3159
    mov word [buff+ecx+4], 0105h         ; 05 01   01 - fragment version, 05 - fragment identifier
3159
    mov word [buff+ecx+4], 0105h	 ; 05 01   01 - fragment version, 05 - fragment identifier
3160
    
3160
    
Line 3161... Line 3161...
3161
    mov word [buff+ecx+6], 0100h         ; data length 
3161
    mov word [buff+ecx+6], 0100h	 ; data length 
3162
    
3162
    
3163
    mov [buff+ecx+8], 01                 ; byte array of required capabilities (1 - text)
3163
    mov [buff+ecx+8], 01		 ; byte array of required capabilities (1 - text)
3164
 
3164
 
3165
    mov [buff+ecx+9], 01                 ; fragment identifier (text message)
3165
    mov [buff+ecx+9], 01		 ; fragment identifier (text message)
Line 3166... Line 3166...
3166
    mov [buff+ecx+10], 01                 ; fragment version
3166
    mov [buff+ecx+10], 01		  ; fragment version
3167
 
3167
 
Line 3168... Line 3168...
3168
    pop ebx
3168
    pop ebx
3169
    mov eax, ebx
3169
    mov eax, ebx
3170
    call strlen
3170
    call strlen
3171
    mov edx, eax
3171
    mov edx, eax
Line 3172... Line 3172...
3172
    lea eax, [eax+4]                     ; „«¨­  á®®¡é¥­¨ï + Message charset number+ Message language number
3172
    lea eax, [eax+4]			 ; „«¨­  á®®¡é¥­¨ï + Message charset number+ Message language number
3173
    
3173
    
Line 3174... Line 3174...
3174
    call htons
3174
    call htons
3175
    mov word [buff+ecx+11], ax
3175
    mov word [buff+ecx+11], ax
3176
 
3176
 
Line 3177... Line 3177...
3177
    mov eax, edx
3177
    mov eax, edx
Line 3178... Line 3178...
3178
    lea eax, [eax+13]                     ; + ¤«¨­  á«ã¦¥¡­ëå ¤ ­­ëå
3178
    lea eax, [eax+13]			  ; + ¤«¨­  á«ã¦¥¡­ëå ¤ ­­ëå
Line 3179... Line 3179...
3179
    call htons
3179
    call htons
3180
    mov word [buff+ecx+2], ax
3180
    mov word [buff+ecx+2], ax
Line 3181... Line 3181...
3181
 
3181
 
3182
 
3182
 
3183
    mov word [buff+ecx+13], 0700h        ; Message charset number
3183
    mov word [buff+ecx+13], 0700h	 ; Message charset number
Line 3184... Line 3184...
3184
    mov word [buff+ecx+15], 0300h        ; Message language number
3184
    mov word [buff+ecx+15], 0300h	 ; Message language number
3185
 
3185
 
Line 3186... Line 3186...
3186
    mov eax, ecx
3186
    mov eax, ecx
3187
    mov ecx, edx                         ; Len
3187
    mov ecx, edx			 ; Len
3188
    lea edx, [eax+17]
3188
    lea edx, [eax+17]
3189
 
3189
 
3190
    mov eax, ebx                         ;Source
3190
    mov eax, ebx			 ;Source
Line 3226... Line 3226...
3226
 
3226
 
3227
    mov [ssnac.wFid], 15h  ; Family
3227
    mov [ssnac.wFid], 15h  ; Family
3228
    mov [ssnac.wSid], 2    ; Subtype
3228
    mov [ssnac.wSid], 2    ; Subtype
Line 3229... Line 3229...
3229
    mov [ssnac.dRi], 702h     ; request-id
3229
    mov [ssnac.dRi], 702h     ; request-id
3230
 
3230
 
3231
    mov word [buff], 0100h         ;TLV.Type(1) - encapsulated META_DATA
3231
    mov word [buff], 0100h	   ;TLV.Type(1) - encapsulated META_DATA
3232
    mov word [buff+2], 1000h       ; 00 10  TLV.Length
3232
    mov word [buff+2], 1000h	   ; 00 10  TLV.Length
3233
    mov word [buff+4], 000Eh       ; (LE)	 	data chunk size (TLV.Length-2)
3233
    mov word [buff+4], 000Eh	   ; (LE)               data chunk size (TLV.Length-2)
3234
    mov eax, UIN
3234
    mov eax, UIN
3235
    call ascitoint
3235
    call ascitoint
3236
    mov dword [buff+6], eax        ;(LE)	 	request owner uin
3236
    mov dword [buff+6], eax	   ;(LE)                request owner uin
3237
    mov word [buff+10], 07D0h      ;data type: META_DATA_REQ
3237
    mov word [buff+10], 07D0h	   ;data type: META_DATA_REQ
Line 3238... Line 3238...
3238
    ;mov word [buff+12], 0008h      ; request sequence number <<<-- Œ®¦¥â ¬¥­ïâìáï FIXIT
3238
    ;mov word [buff+12], 0008h      ; request sequence number <<<-- Œ®¦¥â ¬¥­ïâìáï FIXIT
3239
    mov word [buff+14], 04BAh      ; data subtype: META_SHORTINFO_REQUEST
3239
    mov word [buff+14], 04BAh	   ; data subtype: META_SHORTINFO_REQUEST
Line 3240... Line 3240...
3240
 
3240
 
3241
    mov ecx, [socket]
3241
    mov ecx, [socket]
Line 3242... Line 3242...
3242
    mov edx, 20
3242
    mov edx, 20
3243
 
3243
 
3244
    xor esi, esi        ; ‘ç¥â稪
3244
    xor esi, esi	; ‘ç¥â稪
3245
    xor eax, eax
3245
    xor eax, eax
3246
 
3246
 
3247
  gi_loop:
3247
  gi_loop:
3248
    mov ebx, esi
3248
    mov ebx, esi
3249
    mov word [buff+12], bx      ; request sequence number
3249
    mov word [buff+12], bx	; request sequence number
Line 3250... Line 3250...
3250
    mov ebx, UIN_LEN
3250
    mov ebx, UIN_LEN
3251
    imul ebx, esi
3251
    imul ebx, esi
3252
    mov al,  [uins+ebx]
3252
    mov al,  [uins+ebx]
Line 3285... Line 3285...
3285
    ;
3285
    ;
3286
    ;  Add buddy(s) to contact list
3286
    ;  Add buddy(s) to contact list
3287
    ;
3287
    ;
3288
    mov [ssnac.wFid], 3   ; Family
3288
    mov [ssnac.wFid], 3   ; Family
3289
    mov [ssnac.wSid], 4   ; Subtype
3289
    mov [ssnac.wSid], 4   ; Subtype
3290
    mov [ssnac.dRi], 4    ; request-id
3290
    mov [ssnac.dRi], 4	  ; request-id
Line 3291... Line 3291...
3291
 
3291
 
3292
    xor esi, esi          ; ‘ç¥â稪
3292
    xor esi, esi	  ; ‘ç¥â稪
Line 3293... Line 3293...
3293
    xor edx, edx          ; ‡ ¯®«­¥­® ¡ ©â
3293
    xor edx, edx	  ; ‡ ¯®«­¥­® ¡ ©â
3294
 
3294
 
3295
  ukk_loop:
3295
  ukk_loop:
3296
    mov ebx, UIN_LEN
3296
    mov ebx, UIN_LEN
Line 3335... Line 3335...
3335
    pushf
3335
    pushf
3336
    pushad
3336
    pushad
3337
    cmp [login], 2
3337
    cmp [login], 2
3338
    jnz @f
3338
    jnz @f
3339
    mov ax, [timer]
3339
    mov ax, [timer]
3340
    cmp ax, 300           ;60 c
3340
    cmp ax, 300 	  ;60 c
3341
    jb @f
3341
    jb @f
3342
    mov [timer], 0
3342
    mov [timer], 0
3343
    mov [flap.bId], FLAP_ID
3343
    mov [flap.bId], FLAP_ID
3344
    mov [flap.bCh], 5         ;Keep alive
3344
    mov [flap.bCh], 5	      ;Keep alive
3345
    mov [flap.wDs], 0
3345
    mov [flap.wDs], 0
3346
    inc [seq]
3346
    inc [seq]
3347
    mov ax, [seq]
3347
    mov ax, [seq]
3348
    mov [flap.wSn], ax
3348
    mov [flap.wSn], ax
3349
    mov eax, flap
3349
    mov eax, flap
Line 3361... Line 3361...
3361
 
3361
 
3362
 
3362
 
3363
; <--- initialised data --->
3363
; <--- initialised data --->
3364
DATA
3364
DATA
3365
  lsz header,\
3365
  lsz header,\
3366
    ru, "KI",\                    
3366
    ru, "KI",\			  
Line 3367... Line 3367...
3367
    en, "KI",\
3367
    en, "KI",\
Line 3381... Line 3381...
3381
rflap FLAP_head
3381
rflap FLAP_head
3382
;
3382
;
3383
ssnac SNAC_head        ; ¤«ï ¯¥à¥¤ ç¨ SNAC
3383
ssnac SNAC_head        ; ¤«ï ¯¥à¥¤ ç¨ SNAC
3384
rsnac SNAC_head        ; ¤«ï ¯à¨­ï⮣® SNAC
3384
rsnac SNAC_head        ; ¤«ï ¯à¨­ï⮣® SNAC
3385
;
3385
;
3386
ui UI_head             ; User info
3386
ui UI_head	       ; User info
3387
;
3387
;
3388
procinfo process_information
3388
procinfo process_information
3389
;
3389
;
3390
UIN db '123456789',0
3390
UIN db '123456789',0
3391
PASS db 'coolpass',0
3391
PASS db 'coolpass',0
3392
ID_STRING db 'ICQ Inc. - Product of ICQ (TM).2000b.4.65.1.3281.85',0
3392
ID_STRING db 'ICQ Inc. - Product of ICQ (TM).2000b.4.65.1.3281.85',0
3393
;ID_STRING db 'ICQ Inc. - Product of ICQ (TM).2001b.5.17.1.3642.85',0
3393
;ID_STRING db 'ICQ Inc. - Product of ICQ (TM).2001b.5.17.1.3642.85',0
3394
CAPABILITIES db 053h, 054h, 0, 0, 097h, 0B1h, 027h, 051h, 024h, 03Ch, 043h, 034h, 0ADh, 022h, 0D6h, 0ABh,\
3394
CAPABILITIES db 053h, 054h, 0, 0, 097h, 0B1h, 027h, 051h, 024h, 03Ch, 043h, 034h, 0ADh, 022h, 0D6h, 0ABh,\
3395
                0F7h, 03Fh, 014h, 092h, 02Eh, 07Ah, 064h, 075h, 0FAh, 0DFh, 04Dh, 0C8h, 088h, 06Fh, 0EAh, 035h,\ 
3395
		0F7h, 03Fh, 014h, 092h, 02Eh, 07Ah, 064h, 075h, 0FAh, 0DFh, 04Dh, 0C8h, 088h, 06Fh, 0EAh, 035h,\ 
3396
                095h, 0FDh, 0B6h, 0DFh, 09h, 046h, 013h, 044h,  04Ch, 07Fh, 011h, 0D1h, 082h, 022h, 044h, 045h,\ 
3396
		095h, 0FDh, 0B6h, 0DFh, 09h, 046h, 013h, 044h,	04Ch, 07Fh, 011h, 0D1h, 082h, 022h, 044h, 045h,\ 
3397
                053h, 054h, 0, 0
3397
		053h, 054h, 0, 0
3398
;
3398
;
3399
; From &RQ
3399
; From &RQ
3400
;
3400
;
Line 3401... Line 3401...
3401
 
3401
 
Line 3408... Line 3408...
3408
 
3408
 
3409
 
3409
 
3410
C_LEN = 40h
3410
C_LEN = 40h
3411
;C_LEN = 80
3411
;C_LEN = 80
Line 3412... Line 3412...
3412
ICBM_PARAMS db 0, 0, 0, 0, 0, 0Bh, 01Fh, 040h, 3, 0E7h, 3, 0E7h, 0, 0, 0, 0
3412
ICBM_PARAMS db 0, 0, 0, 0, 0, 0Bh, 01Fh, 040h, 3, 0E7h, 3, 0E7h, 0, 0, 0, 0
3413
ICBMP_LEN = 16           ;    ^^^ from &RQ
3413
ICBMP_LEN = 16		 ;    ^^^ from &RQ
3414
 
3414
 
3415
 
3415
 
3416
;
3416
;
3417
; from &rq
3417
; from &rq
3418
;
3418
;
3419
FAMILY_ARR db  0x00, 0x01, 0x00, 0x03, 0x01, 0x10, 0x04, 0x7B,  0x00, 0x13, 0x00, 0x02, 0x01, 0x10, 0x04, 0x7B,\    
3419
FAMILY_ARR db  0x00, 0x01, 0x00, 0x03, 0x01, 0x10, 0x04, 0x7B,	0x00, 0x13, 0x00, 0x02, 0x01, 0x10, 0x04, 0x7B,\    
Line 3443... Line 3443...
3443
;
3443
;
3444
CL_LANG db 'en',0
3444
CL_LANG db 'en',0
3445
CL_COUNTRY db 'us',0
3445
CL_COUNTRY db 'us',0
Line 3446... Line 3446...
3446
 
3446
 
Line 3447... Line 3447...
3447
 
3447
 
3448
sbuff db 1024 dup 0     ; ãä¥à ¤«ï ¯¥à¥¤ ç¨ ¨á¯®«ì§ã¥âáï ¢­ãâਠsendflap
3448
sbuff db 1024 dup 0	; ãä¥à ¤«ï ¯¥à¥¤ ç¨ ¨á¯®«ì§ã¥âáï ¢­ãâਠsendflap
3449
 
3449
 
3450
rbuff db 1024 dup 0     ; à¨¥¬­ë© ¡ãä¥à
3450
rbuff db 1024 dup 0	; à¨¥¬­ë© ¡ãä¥à
3451
tbuff db 512 dup 0      ; „«ï TLV
3451
tbuff db 512 dup 0	; „«ï TLV
3452
srv_cookie db 512 dup 0 ; Šãª¨ ¤«ï  ¢â®à¨§ æ¨¨
3452
srv_cookie db 512 dup 0 ; Šãª¨ ¤«ï  ¢â®à¨§ æ¨¨
3453
bos_address db 128 dup 0 ; €¤à¥á BOS á¥à¢¥à 
3453
bos_address db 128 dup 0 ; €¤à¥á BOS á¥à¢¥à 
3454
cookie_len dw 0          ; „«¨­  ªãª¨
3454
cookie_len dw 0 	 ; „«¨­  ªãª¨
3455
seq dw 0                 ; Sequence number
3455
seq dw 0		 ; Sequence number
Line 3456... Line 3456...
3456
bos_ip dd 0
3456
bos_ip dd 0
3457
bos_port dd 0
3457
bos_port dd 0
Line 3458... Line 3458...
3458
status dw 0             ; status
3458
status dw 0		; status
Line 3459... Line 3459...
3459
 
3459
 
3460
mbuff db 2048 dup 0     ; „«ï ¯à¨¥¬ 
3460
mbuff db 2048 dup 0	; „«ï ¯à¨¥¬ 
3461
MBUFF_SIZE              = 2048
3461
MBUFF_SIZE		= 2048
Line 3462... Line 3462...
3462
 
3462
 
3463
hrf db 0                ; ”« £ ¯à¨¥¬  § £®«®¢ª 
3463
hrf db 0		; ”« £ ¯à¨¥¬  § £®«®¢ª 
Line 3464... Line 3464...
3464
 
3464
 
3465
mouse_flag dd 0
3465
mouse_flag dd 0
Line 3466... Line 3466...
3466
socket dd 0
3466
socket dd 0
Line 3467... Line 3467...
3467
login db 0
3467
login db 0