Подскажите в какую сторону копать. Какие функции используются чтобы завладень веткой реестра и добавить себе привелегий. Привелегии для установки владельца есть, в реестре regedit всё можно установить щёлкая мышкой =) Нужно сделать это программно.
примерно так =))) Код (Text): BOOL GrantKeyAccess(HKEY hKey, SECURITY_DESCRIPTOR*& ptrCurrentPermissions) { PACL pDacl = NULL; SECURITY_DESCRIPTOR secDesc = {0}; BOOL bDaclPresent = FALSE; BOOL bDaclDefaulted = FALSE; EXPLICIT_ACCESS expilictAccess = {0}; PACL newDACL = NULL; LONG Error = ERROR_SUCCESS; DWORD currentSize = 0; BOOL Result = FALSE; ptrCurrentPermissions = NULL; // Let the system tell us how big this should be, this could be part of the problem if we // are intializing to a size that is too large. Also we need to clear the structure before using if (ERROR_INSUFFICIENT_BUFFER == (Error = RegGetKeySecurity(hKey, DACL_SECURITY_INFORMATION, ptrCurrentPermissions, ¤tSize))) { ptrCurrentPermissions = (SECURITY_DESCRIPTOR*)malloc(currentSize); memset(ptrCurrentPermissions,0x0,currentSize); if (ERROR_SUCCESS != (Error = RegGetKeySecurity(hKey, DACL_SECURITY_INFORMATION, ptrCurrentPermissions, ¤tSize))) goto Exit; } else goto Exit; if (!IsValidSecurityDescriptor(ptrCurrentPermissions)) goto Exit; if (!GetSecurityDescriptorDacl(ptrCurrentPermissions, &bDaclPresent, &pDacl, &bDaclDefaulted)) goto Exit; BuildExplicitAccessWithName(&expilictAccess, TEXT("CURRENT_USER"), MAXIMUM_ALLOWED, SET_ACCESS, NO_INHERITANCE); if(ERROR_SUCCESS != (Error = SetEntriesInAcl(1, &expilictAccess, pDacl, &newDACL))) goto Exit; if(!InitializeSecurityDescriptor(&secDesc, 1)) goto Exit; if(!SetSecurityDescriptorDacl(&secDesc, TRUE, newDACL, FALSE)) goto Exit; //SetSecurityDesciptorControl if(!SetSecurityDescriptorControl(&secDesc, 0x1400, 0x1400)) goto Exit; if (!IsValidSecurityDescriptor(&secDesc)) goto Exit; if (RegSetKeySecurity(hKey, DACL_SECURITY_INFORMATION, &secDesc)) goto Exit; Result = TRUE; Exit: if (pDacl) LocalFree(pDacl); if (newDACL) LocalFree(newDACL); if (!Result && ptrCurrentPermissions) { free(ptrCurrentPermissions); ptrCurrentPermissions = NULL; } return Result; }
А как сделать владельцем группу администраторы? Код (Text): invoke RegOpenKey,HKEY_LOCAL_MACHINE,addr aKey,addr hKey re: invoke RegGetKeySecurity,hKey, OWNER_SECURITY_INFORMATION, pCurPer, addr currentSize test eax,eax jz nxt cmp eax,ERROR_INSUFFICIENT_BUFFER je @f jmp nxt @@: invoke GlobalAlloc,GMEM_FIXED,currentSize mov pCurPer,eax invoke RtlZeroMemory,eax,currentSize jmp re nxt: invoke SetSecurityDescriptorOwner ????? invoke RegSetKeySecurity,hKey, OWNER_SECURITY_INFORMATION, pCurPer test eax,eax jnz exit ....
Код (Text): .data hKey dd ? nSize dd ? domianLen dd 0 cbSid dd 0 secDesc SECURITY_DESCRIPTOR <> sid SID <> bDaclDefaulted BOOL FALSE aKey db 'SOFTWARE\test',0 sid_name_use db 255 dup(?) buffer db 100 dup(?) domian db 100 dup(?) .code mov nSize,100 invoke GetUserName,addr buffer,addr nSize ;Получаем размер под буферы invoke LookupAccountName,0,addr buffer,addr sid,addr cbSid,addr domian,addr domianLen,addr sid_name_use ;Получаем SID invoke LookupAccountName,0,addr buffer,addr sid,addr cbSid,addr domian,addr domianLen,addr sid_name_use invoke RegCreateKeyEx,HKEY_CURRENT_USER,addr aKey,0,0,REG_OPTION_NON_VOLATILE,KEY_ALL_ACCESS or WRITE_OWNER,0,ADDR hKey,0 invoke InitializeSecurityDescriptor,addr secDesc,1 invoke SetSecurityDescriptorOwner,addr secDesc,addr sid,addr bDaclDefaulted invoke RegSetKeySecurity,hKey, OWNER_SECURITY_INFORMATION,addr secDesc Вот такой вот код навоял, только почемуто он не пашет, Все функции возвращают статус успешного завершения, проверено в отладчике, но владелец не меняется, текущий владелец группа "Администраторы" этот код должен сделать владельцем текущего юзера но почемуто не работает, помогите разобратся =(
Подскажите пожалуйста как удалить данные ветки без изменения прав доступа в реестре. Я не программист........буду рад если кто поможет. спасибо. HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Enum\ACPI_HAL HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Enum\Root\ACPI_HAL HKEY_LOCAL_MACHINE\SYSTEM\ControlSet002\Enum\ACPI_HAL HKEY_LOCAL_MACHINE\SYSTEM\ControlSet002\Enum\Root\ACPI_HAL