Jump to content
The simFlight Network Forums

FSUIPC SDK in 64-bit application


Recommended Posts

Hello,

 

I am currently working with the FSUIPC SDK for the C programming language and running into an issue. I am required to compile my end application in 64 bit, and it seems that the provided example C code does not work when compiled in 64 bit, though works as expected when compiled in 32 bit.

 

Initially, there was a problem with the call to CreateFileMapping in the FSUIPC_Open function, which would return an invalid handle error. I resolved that by changing the first argument from (HANDLE)0xFFFFFFFF to INVALID_HANDLE_VALUE, which is correct for a 64-bit program.

// create the file-mapping object
     m_hMap = CreateFileMapping(
		INVALID_HANDLE_VALUE, // use system paging file
		NULL,               // security
		PAGE_READWRITE,     // protection
		0, MAX_SIZE+256,       // size
		szName);            // name 

I was then able to proceed past this point, but am now getting an error from FSUIPC - "IPC request contains bad data" later on in the FSUIPC_Open function, during the call to FSUIPC_Process. Specifically, the message sent to the FS window handle does not return success here -

// send the request (allow up to 9 tries)
	while ((++i < 10) && !SendMessageTimeout(
			m_hWnd,       // FS6 window handle
			m_msg,        // our registered message id
			m_atom,       // wParam: name of file-mapping object
			0,            // lParam: offset of request into file-mapping obj
			SMTO_BLOCK,   // halt this thread until we get a response
			2000,			  // time out interval
			&dwError))    // return value
	{	Sleep(100); // Allow for things to happen
	}

The result contained in dwError is always 0 when the function returns. I did have to change the variable type for dwError from DWORD to DWORD_PTR to be compatible with 64 bit.

 

I have been stuck at this point, unable to communicate with FSUIPC. My goal is to integrate this as part of another application that has to be compiled in 64 bit, so it is essential that I am able to get this to work in a 64 bit program.

 

 

 

Link to comment
Share on other sites

The data supplied to FSUIPC must be EXACTLY as documented. It sounds like somewhere you have a 64-bit pointer instead of a 32-bit one. Take care that all values are 32-bit compatible. Use the debugger to examine the byte-by-byte format of the request data being forwarded. (You probably need to write a 64-bit version of the library code -- I see you must be editing it as it is).

 

Paul Henty has recently made his .NET DLL for FSUIPC 64-bit compatible, so you may want to check that out as a more ready-made solution, or at least talk to him. See his SubMenu above.

 

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.