On reflection adding a simple test for this (at least the handle return bit) would be nice.
It probably makes sense to shorten this MR to deal just with the handle return stuff and leave app key work for a further MR. You could also add a commit that simply adds the `REG_LOAD_APP_KEY` define to `winnt.h` - this will avoid having to recompile much of Wine when applying any future MRs.