home *** CD-ROM | disk | FTP | other *** search
/ ftp.sberbank.sumy.ua / 2014.11.ftp.sberbank.sumy.ua.tar / ftp.sberbank.sumy.ua / incoming / 1 / hello.asm < prev    next >
Assembly Source File  |  2014-02-08  |  3KB  |  186 lines

  1.     .386
  2.     .model flat, stdcall
  3.     option casemap :none                  ; case sensitive
  4.  
  5.     include \masm32\include\windows.inc
  6.     include \masm32\include\kernel32.inc
  7.     include \masm32\include\user32.inc
  8.     include \masm32\macros\macros.asm
  9.  
  10.     includelib \masm32\lib\kernel32.lib
  11.     includelib \masm32\lib\user32.lib
  12.  
  13.     SetMemoryLoc PROTO :DWORD, :DWORD, :DWORD 
  14.     GetStringLengthLoc PROTO :DWORD
  15.     IntToString PROTO :DWORD, :DWORD
  16.     CreateCurrentDateDirectoryLoc PROTO 
  17.     
  18.  
  19. .data
  20.  EVK           db "Evgeney Victorovich Kupin 27 April 1982",0
  21.  
  22.  Str1 db 256 dup(0)
  23.  Test1 db " 27",0
  24.  wspString db "%d",0
  25.  
  26. .code
  27.  
  28. start:
  29.  
  30.   ;  invoke CreateCurrentDateDirectoryLoc
  31.  
  32.  ;   push offset Test1
  33.  ;   push offset EVK
  34.  ;   push offset Str1
  35.  ;   push 3 
  36.  ;   call CatStringsLoc 
  37.  
  38.    ; invoke GetStringLengthLoc, offset Test1
  39.    ; invoke wsprintf, offset Str1, offset wspString, eax
  40.     invoke IntToString, offset Str1,990902013
  41.     invoke MessageBox,0,offset Str1,0,0 
  42.  
  43.     exit
  44.  
  45. GetStringLengthLoc proc lpStr:DWORD
  46.  
  47.  push edi
  48.  pushf 
  49.  
  50.  cld
  51.  xor eax,eax
  52.  mov ecx, 65536 
  53.  mov edi, lpStr
  54.  repne scasb
  55.  
  56.  mov eax,65536-1 
  57.  sub eax, ecx  
  58.  
  59.  popf
  60.  pop edi 
  61.  
  62.  ret
  63. GetStringLengthLoc endp
  64.  
  65.  
  66. CatStringsLoc:                     ; [esp+0] ret, [esp]
  67.   push ebp
  68.   mov ebp, esp
  69.      
  70.   push edi
  71.   push esi
  72.   pushf
  73.  
  74.   mov eax, 12
  75.   mov edx,[ebp+8]
  76.   dec edx
  77.   mov edi, [ebp+12]
  78.  
  79. CatStringsLoc_cat_strings:
  80.   add eax,4
  81.   mov esi, [ebp+eax]
  82.   push eax
  83.   invoke GetStringLengthLoc, [ebp+eax]
  84.   mov ecx, eax
  85.   pop eax
  86.   rep movsb
  87.   dec edx
  88.   jnz CatStringsLoc_cat_strings
  89.  
  90.   popf
  91.   pop esi
  92.   pop edi
  93.  
  94.   mov ecx, [ebp+8]
  95.   mov edx,[esp+4]
  96.   pop ebp
  97.   inc ecx
  98.   CatStringsLoc_clear_stack:
  99.   pop eax
  100.   loop CatStringsLoc_clear_stack 
  101.  
  102.   mov [esp], edx    
  103.   ret
  104.  
  105. IntToString proc lpBuff:DWORD, Val:DWORD
  106.      push ebx
  107.      push edi  
  108.      push esi
  109.  
  110.      mov ebx,10
  111.      mov edi, lpBuff
  112.      mov esi, edi 
  113.      mov eax, Val
  114.  
  115. IntToString_div:
  116.      mov esi,edi
  117.      add esi,10
  118.      dec esi
  119.      mov ecx,10     
  120.  
  121. IntToString_div_shift:
  122.      mov  dl,BYTE PTR[esi]
  123.      mov BYTE PTR [esi+1],dl 
  124.      dec esi
  125.      loop IntToString_div_shift
  126.  
  127.      xor edx,edx 
  128.      div ebx
  129.      add dl,"0"
  130.      mov [edi],dl 
  131.      test eax,eax
  132.      jnz IntToString_div
  133.  
  134.      pop esi 
  135.      pop edi
  136.      pop ebx
  137.      ret 
  138. IntToString endp
  139.  
  140. SetMemoryLoc proc lpMem:DWORD, Val:DWORD, Count:DWORD 
  141.  
  142.       pushf
  143.       push edi 
  144.  
  145.       cld
  146.       mov edi, lpMem
  147.       mov eax, Val
  148.       mov ecx, Count
  149.       rep stosb
  150.  
  151.       pop edi
  152.       popf
  153.       ret 
  154. SetMemoryLoc endp
  155.  
  156. CreateCurrentDateDirectoryLoc proc
  157.  LOCAL cBuffer[100]:BYTE
  158.  LOCAL sysTime:SYSTEMTIME
  159.  LOCAL Month:DWORD
  160.  LOCAL Day:DWORD
  161.  LOCAL Year:DWORD
  162.  
  163.        
  164.      ;   invoke SetMemoryLoc, addr cBuffer, 0, 100
  165.  
  166.         invoke GetLocalTime, addr sysTime 
  167.  
  168.         mov eax,0
  169.         mov ax, sysTime.wDay 
  170.         mov Day, eax
  171.  
  172.         xor ecx, ecx
  173.         mov cx, sysTime.wYear
  174.         mov Year, ecx    
  175.  
  176.         and eax, 0 
  177.         mov ax, sysTime.wMonth
  178.         mov Month, eax
  179.  
  180.         
  181.  
  182.       ;  invoke CreateDirectory, addr cBuffer, 0
  183.  
  184.         ret 
  185. CreateCurrentDateDirectoryLoc endp
  186. end start