ReactOS.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2025
January
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
List overview
Download
Ros-diffs
July 2008
----- 2025 -----
January 2025
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
ros-diffs@reactos.org
25 participants
761 discussions
Start a n
N
ew thread
[ros-arm-bringup] 34589: - Seperate the Ramdisk device extension into the Bus Device Extension and the Drive Device Extension. - Rename the device types to Bus vs Drive, not FDO vs PDO (they're both FDOs). - Use a common extension (the first 0x60 bytes or so) between Bus and Drive devices. - Implement first pass of RamdiskCreateDiskDevice -- doesn't create anything, just validates the parameters. - Implement our delayed work queue for handling requests asynchronously -- SendIrpToThread. Doesn't
by ros-arm-bringup@svn.reactos.org
Author: ros-arm-bringup Date: Sat Jul 19 13:44:31 2008 New Revision: 34589 URL:
http://svn.reactos.org/svn/reactos?rev=34589&view=rev
Log: - Seperate the Ramdisk device extension into the Bus Device Extension and the Drive Device Extension. - Rename the device types to Bus vs Drive, not FDO vs PDO (they're both FDOs). - Use a common extension (the first 0x60 bytes or so) between Bus and Drive devices. - Implement first pass of RamdiskCreateDiskDevice -- doesn't create anything, just validates the parameters. - Implement our delayed work queue for handling requests asynchronously -- SendIrpToThread. Doesn't do anything for now. - Implement RamdiskQueryDeviceRelations... not sure if we're doing the right thing. According to PnP, we get a warning that we are "misbehaving". - Driver seems to crash right now, needs fixes. - Some reformatting to make more lines fit inside 80 characters so it looks nice in joe. Modified: trunk/reactos/drivers/storage/class/ramdisk/ramdisk.c Modified: trunk/reactos/drivers/storage/class/ramdisk/ramdisk.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/storage/class/ramd…
============================================================================== --- trunk/reactos/drivers/storage/class/ramdisk/ramdisk.c [iso-8859-1] (original) +++ trunk/reactos/drivers/storage/class/ramdisk/ramdisk.c [iso-8859-1] Sat Jul 19 13:44:31 2008 @@ -28,8 +28,8 @@ typedef enum _RAMDISK_DEVICE_TYPE { - RamdiskFdo, - RamdiskPdo + RamdiskBus, + RamdiskDrive } RAMDISK_DEVICE_TYPE; typedef enum _RAMDISK_DEVICE_STATE @@ -40,6 +40,7 @@ RamdiskStateStopped, RamdiskStateRemoved, RamdiskStateBusRemoved, + RamdiskStateEnumerated, } RAMDISK_DEVICE_STATE; DEFINE_GUID(RamdiskBusInterface, @@ -48,18 +49,29 @@ 0x410F, 0x80, 0xE4, 0x05, 0xF8, 0x10, 0xE7, 0xA8, 0x8A); -typedef struct _RAMDISK_EXTENSION -{ - RAMDISK_DEVICE_TYPE Type; - RAMDISK_DEVICE_STATE State; - PDEVICE_OBJECT DeviceObject; - PDEVICE_OBJECT PhysicalDeviceObject; - PDEVICE_OBJECT AttachedDevice; - IO_REMOVE_LOCK RemoveLock; - UNICODE_STRING SymbolicLinkName; - FAST_MUTEX DiskListLock; - LIST_ENTRY DiskListHead; -} RAMDISK_EXTENSION, *PRAMDISK_EXTENSION; +// +// GCC does not seem to support anonymous structures +// +#define RAMDISK_EXTENSION \ + RAMDISK_DEVICE_TYPE Type; \ + RAMDISK_DEVICE_STATE State; \ + PDEVICE_OBJECT DeviceObject; \ + PDEVICE_OBJECT PhysicalDeviceObject; \ + PDEVICE_OBJECT AttachedDevice; \ + IO_REMOVE_LOCK RemoveLock; \ + UNICODE_STRING SymbolicLinkName; \ + FAST_MUTEX DiskListLock; \ + LIST_ENTRY DiskList; + +typedef struct _RAMDISK_BUS_EXTENSION +{ + RAMDISK_EXTENSION; +} RAMDISK_BUS_EXTENSION, *PRAMDISK_BUS_EXTENSION; + +typedef struct _RAMDISK_DRIVE_EXTENSION +{ + RAMDISK_EXTENSION; +} RAMDISK_DRIVE_EXTENSION, *PRAMDISK_DRIVE_EXTENSION; ULONG MaximumViewLength; ULONG MaximumPerDiskViewLength; @@ -231,6 +243,49 @@ } } +VOID +NTAPI +RamdiskWorkerThread(IN PDEVICE_OBJECT DeviceObject, + IN PVOID Context) +{ + UNIMPLEMENTED; + while (TRUE); +} + +NTSTATUS +NTAPI +SendIrpToThread(IN PDEVICE_OBJECT DeviceObject, + IN PIRP Irp) +{ + PIO_WORKITEM WorkItem; + + // + // Mark the IRP pending + // + IoMarkIrpPending(Irp); + + // + // Allocate a work item + // + WorkItem = IoAllocateWorkItem(DeviceObject); + if (WorkItem) + { + // + // Queue it up + // + Irp->Tail.Overlay.DriverContext[0] = WorkItem; + IoQueueWorkItem(WorkItem, RamdiskWorkerThread, DelayedWorkQueue, Irp); + return STATUS_PENDING; + } + else + { + // + // Fail + // + return STATUS_INSUFFICIENT_RESOURCES; + } +} + NTSTATUS NTAPI RamdiskOpenClose(IN PDEVICE_OBJECT DeviceObject, @@ -257,11 +312,73 @@ NTSTATUS NTAPI -RamdiskCreateDiskDevice(IN PRAMDISK_EXTENSION DeviceExtension, +RamdiskCreateDiskDevice(IN PRAMDISK_BUS_EXTENSION DeviceExtension, IN PRAMDISK_CREATE_INPUT Input, IN BOOLEAN ValidateOnly, OUT PDEVICE_OBJECT *DeviceObject) { + ULONG BasePage, ViewCount, DiskType; + + // + // Check if we're a CDROM-type RAM disk + // + DiskType = Input->DiskType; + if (DiskType > FILE_DEVICE_CD_ROM) + { + // + // Check if we're an ISO + // + if (DiskType == FILE_DEVICE_CD_ROM_FILE_SYSTEM) + { + // + // NTLDR mounted us somewhere + // + BasePage = Input->BasePage; + if (!BasePage) return STATUS_INVALID_PARAMETER; + + // + // Sanitize disk options + // + Input->Options.Fixed = TRUE; + Input->Options.Readonly = Input->Options.ExportAsCd | + Input->Options.Readonly; + Input->Options.Hidden = FALSE; + Input->Options.NoDosDevice = FALSE; + Input->Options.NoDriveLetter = IsWinPEBoot ? TRUE : FALSE; + } + else + { + // + // The only other possibility is a controller + // + if (DiskType != FILE_DEVICE_CONTROLLER) + return STATUS_INVALID_PARAMETER; + + // + // Read the view count instead + // + ViewCount = Input->ViewCount; + + // + // Sanitize disk options + // + Input->Options.Hidden = FALSE; + Input->Options.NoDosDevice = FALSE; + Input->Options.Readonly = FALSE; + Input->Options.NoDriveLetter = TRUE; + Input->Options.Fixed = TRUE; + } + + // + // Are we just validating and returning to the user? + // + if (ValidateOnly) return STATUS_SUCCESS; + + // + // FIXME-TODO: Implement the rest of the code + // + } + UNIMPLEMENTED; while (TRUE); return STATUS_SUCCESS; @@ -275,7 +392,7 @@ { PRAMDISK_CREATE_INPUT Input; ULONG Length; - PRAMDISK_EXTENSION DeviceExtension; + PRAMDISK_BUS_EXTENSION DeviceExtension; ULONG DiskType; PWCHAR FileNameStart, FileNameEnd; NTSTATUS Status; @@ -284,7 +401,7 @@ // // Get the device extension and our input data // - DeviceExtension = (PRAMDISK_EXTENSION)DeviceObject->DeviceExtension; + DeviceExtension = DeviceObject->DeviceExtension; Length = IoStackLocation->Parameters.DeviceIoControl.InputBufferLength; Input = (PRAMDISK_CREATE_INPUT)Irp->AssociatedIrp.SystemBuffer; @@ -326,7 +443,8 @@ // // Validate the disk type // - if ((Input->Options.ExportAsCd) && (DiskType != FILE_DEVICE_CD_ROM_FILE_SYSTEM)) + if ((Input->Options.ExportAsCd) && + (DiskType != FILE_DEVICE_CD_ROM_FILE_SYSTEM)) { // // If the type isn't CDFS, it has to at least be raw CD @@ -377,7 +495,7 @@ { NTSTATUS Status; PIO_STACK_LOCATION IoStackLocation = IoGetCurrentIrpStackLocation(Irp); - PRAMDISK_EXTENSION DeviceExtension = DeviceObject->DeviceExtension; + PRAMDISK_BUS_EXTENSION DeviceExtension = DeviceObject->DeviceExtension; ULONG Information = 0; // @@ -396,9 +514,9 @@ } // - // Check if this is an FDO or PDO - // - if (DeviceExtension->Type == RamdiskFdo) + // Check if this is an bus device or the drive + // + if (DeviceExtension->Type == RamdiskBus) { // // Check what the request is @@ -429,7 +547,7 @@ else { // - // PDO code not yet done + // Drive code not yet done // ASSERT(FALSE); } @@ -437,8 +555,7 @@ // // Queue the request to our worker thread // - UNIMPLEMENTED; - while (TRUE); + Status = SendIrpToThread(DeviceObject, Irp); CompleteRequest: // @@ -463,11 +580,211 @@ NTSTATUS NTAPI +RamdiskQueryDeviceRelations(IN DEVICE_RELATION_TYPE Type, + IN PDEVICE_OBJECT DeviceObject, + IN PIRP Irp) +{ + PRAMDISK_BUS_EXTENSION DeviceExtension; + PRAMDISK_DRIVE_EXTENSION DriveExtension; + PDEVICE_RELATIONS DeviceRelations, OurDeviceRelations; + ULONG Count, DiskCount, FinalCount; + PLIST_ENTRY ListHead, NextEntry; + PDEVICE_OBJECT* DriveDeviceObject; + RAMDISK_DEVICE_STATE State; + + // + // Get the device extension and check if this is a drive + // + DeviceExtension = DeviceObject->DeviceExtension; + if (DeviceExtension->Type == RamdiskDrive) + { + // + // FIXME: TODO + // + UNIMPLEMENTED; + while (TRUE); + } + + // + // Anything but bus relations, we don't handle + // + if (Type) goto PassToNext; + + // + // Acquire the disk list lock + // + KeEnterCriticalRegion(); + ExAcquireFastMutex(&DeviceExtension->DiskListLock); + + // + // Did a device already fill relations? + // + DeviceRelations = (PDEVICE_RELATIONS)Irp->IoStatus.Information; + if (DeviceRelations) + { + // + // Use the data + // + Count = DeviceRelations->Count; + } + else + { + // + // We're the first + // + Count = 0; + } + + // + // Now loop our drives + // + DiskCount = 0; + ListHead = &DeviceExtension->DiskList; + NextEntry = ListHead->Flink; + while (NextEntry != ListHead) + { + // + // As long as it wasn't removed, count it in + // + DriveExtension = CONTAINING_RECORD(NextEntry, + RAMDISK_DRIVE_EXTENSION, + DiskList); + if (DriveExtension->State < RamdiskStateBusRemoved) DiskCount++; + + // + // Move to the next one + // + NextEntry = NextEntry->Flink; + } + + // + // Now we know our final count + // + FinalCount = Count + DiskCount; + + // + // Allocate the structure + // + OurDeviceRelations = ExAllocatePoolWithTag(PagedPool, + FIELD_OFFSET(DEVICE_RELATIONS, + Objects) + + FinalCount * + sizeof(PDEVICE_OBJECT), + TAG('R', 'a', 'm', 'd')); + if (!OurDeviceRelations) + { + // + // Fail + // + ExReleaseFastMutex(&DeviceExtension->DiskListLock); + KeLeaveCriticalRegion(); + Irp->IoStatus.Status = STATUS_INSUFFICIENT_RESOURCES; + IoCompleteRequest(Irp, IO_NO_INCREMENT); + return STATUS_INSUFFICIENT_RESOURCES; + } + + // + // Check if we already had some relations + // + if (Count) + { + // + // Copy them in + // + RtlCopyMemory(OurDeviceRelations->Objects, + DeviceRelations->Objects, + Count * sizeof(PDEVICE_OBJECT)); + } + + // + // Now loop our drives again + // + ListHead = &DeviceExtension->DiskList; + NextEntry = ListHead->Flink; + while (NextEntry != ListHead) + { + // + // Go to the end of the list + // + DriveDeviceObject = &OurDeviceRelations->Objects[Count]; + + // + // Get the drive state + // + DriveExtension = CONTAINING_RECORD(NextEntry, + RAMDISK_DRIVE_EXTENSION, + DiskList); + State = DriveExtension->State; + + // + // If it was removed or enumerated, we don't touch the device object + // + if (State >= RamdiskStateBusRemoved) + { + // + // If it was removed, we still have to keep track of this though + // + if (State == RamdiskStateBusRemoved) + { + // + // Mark it as enumerated now, but don't actually reference it + // + DriveExtension->State = RamdiskStateEnumerated; + } + } + else + { + // + // First time it's enumerated, reference the device object + // + ObReferenceObject(DriveExtension->DeviceObject); + + // + // Save the object pointer, and move on + // + *DriveDeviceObject++ = DriveExtension->DeviceObject; + } + + if (DriveExtension->State < RamdiskStateBusRemoved) DiskCount++; + + // + // Move to the next one + // + NextEntry = NextEntry->Flink; + } + + // + // Release the lock + // + ExReleaseFastMutex(&DeviceExtension->DiskListLock); + KeLeaveCriticalRegion(); + + // + // Cleanup old relations + // + if (DeviceRelations) ExFreePool(DeviceRelations); + + // + // Complete our IRP + // + Irp->IoStatus.Information = (ULONG_PTR)OurDeviceRelations; + Irp->IoStatus.Status = STATUS_SUCCESS; + + // + // Pass to the next driver + // +PassToNext: + IoCopyCurrentIrpStackLocationToNext(Irp); + return IoCallDriver(DeviceExtension->AttachedDevice, Irp); +} + +NTSTATUS +NTAPI RamdiskPnp(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp) { PIO_STACK_LOCATION IoStackLocation; - PRAMDISK_EXTENSION DeviceExtension; + PRAMDISK_BUS_EXTENSION DeviceExtension; NTSTATUS Status; UCHAR Minor; @@ -569,9 +886,9 @@ case IRP_MN_QUERY_ID: // - // Are we a PDO? - // - if (DeviceExtension->Type == RamdiskPdo) + // Are we a drive? + // + if (DeviceExtension->Type == RamdiskDrive) { DPRINT1("PnP IRP: %lx\n", Minor); while (TRUE); @@ -581,9 +898,9 @@ case IRP_MN_QUERY_BUS_INFORMATION: // - // Are we a PDO? - // - if (DeviceExtension->Type == RamdiskPdo) + // Are we a drive? + // + if (DeviceExtension->Type == RamdiskDrive) { DPRINT1("PnP IRP: %lx\n", Minor); while (TRUE); @@ -599,9 +916,9 @@ case IRP_MN_QUERY_DEVICE_TEXT: // - // Are we a PDO? - // - if (DeviceExtension->Type == RamdiskPdo) + // Are we a drive? + // + if (DeviceExtension->Type == RamdiskDrive) { DPRINT1("PnP IRP: %lx\n", Minor); while (TRUE); @@ -610,16 +927,22 @@ case IRP_MN_QUERY_DEVICE_RELATIONS: - DPRINT1("PnP IRP: %lx\n", Minor); - while (TRUE); - break; + // + // Call our main routine + // + Status = RamdiskQueryDeviceRelations(IoStackLocation-> + Parameters. + QueryDeviceRelations.Type, + DeviceObject, + Irp); + goto ReleaseAndReturn; case IRP_MN_QUERY_CAPABILITIES: // - // Are we a PDO? - // - if (DeviceExtension->Type == RamdiskPdo) + // Are we a drive? + // + if (DeviceExtension->Type == RamdiskDrive) { DPRINT1("PnP IRP: %lx\n", Minor); while (TRUE); @@ -642,9 +965,9 @@ } // - // Are we an FDO? - // - if (DeviceExtension->Type == RamdiskFdo) + // Are we the bus? + // + if (DeviceExtension->Type == RamdiskBus) { // // Do we have an attached device? @@ -720,23 +1043,23 @@ RamdiskAddDevice(IN PDRIVER_OBJECT DriverObject, IN PDEVICE_OBJECT PhysicalDeviceObject) { - PRAMDISK_EXTENSION DeviceExtension; + PRAMDISK_BUS_EXTENSION DeviceExtension; PDEVICE_OBJECT AttachedDevice; NTSTATUS Status; UNICODE_STRING DeviceName; PDEVICE_OBJECT DeviceObject; // - // Only create the FDO once + // Only create the bus FDO once // if (RamdiskBusFdo) return STATUS_DEVICE_ALREADY_ATTACHED; // - // Create the FDO + // Create the bus FDO // RtlInitUnicodeString(&DeviceName, L"\\Device\\Ramdisk"); Status = IoCreateDevice(DriverObject, - sizeof(RAMDISK_EXTENSION), + sizeof(RAMDISK_BUS_EXTENSION), &DeviceName, FILE_DEVICE_BUS_EXTENDER, FILE_DEVICE_SECURE_OPEN, @@ -745,26 +1068,27 @@ if (NT_SUCCESS(Status)) { // - // Initialize the FDO extension - // - DeviceExtension = (PRAMDISK_EXTENSION)DeviceObject->DeviceExtension; - RtlZeroMemory(DeviceObject->DeviceExtension, sizeof(RAMDISK_EXTENSION)); - - // - // Set FDO flags + // Initialize the bus FDO extension + // + DeviceExtension = DeviceObject->DeviceExtension; + RtlZeroMemory(DeviceObject->DeviceExtension, + sizeof(RAMDISK_BUS_EXTENSION)); + + // + // Set bus FDO flags // DeviceObject->Flags |= DO_POWER_PAGABLE | DO_DIRECT_IO; // - // Setup the FDO extension - // - DeviceExtension->Type = RamdiskFdo; + // Setup the bus FDO extension + // + DeviceExtension->Type = RamdiskBus; ExInitializeFastMutex(&DeviceExtension->DiskListLock); IoInitializeRemoveLock(&DeviceExtension->RemoveLock, TAG('R', 'a', 'm', 'd'), 0, 1); - InitializeListHead(&DeviceExtension->DiskListHead); + InitializeListHead(&DeviceExtension->DiskList); DeviceExtension->PhysicalDeviceObject = PhysicalDeviceObject; DeviceExtension->DeviceObject = DeviceObject; @@ -802,7 +1126,7 @@ } // - // FDO is initialized + // Bus FDO is initialized // RamdiskBusFdo = DeviceObject; @@ -955,7 +1279,9 @@ // the required keys when reporting a detected device. // We hack around this ourselves. // - RtlCreateUnicodeString(&((PEXTENDED_DEVOBJ_EXTENSION)PhysicalDeviceObject->DeviceObjectExtension)->DeviceNode->InstancePath, + RtlCreateUnicodeString(&((PEXTENDED_DEVOBJ_EXTENSION) + PhysicalDeviceObject->DeviceObjectExtension) + ->DeviceNode->InstancePath, L"Root\\UNKNOWN\\0000"); //
16 years, 5 months
1
0
0
0
[mkupfer] 34588: Display of ReactOS bitmap implemented.
by mkupfer@svn.reactos.org
Author: mkupfer Date: Sat Jul 19 12:20:20 2008 New Revision: 34588 URL:
http://svn.reactos.org/svn/reactos?rev=34588&view=rev
Log: Display of ReactOS bitmap implemented. Modified: trunk/reactos/base/setup/reactos/lang/en-US.rc trunk/reactos/base/setup/reactos/reactos.c Modified: trunk/reactos/base/setup/reactos/lang/en-US.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/setup/reactos/lang/en…
============================================================================== --- trunk/reactos/base/setup/reactos/lang/en-US.rc [iso-8859-1] (original) +++ trunk/reactos/base/setup/reactos/lang/en-US.rc [iso-8859-1] Sat Jul 19 12:20:20 2008 @@ -19,11 +19,11 @@ CAPTION "ReactOS Setup" FONT 8, "MS Shell Dlg" BEGIN - CONTROL "IDB_LOGO", IDB_ROSLOGO, "Static", WS_CHILD | WS_VISIBLE | SS_CENTERIMAGE, 18, 7, 290, 74 - CONTROL "Setup language:", IDC_STATIC, "Static", WS_CHILD | WS_VISIBLE | WS_GROUP | SS_RIGHT, 20, 99, 106, 11 - CONTROL "", IDC_LANGUAGES,"ComboBox",WS_VISIBLE | WS_TABSTOP | CBS_DROPDOWNLIST, 132, 97, 176, 142 - CONTROL "Keyboard or input method:", IDC_STATIC, "Static", WS_CHILD | WS_VISIBLE | WS_GROUP | SS_RIGHT, 20, 132, 106, 11 - CONTROL "", IDC_KEYLAYOUT, "ComboBox", WS_VISIBLE | WS_TABSTOP | CBS_DROPDOWNLIST, 132, 131, 176, 81 + CONTROL "IDB_LOGO", IDB_ROSLOGO, "Static", WS_CHILD | WS_VISIBLE | SS_OWNERDRAW, 18, 0, 290, 99 + CONTROL "Setup language:", IDC_STATIC, "Static", WS_CHILD | WS_VISIBLE | WS_GROUP | SS_RIGHT, 20, 109, 106, 11 + CONTROL "", IDC_LANGUAGES, "ComboBox", WS_VSCROLL | WS_TABSTOP | CBS_DROPDOWNLIST, 132, 107, 176, 142 + CONTROL "Keyboard or input method:", IDC_STATIC, "Static", WS_CHILD | WS_VISIBLE | WS_GROUP | SS_RIGHT, 20, 142, 106, 11 + CONTROL "", IDC_KEYLAYOUT, "ComboBox", WS_VSCROLL | WS_TABSTOP | CBS_DROPDOWNLIST, 132, 141, 176, 81 LTEXT "Click Next to select the setup type.", IDC_STATIC, 10, 180 ,297, 10 END Modified: trunk/reactos/base/setup/reactos/reactos.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/setup/reactos/reactos…
============================================================================== --- trunk/reactos/base/setup/reactos/reactos.c [iso-8859-1] (original) +++ trunk/reactos/base/setup/reactos/reactos.c [iso-8859-1] Sat Jul 19 12:20:20 2008 @@ -51,7 +51,15 @@ BOOLEAN RepairUpdateFlag; // flag for update/repair an installed reactos } SetupData; +typedef struct _IMGINFO +{ + HBITMAP hBitmap; + INT cxSource; + INT cySource; +} IMGINFO, *PIMGINFO; + TCHAR abort_msg[512],abort_title[64]; +HINSTANCE hInstance; BOOL isUnattend; /* FUNCTIONS ****************************************************************/ @@ -102,6 +110,29 @@ ReleaseDC(NULL, hdc); return hFont; +} + +static VOID +InitImageInfo(PIMGINFO ImgInfo) +{ + BITMAP bitmap; + + ZeroMemory(ImgInfo, sizeof(*ImgInfo)); + + ImgInfo->hBitmap = LoadImage(hInstance, + MAKEINTRESOURCE(IDB_ROSLOGO), + IMAGE_BITMAP, + 0, + 0, + LR_DEFAULTCOLOR); + + if (ImgInfo->hBitmap != NULL) + { + GetObject(ImgInfo->hBitmap, sizeof(BITMAP), &bitmap); + + ImgInfo->cxSource = bitmap.bmWidth; + ImgInfo->cySource = bitmap.bmHeight; + } } static INT_PTR CALLBACK @@ -169,6 +200,8 @@ WPARAM wParam, LPARAM lParam) { + PIMGINFO pImgInfo; + pImgInfo = (PIMGINFO)GetWindowLongPtr(hwndDlg, DWLP_USER); switch (uMsg) { case WM_INITDIALOG: @@ -188,14 +221,55 @@ ShowWindow (hwndControl, SW_SHOW); EnableWindow (hwndControl, TRUE); + pImgInfo = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IMGINFO)); + if (pImgInfo == NULL) + { + EndDialog(hwndDlg, 0); + return FALSE; + } + + SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)pImgInfo); + + InitImageInfo(pImgInfo); + /* Set title font */ /*SendDlgItemMessage(hwndDlg, IDC_STARTTITLE, WM_SETFONT, (WPARAM)hTitleFont, (LPARAM)TRUE);*/ -} - break; + } + break; + case WM_DRAWITEM: + { + LPDRAWITEMSTRUCT lpDrawItem; + lpDrawItem = (LPDRAWITEMSTRUCT) lParam; + if (lpDrawItem->CtlID == IDB_ROSLOGO) + { + HDC hdcMem; + LONG left; + + /* position image in centre of dialog */ + left = (lpDrawItem->rcItem.right - pImgInfo->cxSource) / 2; + + hdcMem = CreateCompatibleDC(lpDrawItem->hDC); + if (hdcMem != NULL) + { + SelectObject(hdcMem, pImgInfo->hBitmap); + BitBlt(lpDrawItem->hDC, + left, + lpDrawItem->rcItem.top, + lpDrawItem->rcItem.right - lpDrawItem->rcItem.left, + lpDrawItem->rcItem.bottom - lpDrawItem->rcItem.top, + hdcMem, + 0, + 0, + SRCCOPY); + DeleteDC(hdcMem); + } + } + return TRUE; + } case WM_NOTIFY: { LPNMHDR lpnm = (LPNMHDR)lParam; @@ -551,6 +625,7 @@ HPROPSHEETPAGE ahpsp[7]; PROPSHEETPAGE psp = {0}; UINT nPages = 0; + hInstance = hInst; isUnattend = isUnattendSetup(); if (!isUnattend)
16 years, 5 months
1
0
0
0
[silverblade] 34587: Starting again (existing code backed-up and will be used as a reference for the new re-write).
by silverblade@svn.reactos.org
Author: silverblade Date: Sat Jul 19 06:02:19 2008 New Revision: 34587 URL:
http://svn.reactos.org/svn/reactos?rev=34587&view=rev
Log: Starting again (existing code backed-up and will be used as a reference for the new re-write). Removed: branches/silverblade-audio/lib/drivers/sound/mmebuddy/auxiliary/ branches/silverblade-audio/lib/drivers/sound/mmebuddy/capabilities.c branches/silverblade-audio/lib/drivers/sound/mmebuddy/devices.c branches/silverblade-audio/lib/drivers/sound/mmebuddy/instances.c branches/silverblade-audio/lib/drivers/sound/mmebuddy/kernel.c branches/silverblade-audio/lib/drivers/sound/mmebuddy/midi/ branches/silverblade-audio/lib/drivers/sound/mmebuddy/mixer/ branches/silverblade-audio/lib/drivers/sound/mmebuddy/mme/ branches/silverblade-audio/lib/drivers/sound/mmebuddy/mmebuddy.rbuild branches/silverblade-audio/lib/drivers/sound/mmebuddy/nt4.c branches/silverblade-audio/lib/drivers/sound/mmebuddy/thread.c branches/silverblade-audio/lib/drivers/sound/mmebuddy/utility.c branches/silverblade-audio/lib/drivers/sound/mmebuddy/wave/ Removed: branches/silverblade-audio/lib/drivers/sound/mmebuddy/capabilities.c URL:
http://svn.reactos.org/svn/reactos/branches/silverblade-audio/lib/drivers/s…
============================================================================== --- branches/silverblade-audio/lib/drivers/sound/mmebuddy/capabilities.c [iso-8859-1] (original) +++ branches/silverblade-audio/lib/drivers/sound/mmebuddy/capabilities.c (removed) @@ -1,109 +1,0 @@ -/* - * PROJECT: ReactOS Sound System "MME Buddy" Library - * LICENSE: GPL - See COPYING in the top level directory - * FILE: lib/sound/mmebuddy/capabilities.c - * - * PURPOSE: Queries sound devices for their capabilities. - * - * PROGRAMMERS: Andrew Greenwood (silverblade(a)reactos.org) -*/ - -#include <windows.h> -#include <mmsystem.h> -#include <ntddk.h> /* needed for ioctl stuff */ -#include <ntddsnd.h> - -#include <mmebuddy.h> - -MMRESULT -GetSoundDeviceCapabilities( - IN PSOUND_DEVICE SoundDevice, - OUT PUNIVERSAL_CAPS Capabilities) -{ - VALIDATE_MMSYS_PARAMETER( IsValidSoundDevice(SoundDevice) ); - VALIDATE_MMSYS_PARAMETER( Capabilities ); - - return SoundDevice->Functions.GetCapabilities(SoundDevice, Capabilities); -} - -MMRESULT -DefaultGetSoundDeviceCapabilities( - IN PSOUND_DEVICE SoundDevice, - OUT PUNIVERSAL_CAPS Capabilities) -{ - HANDLE Handle; - PVOID RawCapsPtr = NULL; - ULONG CapsSize = 0; - DWORD Ioctl; - MMRESULT Result; - DWORD BytesReturned; - - VALIDATE_MMSYS_PARAMETER( IsValidSoundDevice(SoundDevice) ); - VALIDATE_MMSYS_PARAMETER( Capabilities ); - - ZeroMemory(Capabilities, sizeof(UNIVERSAL_CAPS)); - - /* Select appropriate IOCTL and capabilities structure */ - switch ( SoundDevice->DeviceType ) - { - case WAVE_OUT_DEVICE_TYPE : - Ioctl = IOCTL_WAVE_GET_CAPABILITIES; - RawCapsPtr = (PVOID) &Capabilities->WaveOut; - CapsSize = sizeof(WAVEOUTCAPS); - break; - - case WAVE_IN_DEVICE_TYPE : - Ioctl = IOCTL_WAVE_GET_CAPABILITIES; - RawCapsPtr = (PVOID) &Capabilities->WaveIn; - CapsSize = sizeof(WAVEINCAPS); - break; - - case MIDI_OUT_DEVICE_TYPE : - Ioctl = IOCTL_MIDI_GET_CAPABILITIES; - RawCapsPtr = (PVOID) &Capabilities->MidiOut; - CapsSize = sizeof(MIDIOUTCAPS); - break; - - case MIDI_IN_DEVICE_TYPE : - Ioctl = IOCTL_MIDI_GET_CAPABILITIES; - RawCapsPtr = (PVOID) &Capabilities->MidiIn; - CapsSize = sizeof(MIDIINCAPS); - break; - - case MIXER_DEVICE_TYPE : - /* TODO */ - /*Ioctl = IOCTL_MIX_GET_CAPABILITIES;*/ - return MMSYSERR_NOTSUPPORTED; - - case AUX_DEVICE_TYPE : - /* TODO */ - Ioctl = IOCTL_AUX_GET_CAPABILITIES; - return MMSYSERR_NOTSUPPORTED; - - default : - return MMSYSERR_NOTSUPPORTED; - } - - Result = OpenKernelSoundDevice(SoundDevice, - GENERIC_READ, - &Handle); - - if ( Result != MMSYSERR_NOERROR ) - { - Result = TranslateInternalMmResult(Result); - return Result; - } - - /* Call the driver */ - Result = RetrieveFromDeviceHandle( - Handle, - Ioctl, - (LPVOID) RawCapsPtr, - CapsSize, - &BytesReturned, - NULL); - - CloseKernelSoundDevice(Handle); - - return Result; -} Removed: branches/silverblade-audio/lib/drivers/sound/mmebuddy/devices.c URL:
http://svn.reactos.org/svn/reactos/branches/silverblade-audio/lib/drivers/s…
============================================================================== --- branches/silverblade-audio/lib/drivers/sound/mmebuddy/devices.c [iso-8859-1] (original) +++ branches/silverblade-audio/lib/drivers/sound/mmebuddy/devices.c (removed) @@ -1,542 +1,0 @@ -/* - * PROJECT: ReactOS Sound System "MME Buddy" Library - * LICENSE: GPL - See COPYING in the top level directory - * FILE: lib/sound/mmebuddy/devices.c - * - * PURPOSE: Manages lists of sound devices. - * - * PROGRAMMERS: Andrew Greenwood (silverblade(a)reactos.org) -*/ - -/* - TODO: - The removal of devices from the list needs to be separated from - the destruction of the device structure. -*/ - -#include <windows.h> -#include <ntddsnd.h> - -#include <mmebuddy.h> - -/* Device Lists */ -ULONG SoundDeviceTotals[SOUND_DEVICE_TYPES]; -PSOUND_DEVICE SoundDeviceLists[SOUND_DEVICE_TYPES]; - -#define DEVICE_TYPE_TO_INDEX(device_type) \ - ( device_type - MIN_SOUND_DEVICE_TYPE ) - - -ULONG -GetSoundDeviceCount( - IN UCHAR DeviceType) -{ - ULONG Count; - TRACE_ENTRY(); - - if ( ! VALID_SOUND_DEVICE_TYPE(DeviceType) ) - { - TRACE_EXIT(0); - return 0; - } - - Count = SoundDeviceTotals[DeviceType - MIN_SOUND_DEVICE_TYPE]; - - TRACE_EXIT(Count); - return Count; -} - - -VOID -InitSoundDeviceFunctionTable( - IN PSOUND_DEVICE Device, - IN PMMFUNCTION_TABLE SourceFunctionTable) -{ - TRACE_ENTRY(); - - Device->Functions.Constructor = DefaultInstanceConstructor; - Device->Functions.Destructor = DefaultInstanceDestructor; - - Device->Functions.GetCapabilities = DefaultGetSoundDeviceCapabilities; - - /* Wave device specific */ - Device->Functions.QueryWaveFormat = DefaultQueryWaveDeviceFormatSupport; - Device->Functions.SetWaveFormat = DefaultSetWaveDeviceFormat; - - Device->Functions.GetWaveDeviceState = DefaultGetWaveDeviceState; - Device->Functions.PauseWaveDevice = DefaultPauseWaveDevice; - Device->Functions.RestartWaveDevice = DefaultRestartWaveDevice; - Device->Functions.ResetWaveDevice = DefaultResetWaveDevice; - Device->Functions.BreakWaveDeviceLoop = DefaultBreakWaveDeviceLoop; - - if ( ! SourceFunctionTable ) - { - TRACE_EXIT(0); - return; - } - - /* If we get here, the function table is being over-ridden */ - - if ( SourceFunctionTable->Constructor ) - { - Device->Functions.Constructor = - SourceFunctionTable->Constructor; - } - - if ( SourceFunctionTable->Destructor ) - { - Device->Functions.Destructor = - SourceFunctionTable->Destructor; - } - - if ( SourceFunctionTable->GetCapabilities ) - { - Device->Functions.GetCapabilities = - SourceFunctionTable->GetCapabilities; - } - - if ( SourceFunctionTable->QueryWaveFormat ) - { - Device->Functions.QueryWaveFormat = - SourceFunctionTable->QueryWaveFormat; - } - - if ( SourceFunctionTable->SetWaveFormat ) - { - Device->Functions.SetWaveFormat = - SourceFunctionTable->SetWaveFormat; - } - - if ( SourceFunctionTable->GetWaveDeviceState ) - { - Device->Functions.GetWaveDeviceState = - SourceFunctionTable->GetWaveDeviceState; - } - - if ( SourceFunctionTable->PauseWaveDevice ) - { - Device->Functions.PauseWaveDevice = - SourceFunctionTable->PauseWaveDevice; - } - - if ( SourceFunctionTable->RestartWaveDevice ) - { - Device->Functions.RestartWaveDevice = - SourceFunctionTable->RestartWaveDevice; - } - - if ( SourceFunctionTable->ResetWaveDevice ) - { - Device->Functions.ResetWaveDevice = - SourceFunctionTable->ResetWaveDevice; - } - - if ( SourceFunctionTable->BreakWaveDeviceLoop ) - { - Device->Functions.BreakWaveDeviceLoop = - SourceFunctionTable->BreakWaveDeviceLoop; - } - - TRACE_EXIT(0); -} - - -BOOLEAN -AddSoundDevice( - IN UCHAR DeviceType, - IN LPWSTR DevicePath, - IN PMMFUNCTION_TABLE FunctionTable) -{ - PSOUND_DEVICE NewDevice; - UCHAR TypeIndex; - - TRACE_ENTRY(); - - TRACE_("Adding a sound device to list %d\n", DeviceType); - - if ( ! VALID_SOUND_DEVICE_TYPE(DeviceType) ) - { - TRACE_EXIT(FALSE); - return FALSE; - } - - TypeIndex = DeviceType - MIN_SOUND_DEVICE_TYPE; - - NewDevice = AllocateMemoryFor(SOUND_DEVICE); -/* - NewDevice = (PSOUND_DEVICE) - HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(SOUND_DEVICE)); -*/ - - if ( ! NewDevice ) - { - TRACE_EXIT(FALSE); - return FALSE; - } - - NewDevice->Next = NULL; - NewDevice->FirstInstance = NULL; - NewDevice->DeviceType = DeviceType; - - NewDevice->DevicePath = AllocateWideString(wcslen(DevicePath)); -/* - NewDevice->DevicePath = (LPWSTR) - HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, DevicePathSize); -*/ - - if ( ! NewDevice->DevicePath ) - { - FreeMemory(NewDevice); - /*HeapFree(GetProcessHeap(), 0, NewDevice);*/ - TRACE_EXIT(FALSE); - return FALSE; - } - - CopyWideString(NewDevice->DevicePath, DevicePath); - /*CopyMemory(NewDevice->DevicePath, DevicePath, DevicePathSize);*/ - - /* Set up function table */ - InitSoundDeviceFunctionTable(NewDevice, FunctionTable); - - /* Start or add to list */ - if ( ! SoundDeviceLists[TypeIndex] ) - { - TRACE_("Starting device list\n"); - SoundDeviceLists[TypeIndex] = NewDevice; - } - else - { - PSOUND_DEVICE CurrentDevice = SoundDeviceLists[TypeIndex]; - - TRACE_("Adding to device list\n"); - - while ( CurrentDevice != NULL ) - { - if ( ! CurrentDevice->Next ) - { - CurrentDevice->Next = NewDevice; - break; - } - - CurrentDevice = CurrentDevice->Next; - } - } - - ++ SoundDeviceTotals[TypeIndex]; - TRACE_("Now %d devices of type %d\n", (int) SoundDeviceTotals[TypeIndex], DeviceType); - - TRACE_EXIT(TRUE); - return TRUE; -} - - -MMRESULT -RemoveSoundDevice( - IN PSOUND_DEVICE SoundDevice) -{ - ULONG TypeIndex; - BOOLEAN Done = FALSE; - PSOUND_DEVICE CurrentDevice = NULL; - PSOUND_DEVICE PreviousDevice = NULL; - - /*TRACE_("Removing a sound device from list %d\n", DeviceType);*/ - TRACE_ENTRY(); - - VALIDATE_MMSYS_PARAMETER( IsValidSoundDevice(SoundDevice) ); - - TypeIndex = SoundDevice->DeviceType - MIN_SOUND_DEVICE_TYPE; - - /* Clean up any instances */ - if ( SoundDevice->FirstInstance != NULL ) - { - TRACE_("About to destroy all instances of this sound device\n"); - DestroyAllInstancesOfSoundDevice(SoundDevice); - } - - if ( SoundDeviceLists[TypeIndex] == SoundDevice ) - { - TRACE_("Removing head of list\n"); - SoundDeviceLists[TypeIndex] = SoundDevice->Next; - Done = TRUE; - } - else - { - /* Remove from list */ - CurrentDevice = SoundDeviceLists[TypeIndex]; - PreviousDevice = NULL; - - TRACE_("Removing from list\n"); - - while ( CurrentDevice ) - { - if ( CurrentDevice == SoundDevice ) - { - ASSERT(PreviousDevice != NULL); - PreviousDevice->Next = CurrentDevice->Next; - Done = TRUE; - - break; - } - - PreviousDevice = CurrentDevice; - CurrentDevice = CurrentDevice->Next; - } - } - - ASSERT(Done); - - TRACE_("Freeing path at %p\n", SoundDevice->DevicePath); - /* Free the memory associated with the device info */ - FreeMemory(SoundDevice->DevicePath); - - TRACE_("Freeing struct\n"); - FreeMemory(SoundDevice); - - TRACE_EXIT(MMSYSERR_NOERROR); - return MMSYSERR_NOERROR;; -} - - -MMRESULT -RemoveSoundDevices( - IN UCHAR DeviceType) -{ - MMRESULT Result; - PSOUND_DEVICE CurrentDevice; - - TRACE_ENTRY(); - - TRACE_("Emptying device list for device type %d\n", DeviceType); - - VALIDATE_MMSYS_PARAMETER( VALID_SOUND_DEVICE_TYPE(DeviceType) ); - - /* - Clean out the device list. This works by repeatedly removing the - first entry. - */ - while ( (CurrentDevice = - SoundDeviceLists[DeviceType - MIN_SOUND_DEVICE_TYPE]) ) - { - Result = RemoveSoundDevice(CurrentDevice); - ASSERT(Result == MMSYSERR_NOERROR); - } - - /* Reset the list content and item count */ - SoundDeviceLists[DeviceType - MIN_SOUND_DEVICE_TYPE] = NULL; - SoundDeviceTotals[DeviceType - MIN_SOUND_DEVICE_TYPE] = 0; - - TRACE_EXIT(MMSYSERR_NOERROR); - return MMSYSERR_NOERROR; -} - - -VOID -RemoveAllSoundDevices() -{ - ULONG i; - TRACE_ENTRY(); - - TRACE_("RemoveAllSoundDevices\n"); - - for ( i = MIN_SOUND_DEVICE_TYPE; i <= MAX_SOUND_DEVICE_TYPE; ++ i ) - { - RemoveSoundDevices(i); - } - - TRACE_EXIT(0); -} - -BOOLEAN -IsValidSoundDevice( - IN PSOUND_DEVICE SoundDevice) -{ - UCHAR DeviceType; - PSOUND_DEVICE CurrentDevice; - - /* TRACE_ENTRY(); */ - - if ( ! SoundDevice ) - { - TRACE_EXIT(FALSE); - return FALSE; - } - - for ( DeviceType = MIN_SOUND_DEVICE_TYPE; - DeviceType <= MAX_SOUND_DEVICE_TYPE; - ++DeviceType ) - { - CurrentDevice = SoundDeviceLists[DEVICE_TYPE_TO_INDEX(DeviceType)]; - - while ( CurrentDevice ) - { - if ( CurrentDevice == SoundDevice ) - { - /* TRACE_EXIT(TRUE); */ - return TRUE; - } - - CurrentDevice = CurrentDevice->Next; - } - } - - /* Not found in list */ - TRACE_EXIT(FALSE); - return FALSE; -} - - -MMRESULT -GetSoundDevice( - IN UCHAR DeviceType, - IN ULONG DeviceIndex, - OUT PSOUND_DEVICE* Device) -{ - ULONG Count = 0; - PSOUND_DEVICE CurrentDevice = NULL; - - TRACE_ENTRY(); - - VALIDATE_MMSYS_PARAMETER( VALID_SOUND_DEVICE_TYPE(DeviceType) ); - VALIDATE_MMSYS_PARAMETER( Device ); - - if ( DeviceIndex >= SoundDeviceTotals[DeviceType - MIN_SOUND_DEVICE_TYPE] ) - { - TRACE_EXIT(MMSYSERR_BADDEVICEID); - return MMSYSERR_BADDEVICEID; - } - - /* - We know by now that a device at the index should exist - so just loop around until we reach that index. - */ - - CurrentDevice = SoundDeviceLists[DeviceType - MIN_SOUND_DEVICE_TYPE]; - - for ( Count = 0; Count <= DeviceIndex; ++ Count ) - { - *Device = CurrentDevice; - CurrentDevice = CurrentDevice->Next; - } - - TRACE_EXIT(MMSYSERR_NOERROR); - return MMSYSERR_NOERROR; -} - - -MMRESULT -GetSoundDevicePath( - IN PSOUND_DEVICE SoundDevice, - OUT LPWSTR* DevicePath) -{ - TRACE_ENTRY(); - - VALIDATE_MMSYS_PARAMETER( IsValidSoundDevice(SoundDevice) ); - VALIDATE_MMSYS_PARAMETER( DevicePath ); - - MessageBox(0, SoundDevice->DevicePath, L"Foo", MB_TASKMODAL | MB_OK); - *DevicePath = SoundDevice->DevicePath; - - TRACE_EXIT(MMSYSERR_NOERROR); - return MMSYSERR_NOERROR; -} - - -MMRESULT -GetSoundDeviceType( - IN PSOUND_DEVICE SoundDevice, - OUT PUCHAR DeviceType) -{ - TRACE_ENTRY(); - - VALIDATE_MMSYS_PARAMETER( IsValidSoundDevice(SoundDevice) ); - VALIDATE_MMSYS_PARAMETER( DeviceType ); - - *DeviceType = SoundDevice->DeviceType; - - TRACE_EXIT(MMSYSERR_NOERROR); - return MMSYSERR_NOERROR; -} - -MMRESULT -GetSoundDeviceFunctionTable( - IN PSOUND_DEVICE SoundDevice, - OUT PMMFUNCTION_TABLE* FunctionTable) -{ - TRACE_ENTRY(); - - VALIDATE_MMSYS_PARAMETER( IsValidSoundDevice(SoundDevice) ); - VALIDATE_MMSYS_PARAMETER( FunctionTable ); - - *FunctionTable = &SoundDevice->Functions; - - TRACE_EXIT(MMSYSERR_NOERROR); - return MMSYSERR_NOERROR; -} - - -#include <ntddk.h> /* How do I avoid this? */ - -/* Should these go somewhere else? */ - -MMRESULT -DefaultInstanceConstructor( - IN struct _SOUND_DEVICE_INSTANCE* SoundDeviceInstance) -{ - PSOUND_DEVICE SoundDevice; - UCHAR DeviceType; - DWORD AccessRights = GENERIC_READ; - MMRESULT Result; - - TRACE_ENTRY(); - - ASSERT(SoundDeviceInstance != NULL); - GetSoundDeviceFromInstance(SoundDeviceInstance, &SoundDevice); - ASSERT(SoundDevice != NULL); - - /* If this fails, we have an internal error somewhere */ - Result = GetSoundDeviceType(SoundDevice, &DeviceType); - ASSERT(Result == MMSYSERR_NOERROR); - if ( Result != MMSYSERR_NOERROR ) - { - Result = TranslateInternalMmResult(Result); - TRACE_EXIT(Result); - return Result; - } - - if ( DeviceType == WAVE_OUT_DEVICE_TYPE ) - AccessRights |= GENERIC_WRITE; - - Result = OpenKernelSoundDevice(SoundDevice, - AccessRights, - &SoundDeviceInstance->Handle); - - if ( Result != MMSYSERR_NOERROR ) - { - Result = TranslateInternalMmResult(Result); - TRACE_EXIT(MMSYSERR_NOERROR); - return Result; - } - - TRACE_EXIT(MMSYSERR_NOERROR); - return MMSYSERR_NOERROR; -} - - -VOID -DefaultInstanceDestructor( - IN struct _SOUND_DEVICE_INSTANCE* SoundDeviceInstance) -{ - PSOUND_DEVICE SoundDevice; - MMRESULT Result; - - TRACE_ENTRY(); - - ASSERT(SoundDeviceInstance); - GetSoundDeviceFromInstance(SoundDeviceInstance, &SoundDevice); - ASSERT(SoundDevice); - - Result = CloseKernelSoundDevice(SoundDevice); - ASSERT(Result == MMSYSERR_NOERROR); - - TRACE_EXIT(0); -} Removed: branches/silverblade-audio/lib/drivers/sound/mmebuddy/instances.c URL:
http://svn.reactos.org/svn/reactos/branches/silverblade-audio/lib/drivers/s…
============================================================================== --- branches/silverblade-audio/lib/drivers/sound/mmebuddy/instances.c [iso-8859-1] (original) +++ branches/silverblade-audio/lib/drivers/sound/mmebuddy/instances.c (removed) @@ -1,333 +1,0 @@ -/* - * PROJECT: ReactOS Sound System "MME Buddy" Library - * LICENSE: GPL - See COPYING in the top level directory - * FILE: lib/sound/mmebuddy/instances.c - * - * PURPOSE: Handles construction/destruction of sound device instances, - * along with tracking of existing instances. - * - * PROGRAMMERS: Andrew Greenwood (silverblade(a)reactos.org) -*/ - -#include <windows.h> -#include <ntddsnd.h> - -#include <mmebuddy.h> - -/* - Init / New / Delete handlers -*/ - -VOID -InitSoundDeviceInstance( - IN PSOUND_DEVICE_INSTANCE SoundDeviceInstance) -{ - /* Initialise */ - SoundDeviceInstance->Next = NULL; - SoundDeviceInstance->Device = NULL; - /* TODO: WinMM callback entry */ -} - -PSOUND_DEVICE_INSTANCE -AllocateSoundDeviceInstance() -{ - PSOUND_DEVICE_INSTANCE ptr; - ptr = AllocateMemoryFor(SOUND_DEVICE_INSTANCE); - - if ( ! ptr ) - return NULL; - - InitSoundDeviceInstance(ptr); - - return ptr; -} - -VOID -FreeSoundDeviceInstance( - IN PSOUND_DEVICE_INSTANCE SoundDeviceInstance) -{ - FreeMemory(SoundDeviceInstance); -} - - -/* - List management -*/ - -VOID -ListSoundDeviceInstance( - IN PSOUND_DEVICE SoundDevice, - IN PSOUND_DEVICE_INSTANCE SoundDeviceInstance) -{ - MMRESULT Result; - PSOUND_DEVICE_INSTANCE CurrentInstance = NULL; - - TRACE_ENTRY(); - - ASSERT(SoundDevice != NULL); - ASSERT(SoundDeviceInstance != NULL); - ASSERT(SoundDeviceInstance->Device == NULL); - - SoundDeviceInstance->Device = SoundDevice; - - if ( IS_WAVE_DEVICE_TYPE(SoundDevice->DeviceType) ) - { - Result = InitWaveStreamData(SoundDeviceInstance); - ASSERT(Result == MMSYSERR_NOERROR); - } - else if ( IS_MIDI_DEVICE_TYPE(SoundDevice->DeviceType) ) - { - /* TODO ... */ - ASSERT(FALSE); - } - else if ( IS_MIXER_DEVICE_TYPE(SoundDevice->DeviceType) ) - { - /* TODO ... */ - ASSERT(FALSE); - } - else if ( IS_AUX_DEVICE_TYPE(SoundDevice->DeviceType) ) - { - /* TODO ... */ - ASSERT(FALSE); - } - else - { - /* What kind of device do we have, then?!?! */ - ASSERT(FALSE); - } - - /* Search for an appropriate place in the list to put this instance */ - if ( ! SoundDevice->FirstInstance ) - { - /* This is going to be the first instance */ - SoundDevice->FirstInstance = SoundDeviceInstance; - } - else - { - /* There is already one or more instances */ - CurrentInstance = SoundDevice->FirstInstance; - - while ( CurrentInstance ) - { - if ( ! CurrentInstance->Next ) - { - /* Add to the end and get outta here */ - CurrentInstance->Next = SoundDeviceInstance; - break; - } - - CurrentInstance = CurrentInstance->Next; - } - } - - TRACE_EXIT(0); -} - -VOID -UnlistSoundDeviceInstance( - IN PSOUND_DEVICE_INSTANCE SoundDeviceInstance) -{ - PSOUND_DEVICE SoundDevice; - PSOUND_DEVICE_INSTANCE CurrentInstance; - - TRACE_ENTRY(); - - ASSERT(SoundDeviceInstance != NULL); - ASSERT(SoundDeviceInstance->Device != NULL); - - SoundDevice = SoundDeviceInstance->Device; - - if ( SoundDevice->FirstInstance == SoundDeviceInstance ) - { - /* Removing the first instance */ - SoundDevice->FirstInstance = NULL; - } - else - { - /* Removing an instance beyond the first */ - CurrentInstance = SoundDevice->FirstInstance; - - /* If we hit the end of the list, evidently there's a bug */ - while ( CurrentInstance->Next != SoundDeviceInstance ) - { - CurrentInstance = CurrentInstance->Next; - ASSERT(CurrentInstance != NULL); - } - - /* This is actually the one before the one we want to remove */ - CurrentInstance->Next = SoundDeviceInstance->Next; - } - - TRACE_EXIT(0); -} - - -/* - Public routines -*/ - -MMRESULT -CreateSoundDeviceInstance( - IN PSOUND_DEVICE SoundDevice, - OUT PSOUND_DEVICE_INSTANCE* SoundDeviceInstance) -{ - PSOUND_DEVICE_INSTANCE CreatedInstance = NULL; - MMRESULT Result; - - TRACE_ENTRY(); - - TRACE_("Creating instance of PSOUND_DEVICE %p\n", SoundDevice); - - VALIDATE_MMSYS_PARAMETER( IsValidSoundDevice(SoundDevice) ); - VALIDATE_MMSYS_PARAMETER( SoundDeviceInstance ); - - CreatedInstance = AllocateSoundDeviceInstance(); - - if ( ! CreatedInstance ) - { - TRACE_EXIT(MMSYSERR_NOMEM); - return MMSYSERR_NOMEM; - } - - /* Add the new instance to the device's instance list */ - ListSoundDeviceInstance(SoundDevice, CreatedInstance); - - /* Consult the custom construction function */ - Result = SoundDevice->Functions.Constructor(CreatedInstance); - if ( Result != MMSYSERR_NOERROR ) - { - ERR_("Custom ctor returned failure - unlisting"); - UnlistSoundDeviceInstance(CreatedInstance); - TRACE_("Freeing"); - FreeSoundDeviceInstance(CreatedInstance); - CreatedInstance = NULL; - //DestroySoundDeviceInstance(CreatedInstance); - - Result = TranslateInternalMmResult(Result); - } - - /* Fill the output parameter with this */ - *SoundDeviceInstance = CreatedInstance; - - TRACE_EXIT(Result); - - return Result; -} - -MMRESULT -GetSoundDeviceFromInstance( - IN PSOUND_DEVICE_INSTANCE SoundDeviceInstance, - OUT PSOUND_DEVICE* SoundDevice) -{ - ASSERT(SoundDeviceInstance); - ASSERT(SoundDevice); - - TRACE_ENTRY(); - - VALIDATE_MMSYS_PARAMETER( IsValidSoundDeviceInstance(SoundDeviceInstance) ); - VALIDATE_MMSYS_PARAMETER( SoundDevice ); - - *SoundDevice = SoundDeviceInstance->Device; - - TRACE_EXIT(MMSYSERR_NOERROR); - return MMSYSERR_NOERROR; -} - -MMRESULT -DestroySoundDeviceInstance( - IN PSOUND_DEVICE_INSTANCE SoundDeviceInstance) -{ - PSOUND_DEVICE SoundDevice = NULL; - - TRACE_ENTRY(); - - VALIDATE_MMSYS_PARAMETER( IsValidSoundDeviceInstance(SoundDeviceInstance) ); - - SoundDevice = SoundDeviceInstance->Device; - - /* TODO - Perform cleanup, stop playback etc. */ - - /* Call the custom destructor */ - SoundDevice->Functions.Destructor(SoundDeviceInstance); - - /* Remove the isntance from the device's instance list */ - UnlistSoundDeviceInstance(SoundDeviceInstance); - - /* Kill it! */ - FreeSoundDeviceInstance(SoundDeviceInstance); - /*HeapFree(GetProcessHeap(), 0, Instance);*/ - - TRACE_EXIT(MMSYSERR_NOERROR); - return MMSYSERR_NOERROR; -} - -MMRESULT -DestroyAllInstancesOfSoundDevice( - IN PSOUND_DEVICE SoundDevice) -{ - PSOUND_DEVICE_INSTANCE CurrentInstance = NULL; - MMRESULT Result; - - TRACE_ENTRY(); - - VALIDATE_MMSYS_PARAMETER( IsValidSoundDevice(SoundDevice) ); - - /* Just munch away at the first item repeatedly */ - while ( (CurrentInstance = SoundDevice->FirstInstance) ) - { - Result = DestroySoundDeviceInstance(CurrentInstance); - ASSERT(Result == MMSYSERR_NOERROR); - } - - TRACE_EXIT(MMSYSERR_NOERROR); - return MMSYSERR_NOERROR; -} - -BOOLEAN -IsValidSoundDeviceInstance( - IN PSOUND_DEVICE_INSTANCE SoundDeviceInstance) -{ - /* TRACE_ENTRY(); */ - - if ( ! SoundDeviceInstance ) - { - TRACE_EXIT(FALSE); - return FALSE; - } - - /* Now what? */ - return TRUE; - - /* TRACE_EXIT(12345678); */ - - TRACE_EXIT(FALSE); - return ( FALSE ); -} - -MMRESULT -GetSoundDeviceTypeFromInstance( - IN PSOUND_DEVICE_INSTANCE SoundDeviceInstance, - OUT PUCHAR DeviceType) -{ - MMRESULT Result; - PSOUND_DEVICE SoundDevice; - - TRACE_ENTRY(); - - VALIDATE_MMSYS_PARAMETER( IsValidSoundDeviceInstance(SoundDeviceInstance) ); - VALIDATE_MMSYS_PARAMETER( DeviceType ); - - Result = GetSoundDeviceFromInstance(SoundDeviceInstance, &SoundDevice); - - if ( Result != MMSYSERR_NOERROR ) - { - TRACE_EXIT(Result); - return Result; - } - - Result = GetSoundDeviceType(SoundDevice, DeviceType); - Result = TranslateInternalMmResult(Result); - - TRACE_EXIT(Result); - return Result; -} Removed: branches/silverblade-audio/lib/drivers/sound/mmebuddy/kernel.c URL:
http://svn.reactos.org/svn/reactos/branches/silverblade-audio/lib/drivers/s…
============================================================================== --- branches/silverblade-audio/lib/drivers/sound/mmebuddy/kernel.c [iso-8859-1] (original) +++ branches/silverblade-audio/lib/drivers/sound/mmebuddy/kernel.c (removed) @@ -1,303 +1,0 @@ -/* - * PROJECT: ReactOS Sound System "MME Buddy" Library - * LICENSE: GPL - See COPYING in the top level directory - * FILE: lib/sound/mmebuddy/kernel.c - * - * PURPOSE: Routines assisting with device I/O between user-mode and - * kernel-mode. - * - * PROGRAMMERS: Andrew Greenwood (silverblade(a)reactos.org) -*/ - -#include <windows.h> -#include <mmsystem.h> -#include <ntddsnd.h> - -#include <mmebuddy.h> - - -MMRESULT -OpenKernelSoundDeviceByName( - PWSTR DeviceName, - DWORD AccessRights, - PHANDLE Handle) -{ - DWORD OpenFlags = 0; - - VALIDATE_MMSYS_PARAMETER( Handle ); - VALIDATE_MMSYS_PARAMETER( DeviceName ); - - if ( AccessRights != GENERIC_READ ) - { - OpenFlags = FILE_FLAG_OVERLAPPED; - } - - /*TRACE_("Attempting to open '%ws'\n", DeviceName);*/ - - *Handle = CreateFile(DeviceName, - AccessRights, - FILE_SHARE_WRITE, - NULL, - OPEN_EXISTING, - OpenFlags, - NULL); - - if ( *Handle == INVALID_HANDLE_VALUE ) - { - ERR_("Failed to open\n"); - return Win32ErrorToMmResult(GetLastError()); - } - - return MMSYSERR_NOERROR; -} - -MMRESULT -OpenKernelSoundDevice( - PSOUND_DEVICE SoundDevice, - DWORD AccessRights, - PHANDLE Handle) -{ - MMRESULT Result; - - VALIDATE_MMSYS_PARAMETER( IsValidSoundDevice(SoundDevice) ); - VALIDATE_MMSYS_PARAMETER( Handle ); - - Result = OpenKernelSoundDeviceByName(SoundDevice->DevicePath, - AccessRights, - Handle); - - Result = TranslateInternalMmResult(Result); - return Result; -} - -MMRESULT -CloseKernelSoundDevice( - HANDLE Handle) -{ - if ( Handle == INVALID_HANDLE_VALUE ) - return MMSYSERR_INVALPARAM; - - CloseHandle(Handle); - - return MMSYSERR_NOERROR; -} - -MMRESULT -PerformDeviceIo( - IN HANDLE Handle, - IN DWORD IoControlCode, - IN LPVOID InBuffer, - IN DWORD InBufferSize, - OUT LPVOID OutBuffer, - IN DWORD OutBufferSize, - OUT LPDWORD BytesReturned, - IN LPOVERLAPPED Overlapped) -{ - BOOLEAN IoResult = FALSE; - - VALIDATE_MMSYS_PARAMETER( Handle != INVALID_HANDLE_VALUE ); - - /*MessageBox(0, L"Doing IO", L"Info", MB_OK | MB_TASKMODAL);*/ - - TRACE_("IoCtl on handle %d - in %p (%d), out %p (%d)\n", - (int) Handle, InBuffer, (int) InBufferSize, OutBuffer, - (int) OutBufferSize); - - IoResult = DeviceIoControl( - Handle, - IoControlCode, - InBuffer, - InBufferSize, - OutBuffer, - OutBufferSize, - BytesReturned, - Overlapped); - - - if ( ! IoResult ) - { - TRACE_("IoCtl result %d\n", (int) GetLastError()); - return Win32ErrorToMmResult(GetLastError()); - } - - return MMSYSERR_NOERROR; -} - -MMRESULT -RetrieveFromDeviceHandle( - IN HANDLE Handle, - IN DWORD IoControlCode, - OUT LPVOID OutBuffer, - IN DWORD OutBufferSize, - OUT LPDWORD BytesReturned, - IN LPOVERLAPPED Overlapped) -{ - return PerformDeviceIo(Handle, - IoControlCode, - NULL, - 0, - OutBuffer, - OutBufferSize, - BytesReturned, - Overlapped); -} - -MMRESULT -SendToDeviceHandle( - IN HANDLE Handle, - IN DWORD IoControlCode, - IN LPVOID InBuffer, - IN DWORD InBufferSize, - OUT LPDWORD BytesReturned, - IN LPOVERLAPPED Overlapped) -{ - return PerformDeviceIo(Handle, - IoControlCode, - InBuffer, - InBufferSize, - NULL, - 0, - BytesReturned, - Overlapped); -} - -MMRESULT -PerformSoundDeviceIo( - IN PSOUND_DEVICE_INSTANCE SoundDeviceInstance, - IN DWORD IoControlCode, - IN LPVOID InBuffer, - IN DWORD InBufferSize, - OUT LPVOID OutBuffer, - IN DWORD OutBufferSize, - OUT LPDWORD BytesTransferred) -{ - /* - NOTE: This will always do overlapped I/O, which we wait for. - */ - - OVERLAPPED Overlapped; - BOOLEAN IoResult; - MMRESULT Result; - DWORD Transferred; - - if ( ! IsValidSoundDeviceInstance(SoundDeviceInstance) ) - return MMSYSERR_INVALPARAM; - - if ( SoundDeviceInstance->Handle == INVALID_HANDLE_VALUE ) - return MMSYSERR_ERROR; - - ZeroMemory(&Overlapped, sizeof(OVERLAPPED)); - - /* This event is used for announcing the I/O operation completed */ - Overlapped.hEvent = CreateEvent(NULL, FALSE, FALSE, NULL); - - if ( Overlapped.hEvent == INVALID_HANDLE_VALUE ) - return Win32ErrorToMmResult(GetLastError()); - - TRACE_("** Overlapped at %p\n", &Overlapped); - - Result = PerformDeviceIo(SoundDeviceInstance->Handle, - IoControlCode, - InBuffer, - InBufferSize, - OutBuffer, - OutBufferSize, - NULL, - &Overlapped); - - if ( Result != MMSYSERR_NOERROR ) - { - return Result; - } - - /* Wait for I/O completion */ - IoResult = GetOverlappedResult(SoundDeviceInstance->Handle, - &Overlapped, - &Transferred, - TRUE); - - CloseHandle(Overlapped.hEvent); - - if ( ! IoResult ) - { - return Win32ErrorToMmResult(GetLastError()); - } - - if ( BytesTransferred ) - { - *BytesTransferred = Transferred; - } - - return Result; -} - -MMRESULT -RetrieveFromSoundDevice( - IN PSOUND_DEVICE_INSTANCE SoundDeviceInstance, - IN DWORD IoControlCode, - OUT LPVOID OutBuffer, - IN DWORD OutBufferSize, - OUT LPDWORD BytesReturned) -{ - return PerformSoundDeviceIo(SoundDeviceInstance, - IoControlCode, - NULL, - 0, - OutBuffer, - OutBufferSize, - BytesReturned); -} - -MMRESULT -SendToSoundDevice( - IN PSOUND_DEVICE_INSTANCE SoundDeviceInstance, - IN DWORD IoControlCode, - IN LPVOID InBuffer, - IN DWORD InBufferSize, - OUT LPDWORD BytesReturned) -{ - return PerformSoundDeviceIo(SoundDeviceInstance, - IoControlCode, - InBuffer, - InBufferSize, - NULL, - 0, - BytesReturned); -} - - -/* TODO: move somewhere else */ -MMRESULT -WriteSoundDeviceBuffer( - IN PSOUND_DEVICE_INSTANCE SoundDeviceInstance, - IN LPVOID Buffer, - IN DWORD BufferSize, - IN LPOVERLAPPED_COMPLETION_ROUTINE CompletionRoutine, - IN LPOVERLAPPED Overlapped) -{ - VALIDATE_MMSYS_PARAMETER( IsValidSoundDeviceInstance(SoundDeviceInstance) ); - VALIDATE_MMSYS_PARAMETER( Buffer ); - VALIDATE_MMSYS_PARAMETER( BufferSize > 0 ); - - /*wsprintf(msg, L"Writing to handle %x", SoundDeviceInstance->Device->Handle);*/ - /*SOUND_DEBUG(msg);*/ - - TRACE_("WriteFileEx(%p, %p, %d, %p, %p)\n", - SoundDeviceInstance->Handle, - Buffer, - (int) BufferSize, - Overlapped, - CompletionRoutine); - - if ( ! WriteFileEx(SoundDeviceInstance->Handle, - Buffer, - BufferSize, - Overlapped, - CompletionRoutine) ) - { - ERR_("WriteFileEx -- Win32 Error %d", (int) GetLastError()); - return Win32ErrorToMmResult(GetLastError()); - } - - return MMSYSERR_NOERROR; -} Removed: branches/silverblade-audio/lib/drivers/sound/mmebuddy/mmebuddy.rbuild URL:
http://svn.reactos.org/svn/reactos/branches/silverblade-audio/lib/drivers/s…
============================================================================== --- branches/silverblade-audio/lib/drivers/sound/mmebuddy/mmebuddy.rbuild [iso-8859-1] (original) +++ branches/silverblade-audio/lib/drivers/sound/mmebuddy/mmebuddy.rbuild (removed) @@ -1,33 +1,0 @@ -<?xml version="1.0"?> -<!DOCTYPE module SYSTEM "../../../../tools/rbuild/project.dtd"> -<module name="mmebuddy" type="staticlibrary" allowwarnings="false" unicode="yes"> - <include base="ReactOS">include/reactos/libs/sound</include> - <file>kernel.c</file> - <file>nt4.c</file> - <file>devices.c</file> - <file>instances.c</file> - <file>capabilities.c</file> - <file>thread.c</file> - <file>utility.c</file> - <directory name="mme"> - <file>DriverProc.c</file> - <file>callback.c</file> - </directory> - <directory name="wave"> - <file>wodMessage.c</file> - <file>widMessage.c</file> - <file>format.c</file> - <file>streaming.c</file> - <file>streamcontrol.c</file> - </directory> - <directory name="midi"> - <file>modMessage.c</file> - <file>midMessage.c</file> - </directory> - <directory name="mixer"> - <file>mxdMessage.c</file> - </directory> - <directory name="auxiliary"> - <file>auxMessage.c</file> - </directory> -</module> Removed: branches/silverblade-audio/lib/drivers/sound/mmebuddy/nt4.c URL:
http://svn.reactos.org/svn/reactos/branches/silverblade-audio/lib/drivers/s…
============================================================================== --- branches/silverblade-audio/lib/drivers/sound/mmebuddy/nt4.c [iso-8859-1] (original) +++ branches/silverblade-audio/lib/drivers/sound/mmebuddy/nt4.c (removed) @@ -1,325 +1,0 @@ -/* - * PROJECT: ReactOS Sound System "MME Buddy" Library - * LICENSE: GPL - See COPYING in the top level directory - * FILE: lib/sound/mmebuddy/nt4.c - * - * PURPOSE: Assists in locating Windows NT4 compatible sound devices, - * which mostly use the same device naming convention and/or - * store their created device names within their service key - * within the registry. - * - * PROGRAMMERS: Andrew Greenwood (silverblade(a)reactos.org) -*/ - -#include <windows.h> -#include <mmsystem.h> -#include <ntddsnd.h> - -#include <mmebuddy.h> - -/* - Open the parameters key of a sound driver. - NT4 only. -*/ -MMRESULT -OpenSoundDriverParametersRegKey( - IN LPWSTR ServiceName, - OUT PHKEY KeyHandle) -{ - ULONG KeyLength; - PWCHAR ParametersKeyName; - - VALIDATE_MMSYS_PARAMETER( ServiceName ); - VALIDATE_MMSYS_PARAMETER( KeyHandle ); - - /* Work out how long the string will be */ - KeyLength = wcslen(REG_SERVICES_KEY_NAME_U) + 1 - + wcslen(ServiceName) + 1 - + wcslen(REG_PARAMETERS_KEY_NAME_U); - - /* Allocate memory for the string */ - ParametersKeyName = AllocateWideString(KeyLength); - - if ( ! ParametersKeyName ) - return MMSYSERR_NOMEM; - - /* Construct the registry path */ - wsprintf(ParametersKeyName, - L"%s\\%s\\%s", - REG_SERVICES_KEY_NAME_U, - ServiceName, - REG_PARAMETERS_KEY_NAME_U); - - MessageBox(0, ParametersKeyName, L"Parameters key is...", MB_OK | MB_TASKMODAL); - - /* Perform the open */ - if ( RegOpenKeyEx(HKEY_LOCAL_MACHINE, - ParametersKeyName, - 0, - KEY_READ, - KeyHandle) != ERROR_SUCCESS ) - { - /* Couldn't open the key */ - FreeMemory(ParametersKeyName); - return MMSYSERR_ERROR; - } - - FreeMemory(ParametersKeyName); - - return MMSYSERR_NOERROR; -} - -/* - Open one of the Device sub-keys belonging to the sound driver. - NT4 only. -*/ -MMRESULT -OpenSoundDeviceRegKey( - IN LPWSTR ServiceName, - IN DWORD DeviceIndex, - OUT PHKEY KeyHandle) -{ - DWORD PathLength; - PWCHAR RegPath; - - VALIDATE_MMSYS_PARAMETER( ServiceName ); - VALIDATE_MMSYS_PARAMETER( KeyHandle ); - - /* - Work out the space required to hold the path: - - HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\ - sndblst\ - Parameters\ - Device123\ - */ - PathLength = wcslen(REG_SERVICES_KEY_NAME_U) + 1 - + wcslen(ServiceName) + 1 - + wcslen(REG_PARAMETERS_KEY_NAME_U) + 1 - + wcslen(REG_DEVICE_KEY_NAME_U) - + GetDigitCount(DeviceIndex); - - /* Allocate storage for the string */ - RegPath = AllocateWideString(PathLength); - - if ( ! RegPath ) - { - return MMSYSERR_NOMEM; - } - - /* Write the path */ - wsprintf(RegPath, - L"%ls\\%ls\\%ls\\%ls%d", - REG_SERVICES_KEY_NAME_U, - ServiceName, - REG_PARAMETERS_KEY_NAME_U, - REG_DEVICE_KEY_NAME_U, - DeviceIndex); - - MessageBox(0, RegPath, L"Opening registry path", MB_OK | MB_TASKMODAL); - - /* Perform the open */ - if ( RegOpenKeyEx(HKEY_LOCAL_MACHINE, - RegPath, - 0, - KEY_READ, - KeyHandle) != ERROR_SUCCESS ) - { - /* Couldn't open the key */ - FreeMemory(RegPath); - return MMSYSERR_ERROR; - } - - FreeMemory(RegPath); - - return MMSYSERR_NOERROR; -} - -/* - This is the "nice" way to discover audio devices in NT4 - go into the - service registry key and enumerate the Parameters\Device*\Devices - values. The value names represent the device name, whereas the data - assigned to them identifies the type of device. -*/ -MMRESULT -EnumerateNt4ServiceSoundDevices( - IN LPWSTR ServiceName, - IN UCHAR DeviceType, - IN SOUND_DEVICE_DETECTED_PROC SoundDeviceDetectedProc) -{ - HKEY Key; - DWORD KeyIndex = 0; - - VALIDATE_MMSYS_PARAMETER( ServiceName ); - - /* Device type zero means "all" */ - VALIDATE_MMSYS_PARAMETER( VALID_SOUND_DEVICE_TYPE(DeviceType) || - DeviceType == 0 ); - - MessageBox(0, ServiceName, L"Looking for devices", MB_OK | MB_TASKMODAL); - - while ( OpenSoundDeviceRegKey(ServiceName, KeyIndex, &Key) == MMSYSERR_NOERROR ) - { - HKEY DevicesKey; - DWORD ValueType = REG_NONE, ValueIndex = 0; - DWORD MaxNameLength = 0, ValueNameLength = 0; - PWSTR DevicePath = NULL, ValueName = NULL; - DWORD ValueDataLength = sizeof(DWORD); - DWORD ValueData; - - if ( RegOpenKeyEx(Key, - REG_DEVICES_KEY_NAME_U, - 0, - KEY_READ, - &DevicesKey) == ERROR_SUCCESS ) - { - /* Find out how much memory is needed for the key name */ - if ( RegQueryInfoKey(DevicesKey, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, - &MaxNameLength, - NULL, NULL, NULL) != ERROR_SUCCESS ) - { - RegCloseKey(DevicesKey); - RegCloseKey(Key); - - return MMSYSERR_ERROR; - } - - DevicePath = AllocateWideString(MaxNameLength + - strlen("\\\\.\\")); - - /* Check that the memory allocation was successful */ - if ( ! DevicePath ) - { - /* There's no point in going further */ - RegCloseKey(DevicesKey); - RegCloseKey(Key); - - return MMSYSERR_NOMEM; - } - - /* Insert the device path prefix */ - wsprintf(DevicePath, L"\\\\.\\"); - - /* The offset of the string following this prefix */ - ValueName = DevicePath + strlen("\\\\.\\"); - - /* Copy this so that it may be overwritten - include NULL */ - ValueNameLength = MaxNameLength + sizeof(WCHAR); - - while ( RegEnumValue(DevicesKey, - ValueIndex, - ValueName, - &ValueNameLength, - NULL, - &ValueType, - (LPBYTE) &ValueData, - &ValueDataLength) == ERROR_SUCCESS ) - { - /* Device types are stored as DWORDs */ - if ( ( ValueType == REG_DWORD ) && - ( ValueDataLength == sizeof(DWORD) ) ) - { - if ( ( DeviceType == 0 ) || - ( DeviceType == ValueData ) ) - { - SoundDeviceDetectedProc( - ValueData, - DevicePath, - INVALID_HANDLE_VALUE); - } - } - - /* Reset variables for the next iteration */ - ValueNameLength = MaxNameLength + sizeof(WCHAR); - ZeroMemory(ValueName, (MaxNameLength+1)*sizeof(WCHAR)); - /*ZeroWideString(ValueName);*/ - ValueDataLength = sizeof(DWORD); - ValueData = 0; - ValueType = REG_NONE; - - ++ ValueIndex; - } - - FreeMemory(DevicePath); - - RegCloseKey(DevicesKey); - } - - ++ KeyIndex; - - RegCloseKey(Key); - } - - return MMSYSERR_NOERROR; -} - -/* - Brute-force device detection, using a base device name (eg: \\.\WaveOut). - - This will add the device number as a suffix to the end of the string and - attempt to open the device based on that name. On success, it will - increment the device number and repeat this process. - - When it runs out of devices, it will give up. -*/ -MMRESULT -DetectNt4SoundDevices( - IN UCHAR DeviceType, - IN PWSTR BaseDeviceName, - IN SOUND_DEVICE_DETECTED_PROC SoundDeviceDetectedProc) -{ - ULONG DeviceNameLength = 0; - PWSTR DeviceName = NULL; - ULONG Index = 0, Count = 0; - HANDLE DeviceHandle; - BOOLEAN DoSearch = TRUE; - - TRACE_("Detecting NT4 style sound devices of type %d\n", DeviceType); - - VALIDATE_MMSYS_PARAMETER( VALID_SOUND_DEVICE_TYPE(DeviceType) ); - - DeviceNameLength = wcslen(BaseDeviceName); - /* Consider the length of the number */ - DeviceNameLength += GetDigitCount(Index); - - DeviceName = AllocateWideString(DeviceNameLength); - - if ( ! DeviceName ) - { - return MMSYSERR_NOMEM; - } - - while ( DoSearch ) - { - /* Nothing like a nice clean device name */ - ZeroWideString(DeviceName); - wsprintf(DeviceName, L"%ls%d", BaseDeviceName, Index); - - if ( OpenKernelSoundDeviceByName(DeviceName, - GENERIC_READ, - &DeviceHandle) == MMSYSERR_NOERROR ) - { - //DPRINT("Found device %d\n", Index); - MessageBox(0, DeviceName, L"Opened device", MB_OK | MB_TASKMODAL); - - /* Notify the callback function */ - if ( SoundDeviceDetectedProc(DeviceType, DeviceName, DeviceHandle) ) - { - ++ Count; - } - - CloseHandle(DeviceHandle); - - ++ Index; - } - else - { - DoSearch = FALSE; - } - } - - FreeMemory(DeviceName); - - return MMSYSERR_NOERROR; -} Removed: branches/silverblade-audio/lib/drivers/sound/mmebuddy/thread.c URL:
http://svn.reactos.org/svn/reactos/branches/silverblade-audio/lib/drivers/s…
============================================================================== --- branches/silverblade-audio/lib/drivers/sound/mmebuddy/thread.c [iso-8859-1] (original) +++ branches/silverblade-audio/lib/drivers/sound/mmebuddy/thread.c (removed) @@ -1,395 +1,0 @@ -/* - * PROJECT: ReactOS Sound System "MME Buddy" Library - * LICENSE: GPL - See COPYING in the top level directory - * FILE: lib/sound/mmebuddy/thread.c - * - * PURPOSE: Manages a thread to assist with the streaming of sound data. - * - * PROGRAMMERS: Andrew Greenwood (silverblade(a)reactos.org) -*/ - -#include <windows.h> -#include <mmsystem.h> - -#include <mmebuddy.h> - -static BOOLEAN ThreadRunning = FALSE; -static HANDLE SoundThread = INVALID_HANDLE_VALUE; -static HANDLE ReadyEvent = INVALID_HANDLE_VALUE; -static HANDLE RequestEvent = INVALID_HANDLE_VALUE; -static HANDLE DoneEvent = INVALID_HANDLE_VALUE; - -static SOUND_THREAD_REQUEST CurrentRequest = -{ - NULL, - NULL, - NULL, - MMSYSERR_NOERROR -}; - -static SOUND_THREAD_COMPLETED_IO* CompletedIoListHead = NULL; -static SOUND_THREAD_COMPLETED_IO* CompletedIoListTail = NULL; - - -VOID -CleanupThreadEvents(); - -VOID CALLBACK -CompleteSoundThreadIo( - IN DWORD dwErrorCode, - IN DWORD dwNumberOfBytesTransferred, - IN LPOVERLAPPED lpOverlapped) -{ - PSOUND_THREAD_COMPLETED_IO CompletionData; - PSOUND_THREAD_OVERLAPPED SoundOverlapped; - - TRACE_("** I/O has completed\n"); - TRACE_("** Returned overlapped at %p\n", lpOverlapped); - - SoundOverlapped = (PSOUND_THREAD_OVERLAPPED) lpOverlapped; - ASSERT(SoundOverlapped); - - CompletionData = SoundOverlapped->CompletionData; - ASSERT(CompletionData); - - CompletionData->BytesTransferred = dwNumberOfBytesTransferred; - - /* Is this the first completion? */ - if ( ! CompletedIoListHead ) - { - TRACE_("First completion - making new head and tail\n"); - /* This is the first completion */ - ASSERT(! CompletedIoListTail); - - CompletionData->Previous = NULL; - CompletionData->Next = NULL; - - CompletedIoListHead = CompletionData; - CompletedIoListTail = CompletionData; - } - else - { - TRACE_("Not the first completion - making new tail\n"); - ASSERT(CompletionData); - /* This is not the first completion */ - CompletionData->Previous = CompletedIoListTail; - CompletionData->Next = NULL; - - /* Completion data gets made the new tail */ - ASSERT(CompletedIoListTail); - CompletedIoListTail->Next = CompletionData; - CompletedIoListTail = CompletionData; - } - - /* We keep the completion data, but no longer need this: */ - FreeMemory(SoundOverlapped); - - TRACE_("** Leaving completion routine\n"); -} - -MMRESULT -OverlappedSoundDeviceIo( - IN PSOUND_DEVICE_INSTANCE SoundDeviceInstance, - IN PVOID Buffer, - IN DWORD BufferSize, - IN SOUND_THREAD_IO_COMPLETION_HANDLER IoCompletionHandler, - IN PVOID CompletionParameter OPTIONAL) -{ - PSOUND_THREAD_OVERLAPPED Overlapped; - - VALIDATE_MMSYS_PARAMETER( IsValidSoundDeviceInstance(SoundDeviceInstance) ); - VALIDATE_MMSYS_PARAMETER( Buffer ); - VALIDATE_MMSYS_PARAMETER( BufferSize > 0 ); - VALIDATE_MMSYS_PARAMETER( IoCompletionHandler ); - - /* Allocate memory for the overlapped I/O structure (auto-zeroed) */ - Overlapped = AllocateMemoryFor(SOUND_THREAD_OVERLAPPED); - - if ( ! Overlapped ) - return MMSYSERR_NOMEM; - - /* We also need memory for the completion data (auto-zeroed) */ - Overlapped->CompletionData = AllocateMemoryFor(SOUND_THREAD_COMPLETED_IO); - - if ( ! Overlapped->CompletionData ) - { - FreeMemory(Overlapped); - return MMSYSERR_NOMEM; - } - - /* Information to be passed to the completion routine */ - Overlapped->CompletionData->SoundDeviceInstance = SoundDeviceInstance; - Overlapped->CompletionData->CompletionHandler = IoCompletionHandler; - Overlapped->CompletionData->Parameter = CompletionParameter; - Overlapped->CompletionData->BytesTransferred = 0; - - TRACE_("Performing overlapped I/O\n"); - return WriteSoundDeviceBuffer(SoundDeviceInstance, - Buffer, - BufferSize, - CompleteSoundThreadIo, - (LPOVERLAPPED) Overlapped); -} - -MMRESULT -ProcessThreadExitRequest( - IN PSOUND_DEVICE_INSTANCE SoundDeviceInstance OPTIONAL, - IN PVOID Parameter OPTIONAL) -{ - TRACE_("ProcessThreadExitRequest called\n"); - ThreadRunning = FALSE; - return MMSYSERR_NOERROR; -} - -DWORD WINAPI -SoundThreadProc( - IN LPVOID lpParameter OPTIONAL) -{ - ThreadRunning = TRUE; - - /* We're ready to do work */ - SetEvent(ReadyEvent); - - TRACE_("SoundThreadProc entered\n"); - - while ( ThreadRunning ) - { - DWORD WaitResult; - - /* Wait for a request, or an I/O completion */ - WaitResult = WaitForSingleObjectEx(RequestEvent, INFINITE, TRUE); - TRACE_("Came out of waiting\n"); - - if ( WaitResult == WAIT_OBJECT_0 ) - { - /* Process the request */ - - TRACE_("Processing request\n"); - - ASSERT(CurrentRequest.RequestHandler); - if ( CurrentRequest.RequestHandler ) - { - TRACE_("Calling function %p\n", CurrentRequest.RequestHandler); - CurrentRequest.ReturnValue = CurrentRequest.RequestHandler( - CurrentRequest.SoundDeviceInstance, - CurrentRequest.Parameter); - } - else - { - CurrentRequest.ReturnValue = MMSYSERR_ERROR; - } - - /* Announce completion of the request */ - SetEvent(DoneEvent); - /* Accept new requests */ - SetEvent(ReadyEvent); - } - else if ( WaitResult == WAIT_IO_COMPLETION ) - { - PSOUND_THREAD_COMPLETED_IO CurrentCompletion; - - /* Process the I/O Completion */ - TRACE_("Returned from I/O completion APC\n"); - - CurrentCompletion = CompletedIoListHead; - ASSERT(CurrentCompletion); - - TRACE_("Beginning enumeration of completions\n"); - while ( CurrentCompletion ) - { - PSOUND_THREAD_COMPLETED_IO PreviousCompletion; - - TRACE_("Calling completion handler\n"); - /* Call the completion handler */ - CurrentCompletion->CompletionHandler( - CurrentCompletion->SoundDeviceInstance, - CurrentCompletion->Parameter, - CurrentCompletion->BytesTransferred); - - TRACE_("Advancing to next completion\n"); - /* Get the next completion but destroy the previous */ - PreviousCompletion = CurrentCompletion; - CurrentCompletion = CurrentCompletion->Next; - /*CompletedIoListHead = CurrentCompletion;*/ - - FreeMemory(PreviousCompletion); - } - - /* Nothing in the completion queue/list now */ - CompletedIoListHead = NULL; - CompletedIoListTail = NULL; - TRACE_("Ended enumeration of completions\n"); - } - else - { - /* Shouldn't happen! */ - ASSERT(FALSE); - } - } - - TRACE_("THREAD: Exiting\n"); - - ExitThread(0); - return 0; -} - -MMRESULT -CreateThreadEvents() -{ - ReadyEvent = CreateEvent(NULL, FALSE, FALSE, NULL); - - if ( ReadyEvent == INVALID_HANDLE_VALUE ) - { - CleanupThreadEvents(); - return MMSYSERR_NOMEM; - } - - RequestEvent = CreateEvent(NULL, FALSE, FALSE, NULL); - - if ( RequestEvent == INVALID_HANDLE_VALUE ) - { - CleanupThreadEvents(); - return MMSYSERR_NOMEM; - } - - DoneEvent = CreateEvent(NULL, FALSE, FALSE, NULL); - - if ( DoneEvent == INVALID_HANDLE_VALUE ) - { - CleanupThreadEvents(); - return MMSYSERR_NOMEM; - } - - return MMSYSERR_NOERROR; -} - -VOID -CleanupThreadEvents() -{ - if ( ReadyEvent != INVALID_HANDLE_VALUE ) - { - CloseHandle(ReadyEvent); - ReadyEvent = INVALID_HANDLE_VALUE; - } - - if ( RequestEvent != INVALID_HANDLE_VALUE ) - { - CloseHandle(RequestEvent); - RequestEvent = INVALID_HANDLE_VALUE; - } - - if ( DoneEvent != INVALID_HANDLE_VALUE ) - { - CloseHandle(DoneEvent); - DoneEvent = INVALID_HANDLE_VALUE; - } -} - -MMRESULT -StartSoundThread() -{ - MMRESULT Result; - - /* Create the thread events */ - Result = CreateThreadEvents(); - - if ( Result != MMSYSERR_NOERROR ) - { - return Result; - } - - /* Create the thread */ - SoundThread = CreateThread(NULL, - 0, - &SoundThreadProc, - (LPVOID) NULL, /* Parameter */ - CREATE_SUSPENDED, - NULL); - - if ( SoundThread == INVALID_HANDLE_VALUE ) - { - CleanupThreadEvents(); - return Win32ErrorToMmResult(GetLastError()); - } - - TRACE_("Starting sound thread\n"); - - /* We're all set to go, so let's start the thread up */ - if ( ResumeThread(SoundThread) == -1 ) - { - CloseHandle(SoundThread); - SoundThread = INVALID_HANDLE_VALUE; - CleanupThreadEvents(); - ERR_("Error %d\n", (int) GetLastError()); - return Win32ErrorToMmResult(GetLastError()); - } - - return MMSYSERR_NOERROR; -} - -MMRESULT -CallUsingSoundThread( - IN PSOUND_DEVICE_INSTANCE SoundDeviceInstance OPTIONAL, - IN SOUND_THREAD_REQUEST_HANDLER RequestHandler, - IN PVOID Parameter OPTIONAL) -{ - VALIDATE_MMSYS_PARAMETER( RequestHandler ); - - ASSERT(SoundThread != INVALID_HANDLE_VALUE); - if ( SoundThread == INVALID_HANDLE_VALUE ) - { - return MMSYSERR_ERROR; - } - - TRACE_("Waiting for ready event\n"); - /* Wait for the sound thread to be ready for a request */ - WaitForSingleObject(ReadyEvent, INFINITE); - - /* Fill in the information about the request */ - CurrentRequest.SoundDeviceInstance = SoundDeviceInstance; - CurrentRequest.RequestHandler = RequestHandler; - CurrentRequest.Parameter = Parameter; - CurrentRequest.ReturnValue = MMSYSERR_ERROR; - - /* Tell the sound thread there is a request waiting */ - SetEvent(RequestEvent); - - TRACE_("Waiting for done event\n"); - /* Wait for our request to be dealt with */ - WaitForSingleObject(DoneEvent, INFINITE); - - return CurrentRequest.ReturnValue; -} - -MMRESULT -StopSoundThread() -{ - MMRESULT Result; - - ASSERT(SoundThread != INVALID_HANDLE_VALUE); - if ( SoundThread == INVALID_HANDLE_VALUE ) - { - return MMSYSERR_ERROR; - } - - TRACE_("Calling thread shutdown function\n"); - - Result = CallUsingSoundThread(NULL, - ProcessThreadExitRequest, - NULL); - - /* Our request didn't get processed? */ - ASSERT(Result == MMSYSERR_NOERROR); - if ( Result != MMSYSERR_NOERROR ) - return Result; - - WaitForSingleObject(SoundThread, INFINITE); - - TRACE_("Sound thread has quit\n"); - - /* Clean up */ - CloseHandle(SoundThread); - CleanupThreadEvents(); - - return MMSYSERR_NOERROR; -} Removed: branches/silverblade-audio/lib/drivers/sound/mmebuddy/utility.c URL:
http://svn.reactos.org/svn/reactos/branches/silverblade-audio/lib/drivers/s…
============================================================================== --- branches/silverblade-audio/lib/drivers/sound/mmebuddy/utility.c [iso-8859-1] (original) +++ branches/silverblade-audio/lib/drivers/sound/mmebuddy/utility.c (removed) @@ -1,266 +1,0 @@ -/* - * PROJECT: ReactOS Sound System "MME Buddy" Library - * LICENSE: GPL - See COPYING in the top level directory - * FILE: lib/sound/mmebuddy/utility.c - * - * PURPOSE: Provides utility functions used by the library. - * - * PROGRAMMERS: Andrew Greenwood (silverblade(a)reactos.org) -*/ - -#include <windows.h> -#include <mmsystem.h> - -#include <mmebuddy.h> - -/* - Memory -*/ - -static HANDLE ProcessHeapHandle = INVALID_HANDLE_VALUE; -static DWORD CurrentAllocations = 0; - -/* Makes the entry-points safe */ -static HANDLE BigMmLock = NULL; - -#if 0 -typedef struct _ALLOCATION -{ - DWORD Tag; - DWORD Size; -} ALLOCATION; - -PVOID -AllocateTaggedMemory( - IN DWORD Tag, - IN DWORD Size) -{ - PVOID Pointer = NULL; - - Size += sizeof(ALLOCATION); - - if ( ProcessHeapHandle == INVALID_HANDLE_VALUE ) - ProcessHeapHandle = GetProcessHeap(); - - Pointer = HeapAlloc(ProcessHeapHandle, HEAP_ZERO_MEMORY, Size); - - if ( ! Pointer ) - return NULL; - - /* Store the tag and size */ - ((ALLOCATION*)Pointer)->Tag = Tag; - ((ALLOCATION*)Pointer)->Size = Size; - - ++ CurrentAllocations; - - return ((PCHAR)Pointer) + sizeof(ALLOCATION); -} - -VOID -FreeTaggedMemory( - IN DWORD Tag, - IN PVOID Pointer) -{ - ALLOCATION* AllocationInfo; - - ASSERT(ProcessHeapHandle != INVALID_HANDLE_VALUE); - ASSERT(Pointer); - - AllocationInfo = (ALLOCATION*)((PCHAR)Pointer - sizeof(ALLOCATION)); - - ASSERT( AllocationInfo->Tag == Tag ); - - ZeroMemory(AllocationInfo, AllocationInfo->Size + sizeof(ALLOCATION)); - HeapFree(ProcessHeapHandle, 0, AllocationInfo); - - -- CurrentAllocations; -} -#endif - -PVOID -AllocateTaggedMemory( - IN DWORD Tag, - IN DWORD Size) -{ - PVOID Pointer = NULL; - - if ( ProcessHeapHandle == INVALID_HANDLE_VALUE ) - ProcessHeapHandle = GetProcessHeap(); - - Pointer = HeapAlloc(ProcessHeapHandle, HEAP_ZERO_MEMORY, Size); - - if ( ! Pointer ) - return NULL; - - ++ CurrentAllocations; - - return Pointer; -} - -VOID -FreeTaggedMemory( - IN DWORD Tag, - IN PVOID Pointer) -{ - ASSERT(ProcessHeapHandle != INVALID_HANDLE_VALUE); - ASSERT(Pointer); - - HeapFree(ProcessHeapHandle, 0, Pointer); - - -- CurrentAllocations; -} - -DWORD -GetMemoryAllocations() -{ - return CurrentAllocations; -} - - -/* - Other -*/ - -ULONG -GetDigitCount( - ULONG Number) -{ - ULONG Value = Number; - ULONG Digits = 1; - - while ( Value > 9 ) - { - Value /= 10; - ++ Digits; - } - - return Digits; -} - - - -/* - Result codes -*/ - -MMRESULT -Win32ErrorToMmResult(UINT error_code) -{ - switch ( error_code ) - { - case NO_ERROR : - case ERROR_IO_PENDING : - return MMSYSERR_NOERROR; - - case ERROR_BUSY : - return MMSYSERR_ALLOCATED; - - case ERROR_NOT_SUPPORTED : - case ERROR_INVALID_FUNCTION : - return MMSYSERR_NOTSUPPORTED; - - case ERROR_NOT_ENOUGH_MEMORY : - return MMSYSERR_NOMEM; - - case ERROR_ACCESS_DENIED : - return MMSYSERR_BADDEVICEID; - - case ERROR_INSUFFICIENT_BUFFER : - return MMSYSERR_INVALPARAM; - }; - - /* If all else fails, it's just a plain old error */ - - return MMSYSERR_ERROR; -} - -/* - If a function invokes another function, this aids in translating the result - code so that it is applicable in the context of the original caller. For - example, specifying that an invalid parameter was passed probably does not - make much sense if the parameter wasn't passed by the original caller! - - However, things like MMSYSERR_NOMEM make sense to return to the caller. - - This could potentially highlight internal logic problems. -*/ -MMRESULT -TranslateInternalMmResult(MMRESULT Result) -{ - switch ( Result ) - { - case MMSYSERR_INVALPARAM : - case MMSYSERR_INVALFLAG : - { - ERR_("MMRESULT from an internal routine failed with error %d\n", - (int) Result); - - return MMSYSERR_ERROR; - } - } - - return Result; -} - - - -/* - Entrypoint mutex management -*/ - -MMRESULT -InitEntrypointMutex() -{ - BigMmLock = CreateMutex(NULL, FALSE, NULL); - - if ( BigMmLock == NULL ) - { - return Win32ErrorToMmResult(GetLastError()); - } - - return MMSYSERR_NOERROR; -} - -VOID -CleanupEntrypointMutex() -{ - if ( BigMmLock ) - { - CloseHandle(BigMmLock); - } -} - -VOID -AcquireEntrypointMutex() -{ - ASSERT(BigMmLock); - WaitForSingleObject(BigMmLock, INFINITE); -} - -VOID -ReleaseEntrypointMutex() -{ - ASSERT(BigMmLock); - ReleaseMutex(BigMmLock); -} - - -/* - MME Buddy init/cleanup - NOTE: We don't do thread start/stop here... -*/ - -BOOLEAN -InitMmeBuddyLib() -{ - if ( InitEntrypointMutex() != MMSYSERR_NOERROR ) - return FALSE; - - return TRUE; -} - -VOID -CleanupMmeBuddyLib() -{ - ReleaseEntrypointMutex(); -}
16 years, 5 months
1
0
0
0
[pschweitzer] 34586: Fixed i386 build
by pschweitzer@svn.reactos.org
Author: pschweitzer Date: Sat Jul 19 03:04:47 2008 New Revision: 34586 URL:
http://svn.reactos.org/svn/reactos?rev=34586&view=rev
Log: Fixed i386 build Modified: trunk/reactos/ntoskrnl/include/internal/i386/ke.h trunk/reactos/ntoskrnl/include/internal/ke.h Modified: trunk/reactos/ntoskrnl/include/internal/i386/ke.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/include/internal/…
============================================================================== --- trunk/reactos/ntoskrnl/include/internal/i386/ke.h [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/include/internal/i386/ke.h [iso-8859-1] Sat Jul 19 03:04:47 2008 @@ -65,10 +65,6 @@ IN PKIDTENTRY Idt, IN PKGDTENTRY Gdt ); - -VOID -FASTCALL -KiIdleLoop(VOID); VOID KiGdtPrepareForApplicationProcessorInit(ULONG Id); Modified: trunk/reactos/ntoskrnl/include/internal/ke.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/include/internal/…
============================================================================== --- trunk/reactos/ntoskrnl/include/internal/ke.h [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/include/internal/ke.h [iso-8859-1] Sat Jul 19 03:04:47 2008 @@ -992,7 +992,7 @@ ); VOID -FASTCALL +NTAPI KiQuantumEnd( VOID );
16 years, 5 months
1
0
0
0
[ros-arm-bringup] 34585: - Implement DebugService2, but don't make it do anything yet. - Add ATTEMPTED_SWITCH_FROM_DPC bugcheck code.
by ros-arm-bringup@svn.reactos.org
Author: ros-arm-bringup Date: Sat Jul 19 01:53:36 2008 New Revision: 34585 URL:
http://svn.reactos.org/svn/reactos?rev=34585&view=rev
Log: - Implement DebugService2, but don't make it do anything yet. - Add ATTEMPTED_SWITCH_FROM_DPC bugcheck code. Modified: trunk/reactos/include/reactos/mc/bugcodes.mc trunk/reactos/lib/rtl/arm/debug_asm.S Modified: trunk/reactos/include/reactos/mc/bugcodes.mc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/reactos/mc/bugcode…
============================================================================== --- trunk/reactos/include/reactos/mc/bugcodes.mc [iso-8859-1] (original) +++ trunk/reactos/include/reactos/mc/bugcodes.mc [iso-8859-1] Sat Jul 19 01:53:36 2008 @@ -1170,6 +1170,14 @@ Boot Logging Enabled . +MessageId=0xB8 +Severity=Success +Facility=System +SymbolicName=ATTEMPTED_SWITCH_FROM_DPC +Language=English +ATTEMPTED_SWITCH_FROM_DPC +. + MessageId=0xBE Severity=Success Facility=System Modified: trunk/reactos/lib/rtl/arm/debug_asm.S URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/rtl/arm/debug_asm.S?re…
============================================================================== --- trunk/reactos/lib/rtl/arm/debug_asm.S [iso-8859-1] (original) +++ trunk/reactos/lib/rtl/arm/debug_asm.S [iso-8859-1] Sat Jul 19 01:53:36 2008 @@ -27,15 +27,25 @@ // // Do a breakpoint and return // - bkpt BREAKPOINT_PRINT // Could also be PROMPT -- we check later in a1 + bkpt BREAKPOINT_PRINT // Could be prompt too, we check this later bx lr ENTRY_END DebugService + + NESTED_ENTRY DebugService2 + PROLOG_END DebugService2 + + // + // FIXME-TODO: Do a breakpoint and return + // + //bkpt BREAKPOINT_LOAD_SYMBOLS // Could be unload too, we check this later + bx lr + ENTRY_END DebugService2 NESTED_ENTRY RtlCaptureContext PROLOG_END RtlCaptureContext // - // FIXME: Change to stmdb later + // FIXME-PERF: Change to stmdb later // str r0, [a1, #CsR0] str r1, [a1, #CsR1]
16 years, 5 months
1
0
0
0
[ros-arm-bringup] 34584: - Enable interrupts after probing and capturing parameters during a system call. - Enable WFI during idle loop. - Implement undefined exception handler, and get rid of reserved exception code -- this will never happen except for an SoC bug. - Request an APC interrupt if the new thread we context switched to has APCs pending and enabled. - Perform DPC watchdog debugging code if a DPC lasted more than a second. - Do the appropriate bugcheck if DPCs are active during a cont
by ros-arm-bringup@svn.reactos.org
Author: ros-arm-bringup Date: Sat Jul 19 01:53:03 2008 New Revision: 34584 URL:
http://svn.reactos.org/svn/reactos?rev=34584&view=rev
Log: - Enable interrupts after probing and capturing parameters during a system call. - Enable WFI during idle loop. - Implement undefined exception handler, and get rid of reserved exception code -- this will never happen except for an SoC bug. - Request an APC interrupt if the new thread we context switched to has APCs pending and enabled. - Perform DPC watchdog debugging code if a DPC lasted more than a second. - Do the appropriate bugcheck if DPCs are active during a context switch. - Go over the FIXMEs in the assembly files too, and create a new FIXME-PERF category. Modified: trunk/reactos/ntoskrnl/include/internal/arm/intrin_i.h trunk/reactos/ntoskrnl/include/internal/ke.h trunk/reactos/ntoskrnl/ke/arm/ctxswtch.s trunk/reactos/ntoskrnl/ke/arm/kiinit.c trunk/reactos/ntoskrnl/ke/arm/time.c trunk/reactos/ntoskrnl/ke/arm/trap.s trunk/reactos/ntoskrnl/ke/arm/trapc.c trunk/reactos/ntoskrnl/ke/arm/usercall.c Modified: trunk/reactos/ntoskrnl/include/internal/arm/intrin_i.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/include/internal/…
============================================================================== --- trunk/reactos/ntoskrnl/include/internal/arm/intrin_i.h [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/include/internal/arm/intrin_i.h [iso-8859-1] Sat Jul 19 01:53:03 2008 @@ -148,5 +148,11 @@ __asm__ __volatile__ ("mcr p15, 0, %0, c7, c5, 0" : : "r"(0) : "cc"); } +FORCEINLINE +VOID +KeArmWaitForInterrupt(VOID) +{ + __asm__ __volatile__ ("mcr p15, 0, %0, c7, c0, 4" : : "r"(0) : "cc"); +} #endif Modified: trunk/reactos/ntoskrnl/include/internal/ke.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/include/internal/…
============================================================================== --- trunk/reactos/ntoskrnl/include/internal/ke.h [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/include/internal/ke.h [iso-8859-1] Sat Jul 19 01:53:03 2008 @@ -155,6 +155,7 @@ extern ULONG KeTimeIncrement; extern ULONG_PTR KiBugCheckData[5]; extern ULONG KiFreezeFlag; +extern ULONG KiDPCTimeout; /* MACROS *************************************************************************/ Modified: trunk/reactos/ntoskrnl/ke/arm/ctxswtch.s URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/arm/ctxswtch.s…
============================================================================== --- trunk/reactos/ntoskrnl/ke/arm/ctxswtch.s [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/ke/arm/ctxswtch.s [iso-8859-1] Sat Jul 19 01:53:03 2008 @@ -25,7 +25,7 @@ // // Build exception frame - // FIXME: Change to stmdb later + // FIXME-PERF: Change to stmdb later // str r4, [sp, #ExR4] str r5, [sp, #ExR5] @@ -58,7 +58,7 @@ // // Restore the registers - // FIXME: Use LDMIA later + // FIXME-PERF: Use LDMIA later // ldr r4, [sp, #ExR4] ldr r5, [sp, #ExR5] @@ -84,11 +84,7 @@ NESTED_ENTRY KiThreadStartup PROLOG_END KiThreadStartup - - // - // FIXME: Make space on stack and clean it up? - // - + // // Lower to APC_LEVEL // Modified: trunk/reactos/ntoskrnl/ke/arm/kiinit.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/arm/kiinit.c?r…
============================================================================== --- trunk/reactos/ntoskrnl/ke/arm/kiinit.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/ke/arm/kiinit.c [iso-8859-1] Sat Jul 19 01:53:03 2008 @@ -22,17 +22,6 @@ #define __ARMV6__ KeIsArmV6 /* FUNCTIONS ******************************************************************/ - -VOID -DebugService2(IN ULONG Arg1, - IN ULONG Arg2, - IN ULONG Service) -{ - // - // FIXME-TODO: Implement this for symbol load and such - // - return; -} VOID NTAPI Modified: trunk/reactos/ntoskrnl/ke/arm/time.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/arm/time.c?rev…
============================================================================== --- trunk/reactos/ntoskrnl/ke/arm/time.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/ke/arm/time.c [iso-8859-1] Sat Jul 19 01:53:03 2008 @@ -224,8 +224,31 @@ Prcb->DpcTime++; // - // FIXME-TODO: Handle DPC checks - // + // Update Debug DPC time + // + Prcb->DebugDpcTime++; + + // + // Check if we've timed out + // + if (Prcb->DebugDpcTime >= KiDPCTimeout) + { + // + // Print a message + // + DbgPrint("\n*** DPC routine > 1 sec --- This is not a break in " + "KeUpdateSystemTime\n"); + + // + // Break if a debugger is attached + // + if (KdDebuggerEnabled) DbgBreakPoint(); + + // + // Restore the debug DPC time + // + Prcb->DebugDpcTime = 0; + } } } Modified: trunk/reactos/ntoskrnl/ke/arm/trap.s URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/arm/trap.s?rev…
============================================================================== --- trunk/reactos/ntoskrnl/ke/arm/trap.s [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/ke/arm/trap.s [iso-8859-1] Sat Jul 19 01:53:03 2008 @@ -17,7 +17,7 @@ ldr pc, _KiSoftwareInterruptJump // Software Interrupt ldr pc, _KiPrefetchAbortJump // Prefetch Abort ldr pc, _KiDataAbortJump // Data Abort - ldr pc, _KiReservedJump // Reserved + b . // Reserved ldr pc, _KiInterruptJump // Interrupt ldr pc, _KiFastInterruptJump // Fast Interrupt @@ -25,7 +25,6 @@ _KiSoftwareInterruptJump: .word KiSoftwareInterruptException _KiPrefetchAbortJump: .word KiPrefetchAbortException _KiDataAbortJump: .word KiDataAbortException - _KiReservedJump: .word KiReservedException _KiInterruptJump: .word KiInterruptException _KiFastInterruptJump: .word KiFastInterruptException @@ -34,9 +33,22 @@ PROLOG_END KiUndefinedInstructionException // - // FIXME: TODO + // Handle trap entry // - b . + TRAP_PROLOG 0 // NotFromAbort + + // + // Call the C handler + // + adr lr, 1f + mov r0, sp + ldr pc, =KiUndefinedExceptionHandler + +1: + // + // Handle trap exit + // + TRAP_EPILOG 0 // NotFromSystemCall ENTRY_END KiUndefinedInstructionException @@ -137,19 +149,8 @@ PROLOG_END KiFastInterruptException // - // FIXME: TODO + // FIXME-PERF: Implement FIQ exception // b . ENTRY_END KiFastInterruptException - - - NESTED_ENTRY KiReservedException - PROLOG_END KiReservedException - - // - // FIXME: TODO - // - b . - - ENTRY_END KiReservedException Modified: trunk/reactos/ntoskrnl/ke/arm/trapc.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/arm/trapc.c?re…
============================================================================== --- trunk/reactos/ntoskrnl/ke/arm/trapc.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/ke/arm/trapc.c [iso-8859-1] Sat Jul 19 01:53:03 2008 @@ -80,8 +80,9 @@ else { // - // FIXME-TODO: Wait-For-Interrupt ARM Opcode - // + // Go into WFI (sleep more) + // + KeArmWaitForInterrupt(); } } } @@ -155,10 +156,13 @@ if (Prcb->DpcRoutineActive) { // - // FIXME-TODO: Implement bugcheck code - // - DPRINT1("DPCS ACTIVE!!!\n"); - ASSERT(FALSE); + // Crash the machine + // + KeBugCheckEx(ATTEMPTED_SWITCH_FROM_DPC, + (ULONG_PTR)OldThread, + (ULONG_PTR)NewThread, + (ULONG_PTR)OldThread->InitialStack, + 0); } // @@ -167,10 +171,16 @@ if (NewThread->ApcState.KernelApcPending) { // - // FIXME-TODO: Implement bugcheck code - // - DPRINT1("APCs pending!\n"); - ASSERT(FALSE); + // Are APCs enabled? + // + if (NewThread->SpecialApcDisable == 0) + { + // + // Request APC delivery + // + HalRequestSoftwareInterrupt(APC_LEVEL); + return TRUE; + } } // @@ -517,13 +527,23 @@ // Read the opcode // Instruction = *(PULONG)(TrapFrame->Pc - sizeof(ULONG)); - - // - // FIXME-TODO: Enable interrupts? - // - + // // Call the service call dispatcher // KiSystemService(Thread, TrapFrame, Instruction); } + +NTSTATUS +KiUndefinedExceptionHandler(IN PKTRAP_FRAME TrapFrame) +{ + ASSERT(TrapFrame->DbgArgMark == 0xBADB0D00); + + // + // This should never happen + // + DPRINT1("[UNDEF] @ %p/%p\n", TrapFrame->SvcLr, TrapFrame->Pc); + UNIMPLEMENTED; + ASSERT(FALSE); + return STATUS_SUCCESS; +} Modified: trunk/reactos/ntoskrnl/ke/arm/usercall.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/arm/usercall.c…
============================================================================== --- trunk/reactos/ntoskrnl/ke/arm/usercall.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/ke/arm/usercall.c [iso-8859-1] Sat Jul 19 01:53:03 2008 @@ -200,6 +200,11 @@ } // + // We can safely enable interrupts here + // + _enable(); + + // // Do the system call and save result in EAX // TrapFrame->R0 = KiSyscallHandlers[ArgumentCount]((PVOID)SystemCall,
16 years, 5 months
1
0
0
0
[ros-arm-bringup] 34583: - Cleanup some stray header issues for ARM. - Separate kernel FIXMEs into clearer groupings: - TODO FIXMEs are highest priority, as they are missing required functionality. - USER FIXMEs are the next highest priority, since they will be required for user mode support. - V6 FIXMEs and future groupings are lowest priority, since they relate to hardware support we don't care about for now.
by ros-arm-bringup@svn.reactos.org
Author: ros-arm-bringup Date: Sat Jul 19 01:13:10 2008 New Revision: 34583 URL:
http://svn.reactos.org/svn/reactos?rev=34583&view=rev
Log: - Cleanup some stray header issues for ARM. - Separate kernel FIXMEs into clearer groupings: - TODO FIXMEs are highest priority, as they are missing required functionality. - USER FIXMEs are the next highest priority, since they will be required for user mode support. - V6 FIXMEs and future groupings are lowest priority, since they relate to hardware support we don't care about for now. Modified: trunk/reactos/ntoskrnl/include/internal/arm/ke.h trunk/reactos/ntoskrnl/include/internal/ke.h trunk/reactos/ntoskrnl/ke/arm/exp.c trunk/reactos/ntoskrnl/ke/arm/kiinit.c trunk/reactos/ntoskrnl/ke/arm/time.c trunk/reactos/ntoskrnl/ke/arm/trapc.c trunk/reactos/ntoskrnl/ke/arm/usercall.c Modified: trunk/reactos/ntoskrnl/include/internal/arm/ke.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/include/internal/…
============================================================================== --- trunk/reactos/ntoskrnl/include/internal/arm/ke.h [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/include/internal/arm/ke.h [iso-8859-1] Sat Jul 19 01:13:10 2008 @@ -52,4 +52,7 @@ #define KeArchInitThreadWithContext KeArmInitThreadWithContext #define KiSystemStartupReal KiSystemStartup +#define KiGetPreviousMode(tf) \ + ((tf->Spsr & CPSR_MODES) == CPSR_USER_MODE) ? UserMode: KernelMode + #endif Modified: trunk/reactos/ntoskrnl/include/internal/ke.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/include/internal/…
============================================================================== --- trunk/reactos/ntoskrnl/include/internal/ke.h [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/include/internal/ke.h [iso-8859-1] Sat Jul 19 01:13:10 2008 @@ -984,6 +984,30 @@ OUT PKPROCESSOR_STATE ProcessorState ); +VOID +FASTCALL +KiRetireDpcList( + IN PKPRCB Prcb +); + +VOID +FASTCALL +KiQuantumEnd( + VOID +); + +VOID +KiSystemService( + IN PKTHREAD Thread, + IN PKTRAP_FRAME TrapFrame, + IN ULONG Instruction +); + +VOID +KiIdleLoop( + VOID +); + #include "ke_x.h" #endif /* __NTOSKRNL_INCLUDE_INTERNAL_KE_H */ Modified: trunk/reactos/ntoskrnl/ke/arm/exp.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/arm/exp.c?rev=…
============================================================================== --- trunk/reactos/ntoskrnl/ke/arm/exp.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/ke/arm/exp.c [iso-8859-1] Sat Jul 19 01:13:10 2008 @@ -9,15 +9,9 @@ /* INCLUDES *******************************************************************/ #include <ntoskrnl.h> +#include <internal/arm/ksarm.h> #define NDEBUG #include <debug.h> - -/* GLOBALS ********************************************************************/ - -#include <internal/arm/ksarm.h> -#define KiGetPreviousMode(tf) \ -((tf->Spsr & CPSR_MODES) == CPSR_USER_MODE) ? UserMode: KernelMode - /* FUNCTIONS ******************************************************************/ @@ -194,7 +188,7 @@ Context.ContextFlags = CONTEXT_FULL; // - // FIXME: Fuck floating point + // FIXME-V6: VFP Support // // @@ -290,7 +284,7 @@ else { // - // FIXME: User mode + // FIXME-USER: Do user-mode exception handling // ASSERT(FALSE); } Modified: trunk/reactos/ntoskrnl/ke/arm/kiinit.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/arm/kiinit.c?r…
============================================================================== --- trunk/reactos/ntoskrnl/ke/arm/kiinit.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/ke/arm/kiinit.c [iso-8859-1] Sat Jul 19 01:13:10 2008 @@ -23,21 +23,13 @@ /* FUNCTIONS ******************************************************************/ -// -// FIXME: Header cleanup -// -VOID -KiIdleLoop( - VOID -); - VOID DebugService2(IN ULONG Arg1, IN ULONG Arg2, IN ULONG Service) { // - // FIXME: TODO + // FIXME-TODO: Implement this for symbol load and such // return; } @@ -230,7 +222,7 @@ else { // - // FIXME: No MP Support + // FIXME-V6: See if we want to support MP // DPRINT1("ARM MPCore not supported\n"); } Modified: trunk/reactos/ntoskrnl/ke/arm/time.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/arm/time.c?rev…
============================================================================== --- trunk/reactos/ntoskrnl/ke/arm/time.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/ke/arm/time.c [iso-8859-1] Sat Jul 19 01:13:10 2008 @@ -224,7 +224,7 @@ Prcb->DpcTime++; // - // FIXME: Handle DPC checks + // FIXME-TODO: Handle DPC checks // } } Modified: trunk/reactos/ntoskrnl/ke/arm/trapc.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/arm/trapc.c?re…
============================================================================== --- trunk/reactos/ntoskrnl/ke/arm/trapc.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/ke/arm/trapc.c [iso-8859-1] Sat Jul 19 01:13:10 2008 @@ -13,30 +13,6 @@ #define NDEBUG #include <debug.h> -/* GLOBALS ********************************************************************/ - -#define KiGetPreviousMode(tf) \ - ((tf->Spsr & CPSR_MODES) == CPSR_USER_MODE) ? UserMode: KernelMode - -VOID -FASTCALL -KiRetireDpcList( - IN PKPRCB Prcb -); - -VOID -FASTCALL -KiQuantumEnd( - VOID -); - -VOID -KiSystemService( - IN PKTHREAD Thread, - IN PKTRAP_FRAME TrapFrame, - IN ULONG Instruction -); - /* FUNCTIONS ******************************************************************/ VOID @@ -104,7 +80,7 @@ else { // - // FIXME: Wait-For-Interrupt ARM Opcode + // FIXME-TODO: Wait-For-Interrupt ARM Opcode // } } @@ -129,7 +105,7 @@ if (Pcr->PerfGlobalGroupMask) { // - // FIXME: TODO + // We don't support this yet on x86 either // DPRINT1("WMI Tracing not supported\n"); ASSERT(FALSE); @@ -149,7 +125,7 @@ NewProcess->DirectoryTableBase.LowPart) { // - // FIXME: TODO + // FIXME-USER: Support address space switch // DPRINT1("Address space switch not implemented\n"); ASSERT(FALSE); @@ -179,7 +155,7 @@ if (Prcb->DpcRoutineActive) { // - // FIXME: FAIL + // FIXME-TODO: Implement bugcheck code // DPRINT1("DPCS ACTIVE!!!\n"); ASSERT(FALSE); @@ -191,7 +167,7 @@ if (NewThread->ApcState.KernelApcPending) { // - // FIXME: TODO + // FIXME-TODO: Implement bugcheck code // DPRINT1("APCs pending!\n"); ASSERT(FALSE); @@ -217,7 +193,7 @@ PreviousMode = KiGetPreviousMode(TrapFrame); // - // FIXME No use-mode support + // FIXME-USER: Handle APC interrupt while in user-mode // if (PreviousMode == UserMode) ASSERT(FALSE); @@ -372,7 +348,7 @@ if (Irql > DISPATCH_LEVEL) { // - // FIXME: Switch to interrupt stack + // FIXME-TODO: Switch to interrupt stack // //DPRINT1("[ISR]\n"); } @@ -543,7 +519,7 @@ Instruction = *(PULONG)(TrapFrame->Pc - sizeof(ULONG)); // - // FIXME: Enable interrupts? + // FIXME-TODO: Enable interrupts? // // Modified: trunk/reactos/ntoskrnl/ke/arm/usercall.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/arm/usercall.c…
============================================================================== --- trunk/reactos/ntoskrnl/ke/arm/usercall.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/ke/arm/usercall.c [iso-8859-1] Sat Jul 19 01:13:10 2008 @@ -173,7 +173,7 @@ if (Thread->PreviousMode == UserMode) { // - // FIXME: Validate the user stack + // FIXME-USER: Validate the user stack // ASSERT(FALSE); Argument = (PVOID*)TrapFrame->UserSp;
16 years, 5 months
1
0
0
0
[jimtabor] 34582: Move NUMC defines to FNIDs.
by jimtabor@svn.reactos.org
Author: jimtabor Date: Fri Jul 18 22:49:48 2008 New Revision: 34582 URL:
http://svn.reactos.org/svn/reactos?rev=34582&view=rev
Log: Move NUMC defines to FNIDs. Modified: trunk/reactos/dll/win32/user32/windows/defwnd.c trunk/reactos/dll/win32/user32/windows/message.c trunk/reactos/include/reactos/win32k/ntuser.h trunk/reactos/subsystems/win32/win32k/ntuser/message.c Modified: trunk/reactos/dll/win32/user32/windows/defwnd.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/windows/d…
============================================================================== --- trunk/reactos/dll/win32/user32/windows/defwnd.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/user32/windows/defwnd.c [iso-8859-1] Fri Jul 18 22:49:48 2008 @@ -1410,7 +1410,7 @@ case WM_SHOWWINDOW: { - NtUserMessageCall( hWnd, Msg, wParam, lParam, 0, NUMC_DEFWINDOWPROC, FALSE); + NtUserMessageCall( hWnd, Msg, wParam, lParam, 0, FNID_DEFWINDOWPROC, FALSE); break; } Modified: trunk/reactos/dll/win32/user32/windows/message.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/windows/m…
============================================================================== --- trunk/reactos/dll/win32/user32/windows/message.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/user32/windows/message.c [iso-8859-1] Fri Jul 18 22:49:48 2008 @@ -1851,7 +1851,7 @@ wParam, lParam, (ULONG_PTR)&lpCallBack, - NUMC_SENDMESSAGECALLBACK, + FNID_SENDMESSAGECALLBACK, TRUE); } @@ -1873,7 +1873,7 @@ wParam, lParam, (ULONG_PTR)&lpCallBack, - NUMC_SENDMESSAGECALLBACK, + FNID_SENDMESSAGECALLBACK, FALSE); } @@ -2636,7 +2636,7 @@ wParam, lParam, (ULONG_PTR)&parm, - NUMC_BROADCASTSYSTEMMESSAGE, + FNID_BROADCASTSYSTEMMESSAGE, Ansi); } Modified: trunk/reactos/include/reactos/win32k/ntuser.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/reactos/win32k/ntu…
============================================================================== --- trunk/reactos/include/reactos/win32k/ntuser.h [iso-8859-1] (original) +++ trunk/reactos/include/reactos/win32k/ntuser.h [iso-8859-1] Fri Jul 18 22:49:48 2008 @@ -204,23 +204,34 @@ } PFNCLIENTWORKER, *PPFNCLIENTWORKER; -// FNID's for NtUserSetWindowFNID -#define FNID_SCROLLBAR 0x029A -#define FNID_ICONTITLE 0x029B -#define FNID_MENU 0x029C -#define FNID_DESKTOP 0x029D -#define FNID_SWITCH 0x02A0 -#define FNID_BUTTON 0x02A1 -#define FNID_COMBOBOX 0x02A2 -#define FNID_COMBOLBOX 0x02A3 -#define FNID_DIALOG 0x02A4 -#define FNID_EDIT 0x02A5 -#define FNID_LISTBOX 0x02A6 -#define FNID_MDICLIENT 0x02A7 -#define FNID_STATIC 0x02A8 -#define FNID_IME 0x02A9 -#define FNID_TOOLTIPS 0x02B5 -#define FNID_UNKNOWN 0x02B6 +// FNID's for NtUserSetWindowFNID, NtUserMessageCall +#define FNID_SCROLLBAR 0x029A +#define FNID_ICONTITLE 0x029B +#define FNID_MENU 0x029C +#define FNID_DESKTOP 0x029D +#define FNID_DEFWINDOWPROC 0x029E +#define FNID_SWITCH 0x02A0 +#define FNID_BUTTON 0x02A1 +#define FNID_COMBOBOX 0x02A2 +#define FNID_COMBOLBOX 0x02A3 +#define FNID_DIALOG 0x02A4 +#define FNID_EDIT 0x02A5 +#define FNID_LISTBOX 0x02A6 +#define FNID_MDICLIENT 0x02A7 +#define FNID_STATIC 0x02A8 +#define FNID_IME 0x02A9 +#define FNID_CALLWNDPROC 0x02AA +#define FNID_CALLWNDPROCRET 0x02AB +#define FNID_SENDMESSAGE 0x02B0 +// Kernel has option to use TimeOut or normal msg send, based on type of msg. +#define FNID_SENDMESSAGEWTOOPTION 0x02B1 +#define FNID_SENDMESSAGETIMEOUT 0x02B2 +#define FNID_BROADCASTSYSTEMMESSAGE 0x02B4 +#define FNID_TOOLTIPS 0x02B5 +#define FNID_UNKNOWN 0x02B6 +#define FNID_SENDNOTIFYMESSAGE 0x02B7 +#define FNID_SENDMESSAGECALLBACK 0x02B8 + #define FNID_DDEML 0x2000 // Registers DDEML #define FNID_DESTROY 0x4000 // This is sent when WM_NCDESTROY or in the support routine. @@ -1725,15 +1736,6 @@ UINT transType, DWORD keyboardId, HKL dwhkl ); -// Look like fnID's -#define NUMC_DEFWINDOWPROC 0x029E -#define NUMC_SENDMESSAGE 0x02B0 -// Kernel has option to use TO or normal msg send, based on type of msg. -#define NUMC_SENDMESSAGEWTOOPTION 0x02B1 -#define NUMC_SENDMESSAGETIMEOUT 0x02B2 -#define NUMC_BROADCASTSYSTEMMESSAGE 0x02B4 -#define NUMC_SENDNOTIFYMESSAGE 0x02B7 -#define NUMC_SENDMESSAGECALLBACK 0x02B8 LRESULT NTAPI NtUserMessageCall( @@ -1742,7 +1744,7 @@ WPARAM wParam, LPARAM lParam, ULONG_PTR ResultInfo, - DWORD dwType, // NUMC_XX types + DWORD dwType, // FNID_XX types BOOL Ansi); DWORD Modified: trunk/reactos/subsystems/win32/win32k/ntuser/message.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntuser/message.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/message.c [iso-8859-1] Fri Jul 18 22:49:48 2008 @@ -1861,7 +1861,7 @@ UserRefObjectCo(Window, &Ref); switch(dwType) { - case NUMC_DEFWINDOWPROC: + case FNID_DEFWINDOWPROC: lResult = IntDefWindowProc(Window, Msg, wParam, lParam); break; }
16 years, 5 months
1
0
0
0
[tkreuzer] 34581: RtlpCreateCriticalSectionSem: use InterlockedCompareExchangePointer instead of InterlockedCompareExchange for a handle
by tkreuzer@svn.reactos.org
Author: tkreuzer Date: Fri Jul 18 18:47:33 2008 New Revision: 34581 URL:
http://svn.reactos.org/svn/reactos?rev=34581&view=rev
Log: RtlpCreateCriticalSectionSem: use InterlockedCompareExchangePointer instead of InterlockedCompareExchange for a handle Modified: trunk/reactos/lib/rtl/critical.c Modified: trunk/reactos/lib/rtl/critical.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/rtl/critical.c?rev=345…
============================================================================== --- trunk/reactos/lib/rtl/critical.c [iso-8859-1] (original) +++ trunk/reactos/lib/rtl/critical.c [iso-8859-1] Fri Jul 18 18:47:33 2008 @@ -65,8 +65,8 @@ } DPRINT("Created Event: %p \n", hNewEvent); - if ((hEvent = (HANDLE)_InterlockedCompareExchange((PLONG)&CriticalSection->LockSemaphore, - (LONG)hNewEvent, + if ((hEvent = (HANDLE)_InterlockedCompareExchangePointer((PVOID*)&CriticalSection->LockSemaphore, + (PVOID)hNewEvent, 0))) { /* Some just created an event */
16 years, 5 months
1
0
0
0
[mkupfer] 34580: Mario Kacmar <kario AT szm DOT sk> - Enhancement for basic Slovak keyboard layout added. - See #1251 for more details.
by mkupfer@svn.reactos.org
Author: mkupfer Date: Fri Jul 18 16:08:52 2008 New Revision: 34580 URL:
http://svn.reactos.org/svn/reactos?rev=34580&view=rev
Log: Mario Kacmar <kario AT szm DOT sk> - Enhancement for basic Slovak keyboard layout added. - See #1251 for more details. Modified: trunk/reactos/dll/keyboard/kbdsk/kbdsk.c Modified: trunk/reactos/dll/keyboard/kbdsk/kbdsk.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/keyboard/kbdsk/kbdsk.c…
============================================================================== --- trunk/reactos/dll/keyboard/kbdsk/kbdsk.c [iso-8859-1] (original) +++ trunk/reactos/dll/keyboard/kbdsk/kbdsk.c [iso-8859-1] Fri Jul 18 16:08:52 2008 @@ -401,6 +401,8 @@ { DEADTRANS(0x0075, 0x00b4, 0x00fa, 0x0000) }, // u with acute { DEADTRANS(0x0059, 0x00b4, 0x00dd, 0x0000) }, // Y with acute { DEADTRANS(0x0079, 0x00b4, 0x00fd, 0x0000) }, // y with acute + { DEADTRANS(0x005a, 0x00b4, 0x0179, 0x0000) }, // Z with acute + { DEADTRANS(0x007a, 0x00b4, 0x017a, 0x0000) }, // z with acute { DEADTRANS(0x0020, 0x00b4, 0x00b4, 0x0000) }, // space > acute { DEADTRANS(0x004f, 0x005e, 0x00d4, 0x0000) }, // O with circumflex
16 years, 5 months
1
0
0
0
← Newer
1
...
38
39
40
41
42
43
44
...
77
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
Results per page:
10
25
50
100
200