{"id":26190863,"url":"https://github.com/codingabi/appfaults","last_synced_at":"2025-10-20T05:11:26.255Z","repository":{"id":252845012,"uuid":"841108919","full_name":"codingABI/appFaults","owner":"codingABI","description":"Test/stress tool for Windows that creates typical application faults, like a memory leak, freezes ...","archived":false,"fork":false,"pushed_at":"2024-12-15T15:37:45.000Z","size":9206,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-03-12T00:58:22.559Z","etag":null,"topics":["errors","programming","win32api"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"cc0-1.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/codingABI.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-08-11T17:03:24.000Z","updated_at":"2024-12-15T15:37:48.000Z","dependencies_parsed_at":"2024-11-23T15:21:02.014Z","dependency_job_id":"7d5d5538-d37a-4d58-95e7-971e98d697f6","html_url":"https://github.com/codingABI/appFaults","commit_stats":null,"previous_names":["codingabi/appfaults"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/codingABI/appFaults","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codingABI%2FappFaults","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codingABI%2FappFaults/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codingABI%2FappFaults/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codingABI%2FappFaults/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/codingABI","download_url":"https://codeload.github.com/codingABI/appFaults/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codingABI%2FappFaults/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":280016615,"owners_count":26258994,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-20T02:00:06.978Z","response_time":62,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["errors","programming","win32api"],"created_at":"2025-03-12T00:58:25.002Z","updated_at":"2025-10-20T05:11:26.227Z","avatar_url":"https://github.com/codingABI.png","language":"C++","readme":"# appFaults\nTest/stress tool for Microsoft Windows that creates typical application faults, like a memory leak, freezes ...\nThe tool can be used to show or debug the effects of programming errors. Use at your own risk!\n\n![Screenshot of main window](assets/images/appFaults.png)\n\n## License and copyright\nThis project is licensed under the terms of the CC0 [Copyright (c) 2024 codingABI](LICENSE). \n\nIcon for the app: Modified icon \"gear\" from Game icon pack by Kenney Vleugels (www.kenney.nl), https://kenney.nl/assets/game-icons, CC0\n\n## Appendix\n\n### Programming errors/Faults\n\n  - [Endless loop](#endless-loop)\n  - [Add endless loop thread](#add-endless-loop-thread)\n  - [Deadlock](#deadlock)\n  - [External process deadlock](#external-process-deadlock)\n  - [GUI block 60s](#gui-block-60s)\n  - [Memory leak](#memory-leak)\n  - [Handle leak](#handle-leak)\n  - [GDI leak](#gdi-leak)\n  - [Thread spam](#thread-spam)\n  - [Free of non allocated memory](#free-of-non-allocated-memory)\n  - [Write to NULL-pointer](#write-to-null-pointer)\n\n#### Endless loop\nEndless CPU consuming, GUI freezing loop\n```\nLRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)\n{\n    ...\n    case IDM_LOOP:\n        while (true); // Fault\n        ...\n}\n```\n\n#### Add endless loop thread\nAdd thread with an endless CPU consuming loop\n```\nunsigned int __stdcall threadLoop(void* data) {\n    while (true); // Fault\n    return 0;\n}\nLRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)\n{\n    ...\n    case IDM_LOOPTHREAD:\n        _beginthreadex(0, 0, \u0026threadLoop, (void*)hWnd, 0, 0);\n        ...\n}\n```\n\n#### Deadlock\nWaits forever for a semaphore and freeze GUI while waiting\n```\nHANDLE g_semaphore = NULL;\nLRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)\n{\n    ...\n    case IDM_DEADLOCK:\n        WaitForSingleObject(g_semaphore, INFINITE); // Fault\n        ...\n}\nint APIENTRY wWinMain(_In_ HINSTANCE hInstance,\n                     _In_opt_ HINSTANCE hPrevInstance,\n                     _In_ LPWSTR    lpCmdLine,\n                     _In_ int       nCmdShow)\n{\n    ...\n    g_semaphore = CreateSemaphore(NULL, 0, 1, NULL);\n    ...\n}\n```\n\n#### External process deadlock\nWaits forever for an external process (for example **cmd.exe**) and freeze GUI while waiting\n```\nLRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)\n{\n    ...\n    case IDM_EXTERNALDEADLOCK: {\n        ...\n        wchar_t szCommand[] = L\"cmd.exe\";\n        ...    \n        if (CreateProcess(NULL, szCommand, NULL, NULL, FALSE, 0, NULL, NULL, \u0026si, \u0026pi)) {\n            // Wait until child process exits.\n            WaitForSingleObject(pi.hProcess, INFINITE); // Fault, because the external process is long running and we wait in WndProc\n            ...    \n```\n\n#### GUI block 60s\nDelay that prevents the processing of window messages (=\u003e Freeze GUI) for a longer time (60 Seconds)\n```\nLRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)\n{\n    ...\n    case IDM_LOCK10S:\n        Sleep(60000); // Fault\n        ...\n}\n```\n\n#### Memory leak\nAllocates as much memory as possible without freeing memory and freeze GUI. Warning: Your computer may become inoperable as a result!\n```\nLRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)\n{\n    ...\n    case IDM_MEMORYLEAK:\n        ...\n        while (true) HWND* phWindow = (HWND*)malloc(sizeof(HWND)); // Fault\n        ...\n}\n```\n\n#### Handle leak\nEndless creation of handles and freeze GUI.\n```\nLRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)\n{\n    ...\n    case IDM_HANDLELEAK:\n        while (true) OpenProcess(PROCESS_ALL_ACCESS, FALSE, GetCurrentProcessId()); // Fault\n        ...\n} \n```\n\n#### GDI leak\nEndless creation of GDI objects and freeze GUI.\n```\nLRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)\n{\n    ...\n    case IDM_GDILEAK:\n        while (true) CreateFont(48, 0, 0, 0, FW_DONTCARE, FALSE, TRUE, FALSE, DEFAULT_CHARSET, OUT_OUTLINE_PRECIS,\n                                CLIP_DEFAULT_PRECIS, CLEARTYPE_QUALITY, VARIABLE_PITCH, L\"Arial\"); // Fault\n        ...\n}\n```\n\n#### Thread spam\nCreates as much threads as possible and freeze GUI.\n```\nHANDLE g_semaphore = NULL;\nunsigned int __stdcall threadWaitForever(void* data) {\n    WaitForSingleObject(g_semaphore, INFINITE);\n    return 0;\n}\nLRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)\n{\n    ...\n    while (true) _beginthreadex(0, 0, \u0026threadWaitForever, (void*)hWnd, 0, 0); // Fault\n    ...\n}\nint APIENTRY wWinMain(_In_ HINSTANCE hInstance,\n                     _In_opt_ HINSTANCE hPrevInstance,\n                     _In_ LPWSTR    lpCmdLine,\n                     _In_ int       nCmdShow)\n{\n    ...\n    g_semaphore = CreateSemaphore(NULL, 0, 1, NULL);\n    ...\n}\n```\n\n#### Free of non allocated memory\nFree memory that is not allocated\n```\nLRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)\n{\n    char* pszTest = NULL;\n    ...\n    case IDM_FREEINVALID:\n        pszTest = (char*)malloc(sizeof(char));\n        free(pszTest);\n        free(pszTest); // Fault\n        ...\n}\n```\n\n#### Write to NULL-pointer\nWrite to address 0\n```\nLRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)\n{\n    char* pszTest = NULL;\n    ...\n    case IDM_NULLACCESS:\n        pszTest[0] = ' '; // Fault\n    ...\n}\n```\n\n### Development environment\n\nVisual Studio 2022\n\nThe Code works without special frameworks and uses only the Win32 API.\n\n### Digitally signed binaries\nThe compiled EXE files [x64](appFaults/x64)/[x86](appFaults/x86) are digitally signed with my public key \n```\n30 82 01 0a 02 82 01 01 00 a1 23 c9 cc ed e5 63 3a 68 d8 48 ea 8e eb fe 6d c5 59 73 7d ff 4d 6a 60 4e a6 5f b3 3a c6 1c 68 37 fa 3d 5f 76 5e 7a ad 70 cb 07 b7 21 da b6 29 ca 49 2b 8f 3f 2a 0c b4 f8 d1 c4 7b ac 45 59 0d fb 29 e1 9c bb fc e7 fb 8c ce 7a c2 5c 14 58 71 c0 25 41 c0 4e c4 f3 31 3e d3 05 5a 71 00 4e 0e 27 92 b3 f3 bb c5 bf 8b 1c fc 2f 69 50 d4 90 be e2 d6 82 44 a4 6e 67 80 b1 e8 c8 9d 1b 3a 56 a4 8c bf ec 19 9e cd ab 2d 46 fd f7 c7 67 b6 eb fb aa 18 b0 07 21 1b 79 a5 98 e0 7d c7 4d 31 79 47 9c 24 83 61 f3 63 b8 ec cc 62 42 6b 80 9a 74 0b 40 33 bd d1 cb 55 28 80 39 85 89 0c 19 e2 80 cb 39 e5 1b 38 d6 e6 87 a7 af ea 6e f9 df 89 79 fc ac f1 15 a2 58 55 df 27 d6 19 54 a1 91 52 41 eb 1d ad 3b 20 2c 50 e5 a3 c1 59 a4 a7 bb 6f 22 01 bb 46 bf e0 66 fb 82 ee dc 03 a7 8a e5 33 af 75 02 03 01 00 01\n```\nTo run the program only the single EXE file is needed.\n\nDo not run code/binaries, you dont trust!\n\n### FAQ\n\n#### Why task manager starts every time appFaults is started?\n**taskmgr.exe** is started by default, because this tool can be helpfull in combination with appFaults.\n\n#### Why cmd.exe starts?\n**cmd.exe** is started for fault [External process deadlock](#external-process-deadlock) as an example for an external process that could locks appFaults. \n\n#### What is the option \"Register for application restart\"?\nThis option can be set in the window menu (also known as the system menu or the control menu). When enabled  this application\nwill be restarted automatically by the  Windows Error Reporting (WER) if the application has been running for at least 60 seconds \nand encountering an unhandled exception (For example [Write to NULL-pointer](#write-to-null-pointer)).","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodingabi%2Fappfaults","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcodingabi%2Fappfaults","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodingabi%2Fappfaults/lists"}