News:

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

Main Menu

is there any way.....?

Started by shaikkareem, October 13, 2014, 03:29:40 PM

Previous topic - Next topic

shaikkareem

hello again.,
the retyping com style prototypes of com or shell interface methods in masm style is really annoying right now. here manually searching for the specific COM's or SHELL interface definitions and their methods definitions (prototypes) and then typing masm style prototypes include it in my prog is really huge time consuming thing...is there any tool or utility to create the masm style method prototypes include file from sdk's idl or .h files,i want to use those generated include file for com.

I've checked the 'ToutEnMasm' translate tool and his DumpBin_tool_for_decorated_proto tools, i didn't find the description of how to use them,,,, i really want to know is these tools are meant to my kind of situation or not. if yes then need a complete description about using of them to my situation and for others..in his one of tools the .sdk files for what they relate to...

jj2007

Try this plugin for qEditor. Let me know what's missing, maybe I'll find time to add it. But you need to supply some good examples what you mean.

shaikkareem

thanks...jj2007
it is a good that it converts c style structure in masm style structure as bellow:
typedef struct IPersistFileVtbl
    {
        BEGIN_INTERFACE
       
        HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
            __RPC__in IPersistFile * This,
            /* [in] */ __RPC__in REFIID riid,
            /* [annotation][iid_is][out] */
            __RPC__deref_out  void **ppvObject);
       
        ULONG ( STDMETHODCALLTYPE *AddRef )(
            __RPC__in IPersistFile * This);
       
        ULONG ( STDMETHODCALLTYPE *Release )(
            __RPC__in IPersistFile * This);
       
        HRESULT ( STDMETHODCALLTYPE *GetClassID )(
            __RPC__in IPersistFile * This,
            /* [out] */ __RPC__out CLSID *pClassID);
       
        HRESULT ( STDMETHODCALLTYPE *IsDirty )(
            __RPC__in IPersistFile * This);
       
        HRESULT ( STDMETHODCALLTYPE *Load )(
            __RPC__in IPersistFile * This,
            /* [in] */ __RPC__in LPCOLESTR pszFileName,
            /* [in] */ DWORD dwMode);
       
        HRESULT ( STDMETHODCALLTYPE *Save )(
            __RPC__in IPersistFile * This,
            /* [unique][in] */ __RPC__in_opt LPCOLESTR pszFileName,
            /* [in] */ BOOL fRemember);
       
        HRESULT ( STDMETHODCALLTYPE *SaveCompleted )(
            __RPC__in IPersistFile * This,
            /* [unique][in] */ __RPC__in_opt LPCOLESTR pszFileName);
       
        HRESULT ( STDMETHODCALLTYPE *GetCurFile )(
            __RPC__in IPersistFile * This,
            /* [out] */ __RPC__deref_out_opt LPOLESTR *ppszFileName);
       
        END_INTERFACE
    } IPersistFileVtbl;

as:

IPersistFileVtbl STRUCT
HRESULT      BEGIN_INTERFACE <>
IPersistFile   __RPC__in <>
   ;/* [in] */ __RPC__in REFIID riid,
   ;/* [annotation][iid_is][out] */
void         __RPC__deref_out <>
STDMETHODCALLTYPE   ULONG ?
IPersistFile   __RPC__in <>
STDMETHODCALLTYPE   ULONG ?
IPersistFile   __RPC__in <>
STDMETHODCALLTYPE   HRESULT <>
IPersistFile   __RPC__in <>
   ;/* [out] */ __RPC__out CLSID *pClassID);
STDMETHODCALLTYPE   HRESULT <>
IPersistFile   __RPC__in <>
STDMETHODCALLTYPE   HRESULT <>
IPersistFile   __RPC__in <>
   ;/* [in] */ __RPC__in LPCOLESTR pszFileName,
   ;/* [in] */ DWORD dwMode);
STDMETHODCALLTYPE   HRESULT <>
IPersistFile   __RPC__in <>
   ;/* [unique][in] */ __RPC__in_opt LPCOLESTR pszFileName,
   ;/* [in] */ BOOL fRemember);
STDMETHODCALLTYPE   HRESULT <>
IPersistFile   __RPC__in <>
   ;/* [unique][in] */ __RPC__in_opt LPCOLESTR pszFileName);
STDMETHODCALLTYPE   HRESULT <>
IPersistFile   __RPC__in <>
   ;/* [out] */ __RPC__deref_out_opt LPOLESTR *ppszFileName);
}            END_INTERFACE <>
IPersistFileVtbl ENDS



as matter of fact i really unable to understand the transforming methods you used to replace the elements in c struct into masm struct....though it is very helpful to me while programming in COM,
now the actual problem is ,besides it, when in COM calling an object's interface method needs a pointer to that interface(lets say ipersistfile that interface). your tool is helpful in to tell the masm compiler that the retrieved pointer(of ipersistfile) maps to that struct (generated by your tool in masm style as above).after it when comes to calling to functions in that interface needs pointers to that methods,by default the struct members contains the pointers to corresponding code block.Now to invoke them from the pointers we need the prototypes of the corresponding functions as masm compiler says...
so here the time consuming thing is finding them on msdn for their definition and creating there prototypes in masm styles is annoying...
lets say about IUnknown interface its idl file defines its definition as bellow...

HRESULT QueryInterface(
        [in] REFIID riid,
        [out, iid_is(riid), annotation("__RPC__deref_out")] void **ppvObject);
    ULONG AddRef();
    ULONG Release();

f1 typedef proto stdcall :dword, :dword, :dword
fpquery typedef ptr f1

f2 typedef proto stdcall
fpaddr typedef ptr f2

f3 typedef proto stdcall
fprel typedef ptr f3

in the data section i declare the variables in corresponding prototyps

QueryInterface fquery ?
AddRef fpaddr ?
Release fprel ?

i have to do like this for every interface that i willing to use in my code...
that why i need a solution to it..

TouEnMasm

The IPersistFile is in the translated sdk 8.1 (objidl.sdk)
download it with the crt files
put your path in the  envirronement variables "include=......;X:\...;"

Next,you create :
ppvIPersistFile dd 0 ;pointer on the IPersistFile Interface

You call cocreateinstance (or another fonction if msdn say it is another) to get this pointger.
Now  (with a ppvIPersistFile not NULL)you can use the macro
The IPersistFile macro replace the invoke and you use the function of the Interface as API


IPersistFile Load, param1,param2         ;the this=ppvIPersistFile is given by the macro (comethod 3)


The help on how use the translator is in the package.Must be a readme.rtf file or something else.
The name is given in the post where you have dowloaded it.It is in bold in the post.

The translated SDK can be downlod here.

http://masm32.com/board/index.php?topic=563.msg4563#msg4563

read the post and you will know all is needed to use it.


more details:

_APISET_MMISC_VER equ 102h ;> 101h you have WINDOOWS 8.1
include sdk32.inc
include objidl.sdk
NDIS_SUPPORT_NDIS6 equ 0


Fa is a musical note to play with CL

Zen

SHAIKKAREEM,
Quote...manually searching for the specific COM's or SHELL interface definitions and their methods definitions (prototypes) and then typing masm style prototypes include it in my prog is really huge time consuming thing,...
I have had the same problem. It really depends on the syntax that you want for your COM interface definitions. I've noticed that most of the MASM structure definitions that correspond to COM interfaces are of the form:

comethod1Proto      typedef proto :DWORD
comethod2Proto      typedef proto :DWORD, :DWORD
comethod3Proto      typedef proto :DWORD, :DWORD, :DWORD
comethod4Proto      typedef proto :DWORD, :DWORD, :DWORD, :DWORD
comethod5Proto      typedef proto :DWORD, :DWORD, :DWORD, :DWORD, :DWORD
comethod6Proto      typedef proto :DWORD, :DWORD, :DWORD, :DWORD, :DWORD,    :DWORD
comethod7Proto      typedef proto :DWORD, :DWORD, :DWORD, :DWORD, :DWORD,    :DWORD, :DWORD
comethod8Proto      typedef proto :DWORD, :DWORD, :DWORD, :DWORD, :DWORD,    :DWORD, :DWORD, :DWORD
comethod9Proto      typedef proto :DWORD, :DWORD, :DWORD, :DWORD, :DWORD,    :DWORD, :DWORD, :DWORD, :DWORD
comethod10Proto     typedef proto :DWORD, :DWORD, :DWORD, :DWORD, :DWORD,    :DWORD, :DWORD, :DWORD, :DWORD, :DWORD
comethod11Proto     typedef proto :DWORD, :DWORD, :DWORD, :DWORD, :DWORD,    :DWORD, :DWORD, :DWORD, :DWORD, :DWORD,    :DWORD
comethod12Proto     typedef proto :DWORD, :DWORD, :DWORD, :DWORD, :DWORD,    :DWORD, :DWORD, :DWORD, :DWORD, :DWORD,    :DWORD, :DWORD
comethod13Proto     typedef proto :DWORD, :DWORD, :DWORD, :DWORD, :DWORD,    :DWORD, :DWORD, :DWORD, :DWORD, :DWORD,    :DWORD, :DWORD, :DWORD
comethod14Proto     typedef proto :DWORD, :DWORD, :DWORD, :DWORD, :DWORD,    :DWORD, :DWORD, :DWORD, :DWORD, :DWORD,    :DWORD, :DWORD, :DWORD, :DWORD
comethod15Proto     typedef proto :DWORD, :DWORD, :DWORD, :DWORD, :DWORD,    :DWORD, :DWORD, :DWORD, :DWORD, :DWORD,    :DWORD, :DWORD, :DWORD, :DWORD, :DWORD
comethod16Proto     typedef proto :DWORD, :DWORD, :DWORD, :DWORD, :DWORD,    :DWORD, :DWORD, :DWORD, :DWORD, :DWORD,    :DWORD, :DWORD, :DWORD, :DWORD, :DWORD,    :DWORD
comethod17Proto     typedef proto :DWORD, :DWORD, :DWORD, :DWORD, :DWORD,    :DWORD, :DWORD, :DWORD, :DWORD, :DWORD,    :DWORD, :DWORD, :DWORD, :DWORD, :DWORD,    :DWORD, :DWORD
comethod18Proto     typedef proto :DWORD, :DWORD, :DWORD, :DWORD, :DWORD,    :DWORD, :DWORD, :DWORD, :DWORD, :DWORD,    :DWORD, :DWORD, :DWORD, :DWORD, :DWORD,    :DWORD, :DWORD, :DWORD
comethod19Proto     typedef proto :DWORD, :DWORD, :DWORD, :DWORD, :DWORD,    :DWORD, :DWORD, :DWORD, :DWORD, :DWORD,    :DWORD, :DWORD, :DWORD, :DWORD, :DWORD,    :DWORD, :DWORD, :DWORD, :DWORD
comethod20Proto     typedef proto :DWORD, :DWORD, :DWORD, :DWORD, :DWORD,    :DWORD, :DWORD, :DWORD, :DWORD, :DWORD,    :DWORD, :DWORD, :DWORD, :DWORD, :DWORD,    :DWORD, :DWORD, :DWORD, :DWORD, :DWORD

comethod1           typedef ptr comethod1Proto
comethod2           typedef ptr comethod2Proto
comethod3           typedef ptr comethod3Proto
comethod4           typedef ptr comethod4Proto
comethod5           typedef ptr comethod5Proto
comethod6           typedef ptr comethod6Proto
comethod7           typedef ptr comethod7Proto
comethod8           typedef ptr comethod8Proto
comethod9           typedef ptr comethod9Proto
comethod10          typedef ptr comethod10Proto
comethod11          typedef ptr comethod11Proto
comethod12          typedef ptr comethod12Proto
comethod13          typedef ptr comethod13Proto
comethod14          typedef ptr comethod14Proto
comethod15          typedef ptr comethod15Proto
comethod16          typedef ptr comethod16Proto
comethod17          typedef ptr comethod17Proto
comethod18          typedef ptr comethod18Proto
comethod19          typedef ptr comethod19Proto
comethod20          typedef ptr comethod20Proto


This actually works, and most of the COM code you see here on the MASM Forum uses this basic format, or a variant of it, because it's relatively quick and easy.
...Clearly, this can be improved upon,...it's not really foolproof,...

shaikkareem

thanks zen and toutenmasm , here while including the file as

include sdk32.inc
include objidl.sdk
at the compile time the error message is indicating that cannot open file. i really tried to set the system environment variable(path variable) as you said, but no use ..
now what to do.....

actually you posted as "With it you need also the crt header (vc++ 2008)" is these headers are necessary....

Quote
put your path in the  envirronement variables "include=......;X:\...;"

how and which environment variable has to set to be searchable by ml compiler....

TouEnMasm

in a batch file
SET INCLUDE=c:\sdkrc81\um;c:\sdkrc81\shared;c:\VC
If you use another disk,change c:

or ml OPtions
Quote
/I<name> Add include path   

Or an IDE who accept include path  (search in the help of the IDE)
Fa is a musical note to play with CL

shaikkareem

ToutEnMasm....your translated sdk files are good but after included them from ml /I option some sdk files in vc dir got errors as shown by cmd as below:

x:\sdkrc81\vc\stdlib.sdk(326):error a2008 :syntax error :_Int64
x:\sdkrc81\vc\stdlib.sdk(327):error a2008 :syntax error :PROTO
x:\sdkrc81\vc\stdlib.sdk(574):error a2008 :syntax error :_onexit_t

x:\sdkrc81\um\winioctl.sdk(2388): fatal error A1016 : Internel Assebler Error

besides them for com i need uuids as you know but your provided uuids.sdk file after including showing lots of compiler time errors,so where did you defined them. actually i observed them myself in uuids.sdk file there are no enough GUIDS corresponding to both interfaces and classes of COM...as you mentioned in the file "Contains the GUIDs for the MediaType type, subtype fields and format
types for standard media types, and also class ids for well-known components."

and also
if i don't include \masm32\macros\macro.asm the macros used in my program are also giving errors and if i included that file them its also giving errors...so what kind of situation is i'm in...give me description....steps..to follow..

TouEnMasm

The "x:\sdkrc81\vc\stdlib.sdk(326):error a2008 :syntax error :_Int64"
Those error are a bad path in the ml /I path,bad write or missing.

The internal error of ml couldn't be solve.
Use jwasm instead, he is better and do not those errors.

Here is a batch file to made a test,he just show a message
Modify it until successful compile.
I have put JWASM in vc++ bin directory.

You need to learn what is an envirronement and what are PATH ,INCLUDE and some other environnement variables.
http://technet.microsoft.com/en-us/library/bb490869.aspx

Fa is a musical note to play with CL

shaikkareem

QuoteThose error are a bad path in the ml /I path,bad write or missing.
here what i did at ml stage :

"\masm32\bin\ml /I x:\sdkrc81\um /I x:\sdkrc81\shared /I:\sdkrc81\vc /c /coff shellink.asm "

if i really did not use the command correctly i'm sorry about that... :(
will accept good directions from you...

yes...as you said i really need this time to overtake the environment variables and .bat(batch files). I found so many websites which are not taking me too deep in that environment thing...hope you know few others.....clearly explained...

TouEnMasm

Download jwasm http://www.japheth.de/JWasm.html version 2.12pre for windows.
Now use the batch.
If you haven't the vc++ express,you need to SET PATH in the batch

masm32\bin\ml /I x:\sdkrc81\um /I x:\sdkrc81\shared /I:X\sdkrc81\vc /c /coff shellink.asm

Fa is a musical note to play with CL