ReactOS  0.4.13-dev-92-gf251225
desktop.c File Reference
#include <user32.h>
Include dependency graph for desktop.c:

Go to the source code of this file.

Macros

#define COPYS(f, len)   MultiByteToWideChar ( CP_THREAD_ACP, 0, pA->f, len, pW->f, len )
 
#define COPYN(f)   pW->f = pA->f
 
#define COPYS(f, len)   WideCharToMultiByte ( CP_THREAD_ACP, 0, pW->f, len, pA->f, len, NULL, NULL )
 
#define COPYN(f)   pA->f = pW->f
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (user32)
 
LRESULT WINAPI DesktopWndProcW (HWND Wnd, UINT Msg, WPARAM wParam, LPARAM lParam)
 
VOID WINAPI LogFontA2W (LPLOGFONTW pW, CONST LOGFONTA *pA)
 
VOID WINAPI LogFontW2A (LPLOGFONTA pA, CONST LOGFONTW *pW)
 
int WINAPI RealGetSystemMetrics (int nIndex)
 
int WINAPI GetSystemMetrics (int nIndex)
 
BOOL WINAPI SetDeskWallpaper (LPCSTR filename)
 
BOOL WINAPI RealSystemParametersInfoA (UINT uiAction, UINT uiParam, PVOID pvParam, UINT fWinIni)
 
BOOL WINAPI RealSystemParametersInfoW (UINT uiAction, UINT uiParam, PVOID pvParam, UINT fWinIni)
 
BOOL WINAPI SystemParametersInfoA (UINT uiAction, UINT uiParam, PVOID pvParam, UINT fWinIni)
 
BOOL WINAPI SystemParametersInfoW (UINT uiAction, UINT uiParam, PVOID pvParam, UINT fWinIni)
 
HDESK WINAPI CreateDesktopA (LPCSTR lpszDesktop, LPCSTR lpszDevice, LPDEVMODEA pDevmode, DWORD dwFlags, ACCESS_MASK dwDesiredAccess, LPSECURITY_ATTRIBUTES lpsa)
 
HDESK WINAPI CreateDesktopW (LPCWSTR lpszDesktop, LPCWSTR lpszDevice, LPDEVMODEW pDevmode, DWORD dwFlags, ACCESS_MASK dwDesiredAccess, LPSECURITY_ATTRIBUTES lpsa)
 
BOOL WINAPI EnumDesktopsA (HWINSTA WindowStation, DESKTOPENUMPROCA EnumFunc, LPARAM Context)
 
BOOL WINAPI EnumDesktopsW (HWINSTA WindowStation, DESKTOPENUMPROCW EnumFunc, LPARAM Context)
 
HDESK WINAPI GetThreadDesktop (DWORD dwThreadId)
 
HDESK WINAPI OpenDesktopA (LPCSTR lpszDesktop, DWORD dwFlags, BOOL fInherit, ACCESS_MASK dwDesiredAccess)
 
HDESK WINAPI OpenDesktopW (LPCWSTR lpszDesktop, DWORD dwFlags, BOOL fInherit, ACCESS_MASK dwDesiredAccess)
 
BOOL WINAPI SetShellWindow (HWND hwndShell)
 
HWND WINAPI GetShellWindow (VOID)
 

Macro Definition Documentation

◆ COPYN [1/2]

#define COPYN (   f)    pW->f = pA->f

◆ COPYN [2/2]

#define COPYN (   f)    pA->f = pW->f

◆ COPYS [1/2]

#define COPYS (   f,
  len 
)    MultiByteToWideChar ( CP_THREAD_ACP, 0, pA->f, len, pW->f, len )

◆ COPYS [2/2]

#define COPYS (   f,
  len 
)    WideCharToMultiByte ( CP_THREAD_ACP, 0, pW->f, len, pA->f, len, NULL, NULL )

Function Documentation

◆ CreateDesktopA()

HDESK WINAPI CreateDesktopA ( LPCSTR  lpszDesktop,
LPCSTR  lpszDevice,
LPDEVMODEA  pDevmode,
DWORD  dwFlags,
ACCESS_MASK  dwDesiredAccess,
LPSECURITY_ATTRIBUTES  lpsa 
)

Definition at line 431 of file desktop.c.

437 {
438  UNICODE_STRING DesktopNameU;
439  HDESK hDesktop;
440  LPDEVMODEW DevmodeW = NULL;
441 
442  if (lpszDesktop)
443  {
444  /* After conversion, the buffer is zero-terminated */
445  RtlCreateUnicodeStringFromAsciiz(&DesktopNameU, lpszDesktop);
446  }
447  else
448  {
449  RtlInitUnicodeString(&DesktopNameU, NULL);
450  }
451 
452  if (pDevmode)
453  DevmodeW = GdiConvertToDevmodeW(pDevmode);
454 
455  hDesktop = CreateDesktopW(DesktopNameU.Buffer,
456  NULL,
457  DevmodeW,
458  dwFlags,
459  dwDesiredAccess,
460  lpsa);
461 
462  /* Free the string, if it was allocated */
463  if (lpszDesktop) RtlFreeUnicodeString(&DesktopNameU);
464 
465  return hDesktop;
466 }
DEVMODEW *WINAPI GdiConvertToDevmodeW(const DEVMODEA *)
Definition: misc.c:968
smooth NULL
Definition: ftsmooth.c:416
NTSYSAPI BOOLEAN NTAPI RtlCreateUnicodeStringFromAsciiz(_Out_ PUNICODE_STRING Destination, _In_ PCSZ Source)
NTSYSAPI VOID NTAPI RtlFreeUnicodeString(PUNICODE_STRING UnicodeString)
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
HDESK WINAPI CreateDesktopW(LPCWSTR lpszDesktop, LPCWSTR lpszDevice, LPDEVMODEW pDevmode, DWORD dwFlags, ACCESS_MASK dwDesiredAccess, LPSECURITY_ATTRIBUTES lpsa)
Definition: desktop.c:473

Referenced by test_foregroundwindow(), test_getuserobjectinformation(), test_handles(), test_inputdesktop(), test_inputdesktop2(), and thread().

◆ CreateDesktopW()

HDESK WINAPI CreateDesktopW ( LPCWSTR  lpszDesktop,
LPCWSTR  lpszDevice,
LPDEVMODEW  pDevmode,
DWORD  dwFlags,
ACCESS_MASK  dwDesiredAccess,
LPSECURITY_ATTRIBUTES  lpsa 
)

Definition at line 473 of file desktop.c.

479 {
480  OBJECT_ATTRIBUTES oas;
481  UNICODE_STRING DesktopName, DesktopDevice;
482  HWINSTA hWinSta;
483  HDESK hDesktop;
485 
486  /* Retrive WinStation handle. */
487  hWinSta = NtUserGetProcessWindowStation();
488 
489  /* Initialize the strings. */
490  RtlInitUnicodeString(&DesktopName, lpszDesktop);
491  RtlInitUnicodeString(&DesktopDevice, lpszDevice);
492 
493  /* Check for process is inherited, set flag if set. */
494  if (lpsa && lpsa->bInheritHandle) Attributes |= OBJ_INHERIT;
495 
496  /* Initialize the attributes for the desktop. */
498  &DesktopName,
499  Attributes,
500  hWinSta,
501  lpsa ? lpsa->lpSecurityDescriptor : NULL);
502 
503  /* Send the request and call to win32k. */
504  hDesktop = NtUserCreateDesktop( &oas,
505  &DesktopDevice,
506  pDevmode,
507  dwFlags,
508  dwDesiredAccess);
509 
510  return(hDesktop);
511 }
#define OBJ_OPENIF
Definition: winternl.h:229
smooth NULL
Definition: ftsmooth.c:416
#define OBJ_INHERIT
Definition: winternl.h:225
#define OBJ_CASE_INSENSITIVE
Definition: winternl.h:228
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
HDESK APIENTRY NtUserCreateDesktop(POBJECT_ATTRIBUTES ObjectAttributes, PUNICODE_STRING lpszDesktopDevice, LPDEVMODEW lpdmw, DWORD dwFlags, ACCESS_MASK dwDesiredAccess)
Definition: desktop.c:2483
_Must_inspect_result_ _In_ USHORT _In_ PHIDP_PREPARSED_DATA _Out_writes_to_ LengthAttributes PHIDP_EXTENDED_ATTRIBUTES Attributes
Definition: hidpi.h:348
LPVOID lpSecurityDescriptor
Definition: compat.h:181
HWINSTA NTAPI NtUserGetProcessWindowStation(VOID)
Definition: winsta.c:1340
unsigned int ULONG
Definition: retypes.h:1
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define InitializeObjectAttributes(p, n, a, r, s)
Definition: reg.c:106

Referenced by create_desk(), CreateDesktopA(), CreateInheritableDesktop(), CreateWindowStationAndDesktops(), Test_DesktopAccess(), TestGetUserObjectInfoW(), and thread_proc().

◆ DesktopWndProcW()

LRESULT WINAPI DesktopWndProcW ( HWND  Wnd,
UINT  Msg,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 33 of file desktop.c.

37 {
38  TRACE("Desktop W Class Atom! hWnd 0x%x, Msg %d\n", Wnd, Msg);
39 
40  switch(Msg)
41  {
42  case WM_ERASEBKGND:
43  case WM_NCCREATE:
44  case WM_CREATE:
45  case WM_CLOSE:
46  case WM_DISPLAYCHANGE:
47  case WM_PAINT:
48  case WM_SYSCOLORCHANGE:
49  {
50  LRESULT lResult;
52  TRACE("Desktop lResult %d\n", lResult);
53  return lResult;
54  }
55 
56  case WM_PALETTECHANGED:
57  if (Wnd == (HWND)wParam) break;
58  case WM_QUERYNEWPALETTE:
59  {
60  HDC hdc = GetWindowDC( Wnd );
62  ReleaseDC( Wnd, hdc );
63  break;
64  }
65 
66  case WM_SETCURSOR:
68 
69  default:
70  return DefWindowProcW(Wnd, Msg, wParam, lParam);
71  }
72  return 0;
73 }
#define WM_SYSCOLORCHANGE
Definition: winuser.h:1608
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
static HDC
Definition: imagelist.c:92
struct @1567 Msg[]
#define WM_NCCREATE
Definition: winuser.h:1665
WPARAM wParam
Definition: combotst.c:138
LRESULT WINAPI DefWindowProcW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
uint32_t ULONG_PTR
Definition: typedefs.h:63
#define FNID_DESKTOP
Definition: ntuser.h:824
#define WM_SETCURSOR
Definition: winuser.h:1618
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
#define WM_QUERYNEWPALETTE
Definition: winuser.h:1839
#define TRACE(s)
Definition: solgame.cpp:4
#define WM_CLOSE
Definition: winuser.h:1603
#define WM_PALETTECHANGED
Definition: winuser.h:1838
HCURSOR WINAPI LoadCursorW(_In_opt_ HINSTANCE, _In_ LPCWSTR)
Definition: cursoricon.c:2074
#define WM_PAINT
Definition: winuser.h:1602
HDC hdc
Definition: main.c:9
BOOL NTAPI NtUserMessageCall(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam, ULONG_PTR ResultInfo, DWORD dwType, BOOL Ansi)
Definition: message.c:2323
HCURSOR WINAPI SetCursor(_In_opt_ HCURSOR)
HDC WINAPI GetWindowDC(_In_opt_ HWND)
#define IDC_ARROW
Definition: winuser.h:682
#define WM_CREATE
Definition: winuser.h:1590
BOOL WINAPI PaintDesktop(_In_ HDC)
#define WM_ERASEBKGND
Definition: winuser.h:1607
LONG_PTR LRESULT
Definition: windef.h:209
LPARAM lParam
Definition: combotst.c:139

Referenced by DesktopWndProcA(), and RegisterClientPFN().

◆ EnumDesktopsA()

BOOL WINAPI EnumDesktopsA ( HWINSTA  WindowStation,
DESKTOPENUMPROCA  EnumFunc,
LPARAM  Context 
)

Definition at line 519 of file desktop.c.

523 {
524  return EnumNamesA(WindowStation, EnumFunc, Context, TRUE);
525 }
#define TRUE
Definition: types.h:120
static BOOL CALLBACK EnumFunc(_In_ HWND hWnd, _In_ PCWSTR lpszString, _In_ HANDLE hData)
Definition: SetProp.c:15
BOOL FASTCALL EnumNamesA(HWINSTA WindowStation, NAMEENUMPROCA EnumFunc, LPARAM Context, BOOL Desktops)
Definition: winsta.c:273

◆ EnumDesktopsW()

BOOL WINAPI EnumDesktopsW ( HWINSTA  WindowStation,
DESKTOPENUMPROCW  EnumFunc,
LPARAM  Context 
)

Definition at line 533 of file desktop.c.

537 {
538  return EnumNamesW(WindowStation, EnumFunc, Context, TRUE);
539 }
#define TRUE
Definition: types.h:120
BOOL FASTCALL EnumNamesW(HWINSTA WindowStation, NAMEENUMPROCW EnumFunc, LPARAM Context, BOOL Desktops)
Definition: winsta.c:130
static BOOL CALLBACK EnumFunc(_In_ HWND hWnd, _In_ PCWSTR lpszString, _In_ HANDLE hData)
Definition: SetProp.c:15

◆ GetShellWindow()

HWND WINAPI GetShellWindow ( VOID  )

Definition at line 651 of file desktop.c.

652 {
655  if (pdi) return pdi->hShellWindow;
656  return NULL;
657 }
smooth NULL
Definition: ftsmooth.c:416
static __inline PDESKTOPINFO GetThreadDesktopInfo(VOID)
Definition: user_x.h:43
_In_ LPWSTR _In_ ULONG _In_ ULONG _In_ ULONG _Out_ DEVINFO * pdi
Definition: winddi.h:3553

Referenced by _tWinMain(), DoStartStartupItems(), FindShellProxy(), IsAnyDesktopRunning(), test_shell_window(), and test_token_security_descriptor().

◆ GetSystemMetrics()

int WINAPI GetSystemMetrics ( int  nIndex)

Definition at line 139 of file desktop.c.

140 {
141  BOOL Hook;
142  int Ret = 0;
143 
144  if (!gpsi) // Fixme! Hax! Need Timos delay load support?
145  {
146  return RealGetSystemMetrics(nIndex);
147  }
148 
149  LoadUserApiHook();
150 
151  Hook = BeginIfHookedUserApiHook();
152 
153  /* Bypass SEH and go direct. */
154  if (!Hook) return RealGetSystemMetrics(nIndex);
155 
156  _SEH2_TRY
157  {
158  Ret = guah.GetSystemMetrics(nIndex);
159  }
161  {
162  ERR("Got exception in hooked GetSystemMetrics!\n");
163  }
164  _SEH2_END;
165 
166  EndUserApiHook();
167 
168  return Ret;
169 }
BOOL FASTCALL EndUserApiHook(VOID)
Definition: usrapihk.c:164
USERAPIHOOK guah
Definition: usrapihk.c:344
PSERVERINFO gpsi
Definition: main.c:27
_SEH2_TRY
Definition: create.c:4250
unsigned int BOOL
Definition: ntddk_ex.h:94
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
GETSYSTEMMETRICS GetSystemMetrics
Definition: undocuser.h:345
#define ERR(fmt,...)
Definition: debug.h:109
_SEH2_END
Definition: create.c:4424
static __inline void LoadUserApiHook()
Definition: user_x.h:85
BOOL FASTCALL BeginIfHookedUserApiHook(VOID)
Definition: usrapihk.c:106
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:6
int WINAPI RealGetSystemMetrics(int nIndex)
Definition: desktop.c:128

◆ GetThreadDesktop()

HDESK WINAPI GetThreadDesktop ( DWORD  dwThreadId)

Definition at line 547 of file desktop.c.

549 {
550  USER_API_MESSAGE ApiMessage;
551  PUSER_GET_THREAD_CONSOLE_DESKTOP GetThreadConsoleDesktopRequest = &ApiMessage.Data.GetThreadConsoleDesktopRequest;
552 
553  GetThreadConsoleDesktopRequest->ThreadId = dwThreadId;
554 
556  NULL,
558  sizeof(*GetThreadConsoleDesktopRequest));
559  if (!NT_SUCCESS(ApiMessage.Status))
560  {
561  UserSetLastNTError(ApiMessage.Status);
562  return NULL;
563  }
564 
566  (DWORD_PTR)GetThreadConsoleDesktopRequest->ConsoleDesktop);
567 }
#define USERSRV_SERVERDLL_INDEX
Definition: winmsg.h:15
NTSTATUS NTAPI CsrClientCallServer(IN OUT PCSR_API_MESSAGE ApiMessage, IN OUT PCSR_CAPTURE_BUFFER CaptureBuffer OPTIONAL, IN CSR_API_NUMBER ApiNumber, IN ULONG DataLength)
Definition: connect.c:360
HDESK APIENTRY NtUserGetThreadDesktop(DWORD dwThreadId, DWORD Unknown1)
Definition: desktop.c:2984
USER_GET_THREAD_CONSOLE_DESKTOP GetThreadConsoleDesktopRequest
Definition: winmsg.h:103
NTSTATUS Status
Definition: csrmsg.h:112
smooth NULL
Definition: ftsmooth.c:416
#define CSR_CREATE_API_NUMBER(ServerId, ApiId)
Definition: csrmsg.h:37
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
union _USER_API_MESSAGE::@3382 Data
DWORD dwThreadId
Definition: fdebug.c:31
uint32_t DWORD_PTR
Definition: typedefs.h:63
VOID WINAPI UserSetLastNTError(IN NTSTATUS Status)
Definition: misc.c:25

Referenced by do_InitialDesktop_child(), Test_OpenInputDesktop(), and Test_References().

◆ LogFontA2W()

VOID WINAPI LogFontA2W ( LPLOGFONTW  pW,
CONST LOGFONTA pA 
)

Definition at line 77 of file desktop.c.

78 {
79 #define COPYS(f,len) MultiByteToWideChar ( CP_THREAD_ACP, 0, pA->f, len, pW->f, len )
80 #define COPYN(f) pW->f = pA->f
81 
82  COPYN(lfHeight);
83  COPYN(lfWidth);
84  COPYN(lfEscapement);
85  COPYN(lfOrientation);
86  COPYN(lfWeight);
87  COPYN(lfItalic);
88  COPYN(lfUnderline);
89  COPYN(lfStrikeOut);
90  COPYN(lfCharSet);
91  COPYN(lfOutPrecision);
92  COPYN(lfClipPrecision);
93  COPYN(lfQuality);
94  COPYN(lfPitchAndFamily);
95  COPYS(lfFaceName,LF_FACESIZE);
96 
97 #undef COPYN
98 #undef COPYS
99 }
#define LF_FACESIZE
Definition: dimm.idl:39
#define COPYN(f)
#define COPYS(f, len)

Referenced by CreateFontIndirectA(), EnumFontFamiliesExA(), and RealSystemParametersInfoA().

◆ LogFontW2A()

VOID WINAPI LogFontW2A ( LPLOGFONTA  pA,
CONST LOGFONTW pW 
)

Definition at line 103 of file desktop.c.

104 {
105 #define COPYS(f,len) WideCharToMultiByte ( CP_THREAD_ACP, 0, pW->f, len, pA->f, len, NULL, NULL )
106 #define COPYN(f) pA->f = pW->f
107 
108  COPYN(lfHeight);
109  COPYN(lfWidth);
110  COPYN(lfEscapement);
111  COPYN(lfOrientation);
112  COPYN(lfWeight);
113  COPYN(lfItalic);
114  COPYN(lfUnderline);
115  COPYN(lfStrikeOut);
116  COPYN(lfCharSet);
117  COPYN(lfOutPrecision);
118  COPYN(lfClipPrecision);
119  COPYN(lfQuality);
120  COPYN(lfPitchAndFamily);
121  COPYS(lfFaceName,LF_FACESIZE);
122 
123 #undef COPYN
124 #undef COPYS
125 }
#define LF_FACESIZE
Definition: dimm.idl:39
#define COPYN(f)
#define COPYS(f, len)

Referenced by IntEnumFontFamilies(), and RealSystemParametersInfoA().

◆ OpenDesktopA()

HDESK WINAPI OpenDesktopA ( LPCSTR  lpszDesktop,
DWORD  dwFlags,
BOOL  fInherit,
ACCESS_MASK  dwDesiredAccess 
)

Definition at line 575 of file desktop.c.

580 {
581  UNICODE_STRING DesktopNameU;
582  HDESK hDesktop;
583 
584  if (lpszDesktop)
585  {
586  /* After conversion, the buffer is zero-terminated */
587  RtlCreateUnicodeStringFromAsciiz(&DesktopNameU, lpszDesktop);
588  }
589  else
590  {
591  RtlInitUnicodeString(&DesktopNameU, NULL);
592  }
593 
594  hDesktop = OpenDesktopW(DesktopNameU.Buffer,
595  dwFlags,
596  fInherit,
597  dwDesiredAccess);
598 
599  /* Free the string, if it was allocated */
600  if (lpszDesktop) RtlFreeUnicodeString(&DesktopNameU);
601 
602  return hDesktop;
603 }
smooth NULL
Definition: ftsmooth.c:416
NTSYSAPI BOOLEAN NTAPI RtlCreateUnicodeStringFromAsciiz(_Out_ PUNICODE_STRING Destination, _In_ PCSZ Source)
HDESK WINAPI OpenDesktopW(LPCWSTR lpszDesktop, DWORD dwFlags, BOOL fInherit, ACCESS_MASK dwDesiredAccess)
Definition: desktop.c:611
NTSYSAPI VOID NTAPI RtlFreeUnicodeString(PUNICODE_STRING UnicodeString)
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)

◆ OpenDesktopW()

HDESK WINAPI OpenDesktopW ( LPCWSTR  lpszDesktop,
DWORD  dwFlags,
BOOL  fInherit,
ACCESS_MASK  dwDesiredAccess 
)

Definition at line 611 of file desktop.c.

616 {
617  UNICODE_STRING DesktopName;
619 
620  RtlInitUnicodeString(&DesktopName, lpszDesktop);
621 
623  &DesktopName,
626  0);
627 
628  if( fInherit )
629  {
630  ObjectAttributes.Attributes |= OBJ_INHERIT;
631  }
632 
633  return NtUserOpenDesktop(&ObjectAttributes, dwFlags, dwDesiredAccess);
634 }
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
Definition: conport.c:35
HDESK APIENTRY NtUserOpenDesktop(POBJECT_ATTRIBUTES ObjectAttributes, DWORD dwFlags, ACCESS_MASK dwDesiredAccess)
Definition: desktop.c:2543
#define OBJ_INHERIT
Definition: winternl.h:225
#define OBJ_CASE_INSENSITIVE
Definition: winternl.h:228
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
HWINSTA WINAPI GetProcessWindowStation(void)
Definition: ntwrapper.h:124
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define InitializeObjectAttributes(p, n, a, r, s)
Definition: reg.c:106

Referenced by open_desk(), and OpenDesktopA().

◆ RealGetSystemMetrics()

int WINAPI RealGetSystemMetrics ( int  nIndex)

Definition at line 128 of file desktop.c.

129 {
130  //FIXME("Global Server Data -> %x\n",gpsi);
131  if (nIndex < 0 || nIndex >= SM_CMETRICS) return 0;
132  return gpsi->aiSysMet[nIndex];
133 }
PSERVERINFO gpsi
Definition: main.c:27
#define SM_CMETRICS
Definition: winuser.h:1055

Referenced by GetSystemMetrics(), and ResetUserApiHook().

◆ RealSystemParametersInfoA()

BOOL WINAPI RealSystemParametersInfoA ( UINT  uiAction,
UINT  uiParam,
PVOID  pvParam,
UINT  fWinIni 
)

Definition at line 180 of file desktop.c.

184 {
185  switch (uiAction)
186  {
187 
188  case SPI_GETNONCLIENTMETRICS:
189  {
190  LPNONCLIENTMETRICSA pnclma = (LPNONCLIENTMETRICSA)pvParam;
191  NONCLIENTMETRICSW nclmw;
192  if(pnclma->cbSize != sizeof(NONCLIENTMETRICSA))
193  {
195  return FALSE;
196  }
197  nclmw.cbSize = sizeof(NONCLIENTMETRICSW);
198 
199  if (!SystemParametersInfoW(uiAction, sizeof(NONCLIENTMETRICSW),
200  &nclmw, fWinIni))
201  return FALSE;
202 
203  pnclma->iBorderWidth = nclmw.iBorderWidth;
204  pnclma->iScrollWidth = nclmw.iScrollWidth;
205  pnclma->iScrollHeight = nclmw.iScrollHeight;
206  pnclma->iCaptionWidth = nclmw.iCaptionWidth;
207  pnclma->iCaptionHeight = nclmw.iCaptionHeight;
208  pnclma->iSmCaptionWidth = nclmw.iSmCaptionWidth;
209  pnclma->iSmCaptionHeight = nclmw.iSmCaptionHeight;
210  pnclma->iMenuWidth = nclmw.iMenuWidth;
211  pnclma->iMenuHeight = nclmw.iMenuHeight;
212  LogFontW2A(&(pnclma->lfCaptionFont), &(nclmw.lfCaptionFont));
213  LogFontW2A(&(pnclma->lfSmCaptionFont), &(nclmw.lfSmCaptionFont));
214  LogFontW2A(&(pnclma->lfMenuFont), &(nclmw.lfMenuFont));
215  LogFontW2A(&(pnclma->lfStatusFont), &(nclmw.lfStatusFont));
216  LogFontW2A(&(pnclma->lfMessageFont), &(nclmw.lfMessageFont));
217  return TRUE;
218  }
219  case SPI_SETNONCLIENTMETRICS:
220  {
221  LPNONCLIENTMETRICSA pnclma = (LPNONCLIENTMETRICSA)pvParam;
222  NONCLIENTMETRICSW nclmw;
223  if(pnclma->cbSize != sizeof(NONCLIENTMETRICSA))
224  {
226  return FALSE;
227  }
228  nclmw.cbSize = sizeof(NONCLIENTMETRICSW);
229  nclmw.iBorderWidth = pnclma->iBorderWidth;
230  nclmw.iScrollWidth = pnclma->iScrollWidth;
231  nclmw.iScrollHeight = pnclma->iScrollHeight;
232  nclmw.iCaptionWidth = pnclma->iCaptionWidth;
233  nclmw.iCaptionHeight = pnclma->iCaptionHeight;
234  nclmw.iSmCaptionWidth = pnclma->iSmCaptionWidth;
235  nclmw.iSmCaptionHeight = pnclma->iSmCaptionHeight;
236  nclmw.iMenuWidth = pnclma->iMenuWidth;
237  nclmw.iMenuHeight = pnclma->iMenuHeight;
238  LogFontA2W(&(nclmw.lfCaptionFont), &(pnclma->lfCaptionFont));
239  LogFontA2W(&(nclmw.lfSmCaptionFont), &(pnclma->lfSmCaptionFont));
240  LogFontA2W(&(nclmw.lfMenuFont), &(pnclma->lfMenuFont));
241  LogFontA2W(&(nclmw.lfStatusFont), &(pnclma->lfStatusFont));
242  LogFontA2W(&(nclmw.lfMessageFont), &(pnclma->lfMessageFont));
243 
244  return SystemParametersInfoW(uiAction, sizeof(NONCLIENTMETRICSW),
245  &nclmw, fWinIni);
246  }
247  case SPI_GETICONMETRICS:
248  {
249  LPICONMETRICSA picma = (LPICONMETRICSA)pvParam;
250  ICONMETRICSW icmw;
251  if(picma->cbSize != sizeof(ICONMETRICSA))
252  {
254  return FALSE;
255  }
256  icmw.cbSize = sizeof(ICONMETRICSW);
257  if (!SystemParametersInfoW(uiAction, sizeof(ICONMETRICSW),
258  &icmw, fWinIni))
259  return FALSE;
260 
261  picma->iHorzSpacing = icmw.iHorzSpacing;
262  picma->iVertSpacing = icmw.iVertSpacing;
263  picma->iTitleWrap = icmw.iTitleWrap;
264  LogFontW2A(&(picma->lfFont), &(icmw.lfFont));
265  return TRUE;
266  }
267  case SPI_SETICONMETRICS:
268  {
269  LPICONMETRICSA picma = (LPICONMETRICSA)pvParam;
270  ICONMETRICSW icmw;
271  if(picma->cbSize != sizeof(ICONMETRICSA))
272  {
274  return FALSE;
275  }
276  icmw.cbSize = sizeof(ICONMETRICSW);
277  icmw.iHorzSpacing = picma->iHorzSpacing;
278  icmw.iVertSpacing = picma->iVertSpacing;
279  icmw.iTitleWrap = picma->iTitleWrap;
280  LogFontA2W(&(icmw.lfFont), &(picma->lfFont));
281 
282  return SystemParametersInfoW(uiAction, sizeof(ICONMETRICSW),
283  &icmw, fWinIni);
284  }
286  {
287  LOGFONTW lfw;
288  if (!SystemParametersInfoW(uiAction, 0, &lfw, fWinIni))
289  return FALSE;
290  LogFontW2A(pvParam, &lfw);
291  return TRUE;
292  }
294  {
295  LPLOGFONTA plfa = (LPLOGFONTA)pvParam;
296  LOGFONTW lfw;
297  LogFontA2W(&lfw,plfa);
298  return SystemParametersInfoW(uiAction, 0, &lfw, fWinIni);
299  }
301  {
302  BOOL Ret;
303  WCHAR awc[MAX_PATH];
304  UNICODE_STRING ustrWallpaper;
305  ANSI_STRING astrWallpaper;
306 
308  RtlInitUnicodeString(&ustrWallpaper, awc);
309  RtlInitEmptyAnsiString(&astrWallpaper, pvParam, uiParam);
310  RtlUnicodeStringToAnsiString(&astrWallpaper, &ustrWallpaper, FALSE);
311  return Ret;
312  }
313 
315  {
316  UNICODE_STRING ustrWallpaper;
317  BOOL Ret;
318 
319  if (pvParam)
320  {
321  if (!RtlCreateUnicodeStringFromAsciiz(&ustrWallpaper, pvParam))
322  {
323  ERR("RtlCreateUnicodeStringFromAsciiz failed\n");
324  return FALSE;
325  }
326  pvParam = &ustrWallpaper;
327  }
328 
329  Ret = NtUserSystemParametersInfo(SPI_SETDESKWALLPAPER, uiParam, pvParam, fWinIni);
330 
331  if (pvParam)
332  RtlFreeUnicodeString(&ustrWallpaper);
333 
334  return Ret;
335  }
336  }
337  return NtUserSystemParametersInfo(uiAction, uiParam, pvParam, fWinIni);
338 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
#define TRUE
Definition: types.h:120
#define SPI_SETDESKWALLPAPER
Definition: winuser.h:1351
VOID WINAPI LogFontW2A(LPLOGFONTA pA, CONST LOGFONTW *pW)
Definition: desktop.c:103
unsigned int BOOL
Definition: ntddk_ex.h:94
NTSYSAPI BOOLEAN NTAPI RtlCreateUnicodeStringFromAsciiz(_Out_ PUNICODE_STRING Destination, _In_ PCSZ Source)
NTSYSAPI NTSTATUS NTAPI RtlUnicodeStringToAnsiString(PANSI_STRING DestinationString, PUNICODE_STRING SourceString, BOOLEAN AllocateDestinationString)
VOID WINAPI LogFontA2W(LPLOGFONTW pW, CONST LOGFONTA *pA)
Definition: desktop.c:77
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:26
NTSYSAPI VOID NTAPI RtlFreeUnicodeString(PUNICODE_STRING UnicodeString)
#define SetLastError(x)
Definition: compat.h:409
BOOL WINAPI SystemParametersInfoW(UINT uiAction, UINT uiParam, PVOID pvParam, UINT fWinIni)
Definition: desktop.c:398
#define ERR(fmt,...)
Definition: debug.h:109
#define SPI_SETICONTITLELOGFONT
Definition: winuser.h:1365
BOOL NTAPI NtUserSystemParametersInfo(UINT uiAction, UINT uiParam, PVOID pvParam, UINT fWinIni)
Definition: sysparams.c:2129
#define SPI_GETICONTITLELOGFONT
Definition: winuser.h:1362
struct tagLOGFONTA * LPLOGFONTA
#define SPI_GETDESKWALLPAPER
Definition: sysparams.c:40
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)

Referenced by ResetUserApiHook(), and SystemParametersInfoA().

◆ RealSystemParametersInfoW()

BOOL WINAPI RealSystemParametersInfoW ( UINT  uiAction,
UINT  uiParam,
PVOID  pvParam,
UINT  fWinIni 
)

Definition at line 341 of file desktop.c.

345 {
346  switch(uiAction)
347  {
348 
350  {
351  UNICODE_STRING ustrWallpaper;
352 
353  RtlInitUnicodeString(&ustrWallpaper, pvParam);
354  return NtUserSystemParametersInfo(SPI_SETDESKWALLPAPER, uiParam, &ustrWallpaper, fWinIni);
355  }
356  }
357  return NtUserSystemParametersInfo(uiAction, uiParam, pvParam, fWinIni);
358 }
#define SPI_SETDESKWALLPAPER
Definition: winuser.h:1351
BOOL NTAPI NtUserSystemParametersInfo(UINT uiAction, UINT uiParam, PVOID pvParam, UINT fWinIni)
Definition: sysparams.c:2129
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)

Referenced by ResetUserApiHook(), and SystemParametersInfoW().

◆ SetDeskWallpaper()

BOOL WINAPI SetDeskWallpaper ( LPCSTR  filename)

Definition at line 174 of file desktop.c.

175 {
177 }
#define TRUE
Definition: types.h:120
#define SPI_SETDESKWALLPAPER
Definition: winuser.h:1351
const char * filename
Definition: ioapi.h:135
BOOL WINAPI SystemParametersInfoA(UINT uiAction, UINT uiParam, PVOID pvParam, UINT fWinIni)
Definition: desktop.c:365

◆ SetShellWindow()

BOOL WINAPI SetShellWindow ( HWND  hwndShell)

Definition at line 641 of file desktop.c.

642 {
643  return SetShellWindowEx(hwndShell, hwndShell);
644 }
BOOL WINAPI SetShellWindowEx(HWND, HWND)
Definition: ntwrapper.h:58

Referenced by DesktopWindow::Init(), IsAnyDesktopRunning(), test_shell_window(), and DesktopWindow::WndProc().

◆ SystemParametersInfoA()

BOOL WINAPI SystemParametersInfoA ( UINT  uiAction,
UINT  uiParam,
PVOID  pvParam,
UINT  fWinIni 
)

Definition at line 365 of file desktop.c.

369 {
370  BOOL Hook, Ret = FALSE;
371 
372  LoadUserApiHook();
373 
374  Hook = BeginIfHookedUserApiHook();
375 
376  /* Bypass SEH and go direct. */
377  if (!Hook) return RealSystemParametersInfoA(uiAction, uiParam, pvParam, fWinIni);
378 
379  _SEH2_TRY
380  {
381  Ret = guah.SystemParametersInfoA(uiAction, uiParam, pvParam, fWinIni);
382  }
384  {
385  ERR("Got exception in hooked SystemParametersInfoA!\n");
386  }
387  _SEH2_END;
388 
389  EndUserApiHook();
390 
391  return Ret;
392 }
BOOL FASTCALL EndUserApiHook(VOID)
Definition: usrapihk.c:164
USERAPIHOOK guah
Definition: usrapihk.c:344
_SEH2_TRY
Definition: create.c:4250
unsigned int BOOL
Definition: ntddk_ex.h:94
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
BOOL WINAPI RealSystemParametersInfoA(UINT uiAction, UINT uiParam, PVOID pvParam, UINT fWinIni)
Definition: desktop.c:180
#define ERR(fmt,...)
Definition: debug.h:109
_SEH2_END
Definition: create.c:4424
SYSTEMPARAMETERSINFOA SystemParametersInfoA
Definition: undocuser.h:346
static __inline void LoadUserApiHook()
Definition: user_x.h:85
BOOL FASTCALL BeginIfHookedUserApiHook(VOID)
Definition: usrapihk.c:106
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:6

Referenced by SetDeskWallpaper().

◆ SystemParametersInfoW()

BOOL WINAPI SystemParametersInfoW ( UINT  uiAction,
UINT  uiParam,
PVOID  pvParam,
UINT  fWinIni 
)

Definition at line 398 of file desktop.c.

402 {
403  BOOL Hook, Ret = FALSE;
404 
405  LoadUserApiHook();
406 
407  Hook = BeginIfHookedUserApiHook();
408 
409  /* Bypass SEH and go direct. */
410  if (!Hook) return RealSystemParametersInfoW(uiAction, uiParam, pvParam, fWinIni);
411 
412  _SEH2_TRY
413  {
414  Ret = guah.SystemParametersInfoW(uiAction, uiParam, pvParam, fWinIni);
415  }
417  {
418  ERR("Got exception in hooked SystemParametersInfoW!\n");
419  }
420  _SEH2_END;
421 
422  EndUserApiHook();
423 
424  return Ret;
425 }
BOOL FASTCALL EndUserApiHook(VOID)
Definition: usrapihk.c:164
USERAPIHOOK guah
Definition: usrapihk.c:344
_SEH2_TRY
Definition: create.c:4250
BOOL WINAPI RealSystemParametersInfoW(UINT uiAction, UINT uiParam, PVOID pvParam, UINT fWinIni)
Definition: desktop.c:341
unsigned int BOOL
Definition: ntddk_ex.h:94
SYSTEMPARAMETERSINFOW SystemParametersInfoW
Definition: undocuser.h:347
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
#define ERR(fmt,...)
Definition: debug.h:109
_SEH2_END
Definition: create.c:4424
static __inline void LoadUserApiHook()
Definition: user_x.h:85
BOOL FASTCALL BeginIfHookedUserApiHook(VOID)
Definition: usrapihk.c:106
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:6

Referenced by RealSystemParametersInfoA().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( user32  )