flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
baldr
plaster90,
How DWORD type; can be converted to type db 1? By your definition sizeofstruct==0. Even if you place it below ip INPUT line, all-types-fit-in-byte definition won't get you right size. plaster90 wrote: I couldnt sleep because of it ![]() |
|||
![]() |
|
plaster90
all right but could you give me some working example ?
I would be grateful ![]() |
|||
![]() |
|
baldr
plaster90,
This works for me: Code: include "Win32AX.Inc" struct MOUSEINPUT dx dd ? dy dd ? mouseData dd ? dwFlags dd ? time dd ? dwExtraInfo dd ? ends struct KEYBDINPUT wVk dw ? wScan dw ? dwFlags dd ? time dd ? dwExtraInfo dd ? ends struct HARDWAREINPUT uMsg dd ? wParamL dw ? wParamH dw ? ends struct INPUT type dd ? union ki KEYBDINPUT mi MOUSEINPUT hi HARDWAREINPUT ends ends INPUT_MOUSE = 0 INPUT_KEYBOARD = 1 INPUT_HARDWARE = 2 KEYEVENTF_EXTENDEDKEY = 1 KEYEVENTF_KEYUP = 2 KEYEVENTF_UNICODE = 4 KEYEVENTF_SCANCODE = 8 .code start: invoke SendInput, lengthof.inputs, inputs, sizeof.INPUT invoke ExitProcess, 0 .data inputs: irps vk, B A L D R { INPUT INPUT_KEYBOARD, <`vk, 0, 0, 0, 0> INPUT INPUT_KEYBOARD, <`vk, 0, KEYEVENTF_KEYUP, 0, 0> } lengthof.inputs = ($-inputs)/sizeof.INPUT .end start |
|||
![]() |
|
plaster90
thx a lot:)
|
|||
![]() |
|
randomdude
dont forget that if you use:
Code: struct INPUT type dd ? union mi MOUSEINPUT ki KEYBDINPUT hi HARDWAREINPUT ends ends all values will be passed as DWORDs Code: INPUT INPUT_KEYBOARD, <wVk + wScan shl 16, 0, 0, 0, 0> INPUT INPUT_KEYBOARD, <wVk + wScan shl 16, KEYEVENTF_KEYUP, 0, 0> |
|||
![]() |
|
plaster90
baldr
works good, but is there a way to dont use macro? i'm not professional, i'm going to learn macros but this is very hard for me:( i would be gratefull if you give me this cod witout macros thanks a lot |
|||
![]() |
|
baldr
plaster90,
That irps instant macro expands as a sequence of INPUT …,<character,…> / INPUT …,<character, 0, KEYEVENTF_KEYUP,…> pairs for each given letter: Code: INPUT INPUT_KEYBOARD, <'B', 0, 0, 0, 0> INPUT INPUT_KEYBOARD, <'B', 0, KEYEVENTF_KEYUP, 0, 0> INPUT INPUT_KEYBOARD, <'A', 0, 0, 0, 0> INPUT INPUT_KEYBOARD, <'A', 0, KEYEVENTF_KEYUP, 0, 0> INPUT INPUT_KEYBOARD, <'L', 0, 0, 0, 0> INPUT INPUT_KEYBOARD, <'L', 0, KEYEVENTF_KEYUP, 0, 0> INPUT INPUT_KEYBOARD, <'D', 0, 0, 0, 0> INPUT INPUT_KEYBOARD, <'D', 0, KEYEVENTF_KEYUP, 0, 0> INPUT INPUT_KEYBOARD, <'R', 0, 0, 0, 0> INPUT INPUT_KEYBOARD, <'R', 0, KEYEVENTF_KEYUP, 0, 0> |
|||
![]() |
|
plaster90
now it's clear:)
thanks |
|||
![]() |
|
plaster90
Hi i got code to past some tekst but it doesn't fully works:(
Code: format PE GUI 4.0 entry start include 'include\win32ax.inc' struct MOUSEINPUT dx dd ? dy dd ? mouseData dd ? dwFlags dd ? time dd ? dwExtraInfo dd ? ends struct KEYBDINPUT wVk dw ? wScan dw ? dwFlags dd ? time dd ? dwExtraInfo dd ? ends struct HARDWAREINPUT uMsg dd ? wParamL dw ? wParamH dw ? ends struct INPUT type dd ? union mi MOUSEINPUT ki KEYBDINPUT hi HARDWAREINPUT ends ends start: ;invoke Sleep,7000 invoke SendInput,1, inputs1, sizeof.INPUT invoke SendInput,1, inputs2, sizeof.INPUT invoke SendInput,1, inputs3, sizeof.INPUT invoke SendInput,1, inputs4, sizeof.INPUT koniec: invoke ExitProcess,0 inputs1: INPUT 1, <VK_CONTROL, 0, 0, 0, 0> inputs2: INPUT 1, <'V', 0,0, 0, 0> inputs3: INPUT 3, <'V' 0, KEYEVENTF_KEYUP, 0, 0> inputs4: INPUT 4, <VK_CONTROL, 0,KEYEVENTF_KEYUP, 0, 0> section '.idata' import data readable writeable shareable library kernel32, 'kernel32.DLL',\ user32, 'user32.DLL' include 'include\api\kernel32.inc' include 'include\api\user32.inc' My question is why The program DOESN'T relase the key? ![]() it past tekst but CTRL KEY is still press:( |
|||
![]() |
|
plaster90
Hi i got code to past some tekst but it doesn't fully works:(
Code: format PE GUI 4.0 entry start include 'include\win32ax.inc' struct MOUSEINPUT dx dd ? dy dd ? mouseData dd ? dwFlags dd ? time dd ? dwExtraInfo dd ? ends struct KEYBDINPUT wVk dw ? wScan dw ? dwFlags dd ? time dd ? dwExtraInfo dd ? ends struct HARDWAREINPUT uMsg dd ? wParamL dw ? wParamH dw ? ends struct INPUT type dd ? union mi MOUSEINPUT ki KEYBDINPUT hi HARDWAREINPUT ends ends start: ;invoke Sleep,7000 invoke SendInput,1, inputs1, sizeof.INPUT invoke SendInput,1, inputs2, sizeof.INPUT invoke SendInput,1, inputs3, sizeof.INPUT invoke SendInput,1, inputs4, sizeof.INPUT koniec: invoke ExitProcess,0 inputs1: INPUT 1, <VK_CONTROL, 0, 0, 0, 0> inputs2: INPUT 1, <'V', 0,0, 0, 0> inputs3: INPUT 3, <'V' 0, KEYEVENTF_KEYUP, 0, 0> inputs4: INPUT 4, <VK_CONTROL, 0,KEYEVENTF_KEYUP, 0, 0> section '.idata' import data readable writeable shareable library kernel32, 'kernel32.DLL',\ user32, 'user32.DLL' include 'include\api\kernel32.inc' include 'include\api\user32.inc' My question is why The program DOESN'T relase the key?Sad it past tekst but CTRL KEY is still press:( |
|||
![]() |
|
baldr
plaster90 wrote: Hi i got code to past some tekst but it doesn't fully works:( |
|||
![]() |
|
plaster90
Sorry baldr. I pasted wrong code. There is
Inputs3: Input 1 (...) Inputs4: Input 1 (...) And i placed mi MOUSEINPUT bufor ki KEYBOARDINPUT because its correct in msdn funkcion. Where did i make a mistake? I'd like to write it exacly as msdn function. Will you help? Last edited by plaster90 on 12 Jun 2014, 09:44; edited 1 time in total |
|||
![]() |
|
plaster90
Baldr
Just one more question This is your code: Code: struct INPUT type dd ? union ki KEYBDINPUT mi MOUSEINPUT hi HARDWAREINPUT ends ends INPUT_MOUSE = 0 INPUT_KEYBOARD = 1 INPUT_HARDWARE = 2 Could you explain me why you Wrote Code: INPUT_MOUSE = 0 so first position in INPUT's struct is Code: ki KEYBDINPUT ? Sorry but I don't get it:/ I think it should be: Code: ki MOUSEINPUT mi KEYBDINPUT But This code doesnt work good. .. Thanks in advance plaster90 |
|||
![]() |
|
baldr
plaster90,
The order of the members inside the union usually doesn't matter. In stock fasm macros (Macro/Struct.Inc) there is one caveat: initializer for the union uses definition of its first member, hence if you place mi before ki, values you're providing should correspond to <dx, dy, mouseData, dwFlags, time, dwExtraInfo> respectively. Since KEYBDINPUT starts with two words, wVk and wScan, they map to the single MOUSEINPUT dword, dx (lower and higher 16 bits). Consequently, proper initialization of an INPUT structure with MOUSEINPUT first member within anonymous union should look like INPUT INPUT_KEYBOARD, <wVk+wScan shl 16, dwFlags, time, dwExtraInfo>. Order or values of INPUT_* numerical constants are completely unrelated to that. |
|||
![]() |
|
plaster90
I must study macros...
If you dont mind, Could give me a the same code sending 'baldr' and then execute MOUSEINPUT for example: Code: invoke SendInput, 1,some, sizeof. INPUT invoke SendInput, 1,some2, sizeof.INPUT (......) some: INPUT 0,<VK_CONTROL, 0,0,0,0,0> some2: INPUT 0,<VK_CONTROL, 0,KEYEVENTF_KEYUP> I would be grateful |
|||
![]() |
|
baldr
plaster90,
You're either lazy or not understanding what to do. Code: include "Win32AX.Inc" struct MOUSEINPUT dx dd ? dy dd ? mouseData dd ? dwFlags dd ? time dd ? dwExtraInfo dd ? ends struct KEYBDINPUT wVk dw ? wScan dw ? dwFlags dd ? time dd ? dwExtraInfo dd ? ends struct HARDWAREINPUT uMsg dd ? wParamL dw ? wParamH dw ? ends struct INPUT type dd ? union mi MOUSEINPUT ki KEYBDINPUT hi HARDWAREINPUT ends ends INPUT_MOUSE = 0 INPUT_KEYBOARD = 1 INPUT_HARDWARE = 2 KEYEVENTF_EXTENDEDKEY = 1 KEYEVENTF_KEYUP = 2 KEYEVENTF_UNICODE = 4 KEYEVENTF_SCANCODE = 8 MOUSEEVENTF_MOVE = 1 MOUSEEVENTF_LEFTDOWN = 2 MOUSEEVENTF_LEFTUP = 4 .code start: invoke SendInput, lengthof.inputs, inputs, sizeof.INPUT invoke ExitProcess, 0 .data inputs: INPUT INPUT_KEYBOARD, <'B'> INPUT INPUT_KEYBOARD, <'B', KEYEVENTF_KEYUP> INPUT INPUT_KEYBOARD, <'A'> INPUT INPUT_KEYBOARD, <'A', KEYEVENTF_KEYUP> INPUT INPUT_KEYBOARD, <'L'> INPUT INPUT_KEYBOARD, <'L', KEYEVENTF_KEYUP> INPUT INPUT_KEYBOARD, <'D'> INPUT INPUT_KEYBOARD, <'D', KEYEVENTF_KEYUP> INPUT INPUT_KEYBOARD, <'R'> INPUT INPUT_KEYBOARD, <'R', KEYEVENTF_KEYUP> INPUT INPUT_MOUSE, <0, 0, 0, MOUSEEVENTF_LEFTDOWN> INPUT INPUT_MOUSE, <100, 0, 0, MOUSEEVENTF_MOVE> INPUT INPUT_MOUSE, <0, 0, 0, MOUSEEVENTF_LEFTUP> lengthof.inputs = ($-inputs)/sizeof.INPUT .end start ![]() |
|||
![]() |
|
plaster90
Does anyone know how to send key to keyboard using sendinput funkction, but from this kind of bufor:
Code: bufor dd ? |
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.
Website powered by rwasa.