Merge 15268:15329 from trunk
Modified: branches/xmlbuildsystem/reactos/bootdata/livecd.inf
Modified: branches/xmlbuildsystem/reactos/bootdata/packages/reactos.dff
Modified: branches/xmlbuildsystem/reactos/drivers/bus/serenum/detect.c
Modified: branches/xmlbuildsystem/reactos/drivers/dd/serial/create.c
Modified: branches/xmlbuildsystem/reactos/drivers/dd/serial/devctrl.c
Modified: branches/xmlbuildsystem/reactos/drivers/dd/serial/pnp.c
Modified: branches/xmlbuildsystem/reactos/include/ddk/obfuncs.h
Modified: branches/xmlbuildsystem/reactos/include/ddk/psfuncs.h
Modified: branches/xmlbuildsystem/reactos/include/ddk/pstypes.h
Modified: branches/xmlbuildsystem/reactos/lib/crt/stdlib/splitp.c
Modified: branches/xmlbuildsystem/reactos/lib/dinput/keyboard.c
Modified: branches/xmlbuildsystem/reactos/lib/dinput/mouse.c
Modified: branches/xmlbuildsystem/reactos/lib/user32/windows/hook.c
Modified: branches/xmlbuildsystem/reactos/ntoskrnl/cm/cm.h
Modified: branches/xmlbuildsystem/reactos/ntoskrnl/cm/ntfunc.c
Modified: branches/xmlbuildsystem/reactos/ntoskrnl/cm/registry.c
Modified: branches/xmlbuildsystem/reactos/ntoskrnl/cm/regobj.c
Modified: branches/xmlbuildsystem/reactos/ntoskrnl/ex/callback.c
Modified: branches/xmlbuildsystem/reactos/ntoskrnl/ex/event.c
Modified: branches/xmlbuildsystem/reactos/ntoskrnl/ex/evtpair.c
Modified: branches/xmlbuildsystem/reactos/ntoskrnl/ex/mutant.c
Modified: branches/xmlbuildsystem/reactos/ntoskrnl/ex/profile.c
Modified: branches/xmlbuildsystem/reactos/ntoskrnl/ex/sem.c
Modified: branches/xmlbuildsystem/reactos/ntoskrnl/ex/timer.c
Modified: branches/xmlbuildsystem/reactos/ntoskrnl/ex/win32k.c
Modified: branches/xmlbuildsystem/reactos/ntoskrnl/include/internal/io.h
Modified: branches/xmlbuildsystem/reactos/ntoskrnl/include/internal/ob.h
Modified: branches/xmlbuildsystem/reactos/ntoskrnl/include/internal/port.h
Modified: branches/xmlbuildsystem/reactos/ntoskrnl/include/internal/ps.h
Modified: branches/xmlbuildsystem/reactos/ntoskrnl/io/driver.c
Modified: branches/xmlbuildsystem/reactos/ntoskrnl/io/file.c
Modified: branches/xmlbuildsystem/reactos/ntoskrnl/io/iocomp.c
Modified: branches/xmlbuildsystem/reactos/ntoskrnl/io/iomgr.c
Modified: branches/xmlbuildsystem/reactos/ntoskrnl/io/irp.c
Modified: branches/xmlbuildsystem/reactos/ntoskrnl/io/share.c
Modified: branches/xmlbuildsystem/reactos/ntoskrnl/ke/wait.c
Modified: branches/xmlbuildsystem/reactos/ntoskrnl/ldr/init.c
Modified: branches/xmlbuildsystem/reactos/ntoskrnl/lpc/close.c
Modified: branches/xmlbuildsystem/reactos/ntoskrnl/lpc/create.c
Modified: branches/xmlbuildsystem/reactos/ntoskrnl/lpc/port.c
Modified: branches/xmlbuildsystem/reactos/ntoskrnl/mm/section.c
Modified: branches/xmlbuildsystem/reactos/ntoskrnl/ob/dirobj.c
Modified: branches/xmlbuildsystem/reactos/ntoskrnl/ob/handle.c
Modified: branches/xmlbuildsystem/reactos/ntoskrnl/ob/namespc.c
Modified: branches/xmlbuildsystem/reactos/ntoskrnl/ob/object.c
Modified: branches/xmlbuildsystem/reactos/ntoskrnl/ob/security.c
Modified: branches/xmlbuildsystem/reactos/ntoskrnl/ob/symlink.c
Modified: branches/xmlbuildsystem/reactos/ntoskrnl/ob/wait.c
Modified: branches/xmlbuildsystem/reactos/ntoskrnl/ps/cid.c
Modified: branches/xmlbuildsystem/reactos/ntoskrnl/ps/job.c
Modified: branches/xmlbuildsystem/reactos/ntoskrnl/ps/psmgr.c
Modified: branches/xmlbuildsystem/reactos/ntoskrnl/ps/security.c
Modified: branches/xmlbuildsystem/reactos/ntoskrnl/ps/win32.c
Modified: branches/xmlbuildsystem/reactos/ntoskrnl/se/token.c
Modified: branches/xmlbuildsystem/reactos/subsys/system/winefile/Sv.rc
Added: branches/xmlbuildsystem/reactos/subsys/system/winefile/cs.rc
Deleted: branches/xmlbuildsystem/reactos/subsys/system/winefile/cz.rc
Modified: branches/xmlbuildsystem/reactos/subsys/system/winefile/de.rc
Modified: branches/xmlbuildsystem/reactos/subsys/system/winefile/en.rc
Modified: branches/xmlbuildsystem/reactos/subsys/system/winefile/es.rc
Modified: branches/xmlbuildsystem/reactos/subsys/system/winefile/fr.rc
Modified: branches/xmlbuildsystem/reactos/subsys/system/winefile/hu.rc
Modified: branches/xmlbuildsystem/reactos/subsys/system/winefile/it.rc
Modified: branches/xmlbuildsystem/reactos/subsys/system/winefile/nl.rc
Added: branches/xmlbuildsystem/reactos/subsys/system/winefile/pl.rc
Modified: branches/xmlbuildsystem/reactos/subsys/system/winefile/pt.rc
Modified: branches/xmlbuildsystem/reactos/subsys/system/winefile/resource.h
Modified: branches/xmlbuildsystem/reactos/subsys/system/winefile/ru.rc
Modified: branches/xmlbuildsystem/reactos/subsys/system/winefile/si.rc
Modified: branches/xmlbuildsystem/reactos/subsys/system/winefile/winefile.c
Modified: branches/xmlbuildsystem/reactos/subsys/system/winefile/winefile.dsp
Modified: branches/xmlbuildsystem/reactos/subsys/system/winefile/winefile.rc
Modified: branches/xmlbuildsystem/reactos/subsys/system/winefile/zh.rc
Modified: branches/xmlbuildsystem/reactos/subsys/win32k/include/desktop.h
Modified: branches/xmlbuildsystem/reactos/subsys/win32k/include/msgqueue.h
Modified: branches/xmlbuildsystem/reactos/subsys/win32k/include/winsta.h
Modified: branches/xmlbuildsystem/reactos/subsys/win32k/main/dllmain.c
Modified: branches/xmlbuildsystem/reactos/subsys/win32k/ntuser/callback.c
Modified: branches/xmlbuildsystem/reactos/subsys/win32k/ntuser/desktop.c
Modified: branches/xmlbuildsystem/reactos/subsys/win32k/ntuser/hook.c
Modified: branches/xmlbuildsystem/reactos/subsys/win32k/ntuser/input.c
Modified: branches/xmlbuildsystem/reactos/subsys/win32k/ntuser/message.c
Modified: branches/xmlbuildsystem/reactos/subsys/win32k/ntuser/msgqueue.c
Modified: branches/xmlbuildsystem/reactos/subsys/win32k/ntuser/winsta.c
Modified: branches/xmlbuildsystem/reactos/subsys/win32k/w32k.h
Modified: branches/xmlbuildsystem/reactos/tools/cdmake/cdmake.c
Modified: branches/xmlbuildsystem/reactos/w32api/include/ddk/winddk.h
Modified: branches/xmlbuildsystem/reactos/w32api/include/winuser.h

Modified: branches/xmlbuildsystem/reactos/bootdata/livecd.inf
--- branches/xmlbuildsystem/reactos/bootdata/livecd.inf	2005-05-16 12:18:02 UTC (rev 15338)
+++ branches/xmlbuildsystem/reactos/bootdata/livecd.inf	2005-05-16 12:32:10 UTC (rev 15339)
@@ -19,6 +19,9 @@
 ; Shell
 HKLM,"SYSTEM\Setup","CmdLine",0x00020000,"%SystemRoot%\explorer.exe"
 
+; Serial mouse driver
+HKLM,"SYSTEM\CurrentControlSet\Services\Sermouse","Start",0x00010001,0x00000001
+
 ; User Profile List
 HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList",,0x00000012
 HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList","ProfilesDirectory",0x00020000,"%SystemDrive%\Profiles"

Modified: branches/xmlbuildsystem/reactos/bootdata/packages/reactos.dff
--- branches/xmlbuildsystem/reactos/bootdata/packages/reactos.dff	2005-05-16 12:18:02 UTC (rev 15338)
+++ branches/xmlbuildsystem/reactos/bootdata/packages/reactos.dff	2005-05-16 12:32:10 UTC (rev 15339)
@@ -169,6 +169,7 @@
 subsys\system\winlogon\winlogon.exe     1
 subsys\system\winefile\winefile.exe     1
 subsys\system\dhcp\dhcp.exe             1
+subsys\system\sm\sm.exe                 1
 services\eventlog\eventlog.exe          1
 services\rpcss\rpcss.exe                1
 services\umpnpmgr\umpnpmgr.exe          1

Modified: branches/xmlbuildsystem/reactos/drivers/bus/serenum/detect.c
--- branches/xmlbuildsystem/reactos/drivers/bus/serenum/detect.c	2005-05-16 12:18:02 UTC (rev 15338)
+++ branches/xmlbuildsystem/reactos/drivers/bus/serenum/detect.c	2005-05-16 12:32:10 UTC (rev 15339)
@@ -62,6 +62,44 @@
 }
 
 static NTSTATUS
+SerenumSendIrp(
+	IN PDEVICE_OBJECT DeviceObject,
+	IN ULONG MajorFunction)
+{
+	KEVENT Event;
+	PIRP Irp;
+	IO_STATUS_BLOCK IoStatus;
+	NTSTATUS Status;
+
+	KeInitializeEvent(&Event, NotificationEvent, FALSE);
+	
+	Irp = IoBuildSynchronousFsdRequest(
+		MajorFunction,
+		DeviceObject,
+		NULL,
+		0,
+		NULL,
+		&Event,
+		&IoStatus);
+	if (Irp == NULL)
+	{
+		DPRINT("Serenum: IoBuildSynchronousFsdRequest() failed\n");
+		return STATUS_INSUFFICIENT_RESOURCES;
+	}
+	
+	Status = IoCallDriver(DeviceObject, Irp);
+
+	if (Status == STATUS_PENDING)
+	{
+		DPRINT("Serenum: Operation pending\n");
+		KeWaitForSingleObject(&Event, Suspended, KernelMode, FALSE, NULL);
+		Status = IoStatus.Status;
+	}
+
+	return Status;
+}
+
+static NTSTATUS
 ReadBytes(
 	IN PDEVICE_OBJECT LowerDevice,
 	OUT PUCHAR Buffer,
@@ -224,91 +262,95 @@
 	SERIAL_TIMEOUTS Timeouts;
 	SERIALPERF_STATS PerfStats;
 	NTSTATUS Status;
+	
+	/* Open port */
+	Status = SerenumSendIrp(LowerDevice, IRP_MJ_CREATE);
+	if (!NT_SUCCESS(Status)) goto ByeBye;
 
 	/* 1. COM port initialization, check for device enumerate */
 	CHECKPOINT;
 	Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_CLR_DTR,
 		NULL, 0, NULL, NULL);
-	if (!NT_SUCCESS(Status)) return Status;
+	if (!NT_SUCCESS(Status)) goto ByeBye;
 	Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_CLR_RTS,
 		NULL, 0, NULL, NULL);
-	if (!NT_SUCCESS(Status)) return Status;
+	if (!NT_SUCCESS(Status)) goto ByeBye;
 	SerenumWait(200);
 	Size = sizeof(Msr);
 	Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_GET_MODEMSTATUS,
 		NULL, 0, &Msr, &Size);
-	if (!NT_SUCCESS(Status)) return Status;
+	if (!NT_SUCCESS(Status)) goto ByeBye;
 	if ((Msr & SR_MSR_DSR) == 0) goto SerenumDisconnectIdle;
 
 	/* 2. COM port setup, 1st phase */
 	CHECKPOINT;
-	BaudRate = SERIAL_BAUD_1200;
+	BaudRate = 1200;
 	Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_BAUD_RATE,
 		&BaudRate, sizeof(BaudRate), NULL, 0);
-	if (!NT_SUCCESS(Status)) return Status;
+	if (!NT_SUCCESS(Status)) goto ByeBye;
 	Lcr.WordLength = 7;
 	Lcr.Parity = NO_PARITY;
 	Lcr.StopBits = STOP_BIT_1;
 	Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_LINE_CONTROL,
 		&Lcr, sizeof(Lcr), NULL, NULL);
-	if (!NT_SUCCESS(Status)) return Status;
+	if (!NT_SUCCESS(Status)) goto ByeBye;
 	Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_CLR_DTR,
 		NULL, 0, NULL, NULL);
-	if (!NT_SUCCESS(Status)) return Status;
+	if (!NT_SUCCESS(Status)) goto ByeBye;
 	Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_CLR_RTS,
 		NULL, 0, NULL, NULL);
-	if (!NT_SUCCESS(Status)) return Status;
+	if (!NT_SUCCESS(Status)) goto ByeBye;
 	SerenumWait(200);
 	Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_DTR,
 		NULL, 0, NULL, NULL);
-	if (!NT_SUCCESS(Status)) return Status;
+	if (!NT_SUCCESS(Status)) goto ByeBye;
 	SerenumWait(200);
 
 	/* 3. Wait for response, 1st phase */
 	CHECKPOINT;
 	Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_RTS,
 		NULL, 0, NULL, NULL);
-	if (!NT_SUCCESS(Status)) return Status;
+	if (!NT_SUCCESS(Status)) goto ByeBye;
 	Timeouts.ReadIntervalTimeout = 0;
 	Timeouts.ReadTotalTimeoutMultiplier = 0;
 	Timeouts.ReadTotalTimeoutConstant = 200;
 	Timeouts.WriteTotalTimeoutMultiplier = Timeouts.WriteTotalTimeoutConstant = 0;
 	Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_TIMEOUTS,
 		&Timeouts, sizeof(Timeouts), NULL, NULL);
-	if (!NT_SUCCESS(Status)) return Status;
+	if (!NT_SUCCESS(Status)) goto ByeBye;
 	Status = ReadBytes(LowerDevice, Buffer, sizeof(Buffer), &Size);
-	if (!NT_SUCCESS(Status)) return Status;
+	if (!NT_SUCCESS(Status)) goto ByeBye;
 	if (Size != 0) goto SerenumCollectPnpComDeviceId;
 
 	/* 4. COM port setup, 2nd phase */
 	CHECKPOINT;
 	Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_CLR_DTR,
 		NULL, 0, NULL, NULL);
-	if (!NT_SUCCESS(Status)) return Status;
+	if (!NT_SUCCESS(Status)) goto ByeBye;
 	Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_CLR_RTS,
 		NULL, 0, NULL, NULL);
-	if (!NT_SUCCESS(Status)) return Status;
+	if (!NT_SUCCESS(Status)) goto ByeBye;
 	Purge = SERIAL_PURGE_RXABORT | SERIAL_PURGE_RXCLEAR;
 	Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_PURGE,
 		&Purge, 0, NULL, NULL);
-	if (!NT_SUCCESS(Status)) return Status;
+	if (!NT_SUCCESS(Status)) goto ByeBye;
 	SerenumWait(200);
 
 	/* 5. Wait for response, 2nd phase */
 	CHECKPOINT;
 	Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_DTR,
 		NULL, 0, NULL, NULL);
-	if (!NT_SUCCESS(Status)) return Status;
+	if (!NT_SUCCESS(Status)) goto ByeBye;
 	Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_RTS,
 		NULL, 0, NULL, NULL);
-	if (!NT_SUCCESS(Status)) return Status;
+	if (!NT_SUCCESS(Status)) goto ByeBye;
 	Status = ReadBytes(LowerDevice, Buffer, 1, &TotalBytesReceived);
-	if (!NT_SUCCESS(Status)) return Status;
+	if (!NT_SUCCESS(Status)) goto ByeBye;
 	if (TotalBytesReceived != 0) goto SerenumCollectPnpComDeviceId;
 	Size = sizeof(Msr);
 	Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_GET_MODEMSTATUS,
 		NULL, 0, &Msr, &Size);
-	if (!NT_SUCCESS(Status)) return Status;
+	if (!NT_SUCCESS(Status)) goto ByeBye;
 	if ((Msr & SR_MSR_DSR) == 0) goto SerenumVerifyDisconnect; else goto SerenumConnectIdle;
 
 	/* 6. Collect PnP COM device ID */
@@ -319,14 +361,14 @@
 	Timeouts.ReadTotalTimeoutConstant = 2200;
 	Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_TIMEOUTS,
 		&Timeouts, sizeof(Timeouts), NULL, NULL);
-	if (!NT_SUCCESS(Status)) return Status;
+	if (!NT_SUCCESS(Status)) goto ByeBye;
 	Status = ReadBytes(LowerDevice, &Buffer[TotalBytesReceived], sizeof(Buffer) - TotalBytesReceived, &Size);
-	if (!NT_SUCCESS(Status)) return Status;
+	if (!NT_SUCCESS(Status)) goto ByeBye;
 	TotalBytesReceived += Size;
 	Size = sizeof(PerfStats);
 	Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_GET_STATS,
 		NULL, 0, &PerfStats, &Size);
-	if (!NT_SUCCESS(Status)) return Status;
+	if (!NT_SUCCESS(Status)) goto ByeBye;
 	if (PerfStats.FrameErrorCount + PerfStats.ParityErrorCount != 0) goto SerenumConnectIdle;
 	for (i = 0; i < TotalBytesReceived; i++)
 	{
@@ -336,7 +378,10 @@
 	if (TotalBytesReceived == 1 || BufferContainsEndId)
 	{
 		if (SerenumIsValidPnpIdString(Buffer, TotalBytesReceived))
-			return ReportDetectedPnpDevice(Buffer, TotalBytesReceived);
+		{
+			Status = ReportDetectedPnpDevice(Buffer, TotalBytesReceived);
+			goto ByeBye;
+		}
 		goto SerenumConnectIdle;
 	}
 	if (!BufferContainsBeginId) goto SerenumConnectIdle;
@@ -344,7 +389,7 @@
 	Size = sizeof(Msr);
 	Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_GET_MODEMSTATUS,
 		NULL, 0, &Msr, &Size);
-	if (!NT_SUCCESS(Status)) return Status;
+	if (!NT_SUCCESS(Status)) goto ByeBye;
 	if ((Msr & SR_MSR_DSR) == 0) goto SerenumVerifyDisconnect;
 
 	/* 7. Verify disconnect */
@@ -352,10 +397,10 @@
 	CHECKPOINT;
 	Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_DTR,
 		NULL, 0, NULL, NULL);
-	if (!NT_SUCCESS(Status)) return Status;
+	if (!NT_SUCCESS(Status)) goto ByeBye;
 	Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_CLR_RTS,
 		NULL, 0, NULL, NULL);
-	if (!NT_SUCCESS(Status)) return Status;
+	if (!NT_SUCCESS(Status)) goto ByeBye;
 	SerenumWait(5000);
 	goto SerenumDisconnectIdle;
 
@@ -364,24 +409,25 @@
 	CHECKPOINT;
 	Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_DTR,
 		NULL, 0, NULL, NULL);
-	if (!NT_SUCCESS(Status)) return Status;
+	if (!NT_SUCCESS(Status)) goto ByeBye;
 	Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_CLR_RTS,
 		NULL, 0, NULL, NULL);
-	if (!NT_SUCCESS(Status)) return Status;
-	BaudRate = SERIAL_BAUD_300;
+	if (!NT_SUCCESS(Status)) goto ByeBye;
+	BaudRate = 300;
 	Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_BAUD_RATE,
 		&BaudRate, sizeof(BaudRate), NULL, NULL);
-	if (!NT_SUCCESS(Status)) return Status;
+	if (!NT_SUCCESS(Status)) goto ByeBye;
 	Lcr.WordLength = 7;
 	Lcr.Parity = NO_PARITY;
 	Lcr.StopBits = STOP_BIT_1;
 	Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_LINE_CONTROL,
 		&Lcr, sizeof(Lcr), NULL, NULL);
-	if (!NT_SUCCESS(Status)) return Status;
+	if (!NT_SUCCESS(Status)) goto ByeBye;
 	if (TotalBytesReceived == 0)
-		return STATUS_DEVICE_NOT_CONNECTED;
+		Status = STATUS_DEVICE_NOT_CONNECTED;
 	else
-		return STATUS_SUCCESS;
+		Status = STATUS_SUCCESS;
+	goto ByeBye;
 
 	/* 9. Disconnect idle */
 SerenumDisconnectIdle:
@@ -389,21 +435,27 @@
 	/* FIXME: report to OS device removal, if it was present */
 	Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_DTR,
 		NULL, 0, NULL, NULL);
-	if (!NT_SUCCESS(Status)) return Status;
+	if (!NT_SUCCESS(Status)) goto ByeBye;
 	Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_CLR_RTS,
 		NULL, 0, NULL, NULL);
-	if (!NT_SUCCESS(Status)) return Status;
-	BaudRate = SERIAL_BAUD_300;
+	if (!NT_SUCCESS(Status)) goto ByeBye;
+	BaudRate = 300;
 	Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_BAUD_RATE,
 		&BaudRate, sizeof(BaudRate), NULL, NULL);
-	if (!NT_SUCCESS(Status)) return Status;
+	if (!NT_SUCCESS(Status)) goto ByeBye;
 	Lcr.WordLength = 7;
 	Lcr.Parity = NO_PARITY;
 	Lcr.StopBits = STOP_BIT_1;
 	Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_LINE_CONTROL,
 		&Lcr, sizeof(Lcr), NULL, NULL);
-	if (!NT_SUCCESS(Status)) return Status;
-	return STATUS_DEVICE_NOT_CONNECTED;
+	if (!NT_SUCCESS(Status)) goto ByeBye;
+	Status = STATUS_DEVICE_NOT_CONNECTED;
+
+ByeBye:
+	/* Close port */
+	SerenumSendIrp(LowerDevice, IRP_MJ_CLOSE);
+	SerenumSendIrp(LowerDevice, IRP_MJ_CLEANUP);
+	return Status;
 }
 
 NTSTATUS
@@ -429,13 +481,17 @@
 		LowerDevice);
 
 	RtlZeroMemory(Buffer, sizeof(Buffer));
+	
+	/* Open port */
+	Status = SerenumSendIrp(LowerDevice, IRP_MJ_CREATE);
+	if (!NT_SUCCESS(Status)) goto ByeBye;
 
 	/* Reset UART */
 	CHECKPOINT;
 	Mcr = 0; /* MCR: DTR/RTS/OUT2 off */
 	Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_MODEM_CONTROL,
 		&Mcr, sizeof(Mcr), NULL, NULL);
-	if (!NT_SUCCESS(Status)) return Status;
+	if (!NT_SUCCESS(Status)) goto ByeBye;
 
 	/* Set communications parameters */
 	CHECKPOINT;
@@ -443,26 +499,26 @@
 	Fcr = 0;
 	Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_FIFO_CONTROL,
 		&Fcr, sizeof(Fcr), NULL, NULL);
-	if (!NT_SUCCESS(Status)) return Status;
+	if (!NT_SUCCESS(Status)) goto ByeBye;
 	/* Set serial port speed */
-	BaudRate = SERIAL_BAUD_1200;
+	BaudRate = 1200;
 	Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_BAUD_RATE,
 		&BaudRate, sizeof(BaudRate), NULL, NULL);
-	if (!NT_SUCCESS(Status)) return Status;
+	if (!NT_SUCCESS(Status)) goto ByeBye;
 	/* Set LCR */
 	LCR.WordLength = 7;
 	LCR.Parity = NO_PARITY;
 	LCR.StopBits = STOP_BITS_2;
 	Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_LINE_CONTROL,
 		&LCR, sizeof(LCR), NULL, NULL);
-	if (!NT_SUCCESS(Status)) return Status;
+	if (!NT_SUCCESS(Status)) goto ByeBye;
 
 	/* Flush receive buffer */
 	CHECKPOINT;
 	Command = SERIAL_PURGE_RXCLEAR;
 	Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_MODEM_CONTROL,
 		&Command, sizeof(Command), NULL, NULL);
-	if (!NT_SUCCESS(Status)) return Status;
+	if (!NT_SUCCESS(Status)) goto ByeBye;
 	/* Wait 100 ms */
 	SerenumWait(100);
 
@@ -470,10 +526,10 @@
 	CHECKPOINT;
 	Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_DTR,
 		NULL, 0, NULL, NULL);
-	if (!NT_SUCCESS(Status)) return Status;
+	if (!NT_SUCCESS(Status)) goto ByeBye;
 	Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_RTS,
 		NULL, 0, NULL, NULL);
-	if (!NT_SUCCESS(Status)) return Status;
+	if (!NT_SUCCESS(Status)) goto ByeBye;
 
 	/* Set timeout to 500 microseconds */
 	CHECKPOINT;
@@ -483,12 +539,12 @@
 	Timeouts.WriteTotalTimeoutMultiplier = Timeouts.WriteTotalTimeoutConstant = 0;
 	Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_TIMEOUTS,
 		&Timeouts, sizeof(Timeouts), NULL, NULL);
-	if (!NT_SUCCESS(Status)) return Status;
+	if (!NT_SUCCESS(Status)) goto ByeBye;
 
 	/* Fill the read buffer */
 	CHECKPOINT;
 	Status = ReadBytes(LowerDevice, Buffer, sizeof(Buffer)/sizeof(Buffer[0]), &Count);
-	if (!NT_SUCCESS(Status)) return Status;
+	if (!NT_SUCCESS(Status)) goto ByeBye;
 
 	for (i = 0; i < Count; i++)
 	{
@@ -506,7 +562,7 @@
 				&DeviceDescription, &DeviceId, &HardwareIds, &CompatibleIds);
 			RtlFreeUnicodeString(&HardwareIds);
 			RtlFreeUnicodeString(&CompatibleIds);
-			return Status;
+			goto ByeBye;
 		}
 		else if (Buffer[i] == 'M')
 		{
@@ -514,7 +570,8 @@
 			if (i == sizeof(Buffer) - 1)
 			{
 				/* Overflow Error */
-				return STATUS_DEVICE_NOT_CONNECTED;
+				Status = STATUS_DEVICE_NOT_CONNECTED;
+				goto ByeBye;
 			}
 			switch (Buffer[i + 1])
 			{
@@ -539,9 +596,15 @@
 				&DeviceDescription, &DeviceId, &HardwareIds, &CompatibleIds);
 			RtlFreeUnicodeString(&HardwareIds);
 			RtlFreeUnicodeString(&CompatibleIds);
-			return Status;
+			goto ByeBye;
 		}
 	}
 
-	return STATUS_DEVICE_NOT_CONNECTED;
+	Status = STATUS_DEVICE_NOT_CONNECTED;
+	
+ByeBye:
+	/* Close port */
+	SerenumSendIrp(LowerDevice, IRP_MJ_CLOSE);
+	SerenumSendIrp(LowerDevice, IRP_MJ_CLEANUP);
+	return Status;
 }

Modified: branches/xmlbuildsystem/reactos/drivers/dd/serial/create.c
--- branches/xmlbuildsystem/reactos/drivers/dd/serial/create.c	2005-05-16 12:18:02 UTC (rev 15338)
+++ branches/xmlbuildsystem/reactos/drivers/dd/serial/create.c	2005-05-16 12:32:10 UTC (rev 15339)
@@ -17,17 +17,13 @@
 	IN PIRP Irp)
 {
 	PIO_STACK_LOCATION Stack;
-	PFILE_OBJECT FileObject;
 	PSERIAL_DEVICE_EXTENSION DeviceExtension;
 	NTSTATUS Status;
 
 	DPRINT("Serial: IRP_MJ_CREATE\n");
 	Stack = IoGetCurrentIrpStackLocation(Irp);
-	FileObject = Stack->FileObject;
 	DeviceExtension = (PSERIAL_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
 
-	ASSERT(FileObject);
-
 	if (Stack->Parameters.Create.Options & FILE_DIRECTORY_FILE)
 	{
 		CHECKPOINT;
@@ -35,14 +31,6 @@
 		goto ByeBye;
 	}
 
-	if (FileObject->FileName.Length != 0 ||
-		FileObject->RelatedFileObject != NULL)
-	{
-		CHECKPOINT;
-		Status = STATUS_ACCESS_DENIED;
-		goto ByeBye;
-	}
-
 	if(DeviceExtension->IsOpened)
 	{
 		DPRINT("Serial: COM%lu is already opened\n", DeviceExtension->ComPort);

Modified: branches/xmlbuildsystem/reactos/drivers/dd/serial/devctrl.c
--- branches/xmlbuildsystem/reactos/drivers/dd/serial/devctrl.c	2005-05-16 12:18:02 UTC (rev 15338)
+++ branches/xmlbuildsystem/reactos/drivers/dd/serial/devctrl.c	2005-05-16 12:32:10 UTC (rev 15339)
@@ -51,60 +51,29 @@
 	IN PSERIAL_DEVICE_EXTENSION DeviceExtension,
 	IN ULONG NewBaudRate)
 {
+	ULONG BaudRate;
 	USHORT divisor;
 	PUCHAR ComPortBase = (PUCHAR)DeviceExtension->BaseAddress;
-	ULONG BaudRate;
 	NTSTATUS Status = STATUS_SUCCESS;
 
-	if (NewBaudRate & SERIAL_BAUD_USER)
-	{
-		BaudRate = NewBaudRate & ~SERIAL_BAUD_USER;
-		divisor = (USHORT)(BAUD_CLOCK / (CLOCKS_PER_BIT * BaudRate));
-	}
-	else
-	{
-		switch (NewBaudRate)
-		{
-			case SERIAL_BAUD_075:    divisor = 0x600; BaudRate = 75; break;
-			case SERIAL_BAUD_110:    divisor = 0x400; BaudRate = 110; break;
-			case SERIAL_BAUD_134_5:  divisor = 0x360; BaudRate = 134; break;
-			case SERIAL_BAUD_150:    divisor = 0x300; BaudRate = 150; break;
-			case SERIAL_BAUD_300:    divisor = 0x180; BaudRate = 300; break;
-			case SERIAL_BAUD_600:    divisor = 0xc0;  BaudRate = 600; break;
-			case SERIAL_BAUD_1200:   divisor = 0x60;  BaudRate = 1200; break;
-			case SERIAL_BAUD_1800:   divisor = 0x40;  BaudRate = 1800; break;
-			case SERIAL_BAUD_2400:   divisor = 0x30;  BaudRate = 2400; break;
-			case SERIAL_BAUD_4800:   divisor = 0x18;  BaudRate = 4800; break;
-			case SERIAL_BAUD_7200:   divisor = 0x10;  BaudRate = 7200; break;
-			case SERIAL_BAUD_9600:   divisor = 0xc;   BaudRate = 9600; break;
-			case SERIAL_BAUD_14400:  divisor = 0x8;   BaudRate = 14400; break;
-			case SERIAL_BAUD_38400:  divisor = 0x3;   BaudRate = 38400; break;
-			case SERIAL_BAUD_57600:  divisor = 0x2;   BaudRate = 57600; break;
-			case SERIAL_BAUD_115200: divisor = 0x1;   BaudRate = 115200; break;
-			case SERIAL_BAUD_56K:    divisor = 0x2;   BaudRate = 57600; break;
-			case SERIAL_BAUD_128K:   divisor = 0x1;   BaudRate = 115200; break;
-			default: Status = STATUS_INVALID_PARAMETER;
-		}
-	}
+	divisor = (USHORT)(BAUD_CLOCK / (CLOCKS_PER_BIT * NewBaudRate));
+	BaudRate = BAUD_CLOCK / (CLOCKS_PER_BIT * divisor);
 
+	Status = IoAcquireRemoveLock(&DeviceExtension->RemoveLock, (PVOID)DeviceExtension->ComPort);
 	if (NT_SUCCESS(Status))
 	{
-		Status = IoAcquireRemoveLock(&DeviceExtension->RemoveLock, (PVOID)DeviceExtension->ComPort);
-		if (NT_SUCCESS(Status))
-		{
-			UCHAR Lcr;
-			DPRINT("Serial: SerialSetBaudRate(COM%lu, %lu Bauds)\n", DeviceExtension->ComPort, BaudRate);
-			/* Set Bit 7 of LCR to expose baud registers */
-			Lcr = READ_PORT_UCHAR(SER_LCR(ComPortBase));
-			WRITE_PORT_UCHAR(SER_LCR(ComPortBase), Lcr | SR_LCR_DLAB);
-			/* Write the baud rate */
-			WRITE_PORT_UCHAR(SER_DLL(ComPortBase), divisor & 0xff);
-			WRITE_PORT_UCHAR(SER_DLM(ComPortBase), divisor >> 8);
-			/* Switch back to normal registers */
-			WRITE_PORT_UCHAR(SER_LCR(ComPortBase), Lcr);
+		UCHAR Lcr;
+		DPRINT("Serial: SerialSetBaudRate(COM%lu, %lu Bauds)\n", DeviceExtension->ComPort, BaudRate);
+		/* Set Bit 7 of LCR to expose baud registers */
+		Lcr = READ_PORT_UCHAR(SER_LCR(ComPortBase));
+		WRITE_PORT_UCHAR(SER_LCR(ComPortBase), Lcr | SR_LCR_DLAB);
+		/* Write the baud rate */
+		WRITE_PORT_UCHAR(SER_DLL(ComPortBase), divisor & 0xff);
+		WRITE_PORT_UCHAR(SER_DLM(ComPortBase), divisor >> 8);
+		/* Switch back to normal registers */
+		WRITE_PORT_UCHAR(SER_LCR(ComPortBase), Lcr);
 
-			IoReleaseRemoveLock(&DeviceExtension->RemoveLock, (PVOID)DeviceExtension->ComPort);
-		}
+		IoReleaseRemoveLock(&DeviceExtension->RemoveLock, (PVOID)DeviceExtension->ComPort);
 	}
 
 	if (NT_SUCCESS(Status))
@@ -244,16 +213,14 @@
 		| SERIAL_BAUD_150 | SERIAL_BAUD_300 | SERIAL_BAUD_600 | SERIAL_BAUD_1200
 		| SERIAL_BAUD_1800 | SERIAL_BAUD_2400 | SERIAL_BAUD_4800 | SERIAL_BAUD_7200
 		| SERIAL_BAUD_9600 | SERIAL_BAUD_USER;
-	pCommProp->MaxBaud = SERIAL_BAUD_9600;
+	pCommProp->MaxBaud = SERIAL_BAUD_USER;
 	if (DeviceExtension->UartType >= Uart16450)
 	{
 		pCommProp->SettableBaud |= SERIAL_BAUD_14400 | SERIAL_BAUD_19200 | SERIAL_BAUD_38400;
-		pCommProp->MaxBaud = SERIAL_BAUD_38400;
 	}
 	if (DeviceExtension->UartType >= Uart16550)
 	{
 		pCommProp->SettableBaud |= SERIAL_BAUD_56K | SERIAL_BAUD_57600 | SERIAL_BAUD_115200 | SERIAL_BAUD_128K;
-		pCommProp->MaxBaud = SERIAL_BAUD_115200;
 	}
 
 	pCommProp->SettableData = SERIAL_DATABITS_5 | SERIAL_DATABITS_6 | SERIAL_DATABITS_7 | SERIAL_DATABITS_8;

Modified: branches/xmlbuildsystem/reactos/drivers/dd/serial/pnp.c
--- branches/xmlbuildsystem/reactos/drivers/dd/serial/pnp.c	2005-05-16 12:18:02 UTC (rev 15338)
+++ branches/xmlbuildsystem/reactos/drivers/dd/serial/pnp.c	2005-05-16 12:32:10 UTC (rev 15339)
@@ -154,7 +154,7 @@
 	ASSERT(DeviceExtension);
 	ASSERT(DeviceExtension->PnpState == dsStopped);
 
-	DeviceExtension->BaudRate = 19200 | SERIAL_BAUD_USER;
+	DeviceExtension->BaudRate = 19200;
 	DeviceExtension->BaseAddress = 0;
 	Dirql = 0;
 	for (i = 0; i < ResourceList->Count; i++)
@@ -308,8 +308,33 @@
 
 	switch (MinorFunction)
 	{
-		case IRP_MN_START_DEVICE:
+		/* FIXME: do all these minor functions
+		IRP_MN_QUERY_REMOVE_DEVICE 0x1
+		IRP_MN_REMOVE_DEVICE 0x2
 		{
+			DPRINT("Serial: IRP_MJ_PNP / IRP_MN_REMOVE_DEVICE\n");
+			IoAcquireRemoveLock
+			IoReleaseRemoveLockAndWait
+			pass request to DeviceExtension-LowerDriver
+			disable interface
+			IoDeleteDevice(Fdo) and/or IoDetachDevice
+			break;
+		}
+		IRP_MN_CANCEL_REMOVE_DEVICE 0x3
+		IRP_MN_STOP_DEVICE 0x4
+		IRP_MN_QUERY_STOP_DEVICE 0x5
+		IRP_MN_CANCEL_STOP_DEVICE 0x6
+		IRP_MN_QUERY_DEVICE_RELATIONS / BusRelations (optional) 0x7
+		IRP_MN_QUERY_DEVICE_RELATIONS / RemovalRelations (optional) 0x7
+		IRP_MN_QUERY_INTERFACE (optional) 0x8
+		IRP_MN_QUERY_CAPABILITIES (optional) 0x9
+		IRP_MN_FILTER_RESOURCE_REQUIREMENTS (optional) 0xd
+		IRP_MN_QUERY_PNP_DEVICE_STATE (optional) 0x14
+		IRP_MN_DEVICE_USAGE_NOTIFICATION (required or optional) 0x16
+		IRP_MN_SURPRISE_REMOVAL 0x17
+		*/
+		case IRP_MN_START_DEVICE: /* 0x0 */
+		{
 			BOOLEAN ConflictDetected;
 			DPRINT("Serial: IRP_MJ_PNP / IRP_MN_START_DEVICE\n");
 
@@ -355,29 +380,27 @@
 					Stack->Parameters.StartDevice.AllocatedResources);
 			break;
 		}
-		/* IRP_MN_QUERY_STOP_DEVICE (FIXME: required) */
-		/* IRP_MN_STOP_DEVICE (FIXME: required) */
-		/* IRP_MN_CANCEL_STOP_DEVICE (FIXME: required) */
-		/* IRP_MN_QUERY_REMOVE_DEVICE (FIXME: required) */
-		/* case IRP_MN_REMOVE_DEVICE (FIXME: required) */
-		/*{
-			DPRINT("Serial: IRP_MJ_PNP / IRP_MN_REMOVE_DEVICE\n");
-			IoAcquireRemoveLock
-			IoReleaseRemoveLockAndWait
-			pass request to DeviceExtension-LowerDriver
-			disable interface
-			IoDeleteDevice(Fdo) and/or IoDetachDevice
+		case IRP_MN_QUERY_DEVICE_RELATIONS: /* (optional) 0x7 */
+		{
+			switch (Stack->Parameters.QueryDeviceRelations.Type)
+			{
+				case BusRelations:
+				{
+					DPRINT("Serial: IRP_MJ_PNP / IRP_MN_QUERY_DEVICE_RELATIONS / BusRelations\n");
+					return ForwardIrpAndForget(DeviceObject, Irp);
+				}
+				case RemovalRelations:
+				{
+					DPRINT("Serial: IRP_MJ_PNP / IRP_MN_QUERY_DEVICE_RELATIONS / RemovalRelations\n");
+					return ForwardIrpAndForget(DeviceObject, Irp);
+				}
+				default:
+					DPRINT1("Serial: IRP_MJ_PNP / IRP_MN_QUERY_DEVICE_RELATIONS / Unknown type 0x%lx\n",
+						Stack->Parameters.QueryDeviceRelations.Type);
+					return ForwardIrpAndForget(DeviceObject, Irp);
+			}
 			break;
-		}*/
-		/* IRP_MN_CANCEL_REMOVE_DEVICE (FIXME: required) */
-		/* IRP_MN_SURPRISE_REMOVAL (FIXME: required) */
-		/* IRP_MN_QUERY_CAPABILITIES (optional) */
-		/* IRP_MN_QUERY_PNP_DEVICE_STATE (optional) */
-		/* IRP_MN_FILTER_RESOURCE_REQUIREMENTS (optional) */
-		/* IRP_MN_DEVICE_USAGE_NOTIFICATION (FIXME: required or optional ???) */
-		/* IRP_MN_QUERY_DEVICE_RELATIONS / BusRelations (optional) */
-		/* IRP_MN_QUERY_DEVICE_RELATIONS / RemovalRelations (optional) */
-		/* IRP_MN_QUERY_INTERFACE (optional) */
+		}
 		default:
 		{
 			DPRINT1("Serial: unknown minor function 0x%x\n", MinorFunction);

Modified: branches/xmlbuildsystem/reactos/include/ddk/obfuncs.h
--- branches/xmlbuildsystem/reactos/include/ddk/obfuncs.h	2005-05-16 12:18:02 UTC (rev 15338)
+++ branches/xmlbuildsystem/reactos/include/ddk/obfuncs.h	2005-05-16 12:32:10 UTC (rev 15339)
@@ -2,6 +2,121 @@
 #define _INCLUDE_DDK_OBFUNCS_H
 /* OBJECT MANAGER ************************************************************/
 
+typedef enum _OB_OPEN_REASON
+{    
+    ObCreateHandle,
+    ObOpenHandle,
+    ObDuplicateHandle,
+    ObInheritHandle,
+    ObMaxOpenReason
+} OB_OPEN_REASON;
+    
+/* TEMPORARY HACK */
+typedef NTSTATUS STDCALL_FUNC
+(*OB_CREATE_METHOD)(PVOID ObjectBody,
+                     PVOID Parent,
+                     PWSTR RemainingPath,
+                     struct _OBJECT_ATTRIBUTES* ObjectAttributes);
+                         
+/* Object Callbacks */
+typedef NTSTATUS STDCALL_FUNC
+(*OB_OPEN_METHOD)(OB_OPEN_REASON Reason,
+                  PVOID ObjectBody,
+                  PEPROCESS Process,
+                  ULONG HandleCount,
+                  ACCESS_MASK GrantedAccess);
+
+typedef NTSTATUS STDCALL_FUNC
+(*OB_PARSE_METHOD)(PVOID Object,
+                    PVOID *NextObject,
+                    PUNICODE_STRING FullPath,
+                    PWSTR *Path,
+                    ULONG Attributes);
+                        
+typedef VOID STDCALL_FUNC
+(*OB_DELETE_METHOD)(PVOID DeletedObject);
+
+typedef VOID STDCALL_FUNC
+(*OB_CLOSE_METHOD)(PVOID ClosedObject, ULONG HandleCount);
+
+typedef VOID STDCALL_FUNC
+(*OB_DUMP_METHOD)(VOID);
+
+typedef NTSTATUS STDCALL_FUNC
+(*OB_OKAYTOCLOSE_METHOD)(VOID);
+
+typedef NTSTATUS STDCALL_FUNC
+(*OB_QUERYNAME_METHOD)(PVOID ObjectBody,
+                        POBJECT_NAME_INFORMATION ObjectNameInfo,
+                        ULONG Length,
+                        PULONG ReturnLength);
+
+typedef PVOID STDCALL_FUNC
+(*OB_FIND_METHOD)(PVOID WinStaObject,
+                   PWSTR Name,
+                   ULONG Attributes);
+
+typedef NTSTATUS STDCALL_FUNC
+(*OB_SECURITY_METHOD)(PVOID ObjectBody,
+                        SECURITY_OPERATION_CODE OperationCode,
+                        SECURITY_INFORMATION SecurityInformation,
+                        PSECURITY_DESCRIPTOR SecurityDescriptor,
+                        PULONG BufferLength);
+
+typedef struct _OBJECT_CREATE_INFORMATION 
+{
+    ULONG Attributes;
+    HANDLE RootDirectory;
+    PVOID ParseContext;
+    KPROCESSOR_MODE ProbeMode;
+    ULONG PagedPoolCharge;
+    ULONG NonPagedPoolCharge;
+    ULONG SecurityDescriptorCharge;
+    PSECURITY_DESCRIPTOR SecurityDescriptor;
+    PSECURITY_QUALITY_OF_SERVICE SecurityQos;
+    SECURITY_QUALITY_OF_SERVICE SecurityQualityOfService;
+} OBJECT_CREATE_INFORMATION, *POBJECT_CREATE_INFORMATION;
+
+typedef struct _OBJECT_TYPE_INITIALIZER
+{
+    WORD Length;
+    UCHAR UseDefaultObject;
+    UCHAR CaseInsensitive;
+    ULONG InvalidAttributes;
+    GENERIC_MAPPING GenericMapping;
+    ULONG ValidAccessMask;
+    UCHAR SecurityRequired;
+    UCHAR MaintainHandleCount;
+    UCHAR MaintainTypeList;
+    POOL_TYPE PoolType;
+    ULONG DefaultPagedPoolCharge;
+    ULONG DefaultNonPagedPoolCharge;
+    OB_DUMP_METHOD DumpProcedure;
+    OB_OPEN_METHOD OpenProcedure;
+    OB_CLOSE_METHOD CloseProcedure;
+    OB_DELETE_METHOD DeleteProcedure;
+    OB_PARSE_METHOD ParseProcedure;
+    OB_SECURITY_METHOD SecurityProcedure;
+    OB_QUERYNAME_METHOD QueryNameProcedure;
+    OB_OKAYTOCLOSE_METHOD OkayToCloseProcedure;
+} OBJECT_TYPE_INITIALIZER, *POBJECT_TYPE_INITIALIZER;
+
+typedef struct _OBJECT_TYPE
+{
+    ERESOURCE Mutex;                    /* Used to lock the Object Type */
+    LIST_ENTRY TypeList;                /* Links all the Types Together for Debugging */
+    UNICODE_STRING Name;                /* Name of the Type */
+    PVOID DefaultObject;                /* What Object to use during a Wait (ie, FileObjects wait on FileObject->Event) */
+    ULONG Index;                        /* Index of this Type in the Object Directory */
+    ULONG TotalNumberOfObjects;         /* Total number of objects of this type */
+    ULONG TotalNumberOfHandles;         /* Total number of handles of this type */
+    ULONG HighWaterNumberOfObjects;     /* Peak number of objects of this type */
+    ULONG HighWaterNumberOfHandles;     /* Peak number of handles of this type */
+    OBJECT_TYPE_INITIALIZER TypeInfo;   /* Information captured during type creation */
+    ULONG Key;                          /* Key to use when allocating objects of this type */
+    ERESOURCE ObjectLocks[4];           /* Locks for locking the Objects */
+} OBJECT_TYPE;
+
 NTSTATUS STDCALL
 ObAssignSecurity(IN PACCESS_STATE AccessState,
 		 IN PSECURITY_DESCRIPTOR SecurityDescriptor,

Modified: branches/xmlbuildsystem/reactos/include/ddk/psfuncs.h
--- branches/xmlbuildsystem/reactos/include/ddk/psfuncs.h	2005-05-16 12:18:02 UTC (rev 15338)
+++ branches/xmlbuildsystem/reactos/include/ddk/psfuncs.h	2005-05-16 12:32:10 UTC (rev 15339)
@@ -356,11 +356,12 @@
     PVOID	Win32Thread
 	);
 
+struct _W32_OBJECT_CALLBACK;
 
 VOID STDCALL
 STDCALL PsEstablishWin32Callouts (PW32_PROCESS_CALLBACK W32ProcessCallback,
 			  PW32_THREAD_CALLBACK W32ThreadCallback,
-			  PW32_OBJECT_CALLBACK W32ObjectCallback,
+			  struct _W32_OBJECT_CALLBACK *W32ObjectCallback,
 			  PVOID Param4,
 			  ULONG W32ThreadSize,
 			  ULONG W32ProcessSize);

Modified: branches/xmlbuildsystem/reactos/include/ddk/pstypes.h
--- branches/xmlbuildsystem/reactos/include/ddk/pstypes.h	2005-05-16 12:18:02 UTC (rev 15338)
+++ branches/xmlbuildsystem/reactos/include/ddk/pstypes.h	2005-05-16 12:32:10 UTC (rev 15339)
@@ -66,41 +66,7 @@
 typedef NTSTATUS STDCALL_FUNC
 (*PW32_THREAD_CALLBACK)(struct _ETHREAD *Thread,
 			BOOLEAN Create);
-            
-/* 
- * Callbacks used for Win32 objects... this define won't be needed after the Object Manager
- * rewrite -- Alex
- */
-typedef NTSTATUS STDCALL_FUNC
-(*OBJECT_CREATE_ROUTINE)(PVOID ObjectBody,
-                         PVOID Parent,
-                         PWSTR RemainingPath,
-                         struct _OBJECT_ATTRIBUTES* ObjectAttributes);
-
-typedef NTSTATUS STDCALL_FUNC
-(*OBJECT_PARSE_ROUTINE)(PVOID Object,
-                        PVOID *NextObject,
-                        PUNICODE_STRING FullPath,
-                        PWSTR *Path,
-                        ULONG Attributes);
                         
-typedef VOID STDCALL_FUNC
-(*OBJECT_DELETE_ROUTINE)(PVOID DeletedObject);
-
-typedef PVOID STDCALL_FUNC
-(*OBJECT_FIND_ROUTINE)(PVOID WinStaObject,
-                       PWSTR Name,
-                       ULONG Attributes);
-                       
-typedef struct _W32_OBJECT_CALLBACK {
-    OBJECT_CREATE_ROUTINE WinStaCreate;
-    OBJECT_PARSE_ROUTINE WinStaParse;
-    OBJECT_DELETE_ROUTINE WinStaDelete;
-    OBJECT_FIND_ROUTINE WinStaFind;
-    OBJECT_CREATE_ROUTINE DesktopCreate;
-    OBJECT_DELETE_ROUTINE DesktopDelete;    
-} W32_OBJECT_CALLBACK, *PW32_OBJECT_CALLBACK;
-
 typedef struct _STACK_INFORMATION
 {
   PVOID BaseAddress;

Modified: branches/xmlbuildsystem/reactos/lib/crt/stdlib/splitp.c
--- branches/xmlbuildsystem/reactos/lib/crt/stdlib/splitp.c	2005-05-16 12:18:02 UTC (rev 15338)
+++ branches/xmlbuildsystem/reactos/lib/crt/stdlib/splitp.c	2005-05-16 12:32:10 UTC (rev 15339)
@@ -8,9 +8,9 @@
  */
 void _tsplitpath(const _TCHAR* path, _TCHAR* drive, _TCHAR* dir, _TCHAR* fname, _TCHAR* ext)
 {
-  _TCHAR* tmp_drive;
-  _TCHAR* tmp_dir;
-  _TCHAR* tmp_ext;
+  _TCHAR* tmp_drive = NULL;
+  _TCHAR* tmp_dir = NULL;
+  _TCHAR* tmp_ext = NULL;
 
   tmp_drive = (_TCHAR*)_tcschr(path,':');
   if (drive)
@@ -44,8 +44,9 @@
         }
     }
 
-  tmp_ext = (_TCHAR*)_tcsrchr(path,'.');
-  if (!tmp_ext)
+  /* If the dot is before the last dir separator, it's part
+   * of a directory name, not the start of the extension */
+  if (!tmp_ext || tmp_ext < tmp_dir)
     {
       tmp_ext = (_TCHAR*)path+_tcslen(path);
     }

Modified: branches/xmlbuildsystem/reactos/lib/dinput/keyboard.c
--- branches/xmlbuildsystem/reactos/lib/dinput/keyboard.c	2005-05-16 12:18:02 UTC (rev 15338)
+++ branches/xmlbuildsystem/reactos/lib/dinput/keyboard.c	2005-05-16 12:32:10 UTC (rev 15339)
@@ -38,14 +38,6 @@
 
 WINE_DEFAULT_DEBUG_CHANNEL(dinput);
 
-//fast fix misning from mingw headers
-#ifdef __REACTOS__
-#define LLKHF_EXTENDED       (KF_EXTENDED >> 8)
-#define LLKHF_INJECTED       0x00000010
-//#define LLKHF_ALTDOWN        (KF_ALTDOWN >> 8)
-#define LLKHF_UP             (KF_UP >> 8)
-#endif
-
 #define WINE_DINPUT_KEYBOARD_MAX_KEYS 256
 
 static IDirectInputDevice8AVtbl SysKeyboardAvt;

Modified: branches/xmlbuildsystem/reactos/lib/dinput/mouse.c
--- branches/xmlbuildsystem/reactos/lib/dinput/mouse.c	2005-05-16 12:18:02 UTC (rev 15338)
+++ branches/xmlbuildsystem/reactos/lib/dinput/mouse.c	2005-05-16 12:32:10 UTC (rev 15339)
@@ -40,13 +40,6 @@
 #define MOUSE_HACK
 
 WINE_DEFAULT_DEBUG_CHANNEL(dinput);
-typedef struct {
-                     POINT pt;
-                     DWORD mouseData;
-                     DWORD flags;
-                     DWORD time;
-                     ULONG_PTR dwExtraInfo;
-} MSLLHOOKSTRUCT, *PMSLLHOOKSTRUCT;
 
 /* Wine mouse driver object instances */
 #define WINE_MOUSE_X_AXIS_INSTANCE   0

Modified: branches/xmlbuildsystem/reactos/lib/user32/windows/hook.c
--- branches/xmlbuildsystem/reactos/lib/user32/windows/hook.c	2005-05-16 12:18:02 UTC (rev 15338)
+++ branches/xmlbuildsystem/reactos/lib/user32/windows/hook.c	2005-05-16 12:32:10 UTC (rev 15339)
@@ -281,6 +281,8 @@
   PHOOKPROC_CBT_CREATEWND_EXTRA_ARGUMENTS CbtCreatewndExtra;
   WPARAM wParam;
   LPARAM lParam;
+  PKBDLLHOOKSTRUCT KeyboardLlData;
+  PMSLLHOOKSTRUCT MouseLlData;
 
   Common = (PHOOKPROC_CALLBACK_ARGUMENTS) Arguments;
 
@@ -353,6 +355,14 @@
           break;
         }
       break;
+    case WH_KEYBOARD_LL:
+      KeyboardLlData = (PKBDLLHOOKSTRUCT)((PCHAR) Common + Common->lParam);
+      Result = Common->Proc(Common->Code, Common->wParam, (LPARAM) KeyboardLlData);
+      break;
+    case WH_MOUSE_LL:
+      MouseLlData = (PMSLLHOOKSTRUCT)((PCHAR) Common + Common->lParam);
+      Result = Common->Proc(Common->Code, Common->wParam, (LPARAM) MouseLlData);
+      break;
     default:
       return ZwCallbackReturn(NULL, 0, STATUS_NOT_SUPPORTED);
     }

Modified: branches/xmlbuildsystem/reactos/ntoskrnl/cm/cm.h
--- branches/xmlbuildsystem/reactos/ntoskrnl/cm/cm.h	2005-05-16 12:18:02 UTC (rev 15338)
+++ branches/xmlbuildsystem/reactos/ntoskrnl/cm/cm.h	2005-05-16 12:32:10 UTC (rev 15339)
@@ -489,12 +489,6 @@
 	       IN OUT PWSTR *Path,
 	       IN ULONG Attribute);
 
-NTSTATUS STDCALL
-CmiObjectCreate(PVOID ObjectBody,
-		PVOID Parent,
-		PWSTR RemainingPath,
-		POBJECT_ATTRIBUTES ObjectAttributes);
-
 VOID STDCALL
 CmiObjectDelete(PVOID  DeletedObject);
 

Modified: branches/xmlbuildsystem/reactos/ntoskrnl/cm/ntfunc.c
--- branches/xmlbuildsystem/reactos/ntoskrnl/cm/ntfunc.c	2005-05-16 12:18:02 UTC (rev 15338)
+++ branches/xmlbuildsystem/reactos/ntoskrnl/cm/ntfunc.c	2005-05-16 12:32:10 UTC (rev 15339)
@@ -225,13 +225,13 @@
       if (Disposition)
 	*Disposition = REG_OPENED_EXISTING_KEY;
 
-      Status = ObCreateHandle(PsGetCurrentProcess(),
+      Status = ObpCreateHandle(PsGetCurrentProcess(),
 			      Object,
 			      DesiredAccess,
 			      TRUE,
 			      KeyHandle);
 
-      DPRINT("ObCreateHandle failed Status 0x%x\n", Status);
+      DPRINT("ObpCreateHandle failed Status 0x%x\n", Status);
       ObDereferenceObject(Object);
       RtlFreeUnicodeString(&RemainingPath);
       return Status;
@@ -1182,7 +1182,7 @@
 	  goto openkey_cleanup;
     }
 
-  Status = ObCreateHandle(PsGetCurrentProcess(),
+  Status = ObpCreateHandle(PsGetCurrentProcess(),
 			  Object,
 			  DesiredAccess,
 			  TRUE,

Modified: branches/xmlbuildsystem/reactos/ntoskrnl/cm/registry.c
--- branches/xmlbuildsystem/reactos/ntoskrnl/cm/registry.c	2005-05-16 12:18:02 UTC (rev 15338)
+++ branches/xmlbuildsystem/reactos/ntoskrnl/cm/registry.c	2005-05-16 12:32:10 UTC (rev 15339)
@@ -331,7 +331,8 @@
     if (SetupBoot == FALSE) CmInit2((PCHAR)KeLoaderBlock.CommandLine);
 }
 
-VOID INIT_FUNCTION
+VOID 
+INIT_FUNCTION
 CmInitializeRegistry(VOID)
[truncated at 1000 lines; 5729 more skipped]