What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » Help - accessing the registry

Help - accessing the registry
Author: Message:
Choli
Elite Member
*****

Avatar
Choli

Posts: 4714
Reputation: 42
42 / Male / Flag
Joined: Jan 2003
O.P. Help - accessing the registry
I don't understand why the following code fails when I execute it in a script (of Plus, of course) and the same code works perfectly in Visual Basic (typing it using VB syntax, of course).

I'm trying to access the registry, so first of all, I have to open it, using RegOpenKeyEx, but it fails....
code:
var HKEY_CURRENT_USER = 0x80000001;
var KEY_ALL_ACCESS = 0xF003F;

var ret;
var key = Interop.Allocate(4);

var x = Interop.Allocate(10000);

ret = Interop.Call("advapi32.dll", "RegOpenKeyExW", HKEY_CURRENT_USER, "Software\\Patchou\\Messenger Plus! Live", 0, KEY_ALL_ACCESS, key);

if (ret != 0) {
    Debug.Trace("" + ret + " " + Interop.GetLastError());
    Interop.Call("kernel32.dll", "FormatMessageW", 0x00001000, 0, ret, 0, x, 1000, 0);
    Debug.Trace(x.ReadString(0));
}

The output in the debug window is
quote:
2 0
El sistema no puede hallar el archivo especificado.

That means, in english: "The system can't find the specified file".

Seeing the "2 0", I understand that the function RegOpenKeyEx fails, but GetLastError returns 0, ie: no error.

So it seems that it can't find the path "Software\Patchou\Messenger Plus! Live" under the HKCU branch of the registry. However, if I put only "Software", it opens it correctly. That, together with the fact that I can open it using VB, makes me think that Plus Live executes its scripts under another Windows account, therefore accessing another HKCU branch where there is no "Patchou" "folder". I know that's weird and stupid, but what else can it be?

Any ideas?

Thanks.
Messenger Plus! en espaņol:
<< http://www.msgpluslive.es/ >>
<< http://foro.msgpluslive.es/ >>
:plus4:
09-23-2006 06:53 PM
Profile PM Find Quote Report
« Next Oldest Return to Top Next Newest »

Messages In This Thread
Help - accessing the registry - by Choli on 09-23-2006 at 06:53 PM
RE: Help - accessing the registry - by CookieRevised on 09-23-2006 at 07:12 PM
RE: Help - accessing the registry - by Choli on 09-23-2006 at 07:30 PM


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On