# COM Registration Test - Implementation Plan

> **For Claude:** REQUIRED SUB-SKILL: Use superpowers:executing-plans to implement this plan task-by-task.

**Goal:** Verify all 10 COM server DLLs register correctly with regasm and their CLSIDs match the original Decal v2.9.8.3.

**Architecture:** Build a PowerShell verification script that: (1) registers each DLL with regasm, (2) queries the registry for expected CLSIDs, (3) reports pass/fail per GUID. We also cross-reference our [Guid] attributes against the original .rgs files from source_checkout.

**Tech Stack:** regasm.exe (.NET Framework 4.x), PowerShell, Windows Registry

---

### Task 1: Cross-Reference GUIDs Against Original .rgs Files

**Files:**
- Read: `source_checkout/Decal/*.rgs` (original ATL registry scripts)
- Read: `source_checkout/DecalControls/*.rgs`
- Read: `source_checkout/DecalFilters/*.rgs`
- Read: `source_checkout/DecalInput/*.rgs`
- Read: `source_checkout/DecalNet/*.rgs`
- Read: `source_checkout/DecalDat/*.rgs`
- Read: All `*Impl.cs` files in `reconstructed/Managed/Decal.*/`

**Step 1: Extract GUIDs from .rgs files**
Parse each .rgs file for CLSID patterns like `{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}`.

**Step 2: Extract GUIDs from our [Guid("...")] attributes**
Grep all Impl.cs files for Guid attributes.

**Step 3: Compare and report mismatches**
Any GUID in our code that doesn't match the original .rgs is a critical bug.

---

### Task 2: Write the COM Registration Test Script

**Files:**
- Create: `reconstructed/tools/Test-ComRegistration.ps1`

**Step 1: Write PowerShell script**

The script should:
1. Find regasm.exe (32-bit .NET Framework 4.x)
2. Build the solution if needed
3. Register each of the 10 DLLs with `regasm /codebase`
4. Query registry for each expected CLSID at `HKCR\CLSID\{GUID}\InprocServer32`
5. Verify the registered DLL path points to our built assembly
6. Report pass/fail per DLL and per GUID
7. Optionally unregister with `regasm /unregister`

**Step 2: Run the script**

```powershell
powershell -ExecutionPolicy Bypass -File reconstructed/tools/Test-ComRegistration.ps1
```

Expected: All 55 CLSIDs register and appear in registry.

**Step 3: Commit**

```bash
git add reconstructed/tools/Test-ComRegistration.ps1
git commit -m "feat: add COM registration verification script"
```

---

### Task 3: Run Registration and Fix Any Issues

**Step 1: Execute registration**
Run regasm on each DLL and capture output.

**Step 2: Investigate any failures**
Common issues:
- Missing dependencies (Interop DLLs not in same directory)
- x86 vs x64 regasm mismatch
- Missing ComVisible or Guid attributes

**Step 3: Fix and re-test until all pass**

**Step 4: Commit fixes**

---

### Task 4: Unregister and Document Results

**Step 1: Run unregister to clean up**
```powershell
regasm /unregister Decal.DecalDat.dll
```

**Step 2: Verify CLSIDs are removed from registry**

**Step 3: Document results in a test report**

---

## DLL-to-GUID Reference (55 CLSIDs across 10 DLLs)

| DLL | Classes | CLSIDs |
|-----|---------|--------|
| Decal.DecalDat.dll | 3 | DatService, DatStream, DatLibrary |
| Decal.DHS.dll | 2 | HotkeySystem, Hotkey |
| Decal.SpellFilter.dll | 3 | Spells, Spell, Component |
| Decal.DecalInput.dll | 6 | InputService, Hotkey, WndMsg, WinMsgHook, Timer, InputBuffer |
| Decal.DecalNet.dll | 2 | NetService, WebRequest |
| Decal.DecalFilters.dll | 7 | World, WorldObject, WorldIterator, CharacterStats, EchoFilter, EchoFilter2, Prefilter |
| Decal.Core.dll | 4 | DecalCore, ACHooks, PluginSite2, DecalEnum |
| Decal.DecalControls.dll | 17 | Checkbox, List, StaticText, Choice, Progress, FixedLayout, BorderLayout, PageLayout, TextColumn, IconColumn, CheckColumn, DerethMap, Edit, Scroller, PushButton, Notebook, Slider |
| Decal.DecalRender.dll | 4 | RenderService, HUDBackground, HUDView, RenderTargetWrapper |
| Decal.D3DService.dll | 2 | D3DService, D3DObj |
