flat assembler
Message board for the users of flat assembler.

Index > Windows > SendInput anywhere good

Author
Thread Post new topic Reply to topic
semiono



Joined: 31 Aug 2007
Posts: 176
Location: section '.code' executable
semiono
Code:
include '%fasm%/win64ax.inc'
section '.code' executable
start:
        sub rsp,8

        mov [z],$-pInputs
        mov [ki.wVk],VK_TAB+VK_MENU
        invoke Sleep,1000
        invoke SendInput,1,pInputs,[z]
exit:
        invoke ExitProcess,NULL

        VK_TAB = 0x0009
        VK_MENU = 0x0012

section '.data' readable writeable

        z rd MAX_PATH

struct KEYBDINPUT

        wVk dw ?
        wScan dw ?
        dwFlags dd ?
        time dd ?
        dwExtraInfo dd ?
ends
        ki KEYBDINPUT

struct INPUT

        mi dd ?
        ki dd ?
        hi dd ?
ends
        pInputs INPUT    


How to press ALT+SHIFT on winxp desktop?
struct+struct+struct oh my nervous! Confused

_________________
Memory=8388608
Post 07 Nov 2011, 00:55
View user's profile Send private message ICQ Number Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17280
Location: In your JS exploiting you and your system
revolution
semiono wrote:
How to press ALT+SHIFT on winxp desktop?
I use keybd_event to send keystrokes to other windows.
Post 07 Nov 2011, 11:52
View user's profile Send private message Visit poster's website Reply with quote
typedef



Joined: 25 Jul 2010
Posts: 2913
Location: 0x77760000
typedef
semiono wrote:

struct+struct+struct oh my nervous!

Let the fear inside you ! Evil or Very Mad

Seriously, use the modifiers dude. Read the documentation thoroughly
Post 07 Nov 2011, 13:26
View user's profile Send private message Reply with quote
Picnic



Joined: 05 May 2007
Posts: 1288
Location: behind the arc
Picnic
semiono here are few lines that work on my 32 bit xp.
Simulating a Left Windows key keystroke that pops the Start menu.

Code:
format pe console 4.0
include "win32ax.inc"

.data
macro union [def]
{ common size@union = 0
          origin@union = $
   forward virtual
            def
            if $-origin@union > size@union
             size@union = $-origin@union
            end if
           end virtual
   common rb size@union }

struc MOUSEINPUT {
    ._dx        dd ?
    ._dy        dd ?
    .mouseData  dd ?
    .dwFlags    dd ?
    .time       dd ?
    .dwExtraInfo dd ?
    }

struc KEYBDINPUT {
    .wVk        dw 0
    .wScan      dw 0
    .dwFlags    dd 0
    .time       dd 0
    .dwExtraInfo dd 0
    }

struc HARDWAREINPUT {
    .uMsg       dd ?
    .wParamL    dw ?
    .wParamH    dw ?
    }

struc INPUT {
    .type dd ?
    union .mi MOUSEINPUT,\
            .ki KEYBDINPUT,\
            .hi HARDWAREINPUT
            }

    virtual at 0
        INPUT INPUT
        INPUT.size:
    end virtual

    inp INPUT

    define INPUT_KEYBOARD 0x1
    define VK_LWIN 0x5B
    define KEYEVENTF_KEYUP 0x02

.code
main:
        mov [inp.type], INPUT_KEYBOARD

        mov [inp.ki.wVk], VK_LWIN
        mov [inp.ki.wScan], 0
        mov [inp.ki.dwFlags], 0
        mov [inp.ki.time], 0
        mov [inp.ki.dwExtraInfo], 0
        invoke SendInput, 1, inp, INPUT.size

        mov [inp.ki.wVk], VK_LWIN
        mov [inp.ki.wScan], 0
        mov [inp.ki.dwFlags], KEYEVENTF_KEYUP
        mov [inp.ki.time], 0
        mov [inp.ki.dwExtraInfo], 0
        invoke SendInput, 1, inp, INPUT.size

        invoke ExitProcess, 0

.end main
    


p.s I'm not sure if -or how- is possible to simualte ALT+SHIFT with sendinput().
Post 07 Nov 2011, 22:34
View user's profile Send private message Reply with quote
semiono



Joined: 31 Aug 2007
Posts: 176
Location: section '.code' executable
semiono
Picnic, thank You!

revolution wrote:
I use keybd_event to send keystrokes to other windows.

True!

invoke keybd_event,VK_ESCAPE,NULL,NULL,NULL
without dancing with a tambourine!

msdn wrote:
Note This function has been superseded. Use SendInput instead.

la-la-la Smile

_________________
Memory=8388608
Post 08 Nov 2011, 00:50
View user's profile Send private message ICQ Number Reply with quote
typedef



Joined: 25 Jul 2010
Posts: 2913
Location: 0x77760000
typedef
semiono wrote:
Picnic, thank You!

revolution wrote:
I use keybd_event to send keystrokes to other windows.

True!

invoke keybd_event,VK_ESCAPE,NULL,NULL,NULL
without dancing with a tambourine!

msdn wrote:
Note This function has been superseded. Use SendInput instead.

la-la-la Smile


Note Old people have been superseded. Go to young people instead.
Post 08 Nov 2011, 02:20
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar. Also on YouTube, Twitter.

Website powered by rwasa.