void UnregisterServer() { char achIMEKey[ARRAYSIZE(c_szInfoKeyPrefix) + CLSID_STRLEN]; if (!CLSIDToStringA(c_clsidTextService, achIMEKey + ARRAYSIZE(c_szInfoKeyPrefix) - 1)) return; memcpy(achIMEKey, c_szInfoKeyPrefix, sizeof(c_szInfoKeyPrefix) - 1); RecurseDeleteKeyA(HKEY_CLASSES_ROOT, achIMEKey); // On Windows 8, we need to manually delete the registry key for our TIP char tipKey[ARRAYSIZE(c_szTipKeyPrefix) + CLSID_STRLEN]; if (!CLSIDToStringA(c_clsidTextService, tipKey + ARRAYSIZE(c_szTipKeyPrefix) - 1)) return; memcpy(tipKey, c_szTipKeyPrefix, sizeof(c_szTipKeyPrefix) - 1); RecurseDeleteKeyA(HKEY_CLASSES_ROOT, tipKey); }
void UnregisterServer() { char achIMEKey[ARRAYSIZE(c_szInfoKeyPrefix) + CLSID_STRLEN]; if (!CLSIDToStringA(c_clsidTextService, achIMEKey + ARRAYSIZE(c_szInfoKeyPrefix) - 1)) return; memcpy(achIMEKey, c_szInfoKeyPrefix, sizeof(c_szInfoKeyPrefix) - 1); RecurseDeleteKeyA(HKEY_CLASSES_ROOT, achIMEKey); }
static LONG RecurseDeleteKeyA(HKEY hParentKey, LPCSTR lpszKey) { HKEY hKey; LONG lRes; FILETIME time; CHAR szBuffer[256]; DWORD dwSize = ARRAYSIZE(szBuffer); if (RegOpenKeyA(hParentKey, lpszKey, &hKey) != ERROR_SUCCESS) return ERROR_SUCCESS; lRes = ERROR_SUCCESS; while (RegEnumKeyExA(hKey, 0, szBuffer, &dwSize, NULL, NULL, NULL, &time) == ERROR_SUCCESS) { szBuffer[ARRAYSIZE(szBuffer) - 1] = '\0'; lRes = RecurseDeleteKeyA(hKey, szBuffer); if (lRes != ERROR_SUCCESS) break; dwSize = ARRAYSIZE(szBuffer); } RegCloseKey(hKey); return lRes == ERROR_SUCCESS ? RegDeleteKeyA(hParentKey, lpszKey) : lRes; }