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
April 2005
----- 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
26 participants
477 discussions
Start a n
N
ew thread
[gvg] 14622: Read from disk
by gvg@svn.reactos.com
Read from disk Modified: branches/xen/reactos/boot/freeldr/freeldr/Makefile Modified: branches/xen/reactos/boot/freeldr/freeldr/arch/i386/machxen.c Modified: branches/xen/reactos/boot/freeldr/freeldr/arch/i386/machxen.h Added: branches/xen/reactos/boot/freeldr/freeldr/arch/i386/xendisk.c Modified: branches/xen/reactos/boot/freeldr/freeldr/arch/i386/xenevtchn.c Modified: branches/xen/reactos/boot/freeldr/freeldr/arch/i386/xenmem.c _____ Modified: branches/xen/reactos/boot/freeldr/freeldr/Makefile --- branches/xen/reactos/boot/freeldr/freeldr/Makefile 2005-04-14 21:46:14 UTC (rev 14621) +++ branches/xen/reactos/boot/freeldr/freeldr/Makefile 2005-04-14 21:47:57 UTC (rev 14622) @@ -173,6 +173,7 @@ xboxvideo.o \ xencons.o \ xenctrlif.o \ + xendisk.o \ xenentry.o \ xenevtchn.o \ xenmem.o \ _____ Modified: branches/xen/reactos/boot/freeldr/freeldr/arch/i386/machxen.c --- branches/xen/reactos/boot/freeldr/freeldr/arch/i386/machxen.c 2005-04-14 21:46:14 UTC (rev 14621) +++ branches/xen/reactos/boot/freeldr/freeldr/arch/i386/machxen.c 2005-04-14 21:47:57 UTC (rev 14622) @@ -274,14 +274,6 @@ } BOOL -XenDiskReadLogicalSectors(ULONG DriveNumber, ULONGLONG SectorNumber, - ULONG SectorCount, PVOID Buffer) - { - XEN_UNIMPLEMENTED("XenDiskReadLogicalSectors"); - return FALSE; - } - -BOOL XenDiskGetPartitionEntry(ULONG DriveNumber, ULONG PartitionNumber, PPARTITION_TABLE_ENTRY PartitionTableEntry) { _____ Modified: branches/xen/reactos/boot/freeldr/freeldr/arch/i386/machxen.h --- branches/xen/reactos/boot/freeldr/freeldr/arch/i386/machxen.h 2005-04-14 21:46:14 UTC (rev 14621) +++ branches/xen/reactos/boot/freeldr/freeldr/arch/i386/machxen.h 2005-04-14 21:47:57 UTC (rev 14622) @@ -35,7 +35,6 @@ extern shared_info_t *XenSharedInfo; VOID XenMachInit(VOID); -VOID XenMemInit(start_info_t *StartInfo); VOID XenCtrlIfInit(); BOOL XenCtrlIfSendMessageNoblock(ctrl_msg_t *Msg); @@ -46,6 +45,7 @@ VOID XenCtrlIfHandleEvent(); VOID XenCtrlIfSendResponse(ctrl_msg_t *Msg); +VOID XenEvtchnRegisterDisk(unsigned DiskEvtchn); VOID XenEvtchnRegisterCtrlIf(unsigned CtrlIfEvtchn); VOID XenEvtchnDisableEvents(); VOID XenEvtchnEnableEvents(); @@ -71,11 +71,14 @@ VOID XenVideoPrepareForReactOS(VOID); ULONG XenMemGetMemoryMap(PBIOS_MEMORY_MAP BiosMemoryMap, ULONG MaxMemoryMapSize); +VOID XenMemInit(start_info_t *StartInfo); +u32 XenMemVirtualToMachine(void *VirtualAddress); BOOL XenDiskReadLogicalSectors(ULONG DriveNumber, ULONGLONG SectorNumber, ULONG SectorCount, PVOID Buffer); BOOL XenDiskGetPartitionEntry(ULONG DriveNumber, ULONG PartitionNumber, PPARTITION_TABLE_ENTRY PartitionTableEntry); BOOL XenDiskGetDriveGeometry(ULONG DriveNumber, PGEOMETRY DriveGeometry); ULONG XenDiskGetCacheableBlockCount(ULONG DriveNumber); +VOID XenDiskHandleEvent(); VOID XenRTCGetCurrentDateTime(PULONG Year, PULONG Month, PULONG Day, PULONG Hour, PULONG Minute, PULONG Second); _____ Added: branches/xen/reactos/boot/freeldr/freeldr/arch/i386/xendisk.c --- branches/xen/reactos/boot/freeldr/freeldr/arch/i386/xendisk.c 2005-04-14 21:46:14 UTC (rev 14621) +++ branches/xen/reactos/boot/freeldr/freeldr/arch/i386/xendisk.c 2005-04-14 21:47:57 UTC (rev 14622) @@ -0,0 +1,523 @@ +/* + * FreeLoader + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * Based on XenoLinux drivers/xen/blkfront/blkfront.c + * Copyright (c) 2003-2004, Keir Fraser & Steve Hand + * Modifications by Mark A. Williamson are (c) Intel Research Cambridge + * Copyright (c) 2004, Christian Limpach + * Copyright (c) 2004, Andrew Warfield + * Copyright (c) 2005, Christopher Clark + * + * This file may be distributed separately from the Linux kernel, or + * incorporated into other software packages, subject to the following license: + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this source file (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, modify, + * merge, publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "freeldr.h" +#include "machxen.h" +#include "evtchn.h" +#include "io/blkif.h" +#if 2 != XEN_VER +#include "io/ring.h" +#endif /* XEN_VER */ + +#define DISK_STATE_CLOSED 0 +#define DISK_STATE_DISCONNECTED 1 +#define DISK_STATE_CONNECTED 2 + +typedef struct _XENDISKINFO +{ + ULONGLONG SectorCount; + ULONG DriveNumber; + blkif_vdev_t XenDevice; + u16 XenInfo; +} XENDISKINFO, *PXENDISKINFO; + +static BOOL XenDiskInitialized = FALSE; +static unsigned XenDiskState = DISK_STATE_CLOSED; +static unsigned XenDiskEvtchn; +#if 2 == XEN_VER +static blkif_ring_t *XenDiskRing = NULL; +static BLKIF_RING_IDX XenDiskRespCons; /* Response consumer for comms ring. */ +static BLKIF_RING_IDX XenDiskReqProd; /* Private request producer. */ +#else +static blkif_front_ring_t XenDiskRing; +#endif /* XEN_VER */ +static BOOL XenDiskRspReceived; +static unsigned XenDiskCount; +static PXENDISKINFO XenDiskInfo; + +static void *XenDiskScratchPage; +static u32 XenDiskScratchMachine; + +static void * +XenDiskAllocatePageAlignedMemory(unsigned Size) +{ + void *Area; + + Area = MmAllocateMemory(Size); + if (0 != ((ULONG_PTR) Area & (PAGE_SIZE - 1))) + { + printf("Got an unaligned page\n"); + XenDie(); + } + + return Area; +} + +/* Tell the controller to bring up the interface. */ +static void +XenDiskSendInterfaceConnect(void) +{ + ctrl_msg_t CMsg; + blkif_fe_interface_connect_t *Msg; + + CMsg.type = CMSG_BLKIF_FE, + CMsg.subtype = CMSG_BLKIF_FE_INTERFACE_CONNECT, + CMsg.length = sizeof(blkif_fe_interface_connect_t), + Msg = (void*)CMsg.msg; + + Msg->handle = 0; +#if 2 == XEN_VER + Msg->shmem_frame = (XenMemVirtualToMachine(XenDiskRing) >> PAGE_SHIFT); +#else /* XEN_VER */ + Msg->shmem_frame = (XenMemVirtualToMachine(XenDiskRing.sring) >> PAGE_SHIFT); +#endif /* XEN_VER */ + + XenCtrlIfSendMessageBlock(&CMsg); +} + +/* Move from CLOSED to DISCONNECTED state. */ +static void +XenDiskDisconnect(void) +{ +#if 2 == XEN_VER + if (NULL != XenDiskRing) + { + MmFreeMemory(XenDiskRing); + } + + XenDiskRing = (blkif_ring_t *)XenDiskAllocatePageAlignedMemory(PAGE_SIZE); + XenDiskRing->req_prod = 0; + XenDiskRing->resp_prod = 0; + XenDiskRespCons = 0; + XenDiskReqProd = 0; +#else /* XEN_VER */ + blkif_sring_t *SRing; + + if (NULL != XenDiskRing.sring) + { + MmFreeMemory(XenDiskRing.sring); + } + + SRing = (blkif_sring_t *)XenDiskAllocatePageAlignedMemory(PAGE_SIZE); + SHARED_RING_INIT(SRing); + FRONT_RING_INIT(&XenDiskRing, SRing, PAGE_SIZE); +#endif /* XEN_VER */ + + XenDiskState = DISK_STATE_DISCONNECTED; + XenDiskSendInterfaceConnect(); +} + +VOID +XenDiskHandleEvent() +{ + XenDiskRspReceived = TRUE; +} + +static void +XenDiskConnect(blkif_fe_interface_status_t *Status) +{ + XenDiskEvtchn = Status->evtchn; + XenEvtchnRegisterDisk(XenDiskEvtchn); + +#ifdef CONFIG_XEN_BLKDEV_GRANT + rdomid = status->domid; +#endif + + XenDiskState = DISK_STATE_CONNECTED; +} + +static void +XenDiskFree(void) +{ + XenDiskState = DISK_STATE_DISCONNECTED; + + /* Free resources associated with old device channel. */ +#if 2 == XEN_VER + if (NULL != XenDiskRing) + { + MmFreeMemory(XenDiskRing); + XenDiskRing = NULL; + } +#else /* XEN_VER */ + if (NULL != XenDiskRing.sring) + { + MmFreeMemory(XenDiskRing.sring); + XenDiskRing.sring = NULL; + } +#endif /* XEN_VER */ + + XenDiskEvtchn = 0; +} + +static void +XenDiskReset() +{ + XenDiskFree(); + XenDiskDisconnect(); +} + +static void +XenDiskStatus(blkif_fe_interface_status_t *Status) +{ + switch (Status->status) + { + case BLKIF_INTERFACE_STATUS_DISCONNECTED: + switch (XenDiskState) + { + case DISK_STATE_CLOSED: + XenDiskDisconnect(); + break; + case DISK_STATE_DISCONNECTED: + case DISK_STATE_CONNECTED: + /* unexpected(status); */ /* occurs during suspend/resume */ + XenDiskReset(); + break; + } + break; + + case BLKIF_INTERFACE_STATUS_CONNECTED: + switch (XenDiskState) + { + case DISK_STATE_CLOSED: + XenDiskDisconnect(); + XenDiskConnect(Status); + break; + case DISK_STATE_DISCONNECTED: + XenDiskConnect(Status); + break; + case DISK_STATE_CONNECTED: + XenDiskConnect(Status); + break; + } + break; + + default: + break; + } +} + +static void +XenDiskMsgHandler(ctrl_msg_t *Msg, unsigned long Id) +{ + switch (Msg->subtype) + { + case CMSG_BLKIF_FE_INTERFACE_STATUS: + XenDiskStatus((blkif_fe_interface_status_t *) + &Msg->msg[0]); + break; + default: + Msg->length = 0; + break; + } + + XenCtrlIfSendResponse(Msg); +} + +static void +XenDiskSendDriverStatus(BOOL Up) +{ + ctrl_msg_t CMsg; + blkif_fe_driver_status_t *Msg = (void*) CMsg.msg; + + CMsg.type = CMSG_BLKIF_FE; + CMsg.subtype = CMSG_BLKIF_FE_DRIVER_STATUS; + CMsg.length = sizeof(blkif_fe_driver_status_t); + + Msg->status = (Up ? BLKIF_DRIVER_STATUS_UP : BLKIF_DRIVER_STATUS_DOWN); + + XenCtrlIfSendMessageBlock(&CMsg); +} + +static void +XenDiskWaitForState(unsigned State) +{ + /* FIXME maybe introduce a timeout here? */ + while (TRUE) + { + XenEvtchnDisableEvents(); + if (XenDiskState == State) + { + XenEvtchnEnableEvents(); + return; + } + HYPERVISOR_block(); + } +} + +static BOOL +XenDiskControlSend(blkif_request_t *Req, blkif_response_t *Rsp) +{ +#if 2 != XEN_VER + blkif_request_t *DReq; +#endif /* XEN_VER */ + blkif_response_t *SRsp; + + while (TRUE) + { + XenEvtchnDisableEvents(); +#if 2 == XEN_VER + if (BLKIF_RING_SIZE != (XenDiskReqProd - XenDiskRespCons)) +#else /* XEN_VER */ + if (! RING_FULL(&XenDiskRing)) +#endif + { + break; + } + HYPERVISOR_block(); + } + + if (DISK_STATE_CONNECTED != XenDiskState) + { + XenEvtchnEnableEvents(); + return FALSE; + } + +#if 2 == XEN_VER + XenDiskRing->ring[MASK_BLKIF_IDX(XenDiskReqProd)].req = *Req; + XenDiskReqProd++; + XenDiskRing->req_prod = XenDiskReqProd; +#else /* XEN_VER */ + DReq = RING_GET_REQUEST(&XenDiskRing, XenDiskRing.req_prod_pvt); + *DReq = *Req; + + XenDiskRing.req_prod_pvt++; + RING_PUSH_REQUESTS(&XenDiskRing); +#endif /* XEN_VER */ + XenDiskRspReceived = FALSE; + + XenEvtchnEnableEvents(); + + notify_via_evtchn(XenDiskEvtchn); + + while (TRUE) + { + XenEvtchnDisableEvents(); + if (XenDiskRspReceived) + { + break; + } + HYPERVISOR_block(); + } + + if (DISK_STATE_CONNECTED != XenDiskState) + { + XenEvtchnEnableEvents(); + return FALSE; + } + +#if 2 == XEN_VER + SRsp = &XenDiskRing->ring[MASK_BLKIF_IDX(XenDiskRespCons)].resp; + *Rsp = *SRsp; + XenDiskRespCons++; +#else /* XEN_VER */ + SRsp = RING_GET_RESPONSE(&XenDiskRing, XenDiskRing.rsp_cons); + *Rsp = *SRsp; + XenDiskRing.rsp_cons++; +#endif /* XEN_VER */ + + XenDiskRspReceived = FALSE; + XenEvtchnEnableEvents(); + + return TRUE; +} + +static void +XenDiskProbe() +{ + blkif_response_t Rsp; + blkif_request_t Req; + unsigned Disk; + vdisk_t *Probe; + ULONG FloppyNumber, CDRomNumber, HarddiskNumber; + + memset(&Req, 0, sizeof(blkif_request_t)); + Req.operation = BLKIF_OP_PROBE; + Req.nr_segments = 1; +#ifdef CONFIG_XEN_BLKDEV_GRANT + blkif_control_probe_send(&req, &rsp, + (unsigned long)(virt_to_machine(buf))); +#else + Req.frame_and_sects[0] = XenDiskScratchMachine | 7; + + if (! XenDiskControlSend(&Req, &Rsp)) + { + printf("Unexpected disk disconnect\n"); + XenDie(); + } +#endif + + if (Rsp.status <= 0) + { + printf("Could not probe disks (%d)\n", Rsp.status); + XenDie(); + } + + XenDiskCount = Rsp.status; + XenDiskInfo = MmAllocateMemory(XenDiskCount * sizeof(XENDISKINFO)); + if (NULL == XenDiskInfo) + { + XenDie(); + } + Probe = (vdisk_t *) XenDiskScratchPage; + FloppyNumber = 0x00; + HarddiskNumber = 0x80; + CDRomNumber = 0x9f; + for (Disk = 0; Disk < XenDiskCount; Disk++) + { + XenDiskInfo[Disk].SectorCount = Probe[Disk].capacity; + switch (VDISK_TYPE(Probe[Disk].info)) + { + case VDISK_TYPE_FLOPPY: + XenDiskInfo[Disk].DriveNumber = FloppyNumber++; + break; + case VDISK_TYPE_CDROM: + XenDiskInfo[Disk].DriveNumber = CDRomNumber--; + break; + case VDISK_TYPE_DISK: + XenDiskInfo[Disk].DriveNumber = HarddiskNumber++; + break; + case VDISK_TYPE_TAPE: + case VDISK_TYPE_OPTICAL: + default: + XenDiskInfo[Disk].DriveNumber = 0xff; + break; + } + XenDiskInfo[Disk].XenDevice = Probe[Disk].device; + XenDiskInfo[Disk].XenInfo = Probe[Disk].info; + } +} + +static void +XenDiskInit() +{ + XenDiskState = DISK_STATE_CLOSED; + + if (NULL == XenDiskScratchPage) + { + XenDiskScratchPage = XenDiskAllocatePageAlignedMemory(PAGE_SIZE); + XenDiskScratchMachine = XenMemVirtualToMachine(XenDiskScratchPage); + } + + XenCtrlIfRegisterReceiver(CMSG_BLKIF_FE, XenDiskMsgHandler); + + XenDiskSendDriverStatus(TRUE); + XenDiskWaitForState(DISK_STATE_CONNECTED); + + XenDiskProbe(); +} + +BOOL +XenDiskReadLogicalSectors(ULONG DriveNumber, ULONGLONG SectorNumber, + ULONG SectorCount, PVOID Buffer) +{ + blkif_response_t Rsp; + blkif_request_t Req; + ULONG SectorSize; + ULONG Count; + BOOL Found; + unsigned Disk; + blkif_vdev_t Device; + + if (! XenDiskInitialized) + { + XenDiskInitialized = TRUE; + XenDiskInit(); + } + + Found = FALSE; + Device = 0; + for (Disk = 0; Disk < XenDiskCount && ! Found; Disk++) + { + if (DriveNumber == XenDiskInfo[Disk].DriveNumber) + { + Device = XenDiskInfo[Disk].XenDevice; + Found = TRUE; + } + } + if (! Found) + { + return FALSE; + } + + SectorSize = 512; + while (0 < SectorCount) + { + Count = SectorCount; + if (PAGE_SIZE / SectorSize < Count) + { + Count = PAGE_SIZE / SectorSize; + } + memset(&Req, 0, sizeof(blkif_request_t)); + Req.operation = BLKIF_OP_READ; + Req.nr_segments = 1; + Req.device = Device; + Req.id = 0; + Req.sector_number = SectorNumber; +#ifdef CONFIG_XEN_BLKDEV_GRANT + blkif_control_probe_send(&req, &rsp, + (unsigned long)(virt_to_machine(buf))); +#else + Req.frame_and_sects[0] = XenDiskScratchMachine | (Count - 1); + + if (! XenDiskControlSend(&Req, &Rsp)) + { + return FALSE; + } +#endif + if (BLKIF_RSP_OKAY != Rsp.status) + { + return FALSE; + } + memcpy(Buffer, XenDiskScratchPage, Count * SectorSize); + SectorCount -= Count; + SectorNumber += Count; + Buffer = (void *)((char *) Buffer + Count * SectorSize); + } + + return TRUE; +} + +/* EOF */ Property changes on: branches/xen/reactos/boot/freeldr/freeldr/arch/i386/xendisk.c ___________________________________________________________________ Name: svn:keywords + Author Date Id Revision Name: svn:eol-style + native _____ Modified: branches/xen/reactos/boot/freeldr/freeldr/arch/i386/xenevtchn.c --- branches/xen/reactos/boot/freeldr/freeldr/arch/i386/xenevtchn.c 2005-04-14 21:46:14 UTC (rev 14621) +++ branches/xen/reactos/boot/freeldr/freeldr/arch/i386/xenevtchn.c 2005-04-14 21:47:57 UTC (rev 14622) @@ -46,17 +46,16 @@ #define asmlinkage __attribute__((regparm(0))) -static unsigned XenCtrlIfIndex; +static int XenCtrlIfIndex = -1; static u32 XenCtrlIfBit; +static int XenDiskIndex = -1; +static u32 XenDiskBit; -VOID -XenEvtchnRegisterCtrlIf(unsigned CtrlIfEvtchn) +static void +XenEvtchnSetMask() { unsigned i; - XenCtrlIfIndex = CtrlIfEvtchn >> 5; - XenCtrlIfBit = 1 << (CtrlIfEvtchn & 0x1f); - /* Mask all event channels except the one we're interested in */ for (i = 0; i < sizeof(XenSharedInfo->evtchn_mask) @@ -65,8 +64,19 @@ { if (i == XenCtrlIfIndex) { - XenSharedInfo->evtchn_mask[i] = ~ XenCtrlIfBit; + if (i == XenDiskIndex) + { + XenSharedInfo->evtchn_mask[i] = ~ (XenCtrlIfBit | XenDiskBit); + } + else + { + XenSharedInfo->evtchn_mask[i] = ~ XenCtrlIfBit; + } } + else if (i == XenDiskIndex) + { + XenSharedInfo->evtchn_mask[i] = ~ XenDiskBit; + } else { XenSharedInfo->evtchn_mask[i] = ~ 0; @@ -74,6 +84,24 @@ } } +VOID +XenEvtchnRegisterCtrlIf(unsigned CtrlIfEvtchn) +{ + XenCtrlIfIndex = CtrlIfEvtchn >> 5; + XenCtrlIfBit = 1 << (CtrlIfEvtchn & 0x1f); + + XenEvtchnSetMask(); +} + +VOID +XenEvtchnRegisterDisk(unsigned DiskEvtchn) +{ + XenDiskIndex = DiskEvtchn >> 5; + XenDiskBit = 1 << (DiskEvtchn & 0x1f); + + XenEvtchnSetMask(); +} + /* NB. Event delivery is disabled on entry. */ asmlinkage void XenEvtchnDoUpcall(struct pt_regs *Regs) @@ -85,12 +113,31 @@ XenSharedInfo->vcpu_data[0].evtchn_pending_sel = 0; #endif /* XEN_VER */ - while (0 != (XenSharedInfo->evtchn_pending[XenCtrlIfIndex] - & ~ XenSharedInfo->evtchn_mask[XenCtrlIfIndex] - & XenCtrlIfBit)) + while ((0 <= XenDiskIndex + && 0 != (XenSharedInfo->evtchn_pending[XenDiskIndex] + & ~ XenSharedInfo->evtchn_mask[XenDiskIndex] + & XenDiskBit)) || + (0 <= XenCtrlIfIndex + && 0 != (XenSharedInfo->evtchn_pending[XenCtrlIfIndex] + & ~ XenSharedInfo->evtchn_mask[XenCtrlIfIndex] + & XenCtrlIfBit))) { - XenSharedInfo->evtchn_pending[XenCtrlIfIndex] &= ~ XenCtrlIfBit; - XenCtrlIfHandleEvent(); + if (0 <= XenDiskIndex + && 0 != (XenSharedInfo->evtchn_pending[XenDiskIndex] + & ~ XenSharedInfo->evtchn_mask[XenDiskIndex] + & XenDiskBit)) + { + XenSharedInfo->evtchn_pending[XenDiskIndex] &= ~ XenDiskBit; + XenDiskHandleEvent(); + } + if (0 <= XenCtrlIfIndex + && 0 != (XenSharedInfo->evtchn_pending[XenCtrlIfIndex] + & ~ XenSharedInfo->evtchn_mask[XenCtrlIfIndex] + & XenCtrlIfBit)) + { + XenSharedInfo->evtchn_pending[XenCtrlIfIndex] &= ~ XenCtrlIfBit; + XenCtrlIfHandleEvent(); + } } } _____ Modified: branches/xen/reactos/boot/freeldr/freeldr/arch/i386/xenmem.c --- branches/xen/reactos/boot/freeldr/freeldr/arch/i386/xenmem.c 2005-04-14 21:46:14 UTC (rev 14621) +++ branches/xen/reactos/boot/freeldr/freeldr/arch/i386/xenmem.c 2005-04-14 21:47:57 UTC (rev 14622) @@ -26,13 +26,13 @@ /* Page Directory Entry */ typedef struct _PDE { - unsigned long Pde; + u32 Pde; } PDE, *PPDE; /* Page Table Entry */ typedef struct _PTE { - unsigned long Pte; + u32 Pte; } PTE, *PPTE; #define PGDIR_SHIFT 22 @@ -308,4 +308,15 @@ } } +u32 +XenMemVirtualToMachine(void *VirtualAddress) +{ + PPTE PageTable; + + PageTable = (PPTE)((char *) XenPageDir + + (PD_IDX((ULONG_PTR) VirtualAddress) + 1) * PAGE_SIZE); + return PageTable[PT_IDX((ULONG_PTR) VirtualAddress)].Pte + & PAGE_MASK; +} + /* EOF */
19 years, 8 months
1
0
0
0
[ea] 14621: Simple Win32/text application to query the SM (incomplete/untested).
by ea@svn.reactos.com
Simple Win32/text application to query the SM (incomplete/untested). Added: trunk/reactos/subsys/system/sm/ Added: trunk/reactos/subsys/system/sm/makefile Added: trunk/reactos/subsys/system/sm/sm.c Added: trunk/reactos/subsys/system/sm/sm.rc _____ Added: trunk/reactos/subsys/system/sm/makefile --- trunk/reactos/subsys/system/sm/makefile 2005-04-14 20:32:00 UTC (rev 14620) +++ trunk/reactos/subsys/system/sm/makefile 2005-04-14 21:46:14 UTC (rev 14621) @@ -0,0 +1,28 @@ +# $Id$ +# +# ReactOS Win32 SM Query Tool +# +PATH_TO_TOP = ../../.. +TOOLS_PATH = $(PATH_TO_TOP)/tools + +TARGET_TYPE = program + +TARGET_APPTYPE = console + +TARGET_NAME = sm + +TARGET_INSTALLDIR = system32 + +TARGET_CFLAGS = -D__USE_W32API -DANONYMOUSUNIONS -Wall -Werror + +TARGET_OBJECTS = $(TARGET_NAME).o + +TARGET_SDKLIBS = smdll.a ntdll.a + +include $(PATH_TO_TOP)/rules.mak + +include $(TOOLS_PATH)/helper.mk + +include $(TOOLS_PATH)/depend.mk + +# EOF _____ Added: trunk/reactos/subsys/system/sm/sm.c --- trunk/reactos/subsys/system/sm/sm.c 2005-04-14 20:32:00 UTC (rev 14620) +++ trunk/reactos/subsys/system/sm/sm.c 2005-04-14 21:46:14 UTC (rev 14621) @@ -0,0 +1,239 @@ +/* + * ReactOS Win32 Applications + * Copyright (C) 2005 ReactOS Team + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ +/* $Id$ + * + * COPYRIGHT : See COPYING in the top level directory + * PROJECT : ReactOS/Win32 Session Manager Control Tool + * FILE : subsys/system/sm/sm.c + * PROGRAMMER: Emanuele Aliberti (ea(a)reactos.com) + */ +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +#define NTOS_MODE_USER +#include <ntos.h> +#include <sm/helper.h> + +#define SM_CMD(n) cmd_##n +#define SM_CMD_DECL(n) int SM_CMD(n)(int argc, char * argv[]) +#define SM_CMD_CALL(n,c,v) SM_CMD(n)((c),(v)) + +HANDLE hSmApiPort = (HANDLE) 0; + +typedef struct _SM_CMD_DESCRIPTOR +{ + const char * Name; + int (*EntryPoint)(int,char**); + const char * Synopsis; + const char * Description; + +} SM_CMD_DESCRIPTOR, *PSM_CMD_DESCRIPTOR; + +SM_CMD_DECL(boot); +SM_CMD_DECL(help); +SM_CMD_DECL(info); +SM_CMD_DECL(reboot); +SM_CMD_DECL(shutdown); + +/* internal commands directory */ +SM_CMD_DESCRIPTOR Command [] = +{ + {"boot", SM_CMD(boot), "boot subsystem_name", "bootstrap an optional environment subsystem;"}, + {"help", SM_CMD(help), "help [command]", "print help for command;"}, + {"info", SM_CMD(info), "info [subsystem_id]", "print information about a booted subsystem\n" + "if subsystem_id is omitted, a list of booted\n" + "environment subsystems is printed."}, + {"reboot", SM_CMD(reboot), "reboot subsystem_id", "reboot an optional environment subsystem;"}, + {"shutdown", SM_CMD(shutdown), "shutdown subsystem_id", "shutdown an optional environment subsystem;"}, +}; + +PSM_CMD_DESCRIPTOR LookupCommand (const char * CommandName) +{ + int i; + const int command_count = (sizeof Command / sizeof Command[0]); + + /* parse the command... */ + + for (i=0; (i < command_count); i ++) + { + if (0 == strcmp(CommandName, Command[i].Name)) + { + break; + } + } + if (i == command_count) + { + fprintf(stderr, "Unknown command '%s'.\n", CommandName); + return NULL; + } + return & Command [i]; +} + +/* user commands */ + +SM_CMD_DECL(boot) +{ + int rc = EXIT_SUCCESS; + ANSI_STRING ProgramA; + UNICODE_STRING ProgramW; + NTSTATUS Status = STATUS_SUCCESS; + + if (3 == argc) + { + RtlInitAnsiString (& ProgramA, argv[2]); + RtlAnsiStringToUnicodeString (& ProgramW, & ProgramA, TRUE); + Status = SmExecuteProgram (hSmApiPort, & ProgramW); + RtlFreeUnicodeString (& ProgramW); + if (STATUS_SUCCESS != Status) + { + printf ("Status 0x%08lx\n", Status); + } + } + else + { + argv[2]="boot"; + return SM_CMD_CALL(help,3,argv); + } + return rc; +} + +SM_CMD_DECL(help) +{ + int i = 0; + PSM_CMD_DESCRIPTOR cmd = NULL; + int rc = EXIT_SUCCESS; + + switch (argc) + { + case 2: + for (i=0; (i < (sizeof Command / sizeof Command[0])); i ++) + { + printf("%s\n", Command[i].Synopsis); + } + break; + case 3: + cmd = LookupCommand (argv[2]); + if (NULL == cmd) + { + rc = EXIT_FAILURE; + break; + } + printf("%s\n%s\n\n%s\n", + cmd->Name, + cmd->Synopsis, + cmd->Description); + break; + } + return rc; +} + +SM_CMD_DECL(info) +{ + int rc = EXIT_SUCCESS; + NTSTATUS Status = STATUS_SUCCESS; + SM_BASIC_INFORMATION bi = {0,}; + ULONG ReturnDataLength = sizeof bi; + + Status = SmQueryInformation (hSmApiPort, + SmBasicInformation, + & bi, + sizeof bi, + & ReturnDataLength); + if (STATUS_SUCCESS == Status) + { + int i = 0; + + printf ("SSID PID Flags\n"); + for (i = 0; i < bi.SubSystemCount; i ++) + { + printf ("%04x %08lx %04x\n", + bi.SubSystem[i].Id, + bi.SubSystem[i].ProcessId, + bi.SubSystem[i].Flags); + } + } + else + { + printf ("Status 0x%08lx\n", Status); + rc = EXIT_FAILURE; + } + return rc; +} + +SM_CMD_DECL(shutdown) +{ + int rc = EXIT_SUCCESS; + + fprintf(stderr,"not implemented\n"); + return rc; +} + +SM_CMD_DECL(reboot) +{ + int rc = SM_CMD(shutdown)(argc,argv); + if(EXIT_SUCCESS == rc) + { + rc = SM_CMD(boot)(argc,argv); + } + return rc; +} + +/* print command's synopsys */ +int print_synopsys (int argc, char *argv[]) +{ + fprintf (stderr, "ReactOS/Win32 Session Manager Control Tool\n\n"); + printf ("Usage:\n" + "\tsm\n" + "\tsm help [command]\n" + "\tsm command [arguments]\n\n" + "'sm help' will print the list of valid commands.\n"); + return EXIT_SUCCESS; +} + +/* parse and execute */ +int pande (int argc, char *argv[]) +{ + PSM_CMD_DESCRIPTOR Command = NULL; + NTSTATUS Status = STATUS_SUCCESS; + + /* Lookup the user command... */ + Command = LookupCommand (argv[1]); + if (NULL == Command) + { + return EXIT_FAILURE; + } + /* Connect to the SM in non-registering mode. */ + Status = SmConnectApiPort (0, 0, 0, & hSmApiPort); + if (STATUS_SUCCESS == Status) + { + /* ...and execute it */ + return Command->EntryPoint (argc, argv); + } + fprintf (stderr, "Failed to connect to the Session Manager! (Status=0x%08lx)\n", Status); + return EXIT_FAILURE; +} + +int main (int argc, char *argv[]) +{ + return (1==argc) + ? print_synopsys (argc, argv) + : pande (argc, argv); +} +/* EOF */ _____ Added: trunk/reactos/subsys/system/sm/sm.rc --- trunk/reactos/subsys/system/sm/sm.rc 2005-04-14 20:32:00 UTC (rev 14620) +++ trunk/reactos/subsys/system/sm/sm.rc 2005-04-14 21:46:14 UTC (rev 14621) @@ -0,0 +1,4 @@ +#define REACTOS_STR_FILE_DESCRIPTION "ReactOS/Win32 Session Manager Control Tool\0" +#define REACTOS_STR_INTERNAL_NAME "sm\0" +#define REACTOS_STR_ORIGINAL_FILENAME "sm.exe\0" +#include <reactos/version.rc>
19 years, 8 months
1
0
0
0
[mf] 14620: charn <charn89@hotmail.com>:
by mf@svn.reactos.com
charn <charn89(a)hotmail.com>: A function for desktopbar.cpp that controls how the taskbar can be resized. Modified: trunk/reactos/subsys/system/explorer/taskbar/desktopbar.cpp Modified: trunk/reactos/subsys/system/explorer/taskbar/desktopbar.h _____ Modified: trunk/reactos/subsys/system/explorer/taskbar/desktopbar.cpp --- trunk/reactos/subsys/system/explorer/taskbar/desktopbar.cpp 2005-04-14 20:23:02 UTC (rev 14619) +++ trunk/reactos/subsys/system/explorer/taskbar/desktopbar.cpp 2005-04-14 20:32:00 UTC (rev 14620) @@ -69,7 +69,7 @@ RECT rect; - rect.left = -2; // hide left border + rect.left = -2; // hide left border #ifdef TASKBAR_AT_TOP rect.top = -2; // hide top border #else @@ -105,7 +105,7 @@ // create task bar _hwndTaskBar = TaskBar::Create(_hwnd); -#ifndef __MINGW32__ // SHRestricted() missing in MinGW (as of 29.10.2003) +#ifndef __MINGW32__ // SHRestricted() missing in MinGW (as of 29.10.2003) if (!g_Globals._SHRestricted || !SHRestricted(REST_NOTRAYITEMSDISPLAY)) #endif // create tray notification area @@ -222,6 +222,10 @@ Resize(LOWORD(lparam), HIWORD(lparam)); break; + case WM_SIZING: + ControlResize(wparam, lparam); + break; + case PM_RESIZE_CHILDREN: { ClientRect size(_hwnd); Resize(size.right, size.bottom); @@ -336,7 +340,7 @@ g_Globals._desktops.SwitchToDesktop(desktop_idx); - if (_hwndQuickLaunch) + if (_hwndQuickLaunch) PostMessage(_hwndQuickLaunch, PM_UPDATE_DESKTOP, desktop_idx, 0); break;} @@ -391,6 +395,35 @@ } +void DesktopBar::ControlResize(WPARAM wparam, LPARAM lparam) +{ + PRECT dragRect = (PRECT) lparam; + //int screenWidth = GetSystemMetrics(SM_CXSCREEN); + int screenHeight = GetSystemMetrics(SM_CYSCREEN); + + ///@todo write code for taskbar being at sides or top. + + switch(wparam) { + case WMSZ_BOTTOM: //@todo Taskbar is at the top of the screen + break; + + case WMSZ_TOP: // Taskbar is at the bottom of the screen + dragRect->top = screenHeight - (((screenHeight - dragRect->top) + DESKTOPBARBAR_HEIGHT/2) / DESKTOPBARBAR_HEIGHT) * DESKTOPBARBAR_HEIGHT; + if (dragRect->top < screenHeight / 2) + dragRect->top = screenHeight - (screenHeight/2 / DESKTOPBARBAR_HEIGHT * DESKTOPBARBAR_HEIGHT); + else if (dragRect->top > screenHeight - 5) + dragRect->top = screenHeight - 5; + break; + + case WMSZ_RIGHT: //@todo Taskbar is at the left of the screen + break; + + case WMSZ_LEFT: //@todo Taskbar is at the right of the screen + break; + } +} + + #ifdef _ROS_ void DesktopBar::AddTrayIcons() @@ -403,7 +436,7 @@ switch(id) { case ID_TRAY_VOLUME: if (btn == TRAYBUTTON_LEFT) - SetTimer(_hwnd, ID_TRAY_VOLUME, 500, NULL); // wait a bit to correctly handle double clicks + SetTimer(_hwnd, ID_TRAY_VOLUME, 500, NULL); // wait a bit to correctly handle double clicks else { PopupMenu menu(IDM_VOLUME); SetMenuDefaultItem(menu, 0, MF_BYPOSITION); _____ Modified: trunk/reactos/subsys/system/explorer/taskbar/desktopbar.h --- trunk/reactos/subsys/system/explorer/taskbar/desktopbar.h 2005-04-14 20:23:02 UTC (rev 14619) +++ trunk/reactos/subsys/system/explorer/taskbar/desktopbar.h 2005-04-14 20:32:00 UTC (rev 14620) @@ -92,6 +92,7 @@ int Command(int id, int code); void Resize(int cx, int cy); + void ControlResize(WPARAM wparam, LPARAM lparam); void RegisterHotkeys(); void ProcessHotKey(int id_hotkey); void ShowStartMenu();
19 years, 8 months
1
0
0
0
[mf] 14619: from ThomasLa <sikker2004@yahoo.com>:
by mf@svn.reactos.com
from ThomasLa <sikker2004(a)yahoo.com>: Corrected DE.rc language controls Modifed EN.rc implemented part of screensaver functions Shows Screensavers Get Some Values from registry get default screensaver implemented delete screensavers Modified: trunk/reactos/lib/cpl/desk/de.rc Modified: trunk/reactos/lib/cpl/desk/en.rc Modified: trunk/reactos/lib/cpl/desk/resource.h Modified: trunk/reactos/lib/cpl/desk/screensaver.c _____ Modified: trunk/reactos/lib/cpl/desk/de.rc --- trunk/reactos/lib/cpl/desk/de.rc 2005-04-14 15:47:03 UTC (rev 14618) +++ trunk/reactos/lib/cpl/desk/de.rc 2005-04-14 20:23:02 UTC (rev 14619) @@ -9,13 +9,13 @@ 150,105,WS_EX_STATICEDGE CONTROL "",IDC_BACKGROUND_LIST,"SysListView32",LVS_REPORT | LVS_SINGLESEL | LVS_NOCOLUMNHEADER | LVS_SHAREIMAGELISTS | - WS_BORDER | WS_TABSTOP,7,139,170,71 + WS_BORDER | WS_TABSTOP,7,139,173,71 LTEXT "Hintergrundbild:", IDC_STATIC,8,127,180,8 - PUSHBUTTON "&Durchsuchen...",IDC_BROWSE_BUTTON,181,175,60,14 - PUSHBUTTON "&Farbe...",IDC_COLOR_BUTTON,181,195,60,14 - LTEXT "Ausrichtung:",IDC_STATIC,181,138,45,8 - COMBOBOX IDC_PLACEMENT_COMBO,181,148,60,90,CBS_DROPDOWNLIST | + PUSHBUTTON "&Durchsuchen...",IDC_BROWSE_BUTTON,186,175,56,14 + PUSHBUTTON "&Farbe...",IDC_COLOR_BUTTON,186,195,56,14 + LTEXT "Ausrichtung:",IDC_STATIC,186,138,43,8 + COMBOBOX IDC_PLACEMENT_COMBO,186,148,50,90,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP END _____ Modified: trunk/reactos/lib/cpl/desk/en.rc --- trunk/reactos/lib/cpl/desk/en.rc 2005-04-14 15:47:03 UTC (rev 14618) +++ trunk/reactos/lib/cpl/desk/en.rc 2005-04-14 20:23:02 UTC (rev 14619) @@ -24,8 +24,32 @@ CAPTION "Screen Saver" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "This space is intentionally left blank",IDC_STATIC,66, - 110,112,8 + GROUPBOX "&Screen Saver",IDC_SCREENS_DUMMY, 5, 7, 238, 176 + + LTEXT "List of Screensavers:",IDC_STATIC,13, 24, 71, 9 + CONTROL "",IDC_SCREENS_CHOICES,"SysListView32",LVS_REPORT | + LVS_SINGLESEL | LVS_NOCOLUMNHEADER | LVS_SHAREIMAGELISTS | + WS_BORDER | WS_TABSTOP,13, 34, 171, 109 + PUSHBUTTON "&Delete",IDC_SCREENS_DELETE, 189,47,39,10 + PUSHBUTTON "&Add",IDC_SCREENS_POWER_BUTTON, 190,34,39,10 + + PUSHBUTTON "Se&ttings...",IDC_SCREENS_SETTINGS,140, 164, 48, 12,WS_GROUP + PUSHBUTTON "Pre&view",IDC_SCREENS_TESTSC,192, 164, 43, 12 + + CONTROL "On Resume, &Password Protect.",IDC_SCREENS_USEPASSCHK,"button", + BS_AUTOCHECKBOX | WS_TABSTOP,13, 161, 119, 18 + + LTEXT "&Wait:",IDC_STATIC,13, 150, 17, 9 + EDITTEXT IDC_SCREENS_TIMEDELAY,33, 149, 31, 12,ES_RIGHT | WS_GROUP + CONTROL "",IDC_SCREENS_TIME ,UPDOWN_CLASS,UDS_SETBUDDYINT | + UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | + WS_BORDER | WS_GROUP,52, 149, 12, 12 + LTEXT "Minutes before showing Screensaver.",IDC_STATIC,70, 151, 147, 9 + + GROUPBOX "&Energy Saving features of monitor",IDC_SCREENS_DUMMY,5, 186, 238, 35 + LTEXT "To adjust the power settings for your monitor, click on Power Settings.", + IDC_STATIC,16, 199, 155, 19 + PUSHBUTTON "P&ower Settings",IDC_SCREENS_POWER_BUTTON,180, 202, 57, 12 END IDD_APPEARANCE DIALOGEX DISCARDABLE 0, 0, 246, 228 _____ Modified: trunk/reactos/lib/cpl/desk/resource.h --- trunk/reactos/lib/cpl/desk/resource.h 2005-04-14 15:47:03 UTC (rev 14618) +++ trunk/reactos/lib/cpl/desk/resource.h 2005-04-14 20:23:02 UTC (rev 14619) @@ -28,6 +28,18 @@ #define IDC_COLOR_BUTTON 1003 #define IDC_PLACEMENT_COMBO 1004 +/* Screensaver Page */ +#define IDC_SCREENS_CHOICES 1010 +#define IDC_SCREENS_PREVIEW 1011 +#define IDC_SCREENS_POWER_BUTTON 1012 +#define IDC_SCREENS_SETTINGS 1013 +#define IDC_SCREENS_TESTSC 1014 +#define IDC_SCREENS_USEPASSCHK 1015 +#define IDC_SCREENS_TIMEDELAY 1016 +#define IDC_SCREENS_TIME 1017 +#define IDC_SCREENS_DELETE 1018 +#define IDC_SCREENS_DUMMY 5000 + #define IDS_CPLNAME 2000 #define IDS_CPLDESCRIPTION 2001 _____ Modified: trunk/reactos/lib/cpl/desk/screensaver.c --- trunk/reactos/lib/cpl/desk/screensaver.c 2005-04-14 15:47:03 UTC (rev 14618) +++ trunk/reactos/lib/cpl/desk/screensaver.c 2005-04-14 20:23:02 UTC (rev 14619) @@ -12,23 +12,301 @@ #include <commctrl.h> #include "resource.h" +#include <cpl.h> +#include <tchar.h> +#include "desk.h" -INT_PTR CALLBACK ScreenSaverPageProc(HWND hwndDlg, - UINT uMsg, - WPARAM wParam, - LPARAM lParam) +#define MAX_SCREENSAVERS 100 + +void AddListViewItems2(); +void CheckRegScreenSaverIsSecure(); + +typedef struct { + BOOL bIsScreenSaver; /* Is this background a wallpaper */ + TCHAR szFilename[MAX_PATH]; + TCHAR szDisplayName[256]; +} ScreenSaverItem; + +int ImageListSelection = 0; +ScreenSaverItem g_ScreenSaverItems[MAX_SCREENSAVERS]; + +HWND g_hScreenBackgroundPage = NULL; +HWND g_hScreengroundList = NULL; +HWND ControlScreenSaverIsSecure = NULL; + +void ListViewItemAreChanged(int itemIndex) { - switch(uMsg) - { + ScreenSaverItem *ScreenSaverItem = NULL; + + ImageListSelection = itemIndex; + ScreenSaverItem = &g_ScreenSaverItems[ImageListSelection]; + + PropSheet_Changed(GetParent(g_hScreenBackgroundPage), g_hScreenBackgroundPage); +} + +INT_PTR +CALLBACK +ScreenSaverPageProc(HWND hwndDlg, + UINT uMsg, + WPARAM wParam, + LPARAM lParam) +{ + g_hScreenBackgroundPage = hwndDlg; + + switch(uMsg) { case WM_INITDIALOG: - { - } break; - + { + g_hScreengroundList = GetDlgItem(g_hScreenBackgroundPage, IDC_SCREENS_CHOICES); + AddListViewItems2(); + CheckRegScreenSaverIsSecure(); + } break; case WM_COMMAND: - { + { + DWORD controlId = LOWORD(wParam); + DWORD command = HIWORD(wParam); + + switch(controlId) { + case IDC_SCREENS_POWER_BUTTON: // Start Powercfg.Cpl + { + if(command == BN_CLICKED) + WinExec("rundll32 shell32.dll,Control_RunDLL powercfg.cpl,,",SW_SHOWNORMAL); + } break; + case IDC_SCREENS_TESTSC: // Screensaver Preview + { + if(command == BN_CLICKED) + MessageBox(NULL, TEXT("That button doesn't do anything yet"), TEXT("Whoops"), MB_OK); + + } break; + case IDC_SCREENS_DELETE: // Delete Screensaver + { + if(command == BN_CLICKED) { + if (ImageListSelection == 0) // Can NOT delete None sry:-) + return FALSE; + DeleteFileW(g_ScreenSaverItems[ImageListSelection].szFilename); + } + } break; + case IDC_SCREENS_SETTINGS: // Screensaver Settings + { + if(command == BN_CLICKED) + MessageBox(NULL, TEXT("That button doesn't do anything yet"), TEXT("Whoops"), MB_OK); + } break; + case IDC_SCREENS_USEPASSCHK: // Screensaver Is Secure + { + if(command == BN_CLICKED) + MessageBox(NULL, TEXT("That button doesn't do anything yet"), TEXT("Whoops"), MB_OK); + } break; + case IDC_SCREENS_TIME: // Delay before show screensaver + { + } break; + default: + break; } break; + } + case WM_NOTIFY: + { + LPNMHDR lpnm = (LPNMHDR)lParam; + + switch(lpnm->code) { + case PSN_APPLY: + { + return TRUE; + } break; + case LVN_ITEMCHANGED: + { + LPNMLISTVIEW nm = (LPNMLISTVIEW)lParam; + if((nm->uNewState & LVIS_SELECTED) == 0) + return FALSE; + ListViewItemAreChanged(nm->iItem); + break; + } break; + default: + break; + } + } break; } return FALSE; } +void CheckRegScreenSaverIsSecure() +{ + HKEY hKey; + TCHAR szBuffer[2]; + DWORD bufferSize = sizeof(szBuffer); + DWORD varType = REG_SZ; + LONG result; + + ControlScreenSaverIsSecure = GetDlgItem(g_hScreenBackgroundPage, IDC_SCREENS_USEPASSCHK); + + RegOpenKeyEx(HKEY_CURRENT_USER, TEXT("Control Panel\\Desktop"), 0, KEY_ALL_ACCESS, &hKey); + result = RegQueryValueEx(hKey, TEXT("ScreenSaverIsSecure"), 0, &varType, (LPBYTE)szBuffer, &bufferSize); + if(result == ERROR_SUCCESS) + if(_ttoi(szBuffer) == 1) { + SendMessage(ControlScreenSaverIsSecure, BM_SETCHECK, (WPARAM)BST_CHECKED, 0); + goto End; + } + SendMessage(ControlScreenSaverIsSecure, BM_SETCHECK, (WPARAM)BST_UNCHECKED, 0); +End: + RegCloseKey(hKey); +} + +/* Add the bitmaps in the C:\ReactOS directory and the current wallpaper if any */ +void AddListViewItems2() +{ + WIN32_FIND_DATA fd; + HANDLE hFind; + TCHAR szSearchPath[MAX_PATH]; + LV_ITEM listItem; + LV_COLUMN dummy; + RECT clientRect; + HKEY regKey; + SHFILEINFO sfi; + HIMAGELIST himl; + HIMAGELIST g_hScreenShellImageList = NULL; + TCHAR wallpaperFilename[MAX_PATH]; + DWORD bufferSize = sizeof(wallpaperFilename); + DWORD varType = REG_SZ; + LONG result; + UINT i = 0; + int g_ScreenlistViewItemCount = 0; + ScreenSaverItem *ScreenSaverItem = NULL; + + GetClientRect(g_hScreengroundList, &clientRect); + + ZeroMemory(&dummy, sizeof(LV_COLUMN)); + dummy.mask = LVCF_SUBITEM | LVCF_WIDTH; + dummy.iSubItem = 0; + dummy.cx = (clientRect.right - clientRect.left) - GetSystemMetrics(SM_CXVSCROLL); + + ListView_InsertColumn(g_hScreengroundList, 0, &dummy); + + /* Add the "None" item */ + ScreenSaverItem = &g_ScreenSaverItems[g_ScreenlistViewItemCount]; + + ScreenSaverItem->bIsScreenSaver = FALSE; + + LoadString(hApplet, + IDS_NONE, + ScreenSaverItem->szDisplayName, + sizeof(ScreenSaverItem->szDisplayName) / sizeof(TCHAR)); + + ZeroMemory(&listItem, sizeof(LV_ITEM)); + listItem.mask = LVIF_TEXT | LVIF_PARAM | LVIF_STATE | LVIF_IMAGE; + listItem.state = LVIS_SELECTED; + listItem.pszText = ScreenSaverItem->szDisplayName; + listItem.iImage = -1; + listItem.iItem = g_ScreenlistViewItemCount; + listItem.lParam = g_ScreenlistViewItemCount; + + ListView_InsertItem(g_hScreengroundList, &listItem); + ListView_SetItemState(g_hScreengroundList, g_ScreenlistViewItemCount, LVIS_SELECTED, LVIS_SELECTED); + + g_ScreenlistViewItemCount++; + + /* Add current screensaver if any */ + RegOpenKeyEx(HKEY_CURRENT_USER, TEXT("Control Panel\\Desktop"), 0, KEY_ALL_ACCESS, ®Key); + + result = RegQueryValueEx(regKey, TEXT("SCRNSAVE.EXE"), 0, &varType, (LPBYTE)wallpaperFilename, &bufferSize); + + if((result == ERROR_SUCCESS) && (_tcslen(wallpaperFilename) > 0)) + { + himl = (HIMAGELIST)SHGetFileInfo(wallpaperFilename, + 0, + &sfi, + sizeof(sfi), + SHGFI_SYSICONINDEX | SHGFI_SMALLICON | + SHGFI_DISPLAYNAME); + + if(himl != NULL) + { + if(i++ == 0) + { + g_hScreenShellImageList = himl; + ListView_SetImageList(g_hScreengroundList, himl, LVSIL_SMALL); + } + + ScreenSaverItem = &g_ScreenSaverItems[g_ScreenlistViewItemCount]; + + ScreenSaverItem->bIsScreenSaver = TRUE; + + _tcscpy(ScreenSaverItem->szDisplayName, sfi.szDisplayName); + _tcscpy(ScreenSaverItem->szFilename, wallpaperFilename); + + ZeroMemory(&listItem, sizeof(LV_ITEM)); + listItem.mask = LVIF_TEXT | LVIF_PARAM | LVIF_STATE | LVIF_IMAGE; + listItem.state = LVIS_SELECTED; + listItem.pszText = ScreenSaverItem->szDisplayName; + listItem.iImage = sfi.iIcon; + listItem.iItem = g_ScreenlistViewItemCount; + listItem.lParam = g_ScreenlistViewItemCount; + + ListView_InsertItem(g_hScreengroundList, &listItem); + ListView_SetItemState(g_hScreengroundList, g_ScreenlistViewItemCount, LVIS_SELECTED, LVIS_SELECTED); + + g_ScreenlistViewItemCount++; + } + } + + RegCloseKey(regKey); + + /* Add all the screensavers in the C:\ReactOS\System32 directory. */ + + GetSystemDirectory(szSearchPath, MAX_PATH); + _tcscat(szSearchPath, TEXT("\\*.scr")); + + hFind = FindFirstFile(szSearchPath, &fd); + while(hFind != INVALID_HANDLE_VALUE) + { + /* Don't add any hidden screensavers */ + if((fd.dwFileAttributes & FILE_ATTRIBUTE_HIDDEN) == 0) + { + TCHAR filename[MAX_PATH]; + + GetSystemDirectory(filename, MAX_PATH); + + _tcscat(filename, TEXT("\\")); + _tcscat(filename, fd.cFileName); + + himl = (HIMAGELIST)SHGetFileInfo(filename, + 0, + &sfi, + sizeof(sfi), + SHGFI_SYSICONINDEX | SHGFI_SMALLICON | + SHGFI_DISPLAYNAME); + + if(himl == NULL) + { + break; + } + + if(i++ == 0) + { + g_hScreenShellImageList = himl; + ListView_SetImageList(g_hScreengroundList, himl, LVSIL_SMALL); + } + + ScreenSaverItem = &g_ScreenSaverItems[g_ScreenlistViewItemCount]; + + ScreenSaverItem->bIsScreenSaver = TRUE; + + _tcscpy(ScreenSaverItem->szDisplayName, sfi.szDisplayName); + _tcscpy(ScreenSaverItem->szFilename, filename); + + ZeroMemory(&listItem, sizeof(LV_ITEM)); + listItem.mask = LVIF_TEXT | LVIF_PARAM | LVIF_STATE | LVIF_IMAGE; + listItem.pszText = ScreenSaverItem->szDisplayName; + listItem.state = 0; + listItem.iImage = sfi.iIcon; + listItem.iItem = g_ScreenlistViewItemCount; + listItem.lParam = g_ScreenlistViewItemCount; + + ListView_InsertItem(g_hScreengroundList, &listItem); + + g_ScreenlistViewItemCount++; + } + + if(!FindNextFile(hFind, &fd)) + hFind = INVALID_HANDLE_VALUE; + } +} +
19 years, 8 months
1
0
0
0
[weiden] 14618: add some missing gdi functions to the driver function table
by weiden@svn.reactos.com
add some missing gdi functions to the driver function table Modified: trunk/reactos/include/win32k/driver.h Modified: trunk/reactos/subsys/win32k/misc/driver.c _____ Modified: trunk/reactos/include/win32k/driver.h --- trunk/reactos/include/win32k/driver.h 2005-04-14 15:45:14 UTC (rev 14617) +++ trunk/reactos/include/win32k/driver.h 2005-04-14 15:47:03 UTC (rev 14618) @@ -21,9 +21,12 @@ typedef HSURF (STDCALL *PGD_ENABLESURFACE)(DHPDEV); typedef VOID (STDCALL *PGD_DISABLESURFACE)(DHPDEV); typedef BOOL (STDCALL *PGD_ASSERTMODE)(DHPDEV, BOOL); +typedef BOOL (STDCALL *PGD_OFFSET)(SURFOBJ*, LONG, LONG, FLONG); typedef BOOL (STDCALL *PGD_RESETPDEV)(DHPDEV, DHPDEV); +typedef VOID (STDCALL *PGD_DISABLEDRIVER)(VOID); typedef HBITMAP (STDCALL *PGD_CREATEDEVICEBITMAP)(DHPDEV, SIZEL, ULONG); typedef VOID (STDCALL *PGD_DELETEDEVICEBITMAP)(DHSURF); +typedef BOOL (STDCALL *PGD_ALPHABLEND)(SURFOBJ*, SURFOBJ*, CLIPOBJ*, XLATEOBJ*, RECTL*, RECTL*, BLENDOBJ*); typedef BOOL (STDCALL *PGD_REALIZEBRUSH)(BRUSHOBJ*, SURFOBJ*, SURFOBJ*, SURFOBJ*, XLATEOBJ*, ULONG); typedef ULONG (STDCALL *PGD_DITHERCOLOR)(DHPDEV, ULONG, ULONG, PULONG); @@ -38,12 +41,17 @@ typedef BOOL (STDCALL *PGD_BITBLT)(SURFOBJ*, SURFOBJ*, SURFOBJ*, CLIPOBJ*, XLATEOBJ*, RECTL*, POINTL*, POINTL*, BRUSHOBJ*, POINTL*, ROP4); -typedef BOOL (STDCALL *PGD_TRANSPARENTBLT)(SURFOBJ*, SURFOBJ*, CLIPOBJ*, XLATEOBJ*, RECTL*, RECTL*, ULONG, ULONG); +typedef BOOL (STDCALL *PGD_TRANSPARENTBLT)(SURFOBJ*, SURFOBJ*, CLIPOBJ*, XLATEOBJ*, + RECTL*, RECTL*, ULONG, ULONG); typedef BOOL (STDCALL *PGD_COPYBITS)(SURFOBJ*, SURFOBJ*, CLIPOBJ*, XLATEOBJ*, RECTL*, POINTL*); typedef BOOL (STDCALL *PGD_STRETCHBLT)(SURFOBJ*, SURFOBJ*, SURFOBJ*, CLIPOBJ*, XLATEOBJ*, COLORADJUSTMENT*, POINTL*, - RECTL*, RECTL*, POINTL*, ULONG); + RECTL*, RECTL*, POINTL*, ULONG); +typedef BOOL (STDCALL *PGD_STRETCHBLTROP)(SURFOBJ*, SURFOBJ*, SURFOBJ*, CLIPOBJ*, + XLATEOBJ*, COLORADJUSTMENT*, POINTL*, + RECTL*, RECTL*, POINTL*, ULONG, + BRUSHOBJ*, DWORD); typedef BOOL (STDCALL *PGD_SETPALETTE)(DHPDEV, PALOBJ*, ULONG, ULONG, ULONG); typedef BOOL (STDCALL *PGD_TEXTOUT)(SURFOBJ*, STROBJ*, FONTOBJ*, CLIPOBJ*, RECTL*, RECTL*, BRUSHOBJ*, BRUSHOBJ*, POINTL*, MIX); @@ -108,7 +116,9 @@ PGD_ENABLESURFACE EnableSurface; PGD_DISABLESURFACE DisableSurface; PGD_ASSERTMODE AssertMode; + PGD_OFFSET Offset; PGD_RESETPDEV ResetPDEV; + PGD_DISABLEDRIVER DisableDriver; PGD_CREATEDEVICEBITMAP CreateDeviceBitmap; PGD_DELETEDEVICEBITMAP DeleteDeviceBitmap; PGD_REALIZEBRUSH RealizeBrush; @@ -121,6 +131,7 @@ PGD_TRANSPARENTBLT TransparentBlt; PGD_COPYBITS CopyBits; PGD_STRETCHBLT StretchBlt; + PGD_STRETCHBLTROP StretchBltROP; PGD_SETPALETTE SetPalette; PGD_TEXTOUT TextOut; PGD_ESCAPE Escape; @@ -161,6 +172,7 @@ PGD_QUERYSPOOLTYPE QuerySpoolType; PGD_GRADIENTFILL GradientFill; PGD_SYNCHRONIZESURFACE SynchronizeSurface; + PGD_ALPHABLEND AlphaBlend; } DRIVER_FUNCTIONS, *PDRIVER_FUNCTIONS; BOOL DRIVER_RegisterDriver(LPCWSTR Name, PGD_ENABLEDRIVER EnableDriver); _____ Modified: trunk/reactos/subsys/win32k/misc/driver.c --- trunk/reactos/subsys/win32k/misc/driver.c 2005-04-14 15:45:14 UTC (rev 14617) +++ trunk/reactos/subsys/win32k/misc/driver.c 2005-04-14 15:47:03 UTC (rev 14618) @@ -187,7 +187,9 @@ DRIVER_FUNCTION(EnableSurface); DRIVER_FUNCTION(DisableSurface); DRIVER_FUNCTION(AssertMode); + DRIVER_FUNCTION(Offset); DRIVER_FUNCTION(ResetPDEV); + DRIVER_FUNCTION(DisableDriver); DRIVER_FUNCTION(CreateDeviceBitmap); DRIVER_FUNCTION(DeleteDeviceBitmap); DRIVER_FUNCTION(RealizeBrush); @@ -200,6 +202,7 @@ DRIVER_FUNCTION(TransparentBlt); DRIVER_FUNCTION(CopyBits); DRIVER_FUNCTION(StretchBlt); + DRIVER_FUNCTION(StretchBltROP); DRIVER_FUNCTION(SetPalette); DRIVER_FUNCTION(TextOut); DRIVER_FUNCTION(Escape); @@ -240,6 +243,7 @@ DRIVER_FUNCTION(QuerySpoolType); DRIVER_FUNCTION(GradientFill); DRIVER_FUNCTION(SynchronizeSurface); + DRIVER_FUNCTION(AlphaBlend); END_FUNCTION_MAP();
19 years, 8 months
1
0
0
0
[weiden] 14617: define KGATE in win32api
by weiden@svn.reactos.com
define KGATE in win32api Modified: trunk/reactos/w32api/include/ddk/winddk.h _____ Modified: trunk/reactos/w32api/include/ddk/winddk.h --- trunk/reactos/w32api/include/ddk/winddk.h 2005-04-14 15:42:56 UTC (rev 14616) +++ trunk/reactos/w32api/include/ddk/winddk.h 2005-04-14 15:45:14 UTC (rev 14617) @@ -945,6 +945,11 @@ UCHAR ApcDisable; } KMUTANT, *PKMUTANT, *RESTRICTED_POINTER PRKMUTANT, KMUTEX, *PKMUTEX, *RESTRICTED_POINTER PRKMUTEX; +typedef struct _KGATE +{ + DISPATCHER_HEADER Header; +} KGATE, *PKGATE, *RESTRICTED_POINTER PRKGATE; + typedef enum _TIMER_TYPE { NotificationTimer, SynchronizationTimer
19 years, 8 months
1
0
0
0
[chorns] 14616: repos test
by chorns@svn.reactos.com
repos test Modified: branches/xmlbuildsystem/reactos/Makefile _____ Modified: branches/xmlbuildsystem/reactos/Makefile --- branches/xmlbuildsystem/reactos/Makefile 2005-04-14 15:26:31 UTC (rev 14615) +++ branches/xmlbuildsystem/reactos/Makefile 2005-04-14 15:42:56 UTC (rev 14616) @@ -36,7 +36,6 @@ # ROS_RBUILDFLAGS # Pass parameters to rbuild. # -# .PHONY: all .PHONY: clean
19 years, 8 months
1
0
0
0
[arty] 14605: Sorry, forgot header for API dll communication.
by arty@svn.reactos.com
Sorry, forgot header for API dll communication. Added: trunk/reactos/include/rosdhcp_public.h _____ Added: trunk/reactos/include/rosdhcp_public.h --- trunk/reactos/include/rosdhcp_public.h 2005-04-13 06:17:34 UTC (rev 14604) +++ trunk/reactos/include/rosdhcp_public.h 2005-04-13 06:55:26 UTC (rev 14605) @@ -0,0 +1,46 @@ +#ifndef ROSDHCP_PUBLIC_H +#define ROSDHCP_PUBLIC_H + +enum { + DhcpReqLeaseIpAddress, + DhcpReqQueryHWInfo, + DhcpReqReleaseIpAddress, + DhcpReqRenewIpAddress, + DhcpReqStaticRefreshParams, +}; + +typedef struct _COMM_DHCP_REQ { + UINT Type; + DWORD AdapterIndex; + union { + struct { + BOOL Inserted; + } PnpEvent; + struct { + LPWSTR AdapterName; + DHCPCAPI_PARAMS_ARRAY Params; + } RegisterParamChange; + struct { + LPWSTR AdapterName; + LPWSTR RequestId; + } RequestParams, UndoRequestParams; + struct { + DWORD IPAddress; + DWORD Netmask; + } StaticRefreshParams; + } Body; +} COMM_DHCP_REQ; + +typedef union _COMM_DHCP_REPLY { + DWORD Reply; + struct { + DWORD AdapterIndex; + DWORD MediaType; + DWORD Mtu; + DWORD Speed; + } QueryHWInfo; +} COMM_DHCP_REPLY; + +#define DHCP_PIPE_NAME "\\\\.\\pipe\\dhcpclient" + +#endif/*ROSDHCP_PUBLIC_H*/
19 years, 8 months
1
0
0
0
[mf] 14604: tag release 0.2.6
by mf@svn.reactos.com
tag release 0.2.6 Added: tags/ReactOS-0.2.6/ _____ Copied: tags/ReactOS-0.2.6 (from rev 14603, branches/ros-branch-0_2_6)
19 years, 8 months
1
0
0
0
[ion] 14603: Kernel Gates. Ultra-lightweight and exclusive Wait Objects used in NT 5.2+ as high-speed events. Code is untested, so it's not added to the build until I'm back in May.
by ion@svn.reactos.com
Kernel Gates. Ultra-lightweight and exclusive Wait Objects used in NT 5.2+ as high-speed events. Code is untested, so it's not added to the build until I'm back in May. Modified: trunk/reactos/include/ddk/ketypes.h Modified: trunk/reactos/ntoskrnl/include/internal/ps.h Added: trunk/reactos/ntoskrnl/ke/gate.c _____ Modified: trunk/reactos/include/ddk/ketypes.h --- trunk/reactos/include/ddk/ketypes.h 2005-04-12 23:33:29 UTC (rev 14602) +++ trunk/reactos/include/ddk/ketypes.h 2005-04-13 01:12:08 UTC (rev 14603) @@ -88,6 +88,11 @@ LIST_ENTRY ThreadListHead; } KQUEUE, *PKQUEUE; +typedef struct _KGATE +{ + DISPATCHER_HEADER Header; +} KGATE, *PKGATE; + struct _KDPC; typedef struct _KTIMER _____ Modified: trunk/reactos/ntoskrnl/include/internal/ps.h --- trunk/reactos/ntoskrnl/include/internal/ps.h 2005-04-12 23:33:29 UTC (rev 14602) +++ trunk/reactos/ntoskrnl/include/internal/ps.h 2005-04-13 01:12:08 UTC (rev 14603) @@ -85,7 +85,10 @@ CHAR WaitMode; /* 55 */ UCHAR WaitNext; /* 56 */ UCHAR WaitReason; /* 57 */ - PKWAIT_BLOCK WaitBlockList; /* 58 */ + union { /* 58 */ + PKWAIT_BLOCK WaitBlockList; /* 58 */ + PKGATE GateObject; /* 58 */ + }; /* 58 */ LIST_ENTRY WaitListEntry; /* 5C */ ULONG WaitTime; /* 64 */ CHAR BasePriority; /* 68 */ _____ Added: trunk/reactos/ntoskrnl/ke/gate.c --- trunk/reactos/ntoskrnl/ke/gate.c 2005-04-12 23:33:29 UTC (rev 14602) +++ trunk/reactos/ntoskrnl/ke/gate.c 2005-04-13 01:12:08 UTC (rev 14603) @@ -0,0 +1,149 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS Kernel + * FILE: ntoskrnl/ke/gate.c + * PURPOSE: Implements the Gate Dispatcher Object + * + * PROGRAMMERS: Alex Ionescu (alex(a)relsoft.net) + */ + +/* INCLUDES *****************************************************************/ + +#include <ntoskrnl.h> +#define NDEBUG +#include <internal/debug.h> + +/* FUNCTIONS ****************************************************************/ + +VOID +FASTCALL +KeInitializeGate(PKGATE Gate) +{ + DPRINT1("KeInitializeGate(Gate %x)\n", Gate); + + /* Initialize the Dispatcher Header */ + KeInitializeDispatcherHeader(&Gate->Header, + GateObject, + sizeof(Gate) / sizeof(ULONG), + 0); +} + +VOID +FASTCALL +KeWaitForGate(PKGATE Gate, + KWAIT_REASON WaitReason, + KPROCESSOR_MODE WaitMode) +{ + KIRQL OldIrql; + PKTHREAD CurrentThread = KeGetCurrentThread(); + PKWAIT_BLOCK GateWaitBlock; + NTSTATUS Status; + + DPRINT1("KeWaitForGate(Gate %x)\n", Gate); + + do + { + /* Lock the APC Queue */ + KeAcquireSpinLock(&CurrentThread->ApcQueueLock, &OldIrql); + + /* Check if it's already signaled */ + if (!Gate->Header.SignalState) + { + /* Unsignal it */ + Gate->Header.SignalState = 0; + + /* Unlock the Queue and return */ + KeReleaseSpinLock(&CurrentThread->ApcQueueLock, OldIrql); + return; + } + + /* Setup a Wait Block */ + GateWaitBlock = &CurrentThread->WaitBlock[0]; + GateWaitBlock->Object = (PVOID)Gate; + GateWaitBlock->Thread = CurrentThread; + + /* Set the Thread Wait Data */ + CurrentThread->WaitReason = WaitReason; + CurrentThread->WaitMode = WaitMode; + CurrentThread->WaitIrql = OldIrql; + CurrentThread->GateObject = Gate; + + /* Insert into the Wait List */ + InsertTailList(&Gate->Header.WaitListHead, &GateWaitBlock->WaitListEntry); + + /* Handle Kernel Queues */ + if (CurrentThread->Queue) + { + DPRINT1("Waking Queue\n"); + KiWakeQueue(CurrentThread->Queue); + } + + /* Unlock the Queue*/ + KeReleaseSpinLock(&CurrentThread->ApcQueueLock, OldIrql); + + /* Block the Thread */ + DPRINT1("Blocking the Thread: %x\n", CurrentThread); + KiBlockThread(&Status, + CurrentThread->Alertable, + WaitMode, + WaitReason); + + /* Check if we were executing an APC */ + if (Status != STATUS_KERNEL_APC) return; + + DPRINT1("Looping Again\n"); + } while (TRUE); +} + +VOID +FASTCALL +KeSignalGateBoostPriority(PKGATE Gate) +{ + PKTHREAD WaitThread; + PKWAIT_BLOCK WaitBlock; + KIRQL OldIrql; + NTSTATUS WaitStatus = STATUS_SUCCESS; + + DPRINT1("KeSignalGateBoostPriority(EveGate %x)\n", Gate); + + /* Acquire Dispatcher Database Lock */ + OldIrql = KeAcquireDispatcherDatabaseLock(); + + /* Make sure we're not already signaled or that the list is empty */ + if (Gate->Header.SignalState) goto quit; + + /* If our wait list is empty, then signal the event and return */ + if (IsListEmpty(&Gate->Header.WaitListHead)) + { + Gate->Header.SignalState = 1; + goto quit; + } + + /* Get WaitBlock */ + WaitBlock = CONTAINING_RECORD(Gate->Header.WaitListHead.Flink, + KWAIT_BLOCK, + WaitListEntry); + /* Remove it */ + RemoveEntryList(&WaitBlock->WaitListEntry); + + /* Get the Associated thread */ + WaitThread = WaitBlock->Thread; + + /* Increment the Queue's active threads */ + if (WaitThread->Queue) + { + DPRINT1("Incrementing Queue's active threads\n"); + WaitThread->Queue->CurrentCount++; + } + + /* Reschedule the Thread */ + DPRINT1("Unblocking the Thread\n"); + KiUnblockThread(WaitThread, &WaitStatus, EVENT_INCREMENT); + return; + +quit: + /* Release the Dispatcher Database Lock */ + KeReleaseDispatcherDatabaseLock(OldIrql); +} + +/* EOF */
19 years, 8 months
1
0
0
0
← Newer
1
...
24
25
26
27
28
29
30
...
48
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
Results per page:
10
25
50
100
200