Inline Assembly MessageBox Problem
Posted: Wed Sep 16, 2009 1:42 pm
Greetings:
Before the PureBasic site switched over to this new format, I read a thread by either srod, Chris, El_Choni, or blueznl, I can't recall who, but I can't find it again.
My problem is that I copied the example inline assembly code from their thread into a sample program on my 64-bit Windows system, compiled it using PureBasic 4.4 Beta, and it worked perfectly.
However, I copied the same code onto my 32-bit XP system at work and it doesn't display the message box when I compile it using PureBasic 4.31. Here's the code. Can anyone recall from the past forum what's wrong with the code below? Why won't the message box appear on screen?
Like I said, it works perfectly on my 64-bit Vista system, but not on my 32-bit XP system.
Also, the following code works on my Vista system when I substitute PB variables instead of FASM variables:
Not sure what's going on here, but when I inserted a PB MessageRequester() procedure in the code to see if I could get a message box to appear, both boxes showed up on screen. This has me thoroughly baffled. Curious indeed.
Apparently, on my 32-bit XP system, something is missing that would seem to trigger the message box to appear on screen, which by including MessageRequester() seems to add the trigger mechanism. I just can't figure out what's going on here. Not sure if it has anything to do with PB version 3.1 versus 4.4 beta or Vista versus XP or something else.
Additionally, on my 32-bit XP system I can jump over the MessageRequester() procedure in order to get only the inlineASM MessageBox to appear on screen:
This is driving me crazy.
Any hints that would resolve this dilemma would be greatly appreciated--thanks in advance.
Logman
Before the PureBasic site switched over to this new format, I read a thread by either srod, Chris, El_Choni, or blueznl, I can't recall who, but I can't find it again.
My problem is that I copied the example inline assembly code from their thread into a sample program on my 64-bit Windows system, compiled it using PureBasic 4.4 Beta, and it worked perfectly.
However, I copied the same code onto my 32-bit XP system at work and it doesn't display the message box when I compile it using PureBasic 4.31. Here's the code. Can anyone recall from the past forum what's wrong with the code below? Why won't the message box appear on screen?
Code: Select all
EnableASM
DisableDebugger
! EXTRN "__imp__MessageBoxA@16" As MessageBox:dword
PUSH 1
PUSH _caption
PUSH _message
PUSH 0
CALL [MessageBox]
end
! _caption db "Win32 Assembly",0
! _message db "Hi! I am a sample program!",0
Also, the following code works on my Vista system when I substitute PB variables instead of FASM variables:
Code: Select all
EnableASM
DisableDebugger
caption.s = "Win32 Assembly"
message.s = "Hi! I am a sample program!"
! EXTRN "__imp__MessageBoxA@16" As MessageBox:dword
PUSH 1
PUSH caption
PUSH message
PUSH 0
CALL [MessageBox]
End
Code: Select all
EnableASM
DisableDebugger
caption.s = "Win32 Assembly"
message.s = "Hi! I am an example program!"
! EXTRN "__imp__MessageBoxA@16" As MessageBox:dword
PUSH 1
PUSH caption
PUSH message
PUSH 0
CALL [MessageBox]
MessageRequester(caption, message, 1)
End
Additionally, on my 32-bit XP system I can jump over the MessageRequester() procedure in order to get only the inlineASM MessageBox to appear on screen:
Code: Select all
EnableASM
DisableDebugger
caption.s = "Win32 Assembly"
message.s = "Hi! I am an example program!"
! EXTRN "__imp__MessageBoxA@16" As MessageBox:dword
PUSH 1
PUSH caption
PUSH message
PUSH 0
CALL [MessageBox]
JMP l_stop
MessageRequester(caption, message, 2)
Stop:
End

Logman