The MASM Forum
General => The Campus => Topic started by: bluedevil on September 24, 2022, 07:15:07 AM
-
Hello,
I have written icz tute24 in MASM64. Sources are attached.
It works on itself(which is 64 bit)
It works on 32bit apps
It doesn't work on 64bit apps
I have debugged my app and if I am not wrong the problem resides in DLL. The MouseProc function is not getting triggered if mouse is on a 64bit app?
MouseProc proc nCode:QWORD, wParam:WPARAM,lParam:LPARAM
LOCAL ms:MOUSEHOOKSTRUCT
invoke CallNextHookEx, hHook, nCode, wParam, lParam
mov rdx, lParam
mov rax, [rdx]
mov ms.pt.x, eax
shr rax, 32
mov ms.pt.y, eax
invoke WindowFromPoint, ms.pt
invoke PostMessage, hWnd, WM_MOUSEHOOK, rax, 0
xor eax, eax
ret
MouseProc endp
InstallHook proc hwnd:HWND
push hwnd
pop hWnd
invoke SetWindowsHookEx, WH_MOUSE, addr MouseProc, hInstance, 0
mov hHook, rax
ret
InstallHook endp
UninstallHook proc
invoke UnhookWindowsHookEx, hHook
ret
UninstallHook endp
Of course I have look Mikl__ example. Unfortunately I cannot assemble Mikl__ example which was posted here (https://masm32.com/board/index.php?topic=4190.msg46479#msg46479). I couldn't find mymacros.asm @Mikl__ .
-
Hi bluedevil!
look here (http://masm32.com/board/index.php?topic=4190.msg104562#msg104562)
-
Hi bluedevil!
look here (http://"https://masm32.com/board/index.php?topic=4190.msg104562#msg104562")
Mikl_ check that link.
Edit =
A short time later...
Now that works Mikl_. Thx
-
Hi swordfish!
I have corrected the link. Thank you!
-
Hi swordfish!
I have corrected the link. Thank you!
:thup:
-
bluedevil,
Try this one, Mikl__'s code is ok. I remember I just added one ";"
-
Hi bluedevi!
-
@Mikl__ thank you sharing Six_L's post (https://masm32.com/board/index.php?topic=4190.msg104562#msg104562). I have solved my problem with using MSLLHOOKSTRUCT instead of MOUSEHOOKSTRUCT. And using WH_MOUSE_LL instead of WH_MOUSE. I have attached the working sources.
@Mikl__ your executable which you shared in this reply (https://masm32.com/board/index.php?topic=10379.msg113720#msg113720) is not working.
One more question, we use data? for uninitialized section but we also say linker /SECTION:.bbs,S to use uninitialized section as shared. Bu we don't use the word .bbs. So the linker is giving this warning?
LINK : warning LNK4039: section '.bbs' specified with /SECTION option does not exist
-
bluedevil,
can you write specifically WHAT does not work in my example? I don't distribute not worked software. I value my reputation.
-
bluedevil,
can you write specifically WHAT does not work in my example? I don't distribute not worked software. I value my reputation.
I am using a Windows 10 x64 ver 21H2(OS Build 19044.2075). I have downloaded your reply (https://masm32.com/board/index.php?topic=10379.msg113720#msg113720)and learnbit's reply (https://masm32.com/board/index.php?topic=10379.msg113709#msg113709). Both executable's do not show a window, and they immediately closes down!
I have debugged your tut_24b.exe and I got this error message:
7FFE79C82B26: The instruction at 0x7FFE79C82B26 referenced memory at 0x400000. The memory could not be read -> 0000000000400000 (exc.code c0000005, tid 6232)
-
One more question, we use data? for uninitialized section but we also say linker /SECTION:.bbs,S to use uninitialized section as
maybe need ".bss,S" not ".bbs,S" for the warning:
LINK : warning LNK4039: section '.bbs' specified with /SECTION option does not exist
Seems to be a typo.
As for the window not appearing, are the resources getting compiled? The dialog box is a resource.
Post the batch file you are using to assemble with. Could help solve your issues.
-
bluedevil,
Oh, I only run it in Win7 64, and it works.
(I don't have a Windows 10 x64 ver 21H2(OS Build 19044.2075) machine yet...)
-
One more question, we use data? for uninitialized section but we also say linker /SECTION:.bbs,S to use uninitialized section as
maybe need ".bss,S" not ".bbs,S" for the warning:
LINK : warning LNK4039: section '.bbs' specified with /SECTION option does not exist
Seems to be a typo.
As for the window not appearing, are the resources getting compiled? The dialog box is a resource.
Post the batch file you are using to assemble with. Could help solve your issues.
Exactly! It is a typo, I have fixed my batch file.
-
Exactly! It is a typo, I have fixed my batch file.
So, does it work now?
Glad I could give some limited help. I'm not currently set up to run 64 bit code.
-
Exactly! It is a typo, I have fixed my batch file.
So, does it work now?
Glad I could give some limited help. I'm not currently set up to run 64 bit code.
Thank you! Yes it is working. I have now attached the sources with typo fixed batch!
-
Goes to show, don't leave anything to chance. Check for typographical errors and other simple issues when known working code doesn't work as expected. Glad you're all sorted now.