Mark_FreeSoftware
asked on
Registry acces denied?
whenever i try to change a registry key in the policy part of the registry, i get an acces denied error
ret = RegCreateKeyEx(HKCU, path, 0&, "", 0&, KEY_ALL_ACCESS, ByVal 0&, Result, Disp)
after running this, it will return 5 in ret
is there a way to change the rights?
i have been looking for AdjustToken, but i don't know what token to choose, since the shutdown token found everywhere on the Inet isnt helping me
500 points and a grade of A because i am really stuck with this (and i think it is difficult)
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Try
ret = RegCreateKeyEx(HKCU, path, 0&, vbNullString, 0&, KEY_ALL_ACCESS, 0&, Result, Disp)
ret = RegCreateKeyEx(HKCU, path, 0&, vbNullString, 0&, KEY_ALL_ACCESS, 0&, Result, Disp)
ASKER
the vbnullstring doesnt work, and it seems that they are not readonly (i can only check it from the key above, because the subkey we are speaking about is DisableRegistryTools so i can't view it when it is enabled
Before
ret = RegCreateKeyEx(HKCU, path, 0&, vbNullString, 0&, KEY_ALL_ACCESS, 0&, Result, Disp)
put MsgBox path
Is path correct? Could you post it here.
ret = RegCreateKeyEx(HKCU, path, 0&, vbNullString, 0&, KEY_ALL_ACCESS, 0&, Result, Disp)
put MsgBox path
Is path correct? Could you post it here.
ASKER
this is my path "Software\Microsoft\Window
but when the path isnt correct, it shouldnt return error 5
and HKCU value is correct? It should be &H80000001.
There is nothing wrong in the code as such. This key also would be present and the user would also have access to this key. Does this happen with any key?
There is nothing wrong in the code as such. This key also would be present and the user would also have access to this key. Does this happen with any key?
ASKER
no only that one
is there a way to run my program with the system privileges?
What is the user that executes this?
ASKER
a limited account
(but if it is possible it has to work always)
That might be the problem. First verify if this is the problem by running the program with an admin account. If it works, you know it is rights issue.
You could use RunAs batch command but that would mean that user has to enter the password.
You could use RunAs batch command but that would mean that user has to enter the password.
ASKER
and when i use createprocess or when i inject my code into an system process like explorer?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
especially the createprocessasuser looks nice, but there are two problems
when i distribute an app that asks for the adminPass, people will not like it,
and the examples from msdn are written in c (my knowledge is not enough to convert that to vb)
>>when i distribute an app that asks for the adminPass, people will not like it,
That is something you have to decide. If you need admin access only whil installing, there are ways around it but all those involve pust install from Active Directory or some software from domain server. So basically it is remote installed by domain admin and thus will have admin access. If you need admin access while the program is run, you need the password accessible to the program.
>>the examples from msdn are written in c
That can be worked.
That is something you have to decide. If you need admin access only whil installing, there are ways around it but all those involve pust install from Active Directory or some software from domain server. So basically it is remote installed by domain admin and thus will have admin access. If you need admin access while the program is run, you need the password accessible to the program.
>>the examples from msdn are written in c
That can be worked.
ASKER
do you know how gpedit.msc works?
because that program can change the keys without an admin pass
gpedit.msc is a form for ms management console... i have to ask again what you really want. set the registry value from above at any given price?
ASKER
>>at any price.....
not any price, but i would like to have that done
you havent answered the rest. but since both LogonUser and CreateProcessAsUser dont work for you (you could hardcode the password into the script although that is killing the security) im finally giving up - i simply dont meet the point where something does not function as you want it
ASKER
what about a split, do you guys both agree with that?
thats ok if you want to have it that way
Fine with me too.
ASKER
i shall take a look at it tomorrow (i'm at another pc right now)
maybey this helps:
when i edit the settings with gpedit.msc it can change them
is that possible if they are read- only?