ReactOS 0.4.15-dev-8236-g99f0937
RealGetWindowClass.c File Reference
#include "precomp.h"
Include dependency graph for RealGetWindowClass.c:

Go to the source code of this file.

Classes

struct  _TestData
 

Typedefs

typedef struct _TestData TestData
 

Functions

void Test_ClassAtoms ()
 
void Test_RealGetWindowClass ()
 
 START_TEST (RealGetWindowClass)
 

Variables

static PWSTR ControlsList []
 
static TestData RealClassTestData []
 

Typedef Documentation

◆ TestData

Function Documentation

◆ START_TEST()

START_TEST ( RealGetWindowClass  )

Definition at line 182 of file RealGetWindowClass.c.

183{
186}
void Test_ClassAtoms()
void Test_RealGetWindowClass()

◆ Test_ClassAtoms()

void Test_ClassAtoms ( )

Definition at line 81 of file RealGetWindowClass.c.

82{
83 ATOM atom;
84 int i;
85 WNDCLASSW cls;
86
87 // Initialize starting Atom number.
88 atom = GetClassInfoW(NULL, ControlsList[0], &cls);
89 if (!atom)
90 {
91 skip( "No reference Atom\n" );
92 return;
93 }
94
95 trace("First Control Class Atom 0x%x\n",atom);
96
97 for (i = 0; i < 17; atom++ ,i++)
98 {
99 if (lstrcmpW(ControlsList[i],L"\0"))
100 {
101 ATOM test_atom = GetClassInfoW(NULL, ControlsList[i], &cls);
102 // Skip unregistered Classes.
103 if (test_atom)
104 {
105 ok(test_atom == atom, "%S class atom did not match %x:%x\n",ControlsList[i],test_atom,atom);
106 ok(!lstrcmpW(cls.lpszClassName,ControlsList[i]),"GetClassName returned incorrect name\n");
107 }
108 }
109 }
110}
static PWSTR ControlsList[]
#define trace
Definition: atltest.h:70
#define ok(value,...)
Definition: atltest.h:57
#define skip(...)
Definition: atltest.h:64
WORD ATOM
Definition: dimm.idl:113
#define NULL
Definition: types.h:112
int WINAPI lstrcmpW(LPCWSTR str1, LPCWSTR str2)
Definition: locale.c:4242
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
#define L(x)
Definition: ntvdm.h:50
LPCWSTR lpszClassName
Definition: winuser.h:3185
BOOL WINAPI GetClassInfoW(_In_opt_ HINSTANCE, _In_ LPCWSTR, _Out_ LPWNDCLASSW)

Referenced by START_TEST().

◆ Test_RealGetWindowClass()

void Test_RealGetWindowClass ( )

Definition at line 112 of file RealGetWindowClass.c.

113{
114 int testNo;
115 UINT Result;
116 CHAR Buffer[1024];
117
119 ok(Result == 0, "Result = %d\n", Result);
120 ok(GetLastError() == ERROR_INVALID_WINDOW_HANDLE, "GetLastError() = %ld\n", GetLastError());
121
122 for (testNo = 0; testNo < ARRAY_SIZE(RealClassTestData); testNo++)
123 {
124 ATOM atom;
125 WNDCLASSA cls;
126 HWND hWnd;
127
128 /* Register classes, "derived" from built-in dialog, with and without the DLGWINDOWEXTRA flag set */
129 GetClassInfoA(0, "#32770", &cls);
130 if (RealClassTestData[testNo].OverrideWndProc)
132 cls.lpszClassName = RealClassTestData[testNo].ClassName;
133 cls.cbWndExtra &= ~RealClassTestData[testNo].WndExtra;
134 atom = RegisterClassA (&cls);
135 if (atom == 0) return;
136
137 /* Create a window */
140 RealClassTestData[testNo].ClassName,
141 RealClassTestData[testNo].ClassName,
144 CW_USEDEFAULT, CW_USEDEFAULT, 100, 100,
145 NULL, NULL, 0, 0);
146
147 /* Do we expect a HWND at all? */
148 if (RealClassTestData[testNo].ExpectsHwnd)
149 {
150 ok(hWnd != NULL, "\n");
151
152 if (hWnd != NULL)
153 {
154 /* Get the "real" class name */
156 printf("Buffer: %s\nExpectedClassNameBefore(%d): %s\n", Buffer, testNo, RealClassTestData[testNo].ExpectedClassNameBefore);
157 ok( Result != 0, "\n" );
158 ok( strcmp( Buffer, RealClassTestData[testNo].ExpectedClassNameBefore ) == 0, "\n" );
159
160 /* Call a function that requires a dialog window */
162
163 /* Get the "real" class name again */
165 printf("Buffer: %s\nExpectedClassNameAfter(%d): %s\n", Buffer, testNo, RealClassTestData[testNo].ExpectedClassNameAfter);
166 ok( Result != 0, "\n" );
167 ok( strcmp( Buffer, RealClassTestData[testNo].ExpectedClassNameAfter ) == 0, "\n" );
168 }
169 }
170 else
171 {
172 ok(hWnd == NULL, "\n");
173 }
174
175 /* Cleanup */
177 UnregisterClass(RealClassTestData[testNo].ClassName, 0);
178 }
179
180}
static TestData RealClassTestData[]
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
HWND hWnd
Definition: settings.c:17
#define ARRAY_SIZE(A)
Definition: main.h:33
Definition: bufpool.h:45
#define printf
Definition: freeldr.h:97
unsigned int UINT
Definition: ndis.h:50
#define WS_MAXIMIZEBOX
Definition: pedump.c:632
#define WS_OVERLAPPED
Definition: pedump.c:615
#define WS_EX_DLGMODALFRAME
Definition: pedump.c:645
#define WS_DLGFRAME
Definition: pedump.c:626
#define WS_CLIPSIBLINGS
Definition: pedump.c:618
#define WS_POPUPWINDOW
Definition: pedump.c:638
#define WS_MINIMIZEBOX
Definition: pedump.c:631
int cbWndExtra
Definition: winuser.h:3166
LPCSTR lpszClassName
Definition: winuser.h:3172
WNDPROC lpfnWndProc
Definition: winuser.h:3164
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
#define ERROR_INVALID_WINDOW_HANDLE
Definition: winerror.h:881
#define CreateWindowEx
Definition: winuser.h:5764
#define RealGetWindowClass
Definition: winuser.h:5844
#define DM_SETDEFID
Definition: winuser.h:2099
LRESULT WINAPI DefWindowProcA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define IDCANCEL
Definition: winuser.h:831
#define WS_EX_RIGHTSCROLLBAR
Definition: winuser.h:401
#define WS_EX_APPWINDOW
Definition: winuser.h:383
#define WS_EX_CONTROLPARENT
Definition: winuser.h:387
#define UnregisterClass
Definition: winuser.h:5870
#define DS_3DLOOK
Definition: winuser.h:367
#define DS_MODALFRAME
Definition: winuser.h:375
LRESULT WINAPI DefDlgProcA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
ATOM WINAPI RegisterClassA(_In_ CONST WNDCLASSA *)
#define DS_SETFONT
Definition: winuser.h:378
#define WS_EX_WINDOWEDGE
Definition: winuser.h:407
BOOL WINAPI GetClassInfoA(_In_opt_ HINSTANCE, _In_ LPCSTR, _Out_ LPWNDCLASSA)
#define WS_EX_LTRREADING
Definition: winuser.h:393
#define CW_USEDEFAULT
Definition: winuser.h:225
BOOL WINAPI DestroyWindow(_In_ HWND)
#define WS_EX_LEFT
Definition: winuser.h:391
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
Definition: wsk.h:409
char CHAR
Definition: xmlstorage.h:175

Referenced by START_TEST().

Variable Documentation

◆ ControlsList

PWSTR ControlsList[]
static
Initial value:
=
{
L"Button\0",
L"Edit\0",
L"Static\0",
L"ListBox\0",
L"ScrollBar\0",
L"ComboBox\0",
L"MDIClient\0",
L"ComboLBox\0",
L"DDEMLEvent\0",
L"DDEMLMom\0",
L"DMGClass\0",
L"DDEMLAnsiClient\0",
L"DDEMLUnicodeClient\0",
L"DDEMLAnsiServer\0",
L"DDEMLUnicodeServer\0",
L"IME\0",
L"\0",
}

Definition at line 10 of file RealGetWindowClass.c.

Referenced by Test_ClassAtoms().

◆ RealClassTestData

TestData RealClassTestData[]
static

Definition at line 41 of file RealGetWindowClass.c.

Referenced by Test_RealGetWindowClass().