News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests

Main Menu

INPUT_RECORD STRUCT

Started by TBRANSO1, February 07, 2019, 08:01:43 AM

Previous topic - Next topic

TimoVJL

Use SetConsoleMode ENABLE_MOUSE_INPUT
May the source be with you

TBRANSO1

Quote from: TimoVJL on February 09, 2019, 06:36:51 PM
Use SetConsoleMode ENABLE_MOUSE_INPUT
Hey Timo,

I think that I edited my post as you posted... see where I already attempted above.

TBRANSO1

Here is one line that I don't quite get:
If the mouse pointer is within the borders of the console window  and the window has the keyboard focus... ok what does it mean to have keyboard focus?  I bet this is the clue.  :icon_confused:

aw27

I don't know how you have defined your INPUT_RECORD, it appears you copied it from somewhere. Try like this:
INPUT_RECORD STRUCT 8
  EventType             WORD ?
  ;two_byte_alignment    WORD ? : NO!
  UNION
    KeyEvent                KEY_EVENT_RECORD            <>
    MouseEvent              MOUSE_EVENT_RECORD          <>
    WindowBufferSizeEvent   WINDOW_BUFFER_SIZE_RECORD   <>
    MenuEvent               MENU_EVENT_RECORD           <>
    FocusEvent              FOCUS_EVENT_RECORD          <>
  ENDS
INPUT_RECORD ENDS

On the console windows properties uncheck quick edit.

Then it will work:


This console was created by the CreateProcess
function with the CREATE_NEW_CONSOLE parameter.
For continuation press the Esc key. . . You clicked the left mouse button.


There are a few other things but I will not mention at this time.

PS: Few people will recommend learn 64-bit using /LARGEADDRESSAWARE:NO. This is not the way to go, in my opinion.

TBRANSO1

Thanks AW,

I had found the answer on stack overflow.  Apparently, yes the console in Windows 10 sets that quick edit check box automatically, however it can be unchecked programmatically like this:

mov edx, ENABLE_EXTENDED_FLAGS
mov ecx, hIn
call SetConsoleMode
test eax, eax
jz _FinalExit
mov edx, ENABLE_WINDOW_INPUT or ENABLE_MOUSE_INPUT
mov refMode, edx
mov edx, refMode
mov ecx, hIn
call SetConsoleMode


We have to clear all flags with ENABLE_EXTENDED_FLAGS, and set the console, then reset the console with the options that we want.

:t

I am not sure what the /LARGEADDRESSAWARE:NO does, I will look it up... I am only now starting to fumble around with 64-bt.

I guess a question arises:

If I enter a 64-bit process via WinMain (main) function, how would we set up the stack with the push rbp and create the shadow space, or just create the shadow space w/o the push rbp... does the LOCAL automatically sub an additional space for those local variables?

aw27

There are a lot of threads about that in this site, but in my opinion everybody should start with:
Introduction to x64 Assembly by  Chris Lomont
https://software.intel.com/en-us/articles/introduction-to-x64-assembly

hutch--

> I am not sure what the /LARGEADDRESSAWARE:NO does

It is required if you try to use notation that is not allowed. It effectively restricts your app to 32 bit range. The work around is to transfer data through a 64 bit register.

Things like this.

mov rax, yourbiginteger
mov var64, rax


As usual this stuff is very poorly documented.

Some mnemonics are not allowed in 64 bit, using an address as a starting offset worked fine in 32 bit but restricts you to 32 bit range if you have to turn OFF the /LARGEADDRESSAWARE option.

Mikl__

Hi, TBRANSO1!
http://masm32.com/board/index.php?topic=4190.msg54978#msg54978

TBRANSO1

Quote from: Mikl__ on February 10, 2019, 02:42:20 AM
Hi, TBRANSO1!
http://masm32.com/board/index.php?topic=4190.msg54978#msg54978

Yeah, I was scanning through your tutes,.  Since I have a project in mind now, I will need to look through those tutorials more deeply.

However, I still have no idea what your win64.inc library contains.  Can you provide a download link to it, as well as any lib files that works with it?  Do you use WASM, because no hard feelings, but I don't want to use yet another assembler or compiler.  Since, I dabble in Rust, Elixir, Nim, Ruby, Python, Crystal, D, C and C++, they all got their prefer thing, same with different IDE's recommending different compilers, jeesh. I've got compiler / assembler confusion on my system now, with copies of LLVM, CLANG, CL, GNU GCC (different versions), CYGWIN, MSYS, MASM, NASM... it gets me and my computer confused when I have to write makefiles about which f**ing thing I am using with all the different flags.  I mostly stick with GNU GCC/G++ for POSIX/*NIX stuff, MS CL for their C++ stuff, and to MASM for assembly, and use NASM for *UNIX.

I would be afraid to delete any off the system since they're probably so interlinked and I would mess things up, badly  :shock:

I just find learning all of the different syntaxes with all of the different assemblers way too much learn right now... I finally feel very comfortable with MASM and MASM32.

I finally got a firmer understanding of the stack in x64, but it is theoretical, now I have to actually do it.  I am going to do my project in x86 first, then port to x64.


Mikl__

QuoteDo you use WASM, because no hard feelings, but I don't want to use yet another assembler or compiler
Hi, TBRANSO1!
I not used WASM, I use MASM dialect. The name of the site in my signature WASM.IN -- it isn't Open Watcom Assembler or WASM (an x86 assembler produced by Watcom and included as part of the Watcom C/C++ compiler). It is Windows + ASseMbler
There are inc-files that I use in attachment

Mikl__

#25
There are lib-files that I use in attachment
Assigning inc and lib files
Inc-files are text files containing descriptions of data structures and constants of Windows, as well as macros.
Inc-files are generated by the programmer as the operating system tools are used. Similar to the header h/hpp files used when programming in C/C++, sometimes inc files can be generated from h files using the h2inc.exe utility (it can be found in old MASM packages).
The purpose of lib files is to provide link.exe with information about external links to WinAPI functions inside system dll files. A lib file is an archive that stores a set of "external character mappings" - a link to an object (COFF or PE) file. This "character" at the linking stage is either added to the executable image (in the case of COFF, from the precompiled object file), or it is written in the import table (in the case of PE). That is, a certain amount of external links is translated into your exe or dll.
link.exe handles standard COFF libraries and COFF import libraries that have the extension .lib. Standard libraries contain objects and are created using the lib.exe utility. Import libraries contain information about exporting to other programs and are created either by the compiler link.exe when building the program containing the export, or by the utility lib.exe.
The details are described here

TBRANSO1

#26
Quote from: Mikl__ on February 10, 2019, 10:27:16 AM
QuoteDo you use WASM, because no hard feelings, but I don't want to use yet another assembler or compiler
Hi, TBRANSO1!
I not used WASM, I use MASM dialect. The name of the site in my signature WASM.IN -- it isn't Open Watcom Assembler or WASM (an x86 assembler produced by Watcom and included as part of the Watcom C/C++ compiler). It is Windows + ASseMbler
There are inc-files that I use in attachment

Thanks...  :t