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 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
609 discussions
Start a n
N
ew thread
[gvg] 14385: Xen-specific memory setup for FreeLdr
by gvg@svn.reactos.com
Xen-specific memory setup for FreeLdr 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 Modified: branches/xen/reactos/boot/freeldr/freeldr/arch/i386/xencons.c Added: branches/xen/reactos/boot/freeldr/freeldr/arch/i386/xenmem.c Modified: branches/xen/reactos/config Deleted: branches/xen/reactos/include/xen3/private/page.h Deleted: branches/xen/reactos/include/xen3/private/pgtable.h _____ Modified: branches/xen/reactos/boot/freeldr/freeldr/Makefile --- branches/xen/reactos/boot/freeldr/freeldr/Makefile 2005-03-30 20:19:47 UTC (rev 14384) +++ branches/xen/reactos/boot/freeldr/freeldr/Makefile 2005-03-30 22:04:56 UTC (rev 14385) @@ -160,6 +160,7 @@ xboxrtc.o \ xboxvideo.o \ xencons.o \ + xenmem.o \ _alloca.o # For Mingw32 builds ARCH_OBJS = $(addprefix i386/,$(ARCH_I386_OBJS)) _____ Modified: branches/xen/reactos/boot/freeldr/freeldr/arch/i386/machxen.c --- branches/xen/reactos/boot/freeldr/freeldr/arch/i386/machxen.c 2005-03-30 20:19:47 UTC (rev 14384) +++ branches/xen/reactos/boot/freeldr/freeldr/arch/i386/machxen.c 2005-03-30 22:04:56 UTC (rev 14385) @@ -26,8 +26,6 @@ #include <rosxen.h> #include <xen.h> #include <hypervisor.h> -#include <page.h> -#include <pgtable.h> BOOL XenActive = FALSE; ctrl_front_ring_t XenCtrlIfTxRing; @@ -64,71 +62,58 @@ MachVtbl.HwDetect = XenHwDetect; } -start_info_t *HYPERVISOR_start_info; -extern char shared_info[PAGE_SIZE]; - /* _start is the default name ld will use as the entry point. When xen * loads the domain, it will start execution at the elf entry point. */ +void *dummy; void _start() { - pgd_t *pgd; - int ptetab_ma; - int idx; - int pte_ma; - mmu_update_t req; + extern void *start; /* Where is freeldr loaded? */ + start_info_t *StartInfo; control_if_t *CtrlIf; + void *OldStackPtr, *NewStackPtr; + void *OldStackPage, *NewStackPage; /* * Grab start_info - */ - /* The linux build setup_guest() put a start_info_t* into %esi. + * + * The linux build setup_guest() put a start_info_t* into %esi. * =S is inline asm code for get output from reg %esi. */ - asm("":"=S" (HYPERVISOR_start_info)); + asm("":"=S" (StartInfo)); - /* To write to the xen virtual console, we need to map in the - * shared page used by the the domain controller interface. The - * HYPERVISOR_start_info struct identifies the page table and - * shared_info pages. - * - * The following code maps the shared_info mfn (machine frame number) - * into this domains address space over the shared_info[] page. - */ - - /* - * map shared_info page + * Set up memory */ - /* The pgd page (page global directory - level 2 page table) is - * constructed by setup_guest() in tools/libxc/xc_linux_build.c - * Lookup the machine address of ptetab in pgd to construct the - * machine address of the pte entry for shared_info, - * and then call mmu_update to change mapping. - */ - pgd = (pgd_t*)HYPERVISOR_start_info->pt_base; - ptetab_ma = pgd_val(pgd[pgd_index((unsigned long)shared_info)]) - & (PAGE_MASK); - idx = pte_index((unsigned long)shared_info); - pte_ma = ptetab_ma + (idx*sizeof(pte_t)); + XenMemInit(StartInfo); - req.ptr = pte_ma; - req.val = HYPERVISOR_start_info->shared_info|7; - HYPERVISOR_mmu_update(&req, 1, NULL); - /* * Setup control interface */ - XenCtrlIfEvtchn = HYPERVISOR_start_info->domain_controller_evtchn; - CtrlIf = ((control_if_t *)((char *)shared_info + 2048)); + XenCtrlIfEvtchn = XenStartInfo->domain_controller_evtchn; + CtrlIf = ((control_if_t *)((char *)XenSharedInfo + 2048)); /* Sync up with shared indexes. */ FRONT_RING_ATTACH(&XenCtrlIfTxRing, &CtrlIf->tx_ring); BACK_RING_ATTACH(&XenCtrlIfRxRing, &CtrlIf->rx_ring); + /* Now move the stack to low mem */ + /* Copy the stack page */ + __asm__ __volatile__("mov %%esp,%%eax\n" : "=a" (OldStackPtr)); + OldStackPage = (void *) ROUND_DOWN((unsigned long) OldStackPtr, PAGE_SIZE); + NewStackPage = (void *)((char *) &start - PAGE_SIZE); + memcpy(NewStackPage, OldStackPage, PAGE_SIZE); + /* Switch the stack around. */ + NewStackPtr = (void *)((char *) NewStackPage + (OldStackPtr - OldStackPage)); + __asm__ __volatile__("mov %%eax,%%esp\n" : : "a"(NewStackPtr)); + /* Don't use stack based variables after this */ + /* Start freeldr */ XenActive = TRUE; - BootMain(NULL); + BootMain(XenStartInfo->cmd_line); + + /* Shouldn't get here */ + HYPERVISOR_shutdown(); } #define XEN_UNIMPLEMENTED(routine) \ @@ -230,13 +215,6 @@ XEN_UNIMPLEMENTED("XenVideoPrepareForReactOS"); } -ULONG -XenMemGetMemoryMap(PBIOS_MEMORY_MAP BiosMemoryMap, ULONG MaxMemoryMapSize) - { - XEN_UNIMPLEMENTED("XenMemGetMemoryMap"); - return 0; - } - BOOL XenDiskReadLogicalSectors(ULONG DriveNumber, ULONGLONG SectorNumber, ULONG SectorCount, PVOID Buffer) @@ -280,12 +258,6 @@ XEN_UNIMPLEMENTED("XenHwDetect"); } -/* Create shared_info page. This page is mapped over by the real shared - * info page - */ -asm(".align 0x1000; shared_info:;.skip 0x1000;"); - - /* emit the elf segment Xen builder expects in kernel image */ asm(".section __xen_guest;" ".ascii \"GUEST_OS=linux,GUEST_VER=2.6,XEN_VER=3.0,VIRT_BASE=0x00008000\";" ".ascii \",LOADER=generic\";" _____ Modified: branches/xen/reactos/boot/freeldr/freeldr/arch/i386/machxen.h --- branches/xen/reactos/boot/freeldr/freeldr/arch/i386/machxen.h 2005-03-30 20:19:47 UTC (rev 14384) +++ branches/xen/reactos/boot/freeldr/freeldr/arch/i386/machxen.h 2005-03-30 22:04:56 UTC (rev 14385) @@ -33,8 +33,11 @@ extern ctrl_front_ring_t XenCtrlIfTxRing; extern ctrl_back_ring_t XenCtrlIfRxRing; extern int XenCtrlIfEvtchn; +extern start_info_t *XenStartInfo; +extern shared_info_t *XenSharedInfo; VOID XenMachInit(VOID); +VOID XenMemInit(start_info_t *StartInfo); VOID XenConsPutChar(int Ch); BOOL XenConsKbHit(); _____ Modified: branches/xen/reactos/boot/freeldr/freeldr/arch/i386/xencons.c --- branches/xen/reactos/boot/freeldr/freeldr/arch/i386/xencons.c 2005-03-30 20:19:47 UTC (rev 14384) +++ branches/xen/reactos/boot/freeldr/freeldr/arch/i386/xencons.c 2005-03-30 22:04:56 UTC (rev 14385) @@ -25,6 +25,15 @@ #include <ctrl_if.h> #include <evtchn.h> +/* + * Extra ring macros to sync a consumer index up to the public producer index. + * Generally UNSAFE, but we use it for recovery and shutdown in some cases. + */ +#define RING_DROP_PENDING_RESPONSES(_r) \ + do { \ + (_r)->rsp_cons = (_r)->sring->rsp_prod; \ + } while (0) + #define OUTPUT_BUFFER_SIZE 128 static char OutputBuffer[OUTPUT_BUFFER_SIZE]; static unsigned OutputPtr = 0; @@ -34,23 +43,31 @@ { ctrl_msg_t *msg; - /* - * Put message on the control interface ring and trigger virtual - * console writer. - */ - msg = RING_GET_REQUEST(&XenCtrlIfTxRing, XenCtrlIfTxRing.req_prod_pvt); + while (0 != OutputPtr) + { + RING_DROP_PENDING_RESPONSES(&XenCtrlIfTxRing); - msg->type = CMSG_CONSOLE; - msg->subtype = CMSG_CONSOLE_DATA; - msg->length = OutputPtr + 1; - memcpy(msg->msg, OutputBuffer, OutputPtr); - msg->msg[OutputPtr + 1] = '\0'; - msg->id = 0xff; - XenCtrlIfTxRing.req_prod_pvt++; - RING_PUSH_REQUESTS(&XenCtrlIfTxRing); - notify_via_evtchn(XenCtrlIfEvtchn); + if (! RING_FULL(&XenCtrlIfTxRing)) + { + /* + * Put message on the control interface ring and trigger virtual + * console writer. + */ + msg = RING_GET_REQUEST(&XenCtrlIfTxRing, + XenCtrlIfTxRing.req_prod_pvt); - OutputPtr = 0; + msg->type = CMSG_CONSOLE; + msg->subtype = CMSG_CONSOLE_DATA; + msg->length = OutputPtr; + memcpy(msg->msg, OutputBuffer, OutputPtr); + msg->id = 0xff; + XenCtrlIfTxRing.req_prod_pvt++; + RING_PUSH_REQUESTS(&XenCtrlIfTxRing); + notify_via_evtchn(XenCtrlIfEvtchn); + + OutputPtr = 0; + } + } } static VOID _____ Added: branches/xen/reactos/boot/freeldr/freeldr/arch/i386/xenmem.c --- branches/xen/reactos/boot/freeldr/freeldr/arch/i386/xenmem.c 2005-03-30 20:19:47 UTC (rev 14384) +++ branches/xen/reactos/boot/freeldr/freeldr/arch/i386/xenmem.c 2005-03-30 22:04:56 UTC (rev 14385) @@ -0,0 +1,303 @@ +/* + * 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. + */ + +#include "freeldr.h" +#include "machxen.h" + +#include <rosxen.h> +#include <xen.h> +#include <hypervisor.h> + +/* Page Directory Entry */ +typedef struct _PDE +{ + unsigned long Pde; +} PDE, *PPDE; + +/* Page Table Entry */ +typedef struct _PTE +{ + unsigned long Pte; +} PTE, *PPTE; + +#define PGDIR_SHIFT 22 +#define PTRS_PER_PD (PAGE_SIZE / sizeof(PDE)) +#define PTRS_PER_PT (PAGE_SIZE / sizeof(PTE)) + +/* Page Directory Index of a given virtual address */ +#define PD_IDX(Va) (((Va) >> PGDIR_SHIFT) & (PTRS_PER_PD - 1)) +/* Page Table Index of a give virtual address */ +#define PT_IDX(Va) (((Va) >> PAGE_SHIFT) & (PTRS_PER_PT - 1)) +/* Convert a Page Directory or Page Table entry to a (machine) address */ +#define PAGE_MASK (~(PAGE_SIZE-1)) + +/* The PA_* definitions below were copied from ntoskrnl/mm/i386/page.c, maybe + we need a public header for them?? */ +#define PA_BIT_PRESENT (0) +#define PA_BIT_READWRITE (1) +#define PA_BIT_USER (2) +#define PA_BIT_WT (3) +#define PA_BIT_CD (4) +#define PA_BIT_ACCESSED (5) +#define PA_BIT_DIRTY (6) +#define PA_BIT_GLOBAL (8) + +#define PA_PRESENT (1 << PA_BIT_PRESENT) +#define PA_READWRITE (1 << PA_BIT_READWRITE) +#define PA_USER (1 << PA_BIT_USER) +#define PA_DIRTY (1 << PA_BIT_DIRTY) +#define PA_WT (1 << PA_BIT_WT) +#define PA_CD (1 << PA_BIT_CD) +#define PA_ACCESSED (1 << PA_BIT_ACCESSED) +#define PA_GLOBAL (1 << PA_BIT_GLOBAL) + +start_info_t *XenStartInfo; +shared_info_t *XenSharedInfo; + +static PPDE XenPageDir; + +ULONG +XenMemGetMemoryMap(PBIOS_MEMORY_MAP BiosMemoryMap, ULONG MaxMemoryMapSize) +{ + ULONG EntryCount; + + /* Don't give the memory manager a hard time, just tell it we have contiguous + * memory starting at address 0 and handle machine/physical stuff here */ + if (2 <= MaxMemoryMapSize) + { + BiosMemoryMap[0].BaseAddress = 0; + BiosMemoryMap[0].Length = (unsigned long) XenStartInfo; + BiosMemoryMap[0].Type = MEMTYPE_USABLE; + BiosMemoryMap[1].BaseAddress = (unsigned long) XenStartInfo; + BiosMemoryMap[1].Length = XenStartInfo->nr_pages * PAGE_SIZE + - (unsigned long) XenStartInfo; + BiosMemoryMap[1].Type = MEMTYPE_RESERVED; + EntryCount = 2; + } + else + { + EntryCount = 0; + } + + return EntryCount; +} + +/* + * This is an example (virtual) memory layout as presented to us by Xen: + * + * +--------------------+ 0xffffffff + * | Xen private | + * +--------------------+ 0xfc000000 + * | Unmapped | + * +--------------------+ 0x00400000 + * | Mapped unused | + * +--------------------+ 0x0004d000 + * | Stack | + * +--------------------+ 0x0004c000 + * | Start info | + * +--------------------+ 0x0004b000 StartInfo + * | Page dir/tables | + * +--------------------+ 0x00049000 StartInfo->pt_base + * | Machine frame list | + * +--------------------+ 0x00041000 StartInfo->mfn_list + * | FreeLdr image | + * +--------------------+ 0x00008000 + * | Unmapped | + * +--------------------+ 0x00000000 + * + * And this is how we would like it: + * + * +--------------------+ 0xffffffff + * | Xen private | + * +--------------------+ 0xfc000000 + * | Unmapped | + * +--------------------+ 0x02001000 + * | Shared page | + * +--------------------+ 0x02000000 XenSharedPage + * | Page dir/tables | + * +--------------------+ 0x01ff7000 XenPageDir + * | Start info | + * +--------------------+ 0x01ff6000 XenStartInfo + * | Mapped unused | + * +--------------------+ 0x00041000 + * | FreeLdr image | + * +--------------------+ 0x00008000 + * | Stack | + * +--------------------+ 0x00000000 + * + * This way, we can let the FreeLdr memory manager handle the address space + * between the end of the FreeLdr image and the information near the end of + * the physical memory (starting at XenStartInfo). + * XenMemInit sets up the memory the way we like it, except for switching the + * stack. That is done by our caller. + */ +void +XenMemInit(start_info_t *StartInfo) +{ + extern void *start; /* Where is freeldr loaded? */ + static char ErrMsg[] = "XenMemInit failed\n"; + unsigned long StartPfn; /* (Virtual) page frame number of beginning + of freeldr */ + PPDE PageDir; /* Virtual address of page directory */ + PPTE PageTableForPageDir; /* Virtual address of page table which + contains entry for the page directory */ + unsigned long PageDirMachineAddr; /* Machine address of page directory */ + unsigned PageTablesRequired; /* Number of page tables we require */ + unsigned PageTableNumber; /* Index of current page table */ + mmu_update_t MmuReq; /* Request info for mmu update */ + unsigned long MfnIndex; /* Index into mfn_list */ + unsigned long HighAddr; /* Virtual address after reloc to high + memory */ + unsigned long PageNumber; /* Index of current page */ + PPTE PageTable; /* Page table containing current page */ + + PageDir = (PPDE) StartInfo->pt_base; + PageTableForPageDir = (PPTE)((char *) StartInfo->pt_base + + PAGE_SIZE * (PD_IDX(StartInfo->pt_base) + 1)); + PageDirMachineAddr = PageTableForPageDir[PT_IDX(StartInfo->pt_base)].Pte + & PAGE_MASK; + + /* Determine pfn of first allocated memory */ + StartPfn = ROUND_DOWN((unsigned long) &start, PAGE_SIZE) / PAGE_SIZE; + + /* First, lets connect all our page tables */ + PageTablesRequired = ROUND_UP(StartInfo->nr_pages + 1, PTRS_PER_PT) + / PTRS_PER_PT; + for (PageTableNumber = 0; PageTableNumber < PageTablesRequired; + PageTableNumber++) + { + MfnIndex = StartInfo->nr_pages - (StartPfn + PageTablesRequired) + + PageTableNumber; + if (0 == PageDir[PageTableNumber].Pde) + { + MmuReq.ptr = PageDirMachineAddr + PageTableNumber * sizeof(PTE); + } + else + { + /* There's already a page table connected at this position. That + * means that it's also mapped in the area following pt_base. We + * don't want it there, so let's map another page at that pos. + * This page table will be mapped near the top of memory later */ + PageTable = (PPTE)((char *) PageDir + + (PageTableNumber + 1) * PAGE_SIZE); + MmuReq.ptr = (PageDir[PD_IDX((unsigned long) PageTable)].Pde + & PAGE_MASK) + + PT_IDX((unsigned long) PageTable) * sizeof(PTE); + } + MmuReq.val = (((u32*)StartInfo->mfn_list)[MfnIndex] << PAGE_SHIFT) + | (PA_PRESENT | PA_READWRITE | PA_USER); + if (0 != HYPERVISOR_mmu_update(&MmuReq, 1, NULL)) + { + HYPERVISOR_console_io(CONSOLEIO_write, sizeof(ErrMsg), ErrMsg); + HYPERVISOR_shutdown(); + } + } + + /* Now, let's make the page directory visible near the top of mem */ + HighAddr = (StartInfo->nr_pages - (PageTablesRequired + 1)) * PAGE_SIZE; + MmuReq.ptr = (PageDir[PD_IDX(HighAddr)].Pde & PAGE_MASK) + + PT_IDX(HighAddr) * sizeof(PTE); + MmuReq.val = PageDirMachineAddr + | (PA_PRESENT | PA_USER); + if (0 != HYPERVISOR_mmu_update(&MmuReq, 1, NULL)) + { + HYPERVISOR_console_io(CONSOLEIO_write, sizeof(ErrMsg), ErrMsg); + HYPERVISOR_shutdown(); + } + XenPageDir = (PPDE) HighAddr; + + /* We don't need the page directory mapped at the low address (pt_base) + * anymore, so we'll map another page there */ + MmuReq.ptr = (PageDir[PD_IDX((unsigned long) PageDir)].Pde & PAGE_MASK) + + PT_IDX((unsigned long) PageDir) * sizeof(PTE); + MfnIndex = StartInfo->nr_pages - (StartPfn + PageTablesRequired + 1); + MmuReq.val = (((u32*)StartInfo->mfn_list)[MfnIndex] << PAGE_SHIFT) + | (PA_PRESENT | PA_READWRITE | PA_USER); + if (0 != HYPERVISOR_mmu_update(&MmuReq, 1, NULL)) + { + HYPERVISOR_console_io(CONSOLEIO_write, sizeof(ErrMsg), ErrMsg); + HYPERVISOR_shutdown(); + } + + /* Map the page tables near the top of mem */ + for (PageTableNumber = 0; PageTableNumber < PageTablesRequired; + PageTableNumber++) + { + HighAddr = (StartInfo->nr_pages - PageTablesRequired + PageTableNumber) + * PAGE_SIZE; + MmuReq.ptr = (XenPageDir[PD_IDX(HighAddr)].Pde & PAGE_MASK) + + PT_IDX(HighAddr) * sizeof(PTE); + MmuReq.val = (XenPageDir[PageTableNumber].Pde & PAGE_MASK) + | (PA_PRESENT | PA_USER); + if (0 != HYPERVISOR_mmu_update(&MmuReq, 1, NULL)) + { + HYPERVISOR_console_io(CONSOLEIO_write, sizeof(ErrMsg), ErrMsg); + HYPERVISOR_shutdown(); + } + } + + /* Fill in gaps */ + for (PageNumber = 0; + PageNumber < StartInfo->nr_pages - (PageTablesRequired + 1); + PageNumber++) + { + PageTable = (PPTE)((char *) XenPageDir + + (PD_IDX(PageNumber * PAGE_SIZE) + 1) * PAGE_SIZE); + if (0 == PageTable[PT_IDX(PageNumber * PAGE_SIZE)].Pte) + { + if (PageNumber < StartPfn) + { + MfnIndex = StartInfo->nr_pages - StartPfn + PageNumber; + } + else + { + MfnIndex = PageNumber - StartPfn; + } + MmuReq.ptr = (XenPageDir[PD_IDX(PageNumber * PAGE_SIZE)].Pde + & PAGE_MASK) + + PT_IDX(PageNumber * PAGE_SIZE) * sizeof(PTE); + MmuReq.val = (((u32 *) StartInfo->mfn_list)[MfnIndex] << PAGE_SHIFT) + | (PA_PRESENT | PA_READWRITE | PA_USER); + if (0 != HYPERVISOR_mmu_update(&MmuReq, 1, NULL)) + { + HYPERVISOR_console_io(CONSOLEIO_write, sizeof(ErrMsg), ErrMsg); + HYPERVISOR_shutdown(); + } + } + } + + /* Need to move the start info out of the way */ + XenStartInfo = (start_info_t *)((char *) XenPageDir - PAGE_SIZE); + memcpy(XenStartInfo, StartInfo, PAGE_SIZE); + + /* We don't own the shared_info page, map it as an extra page just after + * our "normal" memory */ + XenSharedInfo = (shared_info_t *)(XenStartInfo->nr_pages * PAGE_SIZE); + MmuReq.ptr = (XenPageDir[PD_IDX(XenStartInfo->nr_pages * PAGE_SIZE)].Pde + & PAGE_MASK) + + PT_IDX(XenStartInfo->nr_pages * PAGE_SIZE) * sizeof(PTE); + MmuReq.val = XenStartInfo->shared_info + | (PA_PRESENT | PA_READWRITE | PA_USER); + if (0 != HYPERVISOR_mmu_update(&MmuReq, 1, NULL)) + { + HYPERVISOR_console_io(CONSOLEIO_write, sizeof(ErrMsg), ErrMsg); + HYPERVISOR_shutdown(); + } +} + +/* EOF */ Property changes on: branches/xen/reactos/boot/freeldr/freeldr/arch/i386/xenmem.c ___________________________________________________________________ Name: svn:eol-style + native _____ Modified: branches/xen/reactos/config --- branches/xen/reactos/config 2005-03-30 20:19:47 UTC (rev 14384) +++ branches/xen/reactos/config 2005-03-30 22:04:56 UTC (rev 14385) @@ -24,7 +24,7 @@ # # Whether to compile for debugging # -DBG := 0 +DBG := 1 # # Whether to compile a multiprocessor or single processor version @@ -36,3 +36,7 @@ # #NDISVERSION=NDIS50 +# +# Whether to compile for Xen, and, if so, which version +# +XEN := 3 _____ Deleted: branches/xen/reactos/include/xen3/private/page.h --- branches/xen/reactos/include/xen3/private/page.h 2005-03-30 20:19:47 UTC (rev 14384) +++ branches/xen/reactos/include/xen3/private/page.h 2005-03-30 22:04:56 UTC (rev 14385) @@ -1,12 +0,0 @@ -#ifndef XEN_PAGE_H_INCLUDED -#define XEN_PAGE_H_INCLUDED - -#include <ddk/winddk.h> - -#define PAGE_MASK (~(PAGE_SIZE-1)) - -#define pgd_val(x) ((x).pgd) - -#endif /* XEN_PAGE_H_INCLUDED */ - -/* EOF */ _____ Deleted: branches/xen/reactos/include/xen3/private/pgtable.h --- branches/xen/reactos/include/xen3/private/pgtable.h 2005-03-30 20:19:47 UTC (rev 14384) +++ branches/xen/reactos/include/xen3/private/pgtable.h 2005-03-30 22:04:56 UTC (rev 14385) @@ -1,25 +0,0 @@ -#ifndef XEN_PGTABLE_H_INCLUDED -#define XEN_PGTABLE_H_INCLUDED - -#define PGDIR_SHIFT 22 -#define PTRS_PER_PGD 1024 -#define PTRS_PER_PTE 1024 - -/* - * the pgd page can be thought of an array like this: pgd_t[PTRS_PER_PGD] - * - * this macro returns the index of the entry in the pgd page which would - * control the given virtual address - */ -#define pgd_index(address) (((address) >> PGDIR_SHIFT) & (PTRS_PER_PGD-1)) - -/* - * the pte page can be thought of an array like this: pte_t[PTRS_PER_PTE] - * - * this macro returns the index of the entry in the pte page which would - * control the given virtual address - */ -#define pte_index(address) \ - (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1)) - -#endif /* XEN_PGTABLE_H_INCLUDED */
19 years, 8 months
1
0
0
0
[weiden] 14384: initialize variables
by weiden@svn.reactos.com
initialize variables Modified: trunk/reactos/ntoskrnl/ps/suspend.c _____ Modified: trunk/reactos/ntoskrnl/ps/suspend.c --- trunk/reactos/ntoskrnl/ps/suspend.c 2005-03-30 00:44:52 UTC (rev 14383) +++ trunk/reactos/ntoskrnl/ps/suspend.c 2005-03-30 20:19:47 UTC (rev 14384) @@ -36,11 +36,13 @@ IN PULONG SuspendCount OPTIONAL) { PETHREAD Thread; - NTSTATUS Status; ULONG Prev; - KPROCESSOR_MODE PreviousMode = ExGetPreviousMode(); + KPROCESSOR_MODE PreviousMode; + NTSTATUS Status = STATUS_SUCCESS; PAGED_CODE(); + + PreviousMode = ExGetPreviousMode(); DPRINT("NtResumeThead(ThreadHandle %lx SuspendCount %p)\n", ThreadHandle, SuspendCount); @@ -115,12 +117,14 @@ IN PULONG PreviousSuspendCount OPTIONAL) { PETHREAD Thread; - NTSTATUS Status; ULONG Prev; - KPROCESSOR_MODE PreviousMode = ExGetPreviousMode(); + KPROCESSOR_MODE PreviousMode; + NTSTATUS Status = STATUS_SUCCESS; PAGED_CODE(); + PreviousMode = ExGetPreviousMode(); + /* Check buffer validity */ if(PreviousSuspendCount && PreviousMode == UserMode) {
19 years, 8 months
1
0
0
0
[ion] 14383: Return status on failure.
by ion@svn.reactos.com
Return status on failure. Modified: trunk/reactos/ntoskrnl/ps/suspend.c _____ Modified: trunk/reactos/ntoskrnl/ps/suspend.c --- trunk/reactos/ntoskrnl/ps/suspend.c 2005-03-30 00:32:38 UTC (rev 14382) +++ trunk/reactos/ntoskrnl/ps/suspend.c 2005-03-30 00:44:52 UTC (rev 14383) @@ -93,7 +93,7 @@ /* Dereference and Return */ ObDereferenceObject ((PVOID)Thread); - return STATUS_SUCCESS; + return Status; } /* @@ -169,7 +169,7 @@ /* Dereference and Return */ ObDereferenceObject((PVOID)Thread); - return STATUS_SUCCESS; + return Status; } /* EOF */
19 years, 8 months
1
0
0
0
[ion] 14382: Add SEH...thanks to Hardon for noticing the bugs
by ion@svn.reactos.com
Add SEH...thanks to Hardon for noticing the bugs Modified: trunk/reactos/ntoskrnl/ps/suspend.c _____ Modified: trunk/reactos/ntoskrnl/ps/suspend.c --- trunk/reactos/ntoskrnl/ps/suspend.c 2005-03-29 17:29:02 UTC (rev 14381) +++ trunk/reactos/ntoskrnl/ps/suspend.c 2005-03-30 00:32:38 UTC (rev 14382) @@ -37,17 +37,36 @@ { PETHREAD Thread; NTSTATUS Status; + ULONG Prev; + KPROCESSOR_MODE PreviousMode = ExGetPreviousMode(); PAGED_CODE(); DPRINT("NtResumeThead(ThreadHandle %lx SuspendCount %p)\n", ThreadHandle, SuspendCount); + + /* Check buffer validity */ + if(SuspendCount && PreviousMode == UserMode) { + + _SEH_TRY { + + ProbeForWrite(SuspendCount, + sizeof(ULONG), + sizeof(ULONG)); + } _SEH_HANDLE { + + Status = _SEH_GetExceptionCode(); + + } _SEH_END; + if(!NT_SUCCESS(Status)) return Status; + } + /* Get the Thread Object */ Status = ObReferenceObjectByHandle(ThreadHandle, THREAD_SUSPEND_RESUME, PsThreadType, - KeGetPreviousMode(), + PreviousMode, (PVOID*)&Thread, NULL); if (!NT_SUCCESS(Status)) { @@ -56,7 +75,21 @@ } /* Call the Kernel Function */ - *SuspendCount = KeResumeThread(&Thread->Tcb); + Prev = KeResumeThread(&Thread->Tcb); + + /* Return it */ + if(SuspendCount) { + + _SEH_TRY { + + *SuspendCount = Prev; + + } _SEH_HANDLE { + + Status = _SEH_GetExceptionCode(); + + } _SEH_END; + } /* Dereference and Return */ ObDereferenceObject ((PVOID)Thread); @@ -83,14 +116,33 @@ { PETHREAD Thread; NTSTATUS Status; + ULONG Prev; + KPROCESSOR_MODE PreviousMode = ExGetPreviousMode(); PAGED_CODE(); + + /* Check buffer validity */ + if(PreviousSuspendCount && PreviousMode == UserMode) { + + _SEH_TRY { + + ProbeForWrite(PreviousSuspendCount, + sizeof(ULONG), + sizeof(ULONG)); + } _SEH_HANDLE { + + Status = _SEH_GetExceptionCode(); + + } _SEH_END; + if(!NT_SUCCESS(Status)) return Status; + } + /* Get the Thread Object */ Status = ObReferenceObjectByHandle(ThreadHandle, THREAD_SUSPEND_RESUME, PsThreadType, - KeGetPreviousMode(), + PreviousMode, (PVOID*)&Thread, NULL); if (!NT_SUCCESS(Status)) { @@ -99,7 +151,21 @@ } /* Call the Kernel Function */ - *PreviousSuspendCount = KeSuspendThread(&Thread->Tcb); + Prev = KeSuspendThread(&Thread->Tcb); + + /* Return it */ + if(PreviousSuspendCount) { + + _SEH_TRY { + + *PreviousSuspendCount = Prev; + + } _SEH_HANDLE { + + Status = _SEH_GetExceptionCode(); + + } _SEH_END; + } /* Dereference and Return */ ObDereferenceObject((PVOID)Thread);
19 years, 8 months
1
0
0
0
[weiden] 14381: - added stub for PoQueueShutdownWorkItem required by XP's ntfs.sys
by weiden@svn.reactos.com
- added stub for PoQueueShutdownWorkItem required by XP's ntfs.sys - added stubs for KeAcquireInStackQueuedSpinLock and KeReleaseInStackQueuedSpinLock Modified: trunk/reactos/hal/hal/hal.c Modified: trunk/reactos/hal/hal/hal.def Modified: trunk/reactos/hal/halx86/generic/spinlock.c Modified: trunk/reactos/ntoskrnl/ntoskrnl.def Modified: trunk/reactos/ntoskrnl/po/power.c _____ Modified: trunk/reactos/hal/hal/hal.c --- trunk/reactos/hal/hal/hal.c 2005-03-29 15:22:44 UTC (rev 14380) +++ trunk/reactos/hal/hal/hal.c 2005-03-29 17:29:02 UTC (rev 14381) @@ -721,6 +721,27 @@ VOID +FASTCALL +KeAcquireInStackQueuedSpinLock( + IN PKSPIN_LOCK SpinLock, + IN PKLOCK_QUEUE_HANDLE LockHandle + ) +{ + UNIMPLEMENTED; +} + + +VOID +FASTCALL +KeReleaseInStackQueuedSpinLock( + IN PKLOCK_QUEUE_HANDLE LockHandle + ) +{ + UNIMPLEMENTED; +} + + +VOID STDCALL KeFlushWriteBuffer(VOID) { _____ Modified: trunk/reactos/hal/hal/hal.def --- trunk/reactos/hal/hal/hal.def 2005-03-29 15:22:44 UTC (rev 14380) +++ trunk/reactos/hal/hal/hal.def 2005-03-29 17:29:02 UTC (rev 14381) @@ -70,6 +70,7 @@ KdPortDisableInterrupts@0 KdPortEnableInterrupts@0 KeAcquireSpinLock@8 +@KeAcquireInStackQueuedSpinLock@8 @KeAcquireSpinLockRaiseToSynch@4 KeGetCurrentIrql@0 KeFlushWriteBuffer@0 @@ -78,6 +79,7 @@ KeRaiseIrql@8 KeRaiseIrqlToDpcLevel@0 KeRaiseIrqlToSynchLevel@0 +@KeReleaseInStackQueuedSpinLock@4 KeReleaseSpinLock@8 KeStallExecutionProcessor@4 @KfAcquireSpinLock@4 _____ Modified: trunk/reactos/hal/halx86/generic/spinlock.c --- trunk/reactos/hal/halx86/generic/spinlock.c 2005-03-29 15:22:44 UTC (rev 14380) +++ trunk/reactos/hal/halx86/generic/spinlock.c 2005-03-29 17:29:02 UTC (rev 14381) @@ -98,4 +98,31 @@ KfLowerIrql(NewIrql); } + +/* + * @unimplemented + */ +VOID +FASTCALL +KeAcquireInStackQueuedSpinLock( + IN PKSPIN_LOCK SpinLock, + IN PKLOCK_QUEUE_HANDLE LockHandle + ) +{ + UNIMPLEMENTED; +} + + +/* + * @unimplemented + */ +VOID +FASTCALL +KeReleaseInStackQueuedSpinLock( + IN PKLOCK_QUEUE_HANDLE LockHandle + ) +{ + UNIMPLEMENTED; +} + /* EOF */ _____ Modified: trunk/reactos/ntoskrnl/ntoskrnl.def --- trunk/reactos/ntoskrnl/ntoskrnl.def 2005-03-29 15:22:44 UTC (rev 14380) +++ trunk/reactos/ntoskrnl/ntoskrnl.def 2005-03-29 17:29:02 UTC (rev 14381) @@ -846,6 +846,7 @@ ;PfxInsertPrefix ;PfxRemovePrefix PoCallDriver@8 +PoQueueShutdownWorkItem@4 PoRegisterDeviceForIdleDetection@16 PoRegisterSystemState@8 PoRequestPowerIrp@24 _____ Modified: trunk/reactos/ntoskrnl/po/power.c --- trunk/reactos/ntoskrnl/po/power.c 2005-03-29 15:22:44 UTC (rev 14380) +++ trunk/reactos/ntoskrnl/po/power.c 2005-03-29 17:29:02 UTC (rev 14381) @@ -275,4 +275,19 @@ return Status; } + +NTSTATUS +STDCALL +PoQueueShutdownWorkItem( + IN PWORK_QUEUE_ITEM WorkItem + ) +{ + PAGED_CODE(); + + DPRINT1("PoQueueShutdownWorkItem(%p)\n", WorkItem); + + return STATUS_NOT_IMPLEMENTED; +} + + /* EOF */
19 years, 9 months
1
0
0
0
[weiden] 14380: - ported RtlVerifyVersionInfo from wine
by weiden@svn.reactos.com
- ported RtlVerifyVersionInfo from wine - moved version functions in kernel32 into their own file Modified: trunk/reactos/lib/kernel32/makefile Modified: trunk/reactos/lib/kernel32/misc/env.c Modified: trunk/reactos/lib/kernel32/misc/stubs.c Added: trunk/reactos/lib/kernel32/misc/version.c Modified: trunk/reactos/lib/ntdll/def/ntdll.def Modified: trunk/reactos/lib/rtl/version.c Modified: trunk/reactos/ntoskrnl/ntoskrnl.def _____ Modified: trunk/reactos/lib/kernel32/makefile --- trunk/reactos/lib/kernel32/makefile 2005-03-29 14:27:46 UTC (rev 14379) +++ trunk/reactos/lib/kernel32/makefile 2005-03-29 15:22:44 UTC (rev 14380) @@ -35,7 +35,7 @@ misc/sysinfo.o misc/profile.o \ misc/muldiv.o misc/nls.o misc/computername.o \ misc/perfcnt.o misc/lzexpand_main.o misc/lcformat.o \ - misc/chartype.o + misc/chartype.o misc/version.o FILE_OBJECTS = file/file.o file/curdir.o file/lfile.o file/dir.o \ file/iocompl.o file/volume.o file/deviceio.o file/dosdev.o \ _____ Modified: trunk/reactos/lib/kernel32/misc/env.c --- trunk/reactos/lib/kernel32/misc/env.c 2005-03-29 14:27:46 UTC (rev 14379) +++ trunk/reactos/lib/kernel32/misc/env.c 2005-03-29 15:22:44 UTC (rev 14380) @@ -222,159 +222,6 @@ /* * @implemented */ -DWORD -STDCALL -GetVersion(VOID) -{ - PPEB pPeb = NtCurrentPeb(); - DWORD nVersion; - - nVersion = MAKEWORD(pPeb->OSMajorVersion, pPeb->OSMinorVersion); - - /* behave consistently when posing as another operating system */ - /* build number */ - if(pPeb->OSPlatformId != VER_PLATFORM_WIN32_WINDOWS) - nVersion |= ((DWORD)(pPeb->OSBuildNumber)) << 16; - - /* non-NT platform flag */ - if(pPeb->OSPlatformId != VER_PLATFORM_WIN32_NT) - nVersion |= 0x80000000; - - return nVersion; -} - - -/* - * @implemented - */ -BOOL -STDCALL -GetVersionExW( - LPOSVERSIONINFOW lpVersionInformation - ) -{ - NTSTATUS Status; - - if(lpVersionInformation->dwOSVersionInfoSize != sizeof(OSVERSIONINFOW) && - lpVersionInformation->dwOSVersionInfoSize != sizeof(OSVERSIONINFOEXW)) - { - /* for some reason win sets ERROR_INSUFFICIENT_BUFFER even if it is large - enough but doesn't match the exact sizes supported, ERROR_INVALID_PARAMETER - would've been much more appropriate... */ - SetLastError(ERROR_INSUFFICIENT_BUFFER); - return FALSE; - } - - Status = RtlGetVersion((PRTL_OSVERSIONINFOW)lpVersionInformation); - if(NT_SUCCESS(Status)) - { - int ln, maxlen; - - /* append a reactos specific string to the szCSDVersion string */ - - /* FIXME - we shouldn't do this when there is a (ros-specific) compatibility - flag set so we don't screw applications that might depend on a - certain string */ - - ln = wcslen(lpVersionInformation->szCSDVersion) + 1; - maxlen = (sizeof(lpVersionInformation->szCSDVersion) / sizeof(lpVersionInformation->szCSDVersion[0]) - 1); - if(maxlen > ln) - { - PWCHAR szVer = lpVersionInformation->szCSDVersion + ln; - RtlZeroMemory(szVer, (maxlen - ln + 1) * sizeof(WCHAR)); - wcsncpy(szVer, - L"ReactOS " KERNEL_VERSION_STR L" (Build " KERNEL_VERSION_BUILD_STR L")", - maxlen - ln); - } - - return TRUE; - } - - return FALSE; -} - - -/* - * @implemented - */ -BOOL -STDCALL -GetVersionExA( - LPOSVERSIONINFOA lpVersionInformation - ) -{ - OSVERSIONINFOEXW viw; - - RtlZeroMemory(&viw, sizeof(viw)); - - switch(lpVersionInformation->dwOSVersionInfoSize) - { - case sizeof(OSVERSIONINFOA): - viw.dwOSVersionInfoSize = sizeof(OSVERSIONINFOW); - break; - - case sizeof(OSVERSIONINFOEXA): - viw.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEXW); - break; - - default: - /* for some reason win sets ERROR_INSUFFICIENT_BUFFER even if it is large - enough but doesn't match the exact sizes supported, ERROR_INVALID_PARAMETER - would've been much more appropriate... */ - SetLastError(ERROR_INSUFFICIENT_BUFFER); - return FALSE; - } - - if(GetVersionExW((LPOSVERSIONINFOW)&viw)) - { - ANSI_STRING CSDVersionA; - UNICODE_STRING CSDVersionW; - - /* copy back fields that match both supported structures */ - lpVersionInformation->dwMajorVersion = viw.dwMajorVersion; - lpVersionInformation->dwMinorVersion = viw.dwMinorVersion; - lpVersionInformation->dwBuildNumber = viw.dwBuildNumber; - lpVersionInformation->dwPlatformId = viw.dwPlatformId; - - /* convert the win version string */ - RtlInitUnicodeString(&CSDVersionW, viw.szCSDVersion); - - CSDVersionA.Length = 0; - CSDVersionA.MaximumLength = sizeof(lpVersionInformation->szCSDVersion); - CSDVersionA.Buffer = lpVersionInformation->szCSDVersion; - - RtlUnicodeStringToAnsiString(&CSDVersionA, &CSDVersionW, FALSE); - - /* convert the ReactOS version string */ - CSDVersionW.Buffer = viw.szCSDVersion + CSDVersionW.Length / sizeof(WCHAR) + 1; - CSDVersionW.MaximumLength = sizeof(viw.szCSDVersion) - (CSDVersionW.Length + sizeof(WCHAR)); - CSDVersionW.Length = wcslen(CSDVersionW.Buffer) * sizeof(WCHAR); - CSDVersionA.Buffer = lpVersionInformation->szCSDVersion + CSDVersionA.Length + 1; - CSDVersionA.MaximumLength = sizeof(lpVersionInformation->szCSDVersion) - (CSDVersionA.Length + 1); - CSDVersionA.Length = 0; - - RtlUnicodeStringToAnsiString(&CSDVersionA, &CSDVersionW, FALSE); - - /* copy back the extended fields */ - if(viw.dwOSVersionInfoSize == sizeof(OSVERSIONINFOEXW)) - { - ((LPOSVERSIONINFOEXA)lpVersionInformation)->wServicePackMajor = viw.wServicePackMajor; - ((LPOSVERSIONINFOEXA)lpVersionInformation)->wServicePackMinor = viw.wServicePackMinor; - ((LPOSVERSIONINFOEXA)lpVersionInformation)->wSuiteMask = viw.wSuiteMask; - ((LPOSVERSIONINFOEXA)lpVersionInformation)->wProductType = viw.wProductType; - ((LPOSVERSIONINFOEXA)lpVersionInformation)->wReserved = viw.wReserved; - } - - return TRUE; - } - - return FALSE; -} - - -/* - * @implemented - */ LPSTR STDCALL GetEnvironmentStringsA ( _____ Modified: trunk/reactos/lib/kernel32/misc/stubs.c --- trunk/reactos/lib/kernel32/misc/stubs.c 2005-03-29 14:27:46 UTC (rev 14379) +++ trunk/reactos/lib/kernel32/misc/stubs.c 2005-03-29 15:22:44 UTC (rev 14380) @@ -1283,21 +1283,6 @@ */ BOOL STDCALL -VerifyVersionInfoW( - LPOSVERSIONINFOEXW lpVersionInformation, - DWORD dwTypeMask, - DWORDLONG dwlConditionMask - ) -{ - STUB; - return 0; -} - -/* - * @unimplemented - */ -BOOL -STDCALL DeleteVolumeMountPointA( LPCSTR lpszVolumeMountPoint ) @@ -1555,36 +1540,6 @@ /* * @unimplemented */ -BOOL -STDCALL -VerifyVersionInfoA( - LPOSVERSIONINFOEXA lpVersionInformation, - DWORD dwTypeMask, - DWORDLONG dwlConditionMask - ) -{ - STUB; - return 0; -} - -/* - * @unimplemented - */ -ULONGLONG -STDCALL -VerSetConditionMask( - ULONGLONG ConditionMask, - DWORD TypeMask, - BYTE Condition - ) -{ - STUB; - return 0; -} - -/* - * @unimplemented - */ BOOL STDCALL GetConsoleKeyboardLayoutNameA(LPSTR name) { STUB; _____ Added: trunk/reactos/lib/kernel32/misc/version.c --- trunk/reactos/lib/kernel32/misc/version.c 2005-03-29 14:27:46 UTC (rev 14379) +++ trunk/reactos/lib/kernel32/misc/version.c 2005-03-29 15:22:44 UTC (rev 14380) @@ -0,0 +1,236 @@ +/* $Id$ + * + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS system libraries + * FILE: lib/kernel32/misc/version.c + * PURPOSE: Version functions + * PROGRAMMER: Ariadne ( ariadne(a)xs4all.nl) + * UPDATE HISTORY: + * Created 01/11/98 + */ + +#include <k32.h> + +#define NDEBUG +#include "../include/debug.h" + + +/* FUNCTIONS ******************************************************************/ + + +/* + * @implemented + */ +DWORD +STDCALL +GetVersion(VOID) +{ + PPEB pPeb = NtCurrentPeb(); + DWORD nVersion; + + nVersion = MAKEWORD(pPeb->OSMajorVersion, pPeb->OSMinorVersion); + + /* behave consistently when posing as another operating system */ + /* build number */ + if(pPeb->OSPlatformId != VER_PLATFORM_WIN32_WINDOWS) + nVersion |= ((DWORD)(pPeb->OSBuildNumber)) << 16; + + /* non-NT platform flag */ + if(pPeb->OSPlatformId != VER_PLATFORM_WIN32_NT) + nVersion |= 0x80000000; + + return nVersion; +} + + +/* + * @implemented + */ +BOOL +STDCALL +GetVersionExW( + LPOSVERSIONINFOW lpVersionInformation + ) +{ + NTSTATUS Status; + + if(lpVersionInformation->dwOSVersionInfoSize != sizeof(OSVERSIONINFOW) && + lpVersionInformation->dwOSVersionInfoSize != sizeof(OSVERSIONINFOEXW)) + { + /* for some reason win sets ERROR_INSUFFICIENT_BUFFER even if it is large + enough but doesn't match the exact sizes supported, ERROR_INVALID_PARAMETER + would've been much more appropriate... */ + SetLastError(ERROR_INSUFFICIENT_BUFFER); + return FALSE; + } + + Status = RtlGetVersion((PRTL_OSVERSIONINFOW)lpVersionInformation); + if(NT_SUCCESS(Status)) + { + int ln, maxlen; + + /* append a reactos specific string to the szCSDVersion string */ + + /* FIXME - we shouldn't do this when there is a (ros-specific) compatibility + flag set so we don't screw applications that might depend on a + certain string */ + + ln = wcslen(lpVersionInformation->szCSDVersion) + 1; + maxlen = (sizeof(lpVersionInformation->szCSDVersion) / sizeof(lpVersionInformation->szCSDVersion[0]) - 1); + if(maxlen > ln) + { + PWCHAR szVer = lpVersionInformation->szCSDVersion + ln; + RtlZeroMemory(szVer, (maxlen - ln + 1) * sizeof(WCHAR)); + wcsncpy(szVer, + L"ReactOS " KERNEL_VERSION_STR L" (Build " KERNEL_VERSION_BUILD_STR L")", + maxlen - ln); + } + + return TRUE; + } + + return FALSE; +} + + +/* + * @implemented + */ +BOOL +STDCALL +GetVersionExA( + LPOSVERSIONINFOA lpVersionInformation + ) +{ + OSVERSIONINFOEXW viw; + + RtlZeroMemory(&viw, sizeof(viw)); + + switch(lpVersionInformation->dwOSVersionInfoSize) + { + case sizeof(OSVERSIONINFOA): + viw.dwOSVersionInfoSize = sizeof(OSVERSIONINFOW); + break; + + case sizeof(OSVERSIONINFOEXA): + viw.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEXW); + break; + + default: + /* for some reason win sets ERROR_INSUFFICIENT_BUFFER even if it is large + enough but doesn't match the exact sizes supported, ERROR_INVALID_PARAMETER + would've been much more appropriate... */ + SetLastError(ERROR_INSUFFICIENT_BUFFER); + return FALSE; + } + + if(GetVersionExW((LPOSVERSIONINFOW)&viw)) + { + ANSI_STRING CSDVersionA; + UNICODE_STRING CSDVersionW; + + /* copy back fields that match both supported structures */ + lpVersionInformation->dwMajorVersion = viw.dwMajorVersion; + lpVersionInformation->dwMinorVersion = viw.dwMinorVersion; + lpVersionInformation->dwBuildNumber = viw.dwBuildNumber; + lpVersionInformation->dwPlatformId = viw.dwPlatformId; + + /* convert the win version string */ + RtlInitUnicodeString(&CSDVersionW, viw.szCSDVersion); + + CSDVersionA.Length = 0; + CSDVersionA.MaximumLength = sizeof(lpVersionInformation->szCSDVersion); + CSDVersionA.Buffer = lpVersionInformation->szCSDVersion; + + RtlUnicodeStringToAnsiString(&CSDVersionA, &CSDVersionW, FALSE); + + /* convert the ReactOS version string */ + CSDVersionW.Buffer = viw.szCSDVersion + CSDVersionW.Length / sizeof(WCHAR) + 1; + CSDVersionW.MaximumLength = sizeof(viw.szCSDVersion) - (CSDVersionW.Length + sizeof(WCHAR)); + CSDVersionW.Length = wcslen(CSDVersionW.Buffer) * sizeof(WCHAR); + CSDVersionA.Buffer = lpVersionInformation->szCSDVersion + CSDVersionA.Length + 1; + CSDVersionA.MaximumLength = sizeof(lpVersionInformation->szCSDVersion) - (CSDVersionA.Length + 1); + CSDVersionA.Length = 0; + + RtlUnicodeStringToAnsiString(&CSDVersionA, &CSDVersionW, FALSE); + + /* copy back the extended fields */ + if(viw.dwOSVersionInfoSize == sizeof(OSVERSIONINFOEXW)) + { + ((LPOSVERSIONINFOEXA)lpVersionInformation)->wServicePackMajor = viw.wServicePackMajor; + ((LPOSVERSIONINFOEXA)lpVersionInformation)->wServicePackMinor = viw.wServicePackMinor; + ((LPOSVERSIONINFOEXA)lpVersionInformation)->wSuiteMask = viw.wSuiteMask; + ((LPOSVERSIONINFOEXA)lpVersionInformation)->wProductType = viw.wProductType; + ((LPOSVERSIONINFOEXA)lpVersionInformation)->wReserved = viw.wReserved; + } + + return TRUE; + } + + return FALSE; +} + + +/* + * @implemented + */ +BOOL +STDCALL +VerifyVersionInfoW( + LPOSVERSIONINFOEXW lpVersionInformation, + DWORD dwTypeMask, + DWORDLONG dwlConditionMask + ) +{ + NTSTATUS Status; + + Status = RtlVerifyVersionInfo((PRTL_OSVERSIONINFOEXW)lpVersionInformation, + dwTypeMask, + dwlConditionMask); + switch(Status) + { + case STATUS_INVALID_PARAMETER: + SetLastError(ERROR_BAD_ARGUMENTS); + return FALSE; + + case STATUS_REVISION_MISMATCH: + SetLastError(ERROR_OLD_WIN_VERSION); + return FALSE; + + default: + /* RtlVerifyVersionInfo shouldn't report any other failure code! */ + ASSERT(NT_SUCCESS(Status)); + return TRUE; + } +} + + +/* + * @implemented + */ +BOOL +STDCALL +VerifyVersionInfoA( + LPOSVERSIONINFOEXA lpVersionInformation, + DWORD dwTypeMask, + DWORDLONG dwlConditionMask + ) +{ + OSVERSIONINFOEXW viex; + + viex.dwOSVersionInfoSize = sizeof(viex); + viex.dwMajorVersion = lpVersionInformation->dwMajorVersion; + viex.dwMinorVersion = lpVersionInformation->dwMinorVersion; + viex.dwBuildNumber = lpVersionInformation->dwBuildNumber; + viex.dwPlatformId = lpVersionInformation->dwPlatformId; + /* NOTE: szCSDVersion is ignored, we don't need to convert it to unicode */ + viex.wServicePackMajor = lpVersionInformation->wServicePackMajor; + viex.wServicePackMinor = lpVersionInformation->wServicePackMinor; + viex.wSuiteMask = lpVersionInformation->wSuiteMask; + viex.wProductType = lpVersionInformation->wProductType; + viex.wReserved = lpVersionInformation->wReserved; + + return VerifyVersionInfoW(&viex, dwTypeMask, dwlConditionMask); +} + +/* EOF */ Property changes on: trunk/reactos/lib/kernel32/misc/version.c ___________________________________________________________________ Name: svn:keywords + author date id revision Name: svn:eol-style + native _____ Modified: trunk/reactos/lib/ntdll/def/ntdll.def --- trunk/reactos/lib/ntdll/def/ntdll.def 2005-03-29 14:27:46 UTC (rev 14379) +++ trunk/reactos/lib/ntdll/def/ntdll.def 2005-03-29 15:22:44 UTC (rev 14380) @@ -672,6 +672,7 @@ RtlValidateHeap@12 RtlValidateProcessHeaps@0 RtlValidateUnicodeString@8 +RtlVerifyVersionInfo@16 ;RtlWalkHeap RtlWriteRegistryValue@24 ;RtlZeroHeap _____ Modified: trunk/reactos/lib/rtl/version.c --- trunk/reactos/lib/rtl/version.c 2005-03-29 14:27:46 UTC (rev 14379) +++ trunk/reactos/lib/rtl/version.c 2005-03-29 15:22:44 UTC (rev 14380) @@ -1,6 +1,10 @@ /* * ReactOS kernel * Copyright (C) 2004 ReactOS Team + * Copyright 1997 Marcus Meissner + * Copyright 1998 Patrik Stridvall + * Copyright 1998, 2003 Andreas Mohr + * Copyright 1997, 2003 Alexandre Julliard * * 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 @@ -36,26 +40,205 @@ /* GLOBALS ******************************************************************/ +NTSTATUS +STDCALL +RtlGetVersion( + OUT PRTL_OSVERSIONINFOW lpVersionInformation + ); /* FUNCTIONS ****************************************************************/ /* -* @unimplemented +* @implemented */ -/* NTSTATUS STDCALL RtlVerifyVersionInfo( IN PRTL_OSVERSIONINFOEXW VersionInfo, IN ULONG TypeMask, - IN ULONGLONG ConditionMask + IN ULONGLONG ConditionMask ) { - UNIMPLEMENTED; - return STATUS_NOT_IMPLEMENTED; + RTL_OSVERSIONINFOEXW ver; + NTSTATUS status; + + /* FIXME: + - Check the following special case on Windows (various versions): + o lp->wSuiteMask == 0 and ver.wSuiteMask != 0 and VER_AND/VER_OR + o lp->dwOSVersionInfoSize != sizeof(OSVERSIONINFOEXW) + - MSDN talks about some tests being impossible. Check what really happens. + */ + + ver.dwOSVersionInfoSize = sizeof(ver); + if ((status = RtlGetVersion( (PRTL_OSVERSIONINFOW)&ver )) != STATUS_SUCCESS) return status; + + if(!(TypeMask && ConditionMask)) return STATUS_INVALID_PARAMETER; + + if(TypeMask & VER_PRODUCT_TYPE) + switch(ConditionMask >> 7*3 & 0x07) { + case VER_EQUAL: + if(ver.wProductType != VersionInfo->wProductType) return STATUS_REVISION_MISMATCH; + break; + case VER_GREATER: + if(ver.wProductType <= VersionInfo->wProductType) return STATUS_REVISION_MISMATCH; + break; + case VER_GREATER_EQUAL: + if(ver.wProductType < VersionInfo->wProductType) return STATUS_REVISION_MISMATCH; + break; + case VER_LESS: + if(ver.wProductType >= VersionInfo->wProductType) return STATUS_REVISION_MISMATCH; + break; + case VER_LESS_EQUAL: + if(ver.wProductType > VersionInfo->wProductType) return STATUS_REVISION_MISMATCH; + break; + default: + return STATUS_INVALID_PARAMETER; + } + if(TypeMask & VER_SUITENAME) + switch(ConditionMask >> 6*3 & 0x07) + { + case VER_AND: + if((VersionInfo->wSuiteMask & ver.wSuiteMask) != VersionInfo->wSuiteMask) + return STATUS_REVISION_MISMATCH; + break; + case VER_OR: + if(!(VersionInfo->wSuiteMask & ver.wSuiteMask) && VersionInfo->wSuiteMask) + return STATUS_REVISION_MISMATCH; + break; + default: + return STATUS_INVALID_PARAMETER; + } + if(TypeMask & VER_PLATFORMID) + switch(ConditionMask >> 3*3 & 0x07) + { + case VER_EQUAL: + if(ver.dwPlatformId != VersionInfo->dwPlatformId) return STATUS_REVISION_MISMATCH; + break; + case VER_GREATER: + if(ver.dwPlatformId <= VersionInfo->dwPlatformId) return STATUS_REVISION_MISMATCH; + break; + case VER_GREATER_EQUAL: + if(ver.dwPlatformId < VersionInfo->dwPlatformId) return STATUS_REVISION_MISMATCH; + break; + case VER_LESS: + if(ver.dwPlatformId >= VersionInfo->dwPlatformId) return STATUS_REVISION_MISMATCH; + break; + case VER_LESS_EQUAL: + if(ver.dwPlatformId > VersionInfo->dwPlatformId) return STATUS_REVISION_MISMATCH; + break; + default: + return STATUS_INVALID_PARAMETER; + } + if(TypeMask & VER_BUILDNUMBER) + switch(ConditionMask >> 2*3 & 0x07) + { + case VER_EQUAL: + if(ver.dwBuildNumber != VersionInfo->dwBuildNumber) return STATUS_REVISION_MISMATCH; + break; + case VER_GREATER: + if(ver.dwBuildNumber <= VersionInfo->dwBuildNumber) return STATUS_REVISION_MISMATCH; + break; + case VER_GREATER_EQUAL: + if(ver.dwBuildNumber < VersionInfo->dwBuildNumber) return STATUS_REVISION_MISMATCH; + break; + case VER_LESS: + if(ver.dwBuildNumber >= VersionInfo->dwBuildNumber) return STATUS_REVISION_MISMATCH; + break; + case VER_LESS_EQUAL: + if(ver.dwBuildNumber > VersionInfo->dwBuildNumber) return STATUS_REVISION_MISMATCH; + break; + default: + return STATUS_INVALID_PARAMETER; + } + if(TypeMask & VER_MAJORVERSION) + switch(ConditionMask >> 1*3 & 0x07) + { + case VER_EQUAL: + if(ver.dwMajorVersion != VersionInfo->dwMajorVersion) return STATUS_REVISION_MISMATCH; + break; + case VER_GREATER: + if(ver.dwMajorVersion <= VersionInfo->dwMajorVersion) return STATUS_REVISION_MISMATCH; + break; + case VER_GREATER_EQUAL: + if(ver.dwMajorVersion < VersionInfo->dwMajorVersion) return STATUS_REVISION_MISMATCH; + break; + case VER_LESS: + if(ver.dwMajorVersion >= VersionInfo->dwMajorVersion) return STATUS_REVISION_MISMATCH; + break; + case VER_LESS_EQUAL: + if(ver.dwMajorVersion > VersionInfo->dwMajorVersion) return STATUS_REVISION_MISMATCH; + break; + default: + return STATUS_INVALID_PARAMETER; + } + if(TypeMask & VER_MINORVERSION) + switch(ConditionMask >> 0*3 & 0x07) + { + case VER_EQUAL: + if(ver.dwMinorVersion != VersionInfo->dwMinorVersion) return STATUS_REVISION_MISMATCH; + break; + case VER_GREATER: + if(ver.dwMinorVersion <= VersionInfo->dwMinorVersion) return STATUS_REVISION_MISMATCH; + break; + case VER_GREATER_EQUAL: + if(ver.dwMinorVersion < VersionInfo->dwMinorVersion) return STATUS_REVISION_MISMATCH; + break; + case VER_LESS: + if(ver.dwMinorVersion >= VersionInfo->dwMinorVersion) return STATUS_REVISION_MISMATCH; + break; + case VER_LESS_EQUAL: + if(ver.dwMinorVersion > VersionInfo->dwMinorVersion) return STATUS_REVISION_MISMATCH; + break; + default: + return STATUS_INVALID_PARAMETER; + } + if(TypeMask & VER_SERVICEPACKMAJOR) + switch(ConditionMask >> 5*3 & 0x07) + { + case VER_EQUAL: + if(ver.wServicePackMajor != VersionInfo->wServicePackMajor) return STATUS_REVISION_MISMATCH; + break; + case VER_GREATER: + if(ver.wServicePackMajor <= VersionInfo->wServicePackMajor) return STATUS_REVISION_MISMATCH; + break; + case VER_GREATER_EQUAL: + if(ver.wServicePackMajor < VersionInfo->wServicePackMajor) return STATUS_REVISION_MISMATCH; + break; + case VER_LESS: + if(ver.wServicePackMajor >= VersionInfo->wServicePackMajor) return STATUS_REVISION_MISMATCH; + break; + case VER_LESS_EQUAL: + if(ver.wServicePackMajor > VersionInfo->wServicePackMajor) return STATUS_REVISION_MISMATCH; + break; + default: + return STATUS_INVALID_PARAMETER; + } + if(TypeMask & VER_SERVICEPACKMINOR) + switch(ConditionMask >> 4*3 & 0x07) + { + case VER_EQUAL: + if(ver.wServicePackMinor != VersionInfo->wServicePackMinor) return STATUS_REVISION_MISMATCH; + break; + case VER_GREATER: + if(ver.wServicePackMinor <= VersionInfo->wServicePackMinor) return STATUS_REVISION_MISMATCH; + break; + case VER_GREATER_EQUAL: + if(ver.wServicePackMinor < VersionInfo->wServicePackMinor) return STATUS_REVISION_MISMATCH; + break; + case VER_LESS: + if(ver.wServicePackMinor >= VersionInfo->wServicePackMinor) return STATUS_REVISION_MISMATCH; + break; + case VER_LESS_EQUAL: + if(ver.wServicePackMinor > VersionInfo->wServicePackMinor) return STATUS_REVISION_MISMATCH; + break; + default: + return STATUS_INVALID_PARAMETER; + } + + return STATUS_SUCCESS; } -*/ + /* Header hell made me do it, don't blame me. Please move these somewhere more sensible _____ Modified: trunk/reactos/ntoskrnl/ntoskrnl.def --- trunk/reactos/ntoskrnl/ntoskrnl.def 2005-03-29 14:27:46 UTC (rev 14379) +++ trunk/reactos/ntoskrnl/ntoskrnl.def 2005-03-29 15:22:44 UTC (rev 14380) @@ -1212,7 +1212,7 @@ RtlValidRelativeSecurityDescriptor@12 RtlValidSecurityDescriptor@4 RtlValidSid@4 -;RtlVerifyVersionInfo@16 +RtlVerifyVersionInfo@16 RtlVolumeDeviceToDosName@8 RtlWalkFrameChain@12 RtlWriteRegistryValue@24
19 years, 9 months
1
0
0
0
[weiden] 14379: move chkstk.s from ntdll to rtl because _alloca_probe needs to be exported by ntoskrnl as well
by weiden@svn.reactos.com
move chkstk.s from ntdll to rtl because _alloca_probe needs to be exported by ntoskrnl as well Modified: trunk/reactos/lib/ntdll/makefile Deleted: trunk/reactos/lib/ntdll/rtl/i386/chkstk.s Added: trunk/reactos/lib/rtl/i386/chkstk.s Modified: trunk/reactos/lib/rtl/makefile Modified: trunk/reactos/ntoskrnl/ntoskrnl.def _____ Modified: trunk/reactos/lib/ntdll/makefile --- trunk/reactos/lib/ntdll/makefile 2005-03-29 02:09:42 UTC (rev 14378) +++ trunk/reactos/lib/ntdll/makefile 2005-03-29 14:27:46 UTC (rev 14379) @@ -59,7 +59,6 @@ rtl/i386/aulldiv.o \ rtl/i386/aullrem.o \ rtl/i386/aullshr.o \ - rtl/i386/chkstk.o \ rtl/i386/float.o \ rtl/i386/ftol.o _____ Deleted: trunk/reactos/lib/ntdll/rtl/i386/chkstk.s --- trunk/reactos/lib/ntdll/rtl/i386/chkstk.s 2005-03-29 02:09:42 UTC (rev 14378) +++ trunk/reactos/lib/ntdll/rtl/i386/chkstk.s 2005-03-29 14:27:46 UTC (rev 14379) @@ -1,66 +0,0 @@ -/* $Id$ - * - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS kernel - * PURPOSE: Stack checker - * FILE: lib/ntdll/rtl/i386/chkstk.s - * PROGRAMER: KJK::Hyperion <noog(a)libero.it> - */ - -.globl __chkstk -.globl __alloca_probe - -/* - _chkstk() is called by all stack allocations of more than 4 KB. It grows the - stack in areas of 4 KB each, trying to access each area. This ensures that the - guard page for the stack is hit, and the stack growing triggered - */ -__chkstk: -__alloca_probe: - -/* EAX = size to be allocated */ -/* save the ECX register */ - pushl %ecx - -/* ECX = top of the previous stack frame */ - leal 8(%esp), %ecx - -/* probe the desired memory, page by page */ - cmpl $0x1000, %eax - jge .l_MoreThanAPage - jmp .l_LessThanAPage - -.l_MoreThanAPage: - -/* raise the top of the stack by a page and probe */ - subl $0x1000, %ecx - testl %eax, 0(%ecx) - -/* loop if still more than a page must be probed */ - subl $0x1000, %eax - cmpl $0x1000, %eax - jge .l_MoreThanAPage - -.l_LessThanAPage: - -/* raise the top of the stack by EAX bytes (size % 4096) and probe */ - subl %eax, %ecx - testl %eax, 0(%ecx) - -/* EAX = top of the stack */ - movl %esp, %eax - -/* allocate the memory */ - movl %ecx, %esp - -/* restore ECX */ - movl 0(%eax), %ecx - -/* restore the return address */ - movl 4(%eax), %eax - pushl %eax - -/* return */ - ret - -/* EOF */ _____ Copied: trunk/reactos/lib/rtl/i386/chkstk.s (from rev 14378, trunk/reactos/lib/ntdll/rtl/i386/chkstk.s) _____ Modified: trunk/reactos/lib/rtl/makefile --- trunk/reactos/lib/rtl/makefile 2005-03-29 02:09:42 UTC (rev 14378) +++ trunk/reactos/lib/rtl/makefile 2005-03-29 14:27:46 UTC (rev 14379) @@ -46,6 +46,7 @@ unicode.o \ unicodeprefix.o \ version.o \ + i386/chkstk.o \ i386/exception.o \ i386/except.o _____ Modified: trunk/reactos/ntoskrnl/ntoskrnl.def --- trunk/reactos/ntoskrnl/ntoskrnl.def 2005-03-29 02:09:42 UTC (rev 14378) +++ trunk/reactos/ntoskrnl/ntoskrnl.def 2005-03-29 14:27:46 UTC (rev 14379) @@ -1400,6 +1400,7 @@ _abnormal_termination _alldiv _allmul +_alloca_probe _allrem _allshl _allshr
19 years, 9 months
1
0
0
0
[weiden] 14378: implemented RtlValidateUnicodeString, thanks to "mephistopheles" for providing some pseudeo code
by weiden@svn.reactos.com
implemented RtlValidateUnicodeString, thanks to "mephistopheles" for providing some pseudeo code Modified: trunk/reactos/lib/ntdll/def/ntdll.def Modified: trunk/reactos/lib/rtl/unicode.c _____ Modified: trunk/reactos/lib/ntdll/def/ntdll.def --- trunk/reactos/lib/ntdll/def/ntdll.def 2005-03-28 19:29:59 UTC (rev 14377) +++ trunk/reactos/lib/ntdll/def/ntdll.def 2005-03-29 02:09:42 UTC (rev 14378) @@ -671,6 +671,7 @@ RtlValidSid@4 RtlValidateHeap@12 RtlValidateProcessHeaps@0 +RtlValidateUnicodeString@8 ;RtlWalkHeap RtlWriteRegistryValue@24 ;RtlZeroHeap _____ Modified: trunk/reactos/lib/rtl/unicode.c --- trunk/reactos/lib/rtl/unicode.c 2005-03-28 19:29:59 UTC (rev 14377) +++ trunk/reactos/lib/rtl/unicode.c 2005-03-29 02:09:42 UTC (rev 14378) @@ -2671,4 +2671,33 @@ return STATUS_SUCCESS; } + +/* + * @implemented + */ +NTSTATUS STDCALL +RtlValidateUnicodeString(IN ULONG Flags, + IN PUNICODE_STRING UnicodeString) +{ + /* currently no flags are supported! */ + ASSERT(Flags == 0); + + if ((Flags == 0) && + ((UnicodeString == NULL) || + ((UnicodeString->Length != 0) && + (UnicodeString->Buffer != NULL) && + ((UnicodeString->Length % sizeof(WCHAR)) == 0) && + ((UnicodeString->MaximumLength % sizeof(WCHAR)) == 0) && + (UnicodeString->MaximumLength >= UnicodeString->Length)))) + { + /* a NULL pointer as a unicode string is considered to be a valid unicode + string! */ + return STATUS_SUCCESS; + } + else + { + return STATUS_INVALID_PARAMETER; + } +} + /* EOF */
19 years, 9 months
1
0
0
0
[greatlrd] 14377: Swedish translation
by greatlrd@svn.reactos.com
Swedish translation David Nordenberg dnordenberg(a)users.sourceforge.net proofread by Andreas Bjerkeholt harteex(a)gmail.com, steven : Will commit it to wine also Added: trunk/reactos/lib/user32/Sv.rc Modified: trunk/reactos/lib/user32/user32.rc _____ Added: trunk/reactos/lib/user32/Sv.rc --- trunk/reactos/lib/user32/Sv.rc 2005-03-28 19:25:02 UTC (rev 14376) +++ trunk/reactos/lib/user32/Sv.rc 2005-03-28 19:29:59 UTC (rev 14377) @@ -0,0 +1,99 @@ +/////////////////////////////////////////////////////////////////////// ////// +// Swedish (SE) resources +/* + * Copyright 2005 David Nordenberg + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_SWE) +#ifdef _WIN32 +LANGUAGE LANG_SWEDISH, SUBLANG_DEFAULT +#pragma code_page(850) +#endif //_WIN32 + +/////////////////////////////////////////////////////////////////////// ////// +// +// Dialogs +// + +SELWINDOW DIALOG DISCARDABLE 20, 20, 220, 140 +STYLE DS_SYSMODAL | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | + WS_SYSMENU +FONT 8, "Bitstream Vera Sans" +CAPTION "Võlj f÷nster" +BEGIN + LISTBOX 100, 5, 5, 210, 110, LBS_NOTIFY | LBS_NOINTEGRALHEIGHT | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_VSCROLL | WS_HSCROLL + PUSHBUTTON "&OK", 1, 60, 120, 40, 15, BS_DEFPUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP + PUSHBUTTON "&Avbryt", 2, 120, 120, 40, 15, WS_CHILD | WS_VISIBLE | WS_TABSTOP +END + +/////////////////////////////////////////////////////////////////////// ////// +// +// Menus +// + +EDITMENU MENU LOADONCALL MOVEABLE DISCARDABLE +{ + POPUP "DUMMY" + BEGIN + MENUITEM "&?ngra", EM_UNDO + MENUITEM SEPARATOR + MENUITEM "&Klipp ut", WM_CUT + MENUITEM "K&opiera", WM_COPY + MENUITEM "K&listra in", WM_PASTE + MENUITEM "&Ta bort", WM_CLEAR + MENUITEM SEPARATOR + MENUITEM "&Markera allt", EM_SETSEL + END +} + + +SYSMENU MENU LOADONCALL MOVEABLE DISCARDABLE +{ + MENUITEM "&?terstõll", 61728 + MENUITEM "&Flytta", 61456 + MENUITEM "S&torlek", 61440 + MENUITEM "&Minimera", 61472 + MENUITEM "Ma&ximera", 61488 + MENUITEM SEPARATOR + MENUITEM "&Stõng\tAlt-F4", 61536 +} + +/////////////////////////////////////////////////////////////////////// ////// +// +// Strings +// + +STRINGTABLE +{ + IDS_ERROR, "Fel" + IDS_OK, "OK" + IDS_CANCEL, "Avbryt" + IDS_ABORT, "&Avbryt" + IDS_RETRY, "&F÷rs÷k igen" + IDS_IGNORE, "&Ignorera" + IDS_YES, "&Ja" + IDS_NO, "&Nej" + IDS_HELP, "Hjõlp" + IDS_TRYAGAIN, "&F÷rs÷k igen" + IDS_CONTINUE, "F&ortsõtt" +} + +STRINGTABLE +{ + IDS_MDI_MOREWINDOWS, "&Fler f÷nster..." +} + _____ Modified: trunk/reactos/lib/user32/user32.rc --- trunk/reactos/lib/user32/user32.rc 2005-03-28 19:25:02 UTC (rev 14376) +++ trunk/reactos/lib/user32/user32.rc 2005-03-28 19:29:59 UTC (rev 14377) @@ -61,3 +61,4 @@ #include "En.rc" #include "Da.rc" #include "De.rc" +#include "Sv.rc"
19 years, 9 months
1
0
0
0
[greatlrd] 14376: Swedish translation
by greatlrd@svn.reactos.com
Swedish translation David Nordenberg dnordenberg(a)users.sourceforge.net proofread by Andreas Bjerkeholt harteex(a)gmail.com, changes only for swedish user steven : Will commit it to wine also IDD_TBCUSTOMIZE, LTEXT "Knappar i..." changed width to 85 Added: trunk/reactos/lib/comctl32/comctl_Sv.rc Modified: trunk/reactos/lib/comctl32/rsrc.rc _____ Added: trunk/reactos/lib/comctl32/comctl_Sv.rc --- trunk/reactos/lib/comctl32/comctl_Sv.rc 2005-03-28 19:03:06 UTC (rev 14375) +++ trunk/reactos/lib/comctl32/comctl_Sv.rc 2005-03-28 19:25:02 UTC (rev 14376) @@ -0,0 +1,90 @@ +/* + * Copyright 2005 Andreas Bjerkeholt + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifdef _WIN32 +LANGUAGE LANG_SWEDISH, SUBLANG_DEFAULT +#pragma code_page(850) +#endif //_WIN32 + +IDD_PROPSHEET DIALOG DISCARDABLE 0, 0, 220, 140 +STYLE DS_CONTEXTHELP | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_VISIBLE +CAPTION "Egenskaper f÷r " +FONT 8, "MS Shell Dlg" +BEGIN + DEFPUSHBUTTON "OK", IDOK,4,122,50,14, WS_TABSTOP | WS_GROUP + PUSHBUTTON "Avbryt", IDCANCEL,58,122,50,14 + PUSHBUTTON "&Verkstõll", IDC_APPLY_BUTTON,112,122,50,14,WS_DISABLED + PUSHBUTTON "Hjõlp", IDHELP,166,122,50,14,WS_TABSTOP|WS_GROUP + CONTROL "Tab", IDC_TABCONTROL,"SysTabControl32",WS_CLIPSIBLINGS|WS_GROUP|WS_TABSTOP|TCS _MULTILINE,4,4,212,114 +END + + +IDD_WIZARD DIALOG DISCARDABLE 0, 0, 290, 159 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_VISIBLE +CAPTION "Guide" +FONT 8, "MS Shell Dlg" +BEGIN + DEFPUSHBUTTON "Slutf÷r", IDC_FINISH_BUTTON,121,138,50,14 + DEFPUSHBUTTON "&Nõsta >", IDC_NEXT_BUTTON,121,138,50,14 + PUSHBUTTON "< &F÷regÕende", IDC_BACK_BUTTON,71,138,50,14 + PUSHBUTTON "Avbryt", IDCANCEL,178,138,50,14 + PUSHBUTTON "Hjõlp", IDHELP,235,138,50,14,WS_GROUP + LTEXT "", IDC_SUNKEN_LINE,7,129,278,1,SS_SUNKEN + CONTROL "Tab", IDC_TABCONTROL,"SysTabControl32",WS_CLIPSIBLINGS | WS_DISABLED,7,7,258,5 + LTEXT "", IDC_SUNKEN_LINEHEADER,0,35,290,1,SS_LEFT | SS_SUNKEN | WS_CHILD | WS_VISIBLE +END + + +IDD_TBCUSTOMIZE DIALOG DISCARDABLE 10, 20, 357, 125 +STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +CAPTION "Anpassa verktygsfõltet" +FONT 8, "MS Shell Dlg" +BEGIN + DEFPUSHBUTTON "&Stõng", IDCANCEL,308,6,44,14 + PUSHBUTTON "&?terstõll", IDC_RESET_BTN,308,23,44,14 + PUSHBUTTON "&Hjõlp", IDC_HELP_BTN,308,40,44,14 + PUSHBUTTON "Flytta &upp", IDC_MOVEUP_BTN,308,74,44,14 + PUSHBUTTON "Flytta &ned", IDC_MOVEDN_BTN,308,91,44,14 + LTEXT "T&illgõngliga knappar:", -1,4,5,84,10 + LISTBOX IDC_AVAILBTN_LBOX,4,17,120,100, LBS_NOTIFY | LBS_OWNERDRAWFIXED | LBS_HASSTRINGS | LBS_NOINTEGRALHEIGHT | LBS_DISABLENOSCROLL | WS_BORDER | WS_VSCROLL | WS_HSCROLL | WS_TABSTOP + PUSHBUTTON "&Lõgg till ->", IDOK, 131, 42, 44, 14 + PUSHBUTTON "<- &Ta bort", IDC_REMOVE_BTN,131,62,44,14 + LTEXT "Knappar i v&erktygsfõltet:", -1,182,5,85,10 + LISTBOX IDC_TOOLBARBTN_LBOX, 182,17,120,100,LBS_NOTIFY | LBS_OWNERDRAWFIXED | LBS_HASSTRINGS | LBS_NOINTEGRALHEIGHT | LBS_DISABLENOSCROLL | WS_BORDER | WS_VSCROLL | WS_HSCROLL | WS_TABSTOP +END + +STRINGTABLE DISCARDABLE +{ + IDS_CLOSE "Stõng" +} + +STRINGTABLE DISCARDABLE +{ + IDM_TODAY "Idag:" + IDM_GOTODAY "GÕ till idag" +} + +STRINGTABLE DISCARDABLE +{ + IDS_SEPARATOR "Separator" +} + +STRINGTABLE DISCARDABLE +{ + HKY_NONE "Ingen" +} _____ Modified: trunk/reactos/lib/comctl32/rsrc.rc --- trunk/reactos/lib/comctl32/rsrc.rc 2005-03-28 19:03:06 UTC (rev 14375) +++ trunk/reactos/lib/comctl32/rsrc.rc 2005-03-28 19:25:02 UTC (rev 14376) @@ -1206,5 +1206,6 @@ #include "comctl_Pt.rc" #include "comctl_Ru.rc" #include "comctl_Si.rc" +#include "comctl_Sv.rc" #include "comctl_Th.rc" #include "comctl_Uk.rc"
19 years, 9 months
1
0
0
0
← Newer
1
2
3
4
5
...
61
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
Results per page:
10
25
50
100
200