- //// Call the WH_CBT hook ////
-
- // Allocate the calling structures Justin Case this goes Global.
- pCsw = ExAllocatePoolWithTag(NonPagedPool, sizeof(CREATESTRUCTW), TAG_HOOK);
- pCbtCreate = ExAllocatePoolWithTag(NonPagedPool, sizeof(CBT_CREATEWNDW), TAG_HOOK);
-
- /* Fill the new CREATESTRUCTW */
- pCsw->lpCreateParams = Cs->lpCreateParams;
- pCsw->hInstance = Cs->hInstance;
- pCsw->hMenu = Cs->hMenu;
- pCsw->hwndParent = Cs->hwndParent;
- pCsw->cx = Cs->cx;
- pCsw->cy = Cs->cy;
- pCsw->x = Cs->x;
- pCsw->y = Cs->y;
- pCsw->dwExStyle = Cs->dwExStyle;
- dwStyle = Cs->style; // Save it anyway.
- pCsw->style = Window->style; /* HCBT_CREATEWND needs the real window style */
- pCsw->lpszName = Cs->lpszName;
- pCsw->lpszClass = Cs->lpszClass;
-
- // Based on the assumption this is from "unicode source" user32, ReactOS, answer is yes.
- if (!IS_ATOM(ClassName->Buffer))
- {
- if (Window->state & WNDS_ANSICREATOR)
- {
- ANSI_STRING AnsiString;
- AnsiString.MaximumLength = RtlUnicodeStringToAnsiSize(ClassName)+sizeof(CHAR);
- pszClass = UserHeapAlloc(AnsiString.MaximumLength);
- RtlZeroMemory(pszClass, AnsiString.MaximumLength);
- AnsiString.Buffer = (PCHAR)pszClass;
- RtlUnicodeStringToAnsiString(&AnsiString, ClassName, FALSE);
- }
- else
- {
- UNICODE_STRING UnicodeString;
- UnicodeString.MaximumLength = ClassName->Length + sizeof(UNICODE_NULL);
- pszClass = UserHeapAlloc(UnicodeString.MaximumLength);
- RtlZeroMemory(pszClass, UnicodeString.MaximumLength);
- UnicodeString.Buffer = (PWSTR)pszClass;
- RtlCopyUnicodeString(&UnicodeString, ClassName);
- }
- if (pszClass) pCsw->lpszClass = UserHeapAddressToUser(pszClass);
- }
- if (WindowName->Length)