Hi Vincent,
I succeeded to have a working example. I wrote the code but I can't commit it. Can you add me on the project please?
I added the account "VincentBlondeau" to STHub project. You should be able to commit.
Just to give some indications for the code I changed.
Globally the primitive call is good. But when you pass 'nil' as argument for the primitive, it will not be converted to 'null' ('null' have for value 0). To have the 0, either you change nil into 0 or you add the option #optCoerceNilToNull in the call (because it is not the default...) (See 'NBNativeCodeGen class>>defaultOptions' for the others). It is the mainly problem!
But I tried this already. When I - switch to 0 in the calling method #example2 - or switch to 0 directly in the RegQueryValueExA wraper - or use the option optCoerceNilToNull I still get the generic error.
Concerning the arguments allocation there is some tips: 'NativeBoost allocate: <number>' allocates a memory segment of the size given by <number> and return the address to it. But it is better to use 'NativeBoost allocate: (NBExternalType sizeOf: 'ulong')' or 'NativeBoost allocate: (NBExternalType sizeOf: 'DWORD')' for both dwType and lSize arguments.
Yes, thats clear. I usually try to make it "make it run make it right make it fast", currently I struggle with the first here. ;)
With some advance, you will see in the example4 that the RegQueryValueExA doesn't return a valid error value... I don't know why...
Commit the code where the call works and I can check. Step by step ...
I hope it will be helpful,
I really appreciate your feedback! Thanks Regards Torsten