reg.exe delete and RunProgram() - why not working ?

Just starting out? Need help? Post your questions and find answers here.
hdt888
User
User
Posts: 57
Joined: Sun Jul 07, 2024 8:42 am

reg.exe delete and RunProgram() - why not working ?

Post by hdt888 »

I have use ts-soft's registry.pbi and Hex0r's fix update. I need to delete the following 2 keys:

"HKEY_LOCAL_MACHINE\SOFTWARE\Classes\My-SubKey"
And
"HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Classes\My-SubKey"

I run RegDeleteTree(), it doesn't delete but only deletes the Name column.

Then I use the command:

Code: Select all

RunProgram("reg.exe", "delete " + #DOUBLEQUOTE$ + "HKEY_LOCAL_MACHINE\SOFTWARE\Classes\My-SubKey" + #DOUBLEQUOTE$ + " /f", #Null$, #PB_Program_Wait|#PB_Program_Hide)
RunProgram("reg.exe", "delete " + #DOUBLEQUOTE$ + "HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Classes\My-SubKey" + #DOUBLEQUOTE$ + " /f", #Null$, #PB_Program_Wait|#PB_Program_Hide)
Tested on win10 x64, PureBasic 6.04 x86

Why not working ?
What did I do wrong?. Thank you.
PB 5.x + 6.x + Win10. Feel the ...Pure... Power.
AZJIO
Addict
Addict
Posts: 2225
Joined: Sun May 14, 2017 1:48 am

Re: reg.exe delete and RunProgram() - why not working ?

Post by AZJIO »

some sections require administrator rights to change and delete data.
hdt888
User
User
Posts: 57
Joined: Sun Jul 07, 2024 8:42 am

Re: reg.exe delete and RunProgram() - why not working ?

Post by hdt888 »

yes sir, I alway run as admin.
PB 5.x + 6.x + Win10. Feel the ...Pure... Power.
Axolotl
Addict
Addict
Posts: 872
Joined: Wed Dec 31, 2008 3:36 pm

Re: reg.exe delete and RunProgram() - why not working ?

Post by Axolotl »

you can try this commands on a console to see the result (error) code.
Ideas:
1. Use HKLM instead of HKey_LOCAL_MACHINE.
2. use reg query .... to look if the key is existing and read accessable?
Just because it worked doesn't mean it works.
PureBasic 6.04 (x86) and <latest stable version and current alpha/beta> (x64) on Windows 11 Home. Now started with Linux (VM: Ubuntu 22.04).
User avatar
mk-soft
Always Here
Always Here
Posts: 6320
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: reg.exe delete and RunProgram() - why not working ?

Post by mk-soft »

Compiler Option -> Request Administrator mode
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
hdt888
User
User
Posts: 57
Joined: Sun Jul 07, 2024 8:42 am

Re: reg.exe delete and RunProgram() - why not working ?

Post by hdt888 »

It's still not work.
PB 5.x + 6.x + Win10. Feel the ...Pure... Power.
Axolotl
Addict
Addict
Posts: 872
Joined: Wed Dec 31, 2008 3:36 pm

Re: reg.exe delete and RunProgram() - why not working ?

Post by Axolotl »

what do you get if you run this command on console?

Code: Select all

C:\>reg query HKLM\software\classes\my-subkey /ve
Just because it worked doesn't mean it works.
PureBasic 6.04 (x86) and <latest stable version and current alpha/beta> (x64) on Windows 11 Home. Now started with Linux (VM: Ubuntu 22.04).
hdt888
User
User
Posts: 57
Joined: Sun Jul 07, 2024 8:42 am

Re: reg.exe delete and RunProgram() - why not working ?

Post by hdt888 »

OK, fixed. I using:

Code: Select all

Prototype.i IsWow64Process(hProcess, *Wow64Process)
Prototype.i Wow64DisableWow64FsRedirection(*OldValue)
Prototype.i Wow64RevertWow64FsRedirection(*OldValue)
Working fine for 2 case:

+ edit/delete Registry 32-bit by PB 32-bit on Win 64-bit.
+ edit/delete Registry 64-bit by PB 32-bit on Win 64-bit.

Thank you.
PB 5.x + 6.x + Win10. Feel the ...Pure... Power.
Post Reply