Page 1 of 1

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

Posted: Wed Aug 28, 2024 4:37 am
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.

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

Posted: Wed Aug 28, 2024 7:52 am
by AZJIO
some sections require administrator rights to change and delete data.

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

Posted: Wed Aug 28, 2024 2:09 pm
by hdt888
yes sir, I alway run as admin.

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

Posted: Wed Aug 28, 2024 2:20 pm
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?

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

Posted: Wed Aug 28, 2024 2:23 pm
by mk-soft
Compiler Option -> Request Administrator mode

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

Posted: Wed Aug 28, 2024 2:27 pm
by hdt888
It's still not work.

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

Posted: Wed Aug 28, 2024 3:34 pm
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

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

Posted: Wed Aug 28, 2024 3:35 pm
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.