OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
 
From: Mohammad Saleem (mohammad.saleemMAMEA.SE)
Date: Mon May 27 2002 - 04:18:36 CDT

  • Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

    Hi all,

    I sent a similar question earlier to this archive and got few responses but
    still I have the same problem. May be it depends on that I did not succeed
    to explain my problem clearly.
    I try once again and hope some guru can help me to solve my problem.

    What I want is to create a service to run remotely which uses my own
    service.idl file.
    First I want to test it locally and it doesn't work.
    What I do is the following.

    1. I create just an ATL wizard projekt (with name ATLService) choosing
    "service" as type of application.
    2. Create an ATL object say Foo(Insert->New ATL Object)
    3. Remove Foo.cpp/.h from the projekt.
    4. Add my own service.idl file to projekt.
    5. Remove all occurences of CLSID_Foo and IID_Foo
    6. Edit projekt created file ATLService.cpp
    BEGIN_OBJECT_MAP(ObjectMap)
    OBJECT_ENTRY(CLSID_Foo, CFoo)
    END_OBJECT_MAP()

    to
    BEGIN_OBJECT_MAP(ObjectMap)
    OBJECT_ENTRY(CLSID_Control, CControl)
    END_OBJECT_MAP()
    where CLSID_Control DCOM class instance a client can create (defined i
    service.idl)

    7. Add my own service.idl file.
    8. Compile

    9. add dlldata.c, service_i.c,h/p_.c and again compile and link.

    10. Edit ATLService.rc file as below
    IDR_ATLCCSService1 REGISTRY MOVEABLE PURE "ATLService.rgs"
    IDR_CONTROLCOMPUTERSERVICE REGISTRY DISCARDABLE
    "ATLService.rgs"

            1 TYPELIB "Debug\Service.tlb"

    I get an ATLService.exe.

    11. I run this exe file via VC++ debugger.

    12. I run my test application and the following call succeed i.e. I get "hr
    == 0"

    hr =
             CoCreateInstance(CLSID_Control,
             NULL,
             //CLSCTX_LOCAL_SERVER,
             CLSCTX_ALL,
             IID_IUnknown,
             (VOID FAR **) &pUnk);

    and all works fine (when running DCOM locally).

    Now I want to run this ATLService.exe remotely and as service.
    First I tried to run ATLService.exe remotely as an exe and not service.
    After registering ATLService.exe (/RegServer) and *.dll on server and client
    machine.
    I run the client application I get

    hr = 80040154 (class not registered error)

    Now I tried to run as service locally.

    I did the following

    ATLService.exe /Service
     and I can see my ATLService.exe is there in Services window (adminstrative
    tools->Services)

    a. Now I click start on ATLService Service.
    b. I start my client application and I get
    hr = 80040154 (class not registered error) i.e. the same error which I got
    when I tried to run ATLService.exe remotely and which I could run
    successfully locally.

    Sure, I am missing something for registration between step 1-10.

    Plz help me to solve my problem. Now I have been working on this problem a
    couple of days without much success.

    Ask, if something is not clear.
    I am using winXP.

    thanks

    regard
    /saleem

    ----------------------------------------------------------------
    Users Guide http://discuss.microsoft.com/archives/mailfaq.asp
    contains important info. Save time, search the archives at
    http://discuss.microsoft.com/archives/index.html .
    To unsubscribe, mailto:DCOM-signoff-requestDISCUSS.MICROSOFT.COM