@echo off
PUSHD %~dp0
cd /d "%~dp0"

reg add "HKLM\Software\Classes\CLSID\{B81B0E26-1BBF-11D2-B63E-00805F8AD726}" /f /ve /t REG_SZ /d "WordCEnvelopeWizard.Connect"
reg add "HKLM\Software\Classes\CLSID\{B81B0E26-1BBF-11D2-B63E-00805F8AD726}\InprocServer32" /f /ve /t REG_SZ /d "%cd%\Addins\CENVELOP.DLL"
reg add "HKLM\Software\Classes\CLSID\{B81B0E26-1BBF-11D2-B63E-00805F8AD726}\ProgID" /f /ve /t REG_SZ /d "WordCEnvelopeWizard.Connect"
reg add "HKLM\Software\Classes\CLSID\{B81B0E26-1BBF-11D2-B63E-00805F8AD726}\TypeLib" /f /ve /t REG_SZ /d "{B81B0E29-1BBF-11D2-B63E-00805F8AD726}"
reg add "HKLM\Software\Classes\WordCEnvelopeWizard.Connect" /f /ve /t REG_SZ /d "WordCEnvelopeWizard.Connect"
reg add "HKLM\Software\Classes\WordCEnvelopeWizard.Connect\CLSID" /f /ve /t REG_SZ /d "{B81B0E26-1BBF-11D2-B63E-00805F8AD726}"
reg add "HKLM\Software\Microsoft\Office\Word\Addins\WordCEnvelopeWizard.Connect" /f /v "FriendlyName" /t REG_SZ /d "Microsoft Word 中文信封向导"
reg add "HKLM\Software\Microsoft\Office\Word\Addins\WordCEnvelopeWizard.Connect" /f /v "LoadBehavior" /t REG_DWORD /d 3
reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Components\011DF6C2B5EF1F64BB45A31C8B344FA4" /f /v "00002109B10040800000000000F01FEC" /t REG_SZ /d "%CD%\Addins\CENVELOP.DLL"

rem 稿纸向导加载项:需要GENKO.DLL GKINTL.DLL文件
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\Word\Addins\Genko.Connect12" /f /v "FriendlyName" /t REG_SZ /d "Microsoft Word 稿纸向导加载项"
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\Word\Addins\Genko.Connect12" /f /v "LoadBehavior" /t REG_DWORD /d 3
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Genko.Connect12" /f /ve /t REG_SZ /d "Genko"
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Genko.Connect12\CLSID" /f /ve /t REG_SZ /d "{31D281E2-8D6C-402F-BEC5-9C8E174476D6}"
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{31D281E2-8D6C-402F-BEC5-9C8E174476D6}" /f /ve /t REG_SZ /d "Connect Class"
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{31D281E2-8D6C-402F-BEC5-9C8E174476D6}\InprocServer32" /f /ve /t REG_SZ /d "%CD%\GENKO.DLL"
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{31D281E2-8D6C-402F-BEC5-9C8E174476D6}\InprocServer32" /f /v "ThreadingModel" /t REG_SZ /d "Apartment"
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{31D281E2-8D6C-402F-BEC5-9C8E174476D6}\ProgID" /f /ve /t REG_SZ /d "Genko.Connect12"
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{31D281E2-8D6C-402F-BEC5-9C8E174476D6}\TypeLib" /f /ve /t REG_SZ /d "{E9FE6562-E4A9-4507-9F37-E8EC0AAFB9FD}"
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{31D281E2-8D6C-402F-BEC5-9C8E174476D6}\VersionIndependentProgID" /f /ve /t REG_SZ /d "Genko.Connect12"
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{31D281E2-8D6C-402F-BEC5-9C8E174476D6}" /f /ve /t REG_SZ /d "Genko.Connect12"
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{31D281E2-8D6C-402F-BEC5-9C8E174476D6}" /f /v "AppID" /t REG_SZ /d "{951E5BC0-4D8D-4046-9B74-99BC4B4C413E}"
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{3D5356A9-4BDE-448E-9926-51F39409E48E}" /f /ve /t REG_SZ /d "ColorDropButton Class"
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{3D5356A9-4BDE-448E-9926-51F39409E48E}\InprocServer32" /f /ve /t REG_SZ /d "%CD%\GENKO.DLL"
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{3D5356A9-4BDE-448E-9926-51F39409E48E}\InprocServer32" /f /v "ThreadingModel" /t REG_SZ /d "Apartment"
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{3D5356A9-4BDE-448E-9926-51F39409E48E}\ProgID" /f /ve /t REG_SZ /d "GenkoCP.ColorDropButton.1"
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{3D5356A9-4BDE-448E-9926-51F39409E48E}\TypeLib" /f /ve /t REG_SZ /d "{E9FE6562-E4A9-4507-9F37-E8EC0AAFB9FD}"
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{3D5356A9-4BDE-448E-9926-51F39409E48E}\VersionIndependentProgID" /f /ve /t REG_SZ /d "GenkoCP.ColorDropButton"
rem 无typelib则不显示图标
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Classes\TypeLib\{E9FE6562-E4A9-4507-9F37-E8EC0AAFB9FD}\1.0" /f /ve /t REG_SZ /d "Genko 1.0 Type Library"
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Classes\TypeLib\{E9FE6562-E4A9-4507-9F37-E8EC0AAFB9FD}\1.0\FLAGS" /f /ve /t REG_SZ /d "0"
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Classes\TypeLib\{E9FE6562-E4A9-4507-9F37-E8EC0AAFB9FD}\1.0\HELPDIR" /f /ve /t REG_SZ /d "%CD%\"
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Classes\TypeLib\{E9FE6562-E4A9-4507-9F37-E8EC0AAFB9FD}\1.0\0\win32" /f /ve /t REG_SZ /d "%CD%\GENKO.DLL"

rem 判断64bit Add添加
IF /I NOT "%PROCESSOR_ARCHITECTURE%"=="AMD64" GOTO ENDH
reg add "HKLM\Software\Classes\Wow6432Node\CLSID\{B81B0E26-1BBF-11D2-B63E-00805F8AD726}" /f /ve /t REG_SZ /d "WordCEnvelopeWizard.Connect"
reg add "HKLM\Software\Classes\Wow6432Node\CLSID\{B81B0E26-1BBF-11D2-B63E-00805F8AD726}\InprocServer32" /f /ve /t REG_SZ /d "%cd%\Addins\CENVELOP.DLL"
reg add "HKLM\Software\Classes\Wow6432Node\CLSID\{B81B0E26-1BBF-11D2-B63E-00805F8AD726}\ProgID" /f /ve /t REG_SZ /d "WordCEnvelopeWizard.Connect"
reg add "HKLM\Software\Classes\Wow6432Node\CLSID\{B81B0E26-1BBF-11D2-B63E-00805F8AD726}\TypeLib" /f /ve /t REG_SZ /d "{B81B0E29-1BBF-11D2-B63E-00805F8AD726}"
reg add "HKLM\Software\Wow6432Node\Classes\WordCEnvelopeWizard.Connect" /f /ve /t REG_SZ /d "WordCEnvelopeWizard.Connect"
reg add "HKLM\Software\Wow6432Node\Classes\WordCEnvelopeWizard.Connect\CLSID" /f /ve /t REG_SZ /d "{B81B0E26-1BBF-11D2-B63E-00805F8AD726}"
reg add "HKLM\Software\Wow6432Node\Microsoft\Office\Word\Addins\WordCEnvelopeWizard.Connect" /f /v "FriendlyName" /t REG_SZ /d "Microsoft Word 中文信封向导"
reg add "HKLM\Software\Wow6432Node\Microsoft\Office\Word\Addins\WordCEnvelopeWizard.Connect" /f /v "LoadBehavior" /t REG_DWORD /d 3
reg add "HKLM\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Components\011DF6C2B5EF1F64BB45A31C8B344FA4" /f /v "00002109B10040800000000000F01FEC" /t REG_SZ /d "%CD%\Addins\CENVELOP.DLL"

rem 稿纸向导x64
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Office\Word\Addins\Genko.Connect12" /f /v "FriendlyName" /t REG_SZ /d "Microsoft Word 稿纸向导加载项"
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Office\Word\Addins\Genko.Connect12" /f /v "LoadBehavior" /t REG_DWORD /d 3
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Classes\Genko.Connect12" /f /ve /t REG_SZ /d "Genko"
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Classes\Genko.Connect12\CLSID" /f /ve /t REG_SZ /d "{31D281E2-8D6C-402F-BEC5-9C8E174476D6}"
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Wow6432Node\CLSID\{31D281E2-8D6C-402F-BEC5-9C8E174476D6}" /f /ve /t REG_SZ /d "Connect Class"
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Wow6432Node\CLSID\{31D281E2-8D6C-402F-BEC5-9C8E174476D6}\InprocServer32" /f /ve /t REG_SZ /d "%CD%\GENKO.DLL"
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Wow6432Node\CLSID\{31D281E2-8D6C-402F-BEC5-9C8E174476D6}\InprocServer32" /f /v "ThreadingModel" /t REG_SZ /d "Apartment"
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Wow6432Node\CLSID\{31D281E2-8D6C-402F-BEC5-9C8E174476D6}\ProgID" /f /ve /t REG_SZ /d "Genko.Connect12"
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Wow6432Node\CLSID\{31D281E2-8D6C-402F-BEC5-9C8E174476D6}\TypeLib" /f /ve /t REG_SZ /d "{E9FE6562-E4A9-4507-9F37-E8EC0AAFB9FD}"
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Wow6432Node\CLSID\{31D281E2-8D6C-402F-BEC5-9C8E174476D6}\VersionIndependentProgID" /f /ve /t REG_SZ /d "Genko.Connect12"
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Wow6432Node\CLSID\{31D281E2-8D6C-402F-BEC5-9C8E174476D6}" /f /ve /t REG_SZ /d "Genko.Connect12"
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Wow6432Node\CLSID\{31D281E2-8D6C-402F-BEC5-9C8E174476D6}" /f /v "AppID" /t REG_SZ /d "{951E5BC0-4D8D-4046-9B74-99BC4B4C413E}"
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Wow6432Node\CLSID\{3D5356A9-4BDE-448E-9926-51F39409E48E}" /f /ve /t REG_SZ /d "ColorDropButton Class"
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Wow6432Node\CLSID\{3D5356A9-4BDE-448E-9926-51F39409E48E}\InprocServer32" /f /ve /t REG_SZ /d "%CD%\GENKO.DLL"
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Wow6432Node\CLSID\{3D5356A9-4BDE-448E-9926-51F39409E48E}\InprocServer32" /f /v "ThreadingModel" /t REG_SZ /d "Apartment"
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Wow6432Node\CLSID\{3D5356A9-4BDE-448E-9926-51F39409E48E}\ProgID" /f /ve /t REG_SZ /d "GenkoCP.ColorDropButton.1"
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Wow6432Node\CLSID\{3D5356A9-4BDE-448E-9926-51F39409E48E}\TypeLib" /f /ve /t REG_SZ /d "{E9FE6562-E4A9-4507-9F37-E8EC0AAFB9FD}"
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Wow6432Node\CLSID\{3D5356A9-4BDE-448E-9926-51F39409E48E}\VersionIndependentProgID" /f /ve /t REG_SZ /d "GenkoCP.ColorDropButton"
rem 无typelib则不显示图标
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Wow6432Node\TypeLib\{E9FE6562-E4A9-4507-9F37-E8EC0AAFB9FD}\1.0" /f /ve /t REG_SZ /d "Genko 1.0 Type Library"
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Wow6432Node\TypeLib\{E9FE6562-E4A9-4507-9F37-E8EC0AAFB9FD}\1.0\FLAGS" /f /ve /t REG_SZ /d "0"
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Wow6432Node\TypeLib\{E9FE6562-E4A9-4507-9F37-E8EC0AAFB9FD}\1.0\HELPDIR" /f /ve /t REG_SZ /d "%CD%\\"
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Wow6432Node\TypeLib\{E9FE6562-E4A9-4507-9F37-E8EC0AAFB9FD}\1.0\0\win32" /f /ve /t REG_SZ /d "%CD%\GENKO.DLL"

:ENDH
