0

I am trying to make a Windows Service Client that connects to a Server in c++. The server is not a service and both, the Client and the Server are written in c++ using winsock. The goal is to enumerate the connected devices on the Client Service and send it to the Server and print it there. I am able to send messages between the two and print it out but whenever I try to do it for this it doesn't work.

I have narrowed it down to when I try to get the size of the list generated from GetRawInputDevices() it returns nothing (0). I am assuming this is the size it its reading, which is incorrect, because when I try to do this outside of the service it prints out 5 or 6 devices.

I found a few things online saying that this is not possible but they were old threads and they didnt really give any reasoning behind why. I also do not see why this isnt possible.

Does anyone know if this is possible? If so, any suggestions on what needs to be done differently from just enumerating the list from a non-service client? and if not, what makes this different?

I can post the code if need be.

TOESTER
  • 11
  • 3
  • A service runs in a non-interactive session that can't receive user input, so it makes sense that user input devices are not available to enumeration. Even if they were, the service can't receive the `WM_INPUT` window message from them, as window messages can't cross session boundaries – Remy Lebeau Jan 18 '18 at 16:08
  • Is there anyway that you know to make it so it can enumerate? Also, I am able to print out all of the running processes, how does that differ from devices? – TOESTER Jan 18 '18 at 16:11
  • Would this be the same for accessing/editing registry information? – TOESTER Jan 18 '18 at 19:37
  • processes and input devices are two completely different things. A service can access processes and the Registry, but it might not make sense for a service to access an input device (at least not via the Raw Input API). Try enumerating devices another way – Remy Lebeau Jan 19 '18 at 04:00

0 Answers0