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
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
March 2009
----- 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
28 participants
483 discussions
Start a n
N
ew thread
[fireball] 39913: - Major cleanup of USB keyboard driver: * Remove huge hack, which is not needed anymore since 39912. * Put all global variables into device extension, allowing support for more than one USB keyboard. * Cleanup driver extension structure. * Remove unneeded endpoint finding code. - Add test code for LEDs support (now puts three of them into ON state).
by fireball@svn.reactos.org
Author: fireball Date: Mon Mar 9 13:04:40 2009 New Revision: 39913 URL:
http://svn.reactos.org/svn/reactos?rev=39913&view=rev
Log: - Major cleanup of USB keyboard driver: * Remove huge hack, which is not needed anymore since 39912. * Put all global variables into device extension, allowing support for more than one USB keyboard. * Cleanup driver extension structure. * Remove unneeded endpoint finding code. - Add test code for LEDs support (now puts three of them into ON state). Modified: trunk/reactos/drivers/usb/nt4compat/usbdriver/keyboard.c trunk/reactos/drivers/usb/nt4compat/usbdriver/keyboard.h Modified: trunk/reactos/drivers/usb/nt4compat/usbdriver/keyboard.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/usb/nt4compat/usbd…
============================================================================== --- trunk/reactos/drivers/usb/nt4compat/usbdriver/keyboard.c [iso-8859-1] (original) +++ trunk/reactos/drivers/usb/nt4compat/usbdriver/keyboard.c [iso-8859-1] Mon Mar 9 13:04:40 2009 @@ -9,11 +9,6 @@ #include "usbdriver.h" #include "kbdmou.h" -/* Data for embedded drivers */ -CONNECT_DATA KbdClassInformation; - -PDEVICE_OBJECT KeyboardFdo = NULL; - NTSTATUS AddRegistryEntry(IN PCWSTR PortTypeName, IN PUNICODE_STRING DeviceName, @@ -23,8 +18,9 @@ BOOLEAN kbd_disconnect(PUSB_DEV_MANAGER dev_mgr, DEV_HANDLE dev_handle); BOOLEAN kbd_stop(PUSB_DEV_MANAGER dev_mgr, DEV_HANDLE dev_handle); VOID kbd_irq(PURB purb, PVOID pcontext); +VOID kbd_led(PURB purb, PVOID pcontext); static NTSTATUS -KeyboardCreateDevice(IN PDRIVER_OBJECT DriverObject); +KeyboardCreateDevice(IN PDRIVER_OBJECT DriverObject, IN PKEYBOARD_DRVR_EXTENSION DriverExtension); void * memscan(void * addr, int c, size_t size); static UCHAR usb_kbd_keycode[256] = @@ -47,6 +43,18 @@ 150,158,159,128,136,177,178,176,142,152,173,140 }; +/* This structure starts with the same layout as KEYBOARD_INDICATOR_TRANSLATION */ +typedef struct _LOCAL_KEYBOARD_INDICATOR_TRANSLATION { + USHORT NumberOfIndicatorKeys; + INDICATOR_LIST IndicatorList[3]; +} LOCAL_KEYBOARD_INDICATOR_TRANSLATION, *PLOCAL_KEYBOARD_INDICATOR_TRANSLATION; + +static LOCAL_KEYBOARD_INDICATOR_TRANSLATION IndicatorTranslation = { 3, { + {0x3A, KEYBOARD_CAPS_LOCK_ON}, + {0x45, KEYBOARD_NUM_LOCK_ON}, + {0x46, KEYBOARD_SCROLL_LOCK_ON}}}; + + BOOLEAN kbd_driver_init(PUSB_DEV_MANAGER dev_mgr, PUSB_DRIVER pdriver) { @@ -61,8 +69,8 @@ pdriver->driver_desc.product_id = 0xffff; // USB Product ID. pdriver->driver_desc.release_num = 0x100; // Release Number of Device - pdriver->driver_desc.config_val = 1; // Configuration Value - pdriver->driver_desc.if_num = 1; // Interface Number + pdriver->driver_desc.config_val = 0; // Configuration Value + pdriver->driver_desc.if_num = 0; // Interface Number pdriver->driver_desc.if_class = USB_CLASS_HID; // Interface Class pdriver->driver_desc.if_sub_class = 1; // Interface SubClass pdriver->driver_desc.if_protocol = 1; // Interface Protocol @@ -85,11 +93,8 @@ pdriver->disp_tbl.dev_stop = kbd_stop; pdriver->disp_tbl.dev_reserved = NULL; - // Zero out the class information structure - RtlZeroMemory(&KbdClassInformation, sizeof(CONNECT_DATA)); - // Create the device - KeyboardCreateDevice(dev_mgr->usb_driver_obj); + KeyboardCreateDevice(dev_mgr->usb_driver_obj, pdrvr_ext); usb_dbg_print(DBGLVL_MAXIMUM, ("kbd_driver_init(): keyboard driver is initialized\n")); return TRUE; @@ -123,102 +128,41 @@ PUSB_DRIVER pdrvr; PUSB_DEV pdev; PKEYBOARD_DRVR_EXTENSION pdev_ext; -// LONG i; PUSB_ENDPOINT_DESC pendp_desc = NULL; ULONG MaxPacketSize; + PUSB_CTRL_SETUP_PACKET psetup; usb_dbg_print(DBGLVL_MAXIMUM, ("kbd_connect(): entering...\n")); dev_mgr = param->dev_mgr; pdrvr = param->pdriver; pdev_ext = (PKEYBOARD_DRVR_EXTENSION)pdrvr->driver_ext; + pdev_ext->dev_handle = dev_handle; // Lock USB Device status = usb_query_and_lock_dev(dev_mgr, dev_handle, &pdev); if (status != STATUS_SUCCESS) { - //usb_free_mem(desc_buf); usb_dbg_print(DBGLVL_MEDIUM, ("kbd_connect(): unable to query&lock device, status=0x%x\n", status)); return FALSE; } - // Endpoint-finding code - if (param->if_desc) - { - // Get a pointer to the config packet from compdev - PUCHAR Buffer = (PUCHAR)param->if_desc; - ULONG Offset = 0; - BOOLEAN FoundEndpoint = FALSE; - - // Find our the only needed endpoint descriptor - while (Offset < 512) - { - pendp_desc = (PUSB_ENDPOINT_DESC)&Buffer[Offset]; - usb_dbg_print(DBGLVL_MAXIMUM, ("kbd_connect(): DescType=0x%x, Attrs=0x%x, Len=%d\n", - pendp_desc->bDescriptorType, pendp_desc->bmAttributes, pendp_desc->bLength)); - - if (pendp_desc->bDescriptorType == USB_DT_ENDPOINT && - pendp_desc->bLength == sizeof(USB_ENDPOINT_DESC)) - { - // Found it - FoundEndpoint = TRUE; - break; - } - - Offset += pendp_desc->bLength; - } - - if (!FoundEndpoint) - return FALSE; - - // FIXME: Check if it's INT endpoint - // (pendp_desc->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) == USB_ENDPOINT_XFER_INT) - - // endpoint must be IN - if ((pendp_desc->bEndpointAddress & USB_DIR_IN) == 0) - return FALSE; - - usb_dbg_print(DBGLVL_MAXIMUM, ("kbd_connect(): FoundEndpoint=%d\n", FoundEndpoint)); - } - - // Endpoint descriptor substitution code - { - ULONG if_idx, endp_idx; - PUSB_ENDPOINT pendp; - - //FoundEndpoint = FALSE; - for(if_idx = 0; if_idx < MAX_INTERFACES_PER_CONFIG /*pdev->usb_config->if_count*/; if_idx++) - { - for(endp_idx = 0; endp_idx < MAX_ENDPS_PER_IF /*pdev->usb_config->interf[if_idx].endp_count*/; endp_idx++) - { - pendp = &pdev->usb_config->interf[if_idx].endp[endp_idx]; - - if (pendp->pusb_endp_desc != NULL) - { - //HACKHACK: for some reason this usb driver chooses different and completely wrong - // endpoint. Since I don't have time to research this, I just find the - // endpoint descriptor myself and copy it - memcpy(pendp->pusb_endp_desc, pendp_desc, pendp_desc->bLength); - - usb_dbg_print(DBGLVL_MAXIMUM, ("kbd_connect(): [%i][%i] DescType=0x%x, Attrs=0x%x, Len=%d\n",if_idx, endp_idx, - pendp->pusb_endp_desc->bDescriptorType, pendp->pusb_endp_desc->bmAttributes, pendp->pusb_endp_desc->bLength)); - } - } - } - } + // Get pointer to the endpoint descriptor + pendp_desc = pdev->usb_config->interf[0].endp[0].pusb_endp_desc; + + // Store max packet size + MaxPacketSize = pendp_desc->wMaxPacketSize; + if (MaxPacketSize > 8) + MaxPacketSize = 8; // Unlock USB Device usb_unlock_dev(pdev); - // Send URB + // Send interrupt URB purb = usb_alloc_mem(NonPagedPool, sizeof(URB)); if (purb == NULL) return FALSE; RtlZeroMemory(purb, sizeof(URB)); - - MaxPacketSize = pendp_desc->wMaxPacketSize; - if (MaxPacketSize > 8) - MaxPacketSize = 8; RtlZeroMemory(pdev_ext->kbd_old, 8); @@ -228,7 +172,7 @@ (PUCHAR)&pdev_ext->kbd_data, MaxPacketSize, //use max packet size kbd_irq, - pdev_ext, + pdev_ext->device_ext, 0); // Call USB driver stack @@ -239,19 +183,54 @@ purb = NULL; } + // Set LEDs request + purb = usb_alloc_mem(NonPagedPool, sizeof(URB)); + if (purb == NULL) return FALSE; + RtlZeroMemory(purb, sizeof(URB)); + + pdev_ext->leds_old = 0; + pdev_ext->leds = 7; + + // Build a URB for setting LEDs + psetup = (PUSB_CTRL_SETUP_PACKET) (purb)->setup_packet; + urb_init((purb)); + + purb->endp_handle = usb_make_handle((dev_handle >> 16), 0, 0) | 0xffff; + purb->data_buffer = &pdev_ext->leds; + purb->data_length = 1; + purb->completion = NULL; + purb->context = NULL; + purb->reference = (LONG)pdrvr; + psetup->bmRequestType = USB_DT_HID; + psetup->bRequest = USB_REQ_SET_CONFIGURATION; + psetup->wValue = USB_DT_CONFIG << 8; + psetup->wIndex = param->if_desc->bInterfaceNumber; + psetup->wLength = 1; + + // Call USB driver stack + status = usb_submit_urb(pdev_ext->dev_mgr, purb); + if (status != STATUS_PENDING) + { + usb_free_mem(purb); + purb = NULL; + } + + usb_dbg_print(DBGLVL_MAXIMUM, ("kbd_connect(): leds urb status 0x%x, Interface number %d\n", + status, param->if_desc->bInterfaceNumber)); + return TRUE; } VOID kbd_irq(PURB purb, PVOID pcontext) { - KEYBOARD_INPUT_DATA KeyboardInputData[10]; + KEYBOARD_INPUT_DATA KeyboardInputData[20]; ULONG DataPrepared=0, DataConsumed, i; UCHAR ScanCode; NTSTATUS status; - PKEYBOARD_DRVR_EXTENSION pdev_ext = (PKEYBOARD_DRVR_EXTENSION)pcontext; - PUCHAR data = pdev_ext->kbd_data; - PUCHAR data_old = pdev_ext->kbd_old; + PKEYBOARD_DRVR_EXTENSION pdev_ext; + PKEYBOARD_DEVICE_EXTENSION DeviceExtension = (PKEYBOARD_DEVICE_EXTENSION)pcontext; + PUCHAR data, data_old; usb_dbg_print(DBGLVL_MAXIMUM, ("kbd_irq(): called\n")); ASSERT(purb); @@ -259,8 +238,12 @@ if (purb->status != STATUS_SUCCESS) { usb_dbg_print(DBGLVL_MAXIMUM, ("kbd_irq(): purb->status 0x%08X\n", purb->status)); - //return; - } + return; + } + + pdev_ext = DeviceExtension->DriverExtension; + data = pdev_ext->kbd_data; + data_old = pdev_ext->kbd_old; usb_dbg_print(DBGLVL_MAXIMUM, ("Kbd input: %d %d %d %d %d %d %d %d\n", data[0], data[1], data[2], data[3], data[4], data[5], data[6], data[7])); @@ -317,13 +300,13 @@ } // Commit the input data somewhere... - if (KbdClassInformation.ClassService && DataPrepared > 0) + if (DeviceExtension->ConnectData.ClassService && DataPrepared > 0) { KIRQL OldIrql; KeRaiseIrql(DISPATCH_LEVEL, &OldIrql); - (*(PSERVICE_CALLBACK_ROUTINE)KbdClassInformation.ClassService)( - KbdClassInformation.ClassDeviceObject, + (*(PSERVICE_CALLBACK_ROUTINE)DeviceExtension->ConnectData.ClassService)( + DeviceExtension->ConnectData.ClassDeviceObject, &KeyboardInputData[0], (&KeyboardInputData[0])+DataPrepared, &DataConsumed); @@ -376,59 +359,53 @@ return TRUE;//umss_delete_device(dev_mgr, pdrvr, dev_obj, FALSE); } +VOID +kbd_setleds(PKEYBOARD_DEVICE_EXTENSION DeviceExtension) +{ + //DPRINT("%x\n", DevExt->KeyboardIndicators.LedFlags); +} + // Dispatch routine for our IRPs NTSTATUS KbdDispatch(PDEVICE_OBJECT DeviceObject, PIRP Irp) { NTSTATUS Status = STATUS_INVALID_DEVICE_REQUEST; + PKEYBOARD_DEVICE_EXTENSION DeviceExtension; + + DeviceExtension = DeviceObject->DeviceExtension; usb_dbg_print(DBGLVL_MAXIMUM, ("KbdDispatch(DO %p, code 0x%lx) called\n", DeviceObject, IoGetCurrentIrpStackLocation(Irp)->Parameters.DeviceIoControl.IoControlCode)); - if (DeviceObject == KeyboardFdo) + if (DeviceObject == DeviceExtension->Fdo) { // it's keyboard's IOCTL - PIO_STACK_LOCATION Stk; + PIO_STACK_LOCATION Stack; Irp->IoStatus.Information = 0; - Stk = IoGetCurrentIrpStackLocation(Irp); - - switch (Stk->Parameters.DeviceIoControl.IoControlCode) + Stack = IoGetCurrentIrpStackLocation(Irp); + + switch (Stack->Parameters.DeviceIoControl.IoControlCode) { case IOCTL_INTERNAL_KEYBOARD_CONNECT: usb_dbg_print(DBGLVL_MAXIMUM, ("IOCTL_INTERNAL_KEYBOARD_CONNECT\n")); - if (Stk->Parameters.DeviceIoControl.InputBufferLength < sizeof(CONNECT_DATA)) { + if (Stack->Parameters.DeviceIoControl.InputBufferLength < sizeof(CONNECT_DATA)) { usb_dbg_print(DBGLVL_MAXIMUM, ("Keyboard IOCTL_INTERNAL_KEYBOARD_CONNECT " "invalid buffer size\n")); Irp->IoStatus.Status = STATUS_INVALID_PARAMETER; goto intcontfailure; } - RtlCopyMemory(&KbdClassInformation, - Stk->Parameters.DeviceIoControl.Type3InputBuffer, + RtlCopyMemory(&DeviceExtension->ConnectData, + Stack->Parameters.DeviceIoControl.Type3InputBuffer, sizeof(CONNECT_DATA)); - Irp->IoStatus.Status = STATUS_SUCCESS; - break; -#if 0 - case IOCTL_INTERNAL_I8042_KEYBOARD_WRITE_BUFFER: - usb_dbg_print(DBGLVL_MAXIMUM, ("IOCTL_INTERNAL_I8042_KEYBOARD_WRITE_BUFFER\n")); - if (Stk->Parameters.DeviceIoControl.InputBufferLength < 1) { - Irp->IoStatus.Status = STATUS_INVALID_PARAMETER; - goto intcontfailure; - } - /* if (!DevExt->KeyboardInterruptObject) { - Irp->IoStatus.Status = STATUS_DEVICE_NOT_READY; - goto intcontfailure; - }*/ - - Irp->IoStatus.Status = STATUS_SUCCESS; - break; -#endif + Status = STATUS_SUCCESS; + break; case IOCTL_KEYBOARD_QUERY_ATTRIBUTES: usb_dbg_print(DBGLVL_MAXIMUM, ("IOCTL_KEYBOARD_QUERY_ATTRIBUTES\n")); - if (Stk->Parameters.DeviceIoControl.OutputBufferLength < + if (Stack->Parameters.DeviceIoControl.OutputBufferLength < sizeof(KEYBOARD_ATTRIBUTES)) { usb_dbg_print(DBGLVL_MAXIMUM, ("Keyboard IOCTL_KEYBOARD_QUERY_ATTRIBUTES: " "invalid buffer size\n")); @@ -443,22 +420,23 @@ break; case IOCTL_KEYBOARD_QUERY_INDICATORS: usb_dbg_print(DBGLVL_MAXIMUM, ("IOCTL_KEYBOARD_QUERY_INDICATORS\n")); - if (Stk->Parameters.DeviceIoControl.OutputBufferLength < - sizeof(KEYBOARD_INDICATOR_PARAMETERS)) { - usb_dbg_print(DBGLVL_MAXIMUM, ("Keyboard IOCTL_KEYBOARD_QUERY_INDICATORS: " - "invalid buffer size\n")); - Irp->IoStatus.Status = STATUS_BUFFER_TOO_SMALL; - goto intcontfailure; - } - /*RtlCopyMemory(Irp->AssociatedIrp.SystemBuffer, - &DevExt->KeyboardIndicators, - sizeof(KEYBOARD_INDICATOR_PARAMETERS));*/ - - Irp->IoStatus.Status = STATUS_NOT_SUPPORTED; + if (Stack->Parameters.DeviceIoControl.InputBufferLength < sizeof(KEYBOARD_INDICATOR_PARAMETERS)) + { + Status = STATUS_BUFFER_TOO_SMALL; + } + else + { + RtlCopyMemory( + Irp->AssociatedIrp.SystemBuffer, + &DeviceExtension->KeyboardIndicators, + sizeof(KEYBOARD_INDICATOR_PARAMETERS)); + Irp->IoStatus.Information = sizeof(KEYBOARD_INDICATOR_PARAMETERS); + Status = STATUS_SUCCESS; + } break; case IOCTL_KEYBOARD_QUERY_TYPEMATIC: usb_dbg_print(DBGLVL_MAXIMUM, ("IOCTL_KEYBOARD_QUERY_TYPEMATIC\n")); - if (Stk->Parameters.DeviceIoControl.OutputBufferLength < + if (Stack->Parameters.DeviceIoControl.OutputBufferLength < sizeof(KEYBOARD_TYPEMATIC_PARAMETERS)) { usb_dbg_print(DBGLVL_MAXIMUM, ("Keyboard IOCTL_KEYBOARD_QUERY_TYPEMATIC: " "invalid buffer size\n")); @@ -469,11 +447,11 @@ &DevExt->KeyboardTypematic, sizeof(KEYBOARD_TYPEMATIC_PARAMETERS));*/ - Irp->IoStatus.Status = STATUS_SUCCESS; + Status = STATUS_SUCCESS; break; case IOCTL_KEYBOARD_SET_INDICATORS: usb_dbg_print(DBGLVL_MAXIMUM, ("IOCTL_KEYBOARD_SET_INDICATORS\n")); - if (Stk->Parameters.DeviceIoControl.InputBufferLength < + if (Stack->Parameters.DeviceIoControl.InputBufferLength < sizeof(KEYBOARD_INDICATOR_PARAMETERS)) { usb_dbg_print(DBGLVL_MAXIMUM, ("Keyboard IOCTL_KEYBOARD_SET_INDICTATORS: " "invalid buffer size\n")); @@ -481,17 +459,17 @@ goto intcontfailure; } - /*RtlCopyMemory(&DevExt->KeyboardIndicators, - Irp->AssociatedIrp.SystemBuffer, - sizeof(KEYBOARD_INDICATOR_PARAMETERS));*/ + RtlCopyMemory(&DeviceExtension->KeyboardIndicators, + Irp->AssociatedIrp.SystemBuffer, + sizeof(KEYBOARD_INDICATOR_PARAMETERS)); //DPRINT("%x\n", DevExt->KeyboardIndicators.LedFlags); - - Irp->IoStatus.Status = STATUS_SUCCESS; + kbd_setleds(DeviceExtension); + Status = STATUS_SUCCESS; break; case IOCTL_KEYBOARD_SET_TYPEMATIC: usb_dbg_print(DBGLVL_MAXIMUM, ("IOCTL_KEYBOARD_SET_TYPEMATIC\n")); - if (Stk->Parameters.DeviceIoControl.InputBufferLength < + if (Stack->Parameters.DeviceIoControl.InputBufferLength < sizeof(KEYBOARD_TYPEMATIC_PARAMETERS)) { usb_dbg_print(DBGLVL_MAXIMUM, ("Keyboard IOCTL_KEYBOARD_SET_TYPEMATIC " "invalid buffer size\n")); @@ -503,20 +481,25 @@ Irp->AssociatedIrp.SystemBuffer, sizeof(KEYBOARD_TYPEMATIC_PARAMETERS));*/ - Irp->IoStatus.Status = STATUS_SUCCESS; + Status = STATUS_SUCCESS; break; case IOCTL_KEYBOARD_QUERY_INDICATOR_TRANSLATION: - /* We should check the UnitID, but it's kind of pointless as - * all keyboards are supposed to have the same one - */ - /*RtlCopyMemory(Irp->AssociatedIrp.SystemBuffer, - &IndicatorTranslation, - sizeof(LOCAL_KEYBOARD_INDICATOR_TRANSLATION));*/ - - Irp->IoStatus.Status = STATUS_NOT_SUPPORTED; + if (Stack->Parameters.DeviceIoControl.OutputBufferLength < sizeof(LOCAL_KEYBOARD_INDICATOR_TRANSLATION)) + { + Status = STATUS_BUFFER_TOO_SMALL; + } + else + { + RtlCopyMemory( + Irp->AssociatedIrp.SystemBuffer, + &IndicatorTranslation, + sizeof(LOCAL_KEYBOARD_INDICATOR_TRANSLATION)); + Irp->IoStatus.Information = sizeof(LOCAL_KEYBOARD_INDICATOR_TRANSLATION); + Status = STATUS_SUCCESS; + } break; default: - Irp->IoStatus.Status = STATUS_SUCCESS;//STATUS_INVALID_DEVICE_REQUEST; + Status = STATUS_SUCCESS;//STATUS_INVALID_DEVICE_REQUEST; break; } intcontfailure: @@ -529,6 +512,7 @@ usb_dbg_print(DBGLVL_MINIMUM, ("Invalid internal device request!\n")); } + Irp->IoStatus.Status = Status; if (Status != STATUS_PENDING) IoCompleteRequest(Irp, IO_NO_INCREMENT); @@ -536,10 +520,10 @@ } static NTSTATUS -KeyboardCreateDevice(IN PDRIVER_OBJECT DriverObject) +KeyboardCreateDevice(IN PDRIVER_OBJECT DriverObject, IN PKEYBOARD_DRVR_EXTENSION DriverExtension) { UNICODE_STRING DeviceName = RTL_CONSTANT_STRING(L"\\Device\\KeyboardPortUSB"); - PDEVEXT_HEADER DeviceExtension; + PKEYBOARD_DEVICE_EXTENSION DeviceExtension; PDEVICE_OBJECT Fdo; NTSTATUS Status; @@ -551,7 +535,7 @@ } Status = IoCreateDevice(DriverObject, - sizeof(DEVEXT_HEADER), + sizeof(KEYBOARD_DEVICE_EXTENSION), &DeviceName, FILE_DEVICE_KEYBOARD, FILE_DEVICE_SECURE_OPEN, @@ -563,12 +547,14 @@ usb_dbg_print(DBGLVL_MINIMUM, ("IoCreateDevice() for usb keyboard driver failed with status 0x%08lx\n", Status)); return Status; } - DeviceExtension = (PDEVEXT_HEADER)Fdo->DeviceExtension; - RtlZeroMemory(DeviceExtension, sizeof(DEVEXT_HEADER)); - - DeviceExtension->dispatch = KbdDispatch; - - KeyboardFdo = Fdo; + DeviceExtension = (PKEYBOARD_DEVICE_EXTENSION)Fdo->DeviceExtension; + RtlZeroMemory(DeviceExtension, sizeof(KEYBOARD_DEVICE_EXTENSION)); + + DeviceExtension->hdr.dispatch = KbdDispatch; + DeviceExtension->DriverExtension = DriverExtension; + DriverExtension->device_ext = DeviceExtension; + + DeviceExtension->Fdo = Fdo; Fdo->Flags &= ~DO_DEVICE_INITIALIZING; usb_dbg_print(DBGLVL_MEDIUM, ("Created keyboard Fdo: %p\n", Fdo)); Modified: trunk/reactos/drivers/usb/nt4compat/usbdriver/keyboard.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/usb/nt4compat/usbd…
============================================================================== --- trunk/reactos/drivers/usb/nt4compat/usbdriver/keyboard.h [iso-8859-1] (original) +++ trunk/reactos/drivers/usb/nt4compat/usbdriver/keyboard.h [iso-8859-1] Mon Mar 9 13:04:40 2009 @@ -3,16 +3,19 @@ typedef struct _KEYBOARD_DRVR_EXTENSION { - //INTERRUPT_DATA_BLOCK idb; PUSB_INTERFACE_DESC pif_desc; - UCHAR if_idx, out_endp_idx, in_endp_idx, int_endp_idx; - PUSB_ENDPOINT_DESC pout_endp_desc, pin_endp_desc, pint_endp_desc; + DEV_HANDLE dev_handle; PUSB_DEV_MANAGER dev_mgr; + UCHAR kbd_data[8]; UCHAR kbd_old[8]; + + UCHAR leds; + UCHAR leds_old; + + struct _KEYBOARD_DEVICE_EXTENSION *device_ext; // back pointer } KEYBOARD_DRVR_EXTENSION, *PKEYBOARD_DRVR_EXTENSION; - BOOLEAN kbd_driver_init(PUSB_DEV_MANAGER dev_mgr, PUSB_DRIVER pdriver);
15 years, 9 months
1
0
0
0
[fireball] 39912: - Fix an incorrect assumption that endpoint descriptors must immediately follow an interface descriptor (there may be generic descriptors in between too, as it is for e.g. USB HID devices). Thanks to Michael Lotz from Haiku for his help with this issue. - Fix incorrect handling of alternate interface settings, which resulted in reading uninitialized memory.
by fireball@svn.reactos.org
Author: fireball Date: Mon Mar 9 12:40:43 2009 New Revision: 39912 URL:
http://svn.reactos.org/svn/reactos?rev=39912&view=rev
Log: - Fix an incorrect assumption that endpoint descriptors must immediately follow an interface descriptor (there may be generic descriptors in between too, as it is for e.g. USB HID devices). Thanks to Michael Lotz from Haiku for his help with this issue. - Fix incorrect handling of alternate interface settings, which resulted in reading uninitialized memory. Modified: trunk/reactos/drivers/usb/nt4compat/usbdriver/devmgr.c Modified: trunk/reactos/drivers/usb/nt4compat/usbdriver/devmgr.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/usb/nt4compat/usbd…
============================================================================== --- trunk/reactos/drivers/usb/nt4compat/usbdriver/devmgr.c [iso-8859-1] (original) +++ trunk/reactos/drivers/usb/nt4compat/usbdriver/devmgr.c [iso-8859-1] Mon Mar 9 12:40:43 2009 @@ -1200,6 +1200,7 @@ { LONG i; PUSB_ENDPOINT_DESC pendp_desc; + PBYTE pbuf; if (pcfg == NULL || pif == NULL || pif_desc == NULL) return FALSE; @@ -1218,11 +1219,23 @@ InitializeListHead(&pif->altif_list); pif->altif_count = 0; - pendp_desc = (PUSB_ENDPOINT_DESC) (&((PBYTE) pif_desc)[sizeof(USB_INTERFACE_DESC)]); - - for(i = 0; i < pif->endp_count; i++, pendp_desc++) - { - dev_mgr_build_usb_endp(pif, &pif->endp[i], pendp_desc); + pbuf = &((PBYTE) pif_desc)[sizeof(USB_INTERFACE_DESC)]; + + i = 0; + while (i < pif->endp_count) + { + pendp_desc = (PUSB_ENDPOINT_DESC)pbuf; + + // check if it's an endpoint descriptor + if (pendp_desc->bDescriptorType == USB_DT_ENDPOINT) + { + // add it + dev_mgr_build_usb_endp(pif, &pif->endp[i], pendp_desc); + i++; + } + + // skip to the next one + pbuf += pendp_desc->bLength; } } else @@ -1299,8 +1312,7 @@ } else { - i--; - pif = &pcfg->interf[i]; + pif = &pcfg->interf[i-1]; dev_mgr_build_usb_if(pcfg, pif, pif_desc, TRUE); } }
15 years, 9 months
1
0
0
0
[jmorlan] 39911: add ConPrintf and ConPrintfPaging prototypes to cmd.h
by jmorlan@svn.reactos.org
Author: jmorlan Date: Sun Mar 8 22:21:07 2009 New Revision: 39911 URL:
http://svn.reactos.org/svn/reactos?rev=39911&view=rev
Log: add ConPrintf and ConPrintfPaging prototypes to cmd.h Modified: trunk/reactos/base/shell/cmd/cmd.h Modified: trunk/reactos/base/shell/cmd/cmd.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/cmd/cmd.h?rev=3…
============================================================================== --- trunk/reactos/base/shell/cmd/cmd.h [iso-8859-1] (original) +++ trunk/reactos/base/shell/cmd/cmd.h [iso-8859-1] Sun Mar 8 22:21:07 2009 @@ -150,6 +150,8 @@ VOID ConOutChar (TCHAR); VOID ConOutPuts (LPTSTR); +VOID ConPrintf(LPTSTR, va_list, DWORD); +INT ConPrintfPaging(BOOL NewPage, LPTSTR, va_list, DWORD); VOID ConOutPrintf (LPTSTR, ...); INT ConOutPrintfPaging (BOOL NewPage, LPTSTR, ...); VOID ConErrChar (TCHAR);
15 years, 9 months
1
0
0
0
[jmorlan] 39910: - Clean up code for DIR command - Fix bug where "DIR directoryname /S" wouldn't list subdirectories (you needed to do directoryname\*.*) - Get rid of extra * that appeared in DIR /B /S output
by jmorlan@svn.reactos.org
Author: jmorlan Date: Sun Mar 8 20:37:11 2009 New Revision: 39910 URL:
http://svn.reactos.org/svn/reactos?rev=39910&view=rev
Log: - Clean up code for DIR command - Fix bug where "DIR directoryname /S" wouldn't list subdirectories (you needed to do directoryname\*.*) - Get rid of extra * that appeared in DIR /B /S output Modified: trunk/reactos/base/shell/cmd/dir.c Modified: trunk/reactos/base/shell/cmd/dir.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/cmd/dir.c?rev=3…
============================================================================== --- trunk/reactos/base/shell/cmd/dir.c [iso-8859-1] (original) +++ trunk/reactos/base/shell/cmd/dir.c [iso-8859-1] Sun Mar 8 20:37:11 2009 @@ -565,6 +565,21 @@ return TRUE; } +/* Print either with or without paging, depending on /P switch */ +static INT +DirPrintf(LPDIRSWITCHFLAGS lpFlags, LPTSTR szFormat, ...) +{ + INT iReturn = 0; + va_list arg_ptr; + va_start(arg_ptr, szFormat); + if (lpFlags->bPause) + iReturn = ConPrintfPaging(FALSE, szFormat, arg_ptr, STD_OUTPUT_HANDLE); + else + ConPrintf(szFormat, arg_ptr, STD_OUTPUT_HANDLE); + va_end(arg_ptr); + return iReturn; +} + /* * PrintDirectoryHeader @@ -605,77 +620,21 @@ if (szVolName[0] != _T('\0')) { LoadString(CMD_ModuleHandle, STRING_DIR_HELP2, szMsg, RC_STRING_MAX_SIZE); - //needs to have first paramter as TRUE because - //this is the first output and need to clear the static - if(lpFlags->bPause) - ConOutPrintfPaging(TRUE,szMsg, szRootName[0], szVolName); - else - ConOutPrintf(szMsg, szRootName[0], szVolName); - + DirPrintf(lpFlags, szMsg, szRootName[0], szVolName); } else { LoadString(CMD_ModuleHandle, STRING_DIR_HELP3, szMsg, RC_STRING_MAX_SIZE); - if(lpFlags->bPause) - ConOutPrintfPaging(TRUE,szMsg, szRootName[0]); - else - ConOutPrintf(szMsg, szRootName[0]); + DirPrintf(lpFlags, szMsg, szRootName[0]); } /* print the volume serial number if the return was successful */ LoadString(CMD_ModuleHandle, STRING_DIR_HELP4, (LPTSTR) szMsg, RC_STRING_MAX_SIZE); - if(lpFlags->bPause) - ConOutPrintfPaging(FALSE,szMsg, - HIWORD(dwSerialNr), - LOWORD(dwSerialNr)); - else - ConOutPrintf(szMsg, - HIWORD(dwSerialNr), - LOWORD(dwSerialNr)); - + DirPrintf(lpFlags, szMsg, HIWORD(dwSerialNr), LOWORD(dwSerialNr)); return TRUE; } - -/* - * convert - * - * insert commas into a number - * - */ -#if 0 -static INT -ConvertULong (ULONG num, LPTSTR des, INT len) -{ - TCHAR temp[32]; - INT c = 0; - INT n = 0; - - if (num == 0) - { - des[0] = _T('0'); - des[1] = _T('\0'); - n = 1; - } - else - { - temp[31] = 0; - while (num > 0) - { - if (((c + 1) % (nNumberGroups + 1)) == 0) - temp[30 - c++] = cThousandSeparator; - temp[30 - c++] = (TCHAR)(num % 10) + _T('0'); - num /= 10; - } - - for (n = 0; n <= c; n++) - des[n] = temp[31 - c + n]; - } - - return n; -} -#endif static VOID DirPrintFileDateTime(TCHAR *lpDate, @@ -685,8 +644,6 @@ { FILETIME ft; SYSTEMTIME dt; - TCHAR szDate[30]; - TCHAR szTime[30]; WORD wYear; /* Select the right time field */ @@ -717,20 +674,20 @@ { case 0: /* mmddyy */ default: - _stprintf (szDate, _T("%02d%c%02d%c%0*d"), + _stprintf(lpDate, _T("%02d%c%02d%c%0*d"), dt.wMonth, cDateSeparator, dt.wDay, cDateSeparator, lpFlags->b4Digit?4:2, wYear); break; case 1: /* ddmmyy */ - _stprintf (szDate, _T("%02d%c%02d%c%0*d"), + _stprintf(lpDate, _T("%02d%c%02d%c%0*d"), dt.wDay, cDateSeparator, dt.wMonth, cDateSeparator,lpFlags->b4Digit?4:2, wYear); break; case 2: /* yymmdd */ - _stprintf (szDate, _T("%0*d%c%02d%c%02d"), + _stprintf(lpDate, _T("%0*d%c%02d%c%02d"), lpFlags->b4Digit?4:2, wYear, cDateSeparator, dt.wMonth, cDateSeparator, dt.wDay); break; @@ -740,20 +697,17 @@ { case 0: /* 12 hour format */ default: - _stprintf (szTime,_T("%02d%c%02u%c"), + _stprintf(lpTime,_T("%02d%c%02u%c"), (dt.wHour == 0 ? 12 : (dt.wHour <= 12 ? dt.wHour : dt.wHour - 12)), cTimeSeparator, dt.wMinute, (dt.wHour <= 11 ? _T('a') : _T('p'))); break; case 1: /* 24 hour format */ - _stprintf (szTime, _T("%02d%c%02u"), + _stprintf(lpTime, _T("%02d%c%02u"), dt.wHour, cTimeSeparator, dt.wMinute); break; } - /* Copy results */ - _tcscpy(lpDate, szDate); - _tcscpy(lpTime, szTime); } @@ -771,7 +725,7 @@ lpFreeSpace->QuadPart = 0; - hInstance = LoadLibrary(_T("KERNEL32")); + hInstance = GetModuleHandle(_T("KERNEL32")); if (hInstance != NULL) { pGetFreeDiskSpaceEx = (PGETFREEDISKSPACEEX)GetProcAddress(hInstance, @@ -785,7 +739,6 @@ if (pGetFreeDiskSpaceEx(lpRoot, lpFreeSpace, &TotalNumberOfBytes, &TotalNumberOfFreeBytes) == TRUE) return; } - FreeLibrary(hInstance); } GetDiskFreeSpace(lpRoot, @@ -837,10 +790,7 @@ { ConvertULargeInteger(u64Bytes, szBuffer, sizeof(szBuffer), lpFlags->bTSeperator); LoadString(CMD_ModuleHandle, STRING_DIR_HELP5, szMsg, RC_STRING_MAX_SIZE); - if(lpFlags->bPause) - ConOutPrintfPaging(FALSE,szMsg,ulFiles, szBuffer); - else - ConOutPrintf(szMsg,ulFiles, szBuffer); + DirPrintf(lpFlags, szMsg, ulFiles, szBuffer); } else { @@ -849,22 +799,16 @@ If we are not in bare format and if we have results! */ ConvertULargeInteger(u64Bytes, szBuffer, 20, lpFlags->bTSeperator); LoadString(CMD_ModuleHandle, STRING_DIR_HELP8, szMsg, RC_STRING_MAX_SIZE); - if(lpFlags->bPause) - ConOutPrintfPaging(FALSE,szMsg,ulFiles, szBuffer); - else - ConOutPrintf(szMsg,ulFiles, szBuffer); + DirPrintf(lpFlags, szMsg, ulFiles, szBuffer); } /* Print total directories and freespace */ - if (!lpFlags->bRecursive || (TotalSummary && lpFlags->bRecursive)) + if (!lpFlags->bRecursive || TotalSummary) { GetUserDiskFreeSpace(szPath, &uliFree); ConvertULargeInteger(uliFree, szBuffer, sizeof(szBuffer), lpFlags->bTSeperator); LoadString(CMD_ModuleHandle, STRING_DIR_HELP6, (LPTSTR) szMsg, RC_STRING_MAX_SIZE); - if(lpFlags->bPause) - ConOutPrintfPaging(FALSE,szMsg,ulDirs, szBuffer); - else - ConOutPrintf(szMsg,ulDirs, szBuffer); + DirPrintf(lpFlags, szMsg, ulDirs, szBuffer); } return 0; @@ -967,19 +911,7 @@ DirPrintFileDateTime(szDate, szTime, ptrFiles[i], lpFlags); /* Print the line */ - if(lpFlags->bPause) - { - if (ConOutPrintfPaging(FALSE,_T("%10s %-6s %*s%s %s\n"), - szDate, - szTime, - iSizeFormat, - szSize, - szShortName, - ptrFiles[i]->cFileName) == 1) - return ; - } - else - ConOutPrintf(_T("%10s %-6s %*s%s %s\n"), + DirPrintf(lpFlags, _T("%10s %-6s %*s%s %s\n"), szDate, szTime, iSizeFormat, @@ -1065,17 +997,11 @@ else _stprintf(szTempFname, _T("%s"), ptrFiles[temp]->cFileName); - if(lpFlags->bPause) - ConOutPrintfPaging(FALSE,_T("%-*s"), iLongestName + 1 , szTempFname); - else - ConOutPrintf(_T("%-*s"), iLongestName + 1 , szTempFname); + DirPrintf(lpFlags, _T("%-*s"), iLongestName + 1, szTempFname); } /* Add a new line after the last item in the column */ - if(lpFlags->bPause) - ConOutPrintfPaging(FALSE,_T("\n")); - else - ConOutPrintf(_T("\n")); + DirPrintf(lpFlags, _T("\n")); } } @@ -1135,21 +1061,7 @@ DirPrintFileDateTime(szDate,szTime,ptrFiles[i],lpFlags); /* Print the line */ - if(lpFlags->bPause) - { - if (ConOutPrintfPaging(FALSE,_T("%-8s %-3s %*s %s %s\n"), - szName, /* The file's 8.3 name */ - szExt, /* The file's 8.3 extension */ - iSizeFormat, /* print format for size column */ - szSize, /* The size of file or "<DIR>" for dirs */ - szDate, /* The date of file/dir */ - szTime) == 1) /* The time of file/dir */ - { - return ; - } - } - else - ConOutPrintf(_T("%-8s %-3s %*s %s %s\n"), + DirPrintf(lpFlags, _T("%-8s %-3s %*s %s %s\n"), szName, /* The file's 8.3 name */ szExt, /* The file's 8.3 extension */ iSizeFormat, /* print format for size column */ @@ -1170,7 +1082,6 @@ LPTSTR lpCurPath, /* [IN] Full path of current directory */ LPDIRSWITCHFLAGS lpFlags) /* [IN] The flags used */ { - TCHAR szFullName[MAX_PATH]; DWORD i; for (i = 0; i < dwCount && !bCtrlBreak; i++) @@ -1184,30 +1095,12 @@ if (lpFlags->bRecursive) { /* at recursive mode we print full path of file */ - _tcscpy(szFullName, lpCurPath); - _tcscat(szFullName, ptrFiles[i]->cFileName); - if(lpFlags->bPause) - { - if (ConOutPrintfPaging(FALSE,_T("%s\n"), szFullName) == 1) - { - return ; - } - } - else - ConOutPrintf(_T("%s\n"), szFullName); + DirPrintf(lpFlags, _T("%s\\%s\n"), lpCurPath, ptrFiles[i]->cFileName); } else { /* if we are not in recursive mode we print the file names */ - if(lpFlags->bPause) - { - if (ConOutPrintfPaging(FALSE,_T("%s\n"),ptrFiles[i]->cFileName) == 1) - { - return ; - } - } - else - ConOutPrintf(_T("%s\n"),ptrFiles[i]->cFileName); + DirPrintf(lpFlags, _T("%s\n"), ptrFiles[i]->cFileName); } } } @@ -1226,35 +1119,11 @@ { TCHAR szMsg[RC_STRING_MAX_SIZE]; TCHAR szTemp[MAX_PATH]; /* A buffer to format the directory header */ - LPTSTR pszFilePart; - SIZE_T len; - - /* We cut the trailing \ of the full path, unless the path is a drive */ - if (GetFullPathName(szCurPath, sizeof(szTemp) / sizeof(TCHAR), szTemp, &pszFilePart) == 0) - { - pszFilePart = NULL; - _tcscpy(szTemp, szCurPath); - } - else if (pszFilePart != NULL) - *pszFilePart = _T('\0'); - else - { - len = _tcslen(szTemp); - if (len > 0 && szTemp[len - 1] != _T('\\') && - GetFileAttributes(szTemp) == INVALID_FILE_ATTRIBUTES && - GetLastError() == ERROR_PATH_NOT_FOUND) - { - /* Special case for some fake dos devices, such as con: - GetFullPathName doesn't return a pszFilePart pointer - so we're going to fix this ourselves */ - while (len > 0 && szTemp[len - 1] != _T('\\')) - szTemp[--len] = _T('\0'); - } - } - - len = _tcslen(szTemp); - if ((len != 3 || szTemp[len - 2] != _T(':')) && szTemp[len - 1] == _T('\\')) - szTemp[len-1] = _T('\0'); + + /* Print trailing backslash for root directory of drive */ + _tcscpy(szTemp, szCurPath); + if (_tcslen(szTemp) == 2 && szTemp[1] == _T(':')) + _tcscat(szTemp, _T("\\")); /* Condition to print header: We are not printing in bare format @@ -1262,15 +1131,8 @@ if (!(lpFlags->bBareFormat ) && !((lpFlags->bRecursive) && (dwCount <= 0))) { LoadString(CMD_ModuleHandle, STRING_DIR_HELP7, szMsg, RC_STRING_MAX_SIZE); - if(lpFlags->bPause) - { - if (ConOutPrintfPaging(FALSE,szMsg, szTemp) == 1) - { - return ; - } - } - else - ConOutPrintf(szMsg, szTemp); + if (DirPrintf(lpFlags, szMsg, szTemp)) + return; } if (lpFlags->bBareFormat) @@ -1400,10 +1262,7 @@ } /* Translate the value of iComp to boolean */ - if (iComp > 0) - return TRUE; - else - return FALSE; + return iComp > 0; } /* @@ -1491,18 +1350,17 @@ if (GetFullPathName(szPath, sizeof(szFullPath) / sizeof(TCHAR), szFullPath, &pszFilePart) == 0) { _tcscpy (szFullPath, szPath); - if (szFullPath[_tcslen(szFullPath) - 1] != _T('\\')) - _tcscat (szFullPath, _T("\\")); pszFilePart = NULL; } /* If no wildcard or file was specified and this is a directory, then display all files in it */ - wfdFileInfo.dwFileAttributes = GetFileAttributes(szFullPath); - if (wfdFileInfo.dwFileAttributes != INVALID_FILE_ATTRIBUTES && - (wfdFileInfo.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) - { - _tcscat(szFullPath, _T("\\*")); + if (pszFilePart == NULL || IsExistingDirectory(szFullPath)) + { + pszFilePart = &szFullPath[_tcslen(szFullPath)]; + if (pszFilePart[-1] != _T('\\')) + *pszFilePart++ = _T('\\'); + _tcscpy(pszFilePart, _T("*")); } /* Prepare the linked list, first node is allocated */ @@ -1520,9 +1378,9 @@ /* Collect the results for the current folder */ hSearch = FindFirstFile(szFullPath, &wfdFileInfo); - do - { - if (hSearch != INVALID_HANDLE_VALUE) + if (hSearch != INVALID_HANDLE_VALUE) + { + do { /*If retrieved FileName has extension,and szPath doesnt have extension then JUMP the retrieved FileName*/ if(_tcschr(wfdFileInfo.cFileName,_T('.'))&&(fPoint==TRUE)) @@ -1543,6 +1401,7 @@ ptrStartNode = ptrNextNode; dwCount --; } + FindClose(hSearch); return 1; } @@ -1582,9 +1441,9 @@ } } } - } - } while(FindNextFile(hSearch, &wfdFileInfo)); - FindClose(hSearch); + } while (FindNextFile(hSearch, &wfdFileInfo)); + FindClose(hSearch); + } /* Terminate list */ ptrNextNode->ptrNext = NULL; @@ -1622,7 +1481,9 @@ QsortFiles(ptrFileArray, 0, dwCount-1, lpFlags); /* Print Data */ + pszFilePart[-1] = _T('\0'); /* truncate to directory name only */ DirPrintFiles(ptrFileArray, dwCount, szFullPath, lpFlags); + pszFilePart[-1] = _T('\\'); if (lpFlags->bRecursive) { @@ -1660,20 +1521,13 @@ if (lpFlags->bRecursive) { /* The new search is involving any *.* file */ - if (pszFilePart != NULL) - { - memcpy(szSubPath, szFullPath, (pszFilePart - szFullPath) * sizeof(TCHAR)); - szSubPath[pszFilePart - szFullPath] = _T('\0'); - } - else - _tcscpy(szSubPath, szFullPath); - - _tcscat(szSubPath, _T("*.*")); + memcpy(szSubPath, szFullPath, (pszFilePart - szFullPath) * sizeof(TCHAR)); + _tcscpy(&szSubPath[pszFilePart - szFullPath], _T("*.*")); hRecSearch = FindFirstFile (szSubPath, &wfdFileInfo); - do - { - if (hRecSearch != INVALID_HANDLE_VALUE) + if (hRecSearch != INVALID_HANDLE_VALUE) + { + do { /* We search for directories other than "." and ".." */ if ((_tcsicmp(wfdFileInfo.cFileName, _T(".")) != 0) && @@ -1681,27 +1535,20 @@ (wfdFileInfo.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) { /* Concat the path and the directory to do recursive */ - if (pszFilePart != NULL) - { - memcpy(szSubPath, szFullPath, (pszFilePart - szFullPath) * sizeof(TCHAR)); - szSubPath[pszFilePart - szFullPath] = _T('\0'); - } - else - _tcscpy(szSubPath, szFullPath); - - _tcscat(szSubPath, wfdFileInfo.cFileName); + memcpy(szSubPath, szFullPath, (pszFilePart - szFullPath) * sizeof(TCHAR)); + _tcscpy(&szSubPath[pszFilePart - szFullPath], wfdFileInfo.cFileName); _tcscat(szSubPath, _T("\\")); - if (pszFilePart != NULL) - _tcscat(szSubPath, pszFilePart); + _tcscat(szSubPath, pszFilePart); /* We do the same for the folder */ if (DirList(szSubPath, lpFlags) != 0) { + FindClose(hRecSearch); return 1; } } - } - }while(FindNextFile(hRecSearch,&wfdFileInfo)); + } while(FindNextFile(hRecSearch, &wfdFileInfo)); + } FindClose(hRecSearch); } @@ -1776,6 +1623,10 @@ prev_volume[0] = _T('\0'); + /* Reset paging state */ + if (stFlags.bPause) + ConOutPrintfPaging(TRUE, _T("")); + for(loop = 0; loop < (UINT)entries; loop++) { if (CheckCtrlBreak(BREAK_INPUT))
15 years, 9 months
1
0
0
0
[dchapyshev] 39909: - Fix typo
by dchapyshev@svn.reactos.org
Author: dchapyshev Date: Sun Mar 8 20:35:12 2009 New Revision: 39909 URL:
http://svn.reactos.org/svn/reactos?rev=39909&view=rev
Log: - Fix typo Modified: trunk/reactos/base/applications/calc/lang/ru-RU.rc Modified: trunk/reactos/base/applications/calc/lang/ru-RU.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/calc/lan…
============================================================================== --- trunk/reactos/base/applications/calc/lang/ru-RU.rc [iso-8859-1] (original) +++ trunk/reactos/base/applications/calc/lang/ru-RU.rc [iso-8859-1] Sun Mar 8 20:35:12 2009 @@ -431,7 +431,7 @@ STRINGTABLE DISCARDABLE BEGIN - IDS_STRING_LICENSE "Êàëüêóëÿòîð ReactOS - ñâîáîäíîå ïðîãðàììíîå îáåñïåöåíèå, ðàñïðîñòðàíÿþùååñÿ ïî ëèöåíçèè GNU GPL.\r\n\r\nÂû ìîæåòå ïîëó÷èòü êîïèþ ëèöåíçèè GNU GPL
çäåñü:\r\nhttp://www.gnu.org/licenses/gpl.html\r\n\r\nÎçíàêîìèòüñÿ
c ïåðåâîäîì ëèöåíçèè GNU GPL ìîæíî
çäåñü:\r\nhttp://www.gnu.org/licenses/translations.html
" + IDS_STRING_LICENSE "Êàëüêóëÿòîð ReactOS - ñâîáîäíîå ïðîãðàììíîå îáåñïå÷åíèå, ðàñïðîñòðàíÿþùååñÿ ïî ëèöåíçèè GNU GPL.\r\n\r\nÂû ìîæåòå ïîëó÷èòü êîïèþ ëèöåíçèè GNU GPL
çäåñü:\r\nhttp://www.gnu.org/licenses/gpl.html\r\n\r\nÎçíàêîìèòüñÿ
c ïåðåâîäîì ëèöåíçèè GNU GPL ìîæíî
çäåñü:\r\nhttp://www.gnu.org/licenses/translations.html
" IDS_MATH_ERROR "Îøèáêà" IDS_QUICKHELP "Áûñòðàÿ ñïðàâêà" END
15 years, 9 months
1
0
0
0
[mkupfer] 39908: - continue "marletting" - use marlett font for checkbox
by mkupfer@svn.reactos.org
Author: mkupfer Date: Sun Mar 8 19:32:35 2009 New Revision: 39908 URL:
http://svn.reactos.org/svn/reactos?rev=39908&view=rev
Log: - continue "marletting" - use marlett font for checkbox Modified: trunk/reactos/dll/win32/user32/windows/draw.c Modified: trunk/reactos/dll/win32/user32/windows/draw.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/windows/d…
============================================================================== --- trunk/reactos/dll/win32/user32/windows/draw.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/user32/windows/draw.c [iso-8859-1] Sun Mar 8 19:32:35 2009 @@ -690,52 +690,69 @@ return TRUE; } -/* Ported from WINE20020904 */ -/* Draw a check/3state button coming from DrawFrameControl() - * - * Does a pretty good job in emulating MS behavior. Some quirks are - * however there because MS uses a TrueType font (Marlett) to draw - * the buttons. - */ static BOOL UITOOLS95_DFC_ButtonCheck(HDC dc, LPRECT r, UINT uFlags) { - RECT myr, bar; - UINT flags = BF_RECT | BF_ADJUST; - UITOOLS_MakeSquareRect(r, &myr); - - if(uFlags & DFCS_FLAT) - flags |= BF_FLAT; - else if(uFlags & DFCS_MONO) - flags |= BF_MONO; - - IntDrawRectEdge( dc, &myr, EDGE_SUNKEN, flags ); - - if(uFlags & (DFCS_INACTIVE|DFCS_PUSHED)) - FillRect(dc, &myr, GetSysColorBrush(COLOR_BTNFACE)); - else if( (uFlags & DFCS_BUTTON3STATE) && (uFlags & DFCS_CHECKED) ) - UITOOLS_DrawCheckedRect( dc, &myr ); + RECT rc; + LOGFONT lf; + HFONT hFont, hOldFont; + int SmallDiam, i; + + LPCTSTR OutRight = TEXT("c"); // Outer right + LPCTSTR OutLeft = TEXT("d"); // Outer left + LPCTSTR InRight = TEXT("e"); // inner left + LPCTSTR InLeft = TEXT("f"); // inner right + LPCTSTR Center = TEXT("g"); // center + + SmallDiam = UITOOLS_MakeSquareRect(r, &rc); + + ZeroMemory(&lf, sizeof(LOGFONT)); + lf.lfHeight = SmallDiam; + lf.lfWidth = 0; + lf.lfWeight = FW_NORMAL; + lf.lfCharSet = DEFAULT_CHARSET; + lstrcpy(lf.lfFaceName, TEXT("Marlett")); + hFont = CreateFontIndirect(&lf); + hOldFont = SelectObject(dc, hFont); + + SetBkMode(dc, TRANSPARENT); + + /* Center section, white for active, grey for inactive */ + i= !(uFlags & (DFCS_INACTIVE|DFCS_PUSHED)) ? COLOR_WINDOW : COLOR_BTNFACE; + SetTextColor(dc, GetSysColor(i)); + TextOut(dc, rc.left, rc.top, Center, 1); + + if(uFlags & (DFCS_FLAT | DFCS_MONO)) + { + SetTextColor(dc, GetSysColor(COLOR_WINDOWFRAME)); + TextOut(dc, rc.left, rc.top, OutRight, 1); + TextOut(dc, rc.left, rc.top, OutLeft, 1); + TextOut(dc, rc.left, rc.top, InRight, 1); + TextOut(dc, rc.left, rc.top, InLeft, 1); + } else { - FillRect(dc, &myr, GetSysColorBrush(COLOR_WINDOW)); + SetTextColor(dc, GetSysColor(COLOR_BTNSHADOW)); + TextOut(dc, rc.left, rc.top, OutRight, 1); + SetTextColor(dc, GetSysColor(COLOR_BTNHIGHLIGHT)); + TextOut(dc, rc.left, rc.top, OutLeft, 1); + SetTextColor(dc, GetSysColor(COLOR_3DDKSHADOW)); + TextOut(dc, rc.left, rc.top, InRight, 1); + SetTextColor(dc, GetSysColor(COLOR_3DLIGHT)); + TextOut(dc, rc.left, rc.top, InLeft, 1); } if(uFlags & DFCS_CHECKED) { - int i, k; - i = (uFlags & DFCS_INACTIVE) || (uFlags & 0xff) == DFCS_BUTTON3STATE ? - COLOR_BTNSHADOW : COLOR_WINDOWTEXT; - - /* draw 7 bars, with h=3w to form the check */ - bar.left = myr.left; - bar.top = myr.top + 2; - for (k = 0; k < 7; k++) { - bar.left = bar.left + 1; - bar.top = (k < 3) ? bar.top + 1 : bar.top - 1; - bar.bottom = bar.top + 3; - bar.right = bar.left + 1; - FillRect(dc, &bar, GetSysColorBrush(i)); - } - } + LPCTSTR Check = TEXT("b"); + + SetTextColor(dc, GetSysColor(COLOR_WINDOWTEXT)); + TextOut(dc, rc.left, rc.top, Check, 1); + } + + SetTextColor(dc, GetSysColor(COLOR_WINDOWTEXT)); + SelectObject(dc, hOldFont); + DeleteObject(hFont); + return TRUE; }
15 years, 9 months
1
0
0
0
[janderwald] 39907: - Wait for the APC in wdmaud.drv - Queue ~ one second of audio data before starting to stream - Check if an audio pin is already open and re-use it in that case
by janderwald@svn.reactos.org
Author: janderwald Date: Sun Mar 8 19:25:28 2009 New Revision: 39907 URL:
http://svn.reactos.org/svn/reactos?rev=39907&view=rev
Log: - Wait for the APC in wdmaud.drv - Queue ~ one second of audio data before starting to stream - Check if an audio pin is already open and re-use it in that case Modified: trunk/reactos/dll/win32/wdmaud.drv/wdmaud.c trunk/reactos/drivers/wdm/audio/backpln/portcls/interfaces.h trunk/reactos/drivers/wdm/audio/backpln/portcls/irpstream.c trunk/reactos/drivers/wdm/audio/backpln/portcls/pin_wavecyclic.c trunk/reactos/drivers/wdm/audio/legacy/wdmaud/control.c trunk/reactos/drivers/wdm/audio/sysaudio/control.c Modified: trunk/reactos/dll/win32/wdmaud.drv/wdmaud.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/wdmaud.drv/wdmau…
============================================================================== --- trunk/reactos/dll/win32/wdmaud.drv/wdmaud.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/wdmaud.drv/wdmaud.c [iso-8859-1] Sun Mar 8 19:25:28 2009 @@ -309,10 +309,8 @@ } else { - /* HACK - * The CompletionRoutine should be called by the system - */ - CompletionRoutine(0, Length, (LPOVERLAPPED)Overlap); + WaitForSingleObjectEx (KernelHandle, INFINITE, TRUE); + } return MMSYSERR_NOERROR; Modified: trunk/reactos/drivers/wdm/audio/backpln/portcls/interfaces.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/backpln/…
============================================================================== --- trunk/reactos/drivers/wdm/audio/backpln/portcls/interfaces.h [iso-8859-1] (original) +++ trunk/reactos/drivers/wdm/audio/backpln/portcls/interfaces.h [iso-8859-1] Sun Mar 8 19:25:28 2009 @@ -193,6 +193,7 @@ STDMETHOD_(NTSTATUS, Init)(THIS_ IN KSPIN_CONNECT *ConnectDetails, + IN PKSDATAFORMAT DataFormat, IN PDEVICE_OBJECT DeviceObject); STDMETHOD_(NTSTATUS, AddMapping)(THIS_ @@ -211,7 +212,7 @@ STDMETHOD_(ULONG, MinMappings)(THIS); - STDMETHOD_(ULONG, MaxMappings)(THIS); + STDMETHOD_(BOOL, MinimumDataAvailable)(THIS); }; Modified: trunk/reactos/drivers/wdm/audio/backpln/portcls/irpstream.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/backpln/…
============================================================================== --- trunk/reactos/drivers/wdm/audio/backpln/portcls/irpstream.c [iso-8859-1] (original) +++ trunk/reactos/drivers/wdm/audio/backpln/portcls/irpstream.c [iso-8859-1] Sun Mar 8 19:25:28 2009 @@ -18,8 +18,6 @@ struct _IRP_MAPPING_ * Next; }IRP_MAPPING, *PIRP_MAPPING; -#define MAX_MAPPING (100) - typedef struct { IIrpQueueVtbl *lpVtbl; @@ -27,9 +25,10 @@ LONG ref; ULONG CurrentOffset; - ULONG NextMapping; LONG NumMappings; - IN KSPIN_CONNECT *ConnectDetails; + ULONG NumDataAvailable; + KSPIN_CONNECT *ConnectDetails; + PKSDATAFORMAT_WAVEFORMATEX DataFormat; KDPC Dpc; PIRP_MAPPING FirstMap; @@ -38,7 +37,7 @@ ULONG DpcActive; PIRP_MAPPING FreeMapHead; PIRP_MAPPING FreeMapTail; - + ULONG FreeDataSize; LONG FreeCount; }IIrpQueueImpl; @@ -63,20 +62,27 @@ { NextMapping = CurMapping->Next; - CurMapping->Irp->IoStatus.Information = CurMapping->Header->DataUsed; - CurMapping->Irp->IoStatus.Status = STATUS_SUCCESS; - IoCompleteRequest(CurMapping->Irp, IO_SOUND_INCREMENT); + This->FreeDataSize -= CurMapping->Header->DataUsed; + + if (CurMapping->Irp) + { + CurMapping->Irp->IoStatus.Information = CurMapping->Header->DataUsed; + CurMapping->Irp->IoStatus.Status = STATUS_SUCCESS; + IoCompleteRequest(CurMapping->Irp, IO_SOUND_INCREMENT); + } ExFreePool(CurMapping->Header->Data); ExFreePool(CurMapping->Header); + ExFreePool(CurMapping); CurMapping = NextMapping; InterlockedDecrement(&This->FreeCount); + Count++; } This->DpcActive = FALSE; - DPRINT1("Freed %u Buffers / IRP\n", Count); + DPRINT1("Freed %u Buffers / IRP Available Mappings %u\n", Count, This->NumMappings); } @@ -132,11 +138,14 @@ IIrpQueue_fnInit( IN IIrpQueue *iface, IN KSPIN_CONNECT *ConnectDetails, + IN PKSDATAFORMAT DataFormat, IN PDEVICE_OBJECT DeviceObject) { IIrpQueueImpl * This = (IIrpQueueImpl*)iface; This->ConnectDetails = ConnectDetails; + This->DataFormat = (PKSDATAFORMAT_WAVEFORMATEX)DataFormat; + KeInitializeDpc(&This->Dpc, DpcRoutine, (PVOID)This); return STATUS_SUCCESS; @@ -161,6 +170,8 @@ Mapping->Irp = Irp; Mapping->Next = NULL; + DPRINT1("FirstMap %p LastMap %p NumMappings %u\n", This->FirstMap, This->LastMap, This->NumMappings); + if (!This->FirstMap) This->FirstMap = Mapping; else @@ -170,8 +181,16 @@ InterlockedIncrement(&This->NumMappings); - DPRINT1("IIrpQueue_fnAddMapping NumMappings %u SizeOfMapping %lu\n", This->NumMappings, Mapping->Header->DataUsed); - + if (Irp) + { + Irp->IoStatus.Status = STATUS_PENDING; + Irp->IoStatus.Information = 0; + IoMarkIrpPending(Irp); + } + + This->NumDataAvailable += Mapping->Header->DataUsed; + + DPRINT1("IIrpQueue_fnAddMapping NumMappings %u SizeOfMapping %lu NumDataAvailable %lu\n", This->NumMappings, Mapping->Header->DataUsed, This->NumDataAvailable); return STATUS_SUCCESS; } @@ -221,8 +240,13 @@ This->FreeMapTail = Mapping; Mapping->Next = NULL; - - if (This->FreeCount > iface->lpVtbl->MinMappings(iface) && This->DpcActive == FALSE) + This->FreeDataSize += Mapping->Header->DataUsed; + InterlockedDecrement(&This->NumMappings); + This->NumDataAvailable -= Mapping->Header->DataUsed; + + + if ((This->FreeDataSize > This->DataFormat->WaveFormatEx.nAvgBytesPerSec || This->FreeCount > 25) && + This->DpcActive == FALSE) { Mapping = This->FreeMapHead; This->FreeMapHead = NULL; @@ -245,19 +269,30 @@ ULONG NTAPI -IIrpQueue_fnMaxMappings( - IN IIrpQueue *iface) -{ - return MAX_MAPPING; -} - -ULONG -NTAPI IIrpQueue_fnMinMappings( IN IIrpQueue *iface) { - return MAX_MAPPING / 4; -} + return 25; +} + + +BOOL +NTAPI +IIrpQueue_fnMinimumDataAvailable( + IN IIrpQueue *iface) +{ + BOOL Result; + IIrpQueueImpl * This = (IIrpQueueImpl*)iface; + + if (This->DataFormat->WaveFormatEx.nAvgBytesPerSec < This->NumDataAvailable) + Result = TRUE; + else + Result = FALSE; + + return Result; +} + + static IIrpQueueVtbl vt_IIrpQueue = { @@ -270,7 +305,7 @@ IIrpQueue_fnUpdateMapping, IIrpQueue_fnNumMappings, IIrpQueue_fnMinMappings, - IIrpQueue_fnMaxMappings + IIrpQueue_fnMinimumDataAvailable }; Modified: trunk/reactos/drivers/wdm/audio/backpln/portcls/pin_wavecyclic.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/backpln/…
============================================================================== --- trunk/reactos/drivers/wdm/audio/backpln/portcls/pin_wavecyclic.c [iso-8859-1] (original) +++ trunk/reactos/drivers/wdm/audio/backpln/portcls/pin_wavecyclic.c [iso-8859-1] Sun Mar 8 19:25:28 2009 @@ -27,6 +27,7 @@ ULONG ActiveIrpOffset; ULONG DelayedRequestInProgress; ULONG RetryCount; + ULONG FrameSize; }IPortPinWaveCyclicImpl; @@ -172,16 +173,16 @@ IPortPinWaveCyclicImpl * This = (IPortPinWaveCyclicImpl*)CONTAINING_RECORD(iface, IPortPinWaveCyclicImpl, lpVtblServiceSink); - Status = This->IrpQueue->lpVtbl->GetMapping(This->IrpQueue, &Buffer, &BufferSize); if (!NT_SUCCESS(Status)) { This->RetryCount++; if (This->RetryCount > 30) { - DPRINT1("Stopping\n"); + DPRINT1("Stopping %u\n", This->IrpQueue->lpVtbl->NumMappings(This->IrpQueue)); This->Stream->lpVtbl->SetState(This->Stream, KSSTATE_STOP); This->RetryCount = 0; + This->State = KSSTATE_STOP; return; } DPRINT("IServiceSink_fnRequestService> Waiting for mapping\n"); @@ -380,7 +381,10 @@ if (This->Stream) { - Status = This->Stream->lpVtbl->SetFormat(This->Stream, DataFormat); + This->Stream->lpVtbl->SetState(This->Stream, KSSTATE_STOP); + This->State = KSSTATE_STOP; + + Status = This->Stream->lpVtbl->SetFormat(This->Stream, NewDataFormat); if (NT_SUCCESS(Status)) { if (This->Format) @@ -646,25 +650,44 @@ { NTSTATUS Status; PCONTEXT_WRITE Packet; + PIRP Irp; IPortPinWaveCyclicImpl * This = (IPortPinWaveCyclicImpl*)iface; DPRINT1("IPortPinWaveCyclic_fnFastWrite entered\n"); Packet = (PCONTEXT_WRITE)Buffer; - - Status = This->IrpQueue->lpVtbl->AddMapping(This->IrpQueue, Buffer, Length, Packet->Irp); + //if (This->IrpQueue->lpVtbl->MinimumDataAvailable(This->IrpQueue)) + // Irp = Packet->Irp; + //else + Irp = NULL; + + Status = This->IrpQueue->lpVtbl->AddMapping(This->IrpQueue, Buffer, Length, Irp); if (!NT_SUCCESS(Status)) return FALSE; - if ((This->IrpQueue->lpVtbl->NumMappings(This->IrpQueue) > This->IrpQueue->lpVtbl->MinMappings(This->IrpQueue)) && - This->State != KSSTATE_RUN) + if (This->IrpQueue->lpVtbl->MinimumDataAvailable(This->IrpQueue) == TRUE && This->State != KSSTATE_RUN) { /* some should initiate a state request but didnt do it */ DPRINT1("Starting stream with %lu mappings\n", This->IrpQueue->lpVtbl->NumMappings(This->IrpQueue)); + This->Stream->lpVtbl->SetState(This->Stream, KSSTATE_RUN); This->State = KSSTATE_RUN; + } + + if (!Irp) + { + DPRINT1("Completing Irp %p\n", Packet->Irp); + + Packet->Irp->IoStatus.Status = STATUS_SUCCESS; + Packet->Irp->IoStatus.Information = Packet->Header.DataUsed; + IoCompleteRequest(Packet->Irp, IO_SOUND_INCREMENT); + StatusBlock->Status = STATUS_SUCCESS; + } + else + { + StatusBlock->Status = STATUS_PENDING; } return TRUE; @@ -697,22 +720,21 @@ DeviceObject = GetDeviceObject(Port); + DataFormat = (PKSDATAFORMAT)(ConnectDetails + 1); + + DPRINT("IPortPinWaveCyclic_fnInit entered\n"); + + This->Format = ExAllocatePoolWithTag(NonPagedPool, DataFormat->FormatSize, TAG_PORTCLASS); + if (!This->Format) + return STATUS_INSUFFICIENT_RESOURCES; + + RtlMoveMemory(This->Format, DataFormat, DataFormat->FormatSize); Status = NewIrpQueue(&This->IrpQueue); if (!NT_SUCCESS(Status)) return Status; - Status = This->IrpQueue->lpVtbl->Init(This->IrpQueue, ConnectDetails, DeviceObject); - - DataFormat = (PKSDATAFORMAT)(ConnectDetails + 1); - - DPRINT("IPortPinWaveCyclic_fnInit entered\n"); - - This->Format = ExAllocatePoolWithTag(NonPagedPool, DataFormat->FormatSize, TAG_PORTCLASS); - if (!This->Format) - return STATUS_INSUFFICIENT_RESOURCES; - - RtlMoveMemory(This->Format, DataFormat, DataFormat->FormatSize); + Status = This->IrpQueue->lpVtbl->Init(This->IrpQueue, ConnectDetails, DataFormat, DeviceObject); Status = This->Miniport->lpVtbl->NewStream(This->Miniport, &This->Stream, @@ -729,7 +751,7 @@ if (!NT_SUCCESS(Status)) return Status; - Status = This->ServiceGroup->lpVtbl->AddMember(This->ServiceGroup, + Status = This->ServiceGroup->lpVtbl->AddMember(This->ServiceGroup, (PSERVICESINK)&This->lpVtblServiceSink); if (!NT_SUCCESS(Status)) { @@ -742,6 +764,8 @@ This->CommonBufferOffset = 0; This->CommonBufferSize = This->DmaChannel->lpVtbl->AllocatedBufferSize(This->DmaChannel); This->CommonBuffer = This->DmaChannel->lpVtbl->SystemAddress(This->DmaChannel); + + //Status = This->Stream->lpVtbl->SetNotificationFreq(This->Stream, 10, &This->FrameSize); return STATUS_SUCCESS; Modified: trunk/reactos/drivers/wdm/audio/legacy/wdmaud/control.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/legacy/w…
============================================================================== --- trunk/reactos/drivers/wdm/audio/legacy/wdmaud/control.c [iso-8859-1] (original) +++ trunk/reactos/drivers/wdm/audio/legacy/wdmaud/control.c [iso-8859-1] Sun Mar 8 19:25:28 2009 @@ -733,10 +733,8 @@ KsStreamIo(FileObject, NULL, NULL, NULL, NULL, 0, &IoStatusBlock, Packet, sizeof(CONTEXT_WRITE), KSSTREAM_WRITE, KernelMode); - Irp->IoStatus.Status = STATUS_PENDING; - Irp->IoStatus.Information = 0; - IoMarkIrpPending(Irp); - return STATUS_PENDING; + + return IoStatusBlock.Status; //return SetIrpIoStatus(Irp, STATUS_SUCCESS, 0); } Modified: trunk/reactos/drivers/wdm/audio/sysaudio/control.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/sysaudio…
============================================================================== --- trunk/reactos/drivers/wdm/audio/sysaudio/control.c [iso-8859-1] (original) +++ trunk/reactos/drivers/wdm/audio/sysaudio/control.c [iso-8859-1] Sun Mar 8 19:25:28 2009 @@ -299,7 +299,7 @@ else { AudioClient->Devs[AudioClient->NumDevices -1].ClientHandles[NumHandels].bHandle = FALSE; - AudioClient->Devs[AudioClient->NumDevices -1].ClientHandles[NumHandels].hPin = NULL; + AudioClient->Devs[AudioClient->NumDevices -1].ClientHandles[NumHandels].hPin = VirtualPinHandle; AudioClient->Devs[AudioClient->NumDevices -1].ClientHandles[NumHandels].PinId = WorkerContext->PinConnect->PinId; } @@ -410,6 +410,43 @@ return SetIrpIoStatus(Irp, Status, BytesReturned); } } + +NTSTATUS +SetPinFormat( + PKSAUDIO_DEVICE_ENTRY Entry, + KSPIN_CONNECT * PinConnect, + ULONG Length) +{ + KSP_PIN PinRequest; + PFILE_OBJECT FileObject; + ULONG BytesReturned; + NTSTATUS Status; + + /* re-using pin */ + PinRequest.Property.Set = KSPROPSETID_Connection; + PinRequest.Property.Flags = KSPROPERTY_TYPE_SET; + PinRequest.Property.Id = KSPROPERTY_CONNECTION_DATAFORMAT; + PinRequest.PinId = PinConnect->PinId; + + /* get pin file object */ + Status = ObReferenceObjectByHandle(Entry->Pins[PinConnect->PinId].PinHandle, + GENERIC_READ | GENERIC_WRITE, + IoFileObjectType, KernelMode, (PVOID*)&FileObject, NULL); + + if (!NT_SUCCESS(Status)) + { + DPRINT1("Failed to get pin file object with %x\n", Status); + return Status; + } + + Length -= sizeof(KSPIN_CONNECT) + sizeof(SYSAUDIO_INSTANCE_INFO); + Status = KsSynchronousIoControlDevice(FileObject, KernelMode, IOCTL_KS_PROPERTY, (PVOID)&PinRequest, sizeof(KSPROPERTY), + (PVOID)(PinConnect + 1), Length, &BytesReturned); + ObDereferenceObject(FileObject); + + return Status; +} + NTSTATUS HandleSysAudioFilterPinCreation( @@ -429,9 +466,9 @@ NTSTATUS Status; KSPIN_CINSTANCES PinInstances; PIO_WORKITEM WorkItem; - PFILE_OBJECT FileObject; PPIN_WORKER_CONTEXT WorkerContext; PDISPATCH_CONTEXT DispatchContext; + ULONG Index, SubIndex; IoStack = IoGetCurrentIrpStackLocation(Irp); @@ -456,8 +493,7 @@ /* get client context */ ClientInfo = (PSYSAUDIO_CLIENT)CreateItem->Context; - if (!ClientInfo || !ClientInfo->NumDevices || !ClientInfo->Devs || - ClientInfo->Devs[ClientInfo->NumDevices-1].DeviceId != InstanceInfo->DeviceNumber) + if (!ClientInfo || !ClientInfo->NumDevices || !ClientInfo->Devs) { /* we have a problem */ KeBugCheckEx(0, 0, 0, 0, 0); @@ -506,6 +542,30 @@ if (PinInstances.CurrentCount == PinInstances.PossibleCount) { + for (Index = 0; Index < ClientInfo->NumDevices; Index++) + { + if (ClientInfo->Devs[Index].DeviceId == InstanceInfo->DeviceNumber) + { + if (ClientInfo->Devs[Index].ClientHandlesCount) + { + for(SubIndex = 0; SubIndex < ClientInfo->Devs[Index].ClientHandlesCount; SubIndex++) + { + if (ClientInfo->Devs[Index].ClientHandles[SubIndex].PinId == PinConnect->PinId) + { + /* reuse opened pin */ + Length = IoStack->Parameters.DeviceIoControl.InputBufferLength - sizeof(KSPIN_CONNECT) + sizeof(SYSAUDIO_INSTANCE_INFO); + Status = SetPinFormat(Entry, PinConnect, Length); + DPRINT1("Reusing instance handle Status %x\n", Status); + ASSERT(ClientInfo->Devs[Index].ClientHandles[SubIndex].bHandle == FALSE); + *((PHANDLE)Irp->UserBuffer) = ClientInfo->Devs[Index].ClientHandles[SubIndex].hPin; + return SetIrpIoStatus(Irp, Status, sizeof(HANDLE)); + } + } + } + + } + } + /* pin already exists */ ASSERT(Entry->Pins[PinConnect->PinId].PinHandle != NULL); if (Entry->Pins[PinConnect->PinId].References > 1) @@ -550,39 +610,14 @@ if (PinInstances.CurrentCount == PinInstances.PossibleCount) { /* re-using pin */ - PinRequest.Property.Set = KSPROPSETID_Connection; - PinRequest.Property.Flags = KSPROPERTY_TYPE_SET; - PinRequest.Property.Id = KSPROPERTY_CONNECTION_DATAFORMAT; - - /* get pin file object */ - Status = ObReferenceObjectByHandle(Entry->Pins[PinConnect->PinId].PinHandle, - GENERIC_READ | GENERIC_WRITE, - IoFileObjectType, KernelMode, (PVOID*)&FileObject, NULL); - + Status = SetPinFormat(Entry, PinConnect, Length); if (!NT_SUCCESS(Status)) { - DPRINT1("Failed to get pin file object with %x\n", Status); IoFreeWorkItem(WorkItem); ExFreePool(WorkerContext); ExFreePool(DispatchContext); return SetIrpIoStatus(Irp, Status, 0); } - - Length -= sizeof(KSPIN_CONNECT) + sizeof(SYSAUDIO_INSTANCE_INFO); - Status = KsSynchronousIoControlDevice(FileObject, KernelMode, IOCTL_KS_PROPERTY, (PVOID)&PinRequest, sizeof(KSPROPERTY), - (PVOID)(PinConnect + 1), Length, &BytesReturned); - - ObDereferenceObject(FileObject); - - if (!NT_SUCCESS(Status)) - { - DPRINT1("Failed to set format with Status %x\n", Status); - IoFreeWorkItem(WorkItem); - ExFreePool(WorkerContext); - ExFreePool(DispatchContext); - return SetIrpIoStatus(Irp, Status, 0); - } - } else {
15 years, 9 months
1
0
0
0
[mkupfer] 39906: - continue "marletting" - use marlett font for caption buttons
by mkupfer@svn.reactos.org
Author: mkupfer Date: Sun Mar 8 17:08:28 2009 New Revision: 39906 URL:
http://svn.reactos.org/svn/reactos?rev=39906&view=rev
Log: - continue "marletting" - use marlett font for caption buttons Modified: trunk/reactos/dll/win32/user32/windows/draw.c Modified: trunk/reactos/dll/win32/user32/windows/draw.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/windows/d…
============================================================================== --- trunk/reactos/dll/win32/user32/windows/draw.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/user32/windows/draw.c [iso-8859-1] Sun Mar 8 17:08:28 2009 @@ -845,226 +845,74 @@ return FALSE; } -/* Ported from WINE20020904 */ -/* Draw caption buttons (win95), coming from DrawFrameControl() */ static BOOL UITOOLS95_DrawFrameCaption(HDC dc, LPRECT r, UINT uFlags) { - POINT Line1[10]; - POINT Line2[10]; - int Line1N; - int Line2N; + int colorIdx = uFlags & DFCS_INACTIVE ? COLOR_BTNSHADOW : COLOR_BTNTEXT; + LOGFONT lf; + HFONT hFont, hOldFont; + COLORREF clrsave; RECT myr; - int SmallDiam = UITOOLS_MakeSquareRect(r, &myr)-2; - int i; - HBRUSH hbsave; - HPEN hpsave; - HFONT hfsave, hf; - int colorIdx = uFlags & DFCS_INACTIVE ? COLOR_BTNSHADOW : COLOR_BTNTEXT; - int xc = (myr.left+myr.right)/2; - int yc = (myr.top+myr.bottom)/2; - int edge, move; - char str[2] = "?"; - UINT alignsave; - int bksave; - COLORREF clrsave; - SIZE size; - + INT bkmode; + TCHAR Symbol; + switch(uFlags & 0xff) + { + case DFCS_CAPTIONCLOSE: + Symbol = 'r'; + break; + case DFCS_CAPTIONHELP: + Symbol = 's'; + break; + case DFCS_CAPTIONMIN: + Symbol = '0'; + break; + case DFCS_CAPTIONMAX: + Symbol = '1'; + break; + case DFCS_CAPTIONRESTORE: + Symbol = '2'; + break; + default: + return FALSE; + } if(uFlags & DFCS_PUSHED) IntDrawRectEdge(dc,r,EDGE_SUNKEN, BF_RECT | BF_MIDDLE | BF_SOFT); else IntDrawRectEdge(dc,r,BDR_RAISEDINNER | BDR_RAISEDOUTER, BF_RECT | BF_SOFT | BF_MIDDLE); - - switch(uFlags & 0xff) - { - case DFCS_CAPTIONCLOSE: - { - /* The "X" is made by drawing a series of lines. - * The number of lines drawn depends on the size - * of the bounding rect. e.g. For a 6x5 inside rect, - * two lines are drawn from top-left to bottom-right, - * and two lines from top-right to bottom-left. - * - * 0 1 2 3 4 5 0 1 2 3 4 5 - * 1 * * * * - * 2 * * * * - * 3 * * * * - * 4 * * * * - * - * Drawing one line for every 6 pixels in width - * seems to provide the best proportions. - */ - - POINT start, oldPos; - INT width = myr.right - (++myr.left) - 5; - INT height = (--myr.bottom) - myr.top - 6; - INT numLines = (width / 6) + 1; - - hpsave = (HPEN)SelectObject(dc, GetSysColorPen(colorIdx)); - - start.x = myr.left + 2; - start.y = myr.top + 2; - - if (width < 6) - height = width; - else - start.y++; - - if (uFlags & DFCS_PUSHED) - { - start.x++; - start.y++; - } - - /* now use the width of each line */ - width -= numLines - 1; - - for (i = 0; i < numLines; i++) - { - MoveToEx(dc, start.x + i, start.y, &oldPos); - LineTo(dc, start.x + i + width, start.y + height); - - MoveToEx(dc, start.x + i, start.y + height - 1, &oldPos); - LineTo(dc, start.x + i + width, start.y - 1); - } - - SelectObject(dc, hpsave); - return TRUE; - } - - case DFCS_CAPTIONHELP: - /* This one breaks the flow */ - /* FIXME: We need the Marlett font in order to get this right. */ - - hf = CreateFontA(-SmallDiam, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, - ANSI_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, - DEFAULT_QUALITY, FIXED_PITCH|FF_DONTCARE, "System"); - alignsave = SetTextAlign(dc, TA_TOP|TA_LEFT); - bksave = SetBkMode(dc, TRANSPARENT); - clrsave = GetTextColor(dc); - hfsave = (HFONT)SelectObject(dc, hf); - GetTextExtentPoint32A(dc, str, 1, &size); - - if(uFlags & DFCS_INACTIVE) - { - SetTextColor(dc, GetSysColor(COLOR_BTNHIGHLIGHT)); - TextOutA(dc, xc-size.cx/2+1, yc-size.cy/2+1, str, 1); - } - SetTextColor(dc, GetSysColor(colorIdx)); - TextOutA(dc, xc-size.cx/2, yc-size.cy/2, str, 1); - - SelectObject(dc, hfsave); - SetTextColor(dc, clrsave); - SetBkMode(dc, bksave); - SetTextAlign(dc, alignsave); - DeleteObject(hf); - return TRUE; - - case DFCS_CAPTIONMIN: - /* - * If the button goes from x 0 -- w-1, the leftmost point of the - * minimize line always starts at x>=4. - */ - { - const int width = myr.right - myr.left; - const int xInsetPixels = (width>=9 ? width - 9 : 0) / 8 + 4; - Line1[0].x = Line1[3].x = myr.left + xInsetPixels; - Line1[1].x = Line1[2].x = Line1[0].x + 372*SmallDiam/750; - Line1[0].y = Line1[1].y = myr.top + 563*SmallDiam/750+1; - Line1[2].y = Line1[3].y = Line1[0].y + 92*SmallDiam/750; - Line1N = 4; - Line2N = 0; - } - break; - - case DFCS_CAPTIONMAX: - edge = 47*SmallDiam/750; - Line1[0].x = Line1[5].x = myr.left + 57*SmallDiam/750+3; - Line1[0].y = Line1[1].y = myr.top + 143*SmallDiam/750+1; - Line1[1].x = Line1[2].x = Line1[0].x + 562*SmallDiam/750; - Line1[5].y = Line1[4].y = Line1[0].y + 93*SmallDiam/750; - Line1[2].y = Line1[3].y = Line1[0].y + 513*SmallDiam/750; - Line1[3].x = Line1[4].x = Line1[1].x - edge; - - Line2[0].x = Line2[5].x = Line1[0].x; - Line2[3].x = Line2[4].x = Line1[1].x; - Line2[1].x = Line2[2].x = Line1[0].x + edge; - Line2[0].y = Line2[1].y = Line1[0].y; - Line2[4].y = Line2[5].y = Line1[2].y; - Line2[2].y = Line2[3].y = Line1[2].y - edge; - Line1N = 6; - Line2N = 6; - break; - - case DFCS_CAPTIONRESTORE: - /* FIXME: this one looks bad at small sizes < 15x15 :( */ - edge = 47*SmallDiam/750; - move = 420*SmallDiam/750; - Line1[0].x = Line1[9].x = myr.left + 198*SmallDiam/750+2; - Line1[0].y = Line1[1].y = myr.top + 169*SmallDiam/750+1; - Line1[6].y = Line1[7].y = Line1[0].y + 93*SmallDiam/750; - Line1[7].x = Line1[8].x = Line1[0].x + edge; - Line1[1].x = Line1[2].x = Line1[0].x + move; - Line1[5].x = Line1[6].x = Line1[1].x - edge; - Line1[9].y = Line1[8].y = Line1[0].y + 187*SmallDiam/750; - Line1[2].y = Line1[3].y = Line1[0].y + 327*SmallDiam/750; - Line1[4].y = Line1[5].y = Line1[2].y - edge; - Line1[3].x = Line1[4].x = Line1[2].x - 140*SmallDiam/750; - - Line2[1].x = Line2[2].x = Line1[3].x; - Line2[7].x = Line2[8].x = Line2[1].x - edge; - Line2[0].x = Line2[9].x = Line2[3].x = Line2[4].x = Line2[1].x - move; - Line2[5].x = Line2[6].x = Line2[0].x + edge; - Line2[0].y = Line2[1].y = Line1[9].y + 93*SmallDiam/750; - Line2[4].y = Line2[5].y = Line2[8].y = Line2[9].y = Line2[0].y + 93*SmallDiam/750; - Line2[2].y = Line2[3].y = Line2[0].y + 327*SmallDiam/750; - Line2[6].y = Line2[7].y = Line2[2].y - edge; - Line1N = 10; - Line2N = 10; - break; - - default: - return FALSE; - } - - /* Here the drawing takes place */ + ZeroMemory(&lf, sizeof(LOGFONT)); + UITOOLS_MakeSquareRect(r, &myr); + myr.left += 1; + myr.top += 1; + myr.right -= 1; + myr.bottom -= 1; + if(uFlags & DFCS_PUSHED) + OffsetRect(&myr,1,1); + lf.lfHeight = myr.bottom - myr.top; + lf.lfWidth = 0; + lf.lfWeight = FW_NORMAL; + lf.lfCharSet = DEFAULT_CHARSET; + lstrcpy(lf.lfFaceName, TEXT("Marlett")); + hFont = CreateFontIndirect(&lf); + /* save font and text color */ + hOldFont = SelectObject(dc, hFont); + clrsave = GetTextColor(dc); + bkmode = GetBkMode(dc); + /* set color and drawing mode */ + SetBkMode(dc, TRANSPARENT); if(uFlags & DFCS_INACTIVE) { - /* If we have an inactive button, then you see a shadow */ - hbsave = (HBRUSH)SelectObject(dc, GetSysColorBrush(COLOR_BTNHIGHLIGHT)); - hpsave = (HPEN)SelectObject(dc, GetSysColorPen(COLOR_BTNHIGHLIGHT)); - Polygon(dc, Line1, Line1N); - if(Line2N > 0) - Polygon(dc, Line2, Line2N); - SelectObject(dc, hpsave); - SelectObject(dc, hbsave); - } - - /* Correct for the shadow shift */ - if (!(uFlags & DFCS_PUSHED)) - { - for(i = 0; i < Line1N; i++) - { - Line1[i].x--; - Line1[i].y--; - } - for(i = 0; i < Line2N; i++) - { - Line2[i].x--; - Line2[i].y--; - } - } - - /* Make the final picture */ - hbsave = (HBRUSH)SelectObject(dc, GetSysColorBrush(colorIdx)); - hpsave = (HPEN)SelectObject(dc, GetSysColorPen(colorIdx)); - - Polygon(dc, Line1, Line1N); - if(Line2N > 0) - Polygon(dc, Line2, Line2N); - SelectObject(dc, hpsave); - SelectObject(dc, hbsave); - + /* draw shadow */ + SetTextColor(dc, GetSysColor(COLOR_BTNHIGHLIGHT)); + TextOut(dc, myr.left + 1, myr.top + 1, &Symbol, 1); + } + SetTextColor(dc, GetSysColor(colorIdx)); + /* draw selected symbol */ + TextOut(dc, myr.left, myr.top, &Symbol, 1); + /* restore previous settings */ + SetTextColor(dc, clrsave); + SelectObject(dc, hOldFont); + SetBkMode(dc, bkmode); + DeleteObject(hFont); return TRUE; }
15 years, 9 months
1
0
0
0
[tkreuzer] 39905: Bmfd: Rework code for BmfdQueryFontData, rename some structs, add BMFD_FONT struct, which is associated with a FONTOBJ, rewrite copying bits, so it can do scaling and rotation. Scaled fonts work now. Rotation is not yet finished.
by tkreuzer@svn.reactos.org
Author: tkreuzer Date: Sun Mar 8 06:09:10 2009 New Revision: 39905 URL:
http://svn.reactos.org/svn/reactos?rev=39905&view=rev
Log: Bmfd: Rework code for BmfdQueryFontData, rename some structs, add BMFD_FONT struct, which is associated with a FONTOBJ, rewrite copying bits, so it can do scaling and rotation. Scaled fonts work now. Rotation is not yet finished. Modified: trunk/reactos/drivers/video/font/bmfd/bmfd.h trunk/reactos/drivers/video/font/bmfd/enable.c trunk/reactos/drivers/video/font/bmfd/font.c trunk/reactos/drivers/video/font/bmfd/glyph.c Modified: trunk/reactos/drivers/video/font/bmfd/bmfd.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/video/font/bmfd/bm…
============================================================================== --- trunk/reactos/drivers/video/font/bmfd/bmfd.h [iso-8859-1] (original) +++ trunk/reactos/drivers/video/font/bmfd/bmfd.h [iso-8859-1] Sun Mar 8 06:09:10 2009 @@ -225,7 +225,7 @@ WORD wAscent; WORD wDescent; FLONG flInfo; -} DRVFACE, *PDRVFACE; +} BMFD_FACE, *PBMFD_FACE; typedef struct { @@ -234,8 +234,17 @@ PFONTGROUPHDR pFontDir; FONTTYPE ulFontType; ULONG cNumFaces; - DRVFACE aface[1]; -} DRVFONT, *PDRVFONT; + BMFD_FACE aface[1]; +} BMFD_FILE, *PBMFD_FILE; + +typedef struct +{ + FONTOBJ *pfo; + PBMFD_FACE pface; + ULONG xScale; + ULONG yScale; + ULONG ulAngle; +} BMFD_FONT, *PBMFD_FONT; //"Bold Italic Underline Strikeout" #define MAX_STYLESIZE 35 @@ -246,7 +255,7 @@ WCHAR wszFamilyName[LF_FACESIZE]; WCHAR wszFaceName[LF_FACESIZE]; WCHAR wszStyleName[MAX_STYLESIZE]; -} DRVIFIMETRICS, *PDRVIFIMETRICS; +} BMFD_IFIMETRICS, *PBMFD_IFIMETRICS; /** Function prototypes *******************************************************/ @@ -357,3 +366,8 @@ PVOID pv, ULONG cjSize); +VOID +APIENTRY +BmfdDestroyFont( + IN FONTOBJ *pfo); + Modified: trunk/reactos/drivers/video/font/bmfd/enable.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/video/font/bmfd/en…
============================================================================== --- trunk/reactos/drivers/video/font/bmfd/enable.c [iso-8859-1] (original) +++ trunk/reactos/drivers/video/font/bmfd/enable.c [iso-8859-1] Sun Mar 8 06:09:10 2009 @@ -21,6 +21,7 @@ {INDEX_DrvFree, (PFN)BmfdFree}, {INDEX_DrvQueryGlyphAttrs, (PFN)BmfdQueryGlyphAttrs}, {INDEX_DrvQueryFontData, (PFN)BmfdQueryFontData}, + {INDEX_DrvDestroyFont, (PFN)BmfdDestroyFont}, }; Modified: trunk/reactos/drivers/video/font/bmfd/font.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/video/font/bmfd/fo…
============================================================================== --- trunk/reactos/drivers/video/font/bmfd/font.c [iso-8859-1] (original) +++ trunk/reactos/drivers/video/font/bmfd/font.c [iso-8859-1] Sun Mar 8 06:09:10 2009 @@ -28,7 +28,7 @@ static BOOL FillFaceInfo( - PDRVFACE pface, + PBMFD_FACE pface, PFONTINFO16 pFontInfo) { CHAR ansi[4]; @@ -124,7 +124,7 @@ PNE_TYPEINFO pTInfo; PFONTINFO16 pFontInfo; PCHAR pStart, pEnd; - PDRVFONT pfont = NULL; + PBMFD_FILE pfile = NULL; WORD wShift; ULONG i, cjOffset, cjLength; ULONG type_id, count; @@ -173,15 +173,15 @@ DbgPrint("Found NE_RSCTYPE_FONT\n"); /* Allocate an info structure for this font and all faces */ - cjLength = sizeof(DRVFONT) + (count-1) * sizeof(DRVFACE); - pfont = EngAllocMem(0, cjLength, TAG_FONTINFO); - if (!pfont) + cjLength = sizeof(BMFD_FILE) + (count-1) * sizeof(BMFD_FACE); + pfile = EngAllocMem(0, cjLength, TAG_FONTINFO); + if (!pfile) { DbgPrint("Not enough memory: %ld\n", cjLength); return NULL; } - pfont->cNumFaces = count; + pfile->cNumFaces = count; /* Fill all face info structures */ for (i = 0; i < count; i++) @@ -193,15 +193,15 @@ if (!IsValidPtr(pFontInfo, cjLength, pStart, pEnd, 1)) { DbgPrint("pFontInfo is invalid: 0x%p\n", pFontInfo); - EngFreeMem(pfont); + EngFreeMem(pfile); return NULL; } /* Validate FONTINFO and fill face info */ - if (!FillFaceInfo(&pfont->aface[i], pFontInfo)) + if (!FillFaceInfo(&pfile->aface[i], pFontInfo)) { DbgPrint("pFontInfo is invalid: 0x%p\n", pFontInfo); - EngFreeMem(pfont); + EngFreeMem(pfile); return NULL; } } @@ -226,7 +226,7 @@ type_id = GETVAL(pTInfo->type_id); } - return pfont; + return pfile; } /** Public Interface **********************************************************/ @@ -242,7 +242,7 @@ ULONG ulLangID, ULONG ulFastCheckSum) { - PDRVFONT pfont = NULL; + PBMFD_FILE pfile = NULL; PVOID pvView; ULONG cjView; @@ -266,16 +266,16 @@ DbgPrint("mapped font file to %p, site if %ld\n", pvView, cjView); /* Try to parse a .fon file */ - pfont = ParseFonFile(pvView, cjView); - - if (!pfont) + pfile = ParseFonFile(pvView, cjView); + + if (!pfile) { /* Could be a .fnt file */ - pfont = ParseFntFile(pvView, cjView); + pfile = ParseFntFile(pvView, cjView); } /* Check whether we succeeded finding a font */ - if (!pfont) + if (!pfile) { DbgPrint("No font data found\n"); @@ -286,11 +286,11 @@ return HFF_INVALID; } - pfont->iFile = *piFile; - pfont->pvView = pvView; + pfile->iFile = *piFile; + pfile->pvView = pvView; /* Success, return the pointer to font info structure */ - return (ULONG_PTR)pfont; + return (ULONG_PTR)pfile; } BOOL @@ -298,15 +298,15 @@ BmfdUnloadFontFile( IN ULONG_PTR iFile) { - PDRVFONT pfont = (PDRVFONT)iFile; + PBMFD_FILE pfile = (PBMFD_FILE)iFile; DbgPrint("BmfdUnloadFontFile()\n"); /* Free the memory that was allocated for the font */ - EngFreeMem(pfont); + EngFreeMem(pfile); /* Unmap the font file */ - EngUnmapFontFileFD(pfont->iFile); + EngUnmapFontFileFD(pfile->iFile); return TRUE; } @@ -320,7 +320,7 @@ ULONG cjBuf, ULONG *pulBuf) { - PDRVFONT pfont = (PDRVFONT)iFile; + PBMFD_FILE pfile = (PBMFD_FILE)iFile; DbgPrint("BmfdQueryFontFile()\n"); // DbgBreakPoint(); @@ -330,7 +330,7 @@ case QFF_DESCRIPTION: { /* We copy the face name of the 1st face */ - PCHAR pDesc = pfont->aface[0].pszFaceName; + PCHAR pDesc = pfile->aface[0].pszFaceName; ULONG cOutSize; if (pulBuf) { @@ -349,7 +349,7 @@ case QFF_NUMFACES: /* return the number of faces in the file */ - return pfont->cNumFaces; + return pfile->cNumFaces; default: return FD_ERROR; @@ -387,8 +387,8 @@ ULONG iMode, ULONG_PTR *pid) { - PDRVFONT pfont = (PDRVFONT)iFile; - PDRVFACE pface; + PBMFD_FILE pfile = (PBMFD_FILE)iFile; + PBMFD_FACE pface; ULONG i, j, cjOffset, cjSize, cGlyphs, cRuns; CHAR ch, chFirst, ach[256]; WCHAR wc, awc[256]; @@ -400,14 +400,14 @@ // DbgBreakPoint(); /* Check parameters, we only support QFT_GLYPHSET */ - if (!iFace || iFace > pfont->cNumFaces || iMode != QFT_GLYPHSET) - { - DbgPrint("iFace = %ld, cNumFaces = %ld\n", iFace, pfont->cNumFaces); + if (!iFace || iFace > pfile->cNumFaces || iMode != QFT_GLYPHSET) + { + DbgPrint("iFace = %ld, cNumFaces = %ld\n", iFace, pfile->cNumFaces); return NULL; } /* Get a pointer to the face data */ - pface = &pfont->aface[iFace - 1]; + pface = &pfile->aface[iFace - 1]; /* Get the number of characters in the face */ cGlyphs = pface->cGlyphs; @@ -514,43 +514,43 @@ IN ULONG iFace, IN ULONG_PTR *pid) { - PDRVFONT pfont = (PDRVFONT)iFile; - PDRVFACE pface; + PBMFD_FILE pfile = (PBMFD_FILE)iFile; + PBMFD_FACE pface; PFONTINFO16 pFontInfo; PIFIMETRICS pifi; - PDRVIFIMETRICS pDrvIM; + PBMFD_IFIMETRICS pifiX; PANOSE panose = {0}; DbgPrint("BmfdQueryFont()\n"); // DbgBreakPoint(); /* Validate parameters */ - if (iFace > pfont->cNumFaces || !pid) + if (iFace > pfile->cNumFaces || !pid) { return NULL; } - pface = &pfont->aface[iFace - 1]; + pface = &pfile->aface[iFace - 1]; pFontInfo = pface->pFontInfo; /* Allocate the structure */ - pDrvIM = EngAllocMem(FL_ZERO_MEMORY, sizeof(DRVIFIMETRICS), TAG_IFIMETRICS); - if (!pDrvIM) + pifiX = EngAllocMem(FL_ZERO_MEMORY, sizeof(BMFD_IFIMETRICS), TAG_IFIMETRICS); + if (!pifiX) { return NULL; } /* Return a pointer to free it later */ - *pid = (ULONG_PTR)pDrvIM; + *pid = (ULONG_PTR)pifiX; /* Fill IFIMETRICS */ - pifi = &pDrvIM->ifim; - pifi->cjThis = sizeof(DRVIFIMETRICS); + pifi = &pifiX->ifim; + pifi->cjThis = sizeof(BMFD_IFIMETRICS); pifi->cjIfiExtra = 0; - pifi->dpwszFamilyName = FIELD_OFFSET(DRVIFIMETRICS, wszFamilyName); - pifi->dpwszStyleName = FIELD_OFFSET(DRVIFIMETRICS, wszFamilyName); - pifi->dpwszFaceName = FIELD_OFFSET(DRVIFIMETRICS, wszFaceName); - pifi->dpwszUniqueName = FIELD_OFFSET(DRVIFIMETRICS, wszFaceName); + pifi->dpwszFamilyName = FIELD_OFFSET(BMFD_IFIMETRICS, wszFamilyName); + pifi->dpwszStyleName = FIELD_OFFSET(BMFD_IFIMETRICS, wszFamilyName); + pifi->dpwszFaceName = FIELD_OFFSET(BMFD_IFIMETRICS, wszFaceName); + pifi->dpwszUniqueName = FIELD_OFFSET(BMFD_IFIMETRICS, wszFaceName); pifi->dpFontSim = 0; pifi->lEmbedId = 0; pifi->lItalicAngle = 0; @@ -612,21 +612,21 @@ pifi->panose = panose; /* Set char sets */ - pDrvIM->ajCharSet[0] = pifi->jWinCharSet; - pDrvIM->ajCharSet[1] = DEFAULT_CHARSET; + pifiX->ajCharSet[0] = pifi->jWinCharSet; + pifiX->ajCharSet[1] = DEFAULT_CHARSET; if (pface->flInfo & FM_INFO_CONSTANT_WIDTH) pifi->jWinPitchAndFamily |= FIXED_PITCH; #if 0 - EngMultiByteToUnicodeN(pDrvIM->wszFaceName, + EngMultiByteToUnicodeN(pifiX->wszFaceName, LF_FACESIZE * sizeof(WCHAR), NULL, pFontInfo->, strnlen(pDesc, LF_FACESIZE)); #endif - wcscpy(pDrvIM->wszFaceName, L"Courier-X"); - wcscpy(pDrvIM->wszFamilyName, L"Courier-X"); + wcscpy(pifiX->wszFaceName, L"Courier-X"); + wcscpy(pifiX->wszFamilyName, L"Courier-X"); /* Initialize font weight style flags and string */ if (pifi->usWinWeight == FW_REGULAR) @@ -636,29 +636,29 @@ else if (pifi->usWinWeight > FW_SEMIBOLD) { pifi->fsSelection |= FM_SEL_BOLD; - wcscat(pDrvIM->wszStyleName, L"Bold "); + wcscat(pifiX->wszStyleName, L"Bold "); } else if (pifi->usWinWeight <= FW_LIGHT) { - wcscat(pDrvIM->wszStyleName, L"Light "); + wcscat(pifiX->wszStyleName, L"Light "); } if (pFontInfo->dfItalic) { pifi->fsSelection |= FM_SEL_ITALIC; - wcscat(pDrvIM->wszStyleName, L"Italic "); + wcscat(pifiX->wszStyleName, L"Italic "); } if (pFontInfo->dfUnderline) { pifi->fsSelection |= FM_SEL_UNDERSCORE; - wcscat(pDrvIM->wszStyleName, L"Underscore "); + wcscat(pifiX->wszStyleName, L"Underscore "); } if (pFontInfo->dfStrikeOut) { pifi->fsSelection |= FM_SEL_STRIKEOUT; - wcscat(pDrvIM->wszStyleName, L"Strikeout "); + wcscat(pifiX->wszStyleName, L"Strikeout "); } return pifi; @@ -679,4 +679,12 @@ } - +VOID +APIENTRY +BmfdDestroyFont( + IN FONTOBJ *pfo) +{ + /* Free the font realization info */ + EngFreeMem(pfo->pvProducer); + pfo->pvProducer = NULL; +} Modified: trunk/reactos/drivers/video/font/bmfd/glyph.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/video/font/bmfd/gl…
============================================================================== --- trunk/reactos/drivers/video/font/bmfd/glyph.c [iso-8859-1] (original) +++ trunk/reactos/drivers/video/font/bmfd/glyph.c [iso-8859-1] Sun Mar 8 06:09:10 2009 @@ -7,48 +7,299 @@ #include "bmfd.h" -static +ULONG +FORCEINLINE +_ReadPixel( + CHAR* pjBits, + ULONG x, + ULONG y, + ULONG ulHeight) +{ + CHAR j; + j = pjBits[(x/8) * ulHeight + y]; + return (j >> (~x & 0x7)) & 1; +} + + VOID -FillFDDM( +FORCEINLINE +_WritePixel( + CHAR* pjBits, + ULONG x, + ULONG y, + ULONG cjRow, + ULONG color) +{ + pjBits += y * cjRow; + pjBits += x / 8; + *pjBits |= color << (~x & 0x7); +} + + +PBMFD_FONT +BmfdGetFontInstance( + FONTOBJ *pfo, + PBMFD_FACE pface) +{ + PBMFD_FONT pfont = pfo->pvProducer; + XFORMOBJ *pxo; + FLOATOBJ_XFORM xfo; + + if (!pfont) + { + /* Allocate realization info */ + pfont = EngAllocMem(0, sizeof(BMFD_FONT), 0); + if (!pfont) + { + return NULL; + } + + pxo = FONTOBJ_pxoGetXform(pfo); + XFORMOBJ_iGetFloatObjXform(pxo, &xfo); + + pfont->pfo = pfo; + pfont->pface = pface; + pfont->xScale = FLOATOBJ_GetLong(&xfo.eM11); + pfont->yScale = FLOATOBJ_GetLong(&xfo.eM22); + pfont->ulAngle = 0; + + /* Set the pvProducer member of the fontobj */ + pfo->pvProducer = pfont; + } + + return pfont; +} + + +ULONG +BmfdQueryGlyphAndBitmap( + PBMFD_FONT pfont, + HGLYPH hg, + GLYPHDATA *pgd, + GLYPHBITS *pgb, + ULONG cjSize) +{ + PBMFD_FACE pface = pfont->pface; + PGLYPHENTRY pge = (PGLYPHENTRY)hg; + ULONG xSrc, ySrc, cxSrc, cySrc; + ULONG xDst, yDst, cxDst, cyDst; + ULONG xScale, yScale; + ULONG ulGlyphOffset, cjDstRow, color; + PVOID pvSrc0, pvDst0; + + if (!pge) + { + DbgPrint("no glyph handle given!\n"); + return FD_ERROR; + } + + /* Get the bitmap offset depending on file version */ + if (pface->ulVersion >= 0x300) + { + cxSrc = GETVAL(pge->ge20.geWidth); + ulGlyphOffset = GETVAL(pge->ge30.geOffset); + } + else + { + cxSrc = GETVAL(pge->ge30.geWidth); + ulGlyphOffset = GETVAL(pge->ge20.geOffset); + } + cySrc = pface->wPixHeight; + + /* Pointer to the bitmap bits */ + pvSrc0 = (PBYTE)pface->pFontInfo + ulGlyphOffset; + pvDst0 = pgb->aj; + + xScale = pfont->xScale; + yScale = pfont->yScale; + + /* Calculate extents of destination bitmap */ + if (pfont->ulAngle == 90 || pfont->ulAngle == 270) + { + cxDst = cySrc * xScale; + cyDst = cxSrc * yScale; + } + else + { + cxDst = cxSrc * yScale; + cyDst = cySrc * xScale; + } + cjDstRow = (cxDst + 7) / 8; + + if (pgd) + { + /* Fill GLYPHDATA structure */ + pgd->gdf.pgb = pgb; + pgd->hg = hg; + pgd->fxD = xScale * (pface->wA + cxDst + pface->wC) << 4; + pgd->fxA = xScale * pface->wA << 4; + pgd->fxAB = xScale * (pface->wA + cxDst) << 4; + pgd->fxInkTop = yScale * pface->wAscent << 4; + pgd->fxInkBottom = - yScale * (pface->wDescent << 4); + pgd->rclInk.top = - yScale * pface->wAscent; + pgd->rclInk.bottom = yScale * pface->wDescent; + pgd->rclInk.left = xScale * pface->wA; + pgd->rclInk.right = pgd->rclInk.left + cxDst; + pgd->ptqD.x.LowPart = 0; + pgd->ptqD.x.HighPart = pgd->fxD; + pgd->ptqD.y.LowPart = 0; + pgd->ptqD.y.HighPart = 0; + } + + if (pgb) + { + /* Verify that the buffer is big enough */ + if (cjSize < FIELD_OFFSET(GLYPHBITS, aj) + cyDst * cjDstRow) + { + DbgPrint("Buffer too small (%ld), %ld,%ld\n", + cjSize, cxSrc, cySrc); + return FD_ERROR; + } + + /* Fill GLYPHBITS structure */ + pgb->ptlOrigin.x = yScale * pface->wA; + pgb->ptlOrigin.y = - yScale * pface->wAscent; + pgb->sizlBitmap.cx = cxDst; + pgb->sizlBitmap.cy = cyDst; + + /* Erase destination surface */ + memset(pvDst0, 0, cyDst * cjDstRow); + + switch (pfont->ulAngle) + { + case 90: + /* Copy pixels */ + for (yDst = 0; yDst < cyDst ; yDst++) + { + xSrc = yDst / yScale; + for (xDst = 0; xDst < cxDst; xDst++) + { + ySrc = (cxDst - xDst) / xScale; + color = _ReadPixel(pvSrc0, xSrc, ySrc, cySrc); + _WritePixel(pvDst0, xDst, yDst, cjDstRow, color); + } + } + break; + + case 180: + for (yDst = 0; yDst < cyDst ; yDst++) + { + ySrc = (cyDst - yDst) / yScale; + for (xDst = 0; xDst < cxDst; xDst++) + { + xSrc = (cxDst - xDst) / xScale; + color = _ReadPixel(pvSrc0, xSrc, ySrc, cySrc); + _WritePixel(pvDst0, xDst, yDst, cjDstRow, color); + } + } + break; + + case 270: + for (yDst = 0; yDst < cyDst ; yDst++) + { + xSrc = (cyDst - yDst) / yScale; + for (xDst = 0; xDst < cxDst; xDst++) + { + ySrc = xDst / xScale; + color = _ReadPixel(pvSrc0, xSrc, ySrc, cySrc); + _WritePixel(pvDst0, xDst, yDst, cjDstRow, color); + } + } + break; + + case 0: + default: + for (yDst = 0; yDst < cyDst ; yDst++) + { + ySrc = yDst / yScale; + for (xDst = 0; xDst < cxDst; xDst++) + { + xSrc = xDst / xScale; + color = _ReadPixel(pvSrc0, xSrc, ySrc, cySrc); + _WritePixel(pvDst0, xDst, yDst, cjDstRow, color); + } + } + } + } + + /* Return the size of the GLYPHBITS structure */ + return FIELD_OFFSET(GLYPHBITS, aj) + cyDst * cjDstRow; +} + +ULONG +BmfdQueryMaxExtents( + PBMFD_FONT pfont, PFD_DEVICEMETRICS pfddm, - PFONTINFO16 pFontInfo) + ULONG cjSize) { ULONG cjMaxWidth, cjMaxBitmapSize; - - /* Fill FD_DEVICEMETRICS */ - pfddm->flRealizedType = FDM_MASK; - pfddm->pteBase.x = FLOATL_1; - pfddm->pteBase.y = 0; - pfddm->pteSide.x = 0; - pfddm->pteSide.y = FLOATL_1; - pfddm->ptlUnderline1.x = 0; - pfddm->ptlUnderline1.y = 1; - pfddm->ptlStrikeout.x = 0; - pfddm->ptlStrikeout.y = -4; - pfddm->ptlULThickness.x = 0; - pfddm->ptlULThickness.y = 1; - pfddm->ptlSOThickness.x = 0; - pfddm->ptlSOThickness.y = 1; - pfddm->lD = GETVAL(pFontInfo->dfPixWidth); - pfddm->cxMax = GETVAL(pFontInfo->dfMaxWidth); - pfddm->cyMax = GETVAL(pFontInfo->dfPixHeight); - pfddm->fxMaxAscender = GETVAL(pFontInfo->dfAscent) << 4; - pfddm->fxMaxDescender = (pfddm->cyMax << 4) - pfddm->fxMaxAscender; - pfddm->lMinA = 0; - pfddm->lMinC = 0; - pfddm->lMinD = 0; - - /* Calculate Width in bytes */ - cjMaxWidth = ((pfddm->cxMax + 7) >> 3); - - /* Calculate size of the bitmap, rounded to DWORDs */ - cjMaxBitmapSize = ((cjMaxWidth * pfddm->cyMax) + 3) & ~3; - - /* cjGlyphMax is the full size of the GLYPHBITS structure */ - pfddm->cjGlyphMax = FIELD_OFFSET(GLYPHBITS, aj) + cjMaxBitmapSize; - - /* NOTE: fdxQuantized and NonLinear... stay unchanged */ -} + PFONTINFO16 pFontInfo; + ULONG xScale, yScale; + + if (pfddm) + { + if (cjSize < sizeof(FD_DEVICEMETRICS)) + { + /* Not enough space, fail */ + return FD_ERROR; + } + + pFontInfo = pfont->pface->pFontInfo; + + xScale = pfont->xScale; + yScale = pfont->yScale; + + /* Fill FD_DEVICEMETRICS */ + pfddm->flRealizedType = FDM_MASK; + pfddm->pteBase.x = FLOATL_1; + pfddm->pteBase.y = 0; + pfddm->pteSide.x = 0; + pfddm->pteSide.y = FLOATL_1; + pfddm->ptlUnderline1.x = 0; + pfddm->ptlUnderline1.y = 1; + pfddm->ptlStrikeout.x = 0; + pfddm->ptlStrikeout.y = -4; + pfddm->ptlULThickness.x = 0; + pfddm->ptlULThickness.y = 1; + pfddm->ptlSOThickness.x = 0; + pfddm->ptlSOThickness.y = 1; + pfddm->lMinA = 0; + pfddm->lMinC = 0; + pfddm->lMinD = 0; + + if (pfont->ulAngle == 90 || pfont->ulAngle == 270) + { + pfddm->cxMax = xScale * GETVAL(pFontInfo->dfPixHeight); + pfddm->cyMax = yScale * GETVAL(pFontInfo->dfMaxWidth); + pfddm->fxMaxAscender = yScale * GETVAL(pFontInfo->dfAscent) << 4; + pfddm->fxMaxDescender = (pfddm->cyMax << 4) - pfddm->fxMaxAscender; + } + else + { + pfddm->cxMax = xScale * GETVAL(pFontInfo->dfMaxWidth); + pfddm->cyMax = yScale * GETVAL(pFontInfo->dfPixHeight); + pfddm->fxMaxAscender = yScale * GETVAL(pFontInfo->dfAscent) << 4; + pfddm->fxMaxDescender = (pfddm->cyMax << 4) - pfddm->fxMaxAscender; + } + + pfddm->lD = pfddm->cxMax; + + /* Calculate Width in bytes */ + cjMaxWidth = ((pfddm->cxMax + 7) >> 3); + + /* Calculate size of the bitmap, rounded to DWORDs */ + cjMaxBitmapSize = ((cjMaxWidth * pfddm->cyMax) + 3) & ~3; + + /* cjGlyphMax is the full size of the GLYPHBITS structure */ + pfddm->cjGlyphMax = FIELD_OFFSET(GLYPHBITS, aj) + cjMaxBitmapSize; + + /* NOTE: fdxQuantized and NonLinear... stay unchanged */ + } + + /* Return the size of the structure */ + return sizeof(FD_DEVICEMETRICS); +} + /** Public Interface **********************************************************/ @@ -74,10 +325,9 @@ PVOID pv, ULONG cjSize) { - PDRVFONT pfont = (PDRVFONT)pfo->iFile; - PDRVFACE pface = &pfont->aface[pfo->iFace - 1]; - PGLYPHENTRY pge = (PGLYPHENTRY)hg; - ULONG ulGlyphOffset, ulWidthBytes, ulPixWidth, ulPixHeight, x, y, cjRow; + PBMFD_FILE pfile = (PBMFD_FILE)pfo->iFile; + PBMFD_FACE pface = &pfile->aface[pfo->iFace - 1]; + PBMFD_FONT pfont= BmfdGetFontInstance(pfo, pface); DbgPrint("BmfdQueryFontData(pfo=%p, iMode=%ld, hg=%p, pgd=%p, pv=%p, cjSize=%ld)\n", pfo, iMode, hg, pgd, pv, cjSize); @@ -86,112 +336,11 @@ switch (iMode) { case QFD_GLYPHANDBITMAP: /* 1 */ - { - GLYPHBITS *pgb = pv; - BYTE j, *pjGlyphBits; - -// DbgPrint("QFD_GLYPHANDBITMAP, hg=%p, pgd=%p, pv=%p, cjSize=%d\n", -// hg, pgd, pv, cjSize); - - if (!hg) - { - DbgPrint("no glyph handle given!\n"); - return FD_ERROR; - } - - /* Get the bitmap offset depending on file version */ - if (pface->ulVersion >= 0x300) - { - ulPixWidth = GETVAL(pge->ge20.geWidth); - ulGlyphOffset = GETVAL(pge->ge30.geOffset); - } - else - { - ulPixWidth = GETVAL(pge->ge30.geWidth); - ulGlyphOffset = GETVAL(pge->ge20.geOffset); - } - ulPixHeight = pface->wPixHeight; - - /* Calculate number of bytes per row for gdi */ - cjRow = (ulPixWidth + 7) / 8; // FIXME: other bpp values - - if (pgd) - { - /* Fill GLYPHDATA structure */ - pgd->gdf.pgb = pgb; - pgd->hg = hg; - pgd->fxD = (pface->wA + ulPixWidth + pface->wC) << 4; - pgd->fxA = pface->wA << 4; - pgd->fxAB = (pface->wA + ulPixWidth) << 4; - pgd->fxInkTop = pface->wAscent << 4; - pgd->fxInkBottom = - (pface->wDescent << 4); - pgd->rclInk.top = - pface->wAscent; - pgd->rclInk.bottom = pface->wDescent ; - pgd->rclInk.left = pface->wA; - pgd->rclInk.right = pface->wA + ulPixWidth; - pgd->ptqD.x.LowPart = 0; - pgd->ptqD.x.HighPart = pgd->fxD; - pgd->ptqD.y.LowPart = 0; - pgd->ptqD.y.HighPart = 0; - } - - if (pgb) - { -// DbgBreakPoint(); - - /* Verify that the buffer is big enough */ - if (cjSize < FIELD_OFFSET(GLYPHBITS, aj) + ulPixHeight * cjRow) - { - DbgPrint("Buffer too small (%ld), %ld,%ld\n", - cjSize, ulPixWidth, ulPixHeight); - return FD_ERROR; - } - - /* Fill GLYPHBITS structure */ - pgb->ptlOrigin.x = pface->wA; - pgb->ptlOrigin.y = - pface->wAscent; - pgb->sizlBitmap.cx = ulPixWidth; - pgb->sizlBitmap.cy = ulPixHeight; - - /* Copy the bitmap bits */ - pjGlyphBits = (PBYTE)pface->pFontInfo + ulGlyphOffset; - ulWidthBytes = pface->wWidthBytes; - for (y = 0; y < ulPixHeight; y++) - { - for (x = 0; x < cjRow; x++) - { - j = pjGlyphBits[x * ulPixHeight + y]; - pgb->aj[y * cjRow + x] = j; - } - } - - DbgPrint("iFace=%ld, ulGlyphOffset=%lx, ulPixHeight=%ld, cjRow=%ld\n", - pfo->iFace, ulGlyphOffset, ulPixHeight, cjRow); -// DbgBreakPoint(); - } - - /* Return the size of the GLYPHBITS structure */ - return FIELD_OFFSET(GLYPHBITS, aj) + ulPixHeight * cjRow; - } + return BmfdQueryGlyphAndBitmap(pfont, hg, pgd, pv, cjSize); case QFD_MAXEXTENTS: /* 3 */ - { - if (pv) - { - if (cjSize < sizeof(FD_DEVICEMETRICS)) - { - /* Not enough space, fail */ - return FD_ERROR; - } - - /* Fill the PFD_DEVICEMETRICS structure */ - FillFDDM((PFD_DEVICEMETRICS)pv, pface->pFontInfo); - } - - /* Return the size of the structure */ - return sizeof(FD_DEVICEMETRICS); - } - + return BmfdQueryMaxExtents(pfont, pv, cjSize); + /* we support nothing else */ default: return FD_ERROR;
15 years, 9 months
1
0
0
0
[janderwald] 39904: - Document the mega-haxxx
by janderwald@svn.reactos.org
Author: janderwald Date: Sat Mar 7 23:50:38 2009 New Revision: 39904 URL:
http://svn.reactos.org/svn/reactos?rev=39904&view=rev
Log: - Document the mega-haxxx Modified: trunk/reactos/dll/win32/wdmaud.drv/wdmaud.c Modified: trunk/reactos/dll/win32/wdmaud.drv/wdmaud.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/wdmaud.drv/wdmau…
============================================================================== --- trunk/reactos/dll/win32/wdmaud.drv/wdmaud.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/wdmaud.drv/wdmaud.c [iso-8859-1] Sat Mar 7 23:50:38 2009 @@ -305,11 +305,15 @@ if ( ! WriteFileEx(KernelHandle, &DeviceInfo, sizeof(WDMAUD_DEVICE_INFO), (LPOVERLAPPED)Overlap, CompletionRoutine)) { - // TODO - SND_TRACE(L"WriteFileEx failed with %x\n", GetLastError()); - } - CompletionRoutine(0, Length, (LPOVERLAPPED)Overlap); - + SND_TRACE(L"WriteFileEx failed with %x\n", GetLastError()); + } + else + { + /* HACK + * The CompletionRoutine should be called by the system + */ + CompletionRoutine(0, Length, (LPOVERLAPPED)Overlap); + } return MMSYSERR_NOERROR; }
15 years, 9 months
1
0
0
0
← Newer
1
...
37
38
39
40
41
42
43
...
49
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
Results per page:
10
25
50
100
200