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

Side by Side 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.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« AdblockPlusDeveloperInstall.vcxproj ('K') | « BHO_remove.reg ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # 1 #
2 # NMAKE is a 32-bit application, which makes it problematic to make 64-bit regis try entries with the standard command-line tools such as "reg.exe". 2 # NMAKE is a 32-bit application, which makes it problematic to make 64-bit regis try entries with the standard command-line tools such as "reg.exe".
3 # 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. 3 # 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.
4 # So even if you explicitly put in the 64-bit path, because NMAKE is 32-bit it w ill load the 32-bit version anyway. 4 # So even if you explicitly put in the 64-bit path, because NMAKE is 32-bit it w ill load the 32-bit version anyway.
5 # To get around this, we check for the existence of %WINDIR%\sysnative\reg.exe, which if present means a few things. 5 # To get around this, we check for the existence of %WINDIR%\sysnative\reg.exe, which if present means a few things.
6 # -- 1. We're running on Windows Vista or later, because 64-bit XP doesn't have "sysnative." 6 # -- 1. We're running on Windows Vista or later, because 64-bit XP doesn't have "sysnative."
7 # -- 2. We're running on a 64-bit version of Windows. 7 # -- 2. We're running on a 64-bit version of Windows.
8 # -- 3. We're running from a 32-bit process, which should always be true about N MAKE. 8 # -- 3. We're running from a 32-bit process, which should always be true about N MAKE.
9 # 9 #
10 # See http://ovidiupl.wordpress.com/2008/07/11/useful-wow64-file-system-trick/ f or more details. 10 # See http://ovidiupl.wordpress.com/2008/07/11/useful-wow64-file-system-trick/ f or more details.
11 # 11 #
12 !if [cmd /c if exist %WINDIR%\sysnative\reg.exe exit /b 1] 12 !if [cmd /c if exist %WINDIR%\sysnative\reg.exe exit /b 1]
13 REG=$(WINDIR)\sysnative\reg.exe 13 REG=$(WINDIR)\sysnative\reg.exe
14 CMD=$(WINDIR)\sysnative\cmd.exe
15 X64=1 14 X64=1
16 !else 15 !else
17 REG=$(WINDIR)\reg.exe 16 REG=$(WINDIR)\reg.exe
18 !message Warning: Developer installation not tested on XP or 32-bit Windows. 17 !message Warning: Developer installation not tested on XP or 32-bit Windows.
19 !endif 18 !endif
20 19
21 !message DLL=$(DLL) 20 !message DLL=$(DLL)
22 !message DLL32=$(DLL32)
23 21
24 # 22 #
25 # Default (first) target is a help message, in case anybody runs it outside Visu al Studio. 23 # Default (first) target is a help message, in case anybody runs it outside Visu al Studio.
26 # 24 #
27 help: 25 help:
28 @echo This Makefile is intended to be run from within Visual Studio to p rovide developer installations of Adblock Plus for IE. 26 @echo This Makefile is intended to be run from within Visual Studio to p rovide developer installations of Adblock Plus for IE.
29 27
30 build: register64 copy 28 build64: register64 check_BHO copy
31 29
32 clean: 30 rebuild64: clean64 build64
33 31
34 rebuild: clean build 32 build32: register32 check_BHO copy
33
34 rebuild32: clean32 build32
35 35
36 # 36 #
37 # 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. 37 # 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.
38 # 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 i nstead.
39 # 38 #
40 # Note that the CLSID is register in HKCU, which avoids the need to elevate with UAC to high integrity in order to write. 39 # Note that the CLSID is register in HKCU, which avoids the need to elevate with UAC to high integrity in order to write.
41 # Also note that the "Browser Helper Object" key is in HKLM, which is required b ecause of IE. 40 # Also note that the "Browser Helper Object" key is in HKLM, which is required b ecause of IE.
42 # IE only scans in HKLM for BHO entries. 41 # IE only scans in HKLM for BHO entries.
43 # IE does not scan HKCU for BHO entries, contrary to some sources online. 42 # IE does not scan HKCU for BHO entries, contrary to some sources online.
44 # The tale for this is that it would be a security violation to allow an Adminis trator to run a BHO from HKCU, 43 # The tale for this is that it would be a security violation to allow an Adminis trator to run a BHO from HKCU,
45 # since anything might have written to HKCU (a low-integrity part of the regi stry). 44 # since anything might have written to HKCU (a low-integrity part of the regi stry).
46 # On the other hand, IE could just run low-integrity BHO in a low-integrity cont ainer, but no, it can't do that. 45 # On the other hand, IE could just run low-integrity BHO in a low-integrity cont ainer, but no, it can't do that.
47 # 46 #
48
49 # add "HKLM\Software\Microsoft\Windows\CurrentVersion\Explorer\Browser Helper Ob jects\{FFCB3198-32F3-4E8B-9539-4324694ED664}" /v NoExplorer /t REG_DWORD /d 1 /f >nul
50
51 register64: 47 register64:
52 @echo Start 'register' action. 48 @echo Start 'register' action.
53 $(REG) add HKCU\Software\Classes\CLSID\{FFCB3198-32F3-4E8B-9539-4324694E D664} /ve /d "Adblock Plus for IE Browser Helper Object" /f >nul 49 $(REG) add HKCU\Software\Classes\CLSID\{FFCB3198-32F3-4E8B-9539-4324694E D664} /ve /d "Adblock Plus for IE Browser Helper Object" /f >nul
54 $(REG) add HKCU\Software\Classes\CLSID\{FFCB3198-32F3-4E8B-9539-4324694E D664}\InprocServer32 /ve /d "$(DLL)" /f >nul 50 $(REG) add HKCU\Software\Classes\CLSID\{FFCB3198-32F3-4E8B-9539-4324694E D664}\InprocServer32 /ve /d "$(DLL)" /f >nul
55 $(REG) add HKCU\Software\Classes\CLSID\{FFCB3198-32F3-4E8B-9539-4324694E D664}\InprocServer32 /v ThreadingModel /d "Both" /f >nul 51 $(REG) add HKCU\Software\Classes\CLSID\{FFCB3198-32F3-4E8B-9539-4324694E D664}\InprocServer32 /v ThreadingModel /d "Both" /f >nul
56 $(CMD) /c $(WINDIR)\regedit.exe /s <<temporary.reg
57 Windows Registry Editor Version 5.00
58
59 [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Browser H elper Objects\{FFCB3198-32F3-4E8B-9539-4324694ED664}]
60 @="Adblock Plus for IE"
61 "NoExplorer"=dword:1
62 <<
63 copy temporary.reg temporary.txt
64 @date /t >"$(OutDir)registered.timestamp.txt" 52 @date /t >"$(OutDir)registered.timestamp.txt"
65 @time /t >>"$(OutDir)registered.timestamp.txt" 53 @time /t >>"$(OutDir)registered.timestamp.txt"
66 54
55 #
56 # This is exactly the same as 'register64' except it does not use the $(REG) mac ro but rather just 'reg'
57 # On 64-bit Windows, invoking it this way ends up with the 32-bit version of 're g'.
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
58 # See above about 'sysnative' for why that is.
59 # On 32-bit Windows, it does what you'd expect.
60 # Thus we can use this for 32-bit build targets on both 32- and 64-bit Windows.
61 #
62 register32:
63 @echo Start 'register' action.
64 reg add HKCU\Software\Classes\CLSID\{FFCB3198-32F3-4E8B-9539-4324694ED66 4} /ve /d "Adblock Plus for IE Browser Helper Object" /f >nul
65 reg add HKCU\Software\Classes\CLSID\{FFCB3198-32F3-4E8B-9539-4324694ED66 4}\InprocServer32 /ve /d "$(DLL)" /f >nul
66 reg add HKCU\Software\Classes\CLSID\{FFCB3198-32F3-4E8B-9539-4324694ED66 4}\InprocServer32 /v ThreadingModel /d "Both" /f >nul
67 @date /t >"$(OutDir)registered.timestamp.txt"
68 @time /t >>"$(OutDir)registered.timestamp.txt"
69
70 #
71 # Fortuitously, the warning message below is actually parsed by Visual Studio an d show up with a yellow flag in the error list.
72 #
73 check_BHO:
74 !if [$(REG) query "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\ Explorer\Browser Helper Objects\{FFCB3198-32F3-4E8B-9539-4324694ED664}" 2>&1 >nu l]
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
75 @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.
76 !endif
77
67 copy: 78 copy:
79 @echo Copying files
68 copy "$(ProjectDir)files\settings.ini" "$(OutDir)settings.ini" 80 copy "$(ProjectDir)files\settings.ini" "$(OutDir)settings.ini"
69 xcopy /s /I /y /D "$(ProjectDir)html\*" "$(OutDir)html" 81 xcopy /s /I /y /D "$(ProjectDir)html\*" "$(OutDir)html"
70 xcopy /s /I /y /D "$(ProjectDir)locales\*" "$(OutDir)locales" 82 xcopy /s /I /y /D "$(ProjectDir)locales\*" "$(OutDir)locales"
71 @date /t >"$(OutDir)copied.timestamp.txt" 83 @date /t >"$(OutDir)copied.timestamp.txt"
72 @time /t >>"$(OutDir)copied.timestamp.txt" 84 @time /t >>"$(OutDir)copied.timestamp.txt"
85
86 #
87 # N.B. We don't delete the CLSID in HKLM for clean. That wouldn't be our key, bu t 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
88 #
89 clean64:
90 $(REG) delete HKCU\Software\Classes\CLSID\{FFCB3198-32F3-4E8B-9539-43246 94ED664} /f
91
92 clean32:
93 reg delete HKCU\Software\Classes\CLSID\{FFCB3198-32F3-4E8B-9539-4324694E D664} /f
94
95 #
96 # This utility queries all the registry locations that might be present either i n a developer install or a regular one.
97 # 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.
98 # The BHO key is only relevant in HKLM. The CLSID keys may be either in HKLM or HKCU.
99 #
100 query:
101 # BHO key
102 -@$(REG) query "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVer sion\Explorer\Browser Helper Objects\{FFCB3198-32F3-4E8B-9539-4324694ED664}" 2>n ul
103 # Native platform keys
104 -@$(REG) query HKLM\Software\Classes\CLSID\{FFCB3198-32F3-4E8B-9539-4324 694ED664} /ve 2>nul
105 -@$(REG) query HKLM\Software\Classes\CLSID\{FFCB3198-32F3-4E8B-9539-4324 694ED664}\InprocServer32 2>nul
106 -@$(REG) query HKCU\Software\Classes\CLSID\{FFCB3198-32F3-4E8B-9539-4324 694ED664} /ve 2>nul
107 -@$(REG) query HKCU\Software\Classes\CLSID\{FFCB3198-32F3-4E8B-9539-4324 694ED664}\InprocServer32 2>nul
108 !ifdef X64
109 # WoW64 keys
110 -@$(REG) query HKLM\Software\Wow6432Node\Classes\CLSID\{FFCB3198-32F3-4E 8B-9539-4324694ED664} /ve 2>nul
111 -@$(REG) query HKLM\Software\Wow6432Node\Classes\CLSID\{FFCB3198-32F3-4E 8B-9539-4324694ED664}\InprocServer32 2>nul
112 -@$(REG) query HKCU\Software\Wow6432Node\Classes\CLSID\{FFCB3198-32F3-4E 8B-9539-4324694ED664} /ve 2>nul
113 -@$(REG) query HKCU\Software\Wow6432Node\Classes\CLSID\{FFCB3198-32F3-4E 8B-9539-4324694ED664}\InprocServer32 2>nul
114 !endif
OLDNEW
« AdblockPlusDeveloperInstall.vcxproj ('K') | « BHO_remove.reg ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld