Page 1 of 1 1
Topic Options
#207398 - 2013-06-07 12:55 PM overwriting a system file
Robdutoit Offline
Hey THIS is FUN
***

Registered: 2012-03-27
Posts: 363
Loc: London, England
Some months ago, I edited a file called authui.dll which is in the windows\system32 directory. I edited the file to remove the picture from the windows 7 login ui and to change the font from white to blue for some of my clients who had a white background as their default background jpg for the login screen.

I created a script to move the original authui.dll file to authuiobsolete.dll and copied the modified authui.dll from the netlogon folder to the windows\system32 folder

 Code:
If Exist("%windir%\system32\oobe\Info\Backgrounds\BackgroundDefault.jpg") AND Not Exist("%windir%\system32\authuiobsolete.dll")
   shell 'takeown /a /f %SystemRoot%\System32\authui.dll'
   shell 'ICACLS %SystemRoot%\System32\authui.dll /Grant Administrators:F'
   ? "removing the Picture Icon on windows 7 login screen"
   move ("%windir%\system32\authui.dll") ("%windir%\system32\authuiobsolete.dll")
   copy ("\\" + $MyDomain + "\netlogon\patches\authui.dll") ("%windir%\system32\authui.dll")
Endif


this worked beautifully when rolling out my clients. However, I have encountered a problem in that it seems that windows update is updating the damn file and overwriting my changes ! Argghh.

So like a dutiful hardworking overworked technician, I modified the script to check the version of the authui.dll file instead of checking for the existence of the authuiobsolete.dll file.

So I am now using this script

 Code:
;=============================================================================================
; remove picture icon on Windows 7 login only if BackgroundDefault.jpg picture actually exists
;=============================================================================================

If Exist("%windir%\system32\oobe\Info\Backgrounds\BackgroundDefault.jpg") 
and
GetFileVersion("%windir%\system32\authui.dll", "ProductVersion") <> "6.1.7601.17514"
 ? "We need to update this"
  shell 'takeown /a /f %SystemRoot%\System32\authui.dll'
  shell 'ICACLS %SystemRoot%\System32\authui.dll /Grant Administrators:F'
  ? "removing the Picture Icon on windows 7 login screen"
  move ("%windir%\system32\authui.dll") ("%windir%\system32\authuiobsolete.dll") /c /h /r
  copy ("\\" + $MyDomain + "\netlogon\patches\authui.dll") ("%windir%\system32\authui.dll") /c /h /r
; fileversame("\\" + $MyDomain + "\netlogon\patches\", "%windir%\system32\", "authui.dll", "6.1.7601.17514")
Else
 ? "Do Nothing at all"
Endif


The problem that I am encountering is that it appears that some of the computers are moving the authui.dll to authuiobsolete.dll but not copying the authui.dll file from the netlogon folder onto the computer. this results in a black scren with a cursor and no way to login to the computer. I have to forcibly shutdown the computer and reboot it and it will then copy the authui.dll file across.

I believe that the problem is being caused by a file lock on the authui.dll process or something, so although the authui.dll file no longer exists as its being deleted before the process is locked, it is not able to copy the correct authui.dll file because of this lock. This is my best guess. I believe that when I was originally imaging the computers, that startup script ran AFTER the login ui as the computers logged in automatically after installing the image from Windows Deployment Server, therefore the authui.dll file was not locked because the computer was not sitting at the login ui stage. This may or may not be the problem.

There may be something else causing the issue. But the result is that random computers are I think deleting the authui.dll file and not copying the one from the netlogon folder with the result that the computer sits there with a blank screen a cursor flashing. the only remedy is to forcibly reboot the machine and then it copies the authui.dll file across.

Any ideas welcome.

The authui.dll file changes are based on something like this website.

http://superuser.com/questions/552743/ca...en-in-windows-7

Thanks Rob

I have looked at the move command and I see that I can use a

move source destination /P (which waits until reboot according to the documentation. Would this work in the way I think it does i.e. copies the file from the netlogon folder and when the computer reboots, it then copies the file to the authui.dll file. If so, then this would be much better than deleting the authui.dll file. If this move /P command does not work like that, what options are then in kixtart to replace the file.

Or does anyone have any ideas about this authui.dll issue. I fail to see the point of Microsoft allowing you to change the logon background wallpaper, but not allowing you to remove the picture icon, by token of windows update overwriting your changes in the authui.dll file !

Top
#207399 - 2013-06-07 02:01 PM Re: overwriting a system file [Re: Robdutoit]
Allen Administrator Offline
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4574
Loc: USA
Move and Copy are commands, not functions.... so those parentheses need to go. Almost surprised they are not interfering, but Kix can be very forgiving...

On your superuser link there is this... "You might also need to disable system file protection, otherwise Windows may detect the change and restore the original file"

Aside from that, I'm not going to be much help. Can't say I want to endorse this kind of system modification from a script.
_________________________
(... better days ahead)

Top
#207401 - 2013-06-08 04:36 PM Re: overwriting a system file [Re: Allen]
Robdutoit Offline
Hey THIS is FUN
***

Registered: 2012-03-27
Posts: 363
Loc: London, England
Thanks for the response Allen. I don't think the system file protection is the issue as the file is only updated after certain windows updates. I use the parentheses to make my script more easily readable for me. Most of my script is like that and it doesn't seem to cause any problems.

I am not sure what I will ultimately do about this issue. Its kinda silly Microsoft giving you the option to change the wallpaper background without allowing you to address issues such as font colour. I agree that editing a system file like that is not desirable, but thats the way it is. I will have a look at it in more detail at some point.
Thanks

Top
#207402 - 2013-06-08 05:30 PM Re: overwriting a system file [Re: Robdutoit]
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
 Originally Posted By: Robdutoit
I use the parentheses to make my script more easily readable for me. Most of my script is like that and it doesn't seem to cause any problems.

IMHO, relying on the forgiving nature of KIX could bite you after an upgrade proves to be less forgiving. I always advocate keeping the syntax as pure as possible.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
1 registered (Henriques) and 2516 anonymous users online.
Newest Members
fgarcia, Viginette, ManuvdWielNL, Sir_Barrington, batdk82
17889 Registered Users

Generated in 0.136 seconds in which 0.11 seconds were spent on a total of 13 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org