Masm32Ref idea adapted from advanced programming languages, you can add a reference to your project and use it directly, such as Visual Studio, on the Project menu choose Add reference, I wanted to make the same thing for Assembly programmers
Masm32Ref is a free Software, is intended for Assembly programmers, to extract the .INC file to direct access to COM objects and .net object, contains everything a programmer, for use directly without adding or modifying,
This work is primary, improvement, development and auditing, but this depends on the participation of everyone, because it's free and for everyoneMasm32Ref contains open source helper files plus tools to extract reference files; it also contains a utility to inject .net code within your program
The tool contains three axes:
•
Extract COM object
• Extract dot net object
• InjectorExtract COM object I will explain how to use by examples, and I propose to this example,
https://msdn.microsoft.com/en-us/library/office/ff838565.aspxIf the object name is "
Word.Application", we will replace the point "." by "_" will become the name of the object ''
Word_Application"
To get an new instance add "
New_" to the name of the object with the addition of a variable either defined or not defined
New_Word_Application _WordApplication
Then you can call any Method or Property by adding the name of the function to the name of the object
For example:
Method "Open":
Word_Documents_OpenProperty " Visible " :
Word_Application_Visible_Setto set up an event proc receiver add "
_On_" after the name of the object and add Event name
Event "Quit" :
Word_Application_On_QuitApplication:First, download the tool,and the helper (copy COMHelper.inc to \Masm32\Include)
Second, after execution Choose List Registred COM TypeLibrary
Go to :
Microsoft Word ?? Object Library , I have Microsoft Word 15.0 Object LibraryDouble Click then Choose OutPut Folder, You will get a file Word.INC
Open a new empty project , and write the following code
include word.inc
.data
_WordDocuments dd 0
_WordDocument dd 0
.code
ON_Application_Quit PROC __Inst_Obj:DWORD
invoke MessageBox,0, chr$("ON_Application_Quit"),0,0
RET
ON_Application_Quit ENDP
Start:
New_Word_Application _WordApplication
Word_Application_Visible_Set _WordApplication,TRUE
;Event : Quit
Word_Application_On_Quit _WordApplication,offset ON_Application_Quit
Word_Application_Documents_Get _WordApplication,addr _WordDocuments
Word_Documents_Open _WordDocuments,__String("d:\01.doc"),,,,,,,,,,,,,,,,addr _WordDocument
inkey
__Release _WordApplication
exit
end Start
Try it
Second example:
https://msdn.microsoft.com/en-us/library/windows/desktop/aa393960%28v=vs.85%29.aspx?f=255&MSPPError=-2147217396Microsoft WMI Scripting V1.2 Library (WbemScripting.SWbemLocator)
include WbemScripting.INC
.data
_ISWbemServices dd 0
_SWbemObjectSet dd 0
_ISWbemObject dd 0
_ISWbemPropertySet dd 0
_ISWbemProperty dd 0
_varValue VARIANT <>
.code
Start:
New_WbemScripting_SWbemLocator _SWbemLocator
WbemScripting_SWbemLocator_ConnectServer _SWbemLocator,BSTR$("."),BSTR$("root\cimv2"),0,0,0,0,0,0,addr _ISWbemServices
WbemScripting_SWbemServices_ExecQuery _ISWbemServices,BSTR$("Select * From Win32_ComputerSystem"),BSTR$("WQL"),0,0, addr _SWbemObjectSet
WbemScripting_SWbemObjectSet_ItemIndex _SWbemObjectSet,0,addr _ISWbemObject
WbemScripting_SWbemObject_Properties__Get _ISWbemObject,addr _ISWbemPropertySet
;=========================================== Name
WbemScripting_SWbemPropertySet_Item _ISWbemPropertySet,BSTR$("Name"),0,addr _ISWbemProperty
WbemScripting_SWbemProperty_Value_Get _ISWbemProperty,addr _varValue
invoke crt_wprintf,cfm$("\n Computer name :%s"),_varValue.bstrVal
;=========================================== NumberOfProcessors
WbemScripting_SWbemPropertySet_Item _ISWbemPropertySet,BSTR$("NumberOfProcessors"),0,addr _ISWbemProperty
WbemScripting_SWbemProperty_Value_Get _ISWbemProperty,addr _varValue
invoke crt_wprintf,cfm$("\n Nb Processors :%d "),_varValue.lVal
;=========================================== Workgroup
WbemScripting_SWbemPropertySet_Item _ISWbemPropertySet,BSTR$("Workgroup"),0,addr _ISWbemProperty
WbemScripting_SWbemProperty_Value_Get _ISWbemProperty,addr _varValue
invoke crt_wprintf,cfm$("\n Workgroup :%s "),_varValue.bstrVal
;=========================================== BootupState
WbemScripting_SWbemPropertySet_Item _ISWbemPropertySet,BSTR$("BootupState"),0,addr _ISWbemProperty
WbemScripting_SWbemProperty_Value_Get _ISWbemProperty,addr _varValue
invoke crt_wprintf,cfm$("\n BootupState :%s "),_varValue.bstrVal
;=========================================== DNSHostName
WbemScripting_SWbemPropertySet_Item _ISWbemPropertySet,BSTR$("DNSHostName"),0,addr _ISWbemProperty
WbemScripting_SWbemProperty_Value_Get _ISWbemProperty,addr _varValue
invoke crt_wprintf,cfm$("\n DNSHostName :%s "),_varValue.bstrVal
invoke crt_wprintf,cfm$("\n \n ")
inkey
exit
end Start
I am looking for everyone's participation to improve the tool
I will complete with .net later
To get the latest update Visit
https://sourceforge.net/projects/masm32ref/files/