{"record":{"id":"50c849e219be005e","repo":"BCUninstaller/Bulk-Crap-Uninstaller","slug":"access-is-denied-indicates-that-user-has-no-acces","errorCode":null,"errorMessage":"Access is denied. Indicates that user has no access right to specified resource.","messagePattern":"Access is denied\\. Indicates that user has no access right to specified resource\\.","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"source/UninstallTools/Uninstaller/BulkUninstallEntry.cs","lineNumber":441,"sourceCode":"                            }\r\n                            else if (exitVar == -1073741510)\r\n                            {\r\n                                /* 3221225786 / 0xC000013A / -1073741510 \r\n                                    The application terminated as a result of a CTRL+C. \r\n                                    Indicates that the application has been terminated either by user's \r\n                                    keyboard input CTRL+C or CTRL+Break or closing command prompt window. */\r\n                                _skipLevel = SkipCurrentLevel.Terminate;\r\n                            }\r\n                            else\r\n                            {\r\n                                switch (exitVar)\r\n                                {\r\n                                    case 2:\r\n                                        throw new Exception(\"The system cannot find the file specified. Indicates that the file can not be found in specified location.\");\r\n                                    case 3:\r\n                                        throw new Exception(\"The system cannot find the path specified. Indicates that the specified path can not be found.\");\r\n                                    case 5:\r\n                                        throw new Exception(\"Access is denied. Indicates that user has no access right to specified resource.\");\r\n                                    case 9009:\r\n                                        throw new Exception(\"Program is not recognized as an internal or external command, operable program or batch file.\");\r\n                                    case -2147024846:\r\n                                        throw new Exception(\"0x80070032 - This app is part of Windows and cannot be uninstalled on a per-user basis.\");\r\n\r\n                                    default:\r\n                                        if (options.RetryFailedQuiet || (UninstallerEntry.UninstallerKind == UninstallerType.Nsis && !options.PreferQuiet))\r\n                                            retry = true;\r\n                                        throw new IOException(Localisation.UninstallError_UninstallerReturnedCode + exitVar);\r\n                                }\r\n                            }\r\n                        }\r\n                    }\r\n                }\r\n            }\r\n            catch (Exception ex)\r\n            {\r\n                error = ex;\r","sourceCodeStart":423,"sourceCodeEnd":459,"githubUrl":"https://github.com/BCUninstaller/Bulk-Crap-Uninstaller/blob/608321de98e92297377b1eb69029af55c25504a1/source/UninstallTools/Uninstaller/BulkUninstallEntry.cs#L423-L459","documentation":"The exit-code switch maps exitVar == 5 to a thrown Exception describing ERROR_ACCESS_DENIED. The spawned uninstaller exited with code 5, indicating the OS denied access to a resource the process tried to open/write/delete.","triggerScenarios":"The uninstaller ran without sufficient privileges to modify its target files/registry, or another process holds an exclusive lock on a file it must remove, causing the OS to return access-denied and the process to exit 5.","commonSituations":"App not elevated and the uninstaller needs admin rights to delete Program Files entries; the target app is currently running and locking its binaries; an antivirus or backup tool holds a lock during the uninstall.","solutions":["Run the bulk uninstall elevated and ensure the target application and its background services are stopped first.","Pre-scan for locked files / running processes of the target app and prompt the user to close them.","Catch exit-code-5 specifically and offer to retry after elevation and process termination."],"exampleFix":"// before\nmanager.RunUninstaller(entry, options);\n\n// after\nKillTargetProcesses(entry);\nif (!HasElevation) { RestartAsAdmin(); return; }\nmanager.RunUninstaller(entry, options);","handlingStrategy":"retry","validationCode":"if (!IsProcessElevated())\n    throw new SecurityException(\"Uninstall requires elevation.\");\nKillTargetProcesses(entry); // release locks\nmanager.RunUninstaller(entry, options);","typeGuard":"null","tryCatchPattern":"// retry once after closing locks / elevating\ntry { manager.RunUninstaller(entry, options); }\ncatch (Exception ex) when (ExitCodeOf(ex) == 5)\n{\n    KillTargetProcesses(entry);\n    manager.RunUninstaller(entry, options);\n}","preventionTips":["Run bulk uninstalls elevated.","Stop the target app and its services/tray processes before uninstalling.","Defer uninstalls while AV/backup scans may lock the install folder."],"tags":["uninstaller","process-exit-code","access-denied","exit-code-5","elevation","file-lock"],"backgroundTag":null,"analyzedSha":"608321de98e92297377b1eb69029af55c25504a1","analyzedAt":"2026-08-13T12:17:35.389Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}