Log in

View Full Version : How to porting this code with SDK


Limee AKA Lamer
September 5th, 2004, 17:53
the dialog.asm is written with asmeble,
how to write with SDK?
Who can help me ,thanks!
-----------------------------------------------------

.386
.model flat,stdcall
option casemap:none
DlgProc proto WORD,WORD,WORD,WORD

include \masm32\include\windows.inc
include \masm32\include\user32.inc
include \masm32\include\kernel32.inc
includelib \masm32\lib\user32.lib
includelib \masm32\lib\kernel32.lib

.data
DlgName db "MyDialog",0
AppName db "Our Second Dialog Box",0
TestString db "Wow! I'm in an edit box now",0

.data?
hInstance HINSTANCE ?
CommandLine LPSTR ?
buffer db 512 dup(?)

.const
IDC_EDIT equ 3000
IDC_BUTTON equ 3001
IDC_EXIT equ 3002
IDM_GETTEXT equ 32000
IDM_CLEAR equ 32001
IDM_EXIT equ 32002


.code
start:
invoke GetModuleHandle, NULL
mov hInstance,eax
invoke DialogBoxParam, hInstance, ADDR DlgName,NULL, addr DlgProc, NULL
invoke ExitProcess,eax

DlgProc proc hWnd:HWND, uMsg:UINT, wParam:WPARAM, lParam:LPARAM
.IF uMsg==WM_INITDIALOG
invoke GetDlgItem, hWnd,IDC_EDIT
invoke SetFocus,eax
.ELSEIF uMsg==WM_CLOSE
invoke SendMessage,hWnd,WM_COMMAND,IDM_EXIT,0
.ELSEIF uMsg==WM_COMMAND
mov eax,wParam
.IF lParam==0
.IF ax==IDM_GETTEXT
invoke GetDlgItemText,hWnd,IDC_EDIT,ADDR buffer,512
invoke MessageBox,NULL,ADDR buffer,ADDR AppName,MB_OK
.ELSEIF ax==IDM_CLEAR
invoke SetDlgItemText,hWnd,IDC_EDIT,NULL
.ELSEIF ax==IDM_EXIT
invoke EndDialog, hWnd,NULL
.ENDIF
.ELSE
mov edx,wParam
shr edx,16
.if dx==BN_CLICKED
.IF ax==IDC_BUTTON
invoke SetDlgItemText,hWnd,IDC_EDIT,ADDR TestString
.ELSEIF ax==IDC_EXIT
invoke SendMessage,hWnd,WM_COMMAND,IDM_EXIT,0
.ENDIF
.ENDIF
.ENDIF
.ELSE
mov eax,FALSE
ret
.ENDIF
mov eax,TRUE
ret
DlgProc endp
end start

---------------------------------------------------------------

dELTA
September 5th, 2004, 19:14
For the love of f*****g god read the posting guidelines already, I'm starting to get tired of this...

And in addition to that, for pure assembly language programming questions, the following site is better suited:

http://board.win32asmcommunity.net

JMI
September 5th, 2004, 20:07
It would certainly appear that limee has severe challenges beyond the language barrier.

And dELTA, the Diety does not need to fornicate. The Diety is, so the story goes, capable of "creation" without such "physical" activities.

Regards,

Kayaker
September 5th, 2004, 20:13
Quote:
[Originally Posted by limee]the dialog.asm is written with asmeble,
how to write with SDK?

Asmeble. I like that word. What is it you want to do, write it in C/C++ ?

Neitsa
September 5th, 2004, 20:38
Hello,

Since MASM32 relies heavily on windows, 'translating' a Windows MASM code like the above, to C++ is trully easy (I mean if it doesn't have some specific asm part). There's also an '__asm' keyword in C++ for those specific stuffs.

You'll find a lot of tutorials on basic API programming with C++ (I mean without MFC). Also, be sure to check the MS website, specially the MSDN which is, we must admit, a great knowledge base on Win system.

MASM32 haven't an 'SDK' like C++, but it's trully a powerful low-level language, on the other hand, it is not a good langage for big projects, and it doesn't support OOP (object programming), because it's a procedural language and low level language doesn't support this type of coding.

If you're interested in ASM on windows X86 plateform you should check:

Iczelion web site : http://win32asm.cjb.net/
The AOA ( Art of Assembly): http://webster.cs.ucr.edu/AoA/
MASM32 forum (by hucth): http://www.masmforum.com/
The MASM32 web site: http://www.masm32.com/
and the link provided by Delta which is the biggest Win asm community.

If you're interested in reversing, you'll need to know Asm instructions ! Get a copy of Intel manuals (on paper or in e-version).

Regards, Neitsa.

Limee AKA Lamer
September 6th, 2004, 06:33
[Merged from separate thread in Advanced forum, by dELTA]

I can't compile it,give me a hand.
thanks!

Neitsa
September 6th, 2004, 07:19
Hello,

Sorry to answer this way Limee, but, first of all I think you're in the wrong section of the forum, do you think your question is related to "Advanced reversing and programming" ?

You're question is related to the other post you've previously made, so post it in the same thread.

Second, When such a question arise, I think the minimum things to tell to other people is what are the errors given by the compiler ?

dELTA
September 6th, 2004, 08:14
So limee, that being said, in addition to what you've been told earlier (apparently without you listening at all), one more post breaking the guidelines from you, and you're out... And this time I'm serious.

Woodmann
September 6th, 2004, 18:00
Seems to me he shall be "right out".


And the counting of the numbers shall be. The number one being the first number shall be spake. After the number one be spake thou shalt proceed to the number two. After the number two be reached thoust shall proceed to the number three. Two shallt not count neither shallt four.

FIVE IS RIGHT OUT.

Once the number three be reached thou shallt lobbest thyne holy hand grenade towards thy foe, who being naughty in thyne site shall snuff it.


(butchered by me on behalf of the "Holy Grail"