I am trying to load an off-line NTUSER.DAT file (and then modify it), but I cannot get this working. RegLoadKey returns 8589934592, which I have no idea what it means. This is
8589934592 is 0x200000000 which is more than 32 bits long.
RegLoadKey returns a win32 "long" value, which is 32 bits. You've declared the function as returning a C# long which is 64 bits. If you fix the RegLoadKey declaration to return an int you'll get a value of 0 as expected.