At last I got it to work. The parameter "/reg:64" passed to reg.exe makes it do what it's told. I just hope this won't mess things up on a 32bit windows.
So, that needs to be
component.addElevatedOperation("Execute",reg, "ADD",key, "/reg:64" ,"/v","@TargetDir@\\maintenancetool.exe","/t","REG_SZ","/d","~ RUNASADMIN", "/f");