0

Im trying to get ownership of the uxtheme.dll in my windows 8.1 system32 folder programatically (c++). I read, tried and googled for several hours now but cant find any solution. Every time the uxtheme ownership is set, it doesnt show up in the properties tab. Ownership and full rights are always inherited by the Trusted Installer.

I tried it with system("takeown /f C:\Windows\system32\uxtheme.dll") which prints out success but sadly is not working.

Same goes for the function TakeOwnership() from msdn. [http://msdn.microsoft.com/en-us/library/windows/desktop/aa379620%28v=vs.85%29.aspx]

What do i need to do, to inherit ownership for the local admin, so i can switch out this dll? Does resource protection have anything to do with it?

Once the ownership is set will i be able to replace the dll with MoveFileEx()?

thank you very much, lody

suspectus
  • 16,548
  • 8
  • 49
  • 57
lody
  • 13
  • 2
  • When you use the `system` function it creates a *new* process for the command, which is why it will not work. – Some programmer dude Feb 16 '14 at 14:11
  • As for the `TakeOwnership` function, as with any other system function, you need to check *why* it fails. This is done with the [`GetLastError`](http://msdn.microsoft.com/en-us/library/windows/desktop/ms679360%28v=vs.85%29.aspx) function (note: only call if a function actually failed). See [here for a list of error codes](http://msdn.microsoft.com/en-us/library/windows/desktop/ms681381%28v=vs.85%29.aspx). – Some programmer dude Feb 16 '14 at 14:12
  • Thank you for your quick awnser! So should i use WinExec() or ShellEexecute() instead? As i said it doesnt fail. It quits with message "DACL changed sucessful". – lody Feb 16 '14 at 14:13
  • I just got a step further. I had to set ownership of \windows\ and \system32\ folders first before i could set the ownership for the file. Best regards ;) – lody Feb 16 '14 at 16:21

1 Answers1

0

Ok i solved my problem.

Take ownership of all directorys the file is in. Be aware: If youre running 64bit, pathes to system\ files will be redirected to SysWoW64\ folder.

lody
  • 13
  • 2