internal error 33 in module 35

dnadna Member Posts: 6
Hi,

I'm trying to get a custom COM DLL server working from NAV. I can successfully access to the classes contained in the DLL from a C++ application using CoInitialize and CoGetClassObject but from NAV the following error occurs :
Internal error 33 occured in module 35.
Contact your sys. admin

According to http://wiki.dynamicsbook.com/index.php?title=NAV_internal_error_messages the error message is not really helpful :
Internal Error 33 in Module 35, :: 35-33 #Err_OCX_IDispatch (Module_OCX, 33)
I googled a bit but didn't find anything useful. From older posts on this forum, this error could be related to the component registration or the exposed interfaces. I'm kind of noob with COM, something should be wrong with my DLL. If some guru here could give me some tips, it will be appreciated!

I post here my IID header, the IDL file and my registration script. If you want the full project just ask and I will upload it.
Regards


EDIT #1
I have corrected a small mistake in the registration script.
It's probably related to the interface. When browsing the server with OleView the only visible interface is IUnknown. Something is wrong with the IDL file or when making the project ?!
EDIT #2
I added the following key into the register (updated the script below). Now the interface is visible from OleView but I can't display the type information about the class (TYPE_E_CANTLOADLIBRARY). The TLB or my register entry should not be correct . Now I have two question :
1) Is it correct to set the same value (PSOAInterface CLSID) on the two key ProxyStubClsid & ProxyStubClsid32 ?
2) Is there still something to add in the register?
EDIT #3
I finally managed to get my dll server running properly. The last missing thing was the implementation of the IDispatch interface. Silly me.

IID :
#include <Windows.h>
#include <Objbase.h>
#include <InitGuid.h>

// {02FD9D9C-55D8-47D0-999D-C61D8C01BC66}
DEFINE_GUID(LIBID_Class, 
0x2fd9d9c, 0x55d8, 0x47d0, 0x99, 0x9d, 0xc6, 0x1d, 0x8c, 0x1, 0xbc, 0x66);

// {8BBBC9DB-A159-4E9D-A216-2AE8212CBFF6}
DEFINE_GUID(TYPELIB_ID, 
0x8bbbc9db, 0xa159, 0x4e9d, 0xa2, 0x16, 0x2a, 0xe8, 0x21, 0x2c, 0xbf, 0xf6);

// {DD6599C7-0684-459A-BC9D-1F236DE0759A}
DEFINE_GUID(CLSID_Class, 
0xdd6599c7, 0x684, 0x459a, 0xbc, 0x9d, 0x1f, 0x23, 0x6d, 0xe0, 0x75, 0x9a);

// {AF217BD5-27BE-4406-B695-5DF9406CA453}
DEFINE_GUID(IID_IClass, 
0xaf217bd5, 0x27be, 0x4406, 0xb6, 0x95, 0x5d, 0xf9, 0x40, 0x6c, 0xa4, 0x53);

IDL :
import "unknwn.idl";
import "oaidl.idl";
import "ocidl.idl";

[
	object,
	uuid(AF217BD5-27BE-4406-B695-5DF9406CA453),
	oleautomation,
	helpstring("IClass Interface")
]
interface IClass : IUnknown
{
	HRESULT VirtualMethod([in] int _in, [out] int *_p_out);
};

[
	uuid(8BBBC9DB-A159-4E9D-A216-2AE8212CBFF6),
	version(1.0),
	helpstring("Test 1.0 Type Library")
]
library COM_SAMPLE
{
	importlib("stdole32.tlb");
	importlib("stdole2.tlb");

	interface IClass;

	[
		uuid(DD6599C7-0684-459A-BC9D-1F236DE0759A),
		helpstring("Class - COM_SAMPLE")
	]
	coclass Class
	{
		[default] interface IClass;
	};
};

Registration :
REGEDIT

HKEY_CLASSES_ROOT\CLSID\{DD6599C7-0684-459A-BC9D-1F236DE0759A} = COM_SAMPLE.Class
HKEY_CLASSES_ROOT\CLSID\{DD6599C7-0684-459A-BC9D-1F236DE0759A}\InprocServer32 = <PATH to the dll>
HKEY_CLASSES_ROOT\CLSID\{DD6599C7-0684-459A-BC9D-1F236DE0759A}\ProgID = COM_SAMPLE.Class
HKEY_CLASSES_ROOT\CLSID\{DD6599C7-0684-459A-BC9D-1F236DE0759A}\TypeLib = {8BBBC9DB-A159-4E9D-A216-2AE8212CBFF6}

HKEY_CLASSES_ROOT\COM_SAMPLE.Class = COM_SAMPLE.Class
HKEY_CLASSES_ROOT\COM_SAMPLE.Class\CLSID = {DD6599C7-0684-459A-BC9D-1F236DE0759A}

HKEY_CLASSES_ROOT\TypeLib\{8BBBC9DB-A159-4E9D-A216-2AE8212CBFF6}
HKEY_CLASSES_ROOT\TypeLib\{8BBBC9DB-A159-4E9D-A216-2AE8212CBFF6}\1.0 = COM_SAMPLE.Class
HKEY_CLASSES_ROOT\TypeLib\{8BBBC9DB-A159-4E9D-A216-2AE8212CBFF6}\1.0\0\win32 = <PATH to the tlb>
HKEY_CLASSES_ROOT\TypeLib\{8BBBC9DB-A159-4E9D-A216-2AE8212CBFF6}\1.0\FLAGS = 0
HKEY_CLASSES_ROOT\TypeLib\{8BBBC9DB-A159-4E9D-A216-2AE8212CBFF6}\1.0\HELPDIR

HKEY_CLASSES_ROOT\Interface\{AF217BD5-27BE-4406-B695-5DF9406CA453} = IClass
HKEY_CLASSES_ROOT\Interface\{AF217BD5-27BE-4406-B695-5DF9406CA453}\ProxyStubClsid = {00000320-0000-0000-C000-000000000046}
HKEY_CLASSES_ROOT\Interface\{AF217BD5-27BE-4406-B695-5DF9406CA453}\ProxyStubClsid32 = {00000320-0000-0000-C000-000000000046}
HKEY_CLASSES_ROOT\Interface\{AF217BD5-27BE-4406-B695-5DF9406CA453}\TypeLib = {8BBBC9DB-A159-4E9D-A216-2AE8212CBFF6}
Sign In or Register to comment.