Index: Makefile.DevInstall |
=================================================================== |
new file mode 100644 |
--- /dev/null |
+++ b/Makefile.DevInstall |
@@ -0,0 +1,72 @@ |
+# |
+# NMAKE is a 32-bit application, which makes it problematic to make 64-bit registry entries with the standard command-line tools such as "reg.exe". |
Wladimir Palant
2013/06/18 15:18:33
Quite frankly, I don't think that we want to use n
Wladimir Palant
2013/06/19 07:14:15
So far no contradictions - that's why you made it
Eric
2013/06/19 15:22:54
Probably. If we want to rewrite it later, I won't
Eric
2013/06/20 14:13:47
Well, I could. But it's going to make me really cr
|
+# As a 32-bit application, when it loads "reg.exe" from the ordinary directory, %WINDIR%\System32, the WOW64 system redirects it load from %WINDIR%\SysWOW64. |
+# So even if you explicitly put in the 64-bit path, because NMAKE is 32-bit it will load the 32-bit version anyway. |
+# To get around this, we check for the existence of %WINDIR%\sysnative\reg.exe, which if present means a few things. |
+# -- 1. We're running on Windows Vista or later, because 64-bit XP doesn't have "sysnative." |
+# -- 2. We're running on a 64-bit version of Windows. |
+# -- 3. We're running from a 32-bit process, which should always be true about NMAKE. |
+# |
+# See http://ovidiupl.wordpress.com/2008/07/11/useful-wow64-file-system-trick/ for more details. |
+# |
+!if [cmd /c if exist %WINDIR%\sysnative\reg.exe exit /b 1] |
+REG=$(WINDIR)\sysnative\reg.exe |
+CMD=$(WINDIR)\sysnative\cmd.exe |
+X64=1 |
+!else |
+REG=$(WINDIR)\reg.exe |
+!message Warning: Developer installation not tested on XP or 32-bit Windows. |
+!endif |
+ |
+!message DLL=$(DLL) |
+!message DLL32=$(DLL32) |
+ |
+# |
+# Default (first) target is a help message, in case anybody runs it outside Visual Studio. |
+# |
+help: |
+ @echo This Makefile is intended to be run from within Visual Studio to provide developer installations of Adblock Plus for IE. |
+ |
+build: register64 copy |
+ |
+clean: |
+ |
+rebuild: clean build |
+ |
+# |
+# We're using "reg.exe" for the HKCU keys because the one with the DLL path name would need to be backslash-quoted to go into a .REG file. |
+# We're using "regedit.exe" for the HKLM key because (by default) "reg.exe" does not trigger UAC to prompt the user for privilege elevation and will just fail instead. |
+# |
+# Note that the CLSID is register in HKCU, which avoids the need to elevate with UAC to high integrity in order to write. |
+# Also note that the "Browser Helper Object" key is in HKLM, which is required because of IE. |
+# IE only scans in HKLM for BHO entries. |
+# IE does not scan HKCU for BHO entries, contrary to some sources online. |
+# The tale for this is that it would be a security violation to allow an Administrator to run a BHO from HKCU, |
+# since anything might have written to HKCU (a low-integrity part of the registry). |
+# On the other hand, IE could just run low-integrity BHO in a low-integrity container, but no, it can't do that. |
+# |
+ |
+# add "HKLM\Software\Microsoft\Windows\CurrentVersion\Explorer\Browser Helper Objects\{FFCB3198-32F3-4E8B-9539-4324694ED664}" /v NoExplorer /t REG_DWORD /d 1 /f >nul |
+ |
+register64: |
+ @echo Start 'register' action. |
+ $(REG) add HKCU\Software\Classes\CLSID\{FFCB3198-32F3-4E8B-9539-4324694ED664} /ve /d "Adblock Plus for IE Browser Helper Object" /f >nul |
+ $(REG) add HKCU\Software\Classes\CLSID\{FFCB3198-32F3-4E8B-9539-4324694ED664}\InprocServer32 /ve /d "$(DLL)" /f >nul |
+ $(REG) add HKCU\Software\Classes\CLSID\{FFCB3198-32F3-4E8B-9539-4324694ED664}\InprocServer32 /v ThreadingModel /d "Both" /f >nul |
+ $(CMD) /c $(WINDIR)\regedit.exe /s <<temporary.reg |
+Windows Registry Editor Version 5.00 |
+ |
+[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Browser Helper Objects\{FFCB3198-32F3-4E8B-9539-4324694ED664}] |
+@="Adblock Plus for IE" |
+"NoExplorer"=dword:1 |
+<< |
Wladimir Palant
2013/06/19 07:14:15
Yes, reg.exe runs with the privileges that you run
Wladimir Palant
2013/06/20 07:10:38
In other words, you want to ask developers to run
|
+ copy temporary.reg temporary.txt |
+ @date /t >"$(OutDir)registered.timestamp.txt" |
+ @time /t >>"$(OutDir)registered.timestamp.txt" |
+ |
+copy: |
+ copy "$(ProjectDir)files\settings.ini" "$(OutDir)settings.ini" |
+ xcopy /s /I /y /D "$(ProjectDir)html\*" "$(OutDir)html" |
+ xcopy /s /I /y /D "$(ProjectDir)locales\*" "$(OutDir)locales" |
+ @date /t >"$(OutDir)copied.timestamp.txt" |
+ @time /t >>"$(OutDir)copied.timestamp.txt" |