Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: Makefile.DevInstall

Issue 10952045: Developer installation from within Visual Studio (Closed)
Patch Set: Took UAC out of the build loop Created June 19, 2013, 4:54 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« AdblockPlusDeveloperInstall.vcxproj ('K') | « BHO_remove.reg ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Makefile.DevInstall
===================================================================
--- a/Makefile.DevInstall
+++ b/Makefile.DevInstall
@@ -11,7 +11,6 @@
#
!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
@@ -19,7 +18,6 @@
!endif
!message DLL=$(DLL)
-!message DLL32=$(DLL32)
#
# Default (first) target is a help message, in case anybody runs it outside Visual Studio.
@@ -27,15 +25,16 @@
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
+build64: register64 check_BHO copy
-clean:
+rebuild64: clean64 build64
-rebuild: clean build
+build32: register32 check_BHO copy
+
+rebuild32: clean32 build32
#
# 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.
@@ -45,28 +44,71 @@
# 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
-<<
- copy temporary.reg temporary.txt
@date /t >"$(OutDir)registered.timestamp.txt"
@time /t >>"$(OutDir)registered.timestamp.txt"
+#
+# This is exactly the same as 'register64' except it does not use the $(REG) macro but rather just 'reg'
+# On 64-bit Windows, invoking it this way ends up with the 32-bit version of 'reg'.
Wladimir Palant 2013/06/20 07:10:38 How about renaming the current REG variable into R
Eric 2013/06/20 14:13:47 I want to disagree with one thing. Nothing is ever
+# See above about 'sysnative' for why that is.
+# On 32-bit Windows, it does what you'd expect.
+# Thus we can use this for 32-bit build targets on both 32- and 64-bit Windows.
+#
+register32:
+ @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
+ @date /t >"$(OutDir)registered.timestamp.txt"
+ @time /t >>"$(OutDir)registered.timestamp.txt"
+
+#
+# Fortuitously, the warning message below is actually parsed by Visual Studio and show up with a yellow flag in the error list.
+#
+check_BHO:
+!if [$(REG) query "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Browser Helper Objects\{FFCB3198-32F3-4E8B-9539-4324694ED664}" 2>&1 >nul]
Wladimir Palant 2013/06/20 07:10:38 What about HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node
Eric 2013/06/20 14:13:47 You're correct. I also need to add it to the query
+ @echo Warning: BHO key not registered. IE cannot find the plugin unless the BHO key is present in the registry. Use "BHO_add.reg" to add the key.
+!endif
+
copy:
+ @echo Copying files
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"
+
+#
+# N.B. We don't delete the CLSID in HKLM for clean. That wouldn't be our key, but the installer's.
Wladimir Palant 2013/06/20 07:10:38 IMHO, since this is about the development environm
Eric 2013/06/20 14:13:47 There are three reasons not to delete installer ke
+#
+clean64:
+ $(REG) delete HKCU\Software\Classes\CLSID\{FFCB3198-32F3-4E8B-9539-4324694ED664} /f
+
+clean32:
+ reg delete HKCU\Software\Classes\CLSID\{FFCB3198-32F3-4E8B-9539-4324694ED664} /f
+
+#
+# This utility queries all the registry locations that might be present either in a developer install or a regular one.
+# The '-' annotation means to ignore the error code. '2>nul' means to ignore any error text. It's not an error for a registry key to be absent.
+# The BHO key is only relevant in HKLM. The CLSID keys may be either in HKLM or HKCU.
+#
+query:
+# BHO key
+ -@$(REG) query "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Browser Helper Objects\{FFCB3198-32F3-4E8B-9539-4324694ED664}" 2>nul
+# Native platform keys
+ -@$(REG) query HKLM\Software\Classes\CLSID\{FFCB3198-32F3-4E8B-9539-4324694ED664} /ve 2>nul
+ -@$(REG) query HKLM\Software\Classes\CLSID\{FFCB3198-32F3-4E8B-9539-4324694ED664}\InprocServer32 2>nul
+ -@$(REG) query HKCU\Software\Classes\CLSID\{FFCB3198-32F3-4E8B-9539-4324694ED664} /ve 2>nul
+ -@$(REG) query HKCU\Software\Classes\CLSID\{FFCB3198-32F3-4E8B-9539-4324694ED664}\InprocServer32 2>nul
+!ifdef X64
+# WoW64 keys
+ -@$(REG) query HKLM\Software\Wow6432Node\Classes\CLSID\{FFCB3198-32F3-4E8B-9539-4324694ED664} /ve 2>nul
+ -@$(REG) query HKLM\Software\Wow6432Node\Classes\CLSID\{FFCB3198-32F3-4E8B-9539-4324694ED664}\InprocServer32 2>nul
+ -@$(REG) query HKCU\Software\Wow6432Node\Classes\CLSID\{FFCB3198-32F3-4E8B-9539-4324694ED664} /ve 2>nul
+ -@$(REG) query HKCU\Software\Wow6432Node\Classes\CLSID\{FFCB3198-32F3-4E8B-9539-4324694ED664}\InprocServer32 2>nul
+!endif
« AdblockPlusDeveloperInstall.vcxproj ('K') | « BHO_remove.reg ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld