summaryrefslogtreecommitdiffhomepage
path: root/ftnoir_protocol_sc
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2015-07-03 17:01:47 +0200
committerStanislaw Halik <sthalik@misaki.pl>2015-07-03 17:01:47 +0200
commit8c43f5ad67f75c2160cd37209dbe93c7fe4e97f4 (patch)
treedb3ca6a33df65311e4d20fdb250c5562f0433bc6 /ftnoir_protocol_sc
parent6919231923167c04ce8788eee6deb12d8268e89c (diff)
sc: try fix load failure logic
Diffstat (limited to 'ftnoir_protocol_sc')
-rw-r--r--ftnoir_protocol_sc/ftnoir_protocol_sc.cpp19
1 files changed, 13 insertions, 6 deletions
diff --git a/ftnoir_protocol_sc/ftnoir_protocol_sc.cpp b/ftnoir_protocol_sc/ftnoir_protocol_sc.cpp
index 4d76df03..465d8d20 100644
--- a/ftnoir_protocol_sc/ftnoir_protocol_sc.cpp
+++ b/ftnoir_protocol_sc/ftnoir_protocol_sc.cpp
@@ -76,7 +76,7 @@ void FTNoIR_Protocol::pose( const double *headpose ) {
class ActivationContext {
public:
- ActivationContext(const int resid) {
+ ActivationContext(const int resid) :ok (false) {
hactctx = INVALID_HANDLE_VALUE;
actctx_cookie = 0;
ACTCTXA actx = {0};
@@ -100,7 +100,7 @@ public:
hactctx = INVALID_HANDLE_VALUE;
}
} else {
- qDebug() << "SC: can't create win32 activation context";
+ qDebug() << "SC: can't create win32 activation context" << GetLastError();
}
}
~ActivationContext() {
@@ -110,9 +110,11 @@ public:
ReleaseActCtx(hactctx);
}
}
+ bool is_ok() { return ok; }
private:
ULONG_PTR actctx_cookie;
HANDLE hactctx;
+ bool ok;
};
bool FTNoIR_Protocol::correct()
@@ -121,11 +123,16 @@ bool FTNoIR_Protocol::correct()
{
ActivationContext ctx(142 + static_cast<int>(s.sxs_manifest));
- SCClientLib.setFileName("SimConnect.dll");
- if (!SCClientLib.load()) {
- qDebug() << "SC load" << SCClientLib.errorString();
- return false;
+ if (ctx.is_ok())
+ {
+ SCClientLib.setFileName("SimConnect.dll");
+ if (!SCClientLib.load()) {
+ qDebug() << "SC load" << SCClientLib.errorString();
+ return false;
+ }
}
+ else
+ return false;
}
//