void CSettings::Uninstall() { BOOL b; if (IsVista() && IsElevated(&b) != S_OK) { RunIuElevated("/uninstall"); return; } AutoStartup = false; SendToContextMenu = false; RegisterShellExtension(false); EnableAutostartup(false); CRegistry Reg; Reg.SetRootKey(HKEY_CURRENT_USER); Reg.DeleteWithSubkeys("Software\\Zenden.ws\\Image Uploader\\ContextMenuItems"); Reg.DeleteKey( "Software\\Zenden.ws\\Image Uploader" ); Reg.DeleteKey( "Software\\Zenden.ws" ); // Will not delete if contains subkeys Reg.SetRootKey( HKEY_LOCAL_MACHINE ); Reg.DeleteKey( "Software\\Zenden.ws\\Image Uploader" ); Reg.DeleteKey( "Software\\Zenden.ws" ); // Will not delete if contains subkeys WinUtils::RemoveBrowserKey(); CString ShortcutName = GetSendToPath() + _T("\\Image Uploader.lnk"); DeleteFile(ShortcutName); }
bool __cdecl CleanupCDRom(LPVOID pParam) { CString sTmp = g_sVarTexmf; GetParentDirectory(sTmp); RecursivelyRemove(sTmp); #if 0 CString sWinShellDir; if (! GetWinShellLocation(sWinShellDir) || ! DirectoryExists(sWinShellDir)) return true; if (MessageBox(NULL, "Do you want to remove WinShell too ?", NULL, MB_YESNO | MB_ICONINFORMATION) == IDYES) { char buf[_MAX_PATH]; CString sUninstCmd; for (int i = 0; i < 1000; i++) { wsprintf(buf, "unins%.3d.exe", i); sUninstCmd = ConcatPath(sWinShellDir, buf); if (! FileExists(sUninstCmd)) { i--; break; } } if (i > -1) { wsprintf(buf, "unins%.3d.exe", i); sUninstCmd = ConcatPath(sWinShellDir, buf); RunProcess(sUninstCmd, true); RecursivelyRemove(sWinShellDir); } } #endif // Remove the registry key CRegistry theRegistry; if (theRegistry.Connect(HKEY_CURRENT_USER) == TRUE) { theRegistry.DeleteKey(g_sRegKey); } return true; }
bool delTestKeybyWinAPI() { TCHAR cadKey[MAX_PATH]; _tcscpy(cadKey, _T("Software\\Autodesk\\AutoCAD\\R18.0\\ACAD-8001:804\\Applications\\test")); DWORD dwAccess = KEY_ALL_ACCESS; //判断是否64位 if(IsWow64() == TRUE) { dwAccess |= KEY_WOW64_64KEY; } CRegistry reg; bool ret = reg.Open( cadKey, HKEY_LOCAL_MACHINE, dwAccess); if(ret) { reg.DeleteKey(); } reg.Close(); return ret; }