Jump to content
The simFlight Network Forums

Reading FSUIPC Data from Windows Service


Recommended Posts

Hi there, I'm a first time poster but long time reader. I'm trying to get FSIUPC data to be read and written from a Windows service.

So far I've been met with limited success. Initially I was having problems getting any responsiveness from FSUIPC but realized that it wasn't getting the window handle to the FSUIPC module in FS. Having resolved that I'm still having problems getting FSUIPC connected. Currently it's getting hung up on retrieving the FSUIPC version which I'm assuming is because it may be having a problem reading data.

Again, FSUIPC can get the window handle for the module but can't seem to connect (ERROR: FSUIPC_ERR_VERSION).

Has anyone else had any success (or failure) getting this to work? Any insight would be appreciated.

Thank you,

Frank.

Link to comment
Share on other sites

Sorry for the delay -- as announced here, I have been on holiday.

Again, FSUIPC can get the window handle for the module but can't seem to connect (ERROR: FSUIPC_ERR_VERSION).

Have you tried enabling IPC read/write logging in FSUIPC's logging page, to see what is happening? This is why such debugging facilities are provided.

Always state version numbers when asking for support please. Also, are you using the supplied library or using your own code? I am not sure what programming differences there are for Services.

Regards

Pete

Link to comment
Share on other sites

Pete thank you for the quick reply. Let me please start by saying that your endless devotion to this is nothing short of incredible and very much appreciated. Thanks.

Now back to my headache ;)...

To answer your questions:

Version: 3.75

Library: C#

I'm running FSUIPC v3.75 and using the provided C# library. I'm getting an return code of 7 when trying to connect which, from my understanding is meant to represent FSUIPC_ERR_VERSION, however, upon review of the read/write log it appears as though there is another, different problem (see below). Well, it's probably related as the error code I'm getting from the code and the error reported by the logging don't exactly match but if, as the log states, FSUIPC can't create a file mapping then that may explain why it can't read information, namely the FS version. Strangely though, when it tries to read the offsets for FSUIPC_Version,FSUIPC_FS_Version, and FSUIPC_Lib_Version the "read" and "get" results all come back ok (0) although the results of the FSUIPC_Get command are 0 for FSUIPC_Version and FSUIPC_FS_Version and 2 for FSUIPC_Lib_Version.

With regards to my implementation, I'm simply trying to connect (at this stage) to FSUIPC from within a window's service. As you probably already know, window's services normally DON'T like to interact with running applications (i.e. running applications on the desktop) as they are generally designed to work in a non-interactive manner, however, there is an option to have the service "Interact with the desktop". This allows the service to communicate (in theory) with currently running applications at the user-session level. Honestly, I figured if I could get the window handle for the FSUIPC module then everything else would be ok.

As I mentioned in my original post, I am able to get the window handle for FS but it can't seem to connect, apparently because it can't create or open the filemapping. Oddly though, when I debug the code and step through the FSUIPC library code, it does appear to be able to create a file mapping (a handle is returned for it). Admittedly I don't necessarily understand all the ins and outs of user32.dll API.

I was hoping someone else in this forum had experience with this but given the lack of responses I'm guessing they haven't - or perhaps are too shy to discuss. Either way, any information you can provide would be helpful.

Thanks,

Frank

PS I've removed the name and email address of the registrar for this version of FSUIPC as this is a client application and I don't know if they would want their information posted online. I can provide it to you privately if you require it.

********* FSUIPC, Version 3.75 by Pete Dowson *********

Running inside FS2004(original release)

FSUIPC Key is provided

WideFS Key is provided

[Continuation log requested by user]

Module base=61000000

ClassOptions: UIPCMAIN=FF7F, FS98MAIN=FF7F, FS2KMAIN=FF5E

WeatherOptions(Orig)=40003605[40003605]

InitDelay: 0 seconds

WeatherReadInterval=4

LogOptions=0000000D

49411734 System time = 06:04:11, FS2004 time = 01:02:50 (16:02Z)

49492000 IPC ERROR: Cannot OpenFileMapping (Error=5)

49492094 IPC ERROR: Cannot OpenFileMapping (Error=5)

Link to comment
Share on other sites

Version: 3.75

Ah, a version not supported for some time now. Please see the Announcements above which state the currently supported version numbers. Please ALWAYS check this before asking for support.

With regards to my implementation, I'm simply trying to connect (at this stage) to FSUIPC from within a window's service. As you probably already know, window's services normally DON'T like to interact with running applications (i.e. running applications on the desktop)

No, as I think I already said, I know nothing at all about Services. Sorry.

I was hoping someone else in this forum had experience with this but given the lack of responses I'm guessing they haven't - or perhaps are too shy to discuss. Either way, any information you can provide would be helpful.

Well, I am not sure. The interface to FSUIPC is clear if you are a programmer as the sources are all provided.

AhI see you have provided a log fragment ...

Two things odd here:

49492000 IPC ERROR: Cannot OpenFileMapping (Error=5)

49492094 IPC ERROR: Cannot OpenFileMapping (Error=5)

First, how on Earth is the millisecond elapsed time count getting to 49492000? That's nearly 14 hours! Did you really have FS running continuously for 14 hours?

Second, I've never seen the OpenFileMapping call fail, not ever. Error 5 is "ACCESS DENIED", so it is looking like some sort of privilege thing. Maybe memory owned by Services cannot be shared -- a possibility of violating system integrity, maybe?

Regards

Pete

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use. Guidelines Privacy Policy We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.