* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
/* INCLUDES ******************************************************************/
-#include <w32k.h>
+#include <win32k.h>
#define NDEBUG
#include <debug.h>
BOOL FASTCALL
IntSetupClipboard(PWINSTATION_OBJECT WinStaObj)
{
- WinStaObj->Clipboard = ExAllocatePool(PagedPool, sizeof(CLIPBOARDSYSTEM));
+ WinStaObj->Clipboard = ExAllocatePoolWithTag(PagedPool, sizeof(CLIPBOARDSYSTEM), TAG_WINSTA);
if (WinStaObj->Clipboard)
{
RtlZeroMemory(WinStaObj->Clipboard, sizeof(CLIPBOARDSYSTEM));
/* OBJECT CALLBACKS **********************************************************/
-VOID STDCALL
+VOID APIENTRY
IntWinStaObjectDelete(PWIN32_DELETEMETHOD_PARAMETERS Parameters)
{
PWINSTATION_OBJECT WinSta = (PWINSTATION_OBJECT)Parameters->Object;
}
NTSTATUS
-STDCALL
+APIENTRY
IntWinStaObjectParse(PWIN32_PARSEMETHOD_PARAMETERS Parameters)
{
PUNICODE_STRING RemainingName = Parameters->RemainingName;
return NT_SUCCESS(Status);
}
+
BOOL FASTCALL
co_IntInitializeDesktopGraphics(VOID)
{
+ TEXTMETRICW tmw;
UNICODE_STRING DriverName = RTL_CONSTANT_STRING(L"DISPLAY");
if (! IntCreatePrimarySurface())
{
IntDestroyPrimarySurface();
return FALSE;
}
- DC_FreeDcAttr(ScreenDeviceContext); // Free the dcattr!
- DC_SetOwnership(ScreenDeviceContext, NULL); // This hDC is inaccessible!
+ IntGdiSetDCOwnerEx(ScreenDeviceContext, GDI_OBJ_HMGR_PUBLIC, FALSE);
/* Setup the cursor */
co_IntLoadDefaultCursors();
+ hSystemBM = NtGdiCreateCompatibleDC(ScreenDeviceContext);
+
+ NtGdiSelectFont( hSystemBM, NtGdiGetStockObject(SYSTEM_FONT));
+ IntGdiSetDCOwnerEx( hSystemBM, GDI_OBJ_HMGR_PUBLIC, FALSE);
+
+ // FIXME! Move these to a update routine.
+ gpsi->Planes = NtGdiGetDeviceCaps(ScreenDeviceContext, PLANES);
+ gpsi->BitsPixel = NtGdiGetDeviceCaps(ScreenDeviceContext, BITSPIXEL);
+ gpsi->BitCount = gpsi->Planes * gpsi->BitsPixel;
+ gpsi->dmLogPixels = NtGdiGetDeviceCaps(ScreenDeviceContext, LOGPIXELSY);
+ // Font is realized and this dc was previously set to internal DC_ATTR.
+ gpsi->cxSysFontChar = IntGetCharDimensions(hSystemBM, &tmw, (DWORD*)&gpsi->cySysFontChar);
+ gpsi->tmSysFont = tmw;
+
return TRUE;
}
* @implemented
*/
-HWINSTA STDCALL
+HWINSTA APIENTRY
NtUserCreateWindowStation(
PUNICODE_STRING lpszWindowStationName,
ACCESS_MASK dwDesiredAccess,
DWORD Unknown5,
DWORD Unknown6)
{
- PSYSTEM_CURSORINFO CurInfo;
UNICODE_STRING WindowStationName;
UNICODE_STRING FullWindowStationName;
PWINSTATION_OBJECT WindowStationObject;
return 0;
}
+ /* Zero out the buffer */
+ RtlZeroMemory(WindowStationObject, sizeof(WINSTATION_OBJECT));
+
KeInitializeSpinLock(&WindowStationObject->Lock);
InitializeListHead(&WindowStationObject->DesktopListHead);
WindowStationObject->FlatMenu = FALSE;
- if(!(CurInfo = ExAllocatePool(PagedPool, sizeof(SYSTEM_CURSORINFO))))
- {
- ExFreePool(FullWindowStationName.Buffer);
- /* FIXME - Delete window station object */
- ObDereferenceObject(WindowStationObject);
- SetLastNtError(STATUS_INSUFFICIENT_RESOURCES);
- return 0;
- }
-
- CurInfo->Enabled = FALSE;
- CurInfo->ButtonsDown = 0;
- CurInfo->CursorClipInfo.IsClipped = FALSE;
- CurInfo->LastBtnDown = 0;
- CurInfo->CurrentCursorObject = NULL;
- CurInfo->ShowingCursor = 0;
-
- /* FIXME: Obtain the following information from the registry */
-
- CurInfo->WheelScroLines = 3;
- CurInfo->WheelScroChars = 3;
- CurInfo->SwapButtons = FALSE;
- CurInfo->DblClickSpeed = 500;
- CurInfo->DblClickWidth = 4;
- CurInfo->DblClickHeight = 4;
-
- CurInfo->MouseSpeed = 10;
- CurInfo->CursorAccelerationInfo.FirstThreshold = 6;
- CurInfo->CursorAccelerationInfo.SecondThreshold = 10;
- CurInfo->CursorAccelerationInfo.Acceleration = 1;
-
- CurInfo->MouseHoverTime = 80;
- CurInfo->MouseHoverWidth = 4;
- CurInfo->MouseHoverHeight = 4;
-
- WindowStationObject->ScreenSaverActive = FALSE;
- WindowStationObject->ScreenSaverTimeOut = 10;
- WindowStationObject->SystemCursor = CurInfo;
-
- /* END FIXME loading from register */
-
if (!IntSetupClipboard(WindowStationObject))
{
DPRINT1("WindowStation: Error Setting up the clipboard!!!\n");
}
- if (!IntSetupCurIconHandles(WindowStationObject))
+ if (InputWindowStation == NULL)
{
- DPRINT1("Setting up the Cursor/Icon Handle table failed!\n");
- /* FIXME: Complain more loudly? */
- ExFreePool(FullWindowStationName.Buffer);
+ InputWindowStation = WindowStationObject;
+
+ InitCursorImpl();
}
DPRINT("Window station successfully created (%wZ)\n", &FullWindowStationName);
* @implemented
*/
-HWINSTA STDCALL
+HWINSTA APIENTRY
NtUserOpenWindowStation(
PUNICODE_STRING lpszWindowStationName,
ACCESS_MASK dwDesiredAccess)
InitializeObjectAttributes(
&ObjectAttributes,
&WindowStationName,
- 0,
+ OBJ_CASE_INSENSITIVE,
NULL,
NULL);
Status = ObOpenObjectByName(
&ObjectAttributes,
ExWindowStationObjectType,
- UserMode,
+ KernelMode,
NULL,
dwDesiredAccess,
NULL,
*/
BOOL
-STDCALL
+APIENTRY
NtUserCloseWindowStation(
HWINSTA hWinSta)
{
DPRINT("About to close window station handle (0x%X)\n", hWinSta);
+ if (hWinSta == UserGetProcessWindowStation())
+ {
+ return FALSE;
+ }
+
Status = IntValidateWindowStationHandle(
hWinSta,
KernelMode,
return FALSE;
}
-#if 0
- /* FIXME - free the cursor information when actually deleting the object!! */
- ASSERT(Object->SystemCursor);
- ExFreePool(Object->SystemCursor);
-#endif
-
ObDereferenceObject(Object);
DPRINT("Closing window station handle (0x%X)\n", hWinSta);
* @unimplemented
*/
-BOOL STDCALL
+BOOL APIENTRY
NtUserGetObjectInformation(
HANDLE hObject,
DWORD nIndex,
PDWORD nLengthNeeded)
{
PWINSTATION_OBJECT WinStaObject = NULL;
- PDESKTOP_OBJECT DesktopObject = NULL;
+ PDESKTOP DesktopObject = NULL;
NTSTATUS Status;
PVOID pvData = NULL;
DWORD nDataSize = 0;
*/
BOOL
-STDCALL
+APIENTRY
NtUserSetObjectInformation(
HANDLE hObject,
DWORD nIndex,
UserGetProcessWindowStation(VOID)
{
NTSTATUS Status;
+ PTHREADINFO pti;
HWINSTA WinSta;
if(PsGetCurrentProcess() != CsrProcess)
else
{
DPRINT1("Should use ObFindHandleForObject\n");
- Status = ObOpenObjectByPointer(PsGetCurrentThreadWin32Thread()->Desktop->WindowStation,
+ pti = PsGetCurrentThreadWin32Thread();
+ Status = ObOpenObjectByPointer(pti->rpdesk->rpwinstaParent,
0,
NULL,
WINSTA_ALL_ACCESS,
* @implemented
*/
-HWINSTA STDCALL
+HWINSTA APIENTRY
NtUserGetProcessWindowStation(VOID)
{
return UserGetProcessWindowStation();
IntGetWinStaObj(VOID)
{
PWINSTATION_OBJECT WinStaObj;
+ PTHREADINFO Win32Thread;
+ PEPROCESS CurrentProcess;
/*
* just a temporary hack, this will be gone soon
*/
- if(PsGetCurrentThreadWin32Thread() != NULL && PsGetCurrentThreadWin32Thread()->Desktop != NULL)
+ Win32Thread = PsGetCurrentThreadWin32Thread();
+ if(Win32Thread != NULL && Win32Thread->rpdesk != NULL)
{
- WinStaObj = PsGetCurrentThreadWin32Thread()->Desktop->WindowStation;
+ WinStaObj = Win32Thread->rpdesk->rpwinstaParent;
ObReferenceObjectByPointer(WinStaObj, KernelMode, ExWindowStationObjectType, 0);
}
- else if(PsGetCurrentProcess() != CsrProcess)
+ else if((CurrentProcess = PsGetCurrentProcess()) != CsrProcess)
{
- NTSTATUS Status = IntValidateWindowStationHandle(PsGetCurrentProcess()->Win32WindowStation,
+ NTSTATUS Status = IntValidateWindowStationHandle(CurrentProcess->Win32WindowStation,
KernelMode,
0,
&WinStaObj);
* @implemented
*/
-BOOL STDCALL
+BOOL APIENTRY
NtUserSetProcessWindowStation(HWINSTA hWindowStation)
{
HANDLE hOld;
* @implemented
*/
-BOOL STDCALL
+BOOL APIENTRY
NtUserLockWindowStation(HWINSTA hWindowStation)
{
PWINSTATION_OBJECT Object;
* @implemented
*/
-BOOL STDCALL
+BOOL APIENTRY
NtUserUnlockWindowStation(HWINSTA hWindowStation)
{
PWINSTATION_OBJECT Object;
* @unimplemented
*/
-DWORD STDCALL
+DWORD APIENTRY
NtUserSetWindowStationUser(
DWORD Unknown0,
DWORD Unknown1,
FALSE, &Context, NULL))
{
/* Something went wrong, maybe someone added a directory entry? Just give up. */
- ExFreePool(Buffer);
+ ExFreePoolWithTag(Buffer, TAG_WINSTA);
ObDereferenceObject(DirectoryHandle);
return NT_SUCCESS(Status) ? STATUS_INTERNAL_ERROR : Status;
}
{
if (Buffer != InitialBuffer)
{
- ExFreePool(Buffer);
+ ExFreePoolWithTag(Buffer, TAG_WINSTA);
}
return STATUS_BUFFER_TOO_SMALL;
}
{
if (Buffer != InitialBuffer)
{
- ExFreePool(Buffer);
+ ExFreePoolWithTag(Buffer, TAG_WINSTA);
}
return STATUS_BUFFER_TOO_SMALL;
}
PWINSTATION_OBJECT WindowStation;
KIRQL OldLevel;
PLIST_ENTRY DesktopEntry;
- PDESKTOP_OBJECT DesktopObject;
+ PDESKTOP DesktopObject;
DWORD EntryCount;
ULONG ReturnLength;
WCHAR NullWchar;
DesktopEntry != &WindowStation->DesktopListHead;
DesktopEntry = DesktopEntry->Flink)
{
- DesktopObject = CONTAINING_RECORD(DesktopEntry, DESKTOP_OBJECT, ListEntry);
+ DesktopObject = CONTAINING_RECORD(DesktopEntry, DESKTOP, ListEntry);
ReturnLength += ((PUNICODE_STRING)GET_DESKTOP_NAME(DesktopObject))->Length + sizeof(WCHAR);
EntryCount++;
}
DesktopEntry != &WindowStation->DesktopListHead;
DesktopEntry = DesktopEntry->Flink)
{
- DesktopObject = CONTAINING_RECORD(DesktopEntry, DESKTOP_OBJECT, ListEntry);
+ DesktopObject = CONTAINING_RECORD(DesktopEntry, DESKTOP, ListEntry);
Status = MmCopyToCaller(lpBuffer, ((PUNICODE_STRING)GET_DESKTOP_NAME(DesktopObject))->Buffer, ((PUNICODE_STRING)GET_DESKTOP_NAME(DesktopObject))->Length);
if (! NT_SUCCESS(Status))
{
* @implemented
*/
-NTSTATUS STDCALL
+NTSTATUS APIENTRY
NtUserBuildNameList(
HWINSTA hWindowStation,
ULONG dwSize,