</file>
<file name="Add32.asm">
;Compiles to Add32.obj, linked to Add32.dll
;COMPILE:
; ml.exe /c /coff Add32.asm
;LINK:
; link.exe /SUBSYSTEM:WINDOWS /DLL /DEF:Add32.def Add32.obj
.486
.MODEL FLAT, STDCALL
OPTION casemap :none
INCLUDE \masm32\include\windows.inc
INCLUDE \masm32\include\user32.inc
INCLUDE \masm32\include\kernel32.inc
INCLUDE \masm32\macros\macros.asm
INCLUDELIB \masm32\lib\user32.lib
INCLUDELIB \masm32\lib\kernel32.lib
Add32 PROTO STDCALL :DWORD, :DWORD
.DATA?
hInstance dd ?
.CODE
DllMain PROC hInstDLL:DWORD, reason:DWORD, unused:DWORD
.if reason == DLL_PROCESS_ATTACH
invoke GetModuleHandle,NULL ; use the calling application's instance handle
mov hInstance, eax
mov eax,TRUE
;.elseif reason == DLL_THREAD_ATTACH
;
;.elseif reason == DLL_THREAD_DETACH
;
.elseif reason == DLL_PROCESS_DETACH
; exit code here
.endif
ret
DllMain ENDP
;this adds two 32-bit numbers and returns the sum
Add32 PROC STDCALL USES eax, dw1:DWORD, dw2:DWORD
LOCAL dwSum:DWORD
;Something missing inside this. It compiles but the VB app
;can't find the DLL.
mov eax,dw1
add eax,dw2
ret
Add32 ENDP
</file>
How do I...
(1) Add a typelib to this ?
(2) I'm using dumpbin.exe to view a simple .ocx file. They seem to
export the following:
ordinal hint RVA name
1 0 000017A6 DllCanUnloadNow
2 1 0000177A DllGetClassObject
3 2 00001790 DllRegisterServer
4 3 00001764 DllUnregisterServer
What's the proper way to Export those? When I link it I'm getting
a message that each of those should be Private. I'm guessing that I
need to find those functions somewhere so I can insert the proper
code for them. Hacking through the .ocx I created with OllyDebug
is a very slow process. There a way to get the linker to add those
items automatically?
(3) I need to add a GUID and a class name to the file as well. So
any suggestions in this regards gets a load of thanks. OCX files
seem to import a variety of things from MSVBVM60.DLL but
I'll get to that in due time once I figure out the exports and how
to handle the other things.
(4) Any and all comments, suggetions and links that might help are
appreciated.
::::-o-::::
Jim Carlock
Post replies to the group.
this is a OCX control in ASM:
http://www.japheth.de/Download/asmctrl.zip
Another way - possibly easier - is to use Biterider's OBJASM32 package,
which has OCX support included.
<code file="AsmCtrl.asm">
;identifying paths because multiple DDKs/SDKs are installed
include \masm32\include\windows.inc
include olectl.inc ;not found in the masm32\include folder, see below
include macros.inc ;included
include disphlp.inc ;included
include olecntrl.inc ;included
include debugout.inc ;included
</code>
The Win2003 DDK provides a few olectl.h files. So I'm guessing I
need to convert one of those files into an olectl.inc file. Specifically
the .Net version and XP versions are the same and the W2K version
is slightly different (not by much and I don't know exactly know the
differences). The olectl.h included with the Win2K DDK is the same
file as the one included in the w2k folder of the 2003 DDK.
And then there's the SDKs, where the XPSP2 SDK olectl.h differs
from the 2003 DDK (does Microsoft know what they're doing?)...
PSDK XPSP2 PSDKXP2\Include\OleCtl.h
07/26/2004 02:35 PM 22,388 OleCtl.h
Win2003 DDK inc\wxp\olectl.h
08/03/2004 11:59 PM 22,390 olectl.h
Have you explored these issues at all? And if so, can you offer
any enlightenment? In the mean time I'm going to mess with the
Win2k olectl.h.
Thanks, Andreas.
:: ::-o-:: ::
"Jim Carlock" wrote:
<code file="AsmCtrl.asm">
;identifying paths because multiple DDKs/SDKs are installed
include \masm32\include\windows.inc
include olectl.inc ;not found in the masm32\include folder, see below
include macros.inc ;included
include disphlp.inc ;included
include olecntrl.inc ;included
include debugout.inc ;included
</code>
Never mind, Steve put some of the other include folders in other
than the include folder. \masm32\com\include holds olectl.inc.
09/23/2000 04:47 AM 26,072 olectl.inc
Thanks, twice, Andreas.
these are old and totally outdated include files from Ernie Murphy. You
will need the ones found in