From: phdesign on
I want to customize my DllRegisterServer function and vbAdvance
(http://vb.mvps.org/tools/vbAdvance/) sounds like it would be perfect.
Unfortunately after downloading and installing, I try to register the Custom
Registration example project "DllRegisterServerSample.dll" with regsvr32 and
I get an error x0..05.

I traced the problem to the code that starts the required vb stuff, in
MRuntimeInit, line 106:

hMod = GetModuleHandle("mydll.dll")
....
pGetClass = GetProcAddress(hMod, "DllGetClassObject")
If pGetClass Then
CopyMemory pCall, InitDelegator(FD, pGetClass), 4
'Fails on next line
lRet = pCall.Call(TA.iid, IID_ClassFactory, pICF)
From: Karl E. Peterson on
phdesign wrote:
> I want to customize my DllRegisterServer function and vbAdvance
> (http://vb.mvps.org/tools/vbAdvance/) sounds like it would be perfect.
> Unfortunately after downloading and installing, I try to register the Custom
> Registration example project "DllRegisterServerSample.dll" with regsvr32 and
> I get an error x0..05.
>
> I traced the problem to the code that starts the required vb stuff, in
> MRuntimeInit, line 106:
>
> hMod = GetModuleHandle("mydll.dll")
> ...
> pGetClass = GetProcAddress(hMod, "DllGetClassObject")
> If pGetClass Then
> CopyMemory pCall, InitDelegator(FD, pGetClass), 4
> 'Fails on next line
> lRet = pCall.Call(TA.iid, IID_ClassFactory, pICF)

I've done this, although many years ago, and it worked. No way to help
in this case, given the information you've provided. I'm not even
really sure what else you might add. But what's there is incredibly
vague.

Actually, re-reading it, I'm not sure I ever did try the sample. Just
used it to build my own. Hmmmm...

Okay, I just dropped into a (administrator) command window, in Windows
7 x64, and ran regsvr32 against DllRegisterServerSample.dll, and got
this:

---------------------------
This is a standard VB MsgBox
---------------------------
You can use normal VB code in your DllRegisterServer routine.
---------------------------
OK
---------------------------

Followed by:

---------------------------
RegSvr32
---------------------------
DllRegisterServer in DllRegisterServerSample.dll succeeded.
---------------------------
[OK]
---------------------------

Running the /u option, immediately after, I get:

---------------------------
This is a standard VB MsgBox
---------------------------
You can use normal VB code in your DllUnregisterServer routine.
---------------------------
OK
---------------------------

Followed by:

---------------------------
RegSvr32
---------------------------
DllUnregisterServer in DllRegisterServerSample.dll succeeded.
---------------------------
[OK]
---------------------------

So, are you running with full admin privs, or have you somehow modified
the sample?

--
..NET: It's About Trust!
http://vfred.mvps.org