CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Dec 2006
    Posts
    7

    Access to a non local directory from a windows service (C/C++)

    Hi,

    Executed from a normal program
    open("\\111.111.111.111\xyz",....
    is working corectly.

    But the same code executed in a windows service (system account) fails.
    (Errno delieveres EACCES).

    Have had anybody the same problem (and the solution) ?

    Thanks

  2. #2
    Join Date
    Nov 2003
    Posts
    1,902

    Re: Access to a non local directory from a windows service (C/C++)

    I'm not security guru - but I believe you'll need to do some sort of "client impersonation".

    http://msdn.microsoft.com/en-us/libr...90(VS.85).aspx

    gg

  3. #3
    Join Date
    Nov 2000
    Location
    Voronezh, Russia
    Posts
    6,633

    Re: Access to a non local directory from a windows service (C/C++)

    But the same code executed in a windows service (system account) fails.
    (Errno delieveres EACCES).
    No surprise, since Win2000 the LocalSystem account is deprived of network access. And the solution might be the mentioned client impersonation (or the service running some user account allowed to access that shared folder).

    But, you know what, accessing network files from service always seemed to me a sort of bad design. The enterprise-level data belong in database.
    Best regards,
    Igor

  4. #4
    Join Date
    Dec 2006
    Posts
    7

    Re: Access to a non local directory from a windows service (C/C++)

    @Igor, Codeplug
    Thanks for your help

  5. #5
    Join Date
    Jan 2005
    Location
    germany
    Posts
    160

    Re: Access to a non local directory from a windows service (C/C++)

    a share marked as "null session share" might even be accessed by a service ...

    regards
    HoM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured