Compare commits

...

25 Commits

Author SHA1 Message Date
Brandon Turner
9173e96e7d change to "RELEASE"
svn path=/branches/ros-branch-0_2_8/; revision=18832
2005-10-28 14:23:48 +00:00
Andrew Munger
fb29985637 Disable patented bytecode interpreter, will investigate the non-patented configuration.
svn path=/branches/ros-branch-0_2_8/; revision=18774
2005-10-25 18:08:13 +00:00
Brandon Turner
c41f403a21 Changed to RC2
svn path=/branches/ros-branch-0_2_8/; revision=18761
2005-10-24 21:42:24 +00:00
Gé van Geldorp
c22faedfdb Can't have a release without WineMine:
Add resource file, makes winemine playable again

svn path=/branches/ros-branch-0_2_8/; revision=18706
2005-10-23 13:11:31 +00:00
Gé van Geldorp
940e95f578 Merge from trunk:
Don't issue KBD_LINE_TEST, the results are unreliable. Fixes reopen of #688.

svn path=/branches/ros-branch-0_2_8/; revision=18700
2005-10-23 11:33:45 +00:00
Gé van Geldorp
2816fa8ad0 Merge from trunk:
Use MaxPos instead of MaxTrackingPos when "restoring" a window which was
previously maximized. Fixes bug 925.

svn path=/branches/ros-branch-0_2_8/; revision=18680
2005-10-22 15:19:01 +00:00
Gé van Geldorp
3b88890780 Merge from trunk.
Fix icon alignment when the screen width is not a multiple of the icon spacing.
Fixes bug 912.

svn path=/branches/ros-branch-0_2_8/; revision=18674
2005-10-22 12:11:42 +00:00
Gé van Geldorp
4e8b37f268 Merge from trunk.
Make FindWindow case insensitive. Fixes bug 919.

svn path=/branches/ros-branch-0_2_8/; revision=18667
2005-10-21 21:16:36 +00:00
Gé van Geldorp
38e712904d Merge from trunk.
- Enable/disable keyboard by writing the controller command byte instead of
  issuing keyboard commands, the keyboard commands seem to confuse some kvm
  switches.
- Use STATUS_IO_TIMEOUT consistently, STATUS_TIMEOUT is not an error condition
- Introduce symbolic constants for controller command byte bits
- Try to detect mouse early and if its not present, reset the keyboard
  controller. Some controllers seem to get locked up when writing to a
  non-present mouse.
- Don't check the timeout status bit when reading from the controller. It is
  often wrong.
- Don't treat failure to read keyboard id as a fatal error, we only read it
  to set KeyboardIsAT which we then don't use. Still try to detect the keyboard
  type, but don't fail if it doesn't work.
Fixes bug 688. Thanks to Hartmut, Filip and WaxDragon for testing.

svn path=/branches/ros-branch-0_2_8/; revision=18665
2005-10-21 20:31:59 +00:00
Gé van Geldorp
cbbc54397d Revert r18662, trunk and branch already diverged
svn path=/branches/ros-branch-0_2_8/; revision=18663
2005-10-21 19:45:28 +00:00
Gé van Geldorp
3c5b8f62ce Merge from trunk: Make desktop properties fit in 640x480 desktop
svn path=/branches/ros-branch-0_2_8/; revision=18662
2005-10-21 19:33:16 +00:00
Gé van Geldorp
076872ae0a Merge from trunk. Martijn Vernooij <o112w8r02@sneakemail.com>
Work around continuous repainting of treeview control.
Fixes bug 493.

svn path=/branches/ros-branch-0_2_8/; revision=18658
2005-10-21 17:16:46 +00:00
Gé van Geldorp
1d110cfd34 Merge from trunk.
Patch by hardon. Properly handle 0 timeouts. Fixes bug 857.

svn path=/branches/ros-branch-0_2_8/; revision=18537
2005-10-17 22:09:18 +00:00
Gé van Geldorp
b49ba945d0 Merge from trunk.
Everything must come to an end, even the desktop window. Fixes bug 805.

svn path=/branches/ros-branch-0_2_8/; revision=18535
2005-10-17 22:00:42 +00:00
Gé van Geldorp
5f8cac6653 Merge from trunk.
Inform HAL about the switch to graphics modeas late as possible. Fixes bug 880.

svn path=/branches/ros-branch-0_2_8/; revision=18533
2005-10-17 21:48:12 +00:00
Hartmut Birr
7ed77ada75 Merge from trunk.
Don't use alloca in a macro, which may be used in a loop. This does fix bug #805.

svn path=/branches/ros-branch-0_2_8/; revision=18482
2005-10-15 14:26:53 +00:00
Gé van Geldorp
fd1eddbc07 Merge from trunk.
Make sure we don't hang forever when activating a window belonging to
another thread

svn path=/branches/ros-branch-0_2_8/; revision=18469
2005-10-15 09:55:46 +00:00
Gé van Geldorp
0cefb2734c Merge from trunk. Goplat <mrnobo1024@yahoo.com>:
SetPixel should return the new color. Bug 909.

svn path=/branches/ros-branch-0_2_8/; revision=18451
2005-10-14 18:35:05 +00:00
Gé van Geldorp
e0c4931114 Merge from trunk. tsk <tsk_n@mail.goo.ne.jp>:
UsageMessage is a printf format string.

svn path=/branches/ros-branch-0_2_8/; revision=18440
2005-10-14 09:44:48 +00:00
Gé van Geldorp
667d6e07eb Merge from trunk:
Don't install Winefile icon on desktop, it's already present in the start menu

svn path=/branches/ros-branch-0_2_8/; revision=18438
2005-10-14 09:34:15 +00:00
Gé van Geldorp
7614c174b6 Merge from trunk. Mike <mikeonthecomputer@gmail.com>:
Add installation path for VMware 5.5. Fixes bug 907.

svn path=/branches/ros-branch-0_2_8/; revision=18436
2005-10-14 09:27:30 +00:00
Robert Kopferl
1ed2391c2f preparations for Ros 0.2.8-RC1
svn path=/branches/ros-branch-0_2_8/; revision=18434
2005-10-14 00:03:27 +00:00
Gé van Geldorp
92697d6768 Merge from trunk:
Use the pitch provided by FreeType. Fixes bug 894.

svn path=/branches/ros-branch-0_2_8/; revision=18432
2005-10-13 18:43:49 +00:00
Gé van Geldorp
1bc7e5d407 Send window-bound timers to the correctmessage queue
svn path=/branches/ros-branch-0_2_8/; revision=18421
2005-10-13 07:35:48 +00:00
Gé van Geldorp
5ddd8d5749 Workaround for bug 899
svn path=/branches/ros-branch-0_2_8/; revision=18420
2005-10-13 07:35:19 +00:00
35 changed files with 575 additions and 225 deletions

View File

@@ -42,4 +42,4 @@
Whether to compile for debugging. No compiler optimizations will be Whether to compile for debugging. No compiler optimizations will be
performed. performed.
--> -->
<property name="DBG" value="1" /> <property name="DBG" value="0" />

View File

@@ -10,9 +10,7 @@
/* INCLUDES ****************************************************************/ /* INCLUDES ****************************************************************/
#ifndef NDEBUG
#define NDEBUG #define NDEBUG
#endif
#include <debug.h> #include <debug.h>
#include "i8042prt.h" #include "i8042prt.h"
@@ -78,7 +76,7 @@ NTSTATUS I8042ReadData(UCHAR *Data)
DPRINT("Read: %x (status: %x)\n", Data[0], Status); DPRINT("Read: %x (status: %x)\n", Data[0], Status);
// If the data is valid (not timeout, not parity error) // If the data is valid (not timeout, not parity error)
if (0 == (Status & (KBD_GTO | KBD_PERR))) if (0 == (Status & KBD_PERR))
return STATUS_SUCCESS; return STATUS_SUCCESS;
} }
return STATUS_UNSUCCESSFUL; return STATUS_UNSUCCESSFUL;
@@ -115,7 +113,7 @@ VOID I8042Flush()
UCHAR Ignore; UCHAR Ignore;
while (STATUS_SUCCESS == I8042ReadData(&Ignore)) { while (STATUS_SUCCESS == I8042ReadData(&Ignore)) {
; /* drop */ DPRINT("Data flushed\n"); /* drop */
} }
} }
@@ -146,25 +144,38 @@ NTSTATUS STDCALL I8042SynchWritePort(PDEVICE_EXTENSION DevExt,
do { do {
if (Port) if (Port)
if (!I8042Write(DevExt, I8042_DATA_PORT, Port)) if (!I8042Write(DevExt, I8042_DATA_PORT, Port))
return STATUS_TIMEOUT; {
DPRINT1("Failed to write Port\n");
return STATUS_IO_TIMEOUT;
}
if (!I8042Write(DevExt, I8042_DATA_PORT, Value)) if (!I8042Write(DevExt, I8042_DATA_PORT, Value))
return STATUS_TIMEOUT; {
DPRINT1("Failed to write Value\n");
return STATUS_IO_TIMEOUT;
}
if (WaitForAck) { if (WaitForAck) {
Status = I8042ReadDataWait(DevExt, &Ack); Status = I8042ReadDataWait(DevExt, &Ack);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{
DPRINT1("Failed to read Ack\n");
return Status; return Status;
}
if (Ack == KBD_ACK) if (Ack == KBD_ACK)
return STATUS_SUCCESS; return STATUS_SUCCESS;
if (Ack != KBD_RESEND) if (Ack != KBD_RESEND)
{
DPRINT1("Unexpected Ack 0x%x\n", Ack);
return STATUS_UNEXPECTED_IO_ERROR; return STATUS_UNEXPECTED_IO_ERROR;
}
} else { } else {
return STATUS_SUCCESS; return STATUS_SUCCESS;
} }
DPRINT("Reiterating\n");
ResendIterations--; ResendIterations--;
} while (ResendIterations); } while (ResendIterations);
return STATUS_TIMEOUT; return STATUS_IO_TIMEOUT;
} }
/* /*
@@ -241,7 +252,7 @@ NTSTATUS STDCALL I8042StartPacket(PDEVICE_EXTENSION DevExt,
DevExt->PacketPort = 0; DevExt->PacketPort = 0;
if (!I8042PacketWrite(DevExt)) { if (!I8042PacketWrite(DevExt)) {
Status = STATUS_TIMEOUT; Status = STATUS_IO_TIMEOUT;
DevExt->Packet.State = Idle; DevExt->Packet.State = Idle;
DevExt->PacketResult = STATUS_ABANDONED; DevExt->PacketResult = STATUS_ABANDONED;
goto startpacketdone; goto startpacketdone;
@@ -273,7 +284,7 @@ BOOLEAN STDCALL I8042PacketIsr(PDEVICE_EXTENSION DevExt,
if (DevExt->PacketResends > DevExt->Settings.ResendIterations) { if (DevExt->PacketResends > DevExt->Settings.ResendIterations) {
DevExt->Packet.State = Idle; DevExt->Packet.State = Idle;
DevExt->PacketComplete = TRUE; DevExt->PacketComplete = TRUE;
DevExt->PacketResult = STATUS_TIMEOUT; DevExt->PacketResult = STATUS_IO_TIMEOUT;
DevExt->PacketResends = 0; DevExt->PacketResends = 0;
return TRUE; return TRUE;
} }
@@ -301,7 +312,7 @@ BOOLEAN STDCALL I8042PacketIsr(PDEVICE_EXTENSION DevExt,
if (!I8042PacketWrite(DevExt)) { if (!I8042PacketWrite(DevExt)) {
DevExt->Packet.State = Idle; DevExt->Packet.State = Idle;
DevExt->PacketComplete = TRUE; DevExt->PacketComplete = TRUE;
DevExt->PacketResult = STATUS_TIMEOUT; DevExt->PacketResult = STATUS_IO_TIMEOUT;
return TRUE; return TRUE;
} }
DevExt->Packet.CurrentByte++; DevExt->Packet.CurrentByte++;
@@ -519,30 +530,60 @@ static NTSTATUS STDCALL I8042BasicDetect(PDEVICE_EXTENSION DevExt)
I8042Flush(); I8042Flush();
if (!I8042Write(DevExt, I8042_CTRL_PORT, KBD_SELF_TEST)) if (!I8042Write(DevExt, I8042_CTRL_PORT, KBD_SELF_TEST)) {
return STATUS_TIMEOUT; DPRINT1("Writing KBD_SELF_TEST command failed\n");
return STATUS_IO_TIMEOUT;
}
// Wait longer? // Wait longer?
Counter = 3; Counter = 3;
do { do {
Status = I8042ReadDataWait(DevExt, &Value); Status = I8042ReadDataWait(DevExt, &Value);
} while ((Counter--) && (STATUS_TIMEOUT == Status)); } while ((Counter--) && (STATUS_IO_TIMEOUT == Status));
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status)) {
DPRINT1("Failed to read KBD_SELF_TEST response, status 0x%x\n",
Status);
return Status; return Status;
}
if (Value != 0x55) { if (Value != 0x55) {
DPRINT1("Got %x instead of 55\n", Value); DPRINT1("Got %x instead of 55\n", Value);
return STATUS_IO_DEVICE_ERROR; return STATUS_IO_DEVICE_ERROR;
} }
if (I8042Write(DevExt, I8042_CTRL_PORT, KBD_LINE_TEST)) if (!I8042Write(DevExt, I8042_CTRL_PORT, KBD_READ_MODE)) {
{ DPRINT1("Can't read i8042 mode\n");
Status = I8042ReadDataWait(DevExt, &Value); return FALSE;
if (NT_SUCCESS(Status) && Value == 0)
DevExt->KeyboardExists = TRUE;
} }
Status = I8042ReadDataWait(DevExt, &Value);
if (!NT_SUCCESS(Status)) {
DPRINT1("No response after read i8042 mode\n");
return FALSE;
}
Value |= CCB_KBD_DISAB | CCB_MOUSE_DISAB; /* disable keyboard/mouse */
Value &= ~(CCB_KBD_INT_ENAB | CCB_MOUSE_INT_ENAB);
/* don't enable keyboard and mouse interrupts */
if (!I8042Write(DevExt, I8042_CTRL_PORT, KBD_WRITE_MODE)) {
DPRINT1("Can't set i8042 mode\n");
return FALSE;
}
if (!I8042Write(DevExt, I8042_DATA_PORT, Value)) {
DPRINT1("Can't send i8042 mode\n");
return FALSE;
}
/*
* We used to send a KBD_LINE_TEST command here, but on at least HP
* Pavilion notebooks the response to that command was incorrect.
* So now we just assume that a keyboard is attached.
*/
DevExt->KeyboardExists = TRUE;
if (I8042Write(DevExt, I8042_CTRL_PORT, MOUSE_LINE_TEST)) if (I8042Write(DevExt, I8042_CTRL_PORT, MOUSE_LINE_TEST))
{ {
Status = I8042ReadDataWait(DevExt, &Value); Status = I8042ReadDataWait(DevExt, &Value);
@@ -563,6 +604,11 @@ static NTSTATUS STDCALL I8042Initialize(PDEVICE_EXTENSION DevExt)
return Status; return Status;
} }
if (DevExt->MouseExists) {
DPRINT("Aux port detected\n");
DevExt->MouseExists = I8042DetectMouse(DevExt);
}
if (!DevExt->KeyboardExists) { if (!DevExt->KeyboardExists) {
DPRINT("Keyboard port not detected\n"); DPRINT("Keyboard port not detected\n");
if (DevExt->Settings.Headless) if (DevExt->Settings.Headless)
@@ -820,4 +866,3 @@ NTSTATUS STDCALL DriverEntry(PDRIVER_OBJECT DriverObject,
return(STATUS_SUCCESS); return(STATUS_SUCCESS);
} }

View File

@@ -246,6 +246,17 @@ typedef struct _I8042_HOOK_WORKITEM
#define KBD_GTO 0x40 #define KBD_GTO 0x40
#define KBD_PERR 0x80 #define KBD_PERR 0x80
/*
* Controller command byte bits
*/
#define CCB_KBD_INT_ENAB 0x01
#define CCB_MOUSE_INT_ENAB 0x02
#define CCB_SYSTEM_FLAG 0x04
#define CCB_IGN_KEY_LOCK 0x08
#define CCB_KBD_DISAB 0x10
#define CCB_MOUSE_DISAB 0x20
#define CCB_TRANSLATE 0x40
/* /*
* LED bits * LED bits
@@ -359,6 +370,7 @@ VOID STDCALL I8042MouseHandle(PDEVICE_EXTENSION DevExt,
BOOLEAN STDCALL I8042MouseEnable(PDEVICE_EXTENSION DevExt); BOOLEAN STDCALL I8042MouseEnable(PDEVICE_EXTENSION DevExt);
BOOLEAN STDCALL I8042MouseDisable(PDEVICE_EXTENSION DevExt); BOOLEAN STDCALL I8042MouseDisable(PDEVICE_EXTENSION DevExt);
BOOLEAN STDCALL I8042DetectMouse(PDEVICE_EXTENSION DevExt);
/* ps2pp.c */ /* ps2pp.c */
VOID I8042MouseHandlePs2pp(PDEVICE_EXTENSION DevExt, UCHAR Input); VOID I8042MouseHandlePs2pp(PDEVICE_EXTENSION DevExt, UCHAR Input);

View File

@@ -11,13 +11,11 @@
/* INCLUDES ****************************************************************/ /* INCLUDES ****************************************************************/
#ifndef NDEBUG
#define NDEBUG
#endif
#include <debug.h>
#include "i8042prt.h" #include "i8042prt.h"
#define NDEBUG
#include <debug.h>
/* GLOBALS *******************************************************************/ /* GLOBALS *******************************************************************/
static UCHAR TypematicTable[] = { static UCHAR TypematicTable[] = {
@@ -559,34 +557,73 @@ intcontfailure:
* some really old broken keyboard controllers which I hope won't be * some really old broken keyboard controllers which I hope won't be
* necessary. * necessary.
* *
* Anyway, disabling the keyboard helps the detection and it also * We change the command byte, sending KBD_ENABLE/DISABLE seems to confuse
* clears the keyboard buffer and sets defaults which is what we * some kvm switches.
* want.
*/ */
BOOLEAN STDCALL I8042KeyboardEnable(PDEVICE_EXTENSION DevExt) BOOLEAN STDCALL I8042KeyboardEnable(PDEVICE_EXTENSION DevExt)
{ {
DPRINT("Enabling keyboard\n"); UCHAR Value;
if (STATUS_SUCCESS != I8042SynchWritePort(DevExt, NTSTATUS Status;
0,
KBD_ENABLE, DPRINT("Enable keyboard\n");
TRUE)) {
DPRINT("Can't enable keyboard\n"); if (!I8042Write(DevExt, I8042_CTRL_PORT, KBD_READ_MODE)) {
DPRINT1("Can't read i8042 mode\n");
return FALSE; return FALSE;
} }
Status = I8042ReadDataWait(DevExt, &Value);
if (!NT_SUCCESS(Status)) {
DPRINT1("No response after read i8042 mode\n");
return FALSE;
}
Value &= ~CCB_KBD_DISAB; // don't disable keyboard
if (!I8042Write(DevExt, I8042_CTRL_PORT, KBD_WRITE_MODE)) {
DPRINT1("Can't set i8042 mode\n");
return FALSE;
}
if (!I8042Write(DevExt, I8042_DATA_PORT, Value)) {
DPRINT1("Can't send i8042 mode\n");
return FALSE;
}
return TRUE; return TRUE;
} }
static BOOLEAN STDCALL I8042KeyboardDefaultsAndDisable(PDEVICE_EXTENSION DevExt) static BOOLEAN STDCALL I8042KeyboardDefaultsAndDisable(PDEVICE_EXTENSION DevExt)
{ {
UCHAR Value;
NTSTATUS Status;
DPRINT("Disabling keyboard\n"); DPRINT("Disabling keyboard\n");
if (STATUS_SUCCESS != I8042SynchWritePort(DevExt,
0, if (!I8042Write(DevExt, I8042_CTRL_PORT, KBD_READ_MODE)) {
KBD_DISABLE, DPRINT1("Can't read i8042 mode\n");
TRUE)) {
DPRINT("Can't disable keyboard\n");
return FALSE; return FALSE;
} }
Status = I8042ReadDataWait(DevExt, &Value);
if (!NT_SUCCESS(Status)) {
DPRINT1("No response after read i8042 mode\n");
return FALSE;
}
Value |= CCB_KBD_DISAB; // disable keyboard
if (!I8042Write(DevExt, I8042_CTRL_PORT, KBD_WRITE_MODE)) {
DPRINT1("Can't set i8042 mode\n");
return FALSE;
}
if (!I8042Write(DevExt, I8042_DATA_PORT, Value)) {
DPRINT1("Can't send i8042 mode\n");
return FALSE;
}
return TRUE; return TRUE;
} }
@@ -608,8 +645,8 @@ BOOLEAN STDCALL I8042KeyboardEnableInterrupt(PDEVICE_EXTENSION DevExt)
return FALSE; return FALSE;
} }
Value &= ~(0x10); // don't disable keyboard Value &= ~CCB_KBD_DISAB; // don't disable keyboard
Value |= 0x01; // enable keyboard interrupts Value |= CCB_KBD_INT_ENAB; // enable keyboard interrupts
if (!I8042Write(DevExt, I8042_CTRL_PORT, KBD_WRITE_MODE)) { if (!I8042Write(DevExt, I8042_CTRL_PORT, KBD_WRITE_MODE)) {
DPRINT1("Can't set i8042 mode\n"); DPRINT1("Can't set i8042 mode\n");
@@ -628,6 +665,7 @@ BOOLEAN STDCALL I8042DetectKeyboard(PDEVICE_EXTENSION DevExt)
{ {
NTSTATUS Status; NTSTATUS Status;
UCHAR Value; UCHAR Value;
UCHAR Value2;
ULONG RetryCount = 10; ULONG RetryCount = 10;
DPRINT("Detecting keyboard\n"); DPRINT("Detecting keyboard\n");
@@ -635,12 +673,15 @@ BOOLEAN STDCALL I8042DetectKeyboard(PDEVICE_EXTENSION DevExt)
I8042KeyboardDefaultsAndDisable(DevExt); I8042KeyboardDefaultsAndDisable(DevExt);
do { do {
I8042Flush();
Status = I8042SynchWritePort(DevExt, 0, KBD_GET_ID, TRUE); Status = I8042SynchWritePort(DevExt, 0, KBD_GET_ID, TRUE);
} while (STATUS_TIMEOUT == Status && RetryCount--); } while (STATUS_IO_TIMEOUT == Status && RetryCount--);
if (!NT_SUCCESS(Status)) { if (!NT_SUCCESS(Status)) {
DPRINT1("Can't write GET_ID (%x)\n", Status); DPRINT1("Can't write GET_ID (%x)\n", Status);
return FALSE; /* Could be an AT keyboard */
DevExt->KeyboardIsAT = TRUE;
goto detectsetleds;
} }
Status = I8042ReadDataWait(DevExt, &Value); Status = I8042ReadDataWait(DevExt, &Value);
@@ -658,17 +699,17 @@ BOOLEAN STDCALL I8042DetectKeyboard(PDEVICE_EXTENSION DevExt)
return FALSE; return FALSE;
} }
DPRINT("Keyboard ID: %x", Value); Status = I8042ReadDataWait(DevExt, &Value2);
Status = I8042ReadDataWait(DevExt, &Value);
if (!NT_SUCCESS(Status)) { if (!NT_SUCCESS(Status)) {
DPRINT("Partial ID\n"); DPRINT("Partial ID\n");
return FALSE; return FALSE;
} }
DPRINT ("%x\n", Value); DPRINT("Keyboard ID: 0x%x 0x%x\n", Value, Value2);
detectsetleds: detectsetleds:
I8042Flush(); /* Flush any bytes left over from GET_ID */
Status = I8042SynchWritePort(DevExt, 0, KBD_SET_LEDS, TRUE); Status = I8042SynchWritePort(DevExt, 0, KBD_SET_LEDS, TRUE);
if (!NT_SUCCESS(Status)) { if (!NT_SUCCESS(Status)) {
DPRINT("Can't write SET_LEDS (%x)\n", Status); DPRINT("Can't write SET_LEDS (%x)\n", Status);

View File

@@ -11,13 +11,11 @@
/* INCLUDES ****************************************************************/ /* INCLUDES ****************************************************************/
#ifndef NDEBUG
#define NDEBUG
#endif
#include <debug.h>
#include "i8042prt.h" #include "i8042prt.h"
#define NDEBUG
#include <debug.h>
/* /*
* These functions are callbacks for filter driver custom interrupt * These functions are callbacks for filter driver custom interrupt
* service routines. * service routines.
@@ -897,3 +895,54 @@ BOOLEAN STDCALL I8042MouseDisable(PDEVICE_EXTENSION DevExt)
return TRUE; return TRUE;
} }
BOOLEAN STDCALL I8042DetectMouse(PDEVICE_EXTENSION DevExt)
{
BOOLEAN Ok = TRUE;
NTSTATUS Status;
UCHAR Value;
UCHAR ExpectedReply[] = { 0xFA, 0xAA, 0x00 };
unsigned ReplyByte;
if (! I8042Write(DevExt, I8042_CTRL_PORT, 0xD4) ||
! I8042Write(DevExt, I8042_DATA_PORT, 0xFF))
{
DPRINT1("Failed to write reset command to mouse\n");
Ok = FALSE;
}
for (ReplyByte = 0;
ReplyByte < sizeof(ExpectedReply) / sizeof(ExpectedReply[0]) && Ok;
ReplyByte++)
{
Status = I8042ReadDataWait(DevExt, &Value);
if (! NT_SUCCESS(Status))
{
DPRINT1("No ACK after mouse reset, status 0x%08x\n",
Status);
Ok = FALSE;
}
else if (Value != ExpectedReply[ReplyByte])
{
DPRINT1("Unexpected reply: 0x%02x (expected 0x%02x)\n",
Value, ExpectedReply[ReplyByte]);
Ok = FALSE;
}
}
if (! Ok)
{
/* There is probably no mouse present. On some systems,
the probe locks the entire keyboard controller. Let's
try to get access to the keyboard again by sending a
reset */
I8042Flush();
I8042Write(DevExt, I8042_CTRL_PORT, KBD_SELF_TEST);
I8042ReadDataWait(DevExt, &Value);
I8042Flush();
}
DPRINT("Mouse %sdetected\n", Ok ? "" : "not ");
return Ok;
}

View File

@@ -51,25 +51,28 @@ static VOID ZeroEvents( PAFD_HANDLE HandleArray,
HandleArray[i].Status = 0; HandleArray[i].Status = 0;
} }
static VOID RemoveSelect( PAFD_ACTIVE_POLL Poll ) {
AFD_DbgPrint(MID_TRACE,("Called\n"));
RemoveEntryList( &Poll->ListEntry ); /* you must pass either Poll OR Irp */
KeCancelTimer( &Poll->Timer ); static VOID SignalSocket(
PAFD_ACTIVE_POLL Poll OPTIONAL,
ExFreePool( Poll ); PIRP _Irp OPTIONAL,
PAFD_POLL_INFO PollReq,
AFD_DbgPrint(MID_TRACE,("Done\n")); NTSTATUS Status
} )
{
static VOID SignalSocket( PAFD_ACTIVE_POLL Poll, PAFD_POLL_INFO PollReq,
NTSTATUS Status ) {
UINT i; UINT i;
PIRP Irp = Poll->Irp; PIRP Irp = _Irp ? _Irp : Poll->Irp;
AFD_DbgPrint(MID_TRACE,("Called (Status %x)\n", Status)); AFD_DbgPrint(MID_TRACE,("Called (Status %x)\n", Status));
KeCancelTimer( &Poll->Timer );
Poll->Irp->IoStatus.Status = Status; if (Poll)
Poll->Irp->IoStatus.Information = {
KeCancelTimer( &Poll->Timer );
RemoveEntryList( &Poll->ListEntry );
ExFreePool( Poll );
}
Irp->IoStatus.Status = Status;
Irp->IoStatus.Information =
FIELD_OFFSET(AFD_POLL_INFO, Handles) + sizeof(AFD_HANDLE) * PollReq->HandleCount; FIELD_OFFSET(AFD_POLL_INFO, Handles) + sizeof(AFD_HANDLE) * PollReq->HandleCount;
CopyBackStatus( PollReq->Handles, CopyBackStatus( PollReq->Handles,
PollReq->HandleCount ); PollReq->HandleCount );
@@ -84,8 +87,6 @@ static VOID SignalSocket( PAFD_ACTIVE_POLL Poll, PAFD_POLL_INFO PollReq,
UnlockHandles( AFD_HANDLES(PollReq), PollReq->HandleCount ); UnlockHandles( AFD_HANDLES(PollReq), PollReq->HandleCount );
AFD_DbgPrint(MID_TRACE,("Completing\n")); AFD_DbgPrint(MID_TRACE,("Completing\n"));
IoCompleteRequest( Irp, IO_NETWORK_INCREMENT ); IoCompleteRequest( Irp, IO_NETWORK_INCREMENT );
RemoveEntryList( &Poll->ListEntry );
RemoveSelect( Poll );
AFD_DbgPrint(MID_TRACE,("Done\n")); AFD_DbgPrint(MID_TRACE,("Done\n"));
} }
@@ -108,7 +109,7 @@ static VOID SelectTimeout( PKDPC Dpc,
ZeroEvents( PollReq->Handles, PollReq->HandleCount ); ZeroEvents( PollReq->Handles, PollReq->HandleCount );
KeAcquireSpinLock( &DeviceExt->Lock, &OldIrql ); KeAcquireSpinLock( &DeviceExt->Lock, &OldIrql );
SignalSocket( Poll, PollReq, STATUS_TIMEOUT ); SignalSocket( Poll, NULL, PollReq, STATUS_TIMEOUT );
KeReleaseSpinLock( &DeviceExt->Lock, OldIrql ); KeReleaseSpinLock( &DeviceExt->Lock, OldIrql );
AFD_DbgPrint(MID_TRACE,("Timeout\n")); AFD_DbgPrint(MID_TRACE,("Timeout\n"));
@@ -143,7 +144,7 @@ VOID KillSelectsForFCB( PAFD_DEVICE_EXTENSION DeviceExt,
if( (PVOID)HandleArray[i].Handle == FileObject && if( (PVOID)HandleArray[i].Handle == FileObject &&
(!OnlyExclusive || (OnlyExclusive && Poll->Exclusive)) ) { (!OnlyExclusive || (OnlyExclusive && Poll->Exclusive)) ) {
ZeroEvents( PollReq->Handles, PollReq->HandleCount ); ZeroEvents( PollReq->Handles, PollReq->HandleCount );
SignalSocket( Poll, PollReq, STATUS_SUCCESS ); SignalSocket( Poll, NULL, PollReq, STATUS_SUCCESS );
} }
} }
} }
@@ -161,7 +162,6 @@ AfdSelect( PDEVICE_OBJECT DeviceObject, PIRP Irp,
PFILE_OBJECT FileObject; PFILE_OBJECT FileObject;
PAFD_POLL_INFO PollReq = Irp->AssociatedIrp.SystemBuffer; PAFD_POLL_INFO PollReq = Irp->AssociatedIrp.SystemBuffer;
PAFD_DEVICE_EXTENSION DeviceExt = DeviceObject->DeviceExtension; PAFD_DEVICE_EXTENSION DeviceExt = DeviceObject->DeviceExtension;
PAFD_ACTIVE_POLL Poll = NULL;
UINT CopySize = IrpSp->Parameters.DeviceIoControl.InputBufferLength; UINT CopySize = IrpSp->Parameters.DeviceIoControl.InputBufferLength;
UINT AllocSize = UINT AllocSize =
CopySize + sizeof(AFD_ACTIVE_POLL) - sizeof(AFD_POLL_INFO); CopySize + sizeof(AFD_ACTIVE_POLL) - sizeof(AFD_POLL_INFO);
@@ -196,22 +196,7 @@ AfdSelect( PDEVICE_OBJECT DeviceObject, PIRP Irp,
ZeroEvents( PollReq->Handles, ZeroEvents( PollReq->Handles,
PollReq->HandleCount ); PollReq->HandleCount );
Poll = ExAllocatePool( NonPagedPool, AllocSize );
if( Poll ) {
Poll->Irp = Irp;
Poll->DeviceExt = DeviceExt;
Poll->Exclusive = Exclusive;
KeInitializeTimerEx( &Poll->Timer, NotificationTimer );
KeSetTimer( &Poll->Timer, PollReq->Timeout, &Poll->TimeoutDpc );
KeInitializeDpc( (PRKDPC)&Poll->TimeoutDpc,
(PKDEFERRED_ROUTINE)SelectTimeout,
Poll );
KeAcquireSpinLock( &DeviceExt->Lock, &OldIrql ); KeAcquireSpinLock( &DeviceExt->Lock, &OldIrql );
InsertTailList( &DeviceExt->Polls, &Poll->ListEntry );
for( i = 0; i < PollReq->HandleCount; i++ ) { for( i = 0; i < PollReq->HandleCount; i++ ) {
if( !AFD_HANDLES(PollReq)[i].Handle ) continue; if( !AFD_HANDLES(PollReq)[i].Handle ) continue;
@@ -243,14 +228,37 @@ AfdSelect( PDEVICE_OBJECT DeviceObject, PIRP Irp,
if( Signalled ) { if( Signalled ) {
Status = STATUS_SUCCESS; Status = STATUS_SUCCESS;
Irp->IoStatus.Status = Status; Irp->IoStatus.Status = Status;
SignalSocket( Poll, PollReq, Status ); SignalSocket( NULL, Irp, PollReq, Status );
} else { } else {
Status = STATUS_PENDING;
IoMarkIrpPending( Irp ); PAFD_ACTIVE_POLL Poll = NULL;
Poll = ExAllocatePool( NonPagedPool, AllocSize );
if (Poll){
Poll->Irp = Irp;
Poll->DeviceExt = DeviceExt;
Poll->Exclusive = Exclusive;
KeInitializeTimerEx( &Poll->Timer, NotificationTimer );
KeInitializeDpc( (PRKDPC)&Poll->TimeoutDpc,
(PKDEFERRED_ROUTINE)SelectTimeout,
Poll );
InsertTailList( &DeviceExt->Polls, &Poll->ListEntry );
KeSetTimer( &Poll->Timer, PollReq->Timeout, &Poll->TimeoutDpc );
Status = STATUS_PENDING;
IoMarkIrpPending( Irp );
} else {
AFD_DbgPrint(MAX_TRACE, ("FIXME: do something with the IRP!\n"));
Status = STATUS_NO_MEMORY;
}
} }
KeReleaseSpinLock( &DeviceExt->Lock, OldIrql ); KeReleaseSpinLock( &DeviceExt->Lock, OldIrql );
} else Status = STATUS_NO_MEMORY;
AFD_DbgPrint(MID_TRACE,("Returning %x\n", Status)); AFD_DbgPrint(MID_TRACE,("Returning %x\n", Status));
@@ -400,7 +408,7 @@ VOID PollReeval( PAFD_DEVICE_EXTENSION DeviceExt, PFILE_OBJECT FileObject ) {
if( UpdatePollWithFCB( Poll, FileObject ) ) { if( UpdatePollWithFCB( Poll, FileObject ) ) {
ThePollEnt = ThePollEnt->Flink; ThePollEnt = ThePollEnt->Flink;
AFD_DbgPrint(MID_TRACE,("Signalling socket\n")); AFD_DbgPrint(MID_TRACE,("Signalling socket\n"));
SignalSocket( Poll, PollReq, STATUS_SUCCESS ); SignalSocket( Poll, NULL, PollReq, STATUS_SUCCESS );
} else } else
ThePollEnt = ThePollEnt->Flink; ThePollEnt = ThePollEnt->Flink;
} }

View File

@@ -18,7 +18,6 @@
* If not, write to the Free Software Foundation, * If not, write to the Free Software Foundation,
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
* *
* $Id$
*/ */
#include "videoprt.h" #include "videoprt.h"
@@ -133,18 +132,6 @@ IntVideoPortDispatchOpen(
Irp->IoStatus.Status = STATUS_SUCCESS; Irp->IoStatus.Status = STATUS_SUCCESS;
InterlockedIncrement((PLONG)&DeviceExtension->DeviceOpened); InterlockedIncrement((PLONG)&DeviceExtension->DeviceOpened);
/*
* Storing the device extension pointer in a static variable is an
* ugly hack. Unfortunately, we need it in VideoPortResetDisplayParameters
* and HalAcquireDisplayOwnership doesn't allow us to pass a userdata
* parameter. On the bright side, the DISPLAY device is opened
* exclusively, so there can be only one device extension active at
* any point in time.
*/
ResetDisplayParametersDeviceExtension = DeviceExtension;
HalAcquireDisplayOwnership(IntVideoPortResetDisplayParameters);
} }
else else
{ {
@@ -264,6 +251,56 @@ IntVideoPortDispatchDeviceControl(
return Status; return Status;
} }
/*
* IntVideoPortWrite
*
* This is a bit of a hack. We want to take ownership of the display as late
* as possible, just before the switch to graphics mode. Win32k knows when
* this happens, we don't. So we need Win32k to inform us. This could be done
* using an IOCTL, but there's no way of knowing which IOCTL codes are unused
* in the communication between GDI driver and miniport driver. So we use
* IRP_MJ_WRITE as the signal that win32k is ready to switch to graphics mode,
* since we know for certain that there is no read/write activity going on
* between GDI and miniport drivers.
* We don't actually need the data that is passed, we just trigger on the fact
* that an IRP_MJ_WRITE was sent.
*
* Run Level
* PASSIVE_LEVEL
*/
NTSTATUS NTAPI
IntVideoPortDispatchWrite(
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp)
{
PIO_STACK_LOCATION piosStack = IoGetCurrentIrpStackLocation(Irp);
PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension;
NTSTATUS nErrCode;
DeviceExtension = (PVIDEO_PORT_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
/*
* Storing the device extension pointer in a static variable is an
* ugly hack. Unfortunately, we need it in VideoPortResetDisplayParameters
* and HalAcquireDisplayOwnership doesn't allow us to pass a userdata
* parameter. On the bright side, the DISPLAY device is opened
* exclusively, so there can be only one device extension active at
* any point in time.
*/
ResetDisplayParametersDeviceExtension = DeviceExtension;
HalAcquireDisplayOwnership(IntVideoPortResetDisplayParameters);
nErrCode = STATUS_SUCCESS;
Irp->IoStatus.Information = piosStack->Parameters.Write.Length;
Irp->IoStatus.Status = nErrCode;
IoCompleteRequest(Irp, IO_NO_INCREMENT);
return nErrCode;
}
NTSTATUS NTAPI NTSTATUS NTAPI
IntVideoPortPnPStartDevice( IntVideoPortPnPStartDevice(
IN PDEVICE_OBJECT DeviceObject, IN PDEVICE_OBJECT DeviceObject,

View File

@@ -646,6 +646,7 @@ VideoPortInitialize(
DriverObject->MajorFunction[IRP_MJ_CREATE] = IntVideoPortDispatchOpen; DriverObject->MajorFunction[IRP_MJ_CREATE] = IntVideoPortDispatchOpen;
DriverObject->MajorFunction[IRP_MJ_CLOSE] = IntVideoPortDispatchClose; DriverObject->MajorFunction[IRP_MJ_CLOSE] = IntVideoPortDispatchClose;
DriverObject->MajorFunction[IRP_MJ_DEVICE_CONTROL] = IntVideoPortDispatchDeviceControl; DriverObject->MajorFunction[IRP_MJ_DEVICE_CONTROL] = IntVideoPortDispatchDeviceControl;
DriverObject->MajorFunction[IRP_MJ_WRITE] = IntVideoPortDispatchWrite;
DriverObject->DriverUnload = IntVideoPortUnload; DriverObject->DriverUnload = IntVideoPortUnload;
/* /*

View File

@@ -148,6 +148,11 @@ IntVideoPortDispatchPower(
IN PDEVICE_OBJECT DeviceObject, IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp); IN PIRP Irp);
NTSTATUS NTAPI
IntVideoPortDispatchWrite(
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp);
VOID NTAPI VOID NTAPI
IntVideoPortUnload(PDRIVER_OBJECT DriverObject); IntVideoPortUnload(PDRIVER_OBJECT DriverObject);

View File

@@ -18,11 +18,11 @@
#define __VERSION_H #define __VERSION_H
#define KERNEL_VERSION_MAJOR 0 #define KERNEL_VERSION_MAJOR 0
#define KERNEL_VERSION_MINOR 3 #define KERNEL_VERSION_MINOR 2
#define KERNEL_VERSION_PATCH_LEVEL 0 #define KERNEL_VERSION_PATCH_LEVEL 8
/* KERNEL_VERSION_BUILD_TYPE is L"SVN", L"RC1", L"RC2" or L"RELEASE" */ /* KERNEL_VERSION_BUILD_TYPE is L"SVN", L"RC1", L"RC2" or L"RELEASE" */
#define KERNEL_VERSION_BUILD_TYPE L"SVN" #define KERNEL_VERSION_BUILD_TYPE L"RELEASE"
#endif #endif

View File

@@ -2821,8 +2821,6 @@ TREEVIEW_Refresh(TREEVIEW_INFO *infoPtr, HDC hdc, RECT *rc)
} }
} }
TREEVIEW_UpdateScrollBars(infoPtr);
if (infoPtr->cdmode & CDRF_NOTIFYPOSTPAINT) if (infoPtr->cdmode & CDRF_NOTIFYPOSTPAINT)
infoPtr->cdmode = infoPtr->cdmode =
TREEVIEW_SendCustomDrawNotify(infoPtr, CDDS_POSTPAINT, hdc, rect); TREEVIEW_SendCustomDrawNotify(infoPtr, CDDS_POSTPAINT, hdc, rect);
@@ -3337,6 +3335,7 @@ TREEVIEW_Expand(TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *wineItem,
} }
} }
} }
TREEVIEW_UpdateScrollBars(infoPtr);
return TRUE; return TRUE;
} }

View File

@@ -436,7 +436,7 @@ FT_BEGIN_HEADER
/* Do not #undef this macro here, since the build system might */ /* Do not #undef this macro here, since the build system might */
/* define it for certain configurations only. */ /* define it for certain configurations only. */
/* */ /* */
#define TT_CONFIG_OPTION_BYTECODE_INTERPRETER //#define TT_CONFIG_OPTION_BYTECODE_INTERPRETER
/*************************************************************************/ /*************************************************************************/

View File

@@ -399,7 +399,6 @@ InstallReactOS (HINSTANCE hInstance)
/* desktop shortcuts */ /* desktop shortcuts */
CreateShortcut(CSIDL_DESKTOP, _T("Command Prompt.lnk"), _T("cmd.exe"), _T("Open command prompt")); CreateShortcut(CSIDL_DESKTOP, _T("Command Prompt.lnk"), _T("cmd.exe"), _T("Open command prompt"));
CreateShortcut(CSIDL_DESKTOP, _T("winefile.lnk"), _T("winefile.exe"), _T("Launch Winefile"));
/* program startmenu shortcuts */ /* program startmenu shortcuts */
CreateShortcut(CSIDL_PROGRAMS, _T("Command Prompt.lnk"), _T("cmd.exe"), _T("Open command prompt")); CreateShortcut(CSIDL_PROGRAMS, _T("Command Prompt.lnk"), _T("cmd.exe"), _T("Open command prompt"));

View File

@@ -730,14 +730,11 @@ void DesktopShellView::PositionIcons(int dir)
int dx2 = dir_x2 * cx; int dx2 = dir_x2 * cx;
int dy2 = dir_y2 * cy; int dy2 = dir_y2 * cy;
int start_x = (start_pos.x * work_area.right)/cx*cx + (cx-32)/2; int xoffset = (cx-32)/2;
int start_y = (start_pos.y * work_area.bottom)/cy*cy + 4/*(cy-32)/2*/; int yoffset = 4/*(cy-32)/2*/;
if (start_x >= work_area.right) int start_x = start_pos.x * (work_area.right - cx) + xoffset;
start_x -= cx; int start_y = start_pos.y * (work_area.bottom - cy) + yoffset;
if (start_y >= work_area.bottom)
start_y -= cy;
int x = start_x; int x = start_x;
int y = start_y; int y = start_y;
@@ -755,19 +752,22 @@ void DesktopShellView::PositionIcons(int dir)
IconMap pos_idx; IconMap pos_idx;
int cnt = 0; int cnt = 0;
int xhv = start_x;
int yhv = start_y;
for(int idx=i1; idx!=i2; idx+=dir) { for(int idx=i1; idx!=i2; idx+=dir) {
pos_idx[IconPos(y, x)] = idx; pos_idx[IconPos(y, x)] = idx;
if (_icon_algo == ARRANGE_BORDER_DOWN) { if (_icon_algo == ARRANGE_BORDER_DOWN) {
if (++cnt & 1) if (++cnt & 1)
x = work_area.right - x; x = work_area.right - x - cx + 2*xoffset;
else { else {
y += dy1; y += dy1;
if (y >= work_area.bottom) { if (y + cy - 2 * yoffset > work_area.bottom) {
y = start_y; y = start_y;
x += dx2; start_x += dx2;
x = start_x;
} }
} }
@@ -775,20 +775,32 @@ void DesktopShellView::PositionIcons(int dir)
} }
else if (_icon_algo == ARRANGE_BORDER_HV) { else if (_icon_algo == ARRANGE_BORDER_HV) {
if (++cnt & 1) if (++cnt & 1)
x = work_area.right - x; x = work_area.right - x - cx + 2*xoffset;
else if (cnt & 2) { else if (cnt & 2) {
y += dy1; yhv += cy;
y = yhv;
x = start_x;
if (y >= work_area.bottom) { if (y + cy - 2 * yoffset > work_area.bottom) {
y = start_y; start_x += cx;
x += dx2; xhv = start_x;
x = xhv;
start_y += cy;
yhv = start_y;
y = yhv;
} }
} else { } else {
x += dx1; xhv += cx;
x = xhv;
y = start_y;
if (x >= work_area.right) { if (x + cx - 2 * xoffset > work_area.right) {
x = start_x; start_x += cx;
y += dy2; xhv = start_x;
x = xhv;
start_y += cy;
yhv = start_y;
y = yhv;
} }
} }
@@ -803,10 +815,10 @@ void DesktopShellView::PositionIcons(int dir)
x += dx1; x += dx1;
y += dy1; y += dy1;
if (x<0 || x>=work_area.right) { if (x<0 || x+cx-2*xoffset>work_area.right) {
x = start_x; x = start_x;
y += dy2; y += dy2;
} else if (y<0 || y>=work_area.bottom) { } else if (y<0 || y+cy-2*yoffset>work_area.bottom) {
y = start_y; y = start_y;
x += dx2; x += dx2;
} }

View File

@@ -98,7 +98,7 @@ PSM_CMD_DESCRIPTOR LookupCommand (const TCHAR * CommandName)
{ {
LoadString( GetModuleHandle(NULL), IDS_Unknown, (LPTSTR) UsageMessage,RC_STRING_MAX_SIZE); LoadString( GetModuleHandle(NULL), IDS_Unknown, (LPTSTR) UsageMessage,RC_STRING_MAX_SIZE);
_ftprintf(stderr, _T("%s '%s'.\n"), UsageMessage, CommandName); _ftprintf(stderr, UsageMessage, CommandName);
return NULL; return NULL;
} }
return & Command [i]; return & Command [i];

View File

@@ -41,6 +41,7 @@ BOOL StartVMwConfigWizard, DriverFilesFound, ActivateVBE = FALSE, UninstallDrive
static WCHAR DestinationDriversPath[MAX_PATH+1]; static WCHAR DestinationDriversPath[MAX_PATH+1];
static WCHAR CDDrive = L'\0'; static WCHAR CDDrive = L'\0';
static WCHAR PathToVideoDrivers55[MAX_PATH+1] = L"X:\\program files\\VMware\\VMware Tools\\Drivers\\video\\winnt2k\\32Bit\\";
static WCHAR PathToVideoDrivers45[MAX_PATH+1] = L"X:\\program files\\VMware\\VMware Tools\\Drivers\\video\\winnt2k\\"; static WCHAR PathToVideoDrivers45[MAX_PATH+1] = L"X:\\program files\\VMware\\VMware Tools\\Drivers\\video\\winnt2k\\";
static WCHAR PathToVideoDrivers40[MAX_PATH+1] = L"X:\\video\\winnt2k\\"; static WCHAR PathToVideoDrivers40[MAX_PATH+1] = L"X:\\video\\winnt2k\\";
static WCHAR DestinationPath[MAX_PATH+1]; static WCHAR DestinationPath[MAX_PATH+1];
@@ -223,9 +224,12 @@ IsVMwareCDInDrive(WCHAR *Drv)
if(GetDriveType(Drive) == DRIVE_CDROM) if(GetDriveType(Drive) == DRIVE_CDROM)
{ {
#endif #endif
PathToVideoDrivers55[0] = Current;
PathToVideoDrivers40[0] = Current; PathToVideoDrivers40[0] = Current;
PathToVideoDrivers45[0] = Current; PathToVideoDrivers45[0] = Current;
if(SetCurrentDirectory(PathToVideoDrivers45)) if(SetCurrentDirectory(PathToVideoDrivers55))
SrcPath = PathToVideoDrivers55;
else if(SetCurrentDirectory(PathToVideoDrivers45))
SrcPath = PathToVideoDrivers45; SrcPath = PathToVideoDrivers45;
else if(SetCurrentDirectory(PathToVideoDrivers40)) else if(SetCurrentDirectory(PathToVideoDrivers40))
SrcPath = PathToVideoDrivers40; SrcPath = PathToVideoDrivers40;

View File

@@ -90,20 +90,18 @@ typedef struct _USER_REFERENCE_ENTRY
ASSERT(_obj_ == ref->obj); \ ASSERT(_obj_ == ref->obj); \
\ \
} }
#define UserRefObjectCo(_obj_) \ #define UserRefObjectCo(_obj_, _ref_) \
{ \ { \
PW32THREAD t; \ PW32THREAD t; \
PUSER_REFERENCE_ENTRY ref; \
\ \
ASSERT(_obj_); \ ASSERT(_obj_); \
t = PsGetWin32Thread(); \ t = PsGetWin32Thread(); \
ASSERT(t); \ ASSERT(t); \
ref = (PUSER_REFERENCE_ENTRY)_alloca(sizeof(USER_REFERENCE_ENTRY)); \ ASSERT(_ref_); \
ASSERT(ref); \ (_ref_)->obj = _obj_; \
ref->obj = _obj_; \
ObmReferenceObject(_obj_); \ ObmReferenceObject(_obj_); \
\ \
PushEntryList(&t->ReferencesList, &ref->Entry); \ PushEntryList(&t->ReferencesList, &(_ref_)->Entry); \
\ \
} }

View File

@@ -433,6 +433,7 @@ NtUserTranslateAccelerator(
PWINDOW_OBJECT Window = NULL; PWINDOW_OBJECT Window = NULL;
PACCELERATOR_TABLE Accel = NULL; PACCELERATOR_TABLE Accel = NULL;
ULONG i; ULONG i;
USER_REFERENCE_ENTRY AccelRef, WindowRef;
DECLARE_RETURN(int); DECLARE_RETURN(int);
DPRINT("NtUserTranslateAccelerator(hWnd %x, Table %x, Message %p)\n", DPRINT("NtUserTranslateAccelerator(hWnd %x, Table %x, Message %p)\n",
@@ -458,14 +459,14 @@ NtUserTranslateAccelerator(
RETURN( 0); RETURN( 0);
} }
UserRefObjectCo(Accel); UserRefObjectCo(Accel, &AccelRef);
if (!(Window = UserGetWindowObject(hWnd))) if (!(Window = UserGetWindowObject(hWnd)))
{ {
RETURN( 0); RETURN( 0);
} }
UserRefObjectCo(Window); UserRefObjectCo(Window, &WindowRef);
/* FIXME: Associate AcceleratorTable with the current thread */ /* FIXME: Associate AcceleratorTable with the current thread */

View File

@@ -405,6 +405,7 @@ STDCALL
NtUserShowCaret(HWND hWnd OPTIONAL, BOOL bShow) NtUserShowCaret(HWND hWnd OPTIONAL, BOOL bShow)
{ {
PWINDOW_OBJECT Window = NULL; PWINDOW_OBJECT Window = NULL;
USER_REFERENCE_ENTRY Ref;
DECLARE_RETURN(BOOL); DECLARE_RETURN(BOOL);
BOOL ret; BOOL ret;
@@ -416,7 +417,7 @@ NtUserShowCaret(HWND hWnd OPTIONAL, BOOL bShow)
RETURN(FALSE); RETURN(FALSE);
} }
if (Window) UserRefObjectCo(Window); if (Window) UserRefObjectCo(Window, &Ref);
if (bShow) if (bShow)
ret = co_UserShowCaret(Window); ret = co_UserShowCaret(Window);

View File

@@ -68,12 +68,21 @@ ClassRefObject(PWNDCLASS_OBJECT Class)
VOID FASTCALL DestroyClass(PWNDCLASS_OBJECT Class) VOID FASTCALL DestroyClass(PWNDCLASS_OBJECT Class)
{ {
PWINSTATION_OBJECT WinSta; PWINSTATION_OBJECT WinSta;
WinSta = PsGetWin32Thread()->Desktop->WindowStation;
ASSERT(Class->refs == 0); ASSERT(Class->refs == 0);
RemoveEntryList(&Class->ListEntry); RemoveEntryList(&Class->ListEntry);
//FIXME: release ATOM
RtlDeleteAtomFromAtomTable(WinSta->AtomTable, Class->Atom); /* FIXME See bug 899 */
if (NULL != PsGetWin32Thread())
{
WinSta = PsGetWin32Thread()->Desktop->WindowStation;
//FIXME: release ATOM
RtlDeleteAtomFromAtomTable(WinSta->AtomTable, Class->Atom);
}
else
{
DPRINT1("Can't locate window station, see bug 899\n");
}
ExFreePool(Class); ExFreePool(Class);
} }
@@ -557,6 +566,7 @@ NtUserSetClassLong(HWND hWnd,
{ {
PWINDOW_OBJECT Window; PWINDOW_OBJECT Window;
LONG Ret; LONG Ret;
USER_REFERENCE_ENTRY Ref;
DECLARE_RETURN(DWORD); DECLARE_RETURN(DWORD);
DPRINT("Enter NtUserSetClassLong\n"); DPRINT("Enter NtUserSetClassLong\n");
@@ -567,7 +577,7 @@ NtUserSetClassLong(HWND hWnd,
RETURN(0); RETURN(0);
} }
UserRefObjectCo(Window); UserRefObjectCo(Window, &Ref);
Ret = IntGetClassLong(Window, Offset, Ansi); Ret = IntGetClassLong(Window, Offset, Ansi);
co_IntSetClassLong(Window, Offset, dwNewLong, Ansi); co_IntSetClassLong(Window, Offset, dwNewLong, Ansi);

View File

@@ -61,12 +61,13 @@ co_IntSendDeactivateMessages(HWND hWndPrev, HWND hWnd)
VOID FASTCALL VOID FASTCALL
co_IntSendActivateMessages(HWND hWndPrev, HWND hWnd, BOOL MouseActivate) co_IntSendActivateMessages(HWND hWndPrev, HWND hWnd, BOOL MouseActivate)
{ {
USER_REFERENCE_ENTRY Ref;
PWINDOW_OBJECT Window; PWINDOW_OBJECT Window;
if ((Window = UserGetWindowObject(hWnd))) if ((Window = UserGetWindowObject(hWnd)))
{ {
UserRefObjectCo(Window); UserRefObjectCo(Window, &Ref);
/* Send palette messages */ /* Send palette messages */
if (co_IntPostOrSendMessage(hWnd, WM_QUERYNEWPALETTE, 0, 0)) if (co_IntPostOrSendMessage(hWnd, WM_QUERYNEWPALETTE, 0, 0))
@@ -218,6 +219,7 @@ co_IntMouseActivateWindow(PWINDOW_OBJECT Window)
{ {
HWND Top; HWND Top;
PWINDOW_OBJECT TopWindow; PWINDOW_OBJECT TopWindow;
USER_REFERENCE_ENTRY Ref;
ASSERT_REFS_CO(Window); ASSERT_REFS_CO(Window);
@@ -231,7 +233,7 @@ co_IntMouseActivateWindow(PWINDOW_OBJECT Window)
Top = IntFindChildWindowToOwner(DesktopWindow, Window); Top = IntFindChildWindowToOwner(DesktopWindow, Window);
if((TopWnd = UserGetWindowObject(Top))) if((TopWnd = UserGetWindowObject(Top)))
{ {
UserRefObjectCo(TopWnd); UserRefObjectCo(TopWnd, &Ref);
Ret = co_IntMouseActivateWindow(TopWnd); Ret = co_IntMouseActivateWindow(TopWnd);
UserDerefObjectCo(TopWnd); UserDerefObjectCo(TopWnd);
@@ -246,7 +248,7 @@ co_IntMouseActivateWindow(PWINDOW_OBJECT Window)
if (!TopWindow) return FALSE; if (!TopWindow) return FALSE;
/* TMN: Check return valud from this function? */ /* TMN: Check return valud from this function? */
UserRefObjectCo(TopWindow); UserRefObjectCo(TopWindow, &Ref);
co_IntSetForegroundAndFocusWindow(TopWindow, Window, TRUE); co_IntSetForegroundAndFocusWindow(TopWindow, Window, TRUE);
@@ -386,6 +388,7 @@ CLEANUP:
HWND STDCALL HWND STDCALL
NtUserSetActiveWindow(HWND hWnd) NtUserSetActiveWindow(HWND hWnd)
{ {
USER_REFERENCE_ENTRY Ref;
DECLARE_RETURN(HWND); DECLARE_RETURN(HWND);
DPRINT("Enter NtUserSetActiveWindow(%x)\n", hWnd); DPRINT("Enter NtUserSetActiveWindow(%x)\n", hWnd);
@@ -412,7 +415,7 @@ NtUserSetActiveWindow(HWND hWnd)
RETURN( 0); RETURN( 0);
} }
UserRefObjectCo(Window); UserRefObjectCo(Window, &Ref);
hWndPrev = co_IntSetActiveWindow(Window); hWndPrev = co_IntSetActiveWindow(Window);
UserDerefObjectCo(Window); UserDerefObjectCo(Window);
@@ -503,6 +506,7 @@ HWND FASTCALL co_UserSetFocus(PWINDOW_OBJECT Window OPTIONAL)
PUSER_MESSAGE_QUEUE ThreadQueue; PUSER_MESSAGE_QUEUE ThreadQueue;
HWND hWndPrev; HWND hWndPrev;
PWINDOW_OBJECT TopWnd; PWINDOW_OBJECT TopWnd;
USER_REFERENCE_ENTRY Ref;
ASSERT_REFS_CO(Window); ASSERT_REFS_CO(Window);
@@ -523,7 +527,7 @@ HWND FASTCALL co_UserSetFocus(PWINDOW_OBJECT Window OPTIONAL)
if (TopWnd && TopWnd->hSelf != UserGetActiveWindow()) if (TopWnd && TopWnd->hSelf != UserGetActiveWindow())
{ {
// PWINDOW_OBJECT WndTops = UserGetWindowObject(hWndTop); // PWINDOW_OBJECT WndTops = UserGetWindowObject(hWndTop);
UserRefObjectCo(TopWnd); UserRefObjectCo(TopWnd, &Ref);
co_IntSetActiveWindow(TopWnd); co_IntSetActiveWindow(TopWnd);
UserDerefObjectCo(TopWnd); UserDerefObjectCo(TopWnd);
} }
@@ -547,6 +551,7 @@ HWND STDCALL
NtUserSetFocus(HWND hWnd) NtUserSetFocus(HWND hWnd)
{ {
PWINDOW_OBJECT Window; PWINDOW_OBJECT Window;
USER_REFERENCE_ENTRY Ref;
DECLARE_RETURN(HWND); DECLARE_RETURN(HWND);
HWND ret; HWND ret;
@@ -558,7 +563,7 @@ NtUserSetFocus(HWND hWnd)
RETURN(NULL); RETURN(NULL);
} }
UserRefObjectCo(Window); UserRefObjectCo(Window, &Ref);
ret = co_UserSetFocus(Window); ret = co_UserSetFocus(Window);
UserDerefObjectCo(Window); UserDerefObjectCo(Window);

View File

@@ -547,6 +547,7 @@ BOOL FASTCALL
co_IntTranslateMouseMessage(PUSER_MESSAGE_QUEUE ThreadQueue, LPMSG Msg, USHORT *HitTest, BOOL Remove) co_IntTranslateMouseMessage(PUSER_MESSAGE_QUEUE ThreadQueue, LPMSG Msg, USHORT *HitTest, BOOL Remove)
{ {
PWINDOW_OBJECT Window; PWINDOW_OBJECT Window;
USER_REFERENCE_ENTRY Ref, DesktopRef;
if(!(Window = UserGetWindowObject(Msg->hwnd))) if(!(Window = UserGetWindowObject(Msg->hwnd)))
{ {
@@ -554,7 +555,7 @@ co_IntTranslateMouseMessage(PUSER_MESSAGE_QUEUE ThreadQueue, LPMSG Msg, USHORT *
return TRUE; return TRUE;
} }
UserRefObjectCo(Window); UserRefObjectCo(Window, &Ref);
if(ThreadQueue == Window->MessageQueue && if(ThreadQueue == Window->MessageQueue &&
ThreadQueue->CaptureWindow != Window->hSelf) ThreadQueue->CaptureWindow != Window->hSelf)
@@ -572,7 +573,7 @@ co_IntTranslateMouseMessage(PUSER_MESSAGE_QUEUE ThreadQueue, LPMSG Msg, USHORT *
{ {
PWINDOW_OBJECT Wnd; PWINDOW_OBJECT Wnd;
UserRefObjectCo(DesktopWindow); UserRefObjectCo(DesktopWindow, &DesktopRef);
co_WinPosWindowFromPoint(DesktopWindow, Window->MessageQueue, &Msg->pt, &Wnd); co_WinPosWindowFromPoint(DesktopWindow, Window->MessageQueue, &Msg->pt, &Wnd);
if(Wnd) if(Wnd)
@@ -664,6 +665,7 @@ co_IntPeekMessage(PUSER_MESSAGE Msg,
PUSER_MESSAGE_QUEUE ThreadQueue; PUSER_MESSAGE_QUEUE ThreadQueue;
PUSER_MESSAGE Message; PUSER_MESSAGE Message;
BOOL Present, RemoveMessages; BOOL Present, RemoveMessages;
USER_REFERENCE_ENTRY Ref;
/* The queues and order in which they are checked are documented in the MSDN /* The queues and order in which they are checked are documented in the MSDN
article on GetMessage() */ article on GetMessage() */
@@ -772,7 +774,7 @@ MessageFound:
{ {
USHORT HitTest; USHORT HitTest;
UserRefObjectCo(MsgWindow); UserRefObjectCo(MsgWindow, &Ref);
if(co_IntTranslateMouseMessage(ThreadQueue, &Msg->Msg, &HitTest, TRUE)) if(co_IntTranslateMouseMessage(ThreadQueue, &Msg->Msg, &HitTest, TRUE))
/* FIXME - check message filter again, if the message doesn't match anymore, /* FIXME - check message filter again, if the message doesn't match anymore,
@@ -972,6 +974,7 @@ NtUserGetMessage(PNTUSERGETMESSAGEINFO UnsafeInfo,
UINT Size; UINT Size;
USER_MESSAGE Msg; USER_MESSAGE Msg;
DECLARE_RETURN(BOOL); DECLARE_RETURN(BOOL);
// USER_REFERENCE_ENTRY Ref;
DPRINT("Enter NtUserGetMessage\n"); DPRINT("Enter NtUserGetMessage\n");
UserEnterExclusive(); UserEnterExclusive();
@@ -982,7 +985,7 @@ NtUserGetMessage(PNTUSERGETMESSAGEINFO UnsafeInfo,
RETURN(-1); RETURN(-1);
} }
// if (Window) UserRefObjectCo(Window); // if (Window) UserRefObjectCo(Window, &Ref);
if (MsgFilterMax < MsgFilterMin) if (MsgFilterMax < MsgFilterMin)
{ {
@@ -1357,6 +1360,7 @@ co_IntSendMessageTimeoutSingle(HWND hWnd,
LPARAM lParamPacked; LPARAM lParamPacked;
PW32THREAD Win32Thread; PW32THREAD Win32Thread;
DECLARE_RETURN(LRESULT); DECLARE_RETURN(LRESULT);
USER_REFERENCE_ENTRY Ref;
/* FIXME: Call hooks. */ /* FIXME: Call hooks. */
if (!(Window = UserGetWindowObject(hWnd))) if (!(Window = UserGetWindowObject(hWnd)))
@@ -1364,7 +1368,7 @@ co_IntSendMessageTimeoutSingle(HWND hWnd,
RETURN( FALSE); RETURN( FALSE);
} }
UserRefObjectCo(Window); UserRefObjectCo(Window, &Ref);
Win32Thread = PsGetWin32Thread(); Win32Thread = PsGetWin32Thread();

View File

@@ -689,6 +689,7 @@ NtUserCallHwndLock(
{ {
BOOL Ret = 0; BOOL Ret = 0;
PWINDOW_OBJECT Window; PWINDOW_OBJECT Window;
USER_REFERENCE_ENTRY Ref;
DECLARE_RETURN(BOOLEAN); DECLARE_RETURN(BOOLEAN);
DPRINT("Enter NtUserCallHwndLock\n"); DPRINT("Enter NtUserCallHwndLock\n");
@@ -698,7 +699,7 @@ NtUserCallHwndLock(
{ {
RETURN( FALSE); RETURN( FALSE);
} }
UserRefObjectCo(Window); UserRefObjectCo(Window, &Ref);
/* FIXME: Routine can be 0x53 - 0x5E */ /* FIXME: Routine can be 0x53 - 0x5E */
switch (Routine) switch (Routine)

View File

@@ -468,6 +468,7 @@ co_MsqPeekHardwareMessage(PUSER_MESSAGE_QUEUE MessageQueue, HWND hWnd,
PVOID WaitObjects[2]; PVOID WaitObjects[2];
NTSTATUS WaitStatus; NTSTATUS WaitStatus;
DECLARE_RETURN(BOOL); DECLARE_RETURN(BOOL);
USER_REFERENCE_ENTRY Ref;
if( !IntGetScreenDC() || if( !IntGetScreenDC() ||
PsGetWin32Thread()->MessageQueue == W32kGetPrimitiveMessageQueue() ) PsGetWin32Thread()->MessageQueue == W32kGetPrimitiveMessageQueue() )
@@ -495,7 +496,7 @@ co_MsqPeekHardwareMessage(PUSER_MESSAGE_QUEUE MessageQueue, HWND hWnd,
DesktopWindow = UserGetWindowObject(IntGetDesktopWindow()); DesktopWindow = UserGetWindowObject(IntGetDesktopWindow());
if (DesktopWindow) UserRefObjectCo(DesktopWindow);//can DesktopWindow be NULL? if (DesktopWindow) UserRefObjectCo(DesktopWindow, &Ref);//can DesktopWindow be NULL?
/* Process messages in the message queue itself. */ /* Process messages in the message queue itself. */
IntLockHardwareMessageQueue(MessageQueue); IntLockHardwareMessageQueue(MessageQueue);

View File

@@ -295,7 +295,8 @@ co_IntPaintWindows(PWINDOW_OBJECT Window, ULONG Flags)
Window = UserGetWindowObject(*phWnd); Window = UserGetWindowObject(*phWnd);
if (Window && (Window->Style & WS_VISIBLE)) if (Window && (Window->Style & WS_VISIBLE))
{ {
UserRefObjectCo(Window); USER_REFERENCE_ENTRY Ref;
UserRefObjectCo(Window, &Ref);
co_IntPaintWindows(Window, Flags); co_IntPaintWindows(Window, Flags);
UserDerefObjectCo(Window); UserDerefObjectCo(Window);
} }
@@ -722,6 +723,7 @@ NtUserBeginPaint(HWND hWnd, PAINTSTRUCT* UnsafePs)
PROSRGNDATA Rgn; PROSRGNDATA Rgn;
NTSTATUS Status; NTSTATUS Status;
DECLARE_RETURN(HDC); DECLARE_RETURN(HDC);
USER_REFERENCE_ENTRY Ref;
DPRINT("Enter NtUserBeginPaint\n"); DPRINT("Enter NtUserBeginPaint\n");
UserEnterExclusive(); UserEnterExclusive();
@@ -731,7 +733,7 @@ NtUserBeginPaint(HWND hWnd, PAINTSTRUCT* UnsafePs)
RETURN( NULL); RETURN( NULL);
} }
UserRefObjectCo(Window); UserRefObjectCo(Window, &Ref);
co_UserHideCaret(Window); co_UserHideCaret(Window);
@@ -828,6 +830,7 @@ NtUserEndPaint(HWND hWnd, CONST PAINTSTRUCT* lPs)
{ {
PWINDOW_OBJECT Window; PWINDOW_OBJECT Window;
DECLARE_RETURN(BOOL); DECLARE_RETURN(BOOL);
USER_REFERENCE_ENTRY Ref;
DPRINT("Enter NtUserEndPaint\n"); DPRINT("Enter NtUserEndPaint\n");
UserEnterExclusive(); UserEnterExclusive();
@@ -839,7 +842,7 @@ NtUserEndPaint(HWND hWnd, CONST PAINTSTRUCT* lPs)
UserReleaseDC(Window, lPs->hdc, TRUE); UserReleaseDC(Window, lPs->hdc, TRUE);
UserRefObjectCo(Window); UserRefObjectCo(Window, &Ref);
co_UserShowCaret(Window); co_UserShowCaret(Window);
UserDerefObjectCo(Window); UserDerefObjectCo(Window);
@@ -894,6 +897,7 @@ NtUserGetUpdateRgn(HWND hWnd, HRGN hRgn, BOOL bErase)
DECLARE_RETURN(INT); DECLARE_RETURN(INT);
PWINDOW_OBJECT Window; PWINDOW_OBJECT Window;
INT ret; INT ret;
USER_REFERENCE_ENTRY Ref;
DPRINT("Enter NtUserGetUpdateRgn\n"); DPRINT("Enter NtUserGetUpdateRgn\n");
UserEnterExclusive(); UserEnterExclusive();
@@ -903,7 +907,7 @@ NtUserGetUpdateRgn(HWND hWnd, HRGN hRgn, BOOL bErase)
RETURN(ERROR); RETURN(ERROR);
} }
UserRefObjectCo(Window); UserRefObjectCo(Window, &Ref);
ret = co_UserGetUpdateRgn(Window, hRgn, bErase); ret = co_UserGetUpdateRgn(Window, hRgn, bErase);
UserDerefObjectCo(Window); UserDerefObjectCo(Window);
@@ -975,7 +979,8 @@ NtUserGetUpdateRect(HWND hWnd, LPRECT UnsafeRect, BOOL bErase)
if (bErase && !IntGdiIsEmptyRect(&Rect)) if (bErase && !IntGdiIsEmptyRect(&Rect))
{ {
UserRefObjectCo(Window); USER_REFERENCE_ENTRY Ref;
UserRefObjectCo(Window, &Ref);
co_UserRedrawWindow(Window, NULL, NULL, RDW_ERASENOW | RDW_NOCHILDREN); co_UserRedrawWindow(Window, NULL, NULL, RDW_ERASENOW | RDW_NOCHILDREN);
UserDerefObjectCo(Window); UserDerefObjectCo(Window);
} }
@@ -1013,6 +1018,7 @@ NtUserRedrawWindow(HWND hWnd, CONST RECT *lprcUpdate, HRGN hrgnUpdate,
NTSTATUS Status; NTSTATUS Status;
PWINDOW_OBJECT Wnd; PWINDOW_OBJECT Wnd;
DECLARE_RETURN(BOOL); DECLARE_RETURN(BOOL);
USER_REFERENCE_ENTRY Ref;
DPRINT("Enter NtUserRedrawWindow\n"); DPRINT("Enter NtUserRedrawWindow\n");
UserEnterExclusive(); UserEnterExclusive();
@@ -1034,7 +1040,7 @@ NtUserRedrawWindow(HWND hWnd, CONST RECT *lprcUpdate, HRGN hrgnUpdate,
} }
} }
UserRefObjectCo(Wnd); UserRefObjectCo(Wnd, &Ref);
Status = co_UserRedrawWindow(Wnd, NULL == lprcUpdate ? NULL : &SafeUpdateRect, Status = co_UserRedrawWindow(Wnd, NULL == lprcUpdate ? NULL : &SafeUpdateRect,
hrgnUpdate, flags); hrgnUpdate, flags);
@@ -1206,6 +1212,7 @@ NtUserScrollWindowEx(HWND hWnd, INT dx, INT dy, const RECT *UnsafeRect,
BOOL bOwnRgn = TRUE; BOOL bOwnRgn = TRUE;
NTSTATUS Status; NTSTATUS Status;
DECLARE_RETURN(DWORD); DECLARE_RETURN(DWORD);
USER_REFERENCE_ENTRY Ref, CaretRef;
DPRINT("Enter NtUserScrollWindowEx\n"); DPRINT("Enter NtUserScrollWindowEx\n");
UserEnterExclusive(); UserEnterExclusive();
@@ -1216,7 +1223,7 @@ NtUserScrollWindowEx(HWND hWnd, INT dx, INT dy, const RECT *UnsafeRect,
Window = NULL; /* prevent deref at cleanup */ Window = NULL; /* prevent deref at cleanup */
RETURN( ERROR); RETURN( ERROR);
} }
UserRefObjectCo(Window); UserRefObjectCo(Window, &Ref);
IntGetClientRect(Window, &rc); IntGetClientRect(Window, &rc);
@@ -1292,6 +1299,7 @@ NtUserScrollWindowEx(HWND hWnd, INT dx, INT dy, const RECT *UnsafeRect,
RECT r, dummy; RECT r, dummy;
POINT ClientOrigin; POINT ClientOrigin;
PWINDOW_OBJECT Wnd; PWINDOW_OBJECT Wnd;
USER_REFERENCE_ENTRY WndRef;
IntGetClientOrigin(Window, &ClientOrigin); IntGetClientOrigin(Window, &ClientOrigin);
for (i = 0; List[i]; i++) for (i = 0; List[i]; i++)
@@ -1307,7 +1315,7 @@ NtUserScrollWindowEx(HWND hWnd, INT dx, INT dy, const RECT *UnsafeRect,
if (! UnsafeRect || IntGdiIntersectRect(&dummy, &r, &rc)) if (! UnsafeRect || IntGdiIntersectRect(&dummy, &r, &rc))
{ {
UserRefObjectCo(Wnd); UserRefObjectCo(Wnd, &WndRef);
co_WinPosSetWindowPos(Wnd, 0, r.left + dx, r.top + dy, 0, 0, co_WinPosSetWindowPos(Wnd, 0, r.left + dx, r.top + dy, 0, 0,
SWP_NOZORDER | SWP_NOSIZE | SWP_NOACTIVATE | SWP_NOZORDER | SWP_NOSIZE | SWP_NOACTIVATE |
SWP_NOREDRAW); SWP_NOREDRAW);
@@ -1329,7 +1337,7 @@ NtUserScrollWindowEx(HWND hWnd, INT dx, INT dy, const RECT *UnsafeRect,
if ((CaretWnd = UserGetWindowObject(hwndCaret))) if ((CaretWnd = UserGetWindowObject(hwndCaret)))
{ {
UserRefObjectCo(CaretWnd); UserRefObjectCo(CaretWnd, &CaretRef);
co_IntSetCaretPos(caretrc.left + dx, caretrc.top + dy); co_IntSetCaretPos(caretrc.left + dx, caretrc.top + dy);
co_UserShowCaret(CaretWnd); co_UserShowCaret(CaretWnd);

View File

@@ -548,6 +548,7 @@ NtUserGetScrollBarInfo(HWND hWnd, LONG idObject, PSCROLLBARINFO psbi)
PWINDOW_OBJECT Window; PWINDOW_OBJECT Window;
BOOL Ret; BOOL Ret;
DECLARE_RETURN(BOOL); DECLARE_RETURN(BOOL);
USER_REFERENCE_ENTRY Ref;
DPRINT("Enter NtUserGetScrollBarInfo\n"); DPRINT("Enter NtUserGetScrollBarInfo\n");
UserEnterExclusive(); UserEnterExclusive();
@@ -564,7 +565,7 @@ NtUserGetScrollBarInfo(HWND hWnd, LONG idObject, PSCROLLBARINFO psbi)
RETURN(FALSE); RETURN(FALSE);
} }
UserRefObjectCo(Window); UserRefObjectCo(Window, &Ref);
Ret = co_IntGetScrollBarInfo(Window, idObject, &sbi); Ret = co_IntGetScrollBarInfo(Window, idObject, &sbi);
UserDerefObjectCo(Window); UserDerefObjectCo(Window);
@@ -595,6 +596,7 @@ NtUserGetScrollInfo(HWND hWnd, int fnBar, LPSCROLLINFO lpsi)
DWORD sz; DWORD sz;
BOOL Ret; BOOL Ret;
DECLARE_RETURN(BOOL); DECLARE_RETURN(BOOL);
USER_REFERENCE_ENTRY Ref;
DPRINT("Enter NtUserGetScrollInfo\n"); DPRINT("Enter NtUserGetScrollInfo\n");
UserEnterExclusive(); UserEnterExclusive();
@@ -619,7 +621,7 @@ NtUserGetScrollInfo(HWND hWnd, int fnBar, LPSCROLLINFO lpsi)
RETURN(FALSE); RETURN(FALSE);
} }
UserRefObjectCo(Window); UserRefObjectCo(Window, &Ref);
Ret = co_IntGetScrollInfo(Window, fnBar, &psi); Ret = co_IntGetScrollInfo(Window, fnBar, &psi);
UserDerefObjectCo(Window); UserDerefObjectCo(Window);
@@ -650,6 +652,7 @@ NtUserEnableScrollBar(
PSCROLLBARINFO InfoV = NULL, InfoH = NULL; PSCROLLBARINFO InfoV = NULL, InfoH = NULL;
BOOL Chg = FALSE; BOOL Chg = FALSE;
DECLARE_RETURN(BOOL); DECLARE_RETURN(BOOL);
USER_REFERENCE_ENTRY Ref;
DPRINT("Enter NtUserEnableScrollBar\n"); DPRINT("Enter NtUserEnableScrollBar\n");
UserEnterExclusive(); UserEnterExclusive();
@@ -658,7 +661,7 @@ NtUserEnableScrollBar(
{ {
RETURN(FALSE); RETURN(FALSE);
} }
UserRefObjectCo(Window); UserRefObjectCo(Window, &Ref);
if(wSBflags == SB_CTL) if(wSBflags == SB_CTL)
{ {
@@ -732,6 +735,7 @@ NtUserSetScrollBarInfo(
NTSTATUS Status; NTSTATUS Status;
LONG Obj; LONG Obj;
DECLARE_RETURN(BOOL); DECLARE_RETURN(BOOL);
USER_REFERENCE_ENTRY Ref;
DPRINT("Enter NtUserSetScrollBarInfo\n"); DPRINT("Enter NtUserSetScrollBarInfo\n");
UserEnterExclusive(); UserEnterExclusive();
@@ -740,7 +744,7 @@ NtUserSetScrollBarInfo(
{ {
RETURN( FALSE); RETURN( FALSE);
} }
UserRefObjectCo(Window); UserRefObjectCo(Window, &Ref);
Obj = SBOBJ_TO_SBID(idObject); Obj = SBOBJ_TO_SBID(idObject);
if(!SBID_IS_VALID(Obj)) if(!SBID_IS_VALID(Obj))
@@ -792,6 +796,7 @@ NtUserSetScrollInfo(
NTSTATUS Status; NTSTATUS Status;
SCROLLINFO ScrollInfo; SCROLLINFO ScrollInfo;
DECLARE_RETURN(DWORD); DECLARE_RETURN(DWORD);
USER_REFERENCE_ENTRY Ref;
DPRINT("Enter NtUserSetScrollInfo\n"); DPRINT("Enter NtUserSetScrollInfo\n");
UserEnterExclusive(); UserEnterExclusive();
@@ -800,7 +805,7 @@ NtUserSetScrollInfo(
{ {
RETURN( 0); RETURN( 0);
} }
UserRefObjectCo(Window); UserRefObjectCo(Window, &Ref);
Status = MmCopyFromCaller(&ScrollInfo, lpsi, sizeof(SCROLLINFO) - sizeof(ScrollInfo.nTrackPos)); Status = MmCopyFromCaller(&ScrollInfo, lpsi, sizeof(SCROLLINFO) - sizeof(ScrollInfo.nTrackPos));
if(!NT_SUCCESS(Status)) if(!NT_SUCCESS(Status))
@@ -892,6 +897,7 @@ NtUserShowScrollBar(HWND hWnd, int wBar, DWORD bShow)
PWINDOW_OBJECT Window; PWINDOW_OBJECT Window;
DECLARE_RETURN(DWORD); DECLARE_RETURN(DWORD);
DWORD ret; DWORD ret;
USER_REFERENCE_ENTRY Ref;
DPRINT("Enter NtUserShowScrollBar\n"); DPRINT("Enter NtUserShowScrollBar\n");
UserEnterExclusive(); UserEnterExclusive();
@@ -901,7 +907,7 @@ NtUserShowScrollBar(HWND hWnd, int wBar, DWORD bShow)
RETURN(0); RETURN(0);
} }
UserRefObjectCo(Window); UserRefObjectCo(Window, &Ref);
ret = co_UserShowScrollBar(Window, wBar, bShow); ret = co_UserShowScrollBar(Window, wBar, bShow);
UserDerefObjectCo(Window); UserDerefObjectCo(Window);

View File

@@ -60,6 +60,7 @@ IntSetTimer(HWND Wnd, UINT_PTR IDEvent, UINT Elapse, TIMERPROC TimerFunc, BOOL S
{ {
PWINDOW_OBJECT Window; PWINDOW_OBJECT Window;
UINT_PTR Ret = 0; UINT_PTR Ret = 0;
PUSER_MESSAGE_QUEUE MessageQueue;
DPRINT("IntSetTimer wnd %x id %p elapse %u timerproc %p systemtimer %s\n", DPRINT("IntSetTimer wnd %x id %p elapse %u timerproc %p systemtimer %s\n",
Wnd, IDEvent, Elapse, TimerFunc, SystemTimer ? "TRUE" : "FALSE"); Wnd, IDEvent, Elapse, TimerFunc, SystemTimer ? "TRUE" : "FALSE");
@@ -82,6 +83,7 @@ IntSetTimer(HWND Wnd, UINT_PTR IDEvent, UINT Elapse, TIMERPROC TimerFunc, BOOL S
HintIndex = ++IDEvent; HintIndex = ++IDEvent;
IntUnlockWindowlessTimerBitmap(); IntUnlockWindowlessTimerBitmap();
Ret = IDEvent; Ret = IDEvent;
MessageQueue = PsGetWin32Thread()->MessageQueue;
} }
else else
{ {
@@ -99,6 +101,7 @@ IntSetTimer(HWND Wnd, UINT_PTR IDEvent, UINT Elapse, TIMERPROC TimerFunc, BOOL S
} }
Ret = IDEvent; Ret = IDEvent;
MessageQueue = Window->MessageQueue;
} }
#if 1 #if 1
@@ -128,7 +131,7 @@ IntSetTimer(HWND Wnd, UINT_PTR IDEvent, UINT Elapse, TIMERPROC TimerFunc, BOOL S
Elapse = 10; Elapse = 10;
} }
if (! MsqSetTimer(PsGetWin32Thread()->MessageQueue, Wnd, if (! MsqSetTimer(MessageQueue, Wnd,
IDEvent, Elapse, TimerFunc, IDEvent, Elapse, TimerFunc,
SystemTimer ? WM_SYSTIMER : WM_TIMER)) SystemTimer ? WM_SYSTIMER : WM_TIMER))
{ {

View File

@@ -151,6 +151,7 @@ co_VIS_WindowLayoutChanged(
{ {
HRGN Temp; HRGN Temp;
PWINDOW_OBJECT Parent; PWINDOW_OBJECT Parent;
USER_REFERENCE_ENTRY Ref;
ASSERT_REFS_CO(Window); ASSERT_REFS_CO(Window);
@@ -164,7 +165,7 @@ co_VIS_WindowLayoutChanged(
Window->WindowRect.left - Parent->ClientRect.left, Window->WindowRect.left - Parent->ClientRect.left,
Window->WindowRect.top - Parent->ClientRect.top); Window->WindowRect.top - Parent->ClientRect.top);
UserRefObjectCo(Parent); UserRefObjectCo(Parent, &Ref);
co_UserRedrawWindow(Parent, NULL, Temp, co_UserRedrawWindow(Parent, NULL, Temp,
RDW_FRAME | RDW_ERASE | RDW_INVALIDATE | RDW_FRAME | RDW_ERASE | RDW_INVALIDATE |
RDW_ALLCHILDREN); RDW_ALLCHILDREN);

View File

@@ -239,7 +239,8 @@ static void IntSendDestroyMsg(HWND hWnd)
Window = UserGetWindowObject(hWnd); Window = UserGetWindowObject(hWnd);
if (Window) if (Window)
{ {
// UserRefObjectCo(Window); // USER_REFERENCE_ENTRY Ref;
// UserRefObjectCo(Window, &Ref);
if (!IntGetOwner(Window) && !IntGetParent(Window)) if (!IntGetOwner(Window) && !IntGetParent(Window))
{ {
@@ -569,7 +570,7 @@ co_DestroyThreadWindows(struct _ETHREAD *Thread)
PW32THREAD WThread; PW32THREAD WThread;
PLIST_ENTRY Current; PLIST_ENTRY Current;
PWINDOW_OBJECT Wnd; PWINDOW_OBJECT Wnd;
USER_REFERENCE_ENTRY Ref;
WThread = Thread->Tcb.Win32Thread; WThread = Thread->Tcb.Win32Thread;
while (!IsListEmpty(&WThread->WindowListHead)) while (!IsListEmpty(&WThread->WindowListHead))
@@ -588,7 +589,7 @@ co_DestroyThreadWindows(struct _ETHREAD *Thread)
//ASSERT(co_UserDestroyWindow(Wnd)); //ASSERT(co_UserDestroyWindow(Wnd));
UserRefObjectCo(Wnd);//faxme: temp hack?? UserRefObjectCo(Wnd, &Ref);//faxme: temp hack??
if (!co_UserDestroyWindow(Wnd)) if (!co_UserDestroyWindow(Wnd))
{ {
DPRINT1("Unable to destroy window 0x%x at thread cleanup... This is _VERY_ bad!\n", Wnd); DPRINT1("Unable to destroy window 0x%x at thread cleanup... This is _VERY_ bad!\n", Wnd);
@@ -1355,6 +1356,7 @@ co_IntCreateWindowEx(DWORD dwExStyle,
BOOL MenuChanged; BOOL MenuChanged;
DECLARE_RETURN(HWND); DECLARE_RETURN(HWND);
BOOL HasOwner; BOOL HasOwner;
USER_REFERENCE_ENTRY ParentRef, Ref;
ParentWindowHandle = PsGetWin32Thread()->Desktop->DesktopWindow; ParentWindowHandle = PsGetWin32Thread()->Desktop->DesktopWindow;
OwnerWindowHandle = NULL; OwnerWindowHandle = NULL;
@@ -1388,7 +1390,7 @@ co_IntCreateWindowEx(DWORD dwExStyle,
// { // {
ParentWindow = UserGetWindowObject(ParentWindowHandle); ParentWindow = UserGetWindowObject(ParentWindowHandle);
if (ParentWindow) UserRefObjectCo(ParentWindow); if (ParentWindow) UserRefObjectCo(ParentWindow, &ParentRef);
// } // }
// else // else
// { // {
@@ -1441,7 +1443,7 @@ co_IntCreateWindowEx(DWORD dwExStyle,
RETURN( (HWND)0); RETURN( (HWND)0);
} }
UserRefObjectCo(Window); UserRefObjectCo(Window, &Ref);
ObDereferenceObject(WinSta); ObDereferenceObject(WinSta);
@@ -2033,7 +2035,7 @@ BOOLEAN FASTCALL co_UserDestroyWindow(PWINDOW_OBJECT Window)
ASSERT_REFS_CO(Window); //fixme: temp hack? ASSERT_REFS_CO(Window); //fixme: temp hack?
/* Check for owner thread and desktop window */ /* Check for owner thread and desktop window */
if ((Window->OwnerThread != PsGetCurrentThread()) || IntIsDesktopWindow(Window)) if ((Window->OwnerThread != PsGetCurrentThread()))
{ {
SetLastWin32Error(ERROR_ACCESS_DENIED); SetLastWin32Error(ERROR_ACCESS_DENIED);
return FALSE; return FALSE;
@@ -2101,7 +2103,8 @@ BOOLEAN FASTCALL co_UserDestroyWindow(PWINDOW_OBJECT Window)
HWND *ChildHandle; HWND *ChildHandle;
PWINDOW_OBJECT Child, Desktop; PWINDOW_OBJECT Child, Desktop;
Desktop = UserGetWindowObject(IntGetDesktopWindow()); Desktop = IntIsDesktopWindow(Window) ? Window :
UserGetWindowObject(IntGetDesktopWindow());
Children = IntWinListChildren(Desktop); Children = IntWinListChildren(Desktop);
if (Children) if (Children)
@@ -2118,8 +2121,8 @@ BOOLEAN FASTCALL co_UserDestroyWindow(PWINDOW_OBJECT Window)
if (IntWndBelongsToThread(Child, PsGetWin32Thread())) if (IntWndBelongsToThread(Child, PsGetWin32Thread()))
{ {
USER_REFERENCE_ENTRY ChildRef;
UserRefObjectCo(Child);//temp hack? UserRefObjectCo(Child, &ChildRef);//temp hack?
co_UserDestroyWindow(Child); co_UserDestroyWindow(Child);
UserDerefObjectCo(Child);//temp hack? UserDerefObjectCo(Child);//temp hack?
@@ -2165,6 +2168,7 @@ NtUserDestroyWindow(HWND Wnd)
PWINDOW_OBJECT Window; PWINDOW_OBJECT Window;
DECLARE_RETURN(BOOLEAN); DECLARE_RETURN(BOOLEAN);
BOOLEAN ret; BOOLEAN ret;
USER_REFERENCE_ENTRY Ref;
DPRINT("Enter NtUserDestroyWindow\n"); DPRINT("Enter NtUserDestroyWindow\n");
UserEnterExclusive(); UserEnterExclusive();
@@ -2174,7 +2178,7 @@ NtUserDestroyWindow(HWND Wnd)
RETURN(FALSE); RETURN(FALSE);
} }
UserRefObjectCo(Window);//faxme: dunno if win should be reffed during destroy.. UserRefObjectCo(Window, &Ref);//faxme: dunno if win should be reffed during destroy..
ret = co_UserDestroyWindow(Window); ret = co_UserDestroyWindow(Window);
UserDerefObjectCo(Window);//faxme: dunno if win should be reffed during destroy.. UserDerefObjectCo(Window);//faxme: dunno if win should be reffed during destroy..
@@ -2270,7 +2274,7 @@ IntFindWindow(PWINDOW_OBJECT Parent,
/* Do not send WM_GETTEXT messages in the kernel mode version! /* Do not send WM_GETTEXT messages in the kernel mode version!
The user mode version however calls GetWindowText() which will The user mode version however calls GetWindowText() which will
send WM_GETTEXT messages to windows belonging to its processes */ send WM_GETTEXT messages to windows belonging to its processes */
if((!CheckWindowName || !RtlCompareUnicodeString(WindowName, &(Child->WindowName), FALSE)) && if((!CheckWindowName || !RtlCompareUnicodeString(WindowName, &(Child->WindowName), TRUE)) &&
(!ClassAtom || Child->Class->Atom == ClassAtom)) (!ClassAtom || Child->Class->Atom == ClassAtom))
{ {
Ret = Child->hSelf; Ret = Child->hSelf;
@@ -2449,7 +2453,7 @@ NtUserFindWindowEx(HWND hwndParent,
The user mode version however calls GetWindowText() which will The user mode version however calls GetWindowText() which will
send WM_GETTEXT messages to windows belonging to its processes */ send WM_GETTEXT messages to windows belonging to its processes */
WindowMatches = !CheckWindowName || !RtlCompareUnicodeString( WindowMatches = !CheckWindowName || !RtlCompareUnicodeString(
&WindowName, &TopLevelWindow->WindowName, FALSE); &WindowName, &TopLevelWindow->WindowName, TRUE);
ClassMatches = !CheckClassName || ClassMatches = !CheckClassName ||
ClassAtom == TopLevelWindow->Class->Atom; ClassAtom == TopLevelWindow->Class->Atom;
@@ -2778,6 +2782,7 @@ co_UserSetParent(HWND hWndChild, HWND hWndNewParent)
{ {
PWINDOW_OBJECT Wnd = NULL, WndParent = NULL, WndOldParent; PWINDOW_OBJECT Wnd = NULL, WndParent = NULL, WndOldParent;
HWND hWndOldParent = NULL; HWND hWndOldParent = NULL;
USER_REFERENCE_ENTRY Ref, ParentRef;
if (IntIsBroadcastHwnd(hWndChild) || IntIsBroadcastHwnd(hWndNewParent)) if (IntIsBroadcastHwnd(hWndChild) || IntIsBroadcastHwnd(hWndNewParent))
{ {
@@ -2811,8 +2816,8 @@ co_UserSetParent(HWND hWndChild, HWND hWndNewParent)
return( NULL); return( NULL);
} }
UserRefObjectCo(Wnd); UserRefObjectCo(Wnd, &Ref);
UserRefObjectCo(WndParent); UserRefObjectCo(WndParent, &ParentRef);
WndOldParent = co_IntSetParent(Wnd, WndParent); WndOldParent = co_IntSetParent(Wnd, WndParent);
@@ -2930,6 +2935,7 @@ NtUserSetShellWindowEx(HWND hwndShell, HWND hwndListView)
PWINSTATION_OBJECT WinStaObject; PWINSTATION_OBJECT WinStaObject;
PWINDOW_OBJECT WndShell; PWINDOW_OBJECT WndShell;
DECLARE_RETURN(BOOL); DECLARE_RETURN(BOOL);
USER_REFERENCE_ENTRY Ref;
DPRINT("Enter NtUserSetShellWindowEx\n"); DPRINT("Enter NtUserSetShellWindowEx\n");
UserEnterExclusive(); UserEnterExclusive();
@@ -2985,7 +2991,7 @@ NtUserSetShellWindowEx(HWND hwndShell, HWND hwndListView)
RETURN( FALSE); RETURN( FALSE);
} }
UserRefObjectCo(WndShell); UserRefObjectCo(WndShell, &Ref);
co_WinPosSetWindowPos(WndShell, HWND_BOTTOM, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE|SWP_NOACTIVATE); co_WinPosSetWindowPos(WndShell, HWND_BOTTOM, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE|SWP_NOACTIVATE);
WinStaObject->ShellWindow = hwndShell; WinStaObject->ShellWindow = hwndShell;
@@ -3876,7 +3882,9 @@ NtUserSetMenu(
if (Changed && Repaint) if (Changed && Repaint)
{ {
UserRefObjectCo(Window); USER_REFERENCE_ENTRY Ref;
UserRefObjectCo(Window, &Ref);
co_WinPosSetWindowPos(Window, 0, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE | co_WinPosSetWindowPos(Window, 0, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE |
SWP_NOACTIVATE | SWP_NOZORDER | SWP_FRAMECHANGED); SWP_NOACTIVATE | SWP_NOZORDER | SWP_FRAMECHANGED);
@@ -3917,6 +3925,7 @@ NtUserSetWindowPlacement(HWND hWnd,
WINDOWPLACEMENT Safepl; WINDOWPLACEMENT Safepl;
NTSTATUS Status; NTSTATUS Status;
DECLARE_RETURN(BOOL); DECLARE_RETURN(BOOL);
USER_REFERENCE_ENTRY Ref;
DPRINT("Enter NtUserSetWindowPlacement\n"); DPRINT("Enter NtUserSetWindowPlacement\n");
UserEnterExclusive(); UserEnterExclusive();
@@ -3936,7 +3945,7 @@ NtUserSetWindowPlacement(HWND hWnd,
RETURN( FALSE); RETURN( FALSE);
} }
UserRefObjectCo(Window); UserRefObjectCo(Window, &Ref);
if ((Window->Style & (WS_MAXIMIZE | WS_MINIMIZE)) == 0) if ((Window->Style & (WS_MAXIMIZE | WS_MINIMIZE)) == 0)
{ {
@@ -3982,6 +3991,7 @@ NtUserSetWindowPos(
DECLARE_RETURN(BOOL); DECLARE_RETURN(BOOL);
PWINDOW_OBJECT Window; PWINDOW_OBJECT Window;
BOOL ret; BOOL ret;
USER_REFERENCE_ENTRY Ref;
DPRINT("Enter NtUserSetWindowPos\n"); DPRINT("Enter NtUserSetWindowPos\n");
UserEnterExclusive(); UserEnterExclusive();
@@ -3991,7 +4001,7 @@ NtUserSetWindowPos(
RETURN(FALSE); RETURN(FALSE);
} }
UserRefObjectCo(Window); UserRefObjectCo(Window, &Ref);
ret = co_WinPosSetWindowPos(Window, hWndInsertAfter, X, Y, cx, cy, uFlags); ret = co_WinPosSetWindowPos(Window, hWndInsertAfter, X, Y, cx, cy, uFlags);
UserDerefObjectCo(Window); UserDerefObjectCo(Window);
@@ -4114,7 +4124,8 @@ NtUserSetWindowRgn(
if(bRedraw) if(bRedraw)
{ {
UserRefObjectCo(Window); USER_REFERENCE_ENTRY Ref;
UserRefObjectCo(Window, &Ref);
co_UserRedrawWindow(Window, NULL, NULL, RDW_INVALIDATE); co_UserRedrawWindow(Window, NULL, NULL, RDW_INVALIDATE);
UserDerefObjectCo(Window); UserDerefObjectCo(Window);
} }
@@ -4137,6 +4148,7 @@ NtUserShowWindow(HWND hWnd, LONG nCmdShow)
PWINDOW_OBJECT Window; PWINDOW_OBJECT Window;
BOOL ret; BOOL ret;
DECLARE_RETURN(BOOL); DECLARE_RETURN(BOOL);
USER_REFERENCE_ENTRY Ref;
DPRINT("Enter NtUserShowWindow\n"); DPRINT("Enter NtUserShowWindow\n");
UserEnterExclusive(); UserEnterExclusive();
@@ -4146,7 +4158,7 @@ NtUserShowWindow(HWND hWnd, LONG nCmdShow)
RETURN(FALSE); RETURN(FALSE);
} }
UserRefObjectCo(Window); UserRefObjectCo(Window, &Ref);
ret = co_WinPosShowWindow(Window, nCmdShow); ret = co_WinPosShowWindow(Window, nCmdShow);
UserDerefObjectCo(Window); UserDerefObjectCo(Window);
@@ -4206,6 +4218,7 @@ NtUserWindowFromPoint(LONG X, LONG Y)
HWND Ret; HWND Ret;
PWINDOW_OBJECT DesktopWindow = NULL, Window = NULL; PWINDOW_OBJECT DesktopWindow = NULL, Window = NULL;
DECLARE_RETURN(HWND); DECLARE_RETURN(HWND);
USER_REFERENCE_ENTRY Ref;
DPRINT("Enter NtUserWindowFromPoint\n"); DPRINT("Enter NtUserWindowFromPoint\n");
UserEnterExclusive(); UserEnterExclusive();
@@ -4219,7 +4232,7 @@ NtUserWindowFromPoint(LONG X, LONG Y)
//hmm... threads live on desktops thus we have a reference on the desktop and indirectly the desktop window //hmm... threads live on desktops thus we have a reference on the desktop and indirectly the desktop window
//its possible this referencing is useless, thou it shouldnt hurt... //its possible this referencing is useless, thou it shouldnt hurt...
UserRefObjectCo(DesktopWindow); UserRefObjectCo(DesktopWindow, &Ref);
Hit = co_WinPosWindowFromPoint(DesktopWindow, PsGetWin32Thread()->MessageQueue, &pt, &Window); Hit = co_WinPosWindowFromPoint(DesktopWindow, PsGetWin32Thread()->MessageQueue, &pt, &Window);

View File

@@ -149,6 +149,7 @@ co_WinPosActivateOtherWindow(PWINDOW_OBJECT Window)
{ {
PWINDOW_OBJECT WndTo = NULL; PWINDOW_OBJECT WndTo = NULL;
HWND Fg; HWND Fg;
USER_REFERENCE_ENTRY Ref;
ASSERT_REFS_CO(Window); ASSERT_REFS_CO(Window);
@@ -176,7 +177,7 @@ co_WinPosActivateOtherWindow(PWINDOW_OBJECT Window)
done: done:
if (WndTo) UserRefObjectCo(WndTo); if (WndTo) UserRefObjectCo(WndTo, &Ref);
Fg = UserGetForegroundWindow(); Fg = UserGetForegroundWindow();
if ((!Fg || Window->hSelf == Fg) && WndTo)//fixme: ok if WndTo is NULL?? if ((!Fg || Window->hSelf == Fg) && WndTo)//fixme: ok if WndTo is NULL??
@@ -224,7 +225,8 @@ co_WinPosArrangeIconicWindows(PWINDOW_OBJECT parent)
if((WndChild->Style & WS_MINIMIZE) != 0 ) if((WndChild->Style & WS_MINIMIZE) != 0 )
{ {
UserRefObjectCo(WndChild); USER_REFERENCE_ENTRY Ref;
UserRefObjectCo(WndChild, &Ref);
co_WinPosSetWindowPos(WndChild, 0, x + UserGetSystemMetrics(SM_CXBORDER), co_WinPosSetWindowPos(WndChild, 0, x + UserGetSystemMetrics(SM_CXBORDER),
y - yspacing - UserGetSystemMetrics(SM_CYBORDER) y - yspacing - UserGetSystemMetrics(SM_CYBORDER)
@@ -372,8 +374,8 @@ co_WinPosMinMaximize(PWINDOW_OBJECT Window, UINT ShowFlag, RECT* NewPos)
Window->Style &= ~WS_MINIMIZE; Window->Style &= ~WS_MINIMIZE;
if (Window->Flags & WINDOWOBJECT_RESTOREMAX) if (Window->Flags & WINDOWOBJECT_RESTOREMAX)
{ {
co_WinPosGetMinMaxInfo(Window, NULL, co_WinPosGetMinMaxInfo(Window, &Size,
&InternalPos->MaxPos, NULL, &Size); &InternalPos->MaxPos, NULL, NULL);
Window->Style |= WS_MAXIMIZE; Window->Style |= WS_MAXIMIZE;
IntGdiSetRect(NewPos, InternalPos->MaxPos.x, IntGdiSetRect(NewPos, InternalPos->MaxPos.x,
InternalPos->MaxPos.y, Size.x, Size.y); InternalPos->MaxPos.y, Size.x, Size.y);
@@ -596,7 +598,7 @@ co_WinPosDoWinPosChanging(PWINDOW_OBJECT Window,
if (!(WinPos->flags & SWP_NOSENDCHANGING)) if (!(WinPos->flags & SWP_NOSENDCHANGING))
{ {
co_IntSendMessage(Window->hSelf, WM_WINDOWPOSCHANGING, 0, (LPARAM) WinPos); co_IntPostOrSendMessage(Window->hSelf, WM_WINDOWPOSCHANGING, 0, (LPARAM) WinPos);
} }
*WindowRect = Window->WindowRect; *WindowRect = Window->WindowRect;
@@ -709,7 +711,8 @@ WinPosDoOwnedPopups(HWND hWnd, HWND hWndInsertAfter)
if ((Wnd->Style & WS_POPUP) && if ((Wnd->Style & WS_POPUP) &&
UserGetWindow(List[i], GW_OWNER) == hWnd) UserGetWindow(List[i], GW_OWNER) == hWnd)
{ {
UserRefObjectCo(Wnd); USER_REFERENCE_ENTRY Ref;
UserRefObjectCo(Wnd, &Ref);
co_WinPosSetWindowPos(Wnd, hWndInsertAfter, 0, 0, 0, 0, co_WinPosSetWindowPos(Wnd, hWndInsertAfter, 0, 0, 0, 0,
SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE | SWP_NOSENDCHANGING); SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE | SWP_NOSENDCHANGING);
@@ -1282,7 +1285,7 @@ co_WinPosSetWindowPos(
} }
if ((WinPos.flags & SWP_AGG_STATUSFLAGS) != SWP_AGG_NOPOSCHANGE) if ((WinPos.flags & SWP_AGG_STATUSFLAGS) != SWP_AGG_NOPOSCHANGE)
co_IntSendMessage(WinPos.hwnd, WM_WINDOWPOSCHANGED, 0, (LPARAM) &WinPos); co_IntPostOrSendMessage(WinPos.hwnd, WM_WINDOWPOSCHANGED, 0, (LPARAM) &WinPos);
return TRUE; return TRUE;
} }
@@ -1337,28 +1340,38 @@ co_WinPosShowWindow(PWINDOW_OBJECT Window, INT Cmd)
/* Fall through. */ /* Fall through. */
case SW_MINIMIZE: case SW_MINIMIZE:
{ {
Swp |= SWP_FRAMECHANGED | SWP_NOACTIVATE; Swp |= SWP_NOACTIVATE;
if (!(Window->Style & WS_MINIMIZE)) if (!(Window->Style & WS_MINIMIZE))
{ {
Swp |= co_WinPosMinMaximize(Window, SW_MINIMIZE, &NewPos); Swp |= co_WinPosMinMaximize(Window, SW_MINIMIZE, &NewPos) |
SWP_FRAMECHANGED;
} }
else else
{ {
Swp |= SWP_NOSIZE | SWP_NOMOVE; Swp |= SWP_NOSIZE | SWP_NOMOVE;
if (! WasVisible)
{
Swp |= SWP_FRAMECHANGED;
}
} }
break; break;
} }
case SW_SHOWMAXIMIZED: case SW_SHOWMAXIMIZED:
{ {
Swp |= SWP_SHOWWINDOW | SWP_FRAMECHANGED; Swp |= SWP_SHOWWINDOW;
if (!(Window->Style & WS_MAXIMIZE)) if (!(Window->Style & WS_MAXIMIZE))
{ {
Swp |= co_WinPosMinMaximize(Window, SW_MAXIMIZE, &NewPos); Swp |= co_WinPosMinMaximize(Window, SW_MAXIMIZE, &NewPos) |
SWP_FRAMECHANGED;
} }
else else
{ {
Swp |= SWP_NOSIZE | SWP_NOMOVE; Swp |= SWP_NOSIZE | SWP_NOMOVE;
if (! WasVisible)
{
Swp |= SWP_FRAMECHANGED;
}
} }
break; break;
} }
@@ -1377,14 +1390,19 @@ co_WinPosShowWindow(PWINDOW_OBJECT Window, INT Cmd)
case SW_SHOWNORMAL: case SW_SHOWNORMAL:
case SW_SHOWDEFAULT: case SW_SHOWDEFAULT:
case SW_RESTORE: case SW_RESTORE:
Swp |= SWP_SHOWWINDOW | SWP_FRAMECHANGED; Swp |= SWP_SHOWWINDOW;
if (Window->Style & (WS_MINIMIZE | WS_MAXIMIZE)) if (Window->Style & (WS_MINIMIZE | WS_MAXIMIZE))
{ {
Swp |= co_WinPosMinMaximize(Window, SW_RESTORE, &NewPos); Swp |= co_WinPosMinMaximize(Window, SW_RESTORE, &NewPos) |
SWP_FRAMECHANGED;
} }
else else
{ {
Swp |= SWP_NOSIZE | SWP_NOMOVE; Swp |= SWP_NOSIZE | SWP_NOMOVE;
if (! WasVisible)
{
Swp |= SWP_FRAMECHANGED;
}
} }
break; break;
} }
@@ -1514,6 +1532,7 @@ co_WinPosSearchChildren(
{ {
PWINDOW_OBJECT Current; PWINDOW_OBJECT Current;
HWND *List, *phWnd; HWND *List, *phWnd;
USER_REFERENCE_ENTRY Ref;
ASSERT_REFS_CO(ScopeWin); ASSERT_REFS_CO(ScopeWin);
@@ -1556,7 +1575,7 @@ co_WinPosSearchChildren(
break; break;
} }
UserRefObjectCo(Current); UserRefObjectCo(Current, &Ref);
if (OnlyHitTests && (Current->MessageQueue == OnlyHitTests)) if (OnlyHitTests && (Current->MessageQueue == OnlyHitTests))
{ {
@@ -1641,6 +1660,7 @@ NtUserGetMinMaxInfo(
MINMAXINFO SafeMinMax; MINMAXINFO SafeMinMax;
NTSTATUS Status; NTSTATUS Status;
DECLARE_RETURN(BOOL); DECLARE_RETURN(BOOL);
USER_REFERENCE_ENTRY Ref;
DPRINT("Enter NtUserGetMinMaxInfo\n"); DPRINT("Enter NtUserGetMinMaxInfo\n");
UserEnterExclusive(); UserEnterExclusive();
@@ -1650,7 +1670,7 @@ NtUserGetMinMaxInfo(
RETURN( FALSE); RETURN( FALSE);
} }
UserRefObjectCo(Window); UserRefObjectCo(Window, &Ref);
Size.x = Window->WindowRect.left; Size.x = Window->WindowRect.left;
Size.y = Window->WindowRect.top; Size.y = Window->WindowRect.top;

View File

@@ -1022,10 +1022,9 @@ NtGdiSetPixel(
INT Y, INT Y,
COLORREF Color) COLORREF Color)
{ {
COLORREF cr = NtGdiGetPixel(hDC,X,Y); if (NtGdiSetPixelV(hDC,X,Y,Color))
if(cr != CLR_INVALID && NtGdiSetPixelV(hDC,X,Y,Color))
{ {
return(cr); return NtGdiGetPixel(hDC,X,Y);
} }
return ((COLORREF) -1); return ((COLORREF) -1);
} }

View File

@@ -638,6 +638,7 @@ NtGdiUpdateColors(HDC hDC)
{ {
PWINDOW_OBJECT Wnd; PWINDOW_OBJECT Wnd;
BOOL calledFromUser, ret; BOOL calledFromUser, ret;
USER_REFERENCE_ENTRY Ref;
calledFromUser = UserIsEntered(); calledFromUser = UserIsEntered();
@@ -657,7 +658,7 @@ NtGdiUpdateColors(HDC hDC)
return FALSE; return FALSE;
} }
UserRefObjectCo(Wnd); UserRefObjectCo(Wnd, &Ref);
ret = co_UserRedrawWindow(Wnd, NULL, 0, RDW_INVALIDATE); ret = co_UserRedrawWindow(Wnd, NULL, 0, RDW_INVALIDATE);
UserDerefObjectCo(Wnd); UserDerefObjectCo(Wnd);

View File

@@ -661,6 +661,61 @@ IntPrepareDriverIfNeeded()
return (PrimarySurface.PreparedDriver ? TRUE : IntPrepareDriver()); return (PrimarySurface.PreparedDriver ? TRUE : IntPrepareDriver());
} }
static BOOL FASTCALL
PrepareVideoPrt()
{
PIRP Irp;
NTSTATUS Status;
IO_STATUS_BLOCK Iosb;
BOOL Prepare = TRUE;
ULONG Length = sizeof(BOOL);
PIO_STACK_LOCATION StackPtr;
LARGE_INTEGER StartOffset;
PFILE_OBJECT FileObject = PrimarySurface.VideoFileObject;
PDEVICE_OBJECT DeviceObject = FileObject->DeviceObject;
DPRINT("PrepareVideoPrt() called\n");
KeClearEvent(&PrimarySurface.VideoFileObject->Event);
ObReferenceObjectByPointer(FileObject, 0, IoFileObjectType, KernelMode);
StartOffset.QuadPart = 0;
Irp = IoBuildSynchronousFsdRequest(IRP_MJ_WRITE,
DeviceObject,
(PVOID) &Prepare,
Length,
&StartOffset,
NULL,
&Iosb);
if (NULL == Irp)
{
return FALSE;
}
/* Set up IRP Data */
Irp->Tail.Overlay.OriginalFileObject = FileObject;
Irp->RequestorMode = KernelMode;
Irp->Overlay.AsynchronousParameters.UserApcRoutine = NULL;
Irp->Overlay.AsynchronousParameters.UserApcContext = NULL;
Irp->Flags |= IRP_WRITE_OPERATION;
/* Setup Stack Data */
StackPtr = IoGetNextIrpStackLocation(Irp);
StackPtr->FileObject = PrimarySurface.VideoFileObject;
StackPtr->Parameters.Write.Key = 0;
Status = IoCallDriver(DeviceObject, Irp);
if (STATUS_PENDING == Status)
{
KeWaitForSingleObject(&FileObject->Event, Executive, KernelMode, TRUE, 0);
Status = Iosb.Status;
}
return NT_SUCCESS(Status);
}
BOOL FASTCALL BOOL FASTCALL
IntCreatePrimarySurface() IntCreatePrimarySurface()
{ {
@@ -674,6 +729,11 @@ IntCreatePrimarySurface()
return FALSE; return FALSE;
} }
if (! PrepareVideoPrt())
{
return FALSE;
}
DPRINT("calling EnableSurface\n"); DPRINT("calling EnableSurface\n");
/* Enable the drawing surface */ /* Enable the drawing surface */
PrimarySurface.Handle = PrimarySurface.Handle =

View File

@@ -1458,7 +1458,7 @@ NtGdiExtTextOut(
FT_Face face; FT_Face face;
FT_GlyphSlot glyph; FT_GlyphSlot glyph;
LONGLONG TextLeft, RealXStart; LONGLONG TextLeft, RealXStart;
ULONG TextTop, pitch, previous, BackgroundLeft; ULONG TextTop, previous, BackgroundLeft;
FT_Bool use_kerning; FT_Bool use_kerning;
RECTL DestRect, MaskRect, SpecifiedDestRect; RECTL DestRect, MaskRect, SpecifiedDestRect;
POINTL SourcePoint, BrushOrigin; POINTL SourcePoint, BrushOrigin;
@@ -1805,9 +1805,6 @@ NtGdiExtTextOut(
DPRINT1("WARNING: Failed to render glyph!\n"); DPRINT1("WARNING: Failed to render glyph!\n");
goto fail; goto fail;
} }
pitch = glyph->bitmap.pitch;
} else {
pitch = glyph->bitmap.width;
} }
if (fuOptions & ETO_OPAQUE) if (fuOptions & ETO_OPAQUE)
@@ -1845,9 +1842,17 @@ NtGdiExtTextOut(
* We should create the bitmap out of the loop at the biggest possible * We should create the bitmap out of the loop at the biggest possible
* glyph size. Then use memset with 0 to clear it and sourcerect to * glyph size. Then use memset with 0 to clear it and sourcerect to
* limit the work of the transbitblt. * limit the work of the transbitblt.
*
* FIXME: DIB bitmaps should have an lDelta which is a multiple of 4.
* Here we pass in the pitch from the FreeType bitmap, which is not
* guaranteed to be a multiple of 4. If it's not, we should expand
* the FreeType bitmap to a temporary bitmap.
*/ */
HSourceGlyph = EngCreateBitmap(bitSize, pitch, (glyph->bitmap.pixel_mode == ft_pixel_mode_grays) ? BMF_8BPP : BMF_1BPP, BMF_TOPDOWN, glyph->bitmap.buffer); HSourceGlyph = EngCreateBitmap(bitSize, glyph->bitmap.pitch,
(glyph->bitmap.pixel_mode == ft_pixel_mode_grays) ?
BMF_8BPP : BMF_1BPP, BMF_TOPDOWN,
glyph->bitmap.buffer);
if ( !HSourceGlyph ) if ( !HSourceGlyph )
{ {
DPRINT1("WARNING: EngLockSurface() failed!\n"); DPRINT1("WARNING: EngLockSurface() failed!\n");

View File

@@ -7,4 +7,5 @@
<library>gdi32</library> <library>gdi32</library>
<file>main.c</file> <file>main.c</file>
<file>dialog.c</file> <file>dialog.c</file>
<file>winemine.rc</file>
</module> </module>