ReactOS  0.4.14-dev-98-gb0d4763
ghost.c
Go to the documentation of this file.
1 /*
2  * PROJECT: ReactOS user32.dll
3  * LICENSE: GPL-2.0-or-later (https://spdx.org/licenses/GPL-2.0-or-later)
4  * PURPOSE: Ghost window class
5  * COPYRIGHT: Copyright 2018 Katayama Hirofumi MZ (katayama.hirofumi.mz@gmail.com)
6  */
7 
8 #include <user32.h>
9 #include <strsafe.h>
10 #include "ghostwnd.h"
11 
13 
14 #define GHOST_TIMER_ID 0xFACEDEAD
15 #define GHOST_INTERVAL 1000 // one second
16 
18 {
19  L"Ghost", /* name */
20  0, /* style */
21  GhostWndProcA, /* procA */
22  GhostWndProcW, /* procW */
23  0, /* extra */
24  IDC_WAIT, /* cursor */
25  NULL /* brush */
26 };
27 
28 static HBITMAP
30 {
31  HBITMAP hbm = NULL;
32  BITMAPINFO bi;
33  HDC hdc;
34  LPVOID pvBits;
35 
36  ZeroMemory(&bi, sizeof(bi));
37  bi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
38  bi.bmiHeader.biWidth = cx;
39  bi.bmiHeader.biHeight = cy;
40  bi.bmiHeader.biPlanes = 1;
41  bi.bmiHeader.biBitCount = 32;
42 
44  if (hdc)
45  {
46  hbm = CreateDIBSection(hdc, &bi, DIB_RGB_COLORS, &pvBits, NULL, 0);
47  DeleteDC(hdc);
48  }
49  return hbm;
50 }
51 
52 static HBITMAP
54 {
55  HBITMAP hbm = NULL;
56  HDC hdc, hdcMem;
57  HGDIOBJ hbmOld;
58 
59  hdc = GetWindowDC(hwnd);
60  if (!hdc)
61  return NULL;
62 
64  if (!hdcMem)
65  goto earth;
66 
68  if (hbm)
69  {
70  hbmOld = SelectObject(hdcMem, hbm);
71  BitBlt(hdcMem, 0, 0, cx, cy, hdc, 0, 0, SRCCOPY | CAPTUREBLT);
72  SelectObject(hdcMem, hbmOld);
73  }
74 
76 
77 earth:
78  ReleaseDC(hwnd, hdc);
79 
80  return hbm;
81 }
82 
83 static VOID
85 {
86  BITMAP bm;
87  DWORD i, *pdw;
88 
89  GetObject(hbm, sizeof(bm), &bm);
90 
91  if (bm.bmBitsPixel != 32 || !bm.bmBits)
92  {
93  ERR("bm.bmBitsPixel == %d, bm.bmBits == %p\n",
94  bm.bmBitsPixel, bm.bmBits);
95  return;
96  }
97 
98  pdw = bm.bmBits;
99  for (i = 0; i < bm.bmWidth * bm.bmHeight; ++i)
100  {
101  *pdw = *pdw | 0x00C0C0C0; // bitwise-OR with ARGB #C0C0C0
102  ++pdw;
103  }
104 }
105 
106 /****************************************************************************/
107 
108 static GHOST_DATA *
110 {
112 }
113 
114 static HWND
116 {
118  if (!pData)
119  return NULL;
120  return pData->hwndTarget;
121 }
122 
123 static LPWSTR
124 Ghost_GetText(HWND hwndTarget, INT *pcchTextW, INT cchExtra)
125 {
126  LPWSTR pszTextW = NULL, pszTextNewW;
127  INT cchNonExtra, cchTextW = *pcchTextW;
128 
129  pszTextNewW = HeapAlloc(GetProcessHeap(), 0, cchTextW * sizeof(WCHAR));
130  for (;;)
131  {
132  if (!pszTextNewW)
133  {
134  ERR("HeapAlloc failed\n");
135  if (pszTextW)
136  HeapFree(GetProcessHeap(), 0, pszTextW);
137  return NULL;
138  }
139  pszTextW = pszTextNewW;
140 
141  cchNonExtra = cchTextW - cchExtra;
142  if (InternalGetWindowText(hwndTarget, pszTextW,
143  cchNonExtra) < cchNonExtra - 1)
144  {
145  break;
146  }
147 
148  cchTextW *= 2;
149  pszTextNewW = HeapReAlloc(GetProcessHeap(), 0, pszTextW,
150  cchTextW * sizeof(WCHAR));
151  }
152 
153  *pcchTextW = cchTextW;
154  return pszTextW;
155 }
156 
157 static BOOL
159 {
160  HBITMAP hbm32bpp;
161  HWND hwndTarget, hwndPrev;
162  GHOST_DATA *pData;
163  RECT rc;
164  DWORD style, exstyle;
165  WCHAR szTextW[320], szNotRespondingW[32];
166  LPWSTR pszTextW;
167  INT cchTextW, cchExtraW, cchNonExtraW;
168  PWND pWnd = ValidateHwnd(hwnd);
169  if (pWnd)
170  {
171  if (!pWnd->fnid)
172  {
174  }
175  else if (pWnd->fnid != FNID_GHOST)
176  {
177  ERR("Wrong window class for Ghost! fnId 0x%x\n", pWnd->fnid);
178  return FALSE;
179  }
180  }
181 
182  // get the target
183  hwndTarget = (HWND)lpcs->lpCreateParams;
184  if (!IsWindowVisible(hwndTarget) || // invisible?
185  (GetWindowLongPtrW(hwndTarget, GWL_STYLE) & WS_CHILD) || // child?
186  !IsHungAppWindow(hwndTarget)) // not hung?
187  {
188  return FALSE;
189  }
190 
191  // check prop
192  if (GetPropW(hwndTarget, GHOST_PROP))
193  return FALSE;
194 
195  // set prop
196  SetPropW(hwndTarget, GHOST_PROP, hwnd);
197 
198  // create user data
199  pData = HeapAlloc(GetProcessHeap(), 0, sizeof(GHOST_DATA));
200  if (!pData)
201  {
202  ERR("HeapAlloc failed\n");
203  return FALSE;
204  }
205 
206  // get window image
207  GetWindowRect(hwndTarget, &rc);
208  hbm32bpp = IntGetWindowBitmap(hwndTarget,
209  rc.right - rc.left,
210  rc.bottom - rc.top);
211  if (!hbm32bpp)
212  {
213  ERR("hbm32bpp was NULL\n");
215  return FALSE;
216  }
217  // make a ghost image
218  IntMakeGhostImage(hbm32bpp);
219 
220  // set user data
221  pData->hwndTarget = hwndTarget;
222  pData->hbm32bpp = hbm32bpp;
223  pData->bDestroyTarget = FALSE;
225 
226  // get style
227  style = GetWindowLongPtrW(hwndTarget, GWL_STYLE);
228  exstyle = GetWindowLongPtrW(hwndTarget, GWL_EXSTYLE);
229 
230  // get text
231  cchTextW = ARRAYSIZE(szTextW);
232  cchExtraW = ARRAYSIZE(szNotRespondingW);
233  cchNonExtraW = cchTextW - cchExtraW;
234  if (InternalGetWindowText(hwndTarget, szTextW,
235  cchNonExtraW) < cchNonExtraW - 1)
236  {
237  pszTextW = szTextW;
238  }
239  else
240  {
241  cchTextW *= 2;
242  pszTextW = Ghost_GetText(hwndTarget, &cchTextW, cchExtraW);
243  if (!pszTextW)
244  {
245  ERR("Ghost_GetText failed\n");
246  DeleteObject(hbm32bpp);
248  return FALSE;
249  }
250  }
251 
252  // don't use scrollbars.
254 
255  // set style
258 
259  // set text with " (Not Responding)"
261  szNotRespondingW, ARRAYSIZE(szNotRespondingW));
262  StringCchCatW(pszTextW, cchTextW, szNotRespondingW);
263  SetWindowTextW(hwnd, pszTextW);
264 
265  // free the text buffer
266  if (szTextW != pszTextW)
267  HeapFree(GetProcessHeap(), 0, pszTextW);
268 
269  // get previous window of target
270  hwndPrev = GetWindow(hwndTarget, GW_HWNDPREV);
271 
272  // hide target
273  ShowWindowAsync(hwndTarget, SW_HIDE);
274 
275  // shrink the ghost to zero size and insert.
276  // this will avoid effects.
277  SetWindowPos(hwnd, hwndPrev, 0, 0, 0, 0,
279  SWP_DRAWFRAME);
280 
281  // resume the position and size of ghost
282  MoveWindow(hwnd, rc.left, rc.top,
283  rc.right - rc.left, rc.bottom - rc.top, TRUE);
284 
285  // make ghost visible
287 
288  // redraw
290 
291  // start timer
293 
294  return TRUE;
295 }
296 
297 static void
298 Ghost_Unenchant(HWND hwnd, BOOL bDestroyTarget)
299 {
301  if (!pData)
302  return;
303 
304  pData->bDestroyTarget |= bDestroyTarget;
306 }
307 
308 static void
310 {
311  BITMAP bm;
312  HDC hdcMem;
314 
315  if (!pData || !GetObject(pData->hbm32bpp, sizeof(bm), &bm))
316  return;
317 
319  if (hdcMem)
320  {
321  HGDIOBJ hbmOld = SelectObject(hdcMem, pData->hbm32bpp);
322  BitBlt(hdc, 0, 0, bm.bmWidth, bm.bmHeight,
323  hdcMem, 0, 0, SRCCOPY | CAPTUREBLT);
324  SelectObject(hdcMem, hbmOld);
325  DeleteDC(hdcMem);
326  }
327 }
328 
329 static void
331 {
332  HDC hdc;
333 
334  // do the default behaivour
335  if (bUnicode)
337  else
339 
340  // draw the ghost image
341  hdc = GetWindowDC(hwnd);
342  if (hdc)
343  {
345  ReleaseDC(hwnd, hdc);
346  }
347 }
348 
349 static void
351 {
352  PAINTSTRUCT ps;
353  HDC hdc = BeginPaint(hwnd, &ps);
354  if (hdc)
355  {
356  // don't draw at here
357  EndPaint(hwnd, &ps);
358  }
359 }
360 
361 static void
363 {
364  RECT rc;
365  HWND hwndTarget = Ghost_GetTarget(hwnd);
366 
367  GetWindowRect(hwnd, &rc);
368 
369  // move the target
370  SetWindowPos(hwndTarget, NULL, rc.left, rc.top, 0, 0,
373 }
374 
375 static void
377 {
379 }
380 
381 static void
383 {
384  HWND hwndTarget = pData->hwndTarget;
385  DWORD pid;
387 
388  pData->hwndTarget = NULL;
389  GetWindowThreadProcessId(hwndTarget, &pid);
390 
392  if (hProcess)
393  {
396  }
397 
398  DestroyWindow(hwndTarget);
399 }
400 
401 static void
403 {
404  // delete the user data
406  if (pData)
407  {
409 
410  // delete image
411  DeleteObject(pData->hbm32bpp);
412  pData->hbm32bpp = NULL;
413 
414  // remove prop
415  RemovePropW(pData->hwndTarget, GHOST_PROP);
416 
417  // show target
419 
420  // destroy target if necessary
421  if (pData->bDestroyTarget)
422  {
424  }
425 
427  }
428 
430 
431  PostQuitMessage(0);
432 }
433 
434 static void
436 {
437  INT id;
438  WCHAR szAskTerminate[128];
439  WCHAR szHungUpTitle[128];
440 
441  // stop timer
443 
445  szAskTerminate, ARRAYSIZE(szAskTerminate));
447  szHungUpTitle, ARRAYSIZE(szHungUpTitle));
448 
449  id = MessageBoxW(hwnd, szAskTerminate, szHungUpTitle,
451  if (id == IDYES)
452  {
453  // destroy the target
455  return;
456  }
457 
458  // restart timer
460 }
461 
462 static void
464 {
465  HWND hwndTarget;
467 
468  if (id != GHOST_TIMER_ID || !pData)
469  return;
470 
471  // stop the timer
472  KillTimer(hwnd, id);
473 
474  hwndTarget = pData->hwndTarget;
475  if (!IsWindow(hwndTarget) || !IsHungAppWindow(hwndTarget))
476  {
477  // resume if window is destroyed or responding
479  return;
480  }
481 
482  // restart the timer
484 }
485 
486 static HICON
488 {
490  HICON hIcon = NULL;
491 
492  if (!pData)
493  return NULL;
494 
495  // same as the original icon
496  switch (fType)
497  {
498  case ICON_BIG:
499  {
500  hIcon = (HICON)GetClassLongPtrW(pData->hwndTarget, GCLP_HICON);
501  break;
502  }
503 
504  case ICON_SMALL:
505  {
506  hIcon = (HICON)GetClassLongPtrW(pData->hwndTarget, GCLP_HICONSM);
507  break;
508  }
509  }
510 
511  return hIcon;
512 }
513 
516  BOOL unicode)
517 {
518  switch (uMsg)
519  {
520  case WM_CREATE:
522  return -1;
523  break;
524 
525  case WM_NCPAINT:
526  Ghost_OnNCPaint(hwnd, (HRGN)wParam, unicode);
527  return 0;
528 
529  case WM_ERASEBKGND:
531  return TRUE;
532 
533  case WM_PAINT:
535  break;
536 
537  case WM_MOVE:
539  break;
540 
541  case WM_SIZE:
542  break;
543 
544  case WM_SIZING:
545  return TRUE;
546 
547  case WM_SYSCOMMAND:
548  switch ((UINT)wParam)
549  {
550  case SC_MAXIMIZE:
551  case SC_SIZE:
552  // sizing-related
553  return 0;
554  }
555  if (unicode)
556  return DefWindowProcW(hwnd, uMsg, wParam, lParam);
557  else
558  return DefWindowProcA(hwnd, uMsg, wParam, lParam);
559 
560  case WM_CLOSE:
562  break;
563 
564  case WM_TIMER:
566  break;
567 
568  case WM_NCMOUSEMOVE:
569  if (unicode)
570  DefWindowProcW(hwnd, uMsg, wParam, lParam);
571  else
572  DefWindowProcA(hwnd, uMsg, wParam, lParam);
574  return 0;
575 
576  case WM_GETICON:
577  return (LRESULT)Ghost_GetIcon(hwnd, (INT)wParam);
578 
579  case WM_COMMAND:
580  if (LOWORD(wParam) == 3333)
582  break;
583 
584  case WM_DESTROY:
586  break;
587 
588  case WM_NCDESTROY:
590  break;
591 
592  default:
593  {
594  if (unicode)
595  return DefWindowProcW(hwnd, uMsg, wParam, lParam);
596  else
597  return DefWindowProcA(hwnd, uMsg, wParam, lParam);
598  }
599  }
600  return 0;
601 }
602 
605 {
606  return GhostWndProc_common(hwnd, uMsg, wParam, lParam, FALSE);
607 }
608 
611 {
612  return GhostWndProc_common(hwnd, uMsg, wParam, lParam, TRUE);
613 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
_In_ ULONG_PTR _In_ ULONG _Out_ ULONG_PTR * pid
Definition: winddi.h:3835
#define SWP_DRAWFRAME
Definition: winuser.h:1224
static HICON
Definition: imagelist.c:84
static void Ghost_DestroyTarget(GHOST_DATA *pData)
Definition: ghost.c:382
#define TRUE
Definition: types.h:120
#define CloseHandle
Definition: compat.h:398
BITMAPINFOHEADER bmiHeader
Definition: wingdi.h:1471
#define SW_SHOWNOACTIVATE
Definition: winuser.h:768
static void Ghost_OnNCPaint(HWND hwnd, HRGN hrgn, BOOL bUnicode)
Definition: ghost.c:330
#define IDYES
Definition: winuser.h:829
BOOL WINAPI IsWindow(_In_opt_ HWND)
static void Ghost_OnPaint(HWND hwnd)
Definition: ghost.c:350
#define SW_HIDE
Definition: winuser.h:762
struct tagBITMAPINFOHEADER BITMAPINFOHEADER
static void Ghost_OnClose(HWND hwnd)
Definition: ghost.c:435
static HDC
Definition: imagelist.c:92
#define CALLBACK
Definition: compat.h:27
LONG top
Definition: windef.h:292
HANDLE HWND
Definition: compat.h:13
static BOOL Ghost_OnCreate(HWND hwnd, CREATESTRUCTW *lpcs)
Definition: ghost.c:158
#define ARRAYSIZE(array)
Definition: filtermapper.c:47
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1497
#define ZeroMemory
Definition: winbase.h:1642
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
#define WM_MOVE
Definition: winuser.h:1592
#define GWL_EXSTYLE
Definition: winuser.h:845
_In_ BOOL _In_ HANDLE hProcess
Definition: mapping.h:70
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
BOOL WINAPI SetWindowTextW(_In_ HWND, _In_opt_ LPCWSTR)
UINT_PTR WPARAM
Definition: windef.h:207
static void Ghost_OnDraw(HWND hwnd, HDC hdc)
Definition: ghost.c:309
#define WS_CHILD
Definition: pedump.c:617
#define GetWindowLongPtrW
Definition: winuser.h:4730
LONG left
Definition: windef.h:291
#define FNID_DESTROY
Definition: ntuser.h:859
BOOL WINAPI EndPaint(_In_ HWND, _In_ const PAINTSTRUCT *)
LONG right
Definition: windef.h:293
static HBITMAP IntGetWindowBitmap(HWND hwnd, INT cx, INT cy)
Definition: ghost.c:53
static VOID IntMakeGhostImage(HBITMAP hbm)
Definition: ghost.c:84
BOOL WINAPI DestroyWindow(_In_ HWND)
LRESULT WINAPI GhostWndProc_common(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL unicode)
Definition: ghost.c:515
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
static VOID NTAPI BitBlt(IN ULONG Left, IN ULONG Top, IN ULONG Width, IN ULONG Height, IN PUCHAR Buffer, IN ULONG BitsPerPixel, IN ULONG Delta)
Definition: vga.c:410
HINSTANCE User32Instance
Definition: dllmain.c:27
int32_t INT
Definition: typedefs.h:56
#define SWP_NOSENDCHANGING
Definition: winuser.h:1236
WPARAM wParam
Definition: combotst.c:138
HANDLE WINAPI RemovePropW(_In_ HWND, _In_ LPCWSTR)
LRESULT WINAPI DefWindowProcW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
static void Ghost_OnNCDestroy(HWND hwnd)
Definition: ghost.c:402
STRSAFEAPI StringCchCatW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszSrc)
Definition: strsafe.h:325
#define ICON_SMALL
Definition: tnclass.cpp:48
static HWND Ghost_GetTarget(HWND hwnd)
Definition: ghost.c:115
#define WM_NCPAINT
Definition: winuser.h:1669
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
BOOL WINAPI ShowWindowAsync(_In_ HWND, _In_ int)
#define MB_YESNO
Definition: winuser.h:811
DWORD fnid
Definition: ntuser.h:673
unsigned int BOOL
Definition: ntddk_ex.h:94
WINE_DEFAULT_DEBUG_CHANNEL(ghost)
#define GHOST_INTERVAL
Definition: ghost.c:15
short SHORT
Definition: pedump.c:59
LRESULT CALLBACK GhostWndProcW(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: ghost.c:610
HDC WINAPI BeginPaint(_In_ HWND, _Out_ LPPAINTSTRUCT)
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
static void Ghost_OnMove(HWND hwnd, int x, int y)
Definition: ghost.c:362
BOOL WINAPI IsHungAppWindow(HWND hwnd)
Definition: window.c:1872
#define SC_MAXIMIZE
Definition: winuser.h:2563
#define GWLP_USERDATA
Definition: treelist.c:63
_Out_opt_ int _Out_opt_ int * cy
Definition: commctrl.h:570
#define WM_SIZING
Definition: winuser.h:1789
DWORD WINAPI GetWindowThreadProcessId(HWND, PDWORD)
smooth NULL
Definition: ftsmooth.c:416
#define IDC_WAIT
Definition: winuser.h:684
LONG_PTR LPARAM
Definition: windef.h:208
UINT_PTR WINAPI SetTimer(_In_opt_ HWND, _In_ UINT_PTR, _In_ UINT, _In_opt_ TIMERPROC)
#define WM_DESTROY
Definition: winuser.h:1591
static HICON Ghost_GetIcon(HWND hwnd, INT fType)
Definition: ghost.c:487
#define GCLP_HICONSM
Definition: winuser.h:670
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
BOOL WINAPI SetPropW(_In_ HWND, _In_ LPCWSTR, _In_opt_ HANDLE)
int WINAPI MessageBoxW(_In_opt_ HWND, _In_opt_ LPCWSTR, _In_opt_ LPCWSTR, _In_ UINT)
if(!(yy_init))
Definition: macro.lex.yy.c:714
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define WM_SIZE
Definition: winuser.h:1593
#define SWP_NOACTIVATE
Definition: winuser.h:1227
#define WM_TIMER
Definition: winuser.h:1724
LRESULT CALLBACK GhostWndProcA(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: ghost.c:604
#define WM_CLOSE
Definition: winuser.h:1603
#define WM_NCDESTROY
Definition: winuser.h:1666
#define WINAPI
Definition: msvc.h:8
BOOL WINAPI InvalidateRect(_In_opt_ HWND, _In_opt_ LPCRECT, _In_ BOOL)
static void Ghost_Unenchant(HWND hwnd, BOOL bDestroyTarget)
Definition: ghost.c:298
unsigned long DWORD
Definition: ntddk_ex.h:95
static void Ghost_OnTimer(HWND hwnd, UINT id)
Definition: ghost.c:463
#define GetObject
Definition: wingdi.h:4463
#define WS_HSCROLL
Definition: pedump.c:628
#define WM_PAINT
Definition: winuser.h:1602
#define MB_ICONINFORMATION
Definition: winuser.h:796
BOOL WINAPI KillTimer(_In_opt_ HWND, _In_ UINT_PTR)
HWND WINAPI GetWindow(_In_ HWND, _In_ UINT)
static const WCHAR L[]
Definition: oid.c:1250
PWND FASTCALL ValidateHwnd(HWND hwnd)
Definition: misc.c:369
LPVOID lpCreateParams
Definition: winuser.h:2929
HDC hdc
Definition: main.c:9
#define GCLP_HICON
Definition: winuser.h:669
static HRGN hrgn
Definition: win.c:55
#define IDS_NOT_RESPONDING
Definition: resource.h:257
#define GHOST_PROP
Definition: ghostwnd.h:11
#define WM_COMMAND
Definition: winuser.h:1722
LRESULT WINAPI DefWindowProcA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
BOOL WINAPI MoveWindow(_In_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ BOOL)
static LPWSTR Ghost_GetText(HWND hwndTarget, INT *pcchTextW, INT cchExtra)
Definition: ghost.c:124
#define LoadCursor
Definition: winuser.h:5713
#define SWP_NOSIZE
Definition: winuser.h:1230
#define ERR(fmt,...)
Definition: debug.h:109
#define GWL_STYLE
Definition: winuser.h:846
Definition: ntuser.h:657
#define FNID_GHOST
Definition: ntuser.h:837
HANDLE WINAPI OpenProcess(IN DWORD dwDesiredAccess, IN BOOL bInheritHandle, IN DWORD dwProcessId)
Definition: proc.c:1227
#define PROCESS_TERMINATE
Definition: pstypes.h:149
BOOL WINAPI DeleteDC(_In_ HDC)
#define IDS_ASK_TERMINATE
Definition: resource.h:12
INT WINAPI InternalGetWindowText(_In_ HWND hWnd, _Out_writes_to_(cchMaxCount, return+1) LPWSTR pString, _In_ int cchMaxCount)
HCURSOR WINAPI SetCursor(_In_opt_ HCURSOR)
HICON hIcon
Definition: msconfig.c:44
BOOL WINAPI TerminateProcess(IN HANDLE hProcess, IN UINT uExitCode)
Definition: proc.c:1532
HBITMAP WINAPI CreateDIBSection(HDC hDC, CONST BITMAPINFO *BitmapInfo, UINT Usage, VOID **Bits, HANDLE hSection, DWORD dwOffset)
Definition: bitmap.c:197
#define SC_SIZE
Definition: winuser.h:2559
_In_ HBITMAP hbm
Definition: ntgdi.h:2776
Definition: bl.h:1331
#define HeapReAlloc
Definition: compat.h:393
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
HDC WINAPI GetWindowDC(_In_opt_ HWND)
unsigned int UINT
Definition: ndis.h:50
#define WS_VSCROLL
Definition: pedump.c:627
HANDLE WINAPI GetPropW(_In_ HWND, _In_ LPCWSTR)
static GHOST_DATA * Ghost_GetData(HWND hwnd)
Definition: ghost.c:109
#define GHOST_TIMER_ID
Definition: ghost.c:14
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
#define IDS_HUNG_UP_TITLE
Definition: resource.h:13
_Out_opt_ int * cx
Definition: commctrl.h:570
#define WM_CREATE
Definition: winuser.h:1590
#define HIWORD(l)
Definition: typedefs.h:246
GLenum GLuint id
Definition: glext.h:5579
BOOL WINAPI IsWindowVisible(_In_ HWND)
LONG bottom
Definition: windef.h:294
BOOL NTAPI NtUserSetWindowFNID(HWND hWnd, WORD fnID)
Definition: window.c:4122
#define SWP_NOMOVE
Definition: winuser.h:1229
#define CAPTUREBLT
Definition: wingdi.h:1375
BOOL WINAPI GetWindowRect(_In_ HWND, _Out_ LPRECT)
BOOL WINAPI SetWindowPos(_In_ HWND, _In_opt_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ UINT)
#define SetWindowLongPtrW
Definition: winuser.h:5247
static HBITMAP
Definition: button.c:44
#define WM_ERASEBKGND
Definition: winuser.h:1607
WCHAR * LPWSTR
Definition: xmlstorage.h:184
static HBITMAP IntCreate32BppBitmap(INT cx, INT cy)
Definition: ghost.c:29
TW_UINT32 TW_UINT16 TW_UINT16 TW_MEMREF pData
Definition: twain.h:1827
LONG_PTR LRESULT
Definition: windef.h:209
#define DIB_RGB_COLORS
Definition: wingdi.h:366
static void Ghost_OnDestroy(HWND hwnd)
Definition: ghost.c:376
Arabic default style
Definition: afstyles.h:93
#define WS_VISIBLE
Definition: pedump.c:620
#define WM_SYSCOMMAND
Definition: winuser.h:1723
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82
#define GW_HWNDPREV
Definition: winuser.h:757
#define HeapFree(x, y, z)
Definition: compat.h:394
#define GetClassLongPtrW
Definition: winuser.h:4465
__analysis_noreturn void WINAPI PostQuitMessage(_In_ int)
#define SRCCOPY
Definition: wingdi.h:332
#define WM_NCMOUSEMOVE
Definition: winuser.h:1673
const struct builtin_class_descr GHOST_builtin_class
Definition: ghost.c:17
HDC hdcMem
Definition: welcome.c:104
#define ICON_BIG
Definition: tnclass.cpp:51
#define SWP_NOOWNERZORDER
Definition: winuser.h:1234