ReactOS 0.4.15-dev-7924-g5949c20
ghost.c File Reference
#include <user32.h>
#include <strsafe.h>
#include "ghostwnd.h"
Include dependency graph for ghost.c:

Go to the source code of this file.

Macros

#define GHOST_TIMER_ID   0xFACEDEAD
 
#define GHOST_INTERVAL   1000
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (ghost)
 
static HBITMAP IntCreate32BppBitmap (INT cx, INT cy)
 
static HBITMAP IntGetWindowBitmap (HWND hwnd, INT cx, INT cy)
 
static VOID IntMakeGhostImage (HBITMAP hbm)
 
static GHOST_DATAGhost_GetData (HWND hwnd)
 
static HWND Ghost_GetTarget (HWND hwnd)
 
static LPWSTR Ghost_GetText (HWND hwndTarget, INT *pcchTextW, INT cchExtra)
 
static BOOL Ghost_OnCreate (HWND hwnd, CREATESTRUCTW *lpcs)
 
static void Ghost_Unenchant (HWND hwnd, BOOL bDestroyTarget)
 
static void Ghost_OnDraw (HWND hwnd, HDC hdc)
 
static void Ghost_OnNCPaint (HWND hwnd, HRGN hrgn, BOOL bUnicode)
 
static void Ghost_OnPaint (HWND hwnd)
 
static void Ghost_OnMove (HWND hwnd, int x, int y)
 
static void Ghost_OnDestroy (HWND hwnd)
 
static void Ghost_DestroyTarget (GHOST_DATA *pData)
 
static void Ghost_OnNCDestroy (HWND hwnd)
 
static void Ghost_OnClose (HWND hwnd)
 
static void Ghost_OnTimer (HWND hwnd, UINT id)
 
static HICON Ghost_GetIcon (HWND hwnd, INT fType)
 
LRESULT WINAPI GhostWndProc_common (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL unicode)
 
LRESULT CALLBACK GhostWndProcA (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
LRESULT CALLBACK GhostWndProcW (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
 

Variables

const struct builtin_class_descr GHOST_builtin_class
 

Macro Definition Documentation

◆ GHOST_INTERVAL

#define GHOST_INTERVAL   1000

Definition at line 15 of file ghost.c.

◆ GHOST_TIMER_ID

#define GHOST_TIMER_ID   0xFACEDEAD

Definition at line 14 of file ghost.c.

Function Documentation

◆ Ghost_DestroyTarget()

static void Ghost_DestroyTarget ( GHOST_DATA pData)
static

Definition at line 382 of file ghost.c.

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}
#define NULL
Definition: types.h:112
#define FALSE
Definition: types.h:117
#define CloseHandle
Definition: compat.h:739
BOOL WINAPI TerminateProcess(IN HANDLE hProcess, IN UINT uExitCode)
Definition: proc.c:1532
HANDLE WINAPI OpenProcess(IN DWORD dwDesiredAccess, IN BOOL bInheritHandle, IN DWORD dwProcessId)
Definition: proc.c:1227
unsigned long DWORD
Definition: ntddk_ex.h:95
#define PROCESS_TERMINATE
Definition: pstypes.h:157
_In_ BOOL _In_ HANDLE hProcess
Definition: mapping.h:71
TW_UINT32 TW_UINT16 TW_UINT16 TW_MEMREF pData
Definition: twain.h:1830
DWORD WINAPI GetWindowThreadProcessId(HWND hWnd, PDWORD lpdwProcessId)
_In_ ULONG_PTR _In_ ULONG _Out_ ULONG_PTR * pid
Definition: winddi.h:3837
BOOL WINAPI DestroyWindow(_In_ HWND)

Referenced by Ghost_OnNCDestroy().

◆ Ghost_GetData()

static GHOST_DATA * Ghost_GetData ( HWND  hwnd)
static

Definition at line 109 of file ghost.c.

110{
112}
#define GWLP_USERDATA
Definition: treelist.c:63
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023
#define GetWindowLongPtrW
Definition: winuser.h:4829

Referenced by Ghost_GetIcon(), Ghost_GetTarget(), Ghost_OnDraw(), Ghost_OnNCDestroy(), Ghost_OnTimer(), and Ghost_Unenchant().

◆ Ghost_GetIcon()

static HICON Ghost_GetIcon ( HWND  hwnd,
INT  fType 
)
static

Definition at line 487 of file ghost.c.

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 {
501 break;
502 }
503
504 case ICON_SMALL:
505 {
507 break;
508 }
509 }
510
511 return hIcon;
512}
static HICON
Definition: imagelist.c:84
HICON hIcon
Definition: msconfig.c:44
#define ICON_BIG
Definition: tnclass.cpp:51
#define ICON_SMALL
Definition: tnclass.cpp:48
static GHOST_DATA * Ghost_GetData(HWND hwnd)
Definition: ghost.c:109
#define GCLP_HICONSM
Definition: winuser.h:675
#define GCLP_HICON
Definition: winuser.h:674
#define GetClassLongPtrW
Definition: winuser.h:4564

Referenced by GhostWndProc_common().

◆ Ghost_GetTarget()

static HWND Ghost_GetTarget ( HWND  hwnd)
static

Definition at line 115 of file ghost.c.

116{
118 if (!pData)
119 return NULL;
120 return pData->hwndTarget;
121}

Referenced by Ghost_OnMove().

◆ Ghost_GetText()

static LPWSTR Ghost_GetText ( HWND  hwndTarget,
INT pcchTextW,
INT  cchExtra 
)
static

Definition at line 124 of file ghost.c.

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}
#define ERR(fmt,...)
Definition: debug.h:110
#define GetProcessHeap()
Definition: compat.h:736
#define HeapAlloc
Definition: compat.h:733
#define HeapReAlloc
Definition: compat.h:734
#define HeapFree(x, y, z)
Definition: compat.h:735
int32_t INT
Definition: typedefs.h:58
INT WINAPI InternalGetWindowText(_In_ HWND hWnd, _Out_writes_to_(cchMaxCount, return+1) LPWSTR pString, _In_ int cchMaxCount)
__wchar_t WCHAR
Definition: xmlstorage.h:180
WCHAR * LPWSTR
Definition: xmlstorage.h:184

Referenced by Ghost_OnCreate().

◆ Ghost_OnClose()

static void Ghost_OnClose ( HWND  hwnd)
static

Definition at line 435 of file ghost.c.

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}
#define TRUE
Definition: types.h:120
#define ARRAYSIZE(array)
Definition: filtermapper.c:47
GLuint id
Definition: glext.h:5910
static void Ghost_Unenchant(HWND hwnd, BOOL bDestroyTarget)
Definition: ghost.c:298
#define GHOST_TIMER_ID
Definition: ghost.c:14
#define GHOST_INTERVAL
Definition: ghost.c:15
HINSTANCE User32Instance
Definition: dllmain.c:27
#define IDS_HUNG_UP_TITLE
Definition: resource.h:13
#define IDS_ASK_TERMINATE
Definition: resource.h:12
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
#define MB_YESNO
Definition: winuser.h:817
int WINAPI MessageBoxW(_In_opt_ HWND hWnd, _In_opt_ LPCWSTR lpText, _In_opt_ LPCWSTR lpCaption, _In_ UINT uType)
UINT_PTR WINAPI SetTimer(_In_opt_ HWND, _In_ UINT_PTR, _In_ UINT, _In_opt_ TIMERPROC)
#define MB_ICONINFORMATION
Definition: winuser.h:802
#define IDYES
Definition: winuser.h:835
BOOL WINAPI KillTimer(_In_opt_ HWND, _In_ UINT_PTR)

Referenced by GhostWndProc_common().

◆ Ghost_OnCreate()

static BOOL Ghost_OnCreate ( HWND  hwnd,
CREATESTRUCTW lpcs 
)
static

Definition at line 158 of file ghost.c.

159{
160 HBITMAP hbm32bpp;
161 HWND hwndTarget, hwndPrev;
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,
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}
Arabic default style
Definition: afstyles.h:94
#define IDS_NOT_RESPONDING
Definition: resource.h:263
HANDLE HWND
Definition: compat.h:19
#define ValidateHwnd(hwnd)
Definition: precomp.h:85
pKey DeleteObject()
#define GHOST_PROP
Definition: ghostwnd.h:11
#define FNID_GHOST
Definition: ntuser.h:875
BOOL NTAPI NtUserSetWindowFNID(HWND hWnd, WORD fnID)
Definition: window.c:4330
if(dx< 0)
Definition: linetemp.h:194
static HBITMAP
Definition: button.c:44
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
#define WS_CHILD
Definition: pedump.c:617
#define WS_VSCROLL
Definition: pedump.c:627
#define WS_VISIBLE
Definition: pedump.c:620
#define WS_HSCROLL
Definition: pedump.c:628
STRSAFEAPI StringCchCatW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszSrc)
Definition: strsafe.h:325
Definition: ntuser.h:694
DWORD fnid
Definition: ntuser.h:709
LPVOID lpCreateParams
Definition: winuser.h:2955
LONG right
Definition: windef.h:308
LONG bottom
Definition: windef.h:309
LONG top
Definition: windef.h:307
LONG left
Definition: windef.h:306
static VOID IntMakeGhostImage(HBITMAP hbm)
Definition: ghost.c:84
static HBITMAP IntGetWindowBitmap(HWND hwnd, INT cx, INT cy)
Definition: ghost.c:53
static LPWSTR Ghost_GetText(HWND hwndTarget, INT *pcchTextW, INT cchExtra)
Definition: ghost.c:124
BOOL WINAPI IsHungAppWindow(HWND hwnd)
Definition: window.c:1875
#define SW_HIDE
Definition: winuser.h:768
#define SWP_NOACTIVATE
Definition: winuser.h:1242
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 SWP_DRAWFRAME
Definition: winuser.h:1239
#define SWP_NOMOVE
Definition: winuser.h:1244
BOOL WINAPI SetWindowTextW(_In_ HWND, _In_opt_ LPCWSTR)
BOOL WINAPI ShowWindowAsync(_In_ HWND, _In_ int)
BOOL WINAPI SetPropW(_In_ HWND, _In_ LPCWSTR, _In_opt_ HANDLE)
HANDLE WINAPI GetPropW(_In_ HWND, _In_ LPCWSTR)
HWND WINAPI GetWindow(_In_ HWND, _In_ UINT)
#define SWP_NOOWNERZORDER
Definition: winuser.h:1249
#define GW_HWNDPREV
Definition: winuser.h:762
BOOL WINAPI InvalidateRect(_In_opt_ HWND, _In_opt_ LPCRECT, _In_ BOOL)
#define SetWindowLongPtrW
Definition: winuser.h:5346
#define GWL_STYLE
Definition: winuser.h:852
BOOL WINAPI IsWindowVisible(_In_ HWND)
BOOL WINAPI MoveWindow(_In_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ BOOL)
#define GWL_EXSTYLE
Definition: winuser.h:851

Referenced by GhostWndProc_common().

◆ Ghost_OnDestroy()

static void Ghost_OnDestroy ( HWND  hwnd)
static

Definition at line 376 of file ghost.c.

377{
379}

Referenced by GhostWndProc_common().

◆ Ghost_OnDraw()

static void Ghost_OnDraw ( HWND  hwnd,
HDC  hdc 
)
static

Definition at line 309 of file ghost.c.

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);
326 }
327}
static VOID BitBlt(_In_ ULONG Left, _In_ ULONG Top, _In_ ULONG Width, _In_ ULONG Height, _In_reads_bytes_(Delta *Height) PUCHAR Buffer, _In_ ULONG BitsPerPixel, _In_ ULONG Delta)
Definition: common.c:57
HDC hdc
Definition: main.c:9
static HDC
Definition: imagelist.c:92
Definition: bl.h:1331
HDC hdcMem
Definition: welcome.c:104
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1539
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
#define SRCCOPY
Definition: wingdi.h:333
#define GetObject
Definition: wingdi.h:4468
BOOL WINAPI DeleteDC(_In_ HDC)
#define CAPTUREBLT
Definition: wingdi.h:1376

Referenced by Ghost_OnNCPaint(), and GhostWndProc_common().

◆ Ghost_OnMove()

static void Ghost_OnMove ( HWND  hwnd,
int  x,
int  y 
)
static

Definition at line 362 of file ghost.c.

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}
static HWND Ghost_GetTarget(HWND hwnd)
Definition: ghost.c:115
#define SWP_NOSIZE
Definition: winuser.h:1245
#define SWP_NOSENDCHANGING
Definition: winuser.h:1251

Referenced by GhostWndProc_common().

◆ Ghost_OnNCDestroy()

static void Ghost_OnNCDestroy ( HWND  hwnd)
static

Definition at line 402 of file ghost.c.

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
432}
#define FNID_DESTROY
Definition: ntuser.h:898
static void Ghost_DestroyTarget(GHOST_DATA *pData)
Definition: ghost.c:382
HANDLE WINAPI RemovePropW(_In_ HWND, _In_ LPCWSTR)
__analysis_noreturn void WINAPI PostQuitMessage(_In_ int)
#define SW_SHOWNOACTIVATE
Definition: winuser.h:774

Referenced by GhostWndProc_common().

◆ Ghost_OnNCPaint()

static void Ghost_OnNCPaint ( HWND  hwnd,
HRGN  hrgn,
BOOL  bUnicode 
)
static

Definition at line 330 of file ghost.c.

331{
332 HDC hdc;
333
334 // do the default behaviour
335 if (bUnicode)
337 else
339
340 // draw the ghost image
342 if (hdc)
343 {
346 }
347}
static HRGN hrgn
static void Ghost_OnDraw(HWND hwnd, HDC hdc)
Definition: ghost.c:309
UINT_PTR WPARAM
Definition: windef.h:207
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
HDC WINAPI GetWindowDC(_In_opt_ HWND)
LRESULT WINAPI DefWindowProcW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
LRESULT WINAPI DefWindowProcA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define WM_NCPAINT
Definition: winuser.h:1687

Referenced by GhostWndProc_common().

◆ Ghost_OnPaint()

static void Ghost_OnPaint ( HWND  hwnd)
static

Definition at line 350 of file ghost.c.

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}
BOOL WINAPI EndPaint(_In_ HWND, _In_ const PAINTSTRUCT *)
HDC WINAPI BeginPaint(_In_ HWND, _Out_ LPPAINTSTRUCT)

Referenced by GhostWndProc_common().

◆ Ghost_OnTimer()

static void Ghost_OnTimer ( HWND  hwnd,
UINT  id 
)
static

Definition at line 463 of file ghost.c.

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}
BOOL WINAPI IsWindow(_In_opt_ HWND)

Referenced by GhostWndProc_common().

◆ Ghost_Unenchant()

static void Ghost_Unenchant ( HWND  hwnd,
BOOL  bDestroyTarget 
)
static

Definition at line 298 of file ghost.c.

299{
301 if (!pData)
302 return;
303
304 pData->bDestroyTarget |= bDestroyTarget;
306}

Referenced by Ghost_OnClose(), Ghost_OnTimer(), and GhostWndProc_common().

◆ GhostWndProc_common()

LRESULT WINAPI GhostWndProc_common ( HWND  hwnd,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam,
BOOL  unicode 
)

Definition at line 515 of file ghost.c.

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)
571 else
574 return 0;
575
576 case WM_GETICON:
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}
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
unsigned int UINT
Definition: ndis.h:50
#define LOWORD(l)
Definition: pedump.c:82
short SHORT
Definition: pedump.c:59
#define HIWORD(l)
Definition: typedefs.h:247
static void Ghost_OnNCDestroy(HWND hwnd)
Definition: ghost.c:402
static void Ghost_OnNCPaint(HWND hwnd, HRGN hrgn, BOOL bUnicode)
Definition: ghost.c:330
static void Ghost_OnMove(HWND hwnd, int x, int y)
Definition: ghost.c:362
static BOOL Ghost_OnCreate(HWND hwnd, CREATESTRUCTW *lpcs)
Definition: ghost.c:158
static void Ghost_OnTimer(HWND hwnd, UINT id)
Definition: ghost.c:463
static void Ghost_OnPaint(HWND hwnd)
Definition: ghost.c:350
static void Ghost_OnDestroy(HWND hwnd)
Definition: ghost.c:376
static HICON Ghost_GetIcon(HWND hwnd, INT fType)
Definition: ghost.c:487
static void Ghost_OnClose(HWND hwnd)
Definition: ghost.c:435
LONG_PTR LRESULT
Definition: windef.h:209
#define WM_PAINT
Definition: winuser.h:1620
#define WM_ERASEBKGND
Definition: winuser.h:1625
#define WM_CLOSE
Definition: winuser.h:1621
#define WM_SYSCOMMAND
Definition: winuser.h:1741
#define WM_CREATE
Definition: winuser.h:1608
#define WM_SIZE
Definition: winuser.h:1611
#define WM_COMMAND
Definition: winuser.h:1740
HCURSOR WINAPI SetCursor(_In_opt_ HCURSOR)
#define SC_SIZE
Definition: winuser.h:2584
#define WM_NCMOUSEMOVE
Definition: winuser.h:1691
#define WM_TIMER
Definition: winuser.h:1742
#define LoadCursor
Definition: winuser.h:5812
#define WM_MOVE
Definition: winuser.h:1610
#define WM_SIZING
Definition: winuser.h:1807
#define WM_NCDESTROY
Definition: winuser.h:1684
#define IDC_WAIT
Definition: winuser.h:689
#define WM_DESTROY
Definition: winuser.h:1609
#define SC_MAXIMIZE
Definition: winuser.h:2588

Referenced by GhostWndProcA(), GhostWndProcW(), and RegisterClientPFN().

◆ GhostWndProcA()

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

Definition at line 604 of file ghost.c.

605{
606 return GhostWndProc_common(hwnd, uMsg, wParam, lParam, FALSE);
607}
LRESULT WINAPI GhostWndProc_common(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL unicode)
Definition: ghost.c:515

Referenced by RegisterClientPFN().

◆ GhostWndProcW()

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

Definition at line 610 of file ghost.c.

611{
612 return GhostWndProc_common(hwnd, uMsg, wParam, lParam, TRUE);
613}

Referenced by RegisterClientPFN().

◆ IntCreate32BppBitmap()

static HBITMAP IntCreate32BppBitmap ( INT  cx,
INT  cy 
)
static

Definition at line 29 of file ghost.c.

30{
32 BITMAPINFO bi;
33 HDC hdc;
34 LPVOID pvBits;
35
36 ZeroMemory(&bi, sizeof(bi));
38 bi.bmiHeader.biWidth = cx;
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);
48 }
49 return hbm;
50}
_In_ HBITMAP hbm
Definition: ntgdi.h:2776
_Out_opt_ int _Out_opt_ int * cy
Definition: commctrl.h:586
_Out_opt_ int * cx
Definition: commctrl.h:585
USHORT biBitCount
Definition: precomp.h:46
BITMAPINFOHEADER bmiHeader
Definition: wingdi.h:1476
HBITMAP WINAPI CreateDIBSection(HDC hDC, CONST BITMAPINFO *BitmapInfo, UINT Usage, VOID **Bits, HANDLE hSection, DWORD dwOffset)
Definition: bitmap.c:245
#define ZeroMemory
Definition: winbase.h:1712
#define DIB_RGB_COLORS
Definition: wingdi.h:367

Referenced by IntGetWindowBitmap().

◆ IntGetWindowBitmap()

static HBITMAP IntGetWindowBitmap ( HWND  hwnd,
INT  cx,
INT  cy 
)
static

Definition at line 53 of file ghost.c.

54{
56 HDC hdc, hdcMem;
57 HGDIOBJ hbmOld;
58
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
77earth:
79
80 return hbm;
81}
static HBITMAP IntCreate32BppBitmap(INT cx, INT cy)
Definition: ghost.c:29

Referenced by Ghost_OnCreate().

◆ IntMakeGhostImage()

static VOID IntMakeGhostImage ( HBITMAP  hbm)
static

Definition at line 84 of file ghost.c.

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}
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

Referenced by Ghost_OnCreate().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( ghost  )

Variable Documentation

◆ GHOST_builtin_class

const struct builtin_class_descr GHOST_builtin_class
Initial value:
=
{
L"Ghost",
0,
0,
}
#define L(x)
Definition: ntvdm.h:50
LRESULT CALLBACK GhostWndProcA(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: ghost.c:604
LRESULT CALLBACK GhostWndProcW(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: ghost.c:610

Definition at line 17 of file ghost.c.