flat assembler
Message board for the users of flat assembler.

Index > Windows > help.... winsock

Author
Thread Post new topic Reply to topic
senolc_eht



Joined: 22 Mar 2004
Posts: 57
Location: Indonesia
senolc_eht 24 May 2004, 01:11
i have this code :

Code:
format PE GUI 4.0
entry start

include 'D:\zoro\fasmw152\INCLUDE\win32a.inc'

section '.data' data readable writeable
 messagesyk db 'Succes',0
 messageeror db 'error',0
 messageerorv2 db 'Not version',0
 caption db 'status',0
 messageerorclean db 'couldn't cleaned',0
 messageok db 'can be clean',0

 WsaData WSADATA

section '.code' code readable executable

  start:

        invoke WSAStartup, 0002h, WsaData
        test eax,eax
        jz _startupsuccess

        invoke  MessageBox,HWND_DESKTOP,messageeror,caption,MB_ICONQUESTION+MB_YESNO
        invoke  ExitProcess,0

  _startupsuccess:
      cmp [WsaData.wVersion],2
      jae _versionOK
      invoke  MessageBox,HWND_DESKTOP,messageerorv2,caption,MB_ICONQUESTION+MB_YESNO
      jmp     _doCleanup
  _versionOK:
      invoke  MessageBox,HWND_DESKTOP,messagesyk,caption,MB_ICONQUESTION+MB_YESNO

  _doCleanup:
    invoke  WSACleanup
    test    eax, eax
    jz      _cleanupSucceeded

    invoke  MessageBox,HWND_DESKTOP,messageerorclean,caption,MB_ICONQUESTION+MB_YESNO
    invoke  ExitProcess,0
_cleanupSucceeded:
    invoke  MessageBox,HWND_DESKTOP,messageok,caption,MB_ICONQUESTION+MB_YESNO
    invoke  ExitProcess

section '.idata' import data readable writeable

  library kernel,'KERNEL32.DLL',\
          user,'USER32.DLL',\
          winsock,'Wsock32.dll'

  import kernel,\
         ExitProcess,'ExitProcess'

  import user,\
         MessageBox,'MessageBoxW'


  import winsock,\
         WSAStartup,'WSAStartup',\
         WSACleanup,'WSACleanup'    



help the message box appair like in attachment


Description:
Filesize: 41.14 KB
Viewed: 3673 Time(s)

message.JPG


Post 24 May 2004, 01:11
View user's profile Send private message Yahoo Messenger Reply with quote
aaro



Joined: 21 Jun 2003
Posts: 107
Location: hel.fi
aaro 24 May 2004, 09:16
You are using unicode version of the MessageBox function so your strings need to be unicode to:
Code:
section '.data' data readable writeable
WsaData WSADATA

messagesyk du 'Succes',0
messageeror du 'error',0
messageerorv2 du 'Not version',0
caption du 'status',0
messageerorclean du 'couldn't cleaned',0
messageok du 'can be clean',0
    
Post 24 May 2004, 09:16
View user's profile Send private message Reply with quote
madmatt



Joined: 07 Oct 2003
Posts: 1045
Location: Michigan, USA
madmatt 24 May 2004, 09:17
In the inports section, I simply changed:
Code:
 import user,\
         MessageBox,'MessageBoxW'    


to:
Code:
  import user,\
         MessageBox,'MessageBoxA'    


and all the message boxes turned out ok, also you need to change the
text:
Code:
messageerorclean db 'couldn't cleaned',0    

to:
Code:
messageerorclean db "couldn't cleaned",0    


these are the only things I see so far.
Post 24 May 2004, 09:17
View user's profile Send private message Reply with quote
madmatt



Joined: 07 Oct 2003
Posts: 1045
Location: Michigan, USA
madmatt 24 May 2004, 09:22
and qnother small error,the invoke Exitprocess needs another parameter as below
Code:
_cleanupSucceeded:
    invoke MessageBox,HWND_DESKTOP,messageok,caption,MB_ICONQUESTION+MB_YESNO
    invoke  ExitProcess    


Code:
should be:
_cleanupSucceeded:
    invoke  MessageBox,HWND_DESKTOP,messageok,caption,MB_ICONQUESTION+MB_YESNO
    invoke  ExitProcess,0    
Post 24 May 2004, 09:22
View user's profile Send private message Reply with quote
senolc_eht



Joined: 22 Mar 2004
Posts: 57
Location: Indonesia
senolc_eht 24 May 2004, 10:55
OK thanks for all it's now work fine.......
Post 24 May 2004, 10:55
View user's profile Send private message Yahoo Messenger Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.