From a978b107d7717dd6768a987007cfbbc8b3a89014 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Fri, 2 Oct 2015 05:07:24 +0200
Subject: mfplat: Implement MFTUnregister.

---
 dlls/mfplat/main.c      | 38 ++++++++++++++++++++++++++++++++++++++
 dlls/mfplat/mfplat.spec |  2 +-
 2 files changed, 39 insertions(+), 1 deletion(-)

diff --git a/dlls/mfplat/main.c b/dlls/mfplat/main.c
index d8b0c7a..6b47a4e 100644
--- a/dlls/mfplat/main.c
+++ b/dlls/mfplat/main.c
@@ -191,6 +191,44 @@ HRESULT WINAPI MFTRegister(CLSID clsid, GUID category, LPWSTR name, UINT32 flags
 }
 
 /***********************************************************************
+ *      MFTUnregister (mfplat.@)
+ */
+HRESULT WINAPI MFTUnregister(CLSID clsid)
+{
+    WCHAR buffer[64], category[MAX_PATH];
+    HKEY htransform, hcategory, htmp;
+    DWORD size = MAX_PATH;
+    DWORD index = 0;
+
+    FIXME("(%s)\n", debugstr_guid(&clsid));
+
+    GUIDToString(buffer, &clsid);
+
+    if (!RegOpenKeyW(HKEY_LOCAL_MACHINE, transform_keyW, &htransform))
+    {
+        RegDeleteKeyW(htransform, buffer);
+        RegCloseKey(htransform);
+    }
+
+    if (!RegOpenKeyW(HKEY_LOCAL_MACHINE, categories_keyW, &hcategory))
+    {
+        while (RegEnumKeyExW(hcategory, index, category, &size, NULL, NULL, NULL, NULL) == ERROR_SUCCESS)
+        {
+            if (!RegOpenKeyW(hcategory, category, &htmp))
+            {
+                RegDeleteKeyW(htmp, buffer);
+                RegCloseKey(htmp);
+            }
+            size = MAX_PATH;
+            index++;
+        }
+        RegCloseKey(hcategory);
+    }
+
+    return S_OK;
+}
+
+/***********************************************************************
  *      MFStartup (mfplat.@)
  */
 HRESULT WINAPI MFStartup(ULONG version, DWORD flags)
diff --git a/dlls/mfplat/mfplat.spec b/dlls/mfplat/mfplat.spec
index acde0a5..4501e27 100644
--- a/dlls/mfplat/mfplat.spec
+++ b/dlls/mfplat/mfplat.spec
@@ -140,7 +140,7 @@
 @ stdcall MFTRegister(int128 int128 wstr long long ptr long ptr ptr)
 @ stub MFTRegisterLocal
 @ stub MFTRegisterLocalByCLSID
-@ stub MFTUnregister
+@ stdcall MFTUnregister(int128)
 @ stub MFTUnregisterLocal
 @ stub MFTUnregisterLocalByCLSID
 @ stub MFTraceError
-- 
2.5.1

