koesie10 / fsuipc-node

Native Node module for interfacing with FSUIPC
MIT License
17 stars 14 forks source link

Added permission denied error #15

Closed bgiorgio0506 closed 2 years ago

bgiorgio0506 commented 2 years ago

This push adds a permission denied error and checking during the process call.

Why adding this ? Well in my quest of using this SDK also with X-Plane I noticed that X-Plane is quite picky in terms of who is sending messages to the UIPCMAIN windowinfact I was getting IPC SendMessage failed all retries code : 12 error.

As you imagine I didn't gave up because as per XPUIPC documentation you can connect to X-Plane using the same code as you use to connect with ESP platform, so I started testing and digging into the code.

I noticed a DWORD error 5was returned from the SendMessateTimeout() so a quick look to System Error Codes Table cleared the situation.

I run some more connection tests with XP and these are the results :

| Admin       | Non Admin   | Results     |
| ----------- | ----------- | ----------- |
| Smartcars   | X-Plane     | Test OK     |
| X-Plane     | Smartcars   | Test NOT OK |

*NOTE: when both on the same privileges level it works as expected

So based on these results I've added a permission error code so that future Devs can have a direct idea of why the SendMessageTimeout()