Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Blame | Last modification | View Log | Download | RSS feed

  1. ;
  2. ;    Remote Control Center(Client)
  3. ;
  4. ;    €¢â®à: Hex
  5. ;    ‘ ©â: www.mestack.narod.ru
  6. ;
  7. ;    Ž¯¨á ­¨¥:
  8. ;    à®£à ¬¬ , ¯à¥¤­ §­ ç¥­­ ï ¤«ï ã¯à ¢«¥­¨ï 㤠«ñ­­ë¬ ª®¬¯ìîâ¥à®¬.Š«¨¥­â᪠ï
  9. ;    ç áâì.
  10. ;
  11. ;    Compile with FASM for Menuet
  12. ;    Š®¬¯¨«¨àã¥âáï FASM'®¬ ¤«ï Œ¥­ãí⠎‘
  13. ;
  14.  
  15.  
  16. use32
  17.            org    0x0
  18.  
  19.            db     'MENUET01'      ; 8 byte id
  20.            dd     0x01            ; header version
  21.            dd     START           ; start of code
  22.            dd     I_END           ; size of image
  23.            dd     0x5000          ; memory for app
  24.            dd     0x5000          ; esp
  25.            dd     0x0 , 0x0       ; I_Param , I_Icon
  26.  
  27. include 'lang.inc'
  28. include 'macros.inc'
  29.  
  30. START:                                  ; start of execution
  31.  
  32.     mov  eax,53                ; open socket
  33.     mov  ebx,0
  34.     mov  ecx,0x6000            ; local port
  35.     mov  edx,0x6100            ; remote port
  36.     mov  esi,dword [remote_ip] ; remote IP
  37.     int  0x40
  38.  
  39.     mov  [socket], eax
  40.  
  41.     mov  eax,53                     ; send connect code
  42.     mov  ebx,4
  43.     mov  ecx,[socket]
  44.     mov  edx,1
  45.     mov  esi,connect
  46.     int  0x40
  47.  
  48.     call draw_window            ; at first, draw the window
  49.  
  50. still:
  51.  
  52.     mov  eax,23                 ; wait here for event
  53.     mov  ebx,1
  54.     int  0x40
  55.  
  56.     cmp  eax,1                  ; redraw request ?
  57.     jz   red
  58.     cmp  eax,2                  ; key in buffer ?
  59.     jz   key
  60.     cmp  eax,3                  ; button in buffer ?
  61.     jz   button
  62.  
  63.     jmp  still
  64.  
  65. red:
  66.     call draw_window
  67.     jmp  still
  68.  
  69. key:
  70.     mov  eax,2
  71.     int  0x40
  72.     jmp  still
  73.  
  74. button:
  75.     mov  eax,17
  76.     int  0x40
  77.  
  78.     cmp  ah,1                  ; button id=1 ?
  79.     jnz  noclose
  80.     mov  eax, 53
  81.     mov  ebx, 1
  82.     mov  ecx, [socket]
  83.     int  0x40
  84.     mov  eax,-1
  85.     int  0x40
  86.   noclose:
  87.  
  88.     cmp  ah,2                  ; SEND SHUTDOWN COMMAND?
  89.     je   send_shutdown
  90.  
  91.     cmp  ah,3                  ; SEND REBOOT COMMAND?
  92.     je   send_reboot
  93.  
  94.     cmp  ah,4                  ; SEND SAVEFI COMMAND?
  95.     je   send_savefi
  96.  
  97.     cmp  ah,5                  ; SEND SAVEHI COMMAND?
  98.     je   send_savehi
  99.  
  100.     cmp  ah,6                  ; SEND HOTREBOOT COMMAND?
  101.     je   send_hotreboot
  102.  
  103.     cmp  ah,7                  ; SEND EXIT COMMAND?
  104.     je   send_exit
  105.  
  106.     jmp  still
  107.  
  108.  
  109. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  110. ;;                                              ;;
  111. ;;          SEND COMMANDS TO SERVER             ;;
  112. ;;                                              ;;
  113. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  114. send_shutdown:
  115.  
  116.   mov  eax,53                     ; SEND CODE TO REMOTE
  117.   mov  ebx,4
  118.   mov  ecx,[socket]
  119.   mov  edx,1
  120.   mov  esi,sen_shutdown
  121.   int  0x40
  122.  
  123.   jmp  still
  124.  
  125. send_reboot:
  126.  
  127.   mov  eax,53                     ; SEND CODE TO REMOTE
  128.   mov  ebx,4
  129.   mov  ecx,[socket]
  130.   mov  edx,1
  131.   mov  esi,sen_reboot
  132.   int  0x40
  133.  
  134.   jmp  still
  135.  
  136. send_savefi:
  137.  
  138.   mov  eax,53                     ; SEND CODE TO REMOTE
  139.   mov  ebx,4
  140.   mov  ecx,[socket]
  141.   mov  edx,1
  142.   mov  esi,sen_savefi
  143.   int  0x40
  144.  
  145.   jmp  still
  146.  
  147. send_savehi:
  148.  
  149.   mov  eax,53                     ; SEND CODE TO REMOTE
  150.   mov  ebx,4
  151.   mov  ecx,[socket]
  152.   mov  edx,1
  153.   mov  esi,sen_savehi
  154.   int  0x40
  155.  
  156.   jmp  still
  157.  
  158. send_hotreboot:
  159.  
  160.   mov  eax,53                     ; SEND CODE TO REMOTE
  161.   mov  ebx,4
  162.   mov  ecx,[socket]
  163.   mov  edx,1
  164.   mov  esi,sen_hotreboot
  165.   int  0x40
  166.  
  167.   jmp  still
  168.  
  169. send_exit:
  170.  
  171.   mov  eax,53                     ; SEND CODE TO REMOTE
  172.   mov  ebx,4
  173.   mov  ecx,[socket]
  174.   mov  edx,1
  175.   mov  esi,sen_exit
  176.   int  0x40
  177.  
  178.   jmp  still
  179.  
  180.   get_data:
  181.  
  182.   mov  eax,53
  183.   mov  ebx,3
  184.   mov  ecx,[socket]
  185.   int  0x40
  186.  
  187.   mov  [edi],bl
  188.   inc  edi
  189.  
  190.   mov  eax,53
  191.   mov  ebx,2
  192.   mov  ecx,[socket]
  193.   int  0x40
  194.  
  195.   cmp  eax,0
  196.   jne  get_data
  197.  
  198.   mov  eax,4
  199.   mov  ebx,30*65536+30
  200.   mov  ecx,0x000000
  201.   mov  edx,I_END
  202.   mov  esi,15
  203.   int  0x40
  204.  
  205.   jmp  still
  206. ;   *********************************************
  207. ;   *******  WINDOW DEFINITIONS AND DRAW ********
  208. ;   *********************************************
  209.  
  210.  
  211. draw_window:
  212.  
  213.     mov  eax,12                    ; function 12:tell os about windowdraw
  214.     mov  ebx,1                     ; 1, start of draw
  215.     int  0x40
  216.  
  217.                                    ; DRAW WINDOW
  218.     mov  eax,0                     ; function 0 : define and draw window
  219.     mov  ebx,100*65536+250         ; [x start] *65536 + [x size]
  220.     mov  ecx,60*65536+280          ; [y start] *65536 + [y size]
  221.     mov  edx,0x03ffffff            ; color of work area RRGGBB
  222.     mov  esi,0x80aabbcc            ; color of grab bar  RRGGBB,8->color gl
  223.     mov  edi,0x00aabbcc            ; color of frames    RRGGBB
  224.     int  0x40
  225.  
  226.                                    ; WINDOW LABEL
  227.     mov  eax,4                     ; function 4 : write text to window
  228.     mov  ebx,8*65536+8             ; [x start] *65536 + [y start]
  229.     mov  ecx,0x00ffffff            ; color of text RRGGBB
  230.     mov  edx,labeltext             ; pointer to text beginning
  231.     mov  esi,lte-labeltext         ; text length
  232.     int  0x40
  233.  
  234.     mov  eax,8                     ; CONTROL BUTTONS
  235.     mov  ebx,25*65536+9
  236.     mov  ecx,113*65536+9
  237.     mov  edx,2
  238.     mov  esi,0x667788
  239.     int  0x40
  240.     newbut:
  241.     int  0x40
  242.     add  ecx,16*65536
  243.     inc  edx
  244.     cmp  edx,8
  245.     jb   newbut
  246.  
  247.     cld
  248.     mov  ebx,25*65536+50           ; draw info text with function 4
  249.     mov  ecx,0x000000
  250.     mov  edx,text
  251.     mov  esi,40
  252.   newline:
  253.     mov  eax,4
  254.     int  0x40
  255.     add  ebx,16
  256.     add  edx,40
  257.     cmp  [edx],byte 'x'
  258.     jnz  newline
  259.  
  260.     mov  eax,12                    ; function 12:tell os about windowdraw
  261.     mov  ebx,2                     ; 2, end of draw
  262.     int  0x40
  263.  
  264.     ret
  265.  
  266.  
  267. ; DATA AREA
  268.  
  269.  
  270. text:
  271.     db ' ‚६ï á¥à¢¥à :                         '
  272.     db '                                        '
  273.     db '  Œ¥­î ã¯à ¢«¥­¨ï á¥à¢¥à®¬:             '
  274.     db '                                        '
  275.     db '   - ‚몫îç¨âì                          '
  276.     db '   - ¥à¥§ £à㧨âì                      '
  277.     db '   - ‘®åà ­¨âì ä«®¯¯¨-¨¬¥¤¦             '
  278.     db '   - ‘®åà ­¨âì ¨¬¥¤¦ †. ¤¨áª            '
  279.     db '   - ƒ®àï稩 à¥áâ àâ ï¤à                '
  280.     db '   - ‡ ªàë⨥ á¥à¢¥à­®© ç á⨠          '
  281.     db '                                        '
  282.     db ' ‹®ª «ì­ë©  ¤à¥á : 192.168.0.1          '
  283.     db ' “¤ «ñ­­ë©  ¤à¥á : 192.168.0.2          '
  284.     db '€¤à¥á á¥à¢¥à  - ¢ ª®­æ¥ ¨á室­¨ª        '
  285.     db 'x <- END MARKER, DONT DELETE            '
  286.  
  287.  
  288. labeltext:  db  'Remote Control Center(Client)'  ;
  289. lte:
  290.  
  291. socket  dd  0x0
  292.  
  293. remote_ip  db  192,168,0,2
  294.  
  295. sen_shutdown   db  'S'
  296. sen_reboot   db  'R'
  297. sen_savefi   db  'F'
  298. sen_savehi   db  'H'
  299. sen_hotreboot   db  'O'
  300. sen_exit db 'E'
  301. connect db 'C'
  302.  
  303. I_END:
  304.  
  305.  
  306.  
  307.  
  308.  
  309.  
  310.