Jump to content
Sign in to follow this  

CUI password chars

Recommended Posts


is there any way to mask characters when reading from the cmd input?(fileopen("con" ,4))

Only two things are infinite, the universe and human stupidity, and i'm not sure about the former -Alber EinsteinPractice makes perfect! but nobody's perfect so why practice at all?http://forum.ambrozie.ro

Share this post

Link to post
Share on other sites

the only EASY way I can think of is via HotKeys...

Or maybe some WinApi command... but I'm not sure ;)

(actually just setting the test the same color as the background will work fine ^_^... but yet, I don't know how to do it XD)

Some Projects:[list][*]ZIP UDF using no external files[*]iPod Music Transfer [*]iTunes UDF - fully integrate iTunes with au3[*]iTunes info (taskbar player hover)[*]Instant Run - run scripts without saving them before :)[*]Get Tube - YouTube Downloader[*]Lyric Finder 2 - Find Lyrics to any of your song[*]DeskBox - A Desktop Extension Tool[/list]indifference will ruin the world, but in the end... WHO CARES :P---------------http://torels.altervista.org

Share this post

Link to post
Share on other sites

All the inet searches I came across all referred to hooking of some sort. I made a crude example using code from the _WinAPI_SetWindowsHookEx() example in the help file and tailored it to run as a CUI. Works ok, but not the best and is incomplete.

I'm happy to PM it to you if you're interested in looking.


I was waiting to post the code as it could be altered for bad intent, but since zorphnog already did....here ya go. Must be compiled.


Edited by spudw2k

Share this post

Link to post
Share on other sites

Here's an example I made from modifying the _WinAPI_SetWindowsHookEx example using notepad as the input. Of course you would need to make some changes for interacting with the console input, but it shows the basic idea of what you have to do. If you post your code, we can try to tailor it for your needs.

#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6

#include <WinAPI.au3>
#include <WindowsConstants.au3>
#include <StructureConstants.au3>

Opt('MustDeclareVars', 1)

Global $hHook, $hStub_KeyProc, $buffer = ""


Func _Main()
    Local $hmod

    $hStub_KeyProc = DllCallbackRegister("_KeyProc", "long", "int;wparam;lparam")
    $hmod = _WinAPI_GetModuleHandle("user32.dll")
    $hHook = _WinAPI_SetWindowsHookEx($WH_KEYBOARD_LL, DllCallbackGetPtr($hStub_KeyProc), $hmod)

    WinWait("Untitled -")
    WinActivate("Untitled -")

    While 1
        If ControlGetText("Untitled -", "", "Edit1") <> "" Then ControlSetText("Untitled -", "", "Edit1", "")
EndFunc   ;==>_Main

Func EvaluateKey($keycode)
    If ($keycode = 27) Then
        ConsoleWrite($buffer & @LF)
    $buffer &= Chr($keycode)
EndFunc   ;==>EvaluateKey

; callback function
Func _KeyProc($nCode, $wParam, $lParam)
    Local $tKEYHOOKS
    $tKEYHOOKS = DllStructCreate($tagKBDLLHOOKSTRUCT, $lParam)
    If $nCode < 0 Then
        Return _WinAPI_CallNextHookEx($hHook, $nCode, $wParam, $lParam)
    If $wParam = $WM_KEYDOWN Then
        EvaluateKey(DllStructGetData($tKEYHOOKS, "vkCode"))
    Return _WinAPI_CallNextHookEx($hHook, $nCode, $wParam, $lParam)
EndFunc   ;==>_KeyProc

Func OnAutoItExit()
EndFunc   ;==>OnAutoItExit

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this