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. Strange problems with WaitForSingleObject Windows function

Strange problems with WaitForSingleObject Windows function

Scheduled Pinned Locked Moved C#
helpsecuritysalesquestionlearning
5 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.
  • _ Offline
    _ Offline
    _Erik_
    wrote on last edited by
    #1

    I am having a really strange problem with a component designed to watch for the printer events: First of all, the component has been working like a charm for years in all of the computers in which I have tested and with several operating systems (Windows XP, Vista, 7 and 8.1), in 32 and 64 bits, and running as normal user and local admin as well. However, in the computers of my last customer (Windows 7 64 bits) it only works when running as local admin which is, of course, unacceptable. Before bothering the admins of my customer I would like to know if someone of you has any ideas about the issue, because I have to confess I am completely puzzled. Basically, the compoment starts a thread in which it invokes FindFirstPrinterChangeNotification, which returns a valid handle. Then it invokes WaitForSingleObject for that handle and here is where things get strange: in every other computer, as I said before, it receives and processes the signals perfectly, but in my customer's ones, unless run under local admin, it just stays waiting and receiving no signals no matter what the printer is doing. I mean it does nothing, not even errors. It just waits but the signal does never arrive. I have been reading through the MSDN documentation but I cannot find any plausible explanation: the printer is a local printer which prints to a file and, yes, WaitForSingleObject requires SYNCHRONIZE access right, which I think shouldn't be a big deal. I have not pasted code here because, as I said, it works like a charm in every other computer, so it must be a security configuration issue. Any ideas? Thank you very much.

    L 1 Reply Last reply
    0
    • _ _Erik_

      I am having a really strange problem with a component designed to watch for the printer events: First of all, the component has been working like a charm for years in all of the computers in which I have tested and with several operating systems (Windows XP, Vista, 7 and 8.1), in 32 and 64 bits, and running as normal user and local admin as well. However, in the computers of my last customer (Windows 7 64 bits) it only works when running as local admin which is, of course, unacceptable. Before bothering the admins of my customer I would like to know if someone of you has any ideas about the issue, because I have to confess I am completely puzzled. Basically, the compoment starts a thread in which it invokes FindFirstPrinterChangeNotification, which returns a valid handle. Then it invokes WaitForSingleObject for that handle and here is where things get strange: in every other computer, as I said before, it receives and processes the signals perfectly, but in my customer's ones, unless run under local admin, it just stays waiting and receiving no signals no matter what the printer is doing. I mean it does nothing, not even errors. It just waits but the signal does never arrive. I have been reading through the MSDN documentation but I cannot find any plausible explanation: the printer is a local printer which prints to a file and, yes, WaitForSingleObject requires SYNCHRONIZE access right, which I think shouldn't be a big deal. I have not pasted code here because, as I said, it works like a charm in every other computer, so it must be a security configuration issue. Any ideas? Thank you very much.

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      FindFirstPrinterChangeNotification queries the printer-driver. Update it, or try another printer.

      _Erik_ wrote:

      it works like a charm in every other computer

      That proves hardly anything.

      Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^]

      _ 1 Reply Last reply
      0
      • L Lost User

        FindFirstPrinterChangeNotification queries the printer-driver. Update it, or try another printer.

        _Erik_ wrote:

        it works like a charm in every other computer

        That proves hardly anything.

        Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^]

        _ Offline
        _ Offline
        _Erik_
        wrote on last edited by
        #3

        I forgot to say this in the original post, sorry for that, but the printer driver was also written by myself, that is why I am so puzzled. Anyways, testing with other printers makes no difference: it works fine everywhere I test it but in the customer's computers it does the same... nothing, not even errors... Thanks for the tip anyway, Eddy.

        P 1 Reply Last reply
        0
        • _ _Erik_

          I forgot to say this in the original post, sorry for that, but the printer driver was also written by myself, that is why I am so puzzled. Anyways, testing with other printers makes no difference: it works fine everywhere I test it but in the customer's computers it does the same... nothing, not even errors... Thanks for the tip anyway, Eddy.

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

          Their IT folks probably twiddled with some group policy settings or something. I don't know how to even begin backtracking from the behavior to which setting it might be.. maybe have a chat with the IT department and see if you can track it down from what settings they change?

          We can program with only 1's, but if all you've got are zeros, you've got nothing.

          _ 1 Reply Last reply
          0
          • P patbob

            Their IT folks probably twiddled with some group policy settings or something. I don't know how to even begin backtracking from the behavior to which setting it might be.. maybe have a chat with the IT department and see if you can track it down from what settings they change?

            We can program with only 1's, but if all you've got are zeros, you've got nothing.

            _ Offline
            _ Offline
            _Erik_
            wrote on last edited by
            #5

            Yes, I wanted to avoid bothering them, but I guess I don't have any other option. Thank you very much.

            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