News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Launching Regedit.exe

Started by Robert Collins, December 13, 2005, 05:00:36 PM

Previous topic - Next topic

Robert Collins

Is there a way to lauch 'REGEDIT' and supply it with a KEY so that I can bring up REGEDIT into focus showing the results of the KEY?

I tried the following......

Shell "C:\WINDOWS\REGEDIT.EXE HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\"

....but instead of showing the folder with the information in it, it poped ip with a message box asking me this:

'Are you sure you want to add the information in HKEY_LOCAL_MACHINE\...\CurrentVersion\ to the registry?'

Of course, this is not what I want.


P1

Write to Registry at HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Applets\Regedit
with LastKey = My Computer\HKEY_CURRENT_USER\Software\Nico Mak Computing

Then run RegEdit and it will open to this spot.  You can also Bookmark your favorite registry spots.

Regards,  P1  :8)

Robert Collins

Quote from: P1 on December 13, 2005, 10:07:08 PM
Write to Registry at HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Applets\Regedit
with LastKey = My Computer\HKEY_CURRENT_USER\Software\Nico Mak Computing

Then run RegEdit and it will open to this spot.  You can also Bookmark your favorite registry spots.

Regards,  P1  :8)


I followed your suggestion but subsituting 'Adobe' for 'Nico Mak Computing' since 'Nico Mak Computing'  does not exist.

I then ran Regedit. It did not open to the above spot. It opened normally without any folders opened.

MichaelW

For regedit version 5.0 this seems to work just as it should:

; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««
    include \masm32\include\masm32rt.inc
    include \masm32\include\advapi32.inc
    includelib \masm32\lib\advapi32.lib
; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««
    .data
      hKey      dd 0
      subKey    db "Software\Microsoft\Windows\CurrentVersion\"
                db "Applets\Regedit\",0
      valueName db "LastKey",0
      keyValue  db "My Computer\HKEY_CURRENT_USER\Software\Adobe",0
    .code
; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««
start:
; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««
    ; ERROR_SUCCESS = 0.

    invoke RegOpenKeyEx,HKEY_CURRENT_USER,ADDR subKey,0,
                        KEY_SET_VALUE, ADDR hKey
    print ustr$(eax),13,10

    invoke RegSetValueEx, hKey, ADDR valueName, 0, REG_SZ,
                          ADDR keyValue, SIZEOF keyValue
    print ustr$(eax),13,10

    invoke RegCloseKey, hKey
    print ustr$(eax),13,10

    mov   eax, input(13,10,"Press enter to exit...")
    exit
; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««
end start


With regedit version 4.10.1998 there is no LastKey value, and adding one does not change the behavior.
eschew obfuscation

Robert Collins

Version 4.10 is what I have. Can I run version 5.0+ on Windows 98? I have CDs for Windows 2000 and Windows XP Pro. Perhaps I can simply copy the Regedit.exe from one of these disks and use it on W98? 

MichaelW

I could not make it work. After I copied the Windows 2000 REGEDIT.EXE to the Windows 98 SE system, the system refused to run REGEDIT because of a missing export from COMDLG32.DLL. After I substituted the Windows 2000 COMDLG32.DLL (from safe mode), on restart the system complained about a missing export from USER32.DLL, and then the system refused to run REGEDIT because of the same missing export from USER32.DLL.


eschew obfuscation

sluggy

I think it was Mark Russinovich who showed the only reliable way to do this with regedit: just spawn it, then send it the appropriate "tree-node clicked" messages till you open the node you are interested in. He used to have the example source on his site for it.

Robert Collins

Quote from: MichaelW on December 14, 2005, 05:44:51 AM
I could not make it work. After I copied the Windows 2000 REGEDIT.EXE to the Windows 98 SE system, the system refused to run REGEDIT because of a missing export from COMDLG32.DLL. After I substituted the Windows 2000 COMDLG32.DLL (from safe mode), on restart the system complained about a missing export from USER32.DLL, and then the system refused to run REGEDIT because of the same missing export from USER32.DLL.

That is the problem I'm having so far. It's probably not worth the trouble to go through just for the sake of trying to run version 5 on 98. I've had this kind of problem before with other components and it just leads into one problem after another and then when you do finially get all the missing DLLs copied over it still doesn't work.


Quote from: sluggy on December 14, 2005, 09:14:36 AM
I think it was Mark Russinovich who showed the only reliable way to do this with regedit: just spawn it, then send it the appropriate "tree-node clicked" messages till you open the node you are interested in. He used to have the example source on his site for it.

That's what I was thinking more into was to find some code that can send 'tree-node-clicks' messages to Regedit. I'll look for his example (but I don't know the site) or other examples on Google.

MichaelW

eschew obfuscation

P1

The Key technique is for Shell 5.0 and above ( W2K or better ).  He did not say for what OS he was doing this for. 

The Key Shown was an example and you need to use a VALID existing key for the technique to work.

And when your done working out the bugs with the "tree-node clicked" method, please post the code for the forum to have available.

Regards,  P1  :8)

Robert Collins

Quote from: P1 on December 14, 2005, 03:59:28 PM
The Key technique is for Shell 5.0 and above ( W2K or better ).  He did not say for what OS he was doing this for. 

The Key Shown was an example and you need to use a VALID existing key for the technique to work.

And when your done working out the bugs with the "tree-node clicked" method, please post the code for the forum to have available.

Regards,  P1  :8)

I went to that site but I couldn't find the article. In the meantime, I decided to just make my own Regedit program. I have one now and it looks and works exactly the same as the system's version except I added my own command line code so I can now do what I want.

P1

Quote from: Robert Collins on December 14, 2005, 08:03:55 PMIn the meantime, I decided to just make my own Regedit program. I have one now and it looks and works exactly the same as the system's version except I added my own command line code so I can now do what I want.
Share the code ?

It would be great to see how you got that accomplished.

Regards,  P1  :8)

Robert Collins

Quote from: P1 on December 14, 2005, 08:49:27 PM
Quote from: Robert Collins on December 14, 2005, 08:03:55 PMIn the meantime, I decided to just make my own Regedit program. I have one now and it looks and works exactly the same as the system's version except I added my own command line code so I can now do what I want.
Share the code ?

It would be great to see how you got that accomplished.

Regards,  P1  :8)

Sure. I'll get it cleaned up and put it in a zip file and a link to it. Just so you'll know in advance, it is written in Visual Basic. I do all my programs that I want to make in a short period of time in VB. I only use Assembly & C if I have the time to experiment around.

anunitu

I saw this on Sysinternals, and thought you might be interested. it is a commandline program, that takes an input , and calls Regedit, and goes to the specified key...

http://www.sysinternals.com/Utilities/Regjump.html

Not sure if this is what you are trying to do, but thought i would post it.

Anunitu

sluggy

Quote from: anunitu on December 15, 2005, 01:22:35 AM
I saw this on Sysinternals, and thought you might be interested. it is a commandline program, that takes an input , and calls Regedit, and goes to the specified key...

http://www.sysinternals.com/Utilities/Regjump.html

Not sure if this is what you are trying to do, but thought i would post it.
Yep, that's the one i was talking about. He doesn't have the source there for it now, but i do remember downloading it a couple of years ago and analyzing it.