ReactOS  0.4.12-dev-916-gffc4e30
class.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  _WNDPROC_INFO
 

Macros

#define IS_ATOM(x)   (((ULONG_PTR)(x) > 0x0) && ((ULONG_PTR)(x) < 0x10000))
 

Typedefs

typedef struct _WNDPROC_INFO WNDPROC_INFO
 
typedef struct _WNDPROC_INFOPWNDPROC_INFO
 

Functions

static __inline BOOL IsCallProcHandle (IN WNDPROC lpWndProc)
 
BOOLEAN DestroyCallProc (_Inout_ PVOID Object)
 
PCALLPROCDATA CreateCallProc (IN PDESKTOP Desktop, IN WNDPROC WndProc, IN BOOL Unicode, IN PPROCESSINFO pi)
 
BOOL UserGetCallProcInfo (IN HANDLE hCallProc, OUT PWNDPROC_INFO wpInfo)
 
void FASTCALL DestroyProcessClasses (PPROCESSINFO Process)
 
VOID IntDereferenceClass (IN OUT PCLS Class, IN PDESKTOPINFO Desktop, IN PPROCESSINFO pi)
 
PCLS IntGetAndReferenceClass (PUNICODE_STRING ClassName, HINSTANCE hInstance, BOOL bDesktopThread)
 
BOOL FASTCALL UserRegisterSystemClasses (VOID)
 
VOID UserAddCallProcToClass (IN OUT PCLS Class, IN PCALLPROCDATA CallProc)
 
 _Success_ (return) BOOL NTAPI IntGetAtomFromStringOrAtom(_In_ PUNICODE_STRING ClassName
 
BOOL IntCheckProcessDesktopClasses (IN PDESKTOP Desktop, IN BOOL FreeOnFailure)
 
ULONG_PTR FASTCALL UserGetCPD (PVOID, GETCPD, ULONG_PTR)
 
_Must_inspect_result_ NTSTATUS NTAPI ProbeAndCaptureUnicodeStringOrAtom (_Out_ _When_(return >=0, _At_(pustrOut->Buffer, _Post_ _Notnull_)) PUNICODE_STRING pustrOut, __in_data_source(USER_MODE) _In_ PUNICODE_STRING pustrUnsafe)
 
BOOL FASTCALL LookupFnIdToiCls (int FnId, int *iCls)
 
INT UserGetClassName (IN PCLS Class, IN OUT PUNICODE_STRING ClassName, IN RTL_ATOM Atom, IN BOOL Ansi)
 

Variables

_Out_ RTL_ATOMAtom
 

Macro Definition Documentation

◆ IS_ATOM

#define IS_ATOM (   x)    (((ULONG_PTR)(x) > 0x0) && ((ULONG_PTR)(x) < 0x10000))

Definition at line 3 of file class.h.

Typedef Documentation

◆ PWNDPROC_INFO

◆ WNDPROC_INFO

Function Documentation

◆ _Success_()

_Success_ ( return  )

◆ CreateCallProc()

PCALLPROCDATA CreateCallProc ( IN PDESKTOP  Desktop,
IN WNDPROC  WndProc,
IN BOOL  Unicode,
IN PPROCESSINFO  pi 
)

Definition at line 29 of file callproc.c.

33 {
34  PCALLPROCDATA NewCallProc;
35  HANDLE Handle;
36 
37  /* We can send any thread pointer to the object manager here,
38  * What's important is the process info */
40  Desktop,
41  pi->ptiList,
42  &Handle,
44  sizeof(CALLPROCDATA));
45  if (NewCallProc != NULL)
46  {
47  NewCallProc->pfnClientPrevious = WndProc;
48  NewCallProc->wType |= Unicode ? UserGetCPDA2U : UserGetCPDU2A ;
49  NewCallProc->spcpdNext = NULL;
50 
51  /* Release the extra reference (UserCreateObject added 2 references) */
52  UserDereferenceObject(NewCallProc);
53  }
54 
55  return NewCallProc;
56 }
WNDPROC pfnClientPrevious
Definition: ntuser.h:520
BOOL FASTCALL UserDereferenceObject(PVOID Object)
Definition: object.c:610
PVOID FASTCALL UserCreateObject(PUSER_HANDLE_TABLE ht, PDESKTOP pDesktop, PTHREADINFO pti, HANDLE *h, HANDLE_TYPE type, ULONG size)
Definition: object.c:535
struct _CALLPROCDATA * spcpdNext
Definition: ntuser.h:519
GETCPD wType
Definition: ntuser.h:521
smooth NULL
Definition: ftsmooth.c:416
_In_ HANDLE Handle
Definition: extypes.h:390
static DWORD pi
Definition: protocol.c:150
struct _CALLPROCDATA * PCALLPROCDATA
LRESULT CALLBACK WndProc(HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam)
Definition: solitaire.cpp:598
PUSER_HANDLE_TABLE gHandleTable
Definition: object.c:13

Referenced by IntCreateWindow(), and UserGetCPD().

◆ DestroyCallProc()

BOOLEAN DestroyCallProc ( _Inout_ PVOID  Object)

Definition at line 22 of file callproc.c.

23 {
25  return TRUE;
26 }
BOOL FASTCALL UserDeleteObject(HANDLE h, HANDLE_TYPE type)
Definition: object.c:683
#define TRUE
Definition: types.h:120
#define UserHMGetHandle(obj)
Definition: ntuser.h:208
static IUnknown Object
Definition: main.c:512

Referenced by IntDestroyClass().

◆ DestroyProcessClasses()

void FASTCALL DestroyProcessClasses ( PPROCESSINFO  Process)

Definition at line 300 of file class.c.

301 {
302  PCLS Class;
304 
305  if (pi != NULL)
306  {
307  /* Free all local classes */
308  Class = pi->pclsPrivateList;
309  while (Class != NULL)
310  {
311  pi->pclsPrivateList = Class->pclsNext;
312 
313  ASSERT(Class->pclsBase == Class);
315 
316  Class = pi->pclsPrivateList;
317  }
318 
319  /* Free all global classes */
320  Class = pi->pclsPublicList;
321  while (Class != NULL)
322  {
323  pi->pclsPublicList = Class->pclsNext;
324 
325  ASSERT(Class->pclsBase == Class);
327 
328  Class = pi->pclsPublicList;
329  }
330  }
331 }
static const WCHAR Class[]
Definition: cfgmgr.c:31
struct _PROCESSINFO * PPROCESSINFO
Definition: ntwin32.h:5
static VOID IntDestroyClass(IN OUT PCLS Class)
Definition: class.c:228
smooth NULL
Definition: ftsmooth.c:416
Definition: ntuser.h:533
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
static DWORD pi
Definition: protocol.c:150
_Must_inspect_result_ _In_ PLARGE_INTEGER _In_ PLARGE_INTEGER _In_ ULONG _In_ PFILE_OBJECT _In_ PVOID Process
Definition: fsrtlfuncs.h:219

Referenced by ExitThreadCallback().

◆ IntCheckProcessDesktopClasses()

BOOL IntCheckProcessDesktopClasses ( IN PDESKTOP  Desktop,
IN BOOL  FreeOnFailure 
)

Definition at line 989 of file class.c.

991 {
993  BOOL Ret = TRUE;
994 
995  pi = GetW32ProcessInfo();
996 
997  /* Check all local classes */
999  &pi->pclsPrivateList,
1000  FreeOnFailure,
1001  &Ret);
1002 
1003  /* Check all global classes */
1005  &pi->pclsPublicList,
1006  FreeOnFailure,
1007  &Ret);
1008  if (!Ret)
1009  {
1010  ERR("Failed to move process classes from desktop 0x%p to the shared heap!\n", Desktop);
1012  }
1013 
1014  return Ret;
1015 }
#define TRUE
Definition: types.h:120
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
unsigned int BOOL
Definition: ntddk_ex.h:94
struct _PROCESSINFO * GetW32ProcessInfo(VOID)
Definition: misc.c:777
static VOID IntCheckDesktopClasses(IN PDESKTOP Desktop, IN OUT PCLS *ClassList, IN BOOL FreeOnFailure, OUT BOOL *Ret)
Definition: class.c:920
static DWORD pi
Definition: protocol.c:150
#define ERR(fmt,...)
Definition: debug.h:109
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:27

Referenced by IntSetThreadDesktop().

◆ IntDereferenceClass()

VOID IntDereferenceClass ( IN OUT PCLS  Class,
IN PDESKTOPINFO  Desktop,
IN PPROCESSINFO  pi 
)

Definition at line 792 of file class.c.

795 {
796  PCLS *PrevLink, BaseClass, CurrentClass;
797 
798  ASSERT(Class->cWndReferenceCount >= 1);
799 
800  BaseClass = Class->pclsBase;
801 
802  if (--Class->cWndReferenceCount == 0)
803  {
804  if (BaseClass == Class)
805  {
806  ASSERT(Class->pclsBase == Class);
807 
808  TRACE("IntDereferenceClass 0x%p\n", Class);
809  /* Check if there are clones of the class on other desktops,
810  link the first clone in if possible. If there are no clones
811  then leave the class on the desktop heap. It will get moved
812  to the shared heap when the thread detaches. */
813  if (BaseClass->pclsClone != NULL)
814  {
815  if (BaseClass->Global)
816  PrevLink = &pi->pclsPublicList;
817  else
818  PrevLink = &pi->pclsPrivateList;
819 
820  CurrentClass = *PrevLink;
821  while (CurrentClass != BaseClass)
822  {
823  ASSERT(CurrentClass != NULL);
824 
825  PrevLink = &CurrentClass->pclsNext;
826  CurrentClass = CurrentClass->pclsNext;
827  }
828 
829  ASSERT(*PrevLink == BaseClass);
830 
831  /* Make the first clone become the new base class */
832  IntMakeCloneBaseClass(BaseClass->pclsClone,
833  PrevLink,
834  &BaseClass->pclsClone);
835 
836  /* Destroy the class, there's still another clone of the class
837  that now serves as a base class. Make sure we don't destruct
838  resources shared by all classes (Base = NULL)! */
839  BaseClass->pclsBase = NULL;
840  BaseClass->pclsClone = NULL;
841  IntDestroyClass(BaseClass);
842  }
843  }
844  else
845  {
846  TRACE("IntDereferenceClass1 0x%p\n", Class);
847 
848  /* Locate the cloned class and unlink it */
849  PrevLink = &BaseClass->pclsClone;
850  CurrentClass = BaseClass->pclsClone;
851  while (CurrentClass != Class)
852  {
853  ASSERT(CurrentClass != NULL);
854 
855  PrevLink = &CurrentClass->pclsNext;
856  CurrentClass = CurrentClass->pclsNext;
857  }
858 
859  ASSERT(CurrentClass == Class);
860 
862  Class->pclsNext);
863 
864  ASSERT(Class->pclsBase == BaseClass);
865  ASSERT(Class->pclsClone == NULL);
866 
867  /* The class was just a clone, we don't need it anymore */
869  }
870  }
871 }
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:49
UINT Global
Definition: ntuser.h:561
static VOID IntDestroyClass(IN OUT PCLS Class)
Definition: class.c:228
struct _CLS * pclsClone
Definition: ntuser.h:546
static VOID IntMakeCloneBaseClass(IN OUT PCLS Class, IN OUT PCLS *BaseClassLink, IN OUT PCLS *CloneLink)
Definition: class.c:754
smooth NULL
Definition: ftsmooth.c:416
Definition: ntuser.h:533
#define TRACE(s)
Definition: solgame.cpp:4
#define InterlockedExchangePointer(Target, Value)
Definition: dshow.h:45
struct _CLS * pclsBase
Definition: ntuser.h:545
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
static DWORD pi
Definition: protocol.c:150
struct _CLS * pclsNext
Definition: ntuser.h:535

Referenced by co_UserCreateWindowEx(), and co_UserFreeWindow().

◆ IntGetAndReferenceClass()

PCLS IntGetAndReferenceClass ( PUNICODE_STRING  ClassName,
HINSTANCE  hInstance,
BOOL  bDesktopThread 
)

Definition at line 1407 of file class.c.

1408 {
1409  PCLS *ClassLink, Class = NULL;
1410  RTL_ATOM ClassAtom;
1411  PTHREADINFO pti;
1412 
1413  if (bDesktopThread)
1414  pti = gptiDesktopThread;
1415  else
1417 
1418  if ( !(pti->ppi->W32PF_flags & W32PF_CLASSESREGISTERED ))
1419  {
1421  }
1422 
1423  /* Check the class. */
1424 
1425  TRACE("Finding Class %wZ for hInstance 0x%p\n", ClassName, hInstance);
1426 
1427  ClassAtom = IntGetClassAtom(ClassName,
1428  hInstance,
1429  pti->ppi,
1430  &Class,
1431  &ClassLink);
1432 
1433  if (ClassAtom == (RTL_ATOM)0)
1434  {
1435  if (IS_ATOM(ClassName->Buffer))
1436  {
1437  ERR("Class 0x%p not found\n", ClassName->Buffer);
1438  }
1439  else
1440  {
1441  ERR("Class \"%wZ\" not found\n", ClassName);
1442  }
1443 
1444  return NULL;
1445  }
1446 
1447  TRACE("Referencing Class 0x%p with atom 0x%x\n", Class, ClassAtom);
1449  ClassLink,
1450  pti->rpdesk);
1451  if (Class == NULL)
1452  {
1453  ERR("Failed to reference window class!\n");
1454  return NULL;
1455  }
1456 
1457  return Class;
1458 }
static const WCHAR Class[]
Definition: cfgmgr.c:31
unsigned short RTL_ATOM
Definition: atom.c:42
BOOL FASTCALL UserRegisterSystemClasses(VOID)
Definition: class.c:2276
PVOID NTAPI PsGetCurrentThreadWin32Thread(VOID)
Definition: thread.c:805
struct _DESKTOP * rpdesk
Definition: win32.h:91
PPROCESSINFO ppi
Definition: win32.h:87
PTHREADINFO gptiDesktopThread
Definition: desktop.c:37
HINSTANCE hInstance
Definition: charmap.c:20
smooth NULL
Definition: ftsmooth.c:416
Definition: ntuser.h:533
#define TRACE(s)
Definition: solgame.cpp:4
#define ERR(fmt,...)
Definition: debug.h:109
#define W32PF_CLASSESREGISTERED
Definition: win32.h:17
PCLS IntReferenceClass(IN OUT PCLS BaseClass, IN OUT PCLS *ClassLink, IN PDESKTOP Desktop)
Definition: class.c:726
RTL_ATOM IntGetClassAtom(_In_ PUNICODE_STRING ClassName, IN HINSTANCE hInstance OPTIONAL, IN PPROCESSINFO pi OPTIONAL, OUT PCLS *BaseClass OPTIONAL, OUT PCLS **Link OPTIONAL)
Definition: class.c:1334
#define IS_ATOM(x)
Definition: class.h:3

Referenced by co_UserCreateWindowEx(), and IntCreateDesktop().

◆ IsCallProcHandle()

static __inline BOOL IsCallProcHandle ( IN WNDPROC  lpWndProc)
static

Definition at line 13 of file class.h.

14 {
15  /* FIXME: Check for 64-bit architectures... */
16  return ((ULONG_PTR)lpWndProc & 0xFFFF0000) == 0xFFFF0000;
17 }
uint32_t ULONG_PTR
Definition: typedefs.h:63

Referenced by CallWindowProcA(), CallWindowProcW(), IntSetClassWndProc(), IntSetWindowProc(), and NtUserRegisterClassExWOW().

◆ LookupFnIdToiCls()

BOOL FASTCALL LookupFnIdToiCls ( int  FnId,
int iCls 
)

Definition at line 131 of file class.c.

132 {
133  int i;
134 
135  for ( i = 0; i < ARRAYSIZE(FnidToiCls); i++)
136  {
137  if (FnidToiCls[i].FnId == FnId)
138  {
139  if (iCls) *iCls = FnidToiCls[i].ClsId;
140  return TRUE;
141  }
142  }
143  if (iCls) *iCls = 0;
144  return FALSE;
145 }
#define TRUE
Definition: types.h:120
#define ARRAYSIZE(array)
Definition: filtermapper.c:47
static struct @4119 FnidToiCls[]
int FnId
Definition: class.c:106
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 IntCreateClass(), IntIsGhostWindow(), and NtUserGetClassName().

◆ ProbeAndCaptureUnicodeStringOrAtom()

_Must_inspect_result_ NTSTATUS NTAPI ProbeAndCaptureUnicodeStringOrAtom ( _Out_ _When_(return >=0, _At_(pustrOut->Buffer, _Post_ _Notnull_)) PUNICODE_STRING  pustrOut,
__in_data_source(USER_MODE) _In_ PUNICODE_STRING  pustrUnsafe 
)

Definition at line 150 of file class.c.

153 {
155 
156  /* Default to NULL */
157  pustrOut->Buffer = NULL;
158 
159  _SEH2_TRY
160  {
161  ProbeForRead(pustrUnsafe, sizeof(UNICODE_STRING), 1);
162 
163  /* Validate the string */
164  if ((pustrUnsafe->Length & 1) || (pustrUnsafe->Buffer == NULL))
165  {
166  /* This is not legal */
168  }
169 
170  /* Check if this is an atom */
171  if (IS_ATOM(pustrUnsafe->Buffer))
172  {
173  /* Copy the atom, length is 0 */
174  pustrOut->MaximumLength = pustrOut->Length = 0;
175  pustrOut->Buffer = pustrUnsafe->Buffer;
176  }
177  else
178  {
179  /* Get the length, maximum length includes zero termination */
180  pustrOut->Length = pustrUnsafe->Length;
181  pustrOut->MaximumLength = pustrOut->Length + sizeof(WCHAR);
182 
183  /* Allocate a buffer */
184  pustrOut->Buffer = ExAllocatePoolWithTag(PagedPool,
185  pustrOut->MaximumLength,
186  TAG_STRING);
187  if (!pustrOut->Buffer)
188  {
190  }
191 
192  /* Copy the string and zero terminate it */
193  ProbeForRead(pustrUnsafe->Buffer, pustrOut->Length, 1);
194  RtlCopyMemory(pustrOut->Buffer, pustrUnsafe->Buffer, pustrOut->Length);
195  pustrOut->Buffer[pustrOut->Length / sizeof(WCHAR)] = L'\0';
196  }
197  }
199  {
200  /* Check if we already allocated a buffer */
201  if (pustrOut->Buffer)
202  {
203  /* Free the buffer */
204  ExFreePoolWithTag(pustrOut->Buffer, TAG_STRING);
206  }
207  }
208  _SEH2_END;
209 
210  return Status;
211 }
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
#define TAG_STRING
Definition: oslist.c:24
LONG NTSTATUS
Definition: precomp.h:26
_SEH2_TRY
Definition: create.c:4250
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
smooth NULL
Definition: ftsmooth.c:416
#define _SEH2_YIELD(STMT_)
Definition: pseh2_64.h:8
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
VOID NTAPI ProbeForRead(IN CONST VOID *Address, IN SIZE_T Length, IN ULONG Alignment)
Definition: exintrin.c:102
static const WCHAR L[]
Definition: oid.c:1250
Status
Definition: gdiplustypes.h:24
_SEH2_END
Definition: create.c:4424
#define IS_ATOM(x)
Definition: class.h:3
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:6
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1099
#define _SEH2_GetExceptionCode()
Definition: pseh2_64.h:12
return STATUS_SUCCESS
Definition: btrfs.c:2725

Referenced by NtUserFindExistingCursorIcon(), NtUserGetClassInfo(), NtUserGetWOWClass(), NtUserSetCursorIconData(), and NtUserUnregisterClass().

◆ UserAddCallProcToClass()

VOID UserAddCallProcToClass ( IN OUT PCLS  Class,
IN PCALLPROCDATA  CallProc 
)

Definition at line 400 of file class.c.

402 {
403  PCLS BaseClass;
404 
405  ASSERT(CallProc->spcpdNext == NULL);
406 
407  BaseClass = Class->pclsBase;
408  ASSERT(CallProc->spcpdNext == NULL);
409  CallProc->spcpdNext = BaseClass->spcpdFirst;
410  BaseClass->spcpdFirst = CallProc;
411 
412  /* Update all clones */
413  Class = Class->pclsClone;
414  while (Class != NULL)
415  {
416  Class->spcpdFirst = BaseClass->spcpdFirst;
417  Class = Class->pclsNext;
418  }
419 }
smooth NULL
Definition: ftsmooth.c:416
Definition: ntuser.h:533
PCALLPROCDATA spcpdFirst
Definition: ntuser.h:544
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)

Referenced by IntCreateWindow().

◆ UserGetCallProcInfo()

BOOL UserGetCallProcInfo ( IN HANDLE  hCallProc,
OUT PWNDPROC_INFO  wpInfo 
)

Definition at line 59 of file callproc.c.

61 {
62  PCALLPROCDATA CallProc;
63 
64  CallProc = UserGetObject(gHandleTable,
65  hCallProc,
67  if (CallProc == NULL)
68  {
69  return FALSE;
70  }
71 
72 /* Use Handle pEntry->ppi!
73  if (CallProc->pi != GetW32ProcessInfo())
74  {
75  return FALSE;
76  }*/
77 
78  wpInfo->WindowProc = CallProc->pfnClientPrevious;
79  wpInfo->IsUnicode = !!(CallProc->wType & UserGetCPDA2U);
80 
81  return TRUE;
82 }
#define TRUE
Definition: types.h:120
WNDPROC pfnClientPrevious
Definition: ntuser.h:520
GETCPD wType
Definition: ntuser.h:521
smooth NULL
Definition: ftsmooth.c:416
PVOID UserGetObject(PUSER_HANDLE_TABLE ht, HANDLE handle, HANDLE_TYPE type)
Definition: object.c:462
PUSER_HANDLE_TABLE gHandleTable
Definition: object.c:13

◆ UserGetClassName()

INT UserGetClassName ( IN PCLS  Class,
IN OUT PUNICODE_STRING  ClassName,
IN RTL_ATOM  Atom,
IN BOOL  Ansi 
)

Definition at line 1604 of file class.c.

1608 {
1610  WCHAR szStaticTemp[32];
1611  PWSTR szTemp = NULL;
1612  ULONG BufLen = sizeof(szStaticTemp);
1613  INT Ret = 0;
1614 
1615  /* Note: Accessing the buffer in ClassName may raise an exception! */
1616 
1617  _SEH2_TRY
1618  {
1619  if (Ansi)
1620  {
1621  PANSI_STRING AnsiClassName = (PANSI_STRING)ClassName;
1622  UNICODE_STRING UnicodeClassName;
1623 
1624  /* Limit the size of the static buffer on the stack to the
1625  size of the buffer provided by the caller */
1626  if (BufLen / sizeof(WCHAR) > AnsiClassName->MaximumLength)
1627  {
1628  BufLen = AnsiClassName->MaximumLength * sizeof(WCHAR);
1629  }
1630 
1631  /* Find out how big the buffer needs to be */
1633  Class->atomClassName,
1634  NULL,
1635  NULL,
1636  szStaticTemp,
1637  &BufLen);
1639  {
1640  if (BufLen / sizeof(WCHAR) > AnsiClassName->MaximumLength)
1641  {
1642  /* The buffer required exceeds the ansi buffer provided,
1643  pretend like we're using the ansi buffer and limit the
1644  size to the buffer size provided */
1645  BufLen = AnsiClassName->MaximumLength * sizeof(WCHAR);
1646  }
1647 
1648  /* Allocate a temporary buffer that can hold the unicode class name */
1650  BufLen,
1651  USERTAG_CLASS);
1652  if (szTemp == NULL)
1653  {
1655  _SEH2_LEAVE;
1656  }
1657 
1658  /* Query the class name */
1660  Atom ? Atom : Class->atomNVClassName,
1661  NULL,
1662  NULL,
1663  szTemp,
1664  &BufLen);
1665  }
1666  else
1667  szTemp = szStaticTemp;
1668 
1669  if (NT_SUCCESS(Status))
1670  {
1671  /* Convert the atom name to ansi */
1672 
1673  RtlInitUnicodeString(&UnicodeClassName,
1674  szTemp);
1675 
1676  Status = RtlUnicodeStringToAnsiString(AnsiClassName,
1677  &UnicodeClassName,
1678  FALSE);
1679  if (!NT_SUCCESS(Status))
1680  {
1682  _SEH2_LEAVE;
1683  }
1684  }
1685 
1686  Ret = BufLen / sizeof(WCHAR);
1687  }
1688  else /* !ANSI */
1689  {
1690  BufLen = ClassName->MaximumLength;
1691 
1692  /* Query the atom name */
1694  Atom ? Atom : Class->atomNVClassName,
1695  NULL,
1696  NULL,
1697  ClassName->Buffer,
1698  &BufLen);
1699 
1700  if (!NT_SUCCESS(Status))
1701  {
1703  _SEH2_LEAVE;
1704  }
1705 
1706  Ret = BufLen / sizeof(WCHAR);
1707  }
1708  }
1710  {
1712  }
1713  _SEH2_END;
1714 
1715  if (Ansi && szTemp != NULL && szTemp != szStaticTemp)
1716  {
1718  }
1719 
1720  return Ret;
1721 }
#define BufLen
Definition: fatfs.h:167
#define USERTAG_CLASS
Definition: tags.h:203
uint16_t * PWSTR
Definition: typedefs.h:54
LONG NTSTATUS
Definition: precomp.h:26
PRTL_ATOM_TABLE gAtomTable
Definition: session.c:13
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
_Out_ RTL_ATOM * Atom
Definition: class.h:54
int32_t INT
Definition: typedefs.h:56
#define STATUS_BUFFER_TOO_SMALL
Definition: shellext.h:64
_SEH2_TRY
Definition: create.c:4250
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
smooth NULL
Definition: ftsmooth.c:416
NTSYSAPI NTSTATUS NTAPI RtlUnicodeStringToAnsiString(PANSI_STRING DestinationString, PUNICODE_STRING SourceString, BOOLEAN AllocateDestinationString)
USHORT MaximumLength
Definition: env_spec_w32.h:377
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
ANSI_STRING * PANSI_STRING
Definition: env_spec_w32.h:380
NTSYSAPI NTSTATUS NTAPI RtlQueryAtomInAtomTable(_In_ PRTL_ATOM_TABLE AtomTable, _In_ RTL_ATOM Atom, _Out_opt_ PULONG RefCount, _Out_opt_ PULONG PinCount, _Out_opt_z_bytecap_(*NameLength) PWSTR AtomName, _Inout_opt_ PULONG NameLength)
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
VOID FASTCALL SetLastNtError(NTSTATUS Status)
Definition: error.c:36
Status
Definition: gdiplustypes.h:24
_SEH2_END
Definition: create.c:4424
unsigned int ULONG
Definition: retypes.h:1
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:6
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1099
#define _SEH2_GetExceptionCode()
Definition: pseh2_64.h:12
#define _SEH2_LEAVE
Definition: filesup.c:20
return STATUS_SUCCESS
Definition: btrfs.c:2725
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:27

Referenced by IntIsGhostWindow(), and NtUserGetClassName().

◆ UserGetCPD()

ULONG_PTR FASTCALL UserGetCPD ( PVOID  ,
GETCPD  ,
ULONG_PTR   
)

Definition at line 107 of file callproc.c.

111 {
112  PCLS pCls;
113  PWND pWnd;
114  PDESKTOP pDesk;
115  PCALLPROCDATA CallProc = NULL;
116  PTHREADINFO pti;
117 
119 
122  {
123  pWnd = pvClsWnd;
124  pCls = pWnd->pcls;
125  }
126  else
127  pCls = pvClsWnd;
128 
129  // Search Class call proc data list.
130  if (pCls->spcpdFirst)
131  CallProc = UserSearchForCallProc( pCls->spcpdFirst, (WNDPROC)ProcIn, Flags);
132 
133  // No luck, create a new one for the requested proc.
134  if (!CallProc)
135  {
136  if (!pCls->rpdeskParent)
137  {
138  TRACE("Null DESKTOP Atom %u\n",pCls->atomClassName);
139  pDesk = pti->rpdesk;
140  }
141  else
142  pDesk = pCls->rpdeskParent;
143  CallProc = CreateCallProc( pDesk,
144  (WNDPROC)ProcIn,
145  !!(Flags & UserGetCPDA2U),
146  pti->ppi);
147  if (CallProc)
148  {
149  CallProc->spcpdNext = pCls->spcpdFirst;
151  CallProc);
152  CallProc->wType = Flags;
153  }
154  }
155  return (ULONG_PTR)(CallProc ? GetCallProcHandle(CallProc) : NULL);
156 }
struct _DESKTOP * rpdeskParent
Definition: ntuser.h:539
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:49
PVOID NTAPI PsGetCurrentThreadWin32Thread(VOID)
Definition: thread.c:805
RTL_ATOM atomClassName
Definition: ntuser.h:536
struct _DESKTOP * rpdesk
Definition: win32.h:91
WNDPROC GetCallProcHandle(IN PCALLPROCDATA CallProc)
Definition: callproc.c:15
PPROCESSINFO ppi
Definition: win32.h:87
PCALLPROCDATA CreateCallProc(IN PDESKTOP Desktop, IN WNDPROC WndProc, IN BOOL Unicode, IN PPROCESSINFO pi)
Definition: callproc.c:29
uint32_t ULONG_PTR
Definition: typedefs.h:63
struct _CALLPROCDATA * spcpdNext
Definition: ntuser.h:519
GETCPD wType
Definition: ntuser.h:521
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
smooth NULL
Definition: ftsmooth.c:416
Definition: ntuser.h:533
PCALLPROCDATA spcpdFirst
Definition: ntuser.h:544
#define TRACE(s)
Definition: solgame.cpp:4
#define InterlockedExchangePointer(Target, Value)
Definition: dshow.h:45
LRESULT(CALLBACK * WNDPROC)(HWND, UINT, WPARAM, LPARAM)
Definition: winuser.h:2859
Definition: ntuser.h:657
PCALLPROCDATA FASTCALL UserSearchForCallProc(PCALLPROCDATA pcpd, WNDPROC WndProc, GETCPD Type)
Definition: callproc.c:89
PCLS pcls
Definition: ntuser.h:684

Referenced by IntGetClassWndProc(), IntGetWindowProc(), and NtUserGetCPD().

◆ UserRegisterSystemClasses()

BOOL FASTCALL UserRegisterSystemClasses ( VOID  )

Definition at line 2276 of file class.c.

2277 {
2278  UINT i;
2279  UNICODE_STRING ClassName, MenuName;
2281  WNDCLASSEXW wc;
2282  PCLS Class;
2283  BOOL Ret = TRUE;
2284  HBRUSH hBrush;
2285  DWORD Flags = 0;
2286 
2287  if (ppi->W32PF_flags & W32PF_CLASSESREGISTERED)
2288  return TRUE;
2289 
2290  if ( hModClient == NULL)
2291  return FALSE;
2292 
2293  RtlZeroMemory(&ClassName, sizeof(ClassName));
2294  RtlZeroMemory(&MenuName, sizeof(MenuName));
2295 
2296  for (i = 0; i != ARRAYSIZE(DefaultServerClasses); i++)
2297  {
2298  if (!IS_ATOM(DefaultServerClasses[i].ClassName))
2299  {
2300  RtlInitUnicodeString(&ClassName, DefaultServerClasses[i].ClassName);
2301  }
2302  else
2303  {
2304  ClassName.Buffer = DefaultServerClasses[i].ClassName;
2305  ClassName.Length = 0;
2306  ClassName.MaximumLength = 0;
2307  }
2308 
2309  wc.cbSize = sizeof(wc);
2311 
2313 
2314  if (DefaultServerClasses[i].ProcW)
2315  {
2317  wc.hInstance = hModuleWin;
2318  }
2319  else
2320  {
2322  wc.hInstance = hModClient;
2323  }
2324 
2325  wc.cbClsExtra = 0;
2327  wc.hIcon = NULL;
2328 
2330  wc.hCursor = NULL;
2331  if (DefaultServerClasses[i].hCursor == (HICON)OCR_NORMAL)
2332  {
2333  if (SYSTEMCUR(ARROW) == NULL)
2334  {
2335  ERR("SYSTEMCUR(ARROW) == NULL, should not happen!!\n");
2336  }
2337  else
2338  {
2339  wc.hCursor = UserHMGetHandle(SYSTEMCUR(ARROW));
2340  }
2341  }
2342 
2343  hBrush = DefaultServerClasses[i].hBrush;
2344  if (hBrush <= (HBRUSH)COLOR_MENUBAR)
2345  {
2346  hBrush = IntGetSysColorBrush(HandleToUlong(hBrush));
2347  }
2348  wc.hbrBackground = hBrush;
2349  wc.lpszMenuName = NULL;
2350  wc.lpszClassName = ClassName.Buffer;
2351  wc.hIconSm = NULL;
2352 
2353  Class = IntCreateClass( &wc,
2354  &ClassName,
2355  &ClassName,
2356  &MenuName,
2357  DefaultServerClasses[i].fiId,
2358  Flags,
2359  NULL,
2360  ppi);
2361  if (Class != NULL)
2362  {
2363  Class->pclsNext = ppi->pclsPublicList;
2365  Class);
2366 
2368  }
2369  else
2370  {
2371  ERR("!!! Registering system class failed!\n");
2372  Ret = FALSE;
2373  }
2374  }
2375  if (Ret) ppi->W32PF_flags |= W32PF_CLASSESREGISTERED;
2376  return Ret;
2377 }
static const WCHAR Class[]
Definition: cfgmgr.c:31
static HICON
Definition: imagelist.c:84
#define TRUE
Definition: types.h:120
#define GETPFNSERVER(fnid)
Definition: ntuser.h:870
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:49
int cbWndExtra
Definition: winuser.h:3173
DWORD dwRegisteredClasses
Definition: win32.h:271
HGDIOBJ FASTCALL IntGetSysColorBrush(INT Object)
Definition: stockobj.c:317
#define HandleToUlong(h)
Definition: basetsd.h:79
#define ARRAYSIZE(array)
Definition: filtermapper.c:47
HICON hIcon
Definition: winuser.h:3175
PCLS FASTCALL IntCreateClass(IN CONST WNDCLASSEXW *lpwcx, IN PUNICODE_STRING ClassName, IN PUNICODE_STRING ClassVersion, IN PUNICODE_STRING MenuName, IN DWORD fnID, IN DWORD dwFlags, IN PDESKTOP Desktop, IN PPROCESSINFO pi)
Definition: class.c:1019
REGISTER_SYSCLASS DefaultServerClasses[]
Definition: class.c:35
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
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
LPCWSTR lpszMenuName
Definition: winuser.h:3178
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
Definition: ntuser.h:533
int cbClsExtra
Definition: winuser.h:3172
LPCWSTR lpszClassName
Definition: winuser.h:3179
#define UserHMGetHandle(obj)
Definition: ntuser.h:208
struct _PROCESSINFO * GetW32ProcessInfo(VOID)
Definition: misc.c:777
#define InterlockedExchangePointer(Target, Value)
Definition: dshow.h:45
struct _CLS * pclsPublicList
Definition: win32.h:251
HBRUSH hbrBackground
Definition: winuser.h:3177
UINT cbSize
Definition: winuser.h:3169
unsigned long DWORD
Definition: ntddk_ex.h:95
WNDPROC ProcW
Definition: ntuser.h:456
HINSTANCE hInstance
Definition: winuser.h:3174
#define CSF_SERVERSIDEPROC
Definition: ntuser.h:524
HCURSOR hCursor
Definition: winuser.h:3176
UINT style
Definition: winuser.h:3170
WNDPROC lpfnWndProc
Definition: winuser.h:3171
#define ERR(fmt,...)
Definition: debug.h:109
#define OCR_NORMAL
Definition: winuser.h:1132
#define W32PF_CLASSESREGISTERED
Definition: win32.h:17
unsigned int UINT
Definition: ndis.h:50
HANDLE hModuleWin
Definition: main.c:16
HICON hIconSm
Definition: winuser.h:3180
#define ICLASS_TO_MASK(iCls)
Definition: ntuser.h:863
#define SYSTEMCUR(func)
Definition: cursoricon.h:129
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
#define IS_ATOM(x)
Definition: class.h:3
HINSTANCE hModClient
Definition: ntuser.c:25

Referenced by DesktopThreadMain(), IntGetAndReferenceClass(), NtUserGetClassInfo(), and NtUserRegisterClassExWOW().

Variable Documentation

◆ Atom