diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2013-04-09 11:29:36 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2013-04-09 11:29:36 +0200 |
commit | 5c2f5449e8eb8a3c6d564a16fc8e307996746c14 (patch) | |
tree | 7620ca12dbe844150409db8d22d93e858b517ce2 /ftnoir_protocol_sc/ftnoir_protocol_sc.cpp | |
parent | b78ac5d6535794967d5104bbc265b5079d0ac6b2 (diff) |
Fix SimConnect (thanks Wim)
Diffstat (limited to 'ftnoir_protocol_sc/ftnoir_protocol_sc.cpp')
-rw-r--r-- | ftnoir_protocol_sc/ftnoir_protocol_sc.cpp | 34 |
1 files changed, 24 insertions, 10 deletions
diff --git a/ftnoir_protocol_sc/ftnoir_protocol_sc.cpp b/ftnoir_protocol_sc/ftnoir_protocol_sc.cpp index c01096bf..90ca3dba 100644 --- a/ftnoir_protocol_sc/ftnoir_protocol_sc.cpp +++ b/ftnoir_protocol_sc/ftnoir_protocol_sc.cpp @@ -153,13 +153,13 @@ PDWORD_PTR MsgResult = 0; //
bool FTNoIR_Protocol::checkServerInstallationOK()
{
- QString aFileName; // File Path and Name
-
- // Code to activate the context for the SimConnect DLL
- ACTCTX act = { 0 };
+ // Code to activate the context for the SimConnect DLL
+ ACTCTXA act;
HANDLE hctx;
ULONG_PTR ulCookie;
+ memset(&act, 0, sizeof(act));
+
qDebug() << "SCCheckClientDLL says: Starting Function";
try {
@@ -167,8 +167,9 @@ bool FTNoIR_Protocol::checkServerInstallationOK() act.cbSize = sizeof(act);
act.dwFlags = ACTCTX_FLAG_RESOURCE_NAME_VALID;
char full_path[2048];
- strcpy(full_path, QCoreApplication::applicationDirPath().toLatin1().constData());
- strcat(full_path, "\\libftnoir-proto-simconnect.dll");
+ QByteArray foo = QCoreApplication::applicationDirPath().toLatin1();
+ strcpy(full_path, foo.constData());
+ strcat(full_path, "/ftnoir-proto-simconnect.dll");
act.lpSource = full_path;
act.lpResourceName = MAKEINTRESOURCEA(101);
@@ -199,10 +200,23 @@ bool FTNoIR_Protocol::checkServerInstallationOK() return false;
}
- SCClientLib.setFileName(SC_CLIENT_FILENAME);
- if (SCClientLib.load() != true) {
- qDebug() << "SCCheckClientDLL says: Error loading SimConnect DLL";
- return false;
+ const char* simconnect_paths[] = {
+ "SimConnect.DLL",
+ "C:\\Windows\\WinSxS\\x86_microsoft.flightsimulator.simconnect_67c7c14424d61b5b_10.0.60905.0_none_dd92b94d8a196297\\SimConnect.DLL",
+ "C:\\Windows\\WinSxS\\x86_microsoft.flightsimulator.simconnect_67c7c14424d61b5b_10.0.61242.0_none_e079b46b85043c20\\SimConnect.DLL",
+ "C:\\Windows\\WinSxS\\x86_microsoft.flightsimulator.simconnect_67c7c14424d61b5b_10.0.61259.0_none_55f5ecdc14f60568\\SimConnect.DLL",
+ NULL
+ };
+
+ for (int i = 0; simconnect_paths[i]; i++)
+ {
+ SCClientLib.setFileName(simconnect_paths[i]);
+ if (!SCClientLib.load()) {
+ qDebug() << "SCCheckClientDLL says: Error loading SimConnect DLL";
+ qDebug() << SCClientLib.errorString();
+ continue;
+ }
+ break;
}
//
|