Hello,
i like to set a binary registry key with Tasm.
like : test 01
i try to convert a MASM sample ,but im to new to asm to fix it.
can someone please help me out ,i need this to end my project and im frustrated that i cant find in the web a description about this :(
--------sample for MASM-----------
SetRegKeyDW PROC lpdwValue:DWORD, lpszKeyName:DWORD, lpszValueName:DWORD
LOCAL Disp :DWORD
LOCAL pKey :DWORD
DW_SIZE EQU 4
invoke RegCreateKeyEx, HKEY_CURRENT_USER,
lpszKeyName, NULL, NULL,
REG_OPTION_NON_VOLATILE,
KEY_ALL_ACCESS, NULL,
addr pKey, addr Disp
.IF eax != ERROR_SUCCESS
invoke RegCreateKeyEx, HKEY_CURRENT_USER,
lpszKeyName, NULL, NULL,
REG_OPTION_NON_VOLATILE,
KEY_WRITE, NULL,
addr pKey, addr Disp
.IF eax !=ERROR_SUCCESS
jmp outproc
.ENDIF
.ENDIF
invoke RegSetValueEx, pKey, lpszValueName,
NULL, REG_DWORD_LITTLE_ENDIAN,
lpdwValue, DW_SIZE
invoke RegCloseKey, pKey
------------------------------
if you also know a good site ,speaking about registry editing with Tasm ,please post the url ,too ;)
Thanks a lot ;)
cu
Hi
first of all "invoke" works with MASM only
TASM uses "call" i think (a little confuseing IMHO)
the rest should work ok...
email me or repost here if you still have problems...
Bogdan
Hello,
ähm ,öhm , i dont get it working :(
i think im to stupid.
hm,you know this problem :you like to do things you dont know enough about ,best to finish them yesterday.... *g*
i try to use the sample ,but i got a lot errors when i change invoke to call.
sorry ,i dont know enough about asm to understand what you mean ,but i try to understand it ;)
meanwhile i use try and error again *g*
anyway ,thanks for trying to help me !
cu
One of the major disadvantages to TASM is that it doesn't support high level language macros. Only 'pure' Assembly will do. So, you have to get rid of all your .if, .elseif, .endif, and invokes. This presents a problem because parameters are pushed backwards, not forwards. Let me show you what I mean:
invoke RegCreateKeyEx, HKEY_CURRENT_USER,
lpszKeyName, NULL, NULL,
must become:
push offset Disp ; ADDR is also a macro
push offset pKey
push NULL
push KEY_ALL_ACCESS
push REG_OPTION_NON_VOLATILE
push NULL
push NULL
push lpszKeyName
push HKEY_CURRENT_USER
call RegCreateKeyEx
Secondly, .if, .elseif, .else, and .endif don't exist in the CPU, and thus don't exist in TASM. So, you must use true assembly code:
.IF eax != ERROR_SUCCESS
...
.IF eax !=ERROR_SUCCESS
..
.ENDIF
.ENDIF
could become this
cmp eax,ERROR_SUCCESS
jz Success
; je works also
; Second check code here
cmp eax,ERROR_SUCCESS
jz Success
; Failure code here
; A jmp is needed if you want to keep the failure code
; seperate from the success code
Success:
It's a long process, but a necessary one if you want to port from MASM to TASM.
Hi
Rasco ...TASM supports ALL features that MASM supports
(besides "invoke" is called "call") Actually MASM somehow allways tried to imitate and catch TASM from behind...until Borland abandoned it...somehow...
So even today TASM and MASM are allmost the same...with a small advantage (after many many years of no evolution for TASM) in favour of MASM (however still TASM is 10 to 100 times faster then MASM)
So its a problem on some minor differences...but they can be annoying for a beginner :)
That is why (and only that) i suggest all beginners start with MASM...is easyer and has all the includes up to date :) also more support here :)
All high level (and even more: eax=eax+ebx*4) are available in TASM ...just with little changes
Back to Why:
1.you did include all requested files (constants and structures) at the beginning of your file?
2.have you also defined external functions you use?
3.You have link errors also? (include libs also)
Bogdan
Hi
THANKS for you help !
when i read the answers the light goes on *bg*
now i understand what i made wrong and i got it working ;)
im happy to know this message board ,because all people become help ;)
like me as a beginner.
may the source be with you ;)
thx and cu
an easy way to see how masm assembles conditional jumps would probably be to dissasmble your app, and then imagine you source code looking like that in tasm systax, one confusing mess. It really gets to me, there are all these people, who spend all this time writing brilliant code, post it on the net, so other people can read, it. But.... they wrote it in tasm, so it is almost impossible to understand. Cause even if you save yourself, 1 minute in compiling, you still wasted time in understanding you own code, checking it for errors, tracking down bugs, writing loops, API calls etc, long hand, writing you own include files.... all the crap that is unnesscery
Sorry X
but you are WRONG
TASM has all HLL features of MASM and some more like HLL OOP and basic like operations: eax=ecx+ebx
More... TASM is much faster....
It may not matter to you ...but when you have 4Mbytes of source text and 100 include files...and you build all every 5 minutes or so...it will make a BIG difference
Professionals (and hackers know why they use TASM :) )
Its only problems are:
1.Its not FREE :( and its somehow forgotten by Borland....
2.Has some little outdated include files...but you can use MASM ones with little modifications
Programmers that use TASM are usually more advanced (mainly hackers) so thats why you can not read their source code so easy ...but they sure can :) (me also :) )
Bogdan