forked from taviso/ctftool
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwinmsg.c
71 lines (63 loc) · 1.96 KB
/
winmsg.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#define WIN32_LEAN_AND_MEAN
#define WIN32_NO_STATUS
#include <windows.h>
#include <winternl.h>
#include <stdio.h>
#include <stdlib.h>
#include <msctf.h>
#undef WIN32_NO_STATUS
#include <ntstatus.h>
#include "ntdll.h"
#include "ntalpctyp.h"
#include "ntalpc.h"
#include "ctfinternal.h"
#include "ctftool.h"
#define LogMessage(s, f, ...) fprintf(s, f, __VA_ARGS__), fputc('\n', s)
LRESULT CALLBACK WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
switch (uMsg) {
case WM_GETMINMAXINFO:
case WM_NCCREATE:
case WM_NCCALCSIZE:
case WM_CREATE:
case WM_WINDOWPOSCHANGING:
case WM_ACTIVATEAPP:
case WM_NCACTIVATE:
case WM_ACTIVATE:
case WM_IME_SETCONTEXT:
case WM_IME_NOTIFY:
case WM_GETOBJECT:
case WM_SETFOCUS:
case WM_DESTROY:
case WM_NCDESTROY:
case 0x90: // WM_UAHDESTROYWINDOW
break;
default:
LogMessage(stderr, "WindowProc(%p, %#x, %p, %p);", hwnd, uMsg, (PVOID)wParam, (PVOID) lParam);
}
return DefWindowProc(hwnd, uMsg, wParam, lParam);
}
HWND CreateMessageWindow()
{
WNDCLASSEX WindowClass = {0};
ATOM Atom;
HWND MsgWindow;
WindowClass.cbSize = sizeof(WNDCLASSEX);
WindowClass.lpfnWndProc = WindowProc;
WindowClass.lpszClassName = "Class";
Atom = RegisterClassEx(&WindowClass);
MsgWindow = CreateWindowEx(0,
MAKEINTATOM(Atom),
"Message",
0,
0,
0,
128,
128,
0,
NULL,
NULL,
NULL);
LogMessage(stdout, "message window %p", MsgWindow);
return MsgWindow;
}