AuthorMessage
Lord_Zero
Ametuar
Posts: 122

Quoted from vî¢KMåkè®
lol, i was just looking at the code u posted as example br0, he he it made me think the app i made would be useless apart from sym pure basics, as all it does is open a cmd box and if you in put any character it gets changed to an uppercase letter of alphabet, but i think its good for seeing how to move machine code around the stack, but dunno if any good 4 u??
-//v
regards

You can make a resource file called RSRC.RC that contains :
Code:
#include  "\masm32\include\resource.h"
1000 DIALOGEX MOVEABLE IMPURE LOADONCALL DISCARDABLE   10, 10, 185, 44, 0
STYLE DS_MODALFRAME | 0x0004 | DS_CENTER | WS_CAPTION | WS_SYSMENU | WS_VISIBLE | WS_POPUP
CAPTION "Test"
FONT 8, "MS Sans Serif", 700, 0 /*FALSE*/
BEGIN
    EDITTEXT        200,    6,6,173,12, ES_AUTOHSCROLL | ES_LEFT, , 0
    DEFPUSHBUTTON   "Do &NOT press this button", 1,    11,25,107,15, 0, , 0
    PUSHBUTTON      "E&xit", 2,    135,25,39,15, 0, , 0
END

The program follows :
Code:
.386
.model   flat,stdcall
option   casemap:none
include   \masm32\include\windows.inc
include   \masm32\include\user32.inc
include   \masm32\include\kernel32.inc
include   \masm32\include\shell32.inc
includelib   \masm32\lib\user32.lib
includelib   \masm32\lib\kernel32.lib
includelib   \masm32\lib\shell32.lib
dlgfunc   PROTO   :DWORD,:DWORD,:DWORD,:DWORD
editproc PROTO   :DWORD,:DWORD,:DWORD,:DWORD
.data?
   oldeditproc   dd   ?
   buffer      db   101 dup(?)
.code
start:
   invoke   GetModuleHandle,0
   invoke   DialogBoxParam,eax,1000,0,addr dlgfunc,0
   invoke   ExitProcess,0
dlgfunc   PROC   uses ebx hDlg:DWORD,uMsg:DWORD,wParam:DWORD,lParam:DWORD
   .if uMsg==WM_INITDIALOG
      invoke   SendDlgItemMessage,hDlg,200,EM_LIMITTEXT,100,0
      invoke   GetDlgItem,hDlg,200
      push   eax
      invoke   GetWindowLong,eax,GWL_WNDPROC
      mov   oldeditproc,eax
      pop   eax
      invoke   SetWindowLong,eax,GWL_WNDPROC,addr editproc
   .elseif uMsg==WM_COMMAND
      mov   eax,wParam
      .if ax==1
         invoke   GetDlgItemText,hDlg,200,addr buffer,100
         xor   ebx,ebx
         xor   ecx,ecx
         push   ecx
         push   ecx
         .while eax
            push   ecx
            push   ebx
            invoke   FindWindowEx,ecx,ebx,0,0
            pop   ebx
            pop   ecx
            .if eax
               push   ecx
               push   ebx
               push   eax
               invoke   SetWindowText,eax,addr buffer
               pop   eax
               pop   ebx
               pop   ecx
               push   ecx
               push   eax
               xchg   eax,ebx
               mov   ecx,eax
            .else
               pop   ebx
               pop   ecx
               mov   eax,ebx
               or   eax,ecx
            .endif
         .endw
      .elseif ax==2
         invoke   EndDialog,hDlg,0
      .endif
   .endif
   xor   eax,eax
   ret
dlgfunc   ENDP
editproc   PROC   hWnd:DWORD,uMsg:DWORD,wParam:DWORD,lParam:DWORD
   .if uMsg==WM_CHAR
      mov   eax,wParam
      sub   al,61h
      .if al<26
         and   byte ptr wParam,0DFh
      .endif
   .endif
   invoke   CallWindowProc,oldeditproc,hWnd,uMsg,wParam,lParam
   ret
editproc   ENDP
end  start

You can save this program as uppercase.asm.
To compile you can use the following command line (assuming you have masm installed in the root directory of the disk drive where the program is located) :
\masm32\bin\bldall uppercase