首页
社区
课程
招聘
[旧帖] 奇怪的消息窗口创建失败问题 0.00雪花
发表于: 2016-3-14 16:24 2767

[旧帖] 奇怪的消息窗口创建失败问题 0.00雪花

2016-3-14 16:24
2767
改造公司一个旧有的项目,使用detours注入后创建消息窗口,在CreateWindow时报错,getLastError为183,而奇怪的是我使用一个新项目,用同样的方式却成功,2个项目只有默认项目配置和旧有项目配置的区别(旧项目似乎有不少改动的配置)。个人感觉应该和配置有关,但还是附上消息窗口代码吧。

BOOL InitMessageWindow()
{
	HINSTANCE hInstance = NULL;
	hInstance = GetModuleHandle(NULL);
	if (hInstance == NULL)
	{
		return FALSE;
	}
	WNDCLASS wndcls;
	wndcls.cbClsExtra = 0;
	wndcls.cbWndExtra = 0;
	wndcls.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH);
	wndcls.hCursor = LoadCursor(NULL, IDC_CROSS);
	wndcls.hIcon = LoadIcon(NULL, IDI_APPLICATION);
	wndcls.hInstance = hInstance;
	wndcls.lpfnWndProc = GameFunc;
	wndcls.lpszClassName = "Message Window";
	wndcls.lpszMenuName = NULL;
	wndcls.style = CS_HREDRAW | CS_VREDRAW;
	RegisterClass(&wndcls);
	HWND m_hwnd = CreateWindowEx(0, "Message Window", "Message Window", 0, 0, 0, 0, 0, HWND_MESSAGE, 0, hInstance, 0);
	DWORD dd = GetLastError();
	if (m_hwnd == NULL)
	{
		
		CString rg2;
		rg2.Format("%d", m_hwnd);
		MessageBox(NULL, "CreateWindowEx", rg2, MB_OK);
		return FALSE;
	}
	return TRUE;
}

[课程]Android-CTF解题方法汇总!

收藏
免费 0
支持
分享
最新回复 (3)
雪    币: 35
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
2
飘过,表示看不懂呢
2016-3-21 08:57
0
雪    币: 488
活跃值: (3149)
能力值: ( LV7,RANK:140 )
在线值:
发帖
回帖
粉丝
3
RegisterClass返回是否正常?"Message Window"这个ClassName是否是系统关键字?
2016-3-21 09:24
0
雪    币: 244
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
4
183 错误-当文件已存在时,无法创建该文件。

If the function fails, the return value is NULL. To get extended error information, call GetLastError.

This function typically fails for one of the following reasons:

an invalid parameter value
the system class was registered by a different module
the WH_CBT hook is installed and returns a failure code
the window procedure fails for WM_CREATE or WM_NCCREATE
2016-3-24 10:34
0
游客
登录 | 注册 方可回帖
返回
//