elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado:


+  Foro de elhacker.net
|-+  Programación
| |-+  Programación General
| | |-+  ASM (Moderador: Eternal Idol)
| | | |-+  Ventana en ASM
0 Usuarios y 1 Visitante están viendo este tema.
Páginas: 1 [2] Ir Abajo Respuesta Imprimir
Autor Tema: Ventana en ASM  (Leído 9,951 veces)
EAX_

Desconectado Desconectado

Mensajes: 26


inside myself..


Ver Perfil
Re: Ventana en ASM
« Respuesta #10 en: 20 Diciembre 2009, 23:13 pm »

Sisi, recien lo saque y con un msgbox confirme que funcionó, iba a responder pero ganaste.. gracias..

EAX_


En línea

"Everyone is a genius. But if you judge a fish on its ability to climb a tree, it will live its whole life believing it is stupid." - Albert Einstein
YST


Desconectado Desconectado

Mensajes: 965


I'm you


Ver Perfil WWW
Re: Ventana en ASM
« Respuesta #11 en: 21 Diciembre 2009, 01:27 am »

Citar
%HomeDrive% o %SystemRoot%.

Puedes tambien obtener las variables de entorno con GetEnvironmentVariable

Código
  1. include "win32ax.inc"
  2. .code
  3. start:
  4.  invoke GetEnvironmentVariable,"HomeDrive",Buffer,MAX_PATH
  5. invoke MessageBox,0,Buffer,0,0
  6. invoke ExitProcess,0
  7. .data
  8. Buffer db MAX_PATH dup (0)
  9. .end start


En línea



Yo le enseñe a Kayser a usar objetos en ASM
EAX_

Desconectado Desconectado

Mensajes: 26


inside myself..


Ver Perfil
Re: Ventana en ASM
« Respuesta #12 en: 21 Diciembre 2009, 02:58 am »

Uff, despues de unos intentos me sirvio lo que me pasaste, gracias.. pero no logré usar invoke asi que lo hice asi:
Código
  1. .codee:
  2.        push    MAX_PATH
  3.        push    buff2
  4.        push    _home
  5.        call    [GetEnvironmentVariable]
  6. .data
  7. buff2   db MAX_PATH dup (0)
  8. end data

Gracias..

Edito

Me quede sin memoria (out of memory) y le di más con FASM, ahora nose porque pero me cierra el programa y sale la ventanita de enviar informe de errores

Que tengo mal?
Código
  1. hInstance equ 0x00400000
  2. format PE GUI 4.0 at hInstance as 'exe'
  3. entry codee
  4. include 'WIN32A.INC'
  5.  
  6. section '.bss' readable writeable
  7. msg             MSG
  8. bools           db ? ; [1]Exit
  9.  
  10.  
  11. section '.text' code readable executable
  12.  
  13. codee:
  14.        push    _classname
  15.        push    0
  16.        push    0
  17.        call    [CreateMutex]
  18.        call    [GetLastError]
  19.        TEST    EAX,EAX
  20.        jnz     .fiiin
  21.        push    MAX_PATH
  22.        push    buff2
  23.        push    _home
  24.        call    [GetEnvironmentVariable]
  25.        push    DKGRAY_BRUSH
  26.        call    [GetStockObject]
  27.        mov     [wc.hbrBackground],EAX
  28.        push    IDC_ARROW
  29.        push    0
  30.        call    [LoadCursor]
  31.        mov     [wc.hCursor],EAX
  32.        push    IDI_APPLICATION
  33.        push    0
  34.        call    [LoadIcon]
  35.        mov     [wc.hIcon],EAX
  36.        push    wc
  37.        call    [RegisterClass]
  38.        push    0
  39.        push    [wc.hInstance]
  40.        push    0
  41.        push    0
  42.        push    300
  43.        push    500
  44.        push    CW_USEDEFAULT
  45.        push    CW_USEDEFAULT
  46.        push    WS_VISIBLE+WS_CAPTION+WS_SYSMENU+WS_MAXIMIZEBOX+WS_THICKFRAME
  47.        push    _title
  48.        push    _classname
  49.        push    0
  50.        call    [CreateWindowEx]
  51.        jmp     .jump0
  52.        .jump:
  53.        push    msg
  54.        call    [TranslateMessage]
  55.        push    msg
  56.        call    [DispatchMessage]
  57.        test    [bools],1
  58.        jnz     .fiiin
  59.  
  60.        .jump0:
  61.        push    0
  62.        push    0
  63.        push    0
  64.        push    msg
  65.        call    [GetMessage]
  66.        cmp     EAX,1
  67.        je      .jump
  68. .fiiin:
  69.        ret
  70.  
  71. WindowProc:
  72.        mov     EAX,DWORD PTR SS: ESP+8
  73.        cmp     EAX,WM_LBUTTONDOWN
  74.        je      .lbdwn
  75.        cmp     EAX,WM_DESTROY
  76.        je      .wm_destroy
  77.        jmp     [DefWindowProc]
  78.        .lbdwn:
  79.        push    SW_SHOWNORMAL
  80.        push    0
  81.        push    _c
  82.        push    _cmdp
  83.        push    _cmd
  84.        push    _open
  85.        push    0
  86.        call    [ShellExecute]
  87.        retn    16
  88.        .wm_destroy:
  89.        or      [bools],1
  90.        retn    16
  91.  
  92.  
  93. section '.data' writable readable
  94.  
  95. buff2           db MAX_PATH dup(0)
  96. _home           TCHAR 'HomeDrive'
  97. _open           TCHAR 'open',0
  98. _c              TCHAR 'C:\',0
  99. _cmd            TCHAR 'cmd',0
  100. _cmdp           TCHAR '/c msg * asd',0
  101. _title          TCHAR 'Program fucking',0
  102. _classname      TCHAR 'MyFuckingProgram'
  103. wc              WNDCLASS 0,WindowProc,0,0,hInstance,0,0,0,0,_classname
  104.  
  105. data import
  106.  
  107. U_KERNEL32     equ 1
  108. U_NTDLL       equ 0
  109. U_USER32       equ 1
  110. U_GDI32       equ 1
  111. U_DWM         equ 0
  112. U_SHELL32     equ 1
  113. U_ADVAPI32     equ 0
  114. U_WS2_32       equ 0
  115. U_COMCTL32     equ 0
  116. U_MSIMG32     equ 0
  117. U_MSVCRT       equ 0
  118. U_OLE32       equ 1
  119. include        'LIBS.INC'
  120.  
  121. end data
  122.  
  123.  

EAX_
« Última modificación: 21 Diciembre 2009, 03:21 am por EAX_ » En línea

"Everyone is a genius. But if you judge a fish on its ability to climb a tree, it will live its whole life believing it is stupid." - Albert Einstein
YST


Desconectado Desconectado

Mensajes: 965


I'm you


Ver Perfil WWW
Re: Ventana en ASM
« Respuesta #13 en: 21 Diciembre 2009, 04:13 am »

Le metes un parametro de mas al ShellExecute :P 

Lo adapte un poquito a mi gusto pero esta funcional toma

Código
  1. hInstance equ 0x00400000
  2. format PE GUI 4.0 at hInstance as 'exe'
  3.  
  4. include 'WIN32AX.INC'
  5.  
  6. section '.bss' readable writeable
  7. msg             MSG
  8. bools           db ? ; [1]Exit
  9.  
  10.  
  11. section '.text' code readable executable
  12.  
  13. codee:
  14.        push    _classname
  15.        push    0
  16.        push    0
  17.        call    [CreateMutex]
  18.        call    [GetLastError]
  19.        TEST    EAX,EAX
  20.        jnz     .fiiin
  21.        push    MAX_PATH
  22.        push    buff2
  23.        push    _home
  24.        call    [GetEnvironmentVariable]
  25.        push    DKGRAY_BRUSH
  26.        call    [GetStockObject]
  27.        mov     [wc.hbrBackground],EAX
  28.        push    IDC_ARROW
  29.        push    0
  30.        call    [LoadCursor]
  31.        mov     [wc.hCursor],EAX
  32.        push    IDI_APPLICATION
  33.        push    0
  34.        call    [LoadIcon]
  35.        mov     [wc.hIcon],EAX
  36.        push    wc
  37.        call    [RegisterClass]
  38.        push    0
  39.        push    [wc.hInstance]
  40.        push    0
  41.        push    0
  42.        push    300
  43.        push    500
  44.        push    CW_USEDEFAULT
  45.        push    CW_USEDEFAULT
  46.        push    WS_VISIBLE+WS_CAPTION+WS_SYSMENU+WS_MAXIMIZEBOX+WS_THICKFRAME
  47.        push    _title
  48.        push    _classname
  49.        push    0
  50.        call    [CreateWindowEx]
  51.        jmp     .jump0
  52.        .jump:
  53.        push    msg
  54.        call    [TranslateMessage]
  55.        push    msg
  56.        call    [DispatchMessage]
  57.        test    [bools],1
  58.        jnz     .fiiin
  59.  
  60.        .jump0:
  61.        push    0
  62.        push    0
  63.        push    0
  64.        push    msg
  65.        call    [GetMessage]
  66.        cmp     EAX,1
  67.        je      .jump
  68. .fiiin:
  69.        ret
  70.  
  71. WindowProc:
  72.        mov     EAX,DWORD[ESP+8]
  73.        ;pop edx
  74.        cmp     EAX,WM_LBUTTONDOWN
  75.        je      .lbdwn
  76.        cmp     EAX,WM_DESTROY
  77.        je      .wm_destroy
  78.        jmp     [DefWindowProc]
  79.        .lbdwn:
  80.  
  81.       invoke ShellExecute,0,_open,_cmd,_cmdp,_c, SW_SHOWNORMAL
  82.        ret
  83.        .wm_destroy:
  84. invoke ExitProcess,0
  85.  
  86. section '.data' writable readable
  87.  
  88. buff2           db MAX_PATH dup(0)
  89. _home           TCHAR 'HomeDrive'
  90. _open           TCHAR 'open',0
  91. _c              TCHAR 'C:\',0
  92. _cmd            TCHAR 'cmd',0
  93. _cmdp           TCHAR '/c msg * asd',0
  94. _title          TCHAR 'Program fucking',0
  95. _classname      TCHAR 'MyFuckingProgram'
  96. wc              WNDCLASS 0,WindowProc,0,0,hInstance,0,0,0,0,_classname
  97.  
  98. .end codee
  99.  
En línea



Yo le enseñe a Kayser a usar objetos en ASM
Páginas: 1 [2] Ir Arriba Respuesta Imprimir 

Ir a:  

Mensajes similares
Asunto Iniciado por Respuestas Vistas Último mensaje
Configurar ventana
.NET (C#, VB.NET, ASP)
Meta 2 2,016 Último mensaje 21 Abril 2021, 09:51 am
por Meta
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines