Author Topic: Radasm3 Get filename  (Read 809 times)

ragdog

  • Member
  • ****
  • Posts: 610
Radasm3 Get filename
« on: January 20, 2019, 09:29:01 PM »
Hello

For my addin need i information about the project Main.rc,main.asm etc

But the AddinData struct is this both empty

Code: [Select]
.if (uMsg==AIM_PROJECTOPENED)
invoke SendMessage,hWnd,AIM_GETDATA,NULL,NULL
mov esi,eax
invoke TextOutput, addr [esi].ADDINDATA.szMainRC
invoke TextOutput, addr [esi].ADDINDATA.szMain
invoke TextOutput, addr [esi].szMainAsm

radasm open a project in store it correctly to this structur

GetProjectFiles
Code: [Select]

invoke GetTheFileType,addr pbi.szitem
.if eax==ID_EDITCODE
invoke strcpy,addr da.szMainAsm,addr buffer
.elseif eax==ID_EDITRES
invoke strcpy,addr da.szMainRC,addr buffer
.endif
.endif

if i debug Radasm da.szMainAsm,da.szMainRC is filled with the correct filenames.

Has any an idea how i can get it?

fearless

  • Member
  • ***
  • Posts: 458
    • LetTheLightIn
Re: Radasm3 Get filename
« Reply #1 on: January 21, 2019, 12:20:37 AM »
The FlipCase addin project has an example.
It gets the pointer to the addindata during the InstallDll proc:
Code: [Select]
    ;Get pointer to data struct
    invoke SendMessage,hWin,AIM_GETDATA,0,0
    mov        lpDStruct,eax
and during the DllProc it uses this info:
Code: [Select]
                        ;Change from .tmp to .asm
                        lea        edx,[buffer+eax-3]
                        mov        dword ptr [edx],'msa'
                        mov        eax,lpDStruct
                        mov        edx,[eax].ADDINDATA.lpFile
and has a commented section showing project opened:
Code: [Select]
;    .elseif eax==AIM_PROJECTOPENED
;        ;Always return false
;        ;hWin        handle of mdi frame
;        ;lParam        pointer to ProjectFile
;        ;Added by NEMO
;        mov        eax,[lpDStruct]
;        mov        edx,(ADDINDATA ptr [eax]).lpProject
;        push    ebx
;        mov        ebx,(ADDINDATA ptr [eax]).lpFile
;        invoke lstrcpy,ebx,edx
;        invoke lstrlen,ebx
;        mov        dword ptr [ebx+eax-4],4D53412Eh
;        invoke GetFileAttributes,ebx
;        pop ebx
;        .if eax!=-1
;            ;Open the file
;            push    TRUE
;            mov        eax,[lpPStruct]
;            mov        eax,(ADDINPROCS ptr [eax]).lpOpenProjectFile
;            call    eax
;        .endif
you might have to check the values in eax and ecx you are returning at end of InstallDll to check that the correct hooks are being used, so that the RadASM knows which stuff to handle.
fearless

CM690II Case, HX1000 PSU, Asus Z97, Intel i7-4790K, Seidon 120v Cooler, 16GB DDR3, MSI GTX 980TI

My Github  Twitter

ragdog

  • Member
  • ****
  • Posts: 610
Re: Radasm3 Get filename
« Reply #2 on: January 21, 2019, 02:26:24 AM »
Hello

My problem is solved it works.
accidentally i used an older include and with a older structur. :icon_rolleyes: