set Desktop ACL lazarus / 34-Windows ---------------------------------------------------------------------- fpc2pas · 2021-10-13 15:34 Hi folks I am trying to interact with another logged-on user's process such as a CMD, I am using token impersonation which we all know how to do, it is not a problem. what I am facing is the created process displayed black and empty due to DACL issues, there is a punch of scripts written in PowerShell to do that but I want to implement it using Pascal. for your reference, you have a look into these two scripts to get a clear idea. and there is also an outdated Delphi version but doesn't work and many errors in Lazarus. https://github.com/checkymander/HackSql/blob/master/Set- DesktopACLs.ps1 https://raw.githubusercontent.com/checkymander/HackSql/master/Set- DesktopACLToAllowEveryone.ps1 ---------------------------------------------------------------------- fpc2pas · 2021-10-13 15:35 here also a another Delphi ref : http://rsdn.org/forum/delphi/1698565.all but not compatible with Lazarus ---------------------------------------------------------------------- jamie · 2021-10-13 17:43 Quote from: fpc2pas on October 13, 2021, 05:35:38 pmhere also a another Delphi ref : http://rsdn.org/forum/delphi/1698565.all but not compatible with Lazarus Ok, with a little online searching for constants and corrects for fpc, i got it to compile but I didn't test it. Was that the problem? ---------------------------------------------------------------------- fpc2pas · 2021-10-14 12:06 Quote from: jamie on October 13, 2021, 07:43:15 pmQuote from: fpc2pas on October 13, 2021, 05:35:38 pmhere also a another Delphi ref : http://rsdn.org/forum/delphi/1698565.all but not compatible with Lazarus Ok, with a little online searching for constants and corrects for fpc, i got it to compile but I didn't test it. Was that the problem? oh i was having many errors while compiling the src, such as in these lines // Add the ACE to the new ACL.           if not AddAce(pNewAcl^, ACL_REVISION, MAXDWORD, pTempAce, pTempAce.AceSize) then also was having errors in these if not GetAclInformation(pdacl^, @aclSizeInfo, SizeOf(ACL_SIZE_INFORMATION), AclSizeInformation) then but while change into pdacl value , it fixed it but still errors in pTempAce.Acesize and other longbool values, maybe some probelms in constrains, do you mind share yours modifications? Thanks ---------------------------------------------------------------------- jamie · 2021-10-14 12:23 ok ,i just put the complete project in zip, its a little large for a eye ball shot. ---------------------------------------------------------------------- fpc2pas · 2021-10-14 13:38 Quote from: jamie on October 14, 2021, 02:23:18 pmok ,i just put the complete project in zip, its a little large for a eye ball shot. thanks compiling is okay, but I think the code is not compatible for newer windows as access violation occurred, I am not sure where is the problem. if you have some env to try kindly forward your result ---------------------------------------------------------------------- jamie · 2021-10-15 14:16 I am not on a PC atm with multiple users so its hard for me to do this.. If you could use the debugger to step trace to which procedure is failing and let me know I can look at the code. ---------------------------------------------------------------------- fpc2pas · 2021-10-16 02:35 Quote from: jamie on October 15, 2021, 04:16:44 pmI am not on a PC atm with multiple users so its hard for me to do this.. If you could use the debugger to step trace to which procedure is failing and let me know I can look at the code. thank you i understand that, i think the access violation happens on starting of this function function AddAceToWindowStation(hwinsta: HWINSTA; psid: PSID): Boolean; something like lLengthSidAsUnicodeString access violation