Merge 15187:15381 from trunk.
Modified: branches/cache_manager_rewrite/reactos/Makefile Modified: branches/cache_manager_rewrite/reactos/apps/utils/net/ftp/fake.c Modified: branches/cache_manager_rewrite/reactos/apps/utils/net/ping/ping.c Modified: branches/cache_manager_rewrite/reactos/apps/utils/net/telnet/src/ansiprsr.cpp Modified: branches/cache_manager_rewrite/reactos/apps/utils/net/telnet/src/ansiprsr.h Modified: branches/cache_manager_rewrite/reactos/apps/utils/net/whois/whois.c Modified: branches/cache_manager_rewrite/reactos/boot/freeldr/bootsect/fat.asm Modified: branches/cache_manager_rewrite/reactos/boot/freeldr/freeldr/arch/i386/i386disk.c Modified: branches/cache_manager_rewrite/reactos/boot/freeldr/freeldr/disk/partition.c
Deleted: branches/cache_manager_rewrite/reactos/boot/freeldr/ntvdmpat.c Deleted: branches/cache_manager_rewrite/reactos/boot/freeldr/readme
Modified: branches/cache_manager_rewrite/reactos/bootdata/livecd.inf Modified: branches/cache_manager_rewrite/reactos/bootdata/packages/reactos.dff Modified: branches/cache_manager_rewrite/reactos/drivers/bus/pci/pdo.c Modified: branches/cache_manager_rewrite/reactos/drivers/bus/serenum/detect.c Modified: branches/cache_manager_rewrite/reactos/drivers/bus/serenum/fdo.c Modified: branches/cache_manager_rewrite/reactos/drivers/bus/serenum/misc.c Modified: branches/cache_manager_rewrite/reactos/drivers/bus/serenum/serenum.h Modified: branches/cache_manager_rewrite/reactos/drivers/dd/serial/close.c Modified: branches/cache_manager_rewrite/reactos/drivers/dd/serial/create.c Modified: branches/cache_manager_rewrite/reactos/drivers/dd/serial/devctrl.c Modified: branches/cache_manager_rewrite/reactos/drivers/dd/serial/info.c Modified: branches/cache_manager_rewrite/reactos/drivers/dd/serial/misc.c Modified: branches/cache_manager_rewrite/reactos/drivers/dd/serial/pnp.c Modified: branches/cache_manager_rewrite/reactos/drivers/dd/serial/rw.c Modified: branches/cache_manager_rewrite/reactos/drivers/lib/oskittcp/include/freebsd/src/sys/sys/proc.h Modified: branches/cache_manager_rewrite/reactos/drivers/lib/oskittcp/makefile Modified: branches/cache_manager_rewrite/reactos/drivers/net/npf/time_calls.c Modified: branches/cache_manager_rewrite/reactos/drivers/net/tcpip/tcpip/info.c Modified: branches/cache_manager_rewrite/reactos/drivers/net/tcpip/tcpip/main.c Modified: branches/cache_manager_rewrite/reactos/drivers/storage/atapi/atapi.c Modified: branches/cache_manager_rewrite/reactos/drivers/storage/disk/disk.c Modified: branches/cache_manager_rewrite/reactos/drivers/usb/cromwell/uhci/uhci_main.c Modified: branches/cache_manager_rewrite/reactos/include/ddk/exfuncs.h Modified: branches/cache_manager_rewrite/reactos/include/ddk/extypes.h Modified: branches/cache_manager_rewrite/reactos/include/ddk/iodef.h Modified: branches/cache_manager_rewrite/reactos/include/ddk/iotypes.h Modified: branches/cache_manager_rewrite/reactos/include/ddk/obfuncs.h Modified: branches/cache_manager_rewrite/reactos/include/ddk/psfuncs.h Modified: branches/cache_manager_rewrite/reactos/include/ddk/pstypes.h Modified: branches/cache_manager_rewrite/reactos/include/ddk/sefuncs.h Modified: branches/cache_manager_rewrite/reactos/include/ddk/setypes.h Modified: branches/cache_manager_rewrite/reactos/include/funcs.h Modified: branches/cache_manager_rewrite/reactos/lib/cpl/intl/locale.c Modified: branches/cache_manager_rewrite/reactos/lib/crt/stdlib/splitp.c Modified: branches/cache_manager_rewrite/reactos/lib/dinput/Makefile.in Modified: branches/cache_manager_rewrite/reactos/lib/dinput/data_formats.c Modified: branches/cache_manager_rewrite/reactos/lib/dinput/device.c Modified: branches/cache_manager_rewrite/reactos/lib/dinput/dinput_main.c Modified: branches/cache_manager_rewrite/reactos/lib/dinput/dinput_private.h Modified: branches/cache_manager_rewrite/reactos/lib/dinput/joystick_linux.c Modified: branches/cache_manager_rewrite/reactos/lib/dinput/joystick_linuxinput.c
Deleted: branches/cache_manager_rewrite/reactos/lib/dinput/keyboard.c
Added: branches/cache_manager_rewrite/reactos/lib/dinput/keyboard.c
Modified: branches/cache_manager_rewrite/reactos/lib/dinput/mouse.c Modified: branches/cache_manager_rewrite/reactos/lib/kernel32/process/session.c Modified: branches/cache_manager_rewrite/reactos/lib/mesa32/Makefile Modified: branches/cache_manager_rewrite/reactos/lib/oleaut32/oleaut32_Sv.rc Modified: branches/cache_manager_rewrite/reactos/lib/user32/windows/hook.c Modified: branches/cache_manager_rewrite/reactos/ntoskrnl/cm/cm.h Modified: branches/cache_manager_rewrite/reactos/ntoskrnl/cm/ntfunc.c Modified: branches/cache_manager_rewrite/reactos/ntoskrnl/cm/registry.c Modified: branches/cache_manager_rewrite/reactos/ntoskrnl/cm/regobj.c Modified: branches/cache_manager_rewrite/reactos/ntoskrnl/ex/callback.c Modified: branches/cache_manager_rewrite/reactos/ntoskrnl/ex/event.c Modified: branches/cache_manager_rewrite/reactos/ntoskrnl/ex/evtpair.c Modified: branches/cache_manager_rewrite/reactos/ntoskrnl/ex/lookas.c Modified: branches/cache_manager_rewrite/reactos/ntoskrnl/ex/mutant.c Modified: branches/cache_manager_rewrite/reactos/ntoskrnl/ex/profile.c Modified: branches/cache_manager_rewrite/reactos/ntoskrnl/ex/sem.c Modified: branches/cache_manager_rewrite/reactos/ntoskrnl/ex/timer.c Modified: branches/cache_manager_rewrite/reactos/ntoskrnl/ex/win32k.c Modified: branches/cache_manager_rewrite/reactos/ntoskrnl/include/internal/io.h Modified: branches/cache_manager_rewrite/reactos/ntoskrnl/include/internal/ob.h Modified: branches/cache_manager_rewrite/reactos/ntoskrnl/include/internal/port.h Modified: branches/cache_manager_rewrite/reactos/ntoskrnl/include/internal/ps.h Modified: branches/cache_manager_rewrite/reactos/ntoskrnl/io/device.c Modified: branches/cache_manager_rewrite/reactos/ntoskrnl/io/driver.c Modified: branches/cache_manager_rewrite/reactos/ntoskrnl/io/file.c Modified: branches/cache_manager_rewrite/reactos/ntoskrnl/io/iocomp.c Modified: branches/cache_manager_rewrite/reactos/ntoskrnl/io/iomgr.c Modified: branches/cache_manager_rewrite/reactos/ntoskrnl/io/irp.c Modified: branches/cache_manager_rewrite/reactos/ntoskrnl/io/pnpmgr.c Modified: branches/cache_manager_rewrite/reactos/ntoskrnl/io/resource.c Modified: branches/cache_manager_rewrite/reactos/ntoskrnl/io/share.c Modified: branches/cache_manager_rewrite/reactos/ntoskrnl/ke/wait.c Modified: branches/cache_manager_rewrite/reactos/ntoskrnl/ldr/init.c Modified: branches/cache_manager_rewrite/reactos/ntoskrnl/lpc/close.c Modified: branches/cache_manager_rewrite/reactos/ntoskrnl/lpc/create.c Modified: branches/cache_manager_rewrite/reactos/ntoskrnl/lpc/port.c Modified: branches/cache_manager_rewrite/reactos/ntoskrnl/mm/rmap.c Modified: branches/cache_manager_rewrite/reactos/ntoskrnl/mm/section.c Modified: branches/cache_manager_rewrite/reactos/ntoskrnl/ntoskrnl.def Modified: branches/cache_manager_rewrite/reactos/ntoskrnl/ob/dirobj.c Modified: branches/cache_manager_rewrite/reactos/ntoskrnl/ob/handle.c Modified: branches/cache_manager_rewrite/reactos/ntoskrnl/ob/namespc.c Modified: branches/cache_manager_rewrite/reactos/ntoskrnl/ob/object.c Modified: branches/cache_manager_rewrite/reactos/ntoskrnl/ob/security.c Modified: branches/cache_manager_rewrite/reactos/ntoskrnl/ob/symlink.c Modified: branches/cache_manager_rewrite/reactos/ntoskrnl/ob/wait.c[truncated at 100 lines; 79 more skipped]
--- branches/cache_manager_rewrite/reactos/Makefile 2005-05-17 19:06:59 UTC (rev 15383) +++ branches/cache_manager_rewrite/reactos/Makefile 2005-05-17 19:07:27 UTC (rev 15384) @@ -106,7 +106,7 @@
# autochk cmd format services setup usetup welcome winlogon msiexec SYS_APPS = autochk calc cmd explorer expand format ibrowser msiexec regsvr32 \ reporterror services setup taskmgr userinit usetup welcome vmwinst rundll32 \
- winlogon regedit winefile notepad reactos lsass dhcp
+ winlogon regedit winefile notepad reactos lsass dhcp sm
# System services SYS_SVC = rpcss eventlog umpnpmgr
--- branches/cache_manager_rewrite/reactos/apps/utils/net/ftp/fake.c 2005-05-17 19:06:59 UTC (rev 15383) +++ branches/cache_manager_rewrite/reactos/apps/utils/net/ftp/fake.c 2005-05-17 19:07:27 UTC (rev 15384) @@ -92,7 +92,7 @@
{ static int index = 0; static int total = 0;
- static unsigned char buffer[4096];
+ static char buffer[4096];
if (index == total) {
--- branches/cache_manager_rewrite/reactos/apps/utils/net/ping/ping.c 2005-05-17 19:06:59 UTC (rev 15383) +++ branches/cache_manager_rewrite/reactos/apps/utils/net/ping/ping.c 2005-05-17 19:07:27 UTC (rev 15384) @@ -467,7 +467,7 @@
{ INT Status; SOCKADDR From;
- UINT Length;
+ INT Length;
PVOID Buffer; UINT Size; PICMP_ECHO_PACKET Packet;
--- branches/cache_manager_rewrite/reactos/apps/utils/net/telnet/src/ansiprsr.cpp 2005-05-17 19:06:59 UTC (rev 15383) +++ branches/cache_manager_rewrite/reactos/apps/utils/net/telnet/src/ansiprsr.cpp 2005-05-17 19:07:27 UTC (rev 15384) @@ -53,6 +53,8 @@
#include <string.h> #include "ansiprsr.h"
+const int ANSIColors[] = {BLACK, RED, GREEN, YELLOW, BLUE, MAGENTA, CYAN, WHITE}; +
// The constructor now takes different arguments and initializes different // variables (Paul Brannan 6/15/98) TANSIParser::TANSIParser(TConsole &RefConsole, KeyTranslator &RefKeyTrans,
--- branches/cache_manager_rewrite/reactos/apps/utils/net/telnet/src/ansiprsr.h 2005-05-17 19:06:59 UTC (rev 15383) +++ branches/cache_manager_rewrite/reactos/apps/utils/net/telnet/src/ansiprsr.h 2005-05-17 19:07:27 UTC (rev 15384) @@ -10,7 +10,7 @@
// added this color table to make things go faster (Paul Branann 5/8/98) enum Colors {BLACK=0, BLUE, GREEN, CYAN, RED, MAGENTA, YELLOW, WHITE};
-static const int ANSIColors[] = {BLACK, RED, GREEN, YELLOW, BLUE, MAGENTA, CYAN, WHITE};
+extern const int ANSIColors[];
// This should be greater than the largest conceivable window size // 200 should suffice
--- branches/cache_manager_rewrite/reactos/apps/utils/net/whois/whois.c 2005-05-17 19:06:59 UTC (rev 15383) +++ branches/cache_manager_rewrite/reactos/apps/utils/net/whois/whois.c 2005-05-17 19:07:27 UTC (rev 15384) @@ -52,6 +52,7 @@
/* #include <netinet/in.h> */ /* #include <netdb.h> */ #include <stdio.h>
+#include <stdlib.h>
/* #include <various.h> */ #include <getopt.h>
--- branches/cache_manager_rewrite/reactos/boot/freeldr/bootsect/fat.asm 2005-05-17 19:06:59 UTC (rev 15383) +++ branches/cache_manager_rewrite/reactos/boot/freeldr/bootsect/fat.asm 2005-05-17 19:07:27 UTC (rev 15384) @@ -73,7 +73,7 @@
NumberOfHeads dw 2 HiddenSectors dd 0 TotalSectorsBig dd 0
-BootDrive db 0
+BootDrive db 0xff
Reserved db 0 ExtendSig db 29h SerialNumber dd 00000000h @@ -89,6 +89,9 @@
mov es,ax ; Make ES correct
+ cmp BYTE [BYTE bp+BootDrive],BYTE 0xff ; If they have specified a boot drive then use it + jne GetDriveParameters +
mov [BYTE bp+BootDrive],dl ; Save the boot drive
--- branches/cache_manager_rewrite/reactos/boot/freeldr/freeldr/arch/i386/i386disk.c 2005-05-17 19:06:59 UTC (rev 15383) +++ branches/cache_manager_rewrite/reactos/boot/freeldr/freeldr/arch/i386/i386disk.c 2005-05-17 19:07:27 UTC (rev 15384) @@ -206,9 +206,27 @@
// Partition requested was zero which means the boot partition if (! DiskGetActivePartitionEntry(i386BootDrive, &PartitionTableEntry)) {
+ /* Try partition-less disk */ + *StartSector = 0; + *SectorCount = 0; + } + /* Check for valid partition */ + else if (PartitionTableEntry.SystemIndicator == PARTITION_ENTRY_UNUSED) + {
return FALSE; }
+ else + { + *StartSector = PartitionTableEntry.SectorCountBeforePartition; + *SectorCount = PartitionTableEntry.PartitionSectorCount; + }
}
+ else if (0xff == i386BootPartition) + { + /* Partition-less disk */ + *StartSector = 0; + *SectorCount = 0; + }
else { // Get requested partition @@ -216,25 +234,26 @@
{ return FALSE; }
+ /* Check for valid partition */ + else if (PartitionTableEntry.SystemIndicator == PARTITION_ENTRY_UNUSED) + { + return FALSE; + } + else + { + *StartSector = PartitionTableEntry.SectorCountBeforePartition; + *SectorCount = PartitionTableEntry.PartitionSectorCount; + }
}
- // Check for valid partition - if (PartitionTableEntry.SystemIndicator == PARTITION_ENTRY_UNUSED) - { - return FALSE; - } -
// Try to recognize the file system
- if (!FsRecognizeVolume(i386BootDrive, PartitionTableEntry.SectorCountBeforePartition, &VolumeType))
+ if (!FsRecognizeVolume(i386BootDrive, *StartSector, &VolumeType))
{ return FALSE; } *DriveNumber = i386BootDrive;
- *StartSector = PartitionTableEntry.SectorCountBeforePartition; - *SectorCount = PartitionTableEntry.PartitionSectorCount;
- //switch (PartitionTableEntry.SystemIndicator)
switch (VolumeType) { case PARTITION_FAT_12:
--- branches/cache_manager_rewrite/reactos/boot/freeldr/freeldr/disk/partition.c 2005-05-17 19:06:59 UTC (rev 15383) +++ branches/cache_manager_rewrite/reactos/boot/freeldr/freeldr/disk/partition.c 2005-05-17 19:07:27 UTC (rev 15384) @@ -63,12 +63,12 @@
// Make sure there was only one bootable partition if (BootablePartitionCount == 0) {
- DiskError("No bootable (active) partitions found.", 0);
+ DbgPrint((DPRINT_DISK, "No bootable (active) partitions found.\n"));
return FALSE; } else if (BootablePartitionCount != 1) {
- DiskError("Too many bootable (active) partitions found.", 0);
+ DbgPrint((DPRINT_DISK, "Too many bootable (active) partitions found.\n"));
return FALSE; }
--- branches/cache_manager_rewrite/reactos/boot/freeldr/ntvdmpat.c 2005-05-17 19:06:59 UTC (rev 15383) +++ branches/cache_manager_rewrite/reactos/boot/freeldr/ntvdmpat.c 2005-05-17 19:07:27 UTC (rev 15384) @@ -1,85 +0,0 @@
-/* Copyright (C) 2000 CW Sandmann (sandmann@clio.rice.edu) 1206 Braelinn, Sugar Land, TX 77479 */ -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <fcntl.h> -#ifdef GO32 -#include <unistd.h> -#else -#include <io.h> -#endif - -char view_only = 0; -const char *client_patch_code; -char buffer[20480]; -unsigned long search_base = 0x4c800L; -int f; - -char oldpatch[] = {0x3b, 0x05, 0xac, 0xe6 }; -char newpatch[] = {0x3b, 0x05, 0x58, 0x5e }; - -void patch_image(char *filename) -{ - int i,size; - - view_only = 0; - f = open(filename, O_RDWR | O_BINARY); - if (f < 0) { - f = open(filename, O_RDONLY | O_BINARY); - if (f < 0) { - perror(filename); - return; - } - view_only = 1; - } - - lseek(f, search_base, SEEK_SET); - size = read(f, buffer, sizeof(buffer)); - - client_patch_code = NULL; - for(i=0; i<size && !client_patch_code; i++) - if(!memcmp(buffer+i,oldpatch,sizeof(oldpatch))) - client_patch_code = (buffer+i); - - if(!client_patch_code) { - printf("Old patch string not found in %s!\n",filename); - } else { - lseek(f, search_base+i-1, SEEK_SET); /* Ready to update */ - if(!view_only) { - write(f, newpatch, sizeof(newpatch)); - printf("%s patched\n",filename); - } else - printf("%s patchable (not changed, readonly)\n",filename); - } - close(f); - return; -} - -int main(int argc, char **argv) -{ - int i; - char filename[256]; - char buf1[256]; - char file2[256]; - - if (argc != 1) { /* If they specify names, patch them, exit */ - for(i=1; i<argc; i++) - patch_image(argv[i]); - return 0; - } - - fprintf(stderr, "This image patches Windows 2000 NTVDM to fix nesting DPMI bug.\n"); - - strcpy(filename,getenv("SYSTEMROOT")); - strcpy(file2,filename); - strcat(filename,"\\system32\\ntvdm.exe"); - strcat(file2,"\\system32\\dllcache\\ntvdm.exe"); - - sprintf(buf1,"copy %s %s\\system32\\ntvdm.ori",filename,getenv("SYSTEMROOT")); - printf("%s\n",buf1); - system(buf1); - - patch_image(file2); - patch_image(filename); - return 0; -}
--- branches/cache_manager_rewrite/reactos/boot/freeldr/readme 2005-05-17 19:06:59 UTC (rev 15383) +++ branches/cache_manager_rewrite/reactos/boot/freeldr/readme 2005-05-17 19:07:27 UTC (rev 15384) @@ -1,18 +0,0 @@
-Perform at your own risk. - -Directions for patching NTVDM on Windows 2000 - -1) Start a Command Prompt Window -2) Start Task Manager. Sort by Name. If NTVDM.EXE is a task End Process. -3) Execute NTVDMPAT.EXE from this ZIP file. - -Notes: - With no arguments the executable patches both the DLLCACHE (for system file - protection) and the version in SYSTEM32. The image is a Win32 executable - (launching a DJGPP image will require NTVDM, locking the DLL so it can't - be patched). It saves the old version into NTVDM.ORI if you want to go - back. If you specify arguments on the command line it will patch the - executables you specify instead of automating the process (if you want to - do the archives/patches/moves yourself). Good luck. - - Source included if you want to hack your own version.
--- branches/cache_manager_rewrite/reactos/bootdata/livecd.inf 2005-05-17 19:06:59 UTC (rev 15383) +++ branches/cache_manager_rewrite/reactos/bootdata/livecd.inf 2005-05-17 19:07:27 UTC (rev 15384) @@ -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"
--- branches/cache_manager_rewrite/reactos/bootdata/packages/reactos.dff 2005-05-17 19:06:59 UTC (rev 15383) +++ branches/cache_manager_rewrite/reactos/bootdata/packages/reactos.dff 2005-05-17 19:07:27 UTC (rev 15384) @@ -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
--- branches/cache_manager_rewrite/reactos/drivers/bus/pci/pdo.c 2005-05-17 19:06:59 UTC (rev 15383) +++ branches/cache_manager_rewrite/reactos/drivers/bus/pci/pdo.c 2005-05-17 19:07:27 UTC (rev 15384) @@ -433,7 +433,7 @@
if (Length == 0) { DPRINT("Unused address register\n");
- break;
+ continue;
} /* Set preferred descriptor */ @@ -497,6 +497,7 @@
if (PciConfig.u.type0.InterruptPin != 0) {
+ Descriptor->Option = 0; /* Required */
Descriptor->Type = CmResourceTypeInterrupt; Descriptor->ShareDisposition = CmResourceShareShared; Descriptor->Flags = CM_RESOURCE_INTERRUPT_LEVEL_SENSITIVE; @@ -522,7 +523,7 @@
if (Length == 0) { DPRINT("Unused address register\n");
- break;
+ continue;
} /* Set preferred descriptor */ @@ -722,7 +723,7 @@
if (Length == 0) { DPRINT("Unused address register\n");
- break;
+ continue;
} if (Flags & PCI_ADDRESS_IO_SPACE) @@ -776,7 +777,7 @@
if (Length == 0) { DPRINT("Unused address register\n");
- break;
+ continue;
} if (Flags & PCI_ADDRESS_IO_SPACE)
--- branches/cache_manager_rewrite/reactos/drivers/bus/serenum/detect.c 2005-05-17 19:06:59 UTC (rev 15383) +++ branches/cache_manager_rewrite/reactos/drivers/bus/serenum/detect.c 2005-05-17 19:07:27 UTC (rev 15384) @@ -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;
}
--- branches/cache_manager_rewrite/reactos/drivers/bus/serenum/fdo.c 2005-05-17 19:06:59 UTC (rev 15383) +++ branches/cache_manager_rewrite/reactos/drivers/bus/serenum/fdo.c 2005-05-17 19:07:27 UTC (rev 15384) @@ -125,10 +125,9 @@
} NumPDO = (DeviceExtension->AttachedPdo != NULL ? 1 : 0);
- DeviceRelations = (PDEVICE_RELATIONS)ExAllocatePoolWithTag(
+ DeviceRelations = (PDEVICE_RELATIONS)ExAllocatePool(
PagedPool,
- sizeof(DEVICE_RELATIONS) + sizeof(PDEVICE_OBJECT) * (NumPDO - 1),
- SERENUM_TAG);
+ sizeof(DEVICE_RELATIONS) + sizeof(PDEVICE_OBJECT) * (NumPDO - 1));
if (!DeviceRelations) return STATUS_INSUFFICIENT_RESOURCES;
--- branches/cache_manager_rewrite/reactos/drivers/bus/serenum/misc.c 2005-05-17 19:06:59 UTC (rev 15383) +++ branches/cache_manager_rewrite/reactos/drivers/bus/serenum/misc.c 2005-05-17 19:07:27 UTC (rev 15384) @@ -39,7 +39,7 @@
return STATUS_SUCCESS; }
-/* I really want ANSI strings as last arguments because
+/* I really want PCSZ strings as last arguments because
* PnP ids are ANSI-encoded in PnP device string * identification */ NTSTATUS @@ -122,7 +122,7 @@
{ if (Irp->PendingReturned) KeSetEvent((PKEVENT)Context, IO_NO_INCREMENT, FALSE);
- return STATUS_MORE_PROCESSING_REQUIRED;
+ return STATUS_MORE_PROCESSING_REQUIRED;
} NTSTATUS
--- branches/cache_manager_rewrite/reactos/drivers/bus/serenum/serenum.h 2005-05-17 19:06:59 UTC (rev 15383) +++ branches/cache_manager_rewrite/reactos/drivers/bus/serenum/serenum.h 2005-05-17 19:07:27 UTC (rev 15384) @@ -7,7 +7,6 @@
#include <debug.h> #define SR_MSR_DSR 0x20
- #define ExFreePoolWithTag(p, tag) ExFreePool(p)
/* FIXME: these prototypes MUST NOT be here! */ NTSTATUS STDCALL @@ -117,9 +116,9 @@
NTSTATUS SerenumDuplicateUnicodeString(
- OUT PUNICODE_STRING Destination, - IN PUNICODE_STRING Source, - IN POOL_TYPE PoolType);
+ OUT PUNICODE_STRING Destination, + IN PUNICODE_STRING Source, + IN POOL_TYPE PoolType);
NTSTATUS SerenumInitMultiSzString(
--- branches/cache_manager_rewrite/reactos/drivers/dd/serial/close.c 2005-05-17 19:06:59 UTC (rev 15383) +++ branches/cache_manager_rewrite/reactos/drivers/dd/serial/close.c 2005-05-17 19:07:27 UTC (rev 15384) @@ -24,6 +24,6 @@
Irp->IoStatus.Information = 0; Irp->IoStatus.Status = STATUS_SUCCESS;
- IoCompleteRequest(Irp, IO_NO_INCREMENT);
+ IoCompleteRequest(Irp, IO_NO_INCREMENT);
return STATUS_SUCCESS; }
--- branches/cache_manager_rewrite/reactos/drivers/dd/serial/create.c 2005-05-17 19:06:59 UTC (rev 15383) +++ branches/cache_manager_rewrite/reactos/drivers/dd/serial/create.c 2005-05-17 19:07:27 UTC (rev 15384) @@ -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);
--- branches/cache_manager_rewrite/reactos/drivers/dd/serial/devctrl.c 2005-05-17 19:06:59 UTC (rev 15383) +++ branches/cache_manager_rewrite/reactos/drivers/dd/serial/devctrl.c 2005-05-17 19:07:27 UTC (rev 15384) @@ -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)) @@ -201,9 +170,11 @@
SerialGetPerfStats(IN PIRP pIrp) { PSERIAL_DEVICE_EXTENSION pDeviceExtension;
+ + ASSERT(pIrp);
pDeviceExtension = (PSERIAL_DEVICE_EXTENSION) IoGetCurrentIrpStackLocation(pIrp)->DeviceObject->DeviceExtension;
- ASSERT(DeviceExtension);
+
/* * we assume buffer is big enough to hold SerialPerfStats structure * caller must verify this @@ -242,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;
--- branches/cache_manager_rewrite/reactos/drivers/dd/serial/info.c 2005-05-17 19:06:59 UTC (rev 15383)[truncated at 1001 lines; 13005 more skipped]