I've been wondering how to do this for some time now.

I am going to ask the user for a type of password, how can I show an '*' instead of a character?
Posted on 2002-06-10 11:07:00 by gorshing
1. Use int 21h function 8 into ah. The result will be in al
2. Copy al into a buffer
3. then just print an *

psuedo-asm code
mov ah, 08h

int 21h

-> store al into a buffer
-> Print an *
Use a counter to limit the number of input characters... Something like this...
Posted on 2002-06-11 16:05:40 by stryker
that's dos app... but what about console? I suggest digging through
the console API and see if there's anything helpful. That's what
I'd have to do to help you, so no reason you shouldn't be doing
it yourself :).
Posted on 2002-06-11 16:16:03 by f0dder
Does anyone know how to do $INKEY (or int 0x16) under Win32API? I believe that ReadFile will sit there waiting for a CrLf.
Posted on 2002-06-12 00:14:55 by eet_1024

The trick is to use ReadConsoleInput API in a loop while handling the events on the console...I'll probably create one proggy for this, If I have the time.
Posted on 2002-06-12 01:36:56 by stryker
Here it is...

Source: password.bat
Install: Doubleclick password.bat

Initial Password: stryker

Remember to run this inside a console, do not double click the .exe inside a file manager, like explorer. There are still a lot to be done but it should suffice to give an example on how to create a console password prompt. :)

- The password is case-sensitive
- there *might* be some problems with unicode.
Posted on 2002-06-12 18:04:00 by stryker
invoke    SetConsoleMode, [StdIn], ENABLE_PROCESSED_INPUT
is all I needed for my uses.

ie No Wait for CrLF and No Echo

Posted on 2002-06-13 00:16:18 by eet_1024
Yeah, I forgot - ENABLE_MOUSE_INPUT isn't needed, I was testing some mouse events but seems to me it doesn't work on 2k.

If you notice that at some point, you can't move forward, it's because of the size of the buffer was set initially to 20. Inc/Dec the size of the buffer to suit your need but be careful when the text goes beyond the edges of the screen...This is another case for the backspace key event, this time you have to handle the y coordinate...not much of a fuss but just a side note... Yawnn!!! I'm sleepy!!! :o
Posted on 2002-06-13 03:02:43 by stryker