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:
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
If I wanted to log the results some way i'd do like this:
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")
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)