Skip to content

Commit

Permalink
IQ
Browse files Browse the repository at this point in the history
  • Loading branch information
stevencohn committed Feb 19, 2022
1 parent ed725eb commit 63dc1fb
Show file tree
Hide file tree
Showing 4 changed files with 170 additions and 2 deletions.
1 change: 1 addition & 0 deletions OneMore.sln
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
.editorconfig = .editorconfig
build.ps1 = build.ps1
install-vsix.ps1 = install-vsix.ps1
iq.ps1 = iq.ps1
LICENSE = LICENSE
README.md = README.md
register-onemore.reg = register-onemore.reg
Expand Down
4 changes: 2 additions & 2 deletions OneMore/AddIn.cs
Original file line number Diff line number Diff line change
Expand Up @@ -134,14 +134,14 @@ public void OnConnection(
// from shutting down. Instead, use our ApplicationManager only as needed.

int count = custom == null ? 0 : custom.Length;
logger.WriteLine($"OnConnection(ConnectionMode:{ConnectMode},{count})");
logger.WriteLine($"OnConnection(ConnectionMode:{ConnectMode},custom[{count}])");
}


public void OnAddInsUpdate(ref Array custom)
{
int count = custom == null ? 0 : custom.Length;
logger.WriteLine($"OneAddInsUpdate(custom[]:{count})");
logger.WriteLine($"OneAddInsUpdate(custom[{count}])");
}


Expand Down
167 changes: 167 additions & 0 deletions iq.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,167 @@
<#
.SYNOPSIS
Installation qualification
#>

param (
[switch] $Registry = $true
)

Begin
{
$script:guid = '{88AB88AB-CDFB-4C68-9C3A-F10B75A5BC61}'

function HasKey
{
param($kpath)
if (-not (Test-Path $kpath))
{
write-Host "key not found: $kpath" -ForegroundColor Red
return $false
}
return $true
}

function HasProperty
{
param($kpath, $name)
$ok = (Get-ItemProperty $kpath).PSObject.Properties.Name -contains $name
if (-not $ok)
{
write-Host "property not found: $kpath\$name" -ForegroundColor Red
return $false
}
return $true
}

function HasValue
{
param($kpath, $name, $value)
if (-not (HasProperty $kpath $name))
{
return $false
}
$v = (Get-ItemPropertyValue -Path $kpath -Name $name)
if ($value.Contains('*'))
{
if (-not ($v -like $value))
{
Write-Host "invalid value: $kpath\$name, '$v' <> '$value'" -ForegroundColor Red
return $false
}
}
elseif ($v -ne $value)
{
Write-Host "invalid value: $kpath\$name, '$v' <> '$value'" -ForegroundColor Red
return $false
}
return $true
}

function CheckAppID
{
$0 = "Registry::HKEY_CLASSES_ROOT\AppID\$guid"
if (-not (HasKey $0)) { return }
if (-not (HasValue $0 'DllSurrogate' '')) { return }
Write-Host "OK $0"
}

function CheckRoot
{
$0 = "Registry::HKEY_CLASSES_ROOT\onemore"
if (-not (HasKey $0)) { return }
if (-not (HasValue $0 '(default)' 'URL:OneMore Protocol Handler')) { return }
if (-not (HasValue $0 'URL Protocol' '')) { return }
Write-Host "OK $0"
}

function CheckShell
{
$0 = "Registry::HKEY_CLASSES_ROOT\onemore\shell\open\command"
if (-not (HasKey $0)) { return }
if (-not (HasValue $0 '(default)' '*\OneMoreProtocolHandler.exe %1 %2 %3 %4 %5')) { return }
Write-Host "OK $0"
}

function CheckAddIn
{
$0 = "Registry::HKEY_CLASSES_ROOT\River.OneMoreAddIn"
if (-not (HasKey $0)) { return }
if (-not (HasValue $0 '(default)' 'River.OneMoreAddIn.AddIn')) { return }
$1 = "$0\CLSID"
if (-not (HasValue $1 '(default)' $guid)) { return }
$1 = "$0\CurVer"
if (-not (HasValue $1 '(default)' 'River.OneMoreAddIn.1')) { return }
Write-Host "OK $0"

$0 = "Registry::HKEY_CLASSES_ROOT\River.OneMoreAddIn.1"
if (-not (HasValue $0 '(default)' 'Addin class')) { return }
$1 = "$0\CLSID"
if (-not (HasValue $1 '(default)' $guid)) { return }
Write-Host "OK $0"
}

function CheckCLSID
{
$0 = "Registry::HKEY_CLASSES_ROOT\CLSID\$guid"
if (-not (HasKey $0)) { return }
if (-not (HasValue $0 '(default)' 'River.OneMoreAddIn.AddIn')) { return }
if (-not (HasValue $0 'AppID' $guid)) { return }

$1 = "$0\Implemented Categories\{62C8FE65-4EBB-45E7-B440-6E39B2CDBF29}"
if (-not (HasKey $0)) { return }

$1 = "$0\InprocServer32"
if (-not (HasKey $1)) { return }
if (-not (HasValue $1 '(default)' 'mscoree.dll')) { return }
if (-not (HasValue $1 'ThreadingModel' 'Both')) { return }
if (-not (HasValue $1 'CodeBase' '*\River.OneMoreAddIn.dll')) { return }
if (-not (HasValue $1 'Class' 'River.OneMoreAddIn.AddIn')) { return }
if (-not (HasValue $1 'RuntimeVersion' 'v*')) { return }
if (-not (HasValue $1 'Assembly' 'River.OneMoreAddIn, Version=*')) { return }

$1 = "$0\InprocServer32\"

$1 = "$0\ProgID"
if (-not (HasKey $1)) { return }
if (-not (HasValue $1 '(default)' 'River.OneMoreAddIn')) { return }

$1 = "$0\Programmable"
if (-not (HasKey $1)) { return }
if (-not (HasValue $1 '(default)' '')) { return }

$1 = "$0\TypeLib"
if (-not (HasKey $1)) { return }
if (-not (HasValue $1 '(default)' $guid)) { return }

$1 = "$0\VersionIndependentProgID"
if (-not (HasKey $1)) { return }
if (-not (HasValue $1 '(default)' 'River.OneMoreAddIn')) { return }

Write-Host "OK $0"
}

function CheckUser
{
$0 = "Registry::HKEY_CURRENT_USER\SOFTWARE\Classes\AppID\$guid"
if (-not (HasKey $0)) { return }
if (-not (HasValue $0 'DllSurrogate' '')) { return }

$0 = "Registry::HKEY_CURRENT_USER\SOFTWARE\Microsoft\Office\OneNote\AddIns\River.OneMoreAddIn"
if (-not (HasValue $0 'LoadBehavior' '3')) { return }
if (-not (HasValue $0 'Description' 'Extension for OneNote')) { return }
if (-not (HasValue $0 'FriendlyName' 'OneMoreAddIn')) { return }

$0 = "Registry::HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\River.OneMoreAddIn.dll"
if (-not (HasValue $0 'Path' '*\River.OneMoreAddIn.dll')) { return }
}
}
Process
{
CheckAppID
CheckRoot
CheckShell
CheckAddIn
CheckCLSID
CheckUser
}
Binary file modified register-onemore.reg
Binary file not shown.

0 comments on commit 63dc1fb

Please sign in to comment.