0x00000002
};
-/* Type-checking macro to provide arguments for CoCreateInstance() etc.
- * The pointer arithmetic is a compile-time pointer type check that 'obj'
- * really is a 'type **', but is intended to have no effect at runtime. */
+/* Type-checking macro to provide arguments for CoCreateInstance()
+ * etc, ensuring that 'obj' really is a 'type **'. */
+#define typecheck(checkexpr, result) \
+ (sizeof(checkexpr) ? (result) : (result))
#define COMPTR(type, obj) &IID_##type, \
- (void **)(void *)((obj) + (sizeof((obj)-(type **)(obj))) \
- - (sizeof((obj)-(type **)(obj))))
+ typecheck((obj)-(type **)(obj), (void **)(void *)(obj))
static char putty_path[2048];
ret->lpVtbl->SetPath(ret, app_path);
if (sessionname) {
- param_string = dupcat("@", sessionname, NULL);
+ /* The leading space is reported to work around a Windows 10
+ * behaviour change in which an argument string starting with
+ * '@' causes the SetArguments method to silently do the wrong
+ * thing. */
+ param_string = dupcat(" @", sessionname, NULL);
} else {
param_string = dupstr("");
}