flat assembler
Message board for the users of flat assembler.
Index
> Windows > Down to One Line of Code |
Author |
|
iic2 13 Aug 2008, 03:30
Well, I guest most FASM people are Drivers and OS coders, much deep about the system itself. Seem no one knows or even care about COM or standard Windows coding. Only two real related threads to be founded from day 1. Thanks anyway everybody.
|
|||
13 Aug 2008, 03:30 |
|
ManOfSteel 13 Aug 2008, 06:50
Code: cominvk psl,QueryInterface,IID_IPersistFile,ppf |
|||
13 Aug 2008, 06:50 |
|
iic2 13 Aug 2008, 08:56
Quote: cominvk psl,QueryInterface,IID_IPersistFile,ppf I must have a lot to learn... what about the IShellLink part ??? I'm not doubting you ManOfSteel it took me forever to figure out what the Fasm manual was saying. It seems there are three parameters and I thought I had to call them all separately like in the USECOM ... comcall psl,IShellLink.IUnknown.QueryInterface,\ IID_IPersistFile, [pff] mov ebx,[psl] comcall ebx,IShellLink,IUnknown,[pff] comcall ebx,IShellLink,QueryInterface,[pff] comcall ebx,IShellLink,IID_IPersistFile,[pff] ;;;;;;;;;; Example 2: lea eax, ssIShellLink push eax lea eax, IID_IPersistFile push eax push [ssIShellLink] mov edi,[ssIShellLink] mov edi,[edi] xxx call [edi+IShellLink.IUnknown.QueryInterface] would be: comcall edi,IShellLink,IUnknown comcall edi,IShellLink,QueryInterface Is what I been during here all day is ALL wrong. If so, are you sure your combination is correct. If true, I will be on it from this point. Again, Thanks ManOfSteel ... COM and macros are a trip. I never tried neither until now. comcall is has made it more than interesting to me anyway. |
|||
13 Aug 2008, 08:56 |
|
ManOfSteel 13 Aug 2008, 11:50
Define CLSIDs and other IDs with the GUID macro.
Define your interfaces with the interface macro: Code: interface IShellLink,\ QueryInterface,\ AddRef,\ Release,\ GetPath,\ ... Define 'pointers' to your interfaces (and methods): Code: psl IShellLink ppf IPersistFile ... Get a pointer to the interface you'll be using (with CoCreateInstance for example): Code: invoke CoCreateInstance,CLSID_ShellLink,0,CLSCTX_INPROC_SERVER,IID_IShellLink,psl This will fill the psl pointer from above. Now, you can use any method defined in the interface. For example, the following would query IShellLink for the IPersistFile interface and return a pointer in ppf: Code: cominvk psl,QueryInterface,IID_IPersistFile,ppf |
|||
13 Aug 2008, 11:50 |
|
iic2 13 Aug 2008, 20:59
I'll say Thanks right now because this should be my final posting to this thread about translating COM to FASM. I think i understand the bulk of it now. .. Ok, when translating:
Code: coInvoke psl,IshellLink.IUknown.QueryInterface, IID_IPersistFile, [ppf] We strip the extra variable (or) pointer [IshellLink.] because we have a pointer to it already [psl] to CALL the interface. We strip [IUknown] because it's under our Interface and is not a separate structure like under MASM. Than we call it with cominvk like so: Code: cominvk psl,QueryInterface,IID_IPersistFile, [ppf] ............................... ............................... But when I do the same thing to code below, things are difference; ShellTaskBar ItaskBarList usecome original mov ebx,[ShellTaskBar] comcall ebx,ITaskBarList,HrInit comcall ebx,ITaskBarList,AddTab,[hwnd] comcall ebx,ITaskBarList,ActivateTab,[hwnd] ...................... From ½ from your Idea: This Work no striping: comcall ShellTaskBar,ITaskBarList,HrInit comcall ShellTaskBar,ITaskBarList,AddTab,[hwnd] comcall ShellTaskBar,ITaskBarList,ActivateTab,[hwnd] ...................... This Don't Work: stripped: mov ebx,[ShellTaskBar] comcall ebx,HrInit comcall ebx,AddTab,[hwnd] comcall ebx,ActivateTab,[hwnd] ...................... This Don't Work: stripped: mov ebx,[ShellTaskBar] cominvk ebx,HrInit cominvk ebx,AddTab,[hwnd] cominvk ebx,ActivateTab,[hwnd] ...................... ...................... ShellTaskBar is ItaskBarList pointer to the interface ItaskBarList just as in your workable sample. What's going on here ? Do not using CLSID has anything to do with it ? Final Question: Code Like: CALL [edi+IShellLink.IUnknown.QueryInterface] should be: comcall edi,IShellLink.QueryInterface or cominvk edi,IShellLink.QueryInterface or CALL edi,IShellLink.QueryInterface .............................................. If this is correct. What would be some of the others ways to do it. Could you include any possible manually coding only if you have the time. Have a great day everybody Special Thanks to ManOfSteel Sorry for double post. I was here post went over there. Must be a bug or I slip this time ... Not sure. |
|||
13 Aug 2008, 20:59 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.