News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Strings..

Started by Sponge Magnet, July 26, 2009, 01:22:40 AM

Previous topic - Next topic

Sponge Magnet


        mov lpHash, input()
        mov eax, [lpHash]
        mov szHash, eax


There is no way to get the contents of the user input?

dedndave

input() returns an address to the zero-terminated string (or, at least, i am pretty sure it is terminated - lol)

mov eax,input()
mov InputStringPointer,eax
print eax
print chr$(13,10)

you can also use it to display the prompt text

mov eax,input("Enter Value: ")

refer to the help file: \masm32\help\hlhelp.chm
under macros - console mode macros

Sponge Magnet

Quote from: dedndave on July 26, 2009, 03:35:45 AM
input() returns an address to the zero-terminated string (or, at least, i am pretty sure it is terminated - lol)

mov eax,input()
mov InputStringPointer,eax
print eax
print chr$(13,10)

you can also use it to display the prompt text

mov eax,input("Enter Value: ")

refer to the help file: \masm32\help\hlhelp.chm
under macros - console mode macros

It's just that I can not get the length of a string using its pointer (i,e: lpHash)

        mov lpHash, input()
        mov szHash, [lpHash]
        mov szHashSize, SIZEOF szHash


^ Attempting to move the string itself by de-referencing the pointer. Ends in an error.

dedndave

ohhhh - lol
i am not sure how to do that, other than counting bytes
they probably have a macro.....
try this one.....

mov lpHash,input()
mov ecx,len(eax)

same help file - under string macros
they probably use REPNZ SCASB in that macro

Sponge Magnet

Aww! Thank you so much dedndave! Amazing  :cheekygreen:

dedndave

wow - it actually worked - lol