Chave irrestrita regedit
15/07/2008
0
Eu gravo algumas informações no registro do windows e quando um usuário comum ( não administrador) vai usar o sistema dá erro pois o usuário não é o proprietário da chave.
Mas se for usuário administrador, não dá problemas.
Obrigado.
Craudio
Post mais votado
16/07/2008
Isso funciona para D6 ?
[Error] UanPatchProtecao.pas(46): Undeclared identifier: ´SECURITY_WORLD_SID_AUTHORITY´
[Warning] UanPatchProtecao.pas(47): Constant 0 converted to NIL
[Error] UanPatchProtecao.pas(53): Undeclared identifier: ´SECURITY_WORLD_RID´
[Error] UanPatchProtecao.pas(55): Undeclared identifier: ´TAccess_Allowed_ACE´
[Error] UanPatchProtecao.pas(59): Undeclared identifier: ´ACL_REVISION´
Abraco.
Craudio
Mais Posts
16/07/2008
Comodelphi
abcs.
16/07/2008
Craudio
Obrigado
16/07/2008
Comodelphi
function SetRegistryPerm : Boolean; var eia: TSIDIdentifierAuthority; pEveryoneSID : PSID; sd: Windows.TSecurityDescriptor; pDacl: PACL; dwAclSize: DWORD; aHKey: HKEY; lRetCode: LongInt; begin eia.Value[0] := 0; eia.Value[1] := 0; eia.Value[2] := 0; eia.Value[3] := 0; eia.Value[4] := 0; eia.Value[5] := SECURITY_WORLD_SID_AUTHORITY; pEveryoneSID := 0; pDacl := nil; lRetCode := RegOpenKeyEx(HKEY_LOCAL_MACHINE, ´SOFTWARE\xxxxx\´, 0, WRITE_DAC, aHKey); AllocateAndInitializeSID(eia, 1, SECURITY_WORLD_RID, 0, 0, 0, 0, 0, 0, 0, pEveryoneSid); dwAclSize := sizeof(TACL) + 2 * ( sizeof(TAccess_Allowed_ACE) - sizeof(DWORD) ) + GetLengthSid(pEveryoneSid); pDacl := PACL(HeapAlloc(GetProcessHeap(), 0, dwAclSize)); InitializeAcl(pDacl^, dwAclSize,ACL_REVISION); AddAccessAllowedAce(pDacl^, ACL_REVISION, KEY_ALL_ACCESS, pEveryoneSid); InitializeSecurityDescriptor(@sd, SECURITY_DESCRIPTOR_REVISION); SetSecurityDescriptorDacl(@sd, TRUE, pDacl, FALSE); lRetCode := RegSetKeySecurity(aHKey, SECURITY_INFORMATION(DACL_SECURITY_INFORMATION), @sd); if (lRetCode <> ERROR_SUCCESS) then ShowMessage(´Falha ao atribuir permissão a chave de registro!´) else ShowMessage(´Permissão a chave de registro concluida com exito!´); end;
uso essa função em um pequeno patch, que deve ser rodado como administrador...
os tipos usados estão na unit windows, system.
17/07/2008
Craudio
http://forum.devmedia.com.br/viewtopic.php?t=94480&highlight=regedit
Obrigado pela ajuda !
Abraco
14/02/2019
Jorgeneves338
Isso funciona para D6 ?
[Error] UanPatchProtecao.pas(46): Undeclared identifier: ´SECURITY_WORLD_SID_AUTHORITY´
[Warning] UanPatchProtecao.pas(47): Constant 0 converted to NIL
[Error] UanPatchProtecao.pas(53): Undeclared identifier: ´SECURITY_WORLD_RID´
[Error] UanPatchProtecao.pas(55): Undeclared identifier: ´TAccess_Allowed_ACE´
[Error] UanPatchProtecao.pas(59): Undeclared identifier: ´ACL_REVISION´
Abraco.
Boa Tarde,
você consegui sair deste erros sou iniciante e não estou conseguindo concluir o codigo.
Clique aqui para fazer login e interagir na Comunidade :)