Hello!
How to make DLL with MASM7/8, with EXPORT by name and ordinal?
like: Ord: 023h, Name: SomeFunctionA
in .DEF file its:
EXPORTS FuncName
Now, how to add Ordinal value to this Export?
How to make DLL with MASM7/8, with EXPORT by name and ordinal?
like: Ord: 023h, Name: SomeFunctionA
in .DEF file its:
EXPORTS FuncName
Now, how to add Ordinal value to this Export?
MSDN
EXPORTS
definitions
The EXPORTS statement introduces a section of one or more definitions that are exported functions or data. Each definition must be on a separate line. The EXPORTS keyword can be on the same line as the first definition or on a preceding line. The .def file can contain one or more EXPORTS statements.
The syntax for export definitions is:
entryname[=internalname] [@ordinal ]
entryname is the function or variable name that you want to export. This is required. If the name you export is different from the name in the DLL, specify the export's name in the DLL with internalname. For example, if your DLL exports a function, func1() and you want it to be used as func2(), you would specify:
EXPORTS
func2=func1
@ordinal lets you specify that a number, and not the function name, will go into the DLL's export table. This can help you minimize the size of your DLL. The .LIB file will contain the mapping between the ordinal and the function, which allows you to use the function name as you normally would in projects that use the DLL.
The optional NONAME keyword allows you to export by ordinal only and reduce the size of the export table in the resulting DLL. However, if you want to use GetProcAddress on the DLL, you must know the ordinal because the name will not be valid.
The optional keyword PRIVATE prevents entryname from being placed in the import library generated by LINK. It has no effect on the export in the image also generated by LINK.
The optional keyword DATA specifies that an export is data, not code. For example, you could export a data variable as follows:
EXPORTS
i DATA
When you use PRIVATE and DATA for the same export, PRIVATE must precede DATA.
The following is an example EXPORTS section:
EXPORTS
DllCanUnloadNow @1 PRIVATE DATA
DllWindowName = Name DATA
DllGetClassObject @4 NONAME PRIVATE
DllRegisterServer @7
DllUnregisterServer
EXPORTS
definitions
The EXPORTS statement introduces a section of one or more definitions that are exported functions or data. Each definition must be on a separate line. The EXPORTS keyword can be on the same line as the first definition or on a preceding line. The .def file can contain one or more EXPORTS statements.
The syntax for export definitions is:
entryname[=internalname] [@ordinal ]
entryname is the function or variable name that you want to export. This is required. If the name you export is different from the name in the DLL, specify the export's name in the DLL with internalname. For example, if your DLL exports a function, func1() and you want it to be used as func2(), you would specify:
EXPORTS
func2=func1
@ordinal lets you specify that a number, and not the function name, will go into the DLL's export table. This can help you minimize the size of your DLL. The .LIB file will contain the mapping between the ordinal and the function, which allows you to use the function name as you normally would in projects that use the DLL.
The optional NONAME keyword allows you to export by ordinal only and reduce the size of the export table in the resulting DLL. However, if you want to use GetProcAddress on the DLL, you must know the ordinal because the name will not be valid.
The optional keyword PRIVATE prevents entryname from being placed in the import library generated by LINK. It has no effect on the export in the image also generated by LINK.
The optional keyword DATA specifies that an export is data, not code. For example, you could export a data variable as follows:
EXPORTS
i DATA
When you use PRIVATE and DATA for the same export, PRIVATE must precede DATA.
The following is an example EXPORTS section:
EXPORTS
DllCanUnloadNow @1 PRIVATE DATA
DllWindowName = Name DATA
DllGetClassObject @4 NONAME PRIVATE
DllRegisterServer @7
DllUnregisterServer