944,044 Members | Top Members by Rank

Ad:
  • Assembly Discussion Thread
  • Unsolved
  • Views: 3317
  • Assembly RSS
Mar 15th, 2006
0

I'm new

Expand Post »
I am currently learning 32 bit Win programming in assembly. I used to write in C and C++ but didn't like the code bloat.

My hobbies are photography, stamp collecting,
wood working, and bike riding.

Thanks.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
deutsch is offline Offline
8 posts
since Mar 2006
Mar 15th, 2006
0

Re: I'm new

Welcome! What assembler are you using? Are you working directly with the Win32 API for assembly GUI applications or are you actually doing something fun?

>I used to write in C and C++ but didn't like the code bloat.
Most of the bloat comes from poorly written (or clearly written, if footprint isn't as important as clarity) code and libraries. If you're writing Win32 assembly then you'll still see the bloat from the API you use, and that really can't be avoided for any non-trivial application. To really get the size benefits of assembly, you're looking at bare metal interrupts, but those have their own disadvantages.
Administrator
Reputation Points: 6442
Solved Threads: 1393
Bad Cop
Narue is offline Offline
11,807 posts
since Sep 2004
Mar 15th, 2006
0

Re: I'm new

[QUOTE=Narue]Welcome! What assembler are you using? Are you working directly with the Win32 API for assembly GUI applications or are you actually doing something fun?

I am using Masm for straight assembly API like them good old DOS days. :-)

Right now I am struggling with this code.

Thanks. I have the SDK, but it's a little cryptic.

There is a problem with one/both RegCloseKey statements.
Maybe:

1. Their order should be reversed
2. Something else is needed in the code

What I want Ollydbg to do is go to my breakpoints and stop so I can see what's going on.
Then go one instruction at a time. This computer F-keys does their own thing.

; creatsub.asm Create a subkey of an existing registry key
; Help from AsmER,
; SLOW and EASY with this 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\advapi32.inc

include \masm32\macros\macros.asm

includelib \masm32\lib\kernel32.lib
includelib \masm32\lib\user32.lib
includelib \masm32\lib\advapi32.lib

.DATA

APPKey BYTE "Marzipan", 0
SecondKey BYTE "basement", 0
Opened_Key BYTE "Registry Key sucessfully opened.",0
No_Key BYTE "Registry Key not present!",0
Key_Closed BYTE "Sub_Key creation suceeded.",0
Problem BYTE "Problem closing Registry Key !",0
Sample BYTE "Sample",0 ; title of message box

.DATA?

RegH PHKEY ? ; Handle for registry key DON'T use ADDR with these!
SubRegKey PHKEY ?

.CODE

Start:

jmp Next

Fill db "db eax",0

Next:

invoke RegOpenKey, HKEY_CURRENT_USER, ADDR APPKey, ADDR RegH ;to get handle of already created
;registry key.

.IF EAX == ERROR_SUCCESS

invoke MessageBox, 0, ADDR Opened_Key, ADDR Sample,MB_ICONINFORMATION

.ELSE

invoke MessageBox, 0, ADDR No_Key, ADDR Sample,MB_ICONINFORMATION
invoke ExitProcess, 0 ; exit, we have a problem

.ENDIF

invoke RegCreateKey, RegH, ADDR SecondKey, SubRegKey ;to create or open
;already existing sub reg. key

invoke RegCloseKey, RegH ; close handle for reg. key
int 3
invoke RegCloseKey, SubRegKey ; close handle for reg. key
int 3
.IF EAX == ERROR_SUCCESS

invoke MessageBox, 0, ADDR Key_Closed, ADDR Sample,MB_ICONINFORMATION

.ELSE ; something's amiss

invoke MessageBox, 0, ADDR Problem, ADDR Sample,MB_ICONINFORMATION

.ENDIF

invoke ExitProcess, 0

END Start
Reputation Points: 10
Solved Threads: 0
Newbie Poster
deutsch is offline Offline
8 posts
since Mar 2006

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Assembly Forum Timeline: MIPS language question2 pls help..
Next Thread in Assembly Forum Timeline: Want to get started in Assembly





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC