Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Mutex and user account

Mutex and user account

Scheduled Pinned Locked Moved C#
csharpwpfquestionlearning
6 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    MarioMARTIN
    wrote on last edited by
    #1

    Hi all! I have Windows Services and a WPF application that should share a common resource (config file). To make sure that no application is reading while another is writing I'm locking this resource with a system-wide Mutex. It doesn't work. The Mutex doesn't seem to be unique. Can it be that a Mutex is not unique if a Windows Service (running under the System account) and an WPF application (running under the user account) try to create a Mutex? thanks, MMartin

    G P 2 Replies Last reply
    0
    • M MarioMARTIN

      Hi all! I have Windows Services and a WPF application that should share a common resource (config file). To make sure that no application is reading while another is writing I'm locking this resource with a system-wide Mutex. It doesn't work. The Mutex doesn't seem to be unique. Can it be that a Mutex is not unique if a Windows Service (running under the System account) and an WPF application (running under the user account) try to create a Mutex? thanks, MMartin

      G Offline
      G Offline
      Guffa
      wrote on last edited by
      #2

      You need to use a named mutex for it to be system wide.

      --- single minded; short sighted; long gone;

      M 1 Reply Last reply
      0
      • G Guffa

        You need to use a named mutex for it to be system wide.

        --- single minded; short sighted; long gone;

        M Offline
        M Offline
        MarioMARTIN
        wrote on last edited by
        #3

        Thanks, but "I'm locking this resource with a system-wide Mutex" (=named Mutex) MMartin

        1 Reply Last reply
        0
        • M MarioMARTIN

          Hi all! I have Windows Services and a WPF application that should share a common resource (config file). To make sure that no application is reading while another is writing I'm locking this resource with a system-wide Mutex. It doesn't work. The Mutex doesn't seem to be unique. Can it be that a Mutex is not unique if a Windows Service (running under the System account) and an WPF application (running under the user account) try to create a Mutex? thanks, MMartin

          P Offline
          P Offline
          pbraun
          wrote on last edited by
          #4

          Ok, I'm not certain as to why you would be doing it that way. Have you checked the error codes or exception codes that are being generated? Is your security descriptor set up properly?

          Phil

          M 2 Replies Last reply
          0
          • P pbraun

            Ok, I'm not certain as to why you would be doing it that way. Have you checked the error codes or exception codes that are being generated? Is your security descriptor set up properly?

            Phil

            M Offline
            M Offline
            MarioMARTIN
            wrote on last edited by
            #5

            Hi, we found out that the Windows Services created a Mutex named: \BaseNamedObjects\Map_ConfigFile_Mutex while the WPF-Application (Admin = Icon in System Tray with hidden Window) creates: \Sessions\1\BaseNamedObjects\Map_ConfigFile_Mutex Any idea how I can solve this issue? Thanks, MMartin

            1 Reply Last reply
            0
            • P pbraun

              Ok, I'm not certain as to why you would be doing it that way. Have you checked the error codes or exception codes that are being generated? Is your security descriptor set up properly?

              Phil

              M Offline
              M Offline
              MarioMARTIN
              wrote on last edited by
              #6

              Problem solved: "[...] The \Sessions\1\... is created by Terminal service session (or Fast User Switching which uses terminal services). To make a Mutex global across all sessions prefix the name with 'Global\' [...]" MMartin

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups