DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: Access to DirectDraw Objects

  1. #1
    Sheela Guest

    Access to DirectDraw Objects


    Hi,

    I am using DirectX 7 (DirectDraw only) on Win2000 in a DLL. A service which
    uses the DLL is started automatically using the 'Local System account' on
    startup. One or more instances of an application using the same DLL may be
    started later. When an application is started later, it fails to initialize
    and it fails with a 0xC0000142 error. If I comment out the DirectDraw object
    (DirectDrawCreateEx (NULL, (void **) &ddObj, IID_IDirectDraw7, NULL)) creation,
    everything works fine. I assume the problem is because of differing Security
    Contexts. I am logged in as an Administrator. When I change the 'Log On'
    account of the service from a 'Local System account' to an 'Administrator'
    account, everything works fine.

    Given that DirectDraw object are COM objects, I thought I would try and use
    CoInitializeSecurity () to allow access to everybody (similar to creating
    a
    NULL DACL for other objects) in both the service application and my application.
    I found out that I couldn't use this in a DLL. However, that didn't help.
    Following is the code snippet that I used.

    SECURITY_ATTRIBUTES sa;
    SECURITY_DESCRIPTOR sd;

    sa.nLength = sizeof (SECURITY_ATTRIBUTES);
    sa.lpSecurityDescriptor = &sd; // NULL Dacl, initialized before this
    // assignment
    sa.bInheritHandle = TRUE; // Child process can inherit

    CoInitialize ();
    ret = CoInitializeSecurity (
    &sa,
    -1,
    NULL,
    NULL,
    RPC_C_AUTHN_LEVEL_NONE,
    RPC_C_IMP_LEVEL_DEFAULT,
    NULL,
    EOAC_ANY_AUTHORITY,
    NULL);

    I also tried using dcomcnfg, but that didn't help. Since I am new to COM
    and to Security in general, I am not sure if I am doing the right thing.
    Also,I am not sure if I am correct in my assuming that I can use COM security
    functions as DirectDraw objects are COM objects. I hope there is some solution
    to this problem. Any help is greatly appreciated.

    Thanks,
    Sheela.


  2. #2
    Michael Howard Guest

    Re: Access to DirectDraw Objects


    hhhmmm - audit for object access - and see what transpires in the audit event
    logs. also, can you send the code for building the SD?

    "Sheela" <Sheela_Kashyap@yahoo.com> wrote:
    >
    >Hi,
    >
    >I am using DirectX 7 (DirectDraw only) on Win2000 in a DLL. A service which
    >uses the DLL is started automatically using the 'Local System account' on
    >startup. One or more instances of an application using the same DLL may

    be
    >started later. When an application is started later, it fails to initialize
    >and it fails with a 0xC0000142 error. If I comment out the DirectDraw object
    >(DirectDrawCreateEx (NULL, (void **) &ddObj, IID_IDirectDraw7, NULL)) creation,
    >everything works fine. I assume the problem is because of differing Security
    >Contexts. I am logged in as an Administrator. When I change the 'Log On'
    >account of the service from a 'Local System account' to an 'Administrator'
    >account, everything works fine.
    >
    >Given that DirectDraw object are COM objects, I thought I would try and

    use
    >CoInitializeSecurity () to allow access to everybody (similar to creating
    >a
    >NULL DACL for other objects) in both the service application and my application.
    >I found out that I couldn't use this in a DLL. However, that didn't help.
    >Following is the code snippet that I used.
    >
    >SECURITY_ATTRIBUTES sa;
    >SECURITY_DESCRIPTOR sd;
    >
    >sa.nLength = sizeof (SECURITY_ATTRIBUTES);
    >sa.lpSecurityDescriptor = &sd; // NULL Dacl, initialized before this
    > // assignment
    >sa.bInheritHandle = TRUE; // Child process can inherit
    >
    >CoInitialize ();
    >ret = CoInitializeSecurity (
    > &sa,
    > -1,
    > NULL,
    > NULL,
    > RPC_C_AUTHN_LEVEL_NONE,
    > RPC_C_IMP_LEVEL_DEFAULT,
    > NULL,
    > EOAC_ANY_AUTHORITY,
    > NULL);
    >
    >I also tried using dcomcnfg, but that didn't help. Since I am new to COM
    >and to Security in general, I am not sure if I am doing the right thing.
    >Also,I am not sure if I am correct in my assuming that I can use COM security
    >functions as DirectDraw objects are COM objects. I hope there is some solution
    >to this problem. Any help is greatly appreciated.
    >
    >Thanks,
    >Sheela.
    >



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center