首页
社区
课程
招聘
[求助]求助各位帮忙看看CreateMutex怎么用OD调不了
2014-1-10 13:32 3250

[求助]求助各位帮忙看看CreateMutex怎么用OD调不了

2014-1-10 13:32
3250
#define _CRT_SECURE_NO_WARNINGS
#include <windows.h>
#include <string>
#include <stdio.h>
#include <Dbt.h>
#include <iostream>
#include "io.h"
#include "tlhelp32.h" 
#include "stdio.h"
#include <tchar.h>
#include <conio.h>
#include <fstream>
using namespace std;

HANDLE hOneInstanceMutex;


LRESULT CALLBACK WndProc(HWND hwnd,UINT uMsg,WPARAM wParam,LPARAM lParam);

int APIENTRY WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance,LPSTR lpCmdLine,int nCmdShow)
{
    hOneInstanceMutex = NULL;
    hOneInstanceMutex = ::CreateMutex(NULL, FALSE, _T("113fd4dce30d7d8e2d1c4f2211cd164e1"));
    if(GetLastError() == ERROR_ALREADY_EXISTS)
    {
        hOneInstanceMutex = NULL;
        MessageBox(NULL,TEXT("已存在113fd4dce30d7d8e2d1c4f2211cd164e1的互斥体"),TEXT("提示"),0);
        return 0;
    }
	else
	{
		MessageBox(NULL,TEXT("启动成功"),TEXT("提示"),0);
	}
    WNDCLASS wndclass;
    wndclass.cbClsExtra=0;
    wndclass.cbWndExtra=0;
    wndclass.hbrBackground=(HBRUSH)GetStockObject(BLACK_BRUSH);
    wndclass.hCursor=LoadCursor(NULL,IDC_ICON);
    wndclass.hIcon=LoadIcon(NULL,IDI_ASTERISK);
    wndclass.hInstance=hInstance;
    wndclass.lpfnWndProc=WndProc;
    wndclass.lpszClassName="U";
    wndclass.lpszMenuName=NULL;
    wndclass.style=CS_VREDRAW|CS_HREDRAW;
    RegisterClass(&wndclass);
    HWND hwnd;
    hwnd=CreateWindow("U","",WS_OVERLAPPEDWINDOW,150,150,683,384,NULL,NULL,hInstance,NULL);
    ShowWindow(hwnd,SW_HIDE);
    UpdateWindow(hwnd);
    MSG msg;
    while(GetMessage(&msg,hwnd,0,0))
    {
        TranslateMessage(&msg);
        DispatchMessage(&msg);
    }
    return 0;
}

LRESULT CALLBACK WndProc( HWND hwnd,   UINT uMsg,   WPARAM wParam,   LPARAM lParam  )
{
    switch(uMsg)
    {
        case WM_PAINT:
        {
            PAINTSTRUCT ps;
				BeginPaint(hwnd,&ps);
            EndPaint(hwnd,&ps);
            break;
        }
        case WM_CLOSE:
        {
            return FALSE;
            break;
        }
        case WM_DESTROY:
        {
            return FALSE;
            break;
        }
        default:
        {
            return DefWindowProc(hwnd,uMsg,wParam,lParam);
            break;
        }
    }
    return 0;
}

用OD调试的时候,Ctrl+N里有,回车进去断点,,然后F9运行,程序没停下来

[培训]内核驱动高级班,冲击BAT一流互联网大厂工 作,每周日13:00-18:00直播授课

上传的附件:
收藏
点赞0
打赏
分享
最新回复 (1)
雪    币: 55
活跃值: (519)
能力值: ( LV6,RANK:80 )
在线值:
发帖
回帖
粉丝
hrpirip 1 2014-1-10 15:35
2
0
0012FF18   0040127D  /CALL 到 CreateMutexA 来自 113fd4dc.00401277
0012FF1C   00000000  |pSecurity = NULL
0012FF20   00000000  |InitialOwner = FALSE
0012FF24   0040F2B0  \MutexName = "113fd4dce30d7d8e2d1c4f2211cd164e1"
0012FF28   0000000A
0012FF2C   00404079  返回到 113fd4dc.00404079 来自 113fd4dc.0040408B
0012FF30   0012FF4C
0012FF34   0040639B  返回到 113fd4dc.0040639B 来自 113fd4dc.00404073
0012FF38   00162363
0012FF3C  /0012FF5C
0012FF40  |00407711  返回到 113fd4dc.00407711 来自 113fd4dc.00406385
游客
登录 | 注册 方可回帖
返回