Hello all,
I am searching a source code or a API for set/change registry permissions...
I found only how read, write, set, etc... for value.... (http://msdn.microsoft.com/en-us/library ... 85%29.aspx)
but I need this for permissions...
Can someone help me?
Thanks!
Registry permissions
Re: Registry permissions
I don't understand your question completly maybe so excuse me if this is not what you wanted. Registry permissions are set according to system policy and rights of the user. For example, if your logged in as an administrator or on an account with administrator permissions then no problem, but if your logged in as a user without permissions to the registry then you don't have registry access. I think its possible to change registry permissions programatically by impersonating a user with the necessary permissions but i'm not sure.
If you just need the various functions in a purebasic format then I would suggest that you search the forum using specific API functions as search terms, or get one of the libraries with its source code (the Droopy library for example) and take a look at how those do it.
If you just need the various functions in a purebasic format then I would suggest that you search the forum using specific API functions as search terms, or get one of the libraries with its source code (the Droopy library for example) and take a look at how those do it.
The advantage of a 64 bit operating system over a 32 bit operating system comes down to only being twice the headache.
Re: Registry permissions
Hi SFSxOI,
I am referring in manage registry permissions, for example:
The Windows Resource Kit Tools have the "SubInACL.exe" what it do?
SubInACL is a command-line tool that enables administrators to obtain security information about files, registry keys, printers and services.
A example:
subinacl.exe /keyreg HKEY_LOCAL_MACHINE\SOFTWARE\MySoft /grant=domain1\User1=F /deny=domain2\User2=R
/keyreg = indicate a Registry key
/grant = Grant permission
/deny = Deny permission
F = Full Control
R = Read
I am searching a source code or API for do this on PB..
someone can help me in this.
thank you for attention.
I am referring in manage registry permissions, for example:
The Windows Resource Kit Tools have the "SubInACL.exe" what it do?
SubInACL is a command-line tool that enables administrators to obtain security information about files, registry keys, printers and services.
A example:
subinacl.exe /keyreg HKEY_LOCAL_MACHINE\SOFTWARE\MySoft /grant=domain1\User1=F /deny=domain2\User2=R
/keyreg = indicate a Registry key
/grant = Grant permission
/deny = Deny permission
F = Full Control
R = Read
I am searching a source code or API for do this on PB..
someone can help me in this.
thank you for attention.
=D
Re: Registry permissions
Ahhhh OK I see now. For windows when I encounter something like this, since Windows can run things from a command prompt when I encounter something like this I try it this way first as a down and dirty method to use a utility or something. Some general purpose utility code I use to use utilitites like this quickly:
If I wanted to log the results some way i'd do like this:
Might help you out and be an eaisier solution if you just want to run or use subinacl.exe, dunno. I know its not exactly what you wanted but might help you experiment some.
Maybe something in here > http://msdn.microsoft.com/en-us/library ... S.85).aspx > has this for example > http://msdn.microsoft.com/en-us/library ... S.85).aspx (RegSetKeySecurity function) or maybe > http://msdn.microsoft.com/en-us/library ... S.85).aspx (RegGetKeySecurity function)
Code: Select all
Structure CmdP_STARTUPINFO
cb.l
lpReserved.l
lpDesktop.l
lpTitle.l
dwX.l
dwY.l
dwXSize.l
dwYSize.l
dwXCountChars.l
dwYCountChars.l
dwFillAttribute.l
dwFlags.l
wShowWindow.w
cbReserved2.w
lpReserved2.l
hStdInput.l
hStdOutput.l
hStdError.l
EndStructure
Global proc.PROCESS_INFORMATION, start.CmdP_STARTUPINFO, sa.SECURITY_ATTRIBUTES, hReadP.l, hWriteP.l, lngBytesread.l, strBuff.s=Space(256)
Procedure.s Rd_cmd(comnd_send.s)
sa\nLength =SizeOf(SECURITY_ATTRIBUTES)
sa\bInheritHandle = 1
sa\lpSecurityDescriptor = 0
ret = CreatePipe_(@hReadP, @hWriteP, @sa, 0)
If ret = 0
MessageRequester("Information", "CreateP failed. Error: ",0)
End
EndIf
start\cb = SizeOf(CmdP_STARTUPINFO)
start\dwFlags = #STARTF_USESHOWWINDOW | #STARTF_USESTDHANDLES
start\hStdOutput = hWriteP
start\hStdError = hWriteP
ret = CreateProcess_(0, comnd_send, sa, sa, 1, #NORMAL_PRIORITY_CLASS, 0, 0, @start, @proc)
If ret <> 1
MessageRequester("Information","File Or command not found", 0)
End
EndIf
ret = CloseHandle_(hWriteP)
mOutputs.s = ""
While ret<>0
ret = ReadFile_(hReadP, strBuff, 255, @lngBytesread, 0)
If lngBytesread>0
mOutputs = mOutputs + Left(strBuff, lngBytesread)
EndIf
Wend
ret = CloseHandle_(proc\hProcess)
ret = CloseHandle_(proc\hThread)
ret = CloseHandle_(hReadP)
ProcedureReturn mOutputs
EndProcedure
Debug Rd_cmd("subinacl.exe /keyreg HKEY_LOCAL_MACHINE\SOFTWARE\MySoft /grant=domain1\User1=F /deny=domain2\User2=R") ; may need to put path to sbinacl.exe
Code: Select all
Structure CmdP_STARTUPINFO
cb.l
lpReserved.l
lpDesktop.l
lpTitle.l
dwX.l
dwY.l
dwXSize.l
dwYSize.l
dwXCountChars.l
dwYCountChars.l
dwFillAttribute.l
dwFlags.l
wShowWindow.w
cbReserved2.w
lpReserved2.l
hStdInput.l
hStdOutput.l
hStdError.l
EndStructure
Global proc.PROCESS_INFORMATION, start.CmdP_STARTUPINFO, sa.SECURITY_ATTRIBUTES, hReadP.l, hWriteP.l, lngBytesread.l, strBuff.s=Space(256)
Procedure.s Rd_cmd(comnd_send.s)
sa\nLength =SizeOf(SECURITY_ATTRIBUTES)
sa\bInheritHandle = 1
sa\lpSecurityDescriptor = 0
ret = CreatePipe_(@hReadP, @hWriteP, @sa, 0)
If ret = 0
MessageRequester("Information", "CreateP failed. Error: ",0)
End
EndIf
start\cb = SizeOf(CmdP_STARTUPINFO)
start\dwFlags = #STARTF_USESHOWWINDOW | #STARTF_USESTDHANDLES
start\hStdOutput = hWriteP
start\hStdError = hWriteP
ret = CreateProcess_(0, comnd_send, sa, sa, 1, #NORMAL_PRIORITY_CLASS, 0, 0, @start, @proc)
If ret <> 1
MessageRequester("Information","File Or command not found", 0)
End
EndIf
ret = CloseHandle_(hWriteP)
mOutputs.s = ""
While ret<>0
ret = ReadFile_(hReadP, strBuff, 255, @lngBytesread, 0)
If lngBytesread>0
mOutputs = mOutputs + Left(strBuff, lngBytesread)
EndIf
Wend
ret = CloseHandle_(proc\hProcess)
ret = CloseHandle_(proc\hThread)
ret = CloseHandle_(hReadP)
ProcedureReturn mOutputs
EndProcedure
If CreateFile(0, "subinacl.txt")
WriteString(0, Rd_cmd("subinacl.exe /keyreg HKEY_LOCAL_MACHINE\SOFTWARE\MySoft /grant=domain1\User1=F /deny=domain2\User2=R") ; may need to put path to sbinacl.exe)
CloseFile(0)
EndIf
Delay(10)
RunProgram("subinacl.txt")
Maybe something in here > http://msdn.microsoft.com/en-us/library ... S.85).aspx > has this for example > http://msdn.microsoft.com/en-us/library ... S.85).aspx (RegSetKeySecurity function) or maybe > http://msdn.microsoft.com/en-us/library ... S.85).aspx (RegGetKeySecurity function)
The advantage of a 64 bit operating system over a 32 bit operating system comes down to only being twice the headache.
Re: Registry permissions
Thank you for this code, for this time this will be useful,
after I will try do a code for use the RegSetKeySecurity function,
if CreateThis$ = "I have success on this" : debug "I will post it here" : endif ;hehehe =)
maybe you know a good topic displaying someone learning to coding with windows API... (or a manual)
Thank you.
after I will try do a code for use the RegSetKeySecurity function,
if CreateThis$ = "I have success on this" : debug "I will post it here" : endif ;hehehe =)
maybe you know a good topic displaying someone learning to coding with windows API... (or a manual)
Thank you.
=D