Running regedit from DLL

Just starting out? Need help? Post your questions and find answers here.
Maya

Running regedit from DLL

Post by Maya »

Good evening,
I'm trying to run windows "regedit" from within a DLL function.
None of the following commands worked for me.
Note: notepad can be run, but not regedit! :!:

Any help would be greatly appreciated.

Code: Select all

ProcedureDLL AddReg()
 ; RunProgram("regedit")
 ; RunProgram("regedit.exe","","",0)
 ; RunProgram("C:\Windows\regedit.exe") 
 ; RunProgram("regedit.exe","","c:\windows",0)
 ; ShellExecute_(0, "open", "regedit.exe", #Null, #Null, #SW_SHOW)
EndProcedure
Last edited by Maya on Sun Dec 10, 2023 5:59 pm, edited 1 time in total.
Sergey
User
User
Posts: 60
Joined: Wed Jan 12, 2022 2:41 pm

Re: Running Notepad from DLL

Post by Sergey »

Hi, Maya
I tested on my Win10x64 PB6.04b2

Code: Select all

RunProgram("C:\Windows\regedit.exe"); works fine
you also may test this way

Code: Select all

RunProgram("cmd", "/c regedit", "", #PB_Program_Hide)
But, I recommended use RegCreateKeyEx_(), RegSetValueEx_() and RegCloseKey_() :wink:
Maya

Re: Running Notepad from DLL

Post by Maya »

Sergey wrote: Sat Dec 09, 2023 8:41 am Hi, Maya
I tested on my Win10x64 PB6.04b2
All these commands works from outside the ProcedureDll & none of them works from inside it.
Any Help?
Little John
Addict
Addict
Posts: 4807
Joined: Thu Jun 07, 2007 3:25 pm
Location: Berlin, Germany

Re: Running Notepad from DLL

Post by Little John »

You can try

Code: Select all

ShellExecute_(0, "runas", "regedit.exe", #Null, #Null, #SW_SHOW)
RASHAD
PureBasic Expert
PureBasic Expert
Posts: 4996
Joined: Sun Apr 12, 2009 6:27 am

Re: Running Notepad from DLL

Post by RASHAD »

What is your configuration ?
It works for me
Maybe you need Admin rights

Try LJ snippet it uses Admin right
Egypt my love
Little John
Addict
Addict
Posts: 4807
Joined: Thu Jun 07, 2007 3:25 pm
Location: Berlin, Germany

Re: Running Notepad from DLL

Post by Little John »

@Rashad:
We had the same idea at the same time. :-)
RASHAD
PureBasic Expert
PureBasic Expert
Posts: 4996
Joined: Sun Apr 12, 2009 6:27 am

Re: Running Notepad from DLL

Post by RASHAD »

Hi LJ
It happens all time :)
Egypt my love
Maya

Re: Running Notepad from DLL

Post by Maya »

The issue was with Admin Rights.
Thank you all...
Really Appreciated.
Post Reply