Do not use GlobalFindAtom with atom handles in CreateWindow* functions.
This commit is contained in:
parent
9d2d34fbfd
commit
6fdb5ddc0c
|
@ -690,9 +690,7 @@ static HWND WIN_CreateWindowEx( CREATESTRUCTA *cs, ATOM classAtom,
|
||||||
/* Find the window class */
|
/* Find the window class */
|
||||||
if (!(classPtr = CLASS_FindClassByAtom( classAtom, win32?cs->hInstance:GetExePtr(cs->hInstance) )))
|
if (!(classPtr = CLASS_FindClassByAtom( classAtom, win32?cs->hInstance:GetExePtr(cs->hInstance) )))
|
||||||
{
|
{
|
||||||
char buffer[256];
|
WARN("Bad class '%s'\n", cs->lpszClass );
|
||||||
GlobalGetAtomNameA( classAtom, buffer, sizeof(buffer) );
|
|
||||||
WARN("Bad class '%s'\n", buffer );
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1040,11 +1038,24 @@ HWND16 WINAPI CreateWindowEx16( DWORD exStyle, LPCSTR className,
|
||||||
|
|
||||||
/* Find the class atom */
|
/* Find the class atom */
|
||||||
|
|
||||||
|
if (HIWORD(className))
|
||||||
|
{
|
||||||
if (!(classAtom = GlobalFindAtomA( className )))
|
if (!(classAtom = GlobalFindAtomA( className )))
|
||||||
{
|
{
|
||||||
ERR( "bad class name %s\n", debugres_a(className) );
|
ERR( "bad class name %s\n", debugres_a(className) );
|
||||||
return 0;
|
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 */
|
/* Fix the coordinates */
|
||||||
|
|
||||||
|
@ -1064,12 +1075,6 @@ HWND16 WINAPI CreateWindowEx16( DWORD exStyle, LPCSTR className,
|
||||||
cs.lpszClass = className;
|
cs.lpszClass = className;
|
||||||
cs.dwExStyle = exStyle;
|
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 );
|
return WIN_CreateWindowEx( &cs, classAtom, FALSE, FALSE );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1092,13 +1097,27 @@ HWND WINAPI CreateWindowExA( DWORD exStyle, LPCSTR className,
|
||||||
|
|
||||||
if(exStyle & WS_EX_MDICHILD)
|
if(exStyle & WS_EX_MDICHILD)
|
||||||
return MDI_CreateMDIWindowA(className, windowName, style, x, y, width, height, parent, instance, (LPARAM)data);
|
return MDI_CreateMDIWindowA(className, windowName, style, x, y, width, height, parent, instance, (LPARAM)data);
|
||||||
|
|
||||||
/* Find the class atom */
|
/* Find the class atom */
|
||||||
|
|
||||||
|
if (HIWORD(className))
|
||||||
|
{
|
||||||
if (!(classAtom = GlobalFindAtomA( className )))
|
if (!(classAtom = GlobalFindAtomA( className )))
|
||||||
{
|
{
|
||||||
ERR( "bad class name %s\n", debugres_a(className) );
|
ERR( "bad class name %s\n", debugres_a(className) );
|
||||||
return 0;
|
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 */
|
/* Create the window */
|
||||||
|
|
||||||
|
@ -1115,12 +1134,6 @@ HWND WINAPI CreateWindowExA( DWORD exStyle, LPCSTR className,
|
||||||
cs.lpszClass = className;
|
cs.lpszClass = className;
|
||||||
cs.dwExStyle = exStyle;
|
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 );
|
return WIN_CreateWindowEx( &cs, classAtom, TRUE, FALSE );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1146,11 +1159,24 @@ HWND WINAPI CreateWindowExW( DWORD exStyle, LPCWSTR className,
|
||||||
|
|
||||||
/* Find the class atom */
|
/* Find the class atom */
|
||||||
|
|
||||||
|
if (HIWORD(className))
|
||||||
|
{
|
||||||
if (!(classAtom = GlobalFindAtomW( className )))
|
if (!(classAtom = GlobalFindAtomW( className )))
|
||||||
{
|
{
|
||||||
ERR( "bad class name %s\n", debugres_w(className) );
|
ERR( "bad class name %s\n", debugres_w(className) );
|
||||||
return 0;
|
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 */
|
/* Create the window */
|
||||||
|
|
||||||
|
@ -1167,13 +1193,6 @@ HWND WINAPI CreateWindowExW( DWORD exStyle, LPCWSTR className,
|
||||||
cs.lpszClass = className;
|
cs.lpszClass = className;
|
||||||
cs.dwExStyle = exStyle;
|
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 */
|
/* Note: we rely on the fact that CREATESTRUCT32A and */
|
||||||
/* CREATESTRUCT32W have the same layout. */
|
/* CREATESTRUCT32W have the same layout. */
|
||||||
return WIN_CreateWindowEx( (CREATESTRUCTA *)&cs, classAtom, TRUE, TRUE );
|
return WIN_CreateWindowEx( (CREATESTRUCTA *)&cs, classAtom, TRUE, TRUE );
|
||||||
|
|
Loading…
Reference in New Issue