MSFN Forum: [Release] Replace Notepad with Notepad++ - MSFN Forum

Jump to content



Unattended CD/DVD Guide Homepage · MSFN Forum Rules

Welcome to the Applications Installs forum. Make sure you read the forum rules before you start posting.

Links/Requests to warez and/or any illegal material (porn, cracks, serials, etc..) will not be tolerated. Discussion of circumventing WGA/activation/timebombs/keygens or any other illegal activity will also not be tolerated.

We try our best to keep this forum clean of illegal content. If you see any illegal activity use the "report" button you find in every post to report the specific post to the moderators. If you ignore any of the rules you will be banned without notice.

Read Forum Rules
Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

[Release] Replace Notepad with Notepad++ Script to circumvent windows file protection's hold on notepad.exe Rate Topic: -----

#1 User is offline   vampus8 

  • Newbie
  • Group: Members
  • Posts: 27
  • Joined: 23-June 06

Posted 07 January 2008 - 08:00 PM

Follow these instructions to set up an unattended install of Notepad++ and replace Windows Notepad with Notepad++. Alternatively, you could just replace the files in your windows installation source but this method has the advantage that it can be run from WPI. Special thanks to Olivio over at the German nLite board and Sourceforge whose AutoIT code I modified to make the replacement tool. Here's his original post: http://sourceforge.n...?msg_id=4641563

Basically, the replacement tool copies the notepad++ launcher into c:\windows\, c:\windows\system32\, c:\windows\system32\dllcache, (and a couple other directories if they exist on your computer) replacing notepad.exe in each of those directories. The trick is that it temporarily disables windows file protection on those files so that you don't get error boxes when you try to copy the files and so that Windows doesn't panic and revert them back to the original notepad.exe.

The install process also creates a log file called Notepad_Replacement.log in your home drive (whatever drive your home directory is store in, c:\ for me) and a backup of your original notepad.exe file at C:\windows\Notepad-backup\notepad.exe.

Note: If you run the replacement utility twice it will overwrite your backup notepad.exe with the replacement file.


------------
Instructions
------------

Setup:
1) Download the Notepad++ installer from http://notepad-plus.sourceforge.net/uk/download.php .
2) Download the Notepad++ Launcher from http://notepad-plus.sourceforge.net/uk/download.php .
3) Download the replacement tool exe file from http://www.mediafire.com/?4mzdxey9n1j (or http://www.mediafire.com/?czmnbomsegg if you prefer the original .au3 file)
4) Extract notepad.exe from the Launcher and put it in the same directory as the replacement tool.

Install:
5) Run the notepad++ installer with the switch /S
6) Run the replacement tool.

Voila! A perfectly unattended way to install Notepad++ and completely replace Windows Notepad.

This post has been edited by vampus8: 07 January 2008 - 08:01 PM



#2 User is offline   Jolli 

  • Newbie
  • Group: Members
  • Posts: 35
  • Joined: 18-July 06
  • OS:XP Pro x86
  • Country: Country Flag

Posted 03 May 2008 - 04:38 PM

Link to Sourceforge is dead!

For those who don´t wont a log file and without a Gui is here a stripped autoit code:
--> for the silent installation.

 
#include <array.au3>

; load given notepad files in Array
Dim $Files[7] = [@WindowsDir & "\servicepackfiles\i386\notepad.exe", _
				@WindowsDir & "\source\WinXP\i386\notepad.exe", _
				@SystemDir & "\dllcache\notepad.exe", _
				@SystemDir & "\notepad.exe", _
				@WindowsDir & "\notepad.exe", _
				@HomeDrive & "\i386\notepad.exe", _
				@HomeDrive & "\i386\NOTEPAD.EX_"]
_ArrayDisplay($Files)

;backup MS-Notepad.exe
$WinBU=DirCreate(@WindowsDir & "\Notepad-backup")
If FileExists($Files[4]) Then FileCopy($Files[4], $WinBU, 1)
If FileExists($Files[5]) Then FileCopy($Files[5], $WinBU, 1)
If FileExists($Files[6]) Then FileCopy($Files[6], $WinBU, 1)

;temporary disables protection for MS-Notepad.exe
$Srcfile=@ScriptDir&"\notepad.exe"
For $Element In $Files
    If FileExists($Element) Then DllCall(@SystemDir & "\SFC_OS.DLL","dword", 5, "dword", 0, "wstr", $Element, "dword", -1)
    Next
	If FileExists($Element) Then FileCopy($Srcfile, $Element, 1)
Exit 


For the outstanding reader the compiled "MS-Notepad_Replacer_noGUI+Log.exe" :hello:
--> for the silent installation.
http://uploaded.to/?id=apw67d

==========================================


Here is a picture from the MS-Notepad-Replacer with a Gui:
Attached File  NPP__GUI_eng.jpg (25.66K)
Number of downloads: 19
Here the autoit code from the MS-Notepad-Replacer with Gui for a running System:
 
#cs ----------------------------------------------------------------------------
AutoIt Version: 3.2.8.1
Author:		Olivio

With friendly Help from German nLite Board from Zio82draw, AspirinJunkie

[url="http://www.german-nlite.de"]http://www.german-nlite.de[/url]

Script Function: Temporary disables Protection for MS-Notepad.exe and
				 replace it with the Notepad++ Launcher. 
#ce ----------------------------------------------------------------------------
;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
;~~~~~~~~~~~~~~~~~~~~~~ - TranslateSection Start - ~~~~~~~~~~~~~~~~~~~~~~~
;~~~~~~~~~~~~~ !! Only between " " , otherwise it will crash !! ~~~~~~~~~~~~~~~~~~
;~~~~ i.e. "Notepad++ Replacer" become "Notepad++ Remplaçant" in france ~~~~~~~~~
;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

;---GUI-----------------------------
$Npprpl = "Notepad++ Replacer" 		; Titel of GUI,  if you want to translate 
$Quest1a = "Would you really replace the"
$Quest1b = "     MS - Notepad.exe ?"
$State1a = "  Backup will be taken in"
$State1b = "'Windir - Notepad-backup'."
$State2a = "After replacing, you can read"
$State2b = " the Logfile in Notepad++."
$Buttn_r = "Replace"
$Buttn_c = "Cancel"

;--- 1. MSG - Box--------------------
$Warn = "Warning!"
$Quest2a = "An open session of the notepad.exe excist"
$Quest2b = "Please save your Session right now !"
$Quest2c = "Otherwise the Session will be closed in 20 Seconds"

;--- 2. MSG - Box--------------------
$State3 = "Successfully Replaced"
$Quest3a = "MS-Notepad.exe are all replaced by Launcher"
$Quest3b = "Would you read the Logfile now in Notepad++ ?"

;~~~~~~~~~~~~~~~~~~~~~~ - TranslateSection End - ~~~~~~~~~~~~~~~~~~~~~~~~~
;~~~~~~~~~~~~ !! Don´t translate under this line anything else!! ~~~~~~~~~~~~~~~~~
;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Opt("TrayIconHide", 1)
Opt("GUICloseOnESC", 1)
#include <GuiConstants.au3>

$Pic = (".\npp.logo1.gif")
$Quest1 = $Quest1a & @CRLF & $Quest1b
$State1 = $State1a & @CRLF & $State1b
$State2 = $State2a & @CRLF & $State2b
$date = (@MDAY&"."&@MON&"."&@YEAR&" - "&@HOUR&":"&@MIN&":"&@SEC)

GuiCreate($Npprpl, 384, 281,-1, -1 , BitOr($GUI_SS_DEFAULT_GUI, $WS_EX_TOPMOST))
GUISetIcon("Icon_3.ico")  
GuiCtrlCreatePic($Pic, 0, 0, 164, 314)
$Group_2 = GuiCtrlCreateGroup("", 175, 5, 200, 180)
$Button_3 = GuiCtrlCreateButton($Buttn_r, 181, 210, 85, 40)
$Button_4 = GuiCtrlCreateButton($Buttn_c, 283, 210, 85, 40)
GUICtrlCreateLabel($Quest1, 210, 35)
GUICtrlCreateLabel($State1, 210, 83)
GUICtrlCreateLabel($State2, 207, 133)
GuiSetState()
While 1
	$msg = GuiGetMsg()
	Select
		Case $msg = $GUI_EVENT_CLOSE
			ExitLoop
		Case $msg = $Button_4
			Exit
		Case $msg = $Button_3
			_replace()
			Exit
	EndSelect
WEnd
Exit

Func _replace()
	$rpfile=".\" & $npx
	$ServPf=@WindowsDir & "\servicepackfiles\i386\" & $npx
	$WinSwI=@WindowsDir & "\source\WinXP\i386\" & $npx
	$dlCaN=@SystemDir & "\dllcache\" & $npx
	$SysNp=@SystemDir & "\" & $npx
	$Wnpx=@WindowsDir & "\" & $npx
	$npx="notepad.exe"
	
	$log = FileOpen('Notepad.log', 2)
	FileWriteLine($log, $date & " - " & "Start the Notepad Replacement Logfile" & @CRLF & @CRLF)
	
	If ProcessExists("notepad.exe") > 0 Then
		MsgBox(32, $Warn, $Quest2a & @CRLF & $Quest2b & @CRLF & $Quest2c, 20)
		While ProcessExists($npx)
			ProcessClose($npx)
		Wend
			If ProcessClose($npx) > 0 Then
				FileWriteLine($log, $date & " - " & "OK - open Notepad Process successfully closed" & @CRLF & @CRLF)
			EndIf
		Else
		FileWriteLine($log, $date & " - " & "No open Notepad Process to close" & @CRLF & @CRLF)
	EndIf
	
	;backup Microsoft Notepad.exe
	$WinBU=@WindowsDir & "\Notepad-backup\notepad.exe"
	If FileExists($Wnpx) Then FileCopy($Wnpx, $WinBU, 1)
		If FileCopy($Wnpx, $WinBU, 1) > 0 Then
			FileWriteLine($log, $date & " - " & "OK - Notepad successfully copied in Notepad Backup" & @CRLF & @CRLF)
			Else
			FileWriteLine($log, $date & " - " & "No notepad.exe in 'WinDir'" & @CRLF & @CRLF)
		EndIf
	
	$HmDr1=@HomeDrive & "\i386\notepad.exe"
	If FileExists($HmDr1) Then FileCopy($HmDr1, $WinBU, 1)
		If FileCopy($HmDr1, $WinBU, 1) > 0 Then
			FileWriteLine($log, $date & " - " & "OK - notepad.exe successfully copied in Notepad Backup" & @CRLF & @CRLF)
			Else
			FileWriteLine($log, $date & " - " & "No notepad.exe in 'HomeDrive\i386'" & @CRLF & @CRLF)
		EndIf
	
	$HmDr2=@HomeDrive & "\i386\NOTEPAD.EX_"
	If FileExists($HmDr2) Then FileCopy($HmDr2, @WindowsDir & "\Notepad-backup\NOTEPAD.EX_", 1)
		If FileCopy($HmDr2, @WindowsDir & "\Notepad-backup\NOTEPAD.EX_", 1) > 0 Then
			FileWriteLine($log, $date & " - " & "OK - NOTEPAD.EX_ successfully copied in Notepad Backup" & @CRLF & @CRLF)
			Else
			FileWriteLine($log, $date & " - " & "No NOTEPAD.EX_ in 'HomeDrive\i386'" & @CRLF & @CRLF)
		EndIf
	
	;temporary disables protection for notepad.exe
	Dim $Array[7]
	
	$Array[0] = $ServPf
	$Array[1] = $dlCaN
	$Array[2] = $SysNp
	$Array[3] = $Wnpx
	$Array[4] = $HmDr1
	$Array[5] = $HmDr2
	$Array[6] = $WinSwI
	
	For $Element In $Array
	    If FileExists($Element) Then DllCall(@SystemDir & "\SFC_OS.DLL","dword", 5, "dword", 0, "wstr", $Element, "dword", -1)
		Next
	
	;notepad replacing in given dir
	If FileExists($ServPf) Then FileCopy($rpfile, $ServPf, 1)
		If FileCopy($rpfile, $ServPf, 1) > 0 Then
			FileWriteLine($log, $date & " - " & "OK - Launcher successfully copied in 'servicepackfiles\i386'" & @CRLF & @CRLF)
			Else
			FileWriteLine($log, $date & " - " & "No notepad.exe in 'servicepackfiles\i386'" & @CRLF & @CRLF)
		EndIf
	
	If FileExists($dlCaN) Then FileCopy($rpfile, $dlCaN, 1)
		If FileCopy($rpfile, $dlCaN, 1) > 0 Then
			FileWriteLine($log, $date & " - " & "OK - Launcher successfully copied in '\dllcache'" & @CRLF & @CRLF)
			Else
			FileWriteLine($log, $date & " - " & "No notepad.exe in '\dllcache'" & @CRLF & @CRLF)
		EndIf
	
	If FileExists($SysNp) Then FileCopy($rpfile, $SysNp, 1)
		If FileCopy($rpfile, $SysNp, 1) > 0 Then
			FileWriteLine($log, $date & " - " & "OK - Launcher successfully copied in 'systemdir'" & @CRLF & @CRLF)
			Else
			FileWriteLine($log, $date & " - " & "No notepad.exe in 'systemdir'" & @CRLF & @CRLF)
		EndIf
	
	If FileExists($Wnpx) Then FileCopy($rpfile, $Wnpx, 1)
		If FileCopy($rpfile, $Wnpx, 1) > 0 Then
			FileWriteLine($log, $date & " - " & "OK - Launcher successfully copied in 'Windir'" & @CRLF & @CRLF)
			Else
			FileWriteLine($log, $date & " - " & "No notepad.exe in 'WinDir'" & @CRLF & @CRLF)
		EndIf
	
	If FileExists($HmDr1) Then FileCopy($rpfile, $HmDr1, 1)
		If FileCopy($rpfile, $HmDr1, 1) > 0 Then
			FileWriteLine($log, $date & " - " & "OK - Launcher successfully copied in 'HomeDrive\i386\'" & @CRLF & @CRLF)
			Else
			FileWriteLine($log, $date & " - " & "No notepad.exe in 'HomeDrive\i386'" & @CRLF & @CRLF)
		EndIf
	
	If FileExists($HmDr2) Then FileCopy($rpfile, $HmDr2, 1)
		If FileCopy($rpfile, $HmDr2, 1) > 0 Then
			FileWriteLine($log, $date & " - " & "OK - Launcher successfully copied to 'HomeDrive\i386\NOTEPAD.EX_'" & @CRLF & @CRLF)
			Else
			FileWriteLine($log, $date & " - " & "No NOTEPAD.EX_ in 'HomeDrive\i386'" & @CRLF & @CRLF)
		EndIf
	
	If FileExists($WinSwI) Then FileCopy($rpfile, $WinSwI, 1)
		If FileCopy($rpfile, $WinSwI, 1) > 0 Then
			FileWriteLine($log, $date & " - " & "OK - Launcher successfully copied in 'Windir\source\WinXP\i386'" & @CRLF & @CRLF)
			Else
			FileWriteLine($log, $date & " - " & "No NOTEPAD.EX_ in 'Windir\source\WinXP\i386'" & @CRLF & @CRLF)
		EndIf
	
	FileWriteLine($log, $date & " - " & "End of Notepad Replacement Logfile")
	FileClose($log)
	
	If MsgBox(262212, $State3, $Quest3a & @CRLF & @CRLF & $Quest3b) = 7 Then 
		Exit
	EndIf
	ShellExecute(@ScriptDir & '\Notepad.log')
EndFunc 


For the outstanding reader the compiled "MS-Notepad-Replacer-Gui.exe" in zip :hello:
include the Notepad++launcher and the Notepad++ picture for the Gui.
see the picture: http://s3.directuplo...8qhbanz_jpg.htm

--> for a running system.
http://uploaded.to/?id=4w4w4p

Jolli

This post has been edited by Jolli: 07 November 2008 - 05:53 AM


#3 User is offline   Jolli 

  • Newbie
  • Group: Members
  • Posts: 35
  • Joined: 18-July 06
  • OS:XP Pro x86
  • Country: Country Flag

Posted 07 November 2008 - 06:32 AM

Link restored B)

#4 User is offline   XaviorPenguin 

  • Group: Members
  • Posts: 2
  • Joined: 13-February 05

Posted 12 November 2008 - 04:18 PM

Why do all of that when you can get the Notepad++ Launcher from their site:
http://notepad-plus.sourceforge.net/commun...auncher.bin.zip

Take that EXE and use makecab to compress it to a .ex_, place it in your i386 directory overwriting the original NOTEPAD.EX_ (make sure the Service Packs have been applied first because if you do this first and then the Service Packs, it will overwrite what you have tried to do.) and then use nLite to install the Notepad++ Addon and you are set to go.

I have tinkered with that just recently and it works.

#5 User is offline   Grake 

  • Advanced Member
  • PipPipPip
  • Group: Members
  • Posts: 369
  • Joined: 23-March 05

Posted 12 November 2008 - 06:23 PM

I guess this is for those who want it on a working windows instead of a new install. That said, I did the same thing you did. I just replaced the original notepad with this in the i386 folder.

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users



All trademarks mentioned on this page are the property of their respective owners
Copyright © 2001 - 2011 msfn.org
Privacy Policy