Extension to Registry donated-code.

"Christophe Bouhier (MC/ECM)" <[email protected]> Wed, 29 Jun 2005 11:44:09 +0800
Newsgroups gmane.comp.windows.devel.jawin
Message-ID <54F404A6467B0242BBBE0E5EB405C295D802E4@emyklmw104>
Hi,

I would be very gratefull if someone can extend the donated Registry API
to be able to actually set a value in a Registry key. It seems this is not
supported? I looked-up the method in ADVAPI32.DLL and it looks it should be this
method:

    function RegSetValueW(hKey    : Win32.Winreg.HKEY;
                          lpSubKey: Win32.LPCWSTR;
                          dwType  : Win32.DWORD;
                          lpData  : Win32.LPCWSTR;
                          cbData  : Win32.DWORD)
                                    return Win32.LONG;      -- winreg.h:557


From the src of Registry, it could perhaps do it myself, with some help from the community.
e.g. I would need to understand if adapting the code below would work:


fpOK = new FuncPtr("ADVAPI32.DLL", "RegOpenKeyW");

public static int OpenKey(int key, String subkey) throws IOException, COMException {
                return fpOK.invoke_OI(key, subkey, ReturnFlags.CHECK_W32);
}

to:

fpSKV = new FuncPtr("ADVAPI32.DLL", "RegSetValueW");
public static int SetKeyValue(int key, String value) throws IOException, COMException {
                return fpOK.invoke_I(key, value, ReturnFlags.CHECK_W32);
}

It's a lotta guessing for me, as I am not to familiar with the FuncPtr and win32 programming in general.

Thanks a zillion! / Christophe