News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

Invoke Intellisense issue

Started by Raistlin, January 10, 2018, 07:31:30 PM

Previous topic - Next topic

Raistlin

Hi all, a slight issue that needs solving please.

Step1) A TYPEDEF PROTO with pointer is created
ZLPFN_WSASENDMSG TYPEDEF PROTO s:DWORD,lpMsg:DWORD,dwFlags:DWORD,lpNumberOfBytesSent:DWORD,lpOverlapped:DWORD
PFUNC_WSASENDMSG TYPEDEF PTR ZLPFN_WSASENDMSG


Step2) A Data variable is assigned as pointer to the typedef
.data?
fnWSASendMsg PFUNC_WSASENDMSG ?


Step3) We should be able to Invoke the pointer once populated in code.
invoke fnWSASendMsg,.......

Unfortunately - in the editor, there'll be no intellisense during the INVOKE coding.
Is there a workaround, perhaps using ASSUME or something?

Thanks
Raistlin
Are you pondering what I'm pondering? It's time to take over the world ! - let's use ASSEMBLY...

jj2007

Quote from: Raistlin on January 10, 2018, 07:31:30 PMin the editor, there'll be no intellisense during the INVOKE coding.

Which editor?

Raistlin

@JJ2007: oops - sorry = Both RADASM and EASYCode has currently the same behavior
Are you pondering what I'm pondering? It's time to take over the world ! - let's use ASSEMBLY...

aw27

Quote from: Raistlin on January 10, 2018, 07:31:30 PM
Hi all, a slight issue that needs solving please.

Step1) A TYPEDEF PROTO with pointer is created
ZLPFN_WSASENDMSG TYPEDEF PROTO s:DWORD,lpMsg:DWORD,dwFlags:DWORD,lpNumberOfBytesSent:DWORD,lpOverlapped:DWORD
PFUNC_WSASENDMSG TYPEDEF PTR ZLPFN_WSASENDMSG


Step2) A Data variable is assigned as pointer to the typedef
.data?
fnWSASendMsg PFUNC_WSASENDMSG ?


Step3) We should be able to Invoke the pointer once populated in code.
invoke fnWSASendMsg,.......

Unfortunately - in the editor, there'll be no intellisense during the INVOKE coding.
Is there a workaround, perhaps using ASSUME or something?

Thanks
Raistlin

Something like this?

mov r10, fnWSASendMsg
assume r10 : PFUNC_WSASENDMSG
invoke r10, ....

Raistlin

@aw27 - Thanks, but unfortunately still nothing.. problem persists

It just seems strange that we have the PROTOs (code in first post), so why does the editor not cross reference,
it does so easily on everything else re: standard PROTO, STRUCT, winapi
Are you pondering what I'm pondering? It's time to take over the world ! - let's use ASSEMBLY...

jj2007

Yes, but those hang around in a fixed set of include files that an editor can scan once in a while...

aw27

I feel sorry. I don't use smart editors, only the dumb ones, namely notepad++.

Raistlin

hmmm - thanks guys - this sux - perhaps a means to alias the existing "known" API ?
Are you pondering what I'm pondering? It's time to take over the world ! - let's use ASSEMBLY...

hutch--

Rudi,

There are a pair of macros in the 32 bit macro file, SPROTO and CPROTO that are designed for the task you have in mind.

Raistlin

@hutch : thanx, that's indeed a quicker way to create the TYPEDEF's and assign a variable  :t
              but still does'nt solve my editor problems. I've tested the invokes on pointer variable (per above code) and
              at least the assembler is doing the parameter checking. Just not showing up in the editors' Intellisense during coding.
Are you pondering what I'm pondering? It's time to take over the world ! - let's use ASSEMBLY...

HSE

I think there is no issue. Intellisense is not in the code.
You have to declare the procedure in some winxxx.api file (in EasyCode is ApiCalls.txt)
Equations in Assembly: SmplMath

aw27

If I am seeing well the movie, Raistlin wants to over the mouse on the invoke instruction and see where the call will be done. We have here a supplementary level of indirection and the smart editors may be choking at that.
An alternative will be to transform the indirect call in a direct call. For that we need a READ/WRITE/EXECUTE code segment and some old days flavour programming.


.386
.model flat, stdcall 
option casemap :none 

includelib \masm32\lib\msvcrt.lib
printf proto C :ptr, :vararg

_printf typedef proto C :ptr, :vararg
_pprintf TYPEDEF ptr _printf

_DATA SEGMENT PUBLIC 'DATA'
    msg db "This year is: %d",0Ah,0
_DATA ENDS

_BSS SEGMENT PARA PUBLIC 'BSS'
pprintf _pprintf ?
_BSS ends

_TEXT1 SEGMENT PARA PUBLIC READ WRITE EXECUTE 'CODE'

start:
mov eax, offset printf
mov pprintf, eax
; ...
push 2018
push offset msg
mov eax, pprintf
sub eax, offset _offlbl
mov _off, eax
db 0e8h
_off dd ?
_offlbl:
add esp, 8
ret
end start

_TEXT1 ends


Even with this I am not sure the smart editors will figure it out, they probably have things cached somewhere and will not update in real time.

Raistlin

WOW, that takes me back 25 years.
But yes, just "temporarily" editing the
editor API reference files seems to work OK.
Not ideal, but that's all we can do I guess.
Are you pondering what I'm pondering? It's time to take over the world ! - let's use ASSEMBLY...

HSE

Quote from: Raistlin on January 11, 2018, 02:06:11 AM
that's all we can do I guess.

      You can write a revolutionary editor!  :biggrin:
Equations in Assembly: SmplMath

ragdog

QuoteYou can write a revolutionary editor!

Not easy look on Winasm since open source not any updateor Radasm too.
But i use Radasm and i think is the best asm editor.