Skip to content

Commit c0c4cec

Browse files
committed
Initial commit for FixBlockedFonts TSP
0 parents  commit c0c4cec

9 files changed

Lines changed: 182 additions & 0 deletions

File tree

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<dcmPS:AdvDiagnosticPackage SchemaVersion="1.0" Localized="false" xmlns:dcmPS="http://www.microsoft.com/schemas/dcm/package/2007" xmlns:dcmRS="http://www.microsoft.com/schemas/dcm/resource/2007">
3+
<DiagnosticIdentification>
4+
<ID>72954d23-2250-4068-80f2-828d15ce40b3</ID>
5+
<Version>1.0</Version>
6+
</DiagnosticIdentification>
7+
<DisplayInformation>
8+
<Parameters />
9+
<Name>
10+
<dcmRS:LocalizeResourceElement comment="Comment" index="1">Blocked Fonts</dcmRS:LocalizeResourceElement>
11+
</Name>
12+
<Description>
13+
<dcmRS:LocalizeResourceElement comment="This is a comment" index="4">Looks for fonts containing a Mark of the Web. These fonts can cause problems with applications running on Windows 10.</dcmRS:LocalizeResourceElement>
14+
</Description>
15+
</DisplayInformation>
16+
<PrivacyLink></PrivacyLink>
17+
<PowerShellVersion>2.0</PowerShellVersion>
18+
<SupportedOSVersion clientSupported="true" serverSupported="true">10.0</SupportedOSVersion>
19+
<Rootcauses>
20+
<Rootcause>
21+
<ID>RC_BlockedFont</ID>
22+
<DisplayInformation>
23+
<Parameters />
24+
<Name>
25+
<dcmRS:LocalizeResourceElement comment="" index="2">A system font contains a Mark of the Web</dcmRS:LocalizeResourceElement>
26+
</Name>
27+
<Description />
28+
</DisplayInformation>
29+
<Troubleshooter>
30+
<Script>
31+
<Parameters />
32+
<ProcessArchitecture>Any</ProcessArchitecture>
33+
<RequiresElevation>true</RequiresElevation>
34+
<RequiresInteractivity>false</RequiresInteractivity>
35+
<FileName>TS_RC_BlockedFont.ps1</FileName>
36+
<ExtensionPoint />
37+
</Script>
38+
<ExtensionPoint />
39+
</Troubleshooter>
40+
<Resolvers>
41+
<Resolver>
42+
<ID>Resolver1</ID>
43+
<DisplayInformation>
44+
<Parameters />
45+
<Name>
46+
<dcmRS:LocalizeResourceElement comment="" index="3">Remove Mark of the Web</dcmRS:LocalizeResourceElement>
47+
</Name>
48+
<Description />
49+
</DisplayInformation>
50+
<RequiresConsent>false</RequiresConsent>
51+
<Script>
52+
<Parameters></Parameters>
53+
<ProcessArchitecture>Any</ProcessArchitecture>
54+
<RequiresElevation>true</RequiresElevation>
55+
<RequiresInteractivity>false</RequiresInteractivity>
56+
<FileName>RS_RC_BlockedFont.ps1</FileName>
57+
<ExtensionPoint />
58+
</Script>
59+
<ExtensionPoint />
60+
</Resolver>
61+
</Resolvers>
62+
<Verifier>
63+
<Script>
64+
<Parameters />
65+
<ProcessArchitecture>Any</ProcessArchitecture>
66+
<RequiresElevation>true</RequiresElevation>
67+
<RequiresInteractivity>false</RequiresInteractivity>
68+
<FileName>TS_RC_BlockedFont.ps1</FileName>
69+
<ExtensionPoint />
70+
</Script>
71+
<ExtensionPoint />
72+
</Verifier>
73+
<ContextParameters />
74+
<ExtensionPoint />
75+
</Rootcause>
76+
</Rootcauses>
77+
<Interactions>
78+
<SingleResponseInteractions />
79+
<MultipleResponseInteractions />
80+
<TextInteractions />
81+
<PauseInteractions />
82+
<LaunchUIInteractions />
83+
</Interactions>
84+
<ExtensionPoint></ExtensionPoint>
85+
</dcmPS:AdvDiagnosticPackage>

FixBlockedFonts/Functions.ps1

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
Function Get-BadFontPaths()
2+
{
3+
$BadFontPaths = @()
4+
5+
$SearchLocations = @(
6+
"$env:LocalAppData\Microsoft\Windows\Fonts",
7+
"$env:SystemRoot\Fonts"
8+
)
9+
10+
$SearchLocations | ForEach-Object {
11+
Write-DiagProgress "Scanning $_"
12+
13+
Get-ChildItem -Recurse -Filter *.ttf $_ | ForEach-Object {
14+
$Stream = $_.FullName + ":Zone.Identifier"
15+
$ZoneId = Get-Content $Stream -ErrorAction Ignore
16+
if($ZoneId -like "*ZoneTransfer*") {
17+
$_.FullName
18+
}
19+
}
20+
}
21+
}

FixBlockedFonts/Package.cmd

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
makecat -v packaging/solution.cdf
2+
signtool sign /a /fd SHA256 /tr http://rfc3161timestamp.globalsign.com/advanced /td SHA256 output\DiagPackage.cat
3+
4+
makecab /f packaging/solution.ddf
5+
signtool sign /a /fd SHA256 /tr http://rfc3161timestamp.globalsign.com/advanced /td SHA256 output\cab\FixBlockedFonts.diagcab

FixBlockedFonts/ProjectFile.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Files xmlns="http://www.microsoft.com/schemas/dcm/projectfile/2007">
3+
<FileName xmlns="">Functions.ps1</FileName>
4+
</Files>
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
. ./Functions.ps1
2+
3+
Get-BadFontPaths | ForEach-Object {
4+
Write-DiagProgress "Removing Mark of the Web from " + $_
5+
Unblock-File $_
6+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
. ./Functions.ps1
2+
$RootCauseID = "RC_BlockedFont"
3+
4+
Update-DiagRootCause -Id $RootCauseId -Detected ([bool](Get-BadFontPaths))
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
[CatalogHeader]
2+
Name=DiagPackage.cat
3+
ResultDir=output
4+
PublicVersion=0x0000001
5+
EncodingType=0x00010001
6+
CATATTR1=0x10010001:OSAttr:2:10.0
7+
HashAlgorithms=SHA256
8+
9+
[CatalogFiles]
10+
<hash>FixBlockedFonts.diagpkg=.\output\FixBlockedFonts.diagpkg
11+
<hash>FixBlockedFonts.diagpkgATTR1=0x10010001:Filename:FixBlockedFonts.diagpkg
12+
13+
<hash>Functions.ps1=.\output\Functions.ps1
14+
<hash>Functions.ps1ATTR1=0x10010001:Filename:Functions.ps1
15+
16+
<hash>RS_RC_BlockedFont.ps1=.\output\RS_RC_BlockedFont.ps1
17+
<hash>RS_RC_BlockedFont.ps1ATTR1=0x10010001:Filename:RS_RC_BlockedFont.ps1
18+
19+
<hash>TS_RC_BlockedFont.ps1=.\output\TS_RC_BlockedFont.ps1
20+
<hash>TS_RC_BlockedFont.ps1ATTR1=0x10010001:Filename:TS_RC_BlockedFont.ps1
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
.Set CabinetNameTemplate=output\cab\FixBlockedFonts.diagcab
2+
.Set DiskDirectory1=.
3+
.Set CompressionType=MSZIP
4+
.Set Cabinet=on
5+
.Set Compress=on
6+
.Set CabinetFileCountThreshold=0
7+
.Set FolderFileCountThreshold=0
8+
.Set FolderSizeThreshold=0
9+
.Set MaxCabinetSize=0
10+
.Set MaxDiskFileCount=0
11+
.Set MaxDiskSize=0
12+
output\DiagPackage.cat
13+
output\FixBlockedFonts.diagpkg
14+
output\Functions.ps1
15+
output\RS_RC_BlockedFont.ps1
16+
output\TS_RC_BlockedFont.ps1

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2019 File-New-Project
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

0 commit comments

Comments
 (0)