MTS Component

Hi!

Does anyone know why I have this problem:
I have made a component, with ATL and C++, just a simple ATL project with one simple object with one function without parameters. When I register this component in the Ms. Transaction Server, I get an "Abnormal Termination" or an access violation when I run the function, but if i register the component with regsvr32, it works fine.
Why is this?
I've allready got another project with several components that works fine in the MTS, but this one doesnt! (But I didn't create the project that works, so I don't know the difference between them)
Thanks!
ScattanAsked:
Who is Participating?
 
IexpertConnect With a Mentor Commented:
Mail the drwatson.log to Padraig@Brady001.iol.ie
0
 
inprasCommented:
How about some code? which can give us more light to search?
Regards
0
 
ScattanAuthor Commented:
OK, in the component project this is what the .idl file looks like:

import "oaidl.idl";
import "ocidl.idl";
      [
            object,
            uuid(13CD935D-B797-11D3-B238-00104B92E298),
            dual,
            helpstring("Itest Interface"),
            pointer_default(unique)
      ]
      interface Itest : IDispatch
      {
            [id(1), helpstring("method RunTest")] HRESULT RunTest();
      };

[
      uuid(13CD9351-B797-11D3-B238-00104B92E298),
      version(1.0),
      helpstring("testCleaner 1.0 Type Library")
]
library TESTCLEANERLib
{
      importlib("stdole32.tlb");
      importlib("stdole2.tlb");

      [
            uuid(13CD935E-B797-11D3-B238-00104B92E298),
            helpstring("test Class")
      ]
      coclass test
      {
            [default] interface Itest;
      };
};

And this is what the function looks like:

STDMETHODIMP Ctest::RunTest()
{
      Beep(1000,1000);

      return S_OK;
}

The test-class is declared like this:
class ATL_NO_VTABLE Ctest :
      public CComObjectRootEx<CComSingleThreadModel>,
      public CComCoClass<Ctest, &CLSID_test>,
      public IDispatchImpl<Itest, &IID_Itest, &LIBID_TESTCLEANERLib>

(Its all generated by the wizard)

When I use the object I do like this in the test-application:

   ::CoInitialize(NULL);

    CLSID clsID;
    CComBSTR str("TestCleaner.test");
    CLSIDFromProgID(str,&clsID);

     IUnknown* pUnk;
    if (CoCreateInstance(clsID, NULL, CLSCTX_ALL, IID_IUnknown,  (LPVOID *)&pUnk) != S_OK)
      return S_FALSE;

     Itest* t;
     if (pUnk->QueryInterface(IID_IDispatch, (LPVOID *)&t) != S_OK)
            return S_FALSE;

       if (t->RunTest() != S_OK)
             cout<< "fel";
      
       t->Release();

(After importing TestCleaner.dll)

This works as long as I  don't use the transaction server.
When I create the project, it doesn't matter if I check "Support MTS" or not, there is still the same problem.
Is this the part of the code you need to see or should I give you something else?
Thanks for trying to help!

0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
IexpertCommented:
You need to link in the following

mtx.lib mtxguid.lib

i.e. add these 2 libs to the list @
Project settings/Link tab/General Category/Obj/lib modules


For efficiency also add the following to the list:
  delayimp.lib
and the following switch to the end of the project options
text box in the link tab:
  /delayload:mtxex.dll

Note should also do following after a build
and before using MTS components in MTS.
Execute MTXREREG.exe to refresh all components
registered on your computer. This is the command-line
version of the Refresh Components option that you can
access by right-clicking on a selected package.
0
 
ScattanAuthor Commented:
Thanks, but all that is allready done.
All the .libs and .dlls you suggested are included in the project, so the problem is something else.

There is an error log generated in drwtsn32.log, but I really don't know how to read it.
It says something about the function ZwReplyWaitReceivePort and NtDelayExecution, and the last executions before logging the error are these:
227 mmc.exe
 485 mtx.exe
 453 CMD.exe
  74 RunTestCleaner.exe   //my test-app
 483 mtx.exe
 436 DRWTSN32.exe
   0 _Total.exe


Thanks anyway.
Other suggestions?
0
 
GlennDeanCommented:

>It says something about the function ZwReplyWaitReceivePort

"Zw" functions are part of the kernel so there's something seriously wrong - don't know what.
 Glenn
0
 
ScattanAuthor Commented:
Thanks!
0
All Courses

From novice to tech pro — start learning today.