Author Topic: Invoke Intellisense issue  (Read 664 times)

Raistlin

  • Member
  • ***
  • Posts: 300
Invoke Intellisense issue
« 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
Code: [Select]
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
Code: [Select]
.data?
fnWSASendMsg PFUNC_WSASENDMSG ?

Step3) We should be able to Invoke the pointer once populated in code.
Code: [Select]
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

jj2007

  • Member
  • *****
  • Posts: 8226
  • Assembler is fun ;-)
    • MasmBasic
Re: Invoke Intellisense issue
« Reply #1 on: January 10, 2018, 07:41:35 PM »
in the editor, there'll be no intellisense during the INVOKE coding.

Which editor?

Raistlin

  • Member
  • ***
  • Posts: 300
Re: Invoke Intellisense issue
« Reply #2 on: January 10, 2018, 07:43:39 PM »
@JJ2007: oops - sorry = Both RADASM and EASYCode has currently the same behavior

aw27

  • Member
  • *****
  • Posts: 1139
  • Let's Make ASM Great Again!
Re: Invoke Intellisense issue
« Reply #3 on: January 10, 2018, 08:16:03 PM »
Hi all, a slight issue that needs solving please.

Step1) A TYPEDEF PROTO with pointer is created
Code: [Select]
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
Code: [Select]
.data?
fnWSASendMsg PFUNC_WSASENDMSG ?

Step3) We should be able to Invoke the pointer once populated in code.
Code: [Select]
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

  • Member
  • ***
  • Posts: 300
Re: Invoke Intellisense issue
« Reply #4 on: January 10, 2018, 08:33:31 PM »
@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

jj2007

  • Member
  • *****
  • Posts: 8226
  • Assembler is fun ;-)
    • MasmBasic
Re: Invoke Intellisense issue
« Reply #5 on: January 10, 2018, 08:40:51 PM »
Yes, but those hang around in a fixed set of include files that an editor can scan once in a while...

aw27

  • Member
  • *****
  • Posts: 1139
  • Let's Make ASM Great Again!
Re: Invoke Intellisense issue
« Reply #6 on: January 10, 2018, 08:47:27 PM »
I feel sorry. I don't use smart editors, only the dumb ones, namely notepad++.

Raistlin

  • Member
  • ***
  • Posts: 300
Re: Invoke Intellisense issue
« Reply #7 on: January 10, 2018, 09:05:10 PM »
hmmm - thanks guys - this sux - perhaps a means to alias the existing "known" API ?

hutch--

  • Administrator
  • Member
  • ******
  • Posts: 5262
  • Mnemonic Driven API Grinder
    • The MASM32 SDK
Re: Invoke Intellisense issue
« Reply #8 on: January 10, 2018, 09:08:32 PM »
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.
hutch at movsd dot com
http://www.masm32.com    :biggrin:  :biggrin:

Raistlin

  • Member
  • ***
  • Posts: 300
Re: Invoke Intellisense issue
« Reply #9 on: January 10, 2018, 09:50:24 PM »
@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.

HSE

  • Member
  • ****
  • Posts: 638
  • <AMD>< 7-32>
Re: Invoke Intellisense issue
« Reply #10 on: January 10, 2018, 11:41:59 PM »
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)

aw27

  • Member
  • *****
  • Posts: 1139
  • Let's Make ASM Great Again!
Re: Invoke Intellisense issue
« Reply #11 on: January 11, 2018, 01:08:28 AM »
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.

Code: [Select]
.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

  • Member
  • ***
  • Posts: 300
Re: Invoke Intellisense issue
« Reply #12 on: January 11, 2018, 02:06:11 AM »
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.

HSE

  • Member
  • ****
  • Posts: 638
  • <AMD>< 7-32>
Re: Invoke Intellisense issue
« Reply #13 on: January 11, 2018, 02:20:27 AM »
that's all we can do I guess.

      You can write a revolutionary editor!  :biggrin:

ragdog

  • Member
  • ****
  • Posts: 572
Re: Invoke Intellisense issue
« Reply #14 on: January 11, 2018, 07:22:50 AM »
Quote
      You 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.