如何让其它程序报错

云满笔记 2014-06-04 01:34:11
我现在想让其它程序报错,就是让指定的进程崩溃,怎么做?

注意:是让其它程序进程,不是自身,自身好做啊。

最好附上源码,谢谢!
...全文
248 10 打赏 收藏 转发到动态 举报
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
赵4老师 2014-06-05
  • 打赏
  • 举报
回复
引用 9 楼 ForestDB 的回复:
Linux下,可以向任一进程发信号,使之crash或者core dump; Windows下可以搜搜有无类似的消息。
ms-help://MS.VSCC.v90/MS.VSIPCC.v90/ms.vssdk.v90/dv_vsdbgsdk/html/1f4096a8-f7aa-4dfa-84e1-6d59263e70bb.htm Collapse AllExpand All Code: All Code: Multiple Code: Visual Basic Code: C# Code: Visual C++ Code: J# Code: JScript Visual Basic C# Visual C++ J# JScript Visual Studio SDK Visual Studio Debugger SDK Roadmap See Also Send Feedback [Note: This topic is pre-release documentation and is subject to change in future releases. Blank topics are included as placeholders.] Updated: November 2007 This documentation provides guide and reference information for the Microsoft Visual Studio Debugger SDK. Visual Studio debugging documentation includes samples, a comprehensive reference, and several representative scenarios that demonstrate typical ways to customize the debugger. Your compiler and its output determine what you need to do to implement debugging in your product. If your compiler: Targets the Windows native operating system and writes a .PDB file, you can debug programs with the native code debug engine (DE), which is integrated into Visual Studio. You do not need to implement a DE or expression evaluator. The expression evaluator is written for the syntax of the C++ programming language. Produces Microsoft intermediate language (MSIL) output, you can debug programs with the managed code debug engine DE, which is also integrated into Visual Studio. Thus, you need only implement an expression evaluator. A sample expression evaluator is provided for you. For more information, see the following topics: Expression Evaluation Evaluating Expressions Expression Evaluation Context Expression Evaluation in Break Mode Writing a Common Language Runtime Expression Evaluator Targets a proprietary operating system or some other run-time environment, you need to write your own DE. A tutorial that creates a simple DE using ATL COM is provided. For more information, see the following topics: Creating a Custom Debug Engine Tutorial: Building a Debug Engine Using ATL COM Implementing a Port Supplier Visual Studio Debugging Samples See Also Other Resources Getting Started (Visual Studio Debugging SDK) Send feedback on this topic to Microsoft.
ForestDB 2014-06-04
  • 打赏
  • 举报
回复
Linux下,可以向任一进程发信号,使之crash或者core dump; Windows下可以搜搜有无类似的消息。
云满笔记 2014-06-04
  • 打赏
  • 举报
回复
引用 5 楼 zhao4zhong1 的回复:
[quote=引用 4 楼 sd530842780 的回复:] [quote=引用 3 楼 zhao4zhong1 的回复:] [quote=引用 2 楼 sd530842780 的回复:] 打开进程,修改进程权限,然后Writeporcessmemory就可以了
先杀猪还是先杀驴?[/quote] 我去,赵老师您英明,您决定吧[/quote] 我本来是想回复“我也是这么想的。”不知怎么就想起赵本山的小品了。[/quote]? 赵老师 看看我的问题吧 我真不知道如何使指定进程报错 有没有什么万能的“代码方法” 别跟我说拆硬盘什么之类的 就是那种 只影响指定进程而不会影响到其它进程的方法 我上面附带的WriteProcessMemory代码好像不行 不知道为什么
云满笔记 2014-06-04
  • 打赏
  • 举报
回复
引用 2 楼 sd530842780 的回复:
打开进程,修改进程权限,然后Writeporcessmemory就可以了
我的代码如下:
#include <stdio.h>
#include <stdlib.h>
#include <windows.h>

int main()
{
    int iChoice; // Store users choice.

    DWORD dwProcId; // Store Star Sonata Process ID
    HWND hStarSonata; //
    HANDLE hProcess; // Handle to Star Sonata process

    // Always do error checking, even if it takes a few seconds more to type!
    if ((hStarSonata = FindWindow(NULL, "Star Sonata")) == NULL) { // Try to find the Star Sonata window.
        printf("Cannot find Star Sonata window!"); // We couldn't find it
        exit(1); // So let the user know and exit.
    }

    if (! GetWindowThreadProcessId(hStarSonata, &dwProcId)) { // Try to get the Process ID for use in OpenProcess
        printf("Cannot retrieve process Id!"); // Let them know we cant get it
        exit(1); // Exit...
    }

    // Now we are going to get a process handle to the game
    if ((hProcess = OpenProcess(PROCESS_VM_WRITE, FALSE, dwProcId)) == NULL) { // Call OpenProcess to get VM Write access
        printf("Cannot open process!"); // Failed to open process. Wrong priviliges?
        exit(1);
    }

    printf("Star Sonata Speed Hack (Noz3001)\n\n(1)Enable Speed Hack\t(2)Disable Speed Hack\t(3)Quit\n\n"); // Show Options

    while(iChoice != 3) { // Whilst option is not 3
        printf("NOZ> _\b");
        scanf("%i", &iChoice); // Get next option

        switch(iChoice) {
            case 1:
                // Enable speed hack
                if (! WriteProcessMemory(hProcess, (void*)0x00463de0, 0x75, 1, NULL)) { // Try to write 0x75 (jne) to 0x00463de0 (my address)
                    printf("Failed to write to memory!\n");
                }
                printf("Speed hack enabled.\n");
                break;

            case 2:
                // Disable speed hack
                if (! WriteProcessMemory(hProcess, (void*)0x00463de0, 0x74, 1, NULL)) { // 0x74 is (je). The original opcode.
                    printf("Failed to write to memory!\n");
                }
                printf("Speed hack disabled.\n");
                break;

            case 3:
                printf("Leaving...\n");
                continue;

            default:
                printf("No such option!\n");
                break;
        }
    }

    CloseHandle(hProcess);
    exit(0);
}
提示:Failed to write to memory 我用GetLastError获取的结果是998 为什么??
ForestDB 2014-06-04
  • 打赏
  • 举报
回复
给其他进程发信号。
赵4老师 2014-06-04
  • 打赏
  • 举报
回复
引用 4 楼 sd530842780 的回复:
[quote=引用 3 楼 zhao4zhong1 的回复:] [quote=引用 2 楼 sd530842780 的回复:] 打开进程,修改进程权限,然后Writeporcessmemory就可以了
先杀猪还是先杀驴?[/quote] 我去,赵老师您英明,您决定吧[/quote] 我本来是想回复“我也是这么想的。”不知怎么就想起赵本山的小品了。
不要做咸鱼 2014-06-04
  • 打赏
  • 举报
回复
引用 3 楼 zhao4zhong1 的回复:
[quote=引用 2 楼 sd530842780 的回复:] 打开进程,修改进程权限,然后Writeporcessmemory就可以了
先杀猪还是先杀驴?[/quote] 我去,赵老师您英明,您决定吧
赵4老师 2014-06-04
  • 打赏
  • 举报
回复
引用 2 楼 sd530842780 的回复:
打开进程,修改进程权限,然后Writeporcessmemory就可以了
先杀猪还是先杀驴?
不要做咸鱼 2014-06-04
  • 打赏
  • 举报
回复
打开进程,修改进程权限,然后Writeporcessmemory就可以了
云满笔记 2014-06-04
  • 打赏
  • 举报
回复
自己先顶一个先 。。。

33,311

社区成员

发帖
与我相关
我的任务
社区描述
C/C++ 新手乐园
社区管理员
  • 新手乐园社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧