Commit 6fdb5ddc authored by Gerard Patel's avatar Gerard Patel Committed by Alexandre Julliard

Do not use GlobalFindAtom with atom handles in CreateWindow* functions.

parent 9d2d34fb
......@@ -690,9 +690,7 @@ static HWND WIN_CreateWindowEx( CREATESTRUCTA *cs, ATOM classAtom,
/* Find the window class */
if (!(classPtr = CLASS_FindClassByAtom( classAtom, win32?cs->hInstance:GetExePtr(cs->hInstance) )))
{
char buffer[256];
GlobalGetAtomNameA( classAtom, buffer, sizeof(buffer) );
WARN("Bad class '%s'\n", buffer );
WARN("Bad class '%s'\n", cs->lpszClass );
return 0;
}
......@@ -1040,11 +1038,24 @@ HWND16 WINAPI CreateWindowEx16( DWORD exStyle, LPCSTR className,
/* Find the class atom */
if (HIWORD(className))
{
if (!(classAtom = GlobalFindAtomA( className )))
{
ERR( "bad class name %s\n", debugres_a(className) );
return 0;
}
}
else
{
classAtom = LOWORD(className);
if (!GlobalGetAtomNameA( classAtom, buffer, sizeof(buffer) ))
{
ERR( "bad atom %x\n", classAtom);
return 0;
}
className = buffer;
}
/* Fix the coordinates */
......@@ -1064,12 +1075,6 @@ HWND16 WINAPI CreateWindowEx16( DWORD exStyle, LPCSTR className,
cs.lpszClass = className;
cs.dwExStyle = exStyle;
/* make sure lpszClass is a string */
if (!HIWORD(cs.lpszClass))
{
GlobalGetAtomNameA( classAtom, buffer, sizeof(buffer) );
cs.lpszClass = buffer;
}
return WIN_CreateWindowEx( &cs, classAtom, FALSE, FALSE );
}
......@@ -1092,13 +1097,27 @@ HWND WINAPI CreateWindowExA( DWORD exStyle, LPCSTR className,
if(exStyle & WS_EX_MDICHILD)
return MDI_CreateMDIWindowA(className, windowName, style, x, y, width, height, parent, instance, (LPARAM)data);
/* Find the class atom */
if (HIWORD(className))
{
if (!(classAtom = GlobalFindAtomA( className )))
{
ERR( "bad class name %s\n", debugres_a(className) );
return 0;
}
}
else
{
classAtom = LOWORD(className);
if (!GlobalGetAtomNameA( classAtom, buffer, sizeof(buffer) ))
{
ERR( "bad atom %x\n", classAtom);
return 0;
}
className = buffer;
}
/* Create the window */
......@@ -1115,12 +1134,6 @@ HWND WINAPI CreateWindowExA( DWORD exStyle, LPCSTR className,
cs.lpszClass = className;
cs.dwExStyle = exStyle;
/* make sure lpszClass is a string */
if (!HIWORD(cs.lpszClass))
{
GlobalGetAtomNameA( classAtom, buffer, sizeof(buffer) );
cs.lpszClass = buffer;
}
return WIN_CreateWindowEx( &cs, classAtom, TRUE, FALSE );
}
......@@ -1146,11 +1159,24 @@ HWND WINAPI CreateWindowExW( DWORD exStyle, LPCWSTR className,
/* Find the class atom */
if (HIWORD(className))
{
if (!(classAtom = GlobalFindAtomW( className )))
{
ERR( "bad class name %s\n", debugres_w(className) );
return 0;
}
}
else
{
classAtom = LOWORD(className);
if (!GlobalGetAtomNameW( classAtom, buffer, sizeof(buffer)/sizeof(WCHAR) ))
{
ERR( "bad atom %x\n", classAtom);
return 0;
}
className = buffer;
}
/* Create the window */
......@@ -1167,13 +1193,6 @@ HWND WINAPI CreateWindowExW( DWORD exStyle, LPCWSTR className,
cs.lpszClass = className;
cs.dwExStyle = exStyle;
/* make sure lpszClass is a string */
if (!HIWORD(cs.lpszClass))
{
GlobalGetAtomNameW( classAtom, buffer, sizeof(buffer)/sizeof(WCHAR) );
cs.lpszClass = buffer;
}
/* Note: we rely on the fact that CREATESTRUCT32A and */
/* CREATESTRUCT32W have the same layout. */
return WIN_CreateWindowEx( (CREATESTRUCTA *)&cs, classAtom, TRUE, TRUE );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment