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
[ion] 14743: Fix win32k building
by ion@svn.reactos.com
Fix win32k building Modified: trunk/reactos/ntoskrnl/include/internal/mm.h _____ Modified: trunk/reactos/ntoskrnl/include/internal/mm.h --- trunk/reactos/ntoskrnl/include/internal/mm.h 2005-04-22 12:52:25 UTC (rev 14742) +++ trunk/reactos/ntoskrnl/include/internal/mm.h 2005-04-22 13:17:35 UTC (rev 14743) @@ -508,7 +508,7 @@ STDCALL MmCreatePeb(PEPROCESS Process); -PTEB +struct _TEB* STDCALL MmCreateTeb(PEPROCESS Process, PCLIENT_ID ClientId, @@ -517,7 +517,7 @@ VOID STDCALL MmDeleteTeb(PEPROCESS Process, - PTEB Teb); + struct _TEB* Teb); /* i386/pfault.c *************************************************************/
19 years, 8 months
1
0
0
0
[ion] 14742: Thread Creation and Context Switching re-write, plus Idle/First Thread minimization attempt. Full changelog on ML, too large to post here
by ion@svn.reactos.com
Thread Creation and Context Switching re-write, plus Idle/First Thread minimization attempt. Full changelog on ML, too large to post here Modified: trunk/reactos/ntoskrnl/Makefile.i386 Modified: trunk/reactos/ntoskrnl/include/internal/arch/ps.h Modified: trunk/reactos/ntoskrnl/include/internal/i386/ke.h Modified: trunk/reactos/ntoskrnl/include/internal/i386/ps.h Modified: trunk/reactos/ntoskrnl/include/internal/ke.h Modified: trunk/reactos/ntoskrnl/include/internal/mm.h Modified: trunk/reactos/ntoskrnl/include/internal/ps.h Modified: trunk/reactos/ntoskrnl/kd/gdbstub.c Modified: trunk/reactos/ntoskrnl/kd/kdebug.c Modified: trunk/reactos/ntoskrnl/ke/i386/bios.c Deleted: trunk/reactos/ntoskrnl/ke/i386/bthread.S Added: trunk/reactos/ntoskrnl/ke/i386/ctxswitch.S Modified: trunk/reactos/ntoskrnl/ke/i386/exp.c Modified: trunk/reactos/ntoskrnl/ke/i386/gdt.c Modified: trunk/reactos/ntoskrnl/ke/i386/idt.c Modified: trunk/reactos/ntoskrnl/ke/i386/kernel.c Modified: trunk/reactos/ntoskrnl/ke/i386/ldt.c Modified: trunk/reactos/ntoskrnl/ke/i386/thread.c Deleted: trunk/reactos/ntoskrnl/ke/i386/tskswitch.S Modified: trunk/reactos/ntoskrnl/ke/i386/v86m.c Modified: trunk/reactos/ntoskrnl/ke/kthread.c Modified: trunk/reactos/ntoskrnl/ke/main.c Modified: trunk/reactos/ntoskrnl/ps/debug.c Modified: trunk/reactos/ntoskrnl/ps/idle.c Modified: trunk/reactos/ntoskrnl/ps/kill.c Modified: trunk/reactos/ntoskrnl/ps/psmgr.c Modified: trunk/reactos/ntoskrnl/ps/thread.c _____ Modified: trunk/reactos/ntoskrnl/Makefile.i386 --- trunk/reactos/ntoskrnl/Makefile.i386 2005-04-22 12:46:27 UTC (rev 14741) +++ trunk/reactos/ntoskrnl/Makefile.i386 2005-04-22 12:52:25 UTC (rev 14742) @@ -17,9 +17,8 @@ ke/i386/thread.o \ ke/i386/usercall.o \ ke/i386/trap.o \ - ke/i386/bthread.o \ ke/i386/syscall.o \ - ke/i386/tskswitch.o \ + ke/i386/ctxswitch.o \ ke/i386/v86m.o \ ke/i386/v86m_sup.o \ ke/i386/vdm.o \ _____ Modified: trunk/reactos/ntoskrnl/include/internal/arch/ps.h --- trunk/reactos/ntoskrnl/include/internal/arch/ps.h 2005-04-22 12:46:27 UTC (rev 14741) +++ trunk/reactos/ntoskrnl/include/internal/arch/ps.h 2005-04-22 12:52:25 UTC (rev 14742) @@ -21,8 +21,7 @@ #ifdef i386 #include <internal/i386/ps.h> -#define KiArchContextSwitch Ki386ContextSwitch -#define KiArchInitThread Ke386InitThread +#define KiArchContextSwitch KiSwapContext #define KiArchInitThreadWithContext Ke386InitThreadWithContext #else #error "Unknown processor" _____ Modified: trunk/reactos/ntoskrnl/include/internal/i386/ke.h --- trunk/reactos/ntoskrnl/include/internal/i386/ke.h 2005-04-22 12:46:27 UTC (rev 14741) +++ trunk/reactos/ntoskrnl/include/internal/i386/ke.h 2005-04-22 12:52:25 UTC (rev 14742) @@ -203,6 +203,28 @@ VOID KeCreateApplicationProcessorIdleThread(ULONG Id); +typedef +VOID +STDCALL +(*PKSYSTEM_ROUTINE)(PKSTART_ROUTINE StartRoutine, + PVOID StartContext); + +VOID +STDCALL +Ke386InitThreadWithContext(PKTHREAD Thread, + PKSYSTEM_ROUTINE SystemRoutine, + PKSTART_ROUTINE StartRoutine, + PVOID StartContext, + PCONTEXT Context); + +VOID +STDCALL +KiThreadStartup(PKSYSTEM_ROUTINE SystemRoutine, + PKSTART_ROUTINE StartRoutine, + PVOID StartContext, + BOOLEAN UserThread, + KTRAP_FRAME TrapFrame); + #ifdef CONFIG_SMP #define LOCK "lock ; " #else _____ Modified: trunk/reactos/ntoskrnl/include/internal/i386/ps.h --- trunk/reactos/ntoskrnl/include/internal/i386/ps.h 2005-04-22 12:46:27 UTC (rev 14741) +++ trunk/reactos/ntoskrnl/include/internal/i386/ps.h 2005-04-22 12:52:25 UTC (rev 14742) @@ -27,8 +27,12 @@ #define KTHREAD_TEB 0x20 #define KTHREAD_KERNEL_STACK 0x28 #define KTHREAD_NPX_STATE 0x31 +#define KTHREAD_STATE 0x2D +#define KTHREAD_APCSTATE_PROCESS 0x34 + 0x10 #define KTHREAD_PENDING_USER_APC 0x34 + 0x16 -#define KTHREAD_APCSTATE_PROCESS 0x44 +#define KTHREAD_PENDING_KERNEL_APC 0x34 + 0x15 +#define KTHREAD_CONTEXT_SWITCHES 0x4C +#define KTHREAD_WAIT_IRQL 0x54 #define KTHREAD_SERVICE_TABLE 0xDC #define KTHREAD_PREVIOUS_MODE 0x137 #define KTHREAD_TRAP_FRAME 0x128 @@ -44,7 +48,9 @@ #define KPCR_EXCEPTION_LIST 0x0 #define KPCR_INITIAL_STACK 0x4 +#define KPCR_STACK_LIMIT 0x8 #define KPCR_SELF 0x1C +#define KPCR_GDT 0x3C #define KPCR_TSS 0x40 #define KPCR_CURRENT_THREAD 0x124 #define KPCR_NPX_THREAD 0x2A4 @@ -298,17 +304,6 @@ #endif /* __USE_W32API */ -VOID -Ki386ContextSwitch(struct _KTHREAD* NewThread, - struct _KTHREAD* OldThread); -NTSTATUS -Ke386InitThread(struct _KTHREAD* Thread, PKSTART_ROUTINE fn, - PVOID StartContext); -NTSTATUS -Ke386InitThreadWithContext(struct _KTHREAD* Thread, PCONTEXT Context); -NTSTATUS -Ki386ValidateUserContext(PCONTEXT Context); - #endif /* __ASM__ */ #endif /* __NTOSKRNL_INCLUDE_INTERNAL_I386_PS_H */ _____ Modified: trunk/reactos/ntoskrnl/include/internal/ke.h --- trunk/reactos/ntoskrnl/include/internal/ke.h 2005-04-22 12:46:27 UTC (rev 14741) +++ trunk/reactos/ntoskrnl/include/internal/ke.h 2005-04-22 12:52:25 UTC (rev 14742) @@ -114,6 +114,10 @@ NTSTATUS STDCALL KeSuspendThread(PKTHREAD Thread); + +NTSTATUS +FASTCALL +KiSwapContext(PKTHREAD NewThread); /* gmutex.c ********************************************************************/ @@ -238,9 +242,16 @@ VOID inline FASTCALL KeReleaseDispatcherDatabaseLock(KIRQL Irql); VOID inline FASTCALL KeReleaseDispatcherDatabaseLockFromDpcLevel(VOID); -VOID +VOID STDCALL -KeInitializeThread(struct _KPROCESS* Process, PKTHREAD Thread, BOOLEAN First); +KeInitializeThread(struct _KPROCESS* Process, + PKTHREAD Thread, + PKSYSTEM_ROUTINE SystemRoutine, + PKSTART_ROUTINE StartRoutine, + PVOID StartContext, + PCONTEXT Context, + PVOID Teb, + PVOID KernelStack); VOID STDCALL _____ Modified: trunk/reactos/ntoskrnl/include/internal/mm.h --- trunk/reactos/ntoskrnl/include/internal/mm.h 2005-04-22 12:46:27 UTC (rev 14741) +++ trunk/reactos/ntoskrnl/include/internal/mm.h 2005-04-22 12:52:25 UTC (rev 14742) @@ -508,6 +508,17 @@ STDCALL MmCreatePeb(PEPROCESS Process); +PTEB +STDCALL +MmCreateTeb(PEPROCESS Process, + PCLIENT_ID ClientId, + PINITIAL_TEB InitialTeb); + +VOID +STDCALL +MmDeleteTeb(PEPROCESS Process, + PTEB Teb); + /* i386/pfault.c *************************************************************/ NTSTATUS MmPageFault(ULONG Cs, _____ Modified: trunk/reactos/ntoskrnl/include/internal/ps.h --- trunk/reactos/ntoskrnl/include/internal/ps.h 2005-04-22 12:46:27 UTC (rev 14741) +++ trunk/reactos/ntoskrnl/include/internal/ps.h 2005-04-22 12:52:25 UTC (rev 14742) @@ -497,7 +497,18 @@ PEPROCESS Parent OPTIONAL); - +VOID +STDCALL +PspSystemThreadStartup(PKSTART_ROUTINE StartRoutine, + PVOID StartContext); + +NTSTATUS +PsInitializeIdleOrFirstThread ( + PEPROCESS Process, + PETHREAD* ThreadPtr, + PKSTART_ROUTINE StartRoutine, + KPROCESSOR_MODE AccessMode, + BOOLEAN First); /* * Internal thread priorities, added by Phillip Susi * TODO: rebalence these to make use of all priorities... the ones above 16 _____ Modified: trunk/reactos/ntoskrnl/kd/gdbstub.c --- trunk/reactos/ntoskrnl/kd/gdbstub.c 2005-04-22 12:46:27 UTC (rev 14741) +++ trunk/reactos/ntoskrnl/kd/gdbstub.c 2005-04-22 12:52:25 UTC (rev 14742) @@ -131,6 +131,20 @@ #define EIP_REGNO 8 +typedef +VOID +STDCALL_FUNC +(*PKSYSTEM_ROUTINE)(PKSTART_ROUTINE StartRoutine, + PVOID StartContext); + +VOID +STDCALL +KiThreadStartup(PKSYSTEM_ROUTINE SystemRoutine, + PKSTART_ROUTINE StartRoutine, + PVOID StartContext, + BOOLEAN UserThread, + KTRAP_FRAME TrapFrame); + static CPU_REGISTER GspRegisters[NUMREGS] = { { 4, FIELD_OFFSET (KTRAP_FRAME_X86, Eax), FIELD_OFFSET (CONTEXT, Eax), TRUE }, @@ -582,7 +596,7 @@ * This thread has not been sheduled yet so assume it * is still in PsBeginThreadWithContextInternal(). */ - Value = (ULONG) PsBeginThreadWithContextInternal; + Value = (ULONG)KiThreadStartup; } else { _____ Modified: trunk/reactos/ntoskrnl/kd/kdebug.c --- trunk/reactos/ntoskrnl/kd/kdebug.c 2005-04-22 12:46:27 UTC (rev 14741) +++ trunk/reactos/ntoskrnl/kd/kdebug.c 2005-04-22 12:52:25 UTC (rev 14742) @@ -426,7 +426,7 @@ VOID STDCALL KdSystemDebugControl(ULONG Code) { - extern VOID PsDumpThreads(BOOLEAN IncludeSystem); + extern VOID STDCALL PspDumpThreads(BOOLEAN IncludeSystem); /* A - Dump the entire contents of the non-paged pool. */ if (Code == 0) @@ -462,12 +462,12 @@ /* F */ else if (Code == 5) { - PsDumpThreads(TRUE); + PspDumpThreads(TRUE); } /* G */ else if (Code == 6) { - PsDumpThreads(FALSE); + PspDumpThreads(FALSE); } /* H */ else if (Code == 7) _____ Modified: trunk/reactos/ntoskrnl/ke/i386/bios.c --- trunk/reactos/ntoskrnl/ke/i386/bios.c 2005-04-22 12:46:27 UTC (rev 14741) +++ trunk/reactos/ntoskrnl/ke/i386/bios.c 2005-04-22 12:52:25 UTC (rev 14742) @@ -1,4 +1,4 @@ -/* $Id:$ +/* $Id$ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel _____ Deleted: trunk/reactos/ntoskrnl/ke/i386/bthread.S --- trunk/reactos/ntoskrnl/ke/i386/bthread.S 2005-04-22 12:46:27 UTC (rev 14741) +++ trunk/reactos/ntoskrnl/ke/i386/bthread.S 2005-04-22 12:52:25 UTC (rev 14742) @@ -1,146 +0,0 @@ -/* - * ReactOS kernel - * Copyright (C) 2000 David Welch <welch(a)cwcom.net> - * - * 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 kernel - * FILE: ntoskrnl/ke/i386/bthread.S - * PURPOSE: Trap handlers - * PROGRAMMER: David Welch (david.welch(a)seh.ox.ac.uk) - */ - -/* INCLUDES ******************************************************************/ - -#include <ddk/status.h> -#include <internal/i386/segment.h> -#include <internal/ps.h> -#include <ddk/defines.h> - -/* Values for contextflags */ -#define CONTEXT_i386 0x10000 -#ifndef CONTEXT_CONTROL -#define CONTEXT_CONTROL (CONTEXT_i386 | 1) -#endif -#ifndef CONTEXT_INTEGER -#define CONTEXT_INTEGER (CONTEXT_i386 | 2) -#endif -#ifndef CONTEXT_SEGMENTS -#define CONTEXT_SEGMENTS (CONTEXT_i386 | 4) -#endif -#ifndef CONTEXT_FLOATING_POINT -#define CONTEXT_FLOATING_POINT (CONTEXT_i386 | 8) -#endif -#ifndef CONTEXT_DEBUG_REGISTERS -#define CONTEXT_DEBUG_REGISTERS (CONTEXT_i386 | 0x10) -#endif -#ifndef CONTEXT_FULL -#define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_SEGMENTS) -#endif - -/* FUNCTIONS *****************************************************************/ - -/* - * - */ - -.globl _PsBeginThreadWithContextInternal -.globl _PsBeginThread - -_PsBeginThread: - /* - * This isn't really a function, we are called as the return address - * of the context switch function - */ - - /* - * Do the necessary prolog after a context switch - */ - call _PiBeforeBeginThread - - /* - * Call the actual start of the thread - */ - movl 4(%esp), %ebx /* Start routine */ - movl 8(%esp), %eax /* Start context */ - pushl %eax - call *%ebx /* Call the start routine */ - addl $4, %esp - - /* - * Terminate the thread - */ - pushl %eax - call _PsTerminateSystemThread@4 - addl $4, %esp - - /* - * If that fails then bug check - */ - pushl $0 - call _KeBugCheck@4 - addl $4, %esp - - /* - * And if that fails then loop - */ -.1: - jmp .1 - - -_PsBeginThreadWithContextInternal: - /* - * This isn't really a function, we are called as the return - * address of a context switch - */ - - /* - * Do the necessary prolog before the context switch - */ - call _PiBeforeBeginThread - - /* - * Load the context flags. - */ - popl %ebx - - /* - * Load the debugging registers - */ - testl $(CONTEXT_DEBUG_REGISTERS & ~CONTEXT_i386), %ebx - jz .L1 - popl %eax /* Dr0 */ - movl %eax, %dr0 - popl %eax /* Dr1 */ - movl %eax, %dr1 - popl %eax /* Dr2 */ - movl %eax, %dr2 - popl %eax /* Dr3 */ - movl %eax, %dr3 - popl %eax /* Dr6 */ - movl %eax, %dr6 - popl %eax /* Dr7 */ - movl %eax, %dr7 - jmp .L3 -.L1: - addl $24, %esp -.L3: - - /* Load the rest of the thread's user mode context. */ - movl $0, %eax - jmp _KiServiceExit _____ Added: trunk/reactos/ntoskrnl/ke/i386/ctxswitch.S --- trunk/reactos/ntoskrnl/ke/i386/ctxswitch.S 2005-04-22 12:46:27 UTC (rev 14741) +++ trunk/reactos/ntoskrnl/ke/i386/ctxswitch.S 2005-04-22 12:52:25 UTC (rev 14742) @@ -0,0 +1,290 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS kernel + * FILE: ntoskrnl/ke/i386/ctxswitch.S + * PURPOSE: Thread Context Switching + * + * PROGRAMMERS: Alex Ionescu (alex(a)relsoft.net) + */ + +/* INCLUDES ******************************************************************/ + +#include <roscfg.h> +#include <internal/i386/segment.h> +#include <internal/i386/ke.h> +#include <internal/i386/fpu.h> +#include <internal/ps.h> +#include <ntos/tss.h> +#include <internal/ntoskrnl.h> +.intel_syntax noprefix + +#define Running 2 +#define SIZEOF_TRAP_FRAME 0x8c +#define APC_LEVEL 1 + +/* GLOBALS ****************************************************************/ + +/* FUNCTIONS ****************************************************************/ + +/*++ + * KiThreadStartup + * + * The KiThreadStartup routine is the beginning of any thread. + * + * Params: + * SystemRoutine - Pointer to the System Startup Routine. Either + * PspUserThreadStartup or PspSystemThreadStartup + * + * StartRoutine - For Kernel Threads only, specifies the starting execution + * point of the new thread. + * + * StartContext - For Kernel Threads only, specifies a pointer to variable + * context data to be sent to the StartRoutine above. + * + * UserThread - Indicates whether or not this is a user thread. This tells + * us if the thread has a context or not. + * + * TrapFrame - Pointer to the KTHREAD to which the caller wishes to + * switch from. + * + * Returns: + * Should never return for a system thread. Returns through the System Call + * Exit Dispatcher for a user thread. + * + * Remarks: + * If a return from a system thread is detected, a bug check will occur. + * + *--*/ +.globl _KiThreadStartup@156 +_KiThreadStartup@156: + + /* + * Clear all the non-volatile registers, so the thread won't be tempted to + * expect any static data (like some badly coded usermode/win9x apps do) + */ + xor ebx, ebx + xor esi, edi + xor edi, edi + xor ebp, ebp + + /* It's now safe to go to APC */ + mov ecx, APC_LEVEL + call @KfLowerIrql@4 + + /* + * Call the System Routine which is right on our stack now. + * After we pop the pointer, the Start Routine/Context will be on the + * stack, as parameters to the System Routine + */ + pop eax + call eax + + /* The thread returned... was it a user-thread? */ + pop ecx + or ecx, ecx + jz BadThread + + /* Yes it was, set our trapframe for the System Call Exit Dispatcher */ + mov ebp, esp + + /* Exit back to user-mode */ + jmp _KiServiceExit + +BadThread: + + /* A system thread returned...this is very bad! */ + int 3 + +/*++ + * KiSwapContextInternal + * + * The KiSwapContextInternal routine switches context to another thread. + * + * Params: + * ESI - Pointer to the KTHREAD to which the caller wishes to + * switch to. + * EDI - Pointer to the KTHREAD to which the caller wishes to + * switch from. + * + * Returns: + * None. + * + * Remarks: + * Absolutely all registers except ESP can be trampled here for maximum code flexibility. + * + *--*/ +.globl @KiSwapContextInternal@0 +@KiSwapContextInternal@0: + + /* Get the PCR. It's faster to use ebx+offset then fs:offset */ + mov ebx, [fs:0x1C] + + /* Set the Thread to running */ + mov byte ptr [esi+KTHREAD_STATE], Running + + /* Save the Exception list */ + push [ebx+KPCR_EXCEPTION_LIST] + + /* Switching, disable interrupts now */ + cli + +#ifdef CONFIG_SMP + /* Save FPU state if the thread has used it. */ + mov [ebx+KPCR_NPX_THREAD], 0 + test byte ptr [edi+KTHREAD_NPX_STATE], NPX_STATE_DIRTY + jz 3f + mov eax, [edi+KTHREAD_INITIAL_STACK] + cmp _FxsrSupport, 0 + je 1f + fxsave [eax-SIZEOF_FX_SAVE_AREA] + jmp 2f +1: + fnsave [eax-SIZEOF_FX_SAVE_AREA] +2: + mov byte ptr [edi+KTHREAD_INITIAL_STACK], NPX_STATE_VALID +3: +#endif /* CONFIG_SMP */ + + /* Save the stack pointer in this processors TSS */ + mov ebp, [ebx+KPCR_TSS] + push ss:[ebp+KTSS_ESP0] + + /* Switch stacks */ + mov [edi+KTHREAD_KERNEL_STACK], esp + mov esp, [esi+KTHREAD_KERNEL_STACK] + + /* Stack is OK, safe to enable interrupts now */ + sti + + /* Check if address space switch is needed */ + mov eax, [edi+KTHREAD_APCSTATE_PROCESS] + cmp eax, [esi+KTHREAD_APCSTATE_PROCESS] + + /* If they match, then use the fast-path and skip all this */ + jz SameProcess + + /* Get the new Process. */ + mov edi, [esi+KTHREAD_APCSTATE_PROCESS] + + /* Check if we need an LDT */ + xor eax, eax + cmp [edi+KPROCESS_LDT_DESCRIPTOR0], eax + jz NoLdt + + /* Write the LDT Selector */ + mov ebp, [ebx+KPCR_GDT] + mov eax, [edi+KPROCESS_LDT_DESCRIPTOR0] + mov [ebp+LDT_SELECTOR], eax + mov eax, [edi+KPROCESS_LDT_DESCRIPTOR1] + mov [ebp+LDT_SELECTOR+4], eax + + /* Save LDT Selector */ + mov eax, LDT_SELECTOR + +NoLdt: + + /* Load LDT */ + lldt ax + + /* Get the IOPM */ + mov ecx, [edi+KPROCESS_IOPM_OFFSET] + + /* Set current IOPM offset in the TSS */ + mov [ebp+KTSS_IOMAPBASE], cx + + /* Change the address space */ + mov eax, [edi+KPROCESS_DIRECTORY_TABLE_BASE] + mov cr3, eax + +SameProcess: + + /* Set the TEB */ + mov eax, [esi+KTHREAD_TEB] + mov ecx, [ebx+KPCR_GDT] + mov [ecx+0x3A], ax + shr eax, 16 + mov [ecx+0x3C], al + mov [ecx+0x3F], ah + + /* Increase context switches */ + inc dword ptr [esi+KTHREAD_CONTEXT_SWITCHES] + + /* Set TS in cr0 to catch FPU code and load the FPU state when needed */ +#ifndef CONFIG_SMP + cmp [ebx+KPCR_NPX_THREAD], esi + je 4f +#endif /* !CONFIG_SMP */ + mov eax, cr0 + or eax, X86_CR0_TS + mov cr0, eax +4: + + /* Restore the stack pointer in this processors TSS */ + pop ss:[ebp+KTSS_ESP0] + + /* Restore exception list */ + pop [ebx+KPCR_EXCEPTION_LIST] + + call @KeReleaseDispatcherDatabaseLockFromDpcLevel@0 + + /* Return */ + ret + +/*++ + * KiSwapContext + * + * The KiSwapContext routine switches context to another thread. + * + * Params: + * TargetThread - Pointer to the KTHREAD to which the caller wishes to + * switch to. + * + * Returns: + * The WaitStatus of the Target Thread. NOT YET SUPPORTED. + * + * Remarks: + * This is a wrapper around KiSwapContextInternal which will save all the + * non-volatile registers so that the Internal function can use all of + * them. It will also save the old current thread and set the new one. + * + * The calling thread does not return after KiSwapContextInternal until + * another thread switches to IT. + * + *--*/ +.globl @KiSwapContext@4 +@KiSwapContext@4: + + /* Note, we CANNOT touch ebp */ + + /* Save 4 registers */ + sub esp, 4 * 4 + + /* Save all the non-volatile ones */ + mov [esp+12], ebx + mov [esp+8], esi + mov [esp+4], edi + mov [esp+0], ebp + + /* Get the Current Thread */ + mov edi, fs:[KPCR_CURRENT_THREAD] + + /* Get the New Thread */ + mov esi, ecx + + /* Save it as Current thread */ + mov fs:[KPCR_CURRENT_THREAD], esi + + /* Do the swap with the registers correctly setup */ + call @KiSwapContextInternal@0 + + /* Return the registers */ + mov ebp, [esp+0] + mov esi, [esp+4] + mov edi, [esp+8] + mov ebx, [esp+12] + + /* Clean stack */ + add esp, 4 * 4 + + ret + _____ Modified: trunk/reactos/ntoskrnl/ke/i386/exp.c --- trunk/reactos/ntoskrnl/ke/i386/exp.c 2005-04-22 12:46:27 UTC (rev 14741) +++ trunk/reactos/ntoskrnl/ke/i386/exp.c 2005-04-22 12:52:25 UTC (rev 14742) @@ -502,6 +502,7 @@ */ if (Tf->Eflags & (1 << 17)) { + DPRINT("Tf->Eflags, %x, Tf->Eip %x, ExceptionNr: %d\n", Tf->Eflags, Tf->Eip, ExceptionNr); return(KeV86Exception(ExceptionNr, Tf, cr2)); } @@ -511,7 +512,7 @@ if (PsGetCurrentThread() != NULL && Esp0 < (ULONG)PsGetCurrentThread()->Tcb.StackLimit) { - DbgPrint("Stack underflow (tf->esp %x Limit %x)\n", + DPRINT1("Stack underflow (tf->esp %x Limit %x)\n", Esp0, (ULONG)PsGetCurrentThread()->Tcb.StackLimit); ExceptionNr = 12; } _____ Modified: trunk/reactos/ntoskrnl/ke/i386/gdt.c --- trunk/reactos/ntoskrnl/ke/i386/gdt.c 2005-04-22 12:46:27 UTC (rev 14741) +++ trunk/reactos/ntoskrnl/ke/i386/gdt.c 2005-04-22 12:52:25 UTC (rev 14742) @@ -1,4 +1,4 @@ -/* $Id:$ +/* $Id$ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel _____ Modified: trunk/reactos/ntoskrnl/ke/i386/idt.c --- trunk/reactos/ntoskrnl/ke/i386/idt.c 2005-04-22 12:46:27 UTC (rev 14741) +++ trunk/reactos/ntoskrnl/ke/i386/idt.c 2005-04-22 12:52:25 UTC (rev 14742) @@ -1,4 +1,4 @@ -/* $Id:$ +/* $Id$ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel _____ Modified: trunk/reactos/ntoskrnl/ke/i386/kernel.c --- trunk/reactos/ntoskrnl/ke/i386/kernel.c 2005-04-22 12:46:27 UTC (rev 14741) +++ trunk/reactos/ntoskrnl/ke/i386/kernel.c 2005-04-22 12:52:25 UTC (rev 14742) @@ -133,7 +133,7 @@ IdleProcessorMask |= (1 << KeGetCurrentProcessorNumber()); KeReleaseDispatcherDatabaseLock(oldIrql); } - + VOID INIT_FUNCTION KeCreateApplicationProcessorIdleThread(ULONG Id) @@ -141,11 +141,11 @@ PETHREAD IdleThread; PKPRCB Prcb = ((PKPCR)((ULONG_PTR)KPCR_BASE + Id * PAGE_SIZE))->Prcb; - PsInitializeThread(PsIdleProcess, + PsInitializeIdleOrFirstThread(PsIdleProcess, &IdleThread, NULL, - KernelMode, - FALSE); + KernelMode, + FALSE); IdleThread->Tcb.State = Running; IdleThread->Tcb.FreezeCount = 0; IdleThread->Tcb.Affinity = 1 << Id; _____ Modified: trunk/reactos/ntoskrnl/ke/i386/ldt.c --- trunk/reactos/ntoskrnl/ke/i386/ldt.c 2005-04-22 12:46:27 UTC (rev 14741) +++ trunk/reactos/ntoskrnl/ke/i386/ldt.c 2005-04-22 12:52:25 UTC (rev 14742) @@ -1,4 +1,4 @@ -/* $Id:$ +/* $Id$ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel _____ Modified: trunk/reactos/ntoskrnl/ke/i386/thread.c --- trunk/reactos/ntoskrnl/ke/i386/thread.c 2005-04-22 12:46:27 UTC (rev 14741) +++ trunk/reactos/ntoskrnl/ke/i386/thread.c 2005-04-22 12:52:25 UTC (rev 14742) @@ -1,11 +1,10 @@ -/* $Id:$ - * +/* * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel * FILE: ntoskrnl/ke/i386/thread.c - * PURPOSE: Architecture multitasking functions + * PURPOSE: i386 Thread Context Creation * - * PROGRAMMERS: David Welch (welch(a)cwcom.net) + * PROGRAMMERS: Alex Ionescu (alex(a)relsoft.net) */ /* INCLUDES ****************************************************************/ @@ -13,172 +12,177 @@ #include <ntoskrnl.h> #define NDEBUG #include <internal/debug.h> + +typedef struct _KSHARED_CTXSWITCH_FRAME { + ULONG Esp0; + PVOID ExceptionList; + PVOID RetEip; +} KSHARED_CTXSWITCH_FRAME, *PKSHARED_CTXSWITCH_FRAME; -/* FUNCTIONS *****************************************************************/ +typedef struct _KSTART_FRAME { + PKSYSTEM_ROUTINE SystemRoutine; + PKSTART_ROUTINE StartRoutine; + PVOID StartContext; + BOOLEAN UserThread; +} KSTART_FRAME, *PKSTART_FRAME; -NTSTATUS -Ki386ValidateUserContext(PCONTEXT Context) /* - * FUNCTION: Validates a processor context - * ARGUMENTS: - * Context = Context to validate - * RETURNS: Status - * NOTE: This only validates the context as not violating system security, it - * doesn't guararantee the thread won't crash at some point - * NOTE2: This relies on there only being two selectors which can access - * system space + * This is the Initial Thread Stack Frame on i386. + * + * It is composed of : + * + * - A shared Thread Switching frame so that we can use + * the context-switching code when initializing the thread. + * + * - The Stack Frame for KiThreadStartup, which are the parameters + * that it will receive (System/Start Routines & Context) + * + * - A Trap Frame with the Initial Context *IF AND ONLY IF THE THREAD IS USER* + * + * - The FPU Save Area, theoretically part of the Trap Frame's "ExtendedRegisters" + * + * This Initial Thread Stack Frame starts at Thread->InitialStack and it spans + * a total size of 0x2B8 bytes. */ -{ - if (Context->Eip >= KERNEL_BASE) - { - return(STATUS_UNSUCCESSFUL); - } - if (Context->SegCs == KERNEL_CS) - { - return(STATUS_UNSUCCESSFUL); - } - if (Context->SegDs == KERNEL_DS) - { - return(STATUS_UNSUCCESSFUL); - } - if (Context->SegEs == KERNEL_DS) - { - return(STATUS_UNSUCCESSFUL); - } - if (Context->SegFs == KERNEL_DS) - { - return(STATUS_UNSUCCESSFUL); - } - if (Context->SegGs == KERNEL_DS) - { - return(STATUS_UNSUCCESSFUL); - } - if ((Context->EFlags & X86_EFLAGS_IOPL) != 0 || - (Context->EFlags & X86_EFLAGS_NT) || - (Context->EFlags & X86_EFLAGS_VM) || - (!(Context->EFlags & X86_EFLAGS_IF))) - { - return(STATUS_UNSUCCESSFUL); - } - return(STATUS_SUCCESS); -} +typedef struct _KUINIT_FRAME { + KSHARED_CTXSWITCH_FRAME CtxSwitchFrame; /* -0x2B8 */ + KSTART_FRAME StartFrame; /* -0x2AC */ + KTRAP_FRAME TrapFrame; /* -0x29C */ + FX_SAVE_AREA FxSaveArea; /* -0x210 */ +} KUINIT_FRAME, *PKUINIT_FRAME; -NTSTATUS -Ke386InitThreadWithContext(PKTHREAD Thread, PCONTEXT Context) -{ - PULONG KernelStack; - ULONG InitSize; - PKTRAP_FRAME TrapFrame; - PFX_SAVE_AREA FxSaveArea; +typedef struct _KKINIT_FRAME { + KSHARED_CTXSWITCH_FRAME CtxSwitchFrame; /* -0x22C */ + KSTART_FRAME StartFrame; /* -0x220 */ + FX_SAVE_AREA FxSaveArea; /* -0x210 */ +} KKINIT_FRAME, *PKKINIT_FRAME; - /* - * Setup a stack frame for exit from the task switching routine - */ - - InitSize = 6 * sizeof(DWORD) + sizeof(DWORD) + 6 * sizeof(DWORD) + - + sizeof(KTRAP_FRAME) + sizeof (FX_SAVE_AREA); - KernelStack = (PULONG)((char*)Thread->KernelStack - InitSize); +/* FUNCTIONS *****************************************************************/ - /* Set up the initial frame for the return from the dispatcher. */ - KernelStack[0] = (ULONG)Thread->InitialStack - sizeof(FX_SAVE_AREA); /* TSS->Esp0 */ - KernelStack[1] = 0; /* EDI */ - KernelStack[2] = 0; /* ESI */ - KernelStack[3] = 0; /* EBX */ - KernelStack[4] = 0; /* EBP */ - KernelStack[5] = (ULONG)&PsBeginThreadWithContextInternal; /* EIP */ +VOID +STDCALL +Ke386InitThreadWithContext(PKTHREAD Thread, + PKSYSTEM_ROUTINE SystemRoutine, + PKSTART_ROUTINE StartRoutine, + PVOID StartContext, + PCONTEXT Context) +{ + PFX_SAVE_AREA FxSaveArea; + PKSTART_FRAME StartFrame; + PKSHARED_CTXSWITCH_FRAME CtxSwitchFrame; + PKTRAP_FRAME TrapFrame = NULL; + + /* Check if this is a With-Context Thread */ + DPRINT("Ke386InitThreadContext\n"); + if (Context) { + + /* Set up the Initial Frame */ + PKUINIT_FRAME InitFrame; + InitFrame = (PKUINIT_FRAME)((ULONG_PTR)Thread->InitialStack - sizeof(KUINIT_FRAME)); + DPRINT("Setting up a user-mode thread with the Frame at: %x\n", InitFrame); + + /* Setup the Fx Area */ + FxSaveArea = &InitFrame->FxSaveArea; + DPRINT("Fx Save Area: %x\n", FxSaveArea); + + /* Setup the Initial Fx State */ + if (KiContextToFxSaveArea(FxSaveArea, Context)) { - /* Save the context flags. */ - KernelStack[6] = Context->ContextFlags; - - /* Set up the initial values of the debugging registers. */ - KernelStack[7] = Context->Dr0; - KernelStack[8] = Context->Dr1; - KernelStack[9] = Context->Dr2; - KernelStack[10] = Context->Dr3; - KernelStack[11] = Context->Dr6; - KernelStack[12] = Context->Dr7; - - /* Set up a trap frame from the context. */ - TrapFrame = (PKTRAP_FRAME)(&KernelStack[13]); - TrapFrame->DebugEbp = (PVOID)Context->Ebp; - TrapFrame->DebugEip = (PVOID)Context->Eip; - TrapFrame->DebugArgMark = 0; - TrapFrame->DebugPointer = 0; - TrapFrame->TempCs = 0; - TrapFrame->TempEip = 0; - TrapFrame->Gs = (USHORT)Context->SegGs; - TrapFrame->Es = (USHORT)Context->SegEs; - TrapFrame->Ds = (USHORT)Context->SegDs; - TrapFrame->Edx = Context->Edx; - TrapFrame->Ecx = Context->Ecx; - TrapFrame->Eax = Context->Eax; - TrapFrame->PreviousMode = UserMode; - TrapFrame->ExceptionList = (PVOID)0xFFFFFFFF; - TrapFrame->Fs = TEB_SELECTOR; - TrapFrame->Edi = Context->Edi; - TrapFrame->Esi = Context->Esi; - TrapFrame->Ebx = Context->Ebx; - TrapFrame->Ebp = Context->Ebp; - TrapFrame->ErrorCode = 0; - TrapFrame->Cs = Context->SegCs; - TrapFrame->Eip = Context->Eip; - TrapFrame->Eflags = Context->EFlags | X86_EFLAGS_IF; - TrapFrame->Eflags &= ~(X86_EFLAGS_VM | X86_EFLAGS_NT | X86_EFLAGS_IOPL); - TrapFrame->Esp = Context->Esp; - TrapFrame->Ss = (USHORT)Context->SegSs; - /* FIXME: Should check for a v86 mode context here. */ - - /* Set up the initial floating point state. */ - /* FIXME: Do we have to zero the FxSaveArea or is it already? */ - FxSaveArea = (PFX_SAVE_AREA)((ULONG_PTR)KernelStack + InitSize - sizeof(FX_SAVE_AREA)); - if (KiContextToFxSaveArea(FxSaveArea, Context)) - { - Thread->NpxState = NPX_STATE_VALID; + Thread->NpxState = NPX_STATE_VALID; + + } else { [truncated at 1000 lines; 2134 more skipped]
19 years, 8 months
1
0
0
0
[arty] 14741: Removed a useless temporary from router setting.
by arty@svn.reactos.com
Removed a useless temporary from router setting. Use option 6, DHO_DOMAIN_NAME_SERVERS to get name servers from dhcp server. Fix wrong variable in nameserver setting. Router and Nameserver now correctly acquired from DHCP. Modified: trunk/reactos/subsys/system/dhcp/dhclient.c _____ Modified: trunk/reactos/subsys/system/dhcp/dhclient.c --- trunk/reactos/subsys/system/dhcp/dhclient.c 2005-04-22 12:43:16 UTC (rev 14740) +++ trunk/reactos/subsys/system/dhcp/dhclient.c 2005-04-22 12:46:27 UTC (rev 14741) @@ -437,12 +437,12 @@ } void set_name_servers( struct client_lease *new_lease ) { - if( new_lease->options[DHO_NAME_SERVERS].len ) { + if( new_lease->options[DHO_DOMAIN_NAME_SERVERS].len ) { HKEY RegKey; struct iaddr nameserver; char *nsbuf; int i, addrs = - new_lease->options[DHO_NAME_SERVERS].len / sizeof(ULONG); + new_lease->options[DHO_DOMAIN_NAME_SERVERS].len / sizeof(ULONG); nsbuf = malloc( addrs * sizeof(IP_ADDRESS_STRING) ); nsbuf[0] = 0; @@ -452,9 +452,10 @@ "SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters", 0, KEY_WRITE, &RegKey ) ) { for( i = 0; i < addrs; i++ ) { + nameserver.len = sizeof(ULONG); memcpy( nameserver.iabuf, - new_lease->options[DHO_NAME_SERVERS].data + - (addrs * sizeof(ULONG)), sizeof(ULONG) ); + new_lease->options[DHO_DOMAIN_NAME_SERVERS].data + + (i * sizeof(ULONG)), sizeof(ULONG) ); strcat( nsbuf, piaddr(nameserver) ); if( i != addrs-1 ) strcat( nsbuf, "," ); } @@ -475,6 +476,7 @@ if( Adapter->NteContext ) DeleteIPAddress( Adapter->NteContext ); + /* Set up our default router if we got one from the DHCP server */ if( new_lease->options[DHO_SUBNET_MASK].len ) { NTSTATUS Status; @@ -496,22 +498,19 @@ if( new_lease->options[DHO_ROUTERS].len ) { MIB_IPFORWARDROW RouterMib; NTSTATUS Status; - struct iaddr router; - memcpy( netmask.iabuf, - new_lease->options[DHO_ROUTERS].data, - new_lease->options[DHO_ROUTERS].len ); - RouterMib.dwForwardDest = 0; /* Default route */ RouterMib.dwForwardMask = 0; RouterMib.dwForwardMetric1 = 1; if( old_default_route ) { + /* If we set a default route before, delete it before continuing */ RouterMib.dwForwardDest = old_default_route; DeleteIpForwardEntry( &RouterMib ); } - RouterMib.dwForwardNextHop = *((ULONG*)router.iabuf); + RouterMib.dwForwardNextHop = + *((ULONG*)new_lease->options[DHO_ROUTERS].data); Status = CreateIpForwardEntry( &RouterMib );
19 years, 8 months
1
0
0
0
[ion] 14740: Switch to NT5
by ion@svn.reactos.com
Switch to NT5 Modified: trunk/reactos/bootdata/hivesft.inf _____ Modified: trunk/reactos/bootdata/hivesft.inf --- trunk/reactos/bootdata/hivesft.inf 2005-04-22 12:42:35 UTC (rev 14739) +++ trunk/reactos/bootdata/hivesft.inf 2005-04-22 12:43:16 UTC (rev 14740) @@ -13,9 +13,9 @@ HKLM,"SOFTWARE\Microsoft\Rpc",,0x00000012 ; Version Information -HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion","CurrentVersion",0x00020000,"4.0" -HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion","CSDVersion",0x00020000,"Service Pack 6" -HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion","CurrentBuildNumber",0x00020000,"1381" +HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion","CurrentVersion",0x00020000,"5.0" +HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion","CSDVersion",0x00020000,"Service Pack 3" +HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion","CurrentBuildNumber",0x00020000,"2195" ; Image File Execution Options (NtGlobalFlag with FLG_SHOW_LDR_SNAPS set for loadlib.exe)
19 years, 8 months
1
0
0
0
[ion] 14739: Put back GUI Shell
by ion@svn.reactos.com
Put back GUI Shell Modified: trunk/reactos/bootdata/hivesft.inf _____ Modified: trunk/reactos/bootdata/hivesft.inf --- trunk/reactos/bootdata/hivesft.inf 2005-04-22 10:12:37 UTC (rev 14738) +++ trunk/reactos/bootdata/hivesft.inf 2005-04-22 12:42:35 UTC (rev 14739) @@ -725,8 +725,8 @@ 0x00,0x00,0x0a,0x00,0x00,0x00,0x01,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x 00,0x00 -HKLM,"SOFTWARE\ReactOS\Windows NT\CurrentVersion\Winlogon","Shell",0x00020000,"%SystemRoot%\system32\cm d.exe" -;HKLM,"SOFTWARE\ReactOS\Windows NT\CurrentVersion\Winlogon","Shell",0x00020000,"%SystemRoot%\explorer.ex e" +;HKLM,"SOFTWARE\ReactOS\Windows NT\CurrentVersion\Winlogon","Shell",0x00020000,"%SystemRoot%\system32\cm d.exe" +HKLM,"SOFTWARE\ReactOS\Windows NT\CurrentVersion\Winlogon","Shell",0x00020000,"%SystemRoot%\explorer.ex e" HKLM,"SOFTWARE\ReactOS\Windows NT\CurrentVersion\Winlogon","StartServices",0x00010001,0x00000001 HKLM,"SOFTWARE\ReactOS\Windows NT\CurrentVersion\Winlogon","StartGUI",0x00010001,0x00000000 HKLM,"SOFTWARE\ReactOS\Windows NT\CurrentVersion\Winlogon","Userinit",0x00020000,"%SystemRoot%\system32 \userinit.exe"
19 years, 8 months
1
0
0
0
[chorns] 14738: * Remove empty line
by chorns@svn.reactos.com
* Remove empty line * Rearrange some dependencies Modified: branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler .cpp _____ Modified: branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler .cpp --- branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler .cpp 2005-04-22 09:45:17 UTC (rev 14737) +++ branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler .cpp 2005-04-22 10:12:37 UTC (rev 14738) @@ -1403,12 +1403,14 @@ fprintf ( fMakefile, "\t$(ECHO_AR)\n" ); fprintf ( fMakefile, - "\t%s -rc $@ %s\n\n", + "\t%s -rc $@ %s\n", ar.c_str (), objs_macro.c_str ()); GenerateCleanObjectsAsYouGoCode (); + fprintf ( fMakefile, "\n" ); + return archiveFilename; } @@ -2037,8 +2039,7 @@ { GenerateRules (); - string dependencies = - objectsMacro + " " + linkDepsMacro; + string dependencies = linkDepsMacro + " " + objectsMacro; string linkerParameters = ssprintf ( "-Wl,--subsystem,native -Wl,--entry,%s -Wl,--image-base,%s -Wl,--file-alignment,0x1000 -Wl,--section-alignment,0x1000 -nostartfiles -mdll", module.entrypoint.c_str (), @@ -2085,7 +2086,7 @@ { GenerateRules (); - string dependencies = objectsMacro + " " + linkDepsMacro; + string dependencies = linkDepsMacro + " " + objectsMacro; string linkerParameters = ssprintf ( "-Wl,--subsystem,native -Wl,--entry,%s -Wl,--image-base,%s -Wl,--file-alignment,0x1000 -Wl,--section-alignment,0x1000 -nostartfiles -mdll", module.entrypoint.c_str (), @@ -2131,8 +2132,7 @@ { GenerateRules (); - string dependencies = - objectsMacro + " " + linkDepsMacro; + string dependencies = linkDepsMacro + " " + objectsMacro; string linkerParameters = ssprintf ( "-Wl,--subsystem,native -Wl,--entry,%s -Wl,--image-base,%s -Wl,--file-alignment,0x1000 -Wl,--section-alignment,0x1000 -nostartfiles -nostdlib -mdll", module.entrypoint.c_str (), @@ -2178,8 +2178,7 @@ { GenerateRules (); - string dependencies = - objectsMacro + " " + linkDepsMacro; + string dependencies = linkDepsMacro + " " + objectsMacro; string linkerParameters = ssprintf ( "-Wl,--subsystem,native -Wl,--entry,%s -Wl,--image-base,%s -Wl,--file-alignment,0x1000 -Wl,--section-alignment,0x1000 -nostartfiles -nostdlib", module.entrypoint.c_str (), @@ -2249,7 +2248,7 @@ { GenerateRules (); - string dependencies = objectsMacro + " " + linkDepsMacro; + string dependencies = linkDepsMacro + " " + objectsMacro; string linker; if ( module.cplusplus ) @@ -2301,8 +2300,7 @@ { GenerateRules (); - string dependencies = - objectsMacro + " " + linkDepsMacro; + string dependencies = linkDepsMacro + " " + objectsMacro; string linker; if ( module.cplusplus ) @@ -2354,8 +2352,7 @@ { GenerateRules (); - string dependencies = - objectsMacro + " " + linkDepsMacro; + string dependencies = linkDepsMacro + " " + objectsMacro; string linker; if ( module.cplusplus ) @@ -2836,7 +2833,7 @@ { GenerateRules (); - string dependencies = objectsMacro + " " + linkDepsMacro; + string dependencies = linkDepsMacro + " " + objectsMacro; string linker; if ( module.cplusplus )
19 years, 8 months
1
0
0
0
[arty] 14737: tcpmisc.h:
by arty@svn.reactos.com
tcpmisc.h: - Correct wrongly sized struct IPAddrEntry. dhcp: dhclient.c and dispatch.c - remove lots of #if 0 - remove instances of script_go and associated stuff - write stub check_arp pending ARP api functions being implemented - introduced S_STATIC state for adapters dhcp: api.c: - Do add_protocol and send_discover when telling an adapter to lease. - Do remove_protocol when we make an adapter static. dhcp: adapter.c: - Add infrastructure for finding the adapter key in the registry - Check for IP address settings and apply as static if set, otherwise dynamic tcpip: *info and lan: - Set info types to DEBUG_INFO and DEBUG_DATALINK everywhere tcpip: lan: - Remove kernel IP configuration. bootdata: - Added dhcp service and make it start. - Removed static IP address settings from the default configuration - Removed old JS bootcode Modified: trunk/reactos/bootdata/hivesft.inf Modified: trunk/reactos/bootdata/hivesys.inf Modified: trunk/reactos/bootdata/packages/reactos.dff Modified: trunk/reactos/drivers/lib/ip/network/loopback.c Modified: trunk/reactos/drivers/net/tcpip/datalink/lan.c Modified: trunk/reactos/drivers/net/tcpip/include/debug.h Modified: trunk/reactos/drivers/net/tcpip/tcpip/iinfo.c Modified: trunk/reactos/drivers/net/tcpip/tcpip/info.c Modified: trunk/reactos/drivers/net/tcpip/tcpip/ninfo.c Modified: trunk/reactos/subsys/system/dhcp/Makefile Modified: trunk/reactos/subsys/system/dhcp/adapter.c Modified: trunk/reactos/subsys/system/dhcp/api.c Modified: trunk/reactos/subsys/system/dhcp/dhclient.c Modified: trunk/reactos/subsys/system/dhcp/dispatch.c Modified: trunk/reactos/subsys/system/dhcp/include/dhcpd.h Modified: trunk/reactos/subsys/system/dhcp/include/rosdhcp.h _____ Modified: trunk/reactos/bootdata/hivesft.inf --- trunk/reactos/bootdata/hivesft.inf 2005-04-22 09:19:18 UTC (rev 14736) +++ trunk/reactos/bootdata/hivesft.inf 2005-04-22 09:45:17 UTC (rev 14737) @@ -725,8 +725,8 @@ 0x00,0x00,0x0a,0x00,0x00,0x00,0x01,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x 00,0x00 -;HKLM,"SOFTWARE\ReactOS\Windows NT\CurrentVersion\Winlogon","Shell",0x00020000,"%SystemRoot%\system32\cm d.exe" -HKLM,"SOFTWARE\ReactOS\Windows NT\CurrentVersion\Winlogon","Shell",0x00020000,"%SystemRoot%\explorer.ex e" +HKLM,"SOFTWARE\ReactOS\Windows NT\CurrentVersion\Winlogon","Shell",0x00020000,"%SystemRoot%\system32\cm d.exe" +;HKLM,"SOFTWARE\ReactOS\Windows NT\CurrentVersion\Winlogon","Shell",0x00020000,"%SystemRoot%\explorer.ex e" HKLM,"SOFTWARE\ReactOS\Windows NT\CurrentVersion\Winlogon","StartServices",0x00010001,0x00000001 HKLM,"SOFTWARE\ReactOS\Windows NT\CurrentVersion\Winlogon","StartGUI",0x00010001,0x00000000 HKLM,"SOFTWARE\ReactOS\Windows NT\CurrentVersion\Winlogon","Userinit",0x00020000,"%SystemRoot%\system32 \userinit.exe" _____ Modified: trunk/reactos/bootdata/hivesys.inf --- trunk/reactos/bootdata/hivesys.inf 2005-04-22 09:19:18 UTC (rev 14736) +++ trunk/reactos/bootdata/hivesys.inf 2005-04-22 09:45:17 UTC (rev 14737) @@ -293,9 +293,9 @@ HKLM,"SYSTEM\CurrentControlSet\Services\3c90x1\Linkage","Route",0x000100 00,"3c90x1" HKLM,"SYSTEM\CurrentControlSet\Services\3c90x1\Parameters","SlotNumber", 0x00000000,"10" HKLM,"SYSTEM\CurrentControlSet\Services\3c90x1\Parameters","BusNumber",0 x00000000,"0" -HKLM,"SYSTEM\CurrentControlSet\Services\3c90x1\Parameters\Tcpip","Defau ltGateway",0x00010000,"10.0.0.1" -HKLM,"SYSTEM\CurrentControlSet\Services\3c90x1\Parameters\Tcpip","IPAdd ress",0x00010000,"10.0.0.100" -HKLM,"SYSTEM\CurrentControlSet\Services\3c90x1\Parameters\Tcpip","Subne tMask",0x00010000,"255.255.255.0" +HKLM,"SYSTEM\CurrentControlSet\Services\3c90x1\Parameters\Tcpip","Defau ltGateway",0x00010000,"0.0.0.0" +HKLM,"SYSTEM\CurrentControlSet\Services\3c90x1\Parameters\Tcpip","IPAdd ress",0x00010000,"0.0.0.0" +HKLM,"SYSTEM\CurrentControlSet\Services\3c90x1\Parameters\Tcpip","Subne tMask",0x00010000,"0.0.0.0" ; Afd driver HKLM,"SYSTEM\CurrentControlSet\Services\Afd","ErrorControl",0x00010001,0 x00000001 @@ -446,6 +446,13 @@ HKLM,"SYSTEM\CurrentControlSet\Services\EventLog","Start",0x00010001,0x0 0000002 HKLM,"SYSTEM\CurrentControlSet\Services\EventLog","Type",0x00010001,0x00 000010 +; DHCP client service +HKLM,"SYSTEM\CurrentControlSet\Services\DHCP","ErrorControl",0x00010001 ,0x00000000 +HKLM,"SYSTEM\CurrentControlSet\Services\DHCP","Group",0x00000000,"Netwo rk" +HKLM,"SYSTEM\CurrentControlSet\Services\DHCP","ImagePath",0x00020000,"% SystemRoot%\system32\dhcp.exe" +HKLM,"SYSTEM\CurrentControlSet\Services\DHCP","Start",0x00010001,0x0000 0002 +HKLM,"SYSTEM\CurrentControlSet\Services\DHCP","Type",0x00010001,0x00000 010 + ; Floppy driver HKLM,"SYSTEM\CurrentControlSet\Services\Floppy","ErrorControl",0x0001000 1,0x00000000 HKLM,"SYSTEM\CurrentControlSet\Services\Floppy","Group",0x00000000,"Prim ary Disk" @@ -572,9 +579,9 @@ HKLM,"SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08 002BE10318}\0001","Port",0x00000000,"280" HKLM,"SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08 002BE10318}\0001","Irq",0x00000000,"9" HKLM,"SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08 002BE10318}\0001","NetworkAddress",0x00000000,"001122334455" -HKLM,"SYSTEM\CurrentControlSet\Services\Ne20001\Parameters\Tcpip","Defa ultGateway",0x00010000,"10.0.0.1" -HKLM,"SYSTEM\CurrentControlSet\Services\Ne20001\Parameters\Tcpip","IPAd dress",0x00010000,"10.0.0.100" -HKLM,"SYSTEM\CurrentControlSet\Services\Ne20001\Parameters\Tcpip","Subn etMask",0x00010000,"255.255.255.0" +HKLM,"SYSTEM\CurrentControlSet\Services\Ne20001\Parameters\Tcpip","Defa ultGateway",0x00010000,"0.0.0.0" +HKLM,"SYSTEM\CurrentControlSet\Services\Ne20001\Parameters\Tcpip","IPAd dress",0x00010000,"0.0.0.0" +HKLM,"SYSTEM\CurrentControlSet\Services\Ne20001\Parameters\Tcpip","Subn etMask",0x00010000,"0.0.0.0" ; one day this will happen automatically; until then we need this since ndis5 drivers ; rely on the fact that their resources are handed to them by ndis, so we have to find @@ -663,9 +670,9 @@ HKLM,"SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08 002BE10318}\0000","BusNumber",0x00000000,"0" HKLM,"SYSTEM\CurrentControlSet\Control\Network\{4D36E972-E325-11CE-BFC1- 08002BE10318}\{RANDOMCFGGUIDFOR_PCNET1}",,0x00000000,"Network Adapters" HKLM,"SYSTEM\CurrentControlSet\Control\Network\{4D36E972-E325-11CE-BFC1- 08002BE10318}\{RANDOMCFGGUIDFOR_PCNET1}\Connection","Name",0x00000000,"A MD PCNet (static Registry entry)" -HKLM,"SYSTEM\CurrentControlSet\Services\PCNet1\Parameters\Tcpip","Defau ltGateway",0x00010000,"10.0.0.1" -HKLM,"SYSTEM\CurrentControlSet\Services\PCNet1\Parameters\Tcpip","IPAdd ress",0x00010000,"10.0.0.100" -HKLM,"SYSTEM\CurrentControlSet\Services\PCNet1\Parameters\Tcpip","Subne tMask",0x00010000,"255.255.255.0" +HKLM,"SYSTEM\CurrentControlSet\Services\PCNet1\Parameters\Tcpip","Defau ltGateway",0x00010000,"0.0.0.0" +HKLM,"SYSTEM\CurrentControlSet\Services\PCNet1\Parameters\Tcpip","IPAdd ress",0x00010000,"0.0.0.0" +HKLM,"SYSTEM\CurrentControlSet\Services\PCNet1\Parameters\Tcpip","Subne tMask",0x00010000,"0.0.0.0" ; Named Pipe filesystem driver HKLM,"SYSTEM\CurrentControlSet\Services\Npfs","ErrorControl",0x00010001, 0x00000000 @@ -867,100 +874,4 @@ HKLM,"SYSTEM\Setup","SetupType",0x00010001,0x00000001 HKLM,"SYSTEM\Setup","SystemPartition",0x00000000,"\Device\Harddisk0\Part ition1" HKLM,"SYSTEM\Setup","SystemSetupInProgress",0x00010001,0x00000000 - -; ----------------------------- KJS Init ---------------------------- -HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","kjsinit",0x00010000,\ -"function init(v) { var rk = '\\Registry\\Machine\\System\\CurrentControlSet\\Control\\Kdb'; eval(System.regread(rk,v)); } for( i = 1; i <= 45; i++ ) { init((new Number(i)).toString()); }" - -HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","1",0x00010000,\ -"function write(x) { System.print(x); }" -HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","2",0x00010000,\ -"function regs(n) { return System.regs(n); }" -HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","3",0x00010000,\ -"function debugebp() { return regs(0); }" -HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","4",0x00010000,\ -"function debugeip() { return regs(1); }" -HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","5",0x00010000,\ -"function tf_argmark() { return regs(2); }" -HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","6",0x00010000,\ -"function tf_pointer() { return regs(3); }" -HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","7",0x00010000,\ -"function tf_tempcs() { return regs(4); } " -HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","8",0x00010000,\ -"function tf_tempeip() { return regs(5); } " -HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","9",0x00010000,\ -"function dr0() { return regs(6); } " -HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","10",0x00010000,\ -"function dr1() { return regs(7); } " -HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","11",0x00010000,\ -"function dr2() { return regs(8); } " -HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","12",0x00010000,\ -"function dr3() { return regs(9); } " -HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","13",0x00010000,\ -"function dr6() { return regs(10); } " -HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","14",0x00010000,\ -"function dr7() { return regs(11); } " -HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","15",0x00010000,\ -"function gs() { return regs(12) & 0xffff; }" -HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","16",0x00010000,\ -"function es() { return regs(13) & 0xffff; }" -HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","17",0x00010000,\ -"function ds() { return regs(14) & 0xffff; }" -HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","18",0x00010000,\ -"function edx() { return regs(15); }" -HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","19",0x00010000,\ -"function ecx() { return regs(16); }" -HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","20",0x00010000,\ -"function eax() { return regs(17); }" -HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","21",0x00010000,\ -"function tf_pmode() { return regs(18); }" -HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","22",0x00010000,\ -"function tf_exl() { return regs(19); }" -HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","23",0x00010000,\ -"function fs() { return regs(20) & 0xffff; }" -HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","24",0x00010000,\ -"function edi() { return regs(21); }" -HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","25",0x00010000,\ -"function esi() { return regs(22); }" -HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","26",0x00010000,\ -"function ebx() { return regs(23); }" -HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","27",0x00010000,\ -"function ebp() { return regs(24); }" -HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","28",0x00010000,\ -"function error_code() { return regs(25); }" -HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","29",0x00010000,\ -"function eip() { return regs(26); }" -HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","30",0x00010000,\ -"function cs() { return regs(27) & 0xffff; }" -HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","31",0x00010000,\ -"function eflags() { return regs(28); }" -HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","32",0x00010000,\ -"function esp() { return regs(29); }" -HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","33",0x00010000,\ -"function ss() { return regs(30) & 0xffff; }" -HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","34",0x00010000,\ -"function v86_es() { return regs(31) & 0xffff; }" -HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","35",0x00010000,\ -"function v86_ds() { return regs(32) & 0xffff; }" -HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","36",0x00010000,\ -"function v86_fs() { return regs(33) & 0xffff; }" -HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","37",0x00010000,\ -"function v86_gs() { return regs(34) & 0xffff; }" -HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","38",0x00010000,\ -"function peekl(a) { return System.mread(4,a); }" -HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","39",0x00010000,\ -"function pokel(a,b) { return System.mwrite(4,a,b); }" -HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","40",0x00010000,\ -"function peekw(a) { return System.mread(2,a); }" -HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","41",0x00010000,\ -"function pokew(a,b) { return System.mwrite(2,a,b); }" -HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","42",0x00010000,\ -"function peek(a) { return System.mread(1,a); }" -HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","43",0x00010000,\ -"function poke(a,b) { return System.mwrite(1,a,b); }" -HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","44",0x00010000,\ -"function regread(x,y) { return System.regread(x,y); }" -HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","45",0x00010000,\ -"write('JS Registry Init Complete. Welcome to ReactOS kernel scripting');" - ; EOF _____ Modified: trunk/reactos/bootdata/packages/reactos.dff --- trunk/reactos/bootdata/packages/reactos.dff 2005-04-22 09:19:18 UTC (rev 14736) +++ trunk/reactos/bootdata/packages/reactos.dff 2005-04-22 09:45:17 UTC (rev 14737) @@ -167,6 +167,7 @@ subsys\system\vmwinst\vmwinst.exe 1 subsys\system\winlogon\winlogon.exe 1 subsys\system\winefile\winefile.exe 1 +subsys\system\dhcp\dhcp.exe 1 services\eventlog\eventlog.exe 1 services\rpcss\rpcss.exe 1 services\umpnpmgr\umpnpmgr.exe 1 _____ Modified: trunk/reactos/drivers/lib/ip/network/loopback.c --- trunk/reactos/drivers/lib/ip/network/loopback.c 2005-04-22 09:19:18 UTC (rev 14736) +++ trunk/reactos/drivers/lib/ip/network/loopback.c 2005-04-22 09:45:17 UTC (rev 14737) @@ -189,6 +189,10 @@ Loopback = IPCreateInterface(&BindInfo); + Loopback->Name.Buffer = L"Loopback"; + Loopback->Name.MaximumLength = Loopback->Name.Length = + wcslen(Loopback->Name.Buffer) * sizeof(WCHAR); + AddrInitIPv4(&Loopback->Unicast, LOOPBACK_ADDRESS_IPv4); AddrInitIPv4(&Loopback->Netmask, LOOPBACK_ADDRMASK_IPv4); _____ Modified: trunk/reactos/drivers/net/tcpip/datalink/lan.c --- trunk/reactos/drivers/net/tcpip/datalink/lan.c 2005-04-22 09:19:18 UTC (rev 14736) +++ trunk/reactos/drivers/net/tcpip/datalink/lan.c 2005-04-22 09:45:17 UTC (rev 14737) @@ -366,6 +366,8 @@ PLAN_ADAPTER Adapter = (PLAN_ADAPTER)BindingContext; KIRQL OldIrql; + TI_DbgPrint(DEBUG_DATALINK,("called\n")); + TcpipAcquireSpinLock( &LanWorkLock, &OldIrql ); WQItem = ExAllocatePool( NonPagedPool, sizeof(LAN_WQ_ITEM) ); @@ -408,6 +410,8 @@ { ASSERT(KeGetCurrentIrql() == DISPATCH_LEVEL); + TI_DbgPrint(DEBUG_DATALINK,("called\n")); + TransferDataCompleteCalled++; ASSERT(TransferDataCompleteCalled <= TransferDataCalled); @@ -736,59 +740,6 @@ return Status; } -static NTSTATUS ReadIPAddressFromRegistry( HANDLE RegHandle, - PWCHAR RegistryValue, - PIP_ADDRESS Address ) { - UNICODE_STRING ValueName; - UNICODE_STRING UnicodeAddress; - NTSTATUS Status; - ULONG ResultLength; - UCHAR buf[1024]; - PKEY_VALUE_PARTIAL_INFORMATION Information = (PKEY_VALUE_PARTIAL_INFORMATION)buf; - ANSI_STRING AnsiAddress; - ULONG AnsiLen; - - RtlInitUnicodeString(&ValueName, RegistryValue); - Status = - ZwQueryValueKey(RegHandle, - &ValueName, - KeyValuePartialInformation, - Information, - sizeof(buf), - &ResultLength); - - if (!NT_SUCCESS(Status)) - return Status; - /* IP address is stored as a REG_MULTI_SZ - we only pay attention to the first one though */ - TI_DbgPrint(MIN_TRACE, ("Information DataLength: 0x%x\n", Information->DataLength)); - - UnicodeAddress.Buffer = (PWCHAR)&Information->Data; - UnicodeAddress.Length = Information->DataLength; - UnicodeAddress.MaximumLength = Information->DataLength; - - AnsiLen = RtlUnicodeStringToAnsiSize(&UnicodeAddress); - if(!AnsiLen) - return STATUS_NO_MEMORY; - - AnsiAddress.Buffer = exAllocatePoolWithTag(PagedPool, AnsiLen, 0x01020304); - if(!AnsiAddress.Buffer) - return STATUS_NO_MEMORY; - - AnsiAddress.Length = AnsiLen; - AnsiAddress.MaximumLength = AnsiLen; - - Status = RtlUnicodeStringToAnsiString(&AnsiAddress, &UnicodeAddress, FALSE); - if (!NT_SUCCESS(Status)) { - exFreePool(AnsiAddress.Buffer); - return STATUS_UNSUCCESSFUL; - } - - AnsiAddress.Buffer[AnsiAddress.Length] = 0; - AddrInitIPv4(Address, inet_addr(AnsiAddress.Buffer)); - - return STATUS_SUCCESS; -} - static NTSTATUS ReadStringFromRegistry( HANDLE RegHandle, PWCHAR RegistryValue, PUNICODE_STRING String ) { @@ -1001,7 +952,7 @@ PIP_INTERFACE IF; NDIS_STATUS NdisStatus; LLIP_BIND_INFO BindInfo; - IP_ADDRESS DefaultGateway, DefaultMask = { 0 }; + IP_ADDRESS DefaultMask = { 0 }; ULONG Lookahead = LOOKAHEAD_SIZE; NTSTATUS Status; HANDLE RegHandle = 0; @@ -1055,20 +1006,10 @@ TI_DbgPrint(DEBUG_DATALINK,("Adapter Name: %wZ\n", &IF->Name)); } - if(NT_SUCCESS(Status)) - Status = ReadIPAddressFromRegistry( RegHandle, L"DefaultGateway", - &DefaultGateway ); - if(!NT_SUCCESS(Status)) { - Status = STATUS_SUCCESS; - RtlZeroMemory( &DefaultGateway, sizeof(DefaultGateway) ); - } + DefaultMask.Type = IP_ADDRESS_V4; - if(NT_SUCCESS(Status)) - Status = ReadIPAddressFromRegistry( RegHandle, L"IPAddress", - &IF->Unicast ); - if(NT_SUCCESS(Status)) - Status = ReadIPAddressFromRegistry( RegHandle, L"SubnetMask", - &IF->Netmask ); + IF->Unicast = DefaultMask; + IF->Netmask = DefaultMask; IF->Broadcast.Type = IP_ADDRESS_V4; IF->Broadcast.Address.IPv4Address = @@ -1077,33 +1018,6 @@ TI_DbgPrint(DEBUG_DATALINK,("BCAST(IF) %s\n", A2S(&IF->Broadcast))); - if(NT_SUCCESS(Status)) { - /* It's ok to fail some of the above. We'll just use DHCP. */ - TI_DbgPrint - (DEBUG_DATALINK, - ("--> Our IP address on this interface: '%s'\n", - A2S(&IF->Unicast))); - - TI_DbgPrint - (DEBUG_DATALINK, - ("--> Our net mask on this interface: '%s'\n", - A2S(&IF->Netmask))); - - if( DefaultGateway.Address.IPv4Address ) { - TI_DbgPrint - (DEBUG_DATALINK, - ("--> Our gateway is: '%s'\n", - A2S(&DefaultGateway))); - - /* Create a default route */ - RouterCreateRoute( &DefaultMask, /* Zero */ - &DefaultMask, /* Zero */ - &DefaultGateway, - IF, - 1 ); - } - } - /* Get maximum link speed */ NdisStatus = NDISCall(Adapter, NdisRequestQueryInformation, _____ Modified: trunk/reactos/drivers/net/tcpip/include/debug.h --- trunk/reactos/drivers/net/tcpip/include/debug.h 2005-04-22 09:19:18 UTC (rev 14736) +++ trunk/reactos/drivers/net/tcpip/include/debug.h 2005-04-22 09:45:17 UTC (rev 14737) @@ -32,6 +32,7 @@ #define DEBUG_NCACHE 0x00400000 #define DEBUG_CPOINT 0x00800000 #define DEBUG_LOCK 0x01000000 +#define DEBUG_INFO 0x02000000 #define DEBUG_ULTRA 0xFFFFFFFF #ifdef DBG _____ Modified: trunk/reactos/drivers/net/tcpip/tcpip/iinfo.c --- trunk/reactos/drivers/net/tcpip/tcpip/iinfo.c 2005-04-22 09:19:18 UTC (rev 14736) +++ trunk/reactos/drivers/net/tcpip/tcpip/iinfo.c 2005-04-22 09:45:17 UTC (rev 14737) @@ -21,7 +21,7 @@ ULONG Size; UINT DescrLenMax = MAX_IFDESCR_LEN - 1; - TI_DbgPrint(MAX_TRACE, + TI_DbgPrint(DEBUG_INFO, ("Getting IFEntry MIB (IF %08x LA %08x) (%04x:%d)\n", Interface, IF, ID->tei_entity, ID->tei_instance)); @@ -38,7 +38,7 @@ OutData->Type = Interface == Loopback ? MIB_IF_TYPE_LOOPBACK : MIB_IF_TYPE_ETHERNET; OutData->Mtu = Interface->MTU; - TI_DbgPrint(MAX_TRACE, + TI_DbgPrint(DEBUG_INFO, ("Getting interface speed\n")); OutData->PhysAddrLen = Interface->AddressLength; OutData->AdminStatus = MIB_IF_ADMIN_STATUS_UP; @@ -53,27 +53,28 @@ if( IF ) { GetInterfaceSpeed( Interface, (PUINT)&OutData->Speed ); - TI_DbgPrint(MAX_TRACE, + TI_DbgPrint(DEBUG_INFO, ("IF Speed = %d * 100bps\n", OutData->Speed)); memcpy(OutData->PhysAddr,Interface->Address,Interface->AddressLength); - TI_DbgPrint(MAX_TRACE, ("Got HWAddr\n")); - GetInterfaceName( Interface, IFDescr, MAX_IFDESCR_LEN - 1 ); - DescrLenMax = strlen( IFDescr ) + 1; + TI_DbgPrint(DEBUG_INFO, ("Got HWAddr\n")); } - IFDescr[DescrLenMax] = 0; /* Terminate ifdescr string */ + GetInterfaceName( Interface, IFDescr, MAX_IFDESCR_LEN - 1 ); + DescrLenMax = strlen( IFDescr ) + 1; - TI_DbgPrint(MAX_TRACE, ("Copied in name %s\n", IFDescr)); + TI_DbgPrint(DEBUG_INFO, ("Copied in name %s\n", IFDescr)); OutData->DescrLen = DescrLenMax; IFDescr += DescrLenMax; Size = IFDescr - (PCHAR)OutData + 1; - TI_DbgPrint(MAX_TRACE, ("Finished IFEntry MIB (%04x:%d) size %d\n", + TI_DbgPrint(DEBUG_INFO, ("Finished IFEntry MIB (%04x:%d) size %d\n", ID->tei_entity, ID->tei_instance, Size)); Status = InfoCopyOut( (PCHAR)OutData, Size, Buffer, BufferSize ); ExFreePool( OutData ); + TI_DbgPrint(DEBUG_INFO,("Returning %x\n", Status)); + return Status; } @@ -104,7 +105,7 @@ TDIEntityID *id, PCHAR Buffer, UINT BufferSize ) { - TI_DbgPrint(MAX_TRACE, ("Got Request: Class %x Type %x Id %x, EntityID %x:%x\n", + TI_DbgPrint(DEBUG_INFO, ("Got Request: Class %x Type %x Id %x, EntityID %x:%x\n", InfoClass, InfoId, id->tei_entity, id->tei_instance)); return TDI_INVALID_REQUEST; } _____ Modified: trunk/reactos/drivers/net/tcpip/tcpip/info.c --- trunk/reactos/drivers/net/tcpip/tcpip/info.c 2005-04-22 09:19:18 UTC (rev 14736) +++ trunk/reactos/drivers/net/tcpip/tcpip/info.c 2005-04-22 09:45:17 UTC (rev 14737) @@ -28,7 +28,7 @@ KIRQL OldIrql; UINT Count = 0, i; - TI_DbgPrint(MAX_TRACE, + TI_DbgPrint(DEBUG_INFO, ("Inserting interface %08x (%d entities already)\n", Interface, EntityCount)); @@ -38,7 +38,7 @@ for( i = 0; i < EntityCount; i++ ) if( EntityList[i].tei_entity == IF_ENTITY ) { Count++; - TI_DbgPrint(MAX_TRACE, ("Entity %d is an IF. Found %d\n", + TI_DbgPrint(DEBUG_INFO, ("Entity %d is an IF. Found %d\n", i, Count)); } @@ -80,7 +80,7 @@ UINT Count, Size, BufSize = *BufferSize; KIRQL OldIrql; - TI_DbgPrint(MAX_TRACE,("About to copy %d TDIEntityIDs to user\n", + TI_DbgPrint(DEBUG_INFO,("About to copy %d TDIEntityIDs to user\n", EntityCount)); TcpipAcquireSpinLock(&EntityListLock, &OldIrql); @@ -134,7 +134,7 @@ BOOL FoundEntity = FALSE; InfoRequest_f InfoRequest = NULL; - TI_DbgPrint(MAX_TRACE, + TI_DbgPrint(DEBUG_INFO, ("InfoEx Req: %x %x %x!%04x:%d\n", ID->toi_class, ID->toi_type, @@ -148,7 +148,7 @@ if ((ID->toi_class != INFO_CLASS_GENERIC) || (ID->toi_type != INFO_TYPE_PROVIDER) || (ID->toi_id != ENTITY_LIST_ID)) { - TI_DbgPrint(MAX_TRACE,("Invalid parameter\n")); + TI_DbgPrint(DEBUG_INFO,("Invalid parameter\n")); Status = TDI_INVALID_PARAMETER; } else Status = InfoTdiQueryListEntities(Buffer, BufferSize); @@ -168,7 +168,7 @@ TcpipReleaseSpinLock( &EntityListLock, OldIrql ); if( FoundEntity ) { - TI_DbgPrint(MAX_TRACE, + TI_DbgPrint(DEBUG_INFO, ("Calling Entity %d (%04x:%d) InfoEx (%x,%x,%x)\n", i, ID->toi_entity.tei_entity, ID->toi_entity.tei_instance, @@ -183,7 +183,7 @@ } } - TI_DbgPrint(MAX_TRACE,("Status: %08x\n", Status)); + TI_DbgPrint(DEBUG_INFO,("Status: %08x\n", Status)); return Status; } _____ Modified: trunk/reactos/drivers/net/tcpip/tcpip/ninfo.c --- trunk/reactos/drivers/net/tcpip/tcpip/ninfo.c 2005-04-22 09:19:18 UTC (rev 14736) +++ trunk/reactos/drivers/net/tcpip/tcpip/ninfo.c 2005-04-22 09:45:17 UTC (rev 14737) @@ -25,7 +25,7 @@ ExAllocatePool( NonPagedPool, sizeof( IPADDR_ENTRY ) * IfCount ); PIPADDR_ENTRY IpCurrent = IpAddress; - TI_DbgPrint(MAX_TRACE, ("Called.\n")); + TI_DbgPrint(DEBUG_INFO, ("Called.\n")); TcpipAcquireSpinLock(&InterfaceListLock, &OldIrql); @@ -56,7 +56,7 @@ ExFreePool( IpAddress ); - TI_DbgPrint(MAX_TRACE, ("Returning %08x\n", Status)); + TI_DbgPrint(DEBUG_INFO, ("Returning %08x\n", Status)); return Status; } @@ -73,7 +73,7 @@ PIPROUTE_ENTRY RouteEntries = ExAllocatePool( NonPagedPool, Size ), RtCurrent = RouteEntries; - TI_DbgPrint(MAX_TRACE, ("Called, routes = %d, RCache = %08x\n", + TI_DbgPrint(DEBUG_INFO, ("Called, routes = %d, RCache = %08x\n", RtCount, RCache)); if( !RCache || !RouteEntries ) { @@ -106,7 +106,7 @@ RtCurrent->Type = TDI_ADDRESS_TYPE_IP; TI_DbgPrint - (MAX_TRACE, + (DEBUG_INFO, ("%d: NA %08x NM %08x GW %08x MT %x\n", RtCurrent - RouteEntries, RtCurrent->Dest, @@ -132,7 +132,7 @@ ExFreePool( RouteEntries ); ExFreePool( RCache ); - TI_DbgPrint(MAX_TRACE, ("Returning %08x\n", Status)); + TI_DbgPrint(DEBUG_INFO, ("Returning %08x\n", Status)); return Status; } @@ -144,7 +144,7 @@ UINT RouteCount = CountFIBs( NULL ); TDI_STATUS Status = TDI_INVALID_REQUEST; - TI_DbgPrint(MAX_TRACE, ("Called.\n")); + TI_DbgPrint(DEBUG_INFO, ("Called.\n")); RtlZeroMemory(&SnmpInfo, sizeof(IPSNMP_INFO)); @@ -155,7 +155,7 @@ Status = InfoCopyOut( (PCHAR)&SnmpInfo, sizeof(SnmpInfo), Buffer, BufferSize ); - TI_DbgPrint(MAX_TRACE, ("Returning %08x\n", Status)); + TI_DbgPrint(DEBUG_INFO, ("Returning %08x\n", Status)); return Status; } @@ -169,7 +169,7 @@ PUINT BufferSize ) { TDI_STATUS Status = TDI_INVALID_REQUEST; - TI_DbgPrint(MAX_TRACE, ("Called.\n")); + TI_DbgPrint(DEBUG_INFO, ("Called.\n")); switch( InfoClass ) { case INFO_CLASS_GENERIC: @@ -200,7 +200,7 @@ } } - TI_DbgPrint(MAX_TRACE, ("Returning %08x\n", Status)); + TI_DbgPrint(DEBUG_INFO, ("Returning %08x\n", Status)); return Status; } @@ -218,7 +218,7 @@ IP_ADDRESS Router; PNEIGHBOR_CACHE_ENTRY NCE; - TI_DbgPrint(MID_TRACE,("Called\n")); + TI_DbgPrint(DEBUG_INFO,("Called\n")); OskitDumpBuffer( (OSK_PCHAR)Buffer, BufferSize ); @@ -232,7 +232,7 @@ AddrInitIPv4( &Router, Route->Gw ); if( Route->Type == IP_ROUTE_TYPE_ADD ) { /* Add the route */ - TI_DbgPrint(MID_TRACE,("Adding route (%s)\n", A2S(&Address))); + TI_DbgPrint(DEBUG_INFO,("Adding route (%s)\n", A2S(&Address))); /* Find the existing route this belongs to */ NCE = RouterGetRoute( &Router ); /* Really add the route */ @@ -243,12 +243,12 @@ else Status = STATUS_UNSUCCESSFUL; } else if( Route->Type == IP_ROUTE_TYPE_DEL ) { - TI_DbgPrint(MID_TRACE,("Removing route (%s)\n", A2S(&Address))); + TI_DbgPrint(DEBUG_INFO,("Removing route (%s)\n", A2S(&Address))); Status = RouterRemoveRoute( &Address, &Router ); } else Status = TDI_INVALID_REQUEST; } - TI_DbgPrint(MID_TRACE,("Returning %x\n", Status)); + TI_DbgPrint(DEBUG_INFO,("Returning %x\n", Status)); return Status; } _____ Modified: trunk/reactos/subsys/system/dhcp/Makefile --- trunk/reactos/subsys/system/dhcp/Makefile 2005-04-22 09:19:18 UTC (rev 14736) +++ trunk/reactos/subsys/system/dhcp/Makefile 2005-04-22 09:45:17 UTC (rev 14737) @@ -16,6 +16,8 @@ TARGET_SDKLIBS = iphlpapi.a ws2_32.a ntdll.a +TARGET_INSTALLDIR = system32 + TARGET_RC_SRCS = dhcp.rc TARGET_RC_BINSRC = _____ Modified: trunk/reactos/subsys/system/dhcp/adapter.c --- trunk/reactos/subsys/system/dhcp/adapter.c 2005-04-22 09:19:18 UTC (rev 14736) +++ trunk/reactos/subsys/system/dhcp/adapter.c 2005-04-22 09:45:17 UTC (rev 14737) @@ -5,34 +5,212 @@ static WSADATA wsd; extern struct interface_info *ifi; -DWORD GetAddress( PDHCP_ADAPTER Adapter ) { - PMIB_IPADDRTABLE AddressTable = NULL; - ULONG i, Size = 0, NumAddressRows; - DWORD Error = GetIpAddrTable( AddressTable, &Size, FALSE ); +PCHAR *GetSubkeyNames( PCHAR MainKeyName, PCHAR Append ) { + int i = 0; + DWORD Error; + HKEY MainKey; + PCHAR *Out, OutKeyName; + DWORD CharTotal = 0, ThisKey, AppendLen = 1 + strlen(Append); + DWORD MaxSubKeyLen = 0, MaxSubKeys = 0; - while( Error == ERROR_INSUFFICIENT_BUFFER ) { - free( AddressTable ); - AddressTable = malloc( Size ); - if( AddressTable ) - Error = GetIpAddrTable( AddressTable, &Size, FALSE ); + Error = RegOpenKey( HKEY_LOCAL_MACHINE, MainKeyName, &MainKey ); + + if( Error ) return NULL; + + Error = RegQueryInfoKey + ( MainKey, + NULL, NULL, NULL, + &MaxSubKeys, &MaxSubKeyLen, + NULL, NULL, NULL, NULL, NULL, NULL ); + + DH_DbgPrint(MID_TRACE,("MaxSubKeys: %d, MaxSubKeyLen %d\n", + MaxSubKeys, MaxSubKeyLen)); + + CharTotal = (sizeof(PCHAR) + MaxSubKeyLen + AppendLen) * (MaxSubKeys + 1); + + DH_DbgPrint(MID_TRACE,("AppendLen: %d, CharTotal: %d\n", + AppendLen, CharTotal)); + + Out = malloc( CharTotal ); + OutKeyName = ((PCHAR)&Out[MaxSubKeys+1]); + + if( !Out ) { RegCloseKey( MainKey ); return NULL; } + + i = 0; + do { + Out[i] = OutKeyName; + Error = RegEnumKey( MainKey, i, OutKeyName, MaxSubKeyLen ); + if( !Error ) { + strcat( OutKeyName, Append ); + DH_DbgPrint(MID_TRACE,("[%d]: %s\n", i, OutKeyName)); + OutKeyName += strlen(OutKeyName) + 1; + i++; + } else Out[i] = 0; + } while( Error == ERROR_SUCCESS ); + + RegCloseKey( MainKey ); + + return Out; +} + +PCHAR RegReadString( HKEY Root, PCHAR Subkey, PCHAR Value ) { + PCHAR SubOut = NULL; + DWORD SubOutLen = 0, Error = 0; + HKEY ValueKey = NULL; + + DH_DbgPrint(MID_TRACE,("Looking in %x:%s:%s\n", Root, Subkey, Value )); + + if( Subkey && strlen(Subkey) ) { + if( RegOpenKey( Root, Subkey, &ValueKey ) != ERROR_SUCCESS ) + goto regerror; + } else ValueKey = Root; + + DH_DbgPrint(MID_TRACE,("Got Key %x\n", ValueKey)); + + if( (Error = RegQueryValueEx( ValueKey, Value, NULL, NULL, + SubOut, &SubOutLen )) != ERROR_SUCCESS ) + goto regerror; + + DH_DbgPrint(MID_TRACE,("Value %s has size %d\n", Value, SubOutLen)); + + if( !(SubOut = malloc(SubOutLen)) ) + goto regerror; + + if( (Error = RegQueryValueEx( ValueKey, Value, NULL, NULL, + SubOut, &SubOutLen )) != ERROR_SUCCESS ) + goto regerror; + + DH_DbgPrint(MID_TRACE,("Value %s is %s\n", Value, SubOut)); + + goto cleanup; + +regerror: + if( SubOut ) free( SubOut ); +cleanup: + if( ValueKey && ValueKey != Root ) { + DH_DbgPrint(MID_TRACE,("Closing key %x\n", ValueKey)); + RegCloseKey( ValueKey ); } - if( Error != ERROR_SUCCESS ) { - free( AddressTable ); - return Error; + + DH_DbgPrint(MID_TRACE,("Returning %x with error %d\n", SubOut, Error)); + + return SubOut; +} + +HKEY FindAdapterKey( PDHCP_ADAPTER Adapter ) { + int i = 0; + PCHAR EnumKeyName = + "SYSTEM\\CurrentControlSet\\Control\\Class\\" + "{4D36E972-E325-11CE-BFC1-08002BE10318}"; + PCHAR TargetKeyNameStart = + "SYSTEM\\CurrentControlSet\\Services\\"; + PCHAR TargetKeyNameEnd = "\\Parameters\\Tcpip"; + PCHAR TargetKeyName = NULL; + PCHAR *EnumKeysLinkage = GetSubkeyNames( EnumKeyName, "\\Linkage" ); + PCHAR *EnumKeysTop = GetSubkeyNames( EnumKeyName, "" ); + PCHAR RootDevice = NULL, DriverDesc = NULL; + HKEY EnumKey, OutKey = NULL; + DWORD Error = ERROR_SUCCESS; + + if( !EnumKeysLinkage || !EnumKeysTop ) goto cleanup; + + Error = RegOpenKey( HKEY_LOCAL_MACHINE, EnumKeyName, &EnumKey ); + + if( Error ) goto cleanup; + + for( i = 0; EnumKeysLinkage[i]; i++ ) { + RootDevice = RegReadString + ( EnumKey, EnumKeysLinkage[i], "RootDevice" ); + DriverDesc = RegReadString + ( EnumKey, EnumKeysTop[i], "DriverDesc" ); + + if( DriverDesc && + !strcmp( DriverDesc, Adapter->DhclientInfo.name ) ) { + TargetKeyName = + malloc( strlen( TargetKeyNameStart ) + + strlen( RootDevice ) + + strlen( TargetKeyNameEnd ) + 1 ); + if( !TargetKeyName ) goto cleanup; + sprintf( TargetKeyName, "%s%s%s", + TargetKeyNameStart, RootDevice, TargetKeyNameEnd ); + Error = RegOpenKey( HKEY_LOCAL_MACHINE, TargetKeyName, &OutKey ); + break; + } else { + free( RootDevice ); RootDevice = 0; + free( DriverDesc ); DriverDesc = 0; + } } - NumAddressRows = Size / sizeof(MIB_IPADDRTABLE); - for( i = 0; i < AddressTable->dwNumEntries; i++ ) { - DH_DbgPrint(MID_TRACE, - ("Finding address for adapter %d: (%d -> %x)\n", - Adapter->IfMib.dwIndex, - AddressTable->table[i].dwIndex, - AddressTable->table[i].dwAddr)); - if( Adapter->IfMib.dwIndex == AddressTable->table[i].dwIndex ) { - memcpy( &Adapter->IfAddr, &AddressTable->table[i], - sizeof( MIB_IPADDRROW ) ); +cleanup: + if( RootDevice ) free( RootDevice ); + if( DriverDesc ) free( DriverDesc ); + if( EnumKeysLinkage ) free( EnumKeysLinkage ); + if( EnumKeysTop ) free( EnumKeysTop ); + if( TargetKeyName ) free( TargetKeyName ); + + return OutKey; +} + +BOOL PrepareAdapterForService( PDHCP_ADAPTER Adapter ) { + HKEY AdapterKey = NULL; + PCHAR IPAddress = NULL, Netmask = NULL, DefaultGateway = NULL; + NTSTATUS Status = STATUS_SUCCESS; + DWORD Error = ERROR_SUCCESS; + MIB_IPFORWARDROW DefGatewayRow; + + Adapter->DhclientState.config = &Adapter->DhclientConfig; + strncpy(Adapter->DhclientInfo.name, Adapter->IfMib.bDescr, + sizeof(Adapter->DhclientInfo.name)); + + AdapterKey = FindAdapterKey( Adapter ); + if( AdapterKey ) + IPAddress = RegReadString( AdapterKey, NULL, "IPAddress" ); + + if( IPAddress && strcmp( IPAddress, "0.0.0.0" ) ) { + /* Non-automatic case */ + DH_DbgPrint + (MID_TRACE,("Adapter Name: [%s] (Bind Status %x) (static %s)\n", + Adapter->DhclientInfo.name, + Adapter->BindStatus, + IPAddress)); + + Adapter->DhclientState.state = S_STATIC; + + Netmask = RegReadString( AdapterKey, NULL, "Subnetmask" ); + if( !Netmask ) Netmask = "255.255.255.0"; + + Status = AddIPAddress( inet_addr( IPAddress ), + inet_addr( Netmask ), + Adapter->IfMib.dwIndex, + &Adapter->NteContext, + &Adapter->NteInstance ); + + DefaultGateway = RegReadString( AdapterKey, NULL, "DefaultGateway" ); + + if( DefaultGateway ) { + DefGatewayRow.dwForwardDest = 0; + DefGatewayRow.dwForwardMask = 0; + DefGatewayRow.dwForwardMetric1 = 1; + DefGatewayRow.dwForwardNextHop = inet_addr(DefaultGateway); + Error = CreateIpForwardEntry( &DefGatewayRow ); + if( Error ) + warning("Failed to set default gateway %s: %d\n", + DefaultGateway, Error); } + + if( DefaultGateway ) free( DefaultGateway ); + if( Netmask ) free( Netmask ); + } else { + /* Automatic case */ + DH_DbgPrint + (MID_TRACE,("Adapter Name: [%s] (Bind Status %x) (dynamic)\n", + Adapter->DhclientInfo.name, + Adapter->BindStatus)); } + + if( IPAddress ) free( IPAddress ); + + return TRUE; } /* @@ -66,20 +244,23 @@ Table->table[i].dwIndex)); Adapter = calloc( sizeof( DHCP_ADAPTER ) + Table->table[i].dwMtu, 1 ); - if( Adapter && Table->table[i].dwType ) { + if( Adapter && Table->table[i].dwType == MIB_IF_TYPE_ETHERNET ) { memcpy( &Adapter->IfMib, &Table->table[i], sizeof(Adapter->IfMib) ); - GetAddress( Adapter ); - InsertTailList( &AdapterList, &Adapter->ListEntry ); - Adapter->DhclientInfo.next = ifi; Adapter->DhclientInfo.client = &Adapter->DhclientState; Adapter->DhclientInfo.rbuf = Adapter->recv_buf; Adapter->DhclientInfo.rbuf_max = Table->table[i].dwMtu; Adapter->DhclientInfo.rbuf_len = Adapter->DhclientInfo.rbuf_offset = 0; + memcpy(Adapter->DhclientInfo.hw_address.haddr, + Adapter->IfMib.bPhysAddr, + Adapter->IfMib.dwPhysAddrLen); + Adapter->DhclientInfo.hw_address.hlen = + Adapter->IfMib.dwPhysAddrLen; + if( DhcpSocket == INVALID_SOCKET ) { DhcpSocket = - Adapter->DhclientInfo.rfdesc = + Adapter->DhclientInfo.rfdesc = Adapter->DhclientInfo.wfdesc = socket( AF_INET, SOCK_DGRAM, IPPROTO_UDP ); Adapter->ListenAddr.sin_family = AF_INET; @@ -93,7 +274,7 @@ Adapter->DhclientInfo.rfdesc = Adapter->DhclientInfo.wfdesc = DhcpSocket; } - Adapter->DhclientState.config = &Adapter->DhclientConfig; + Adapter->DhclientConfig.timeout = DHCP_PANIC_TIMEOUT; Adapter->DhclientConfig.initial_interval = DHCP_DISCOVER_INTERVAL; Adapter->DhclientConfig.retry_interval = DHCP_DISCOVER_INTERVAL; @@ -102,13 +283,17 @@ Adapter->DhclientConfig.backoff_cutoff = DHCP_BACKOFF_MAX; Adapter->DhclientState.interval = Adapter->DhclientConfig.retry_interval; - strncpy(Adapter->DhclientInfo.name, Adapter->IfMib.bDescr, - sizeof(Adapter->DhclientInfo.name)); - DH_DbgPrint(MID_TRACE,("Adapter Name: [%s] (Bind Status %x)\n", - Adapter->DhclientInfo.name, - Adapter->BindStatus)); - ifi = &Adapter->DhclientInfo; - } + + if( PrepareAdapterForService( Adapter ) ) { + Adapter->DhclientInfo.next = ifi; + ifi = &Adapter->DhclientInfo; + InsertTailList( &AdapterList, &Adapter->ListEntry ); + } else { free( Adapter ); Adapter = 0; } + } else { free( Adapter ); Adapter = 0; } + + if( !Adapter ) + DH_DbgPrint(MID_TRACE,("Adapter %d was rejected\n", + Table->table[i].dwIndex)); } DH_DbgPrint(MID_TRACE,("done with AdapterInit\n")); _____ Modified: trunk/reactos/subsys/system/dhcp/api.c --- trunk/reactos/subsys/system/dhcp/api.c 2005-04-22 09:19:18 UTC (rev 14736) +++ trunk/reactos/subsys/system/dhcp/api.c 2005-04-22 09:45:17 UTC (rev 14737) @@ -38,8 +38,11 @@ Reply.Reply = Adapter ? 1 : 0; if( Adapter ) { - Adapter->DhclientState.state = S_REBOOTING; - send_discover( &Adapter->DhclientInfo ); + add_protocol( Adapter->DhclientInfo.name, + Adapter->DhclientInfo.rfdesc, got_one, + &Adapter->DhclientInfo ); + Adapter->DhclientInfo.client->state = S_INIT; + state_reboot(&Adapter->DhclientInfo); } ApiUnlock(); @@ -77,6 +80,7 @@ if( Adapter ) { DeleteIPAddress( Adapter->NteContext ); + remove_protocol( find_protocol_by_adapter( &Adapter->DhclientInfo ) ); } ApiUnlock(); @@ -101,6 +105,7 @@ Adapter->DhclientState.state = S_BOUND; + send_discover( &Adapter->DhclientInfo ); state_bound( &Adapter->DhclientInfo ); ApiUnlock(); @@ -121,7 +126,8 @@ if( Adapter ) { DeleteIPAddress( Adapter->NteContext ); - Adapter->DhclientState.state = S_BOUND; + Adapter->DhclientState.state = S_STATIC; + remove_protocol( find_protocol_by_adapter( &Adapter->DhclientInfo ) ); Status = AddIPAddress( Req->Body.StaticRefreshParams.IPAddress, Req->Body.StaticRefreshParams.Netmask, Req->AdapterIndex, _____ Modified: trunk/reactos/subsys/system/dhcp/dhclient.c --- trunk/reactos/subsys/system/dhcp/dhclient.c 2005-04-22 09:19:18 UTC (rev 14736) +++ trunk/reactos/subsys/system/dhcp/dhclient.c 2005-04-22 09:45:17 UTC (rev 14737) @@ -108,6 +108,7 @@ int res_hnok(const char *dn); char *option_as_string(unsigned int code, unsigned char *data, int len); int fork_privchld(int, int); +int check_arp( struct interface_info *ip, struct client_lease *lp ); #define ROUNDUP(a) \ ((a) > 0 ? (1 + (((a) - 1) | (sizeof(long) - 1))) : sizeof(long)) @@ -115,143 +116,11 @@ time_t scripttime; -#if 0 - -int -findproto(char *cp, int n) -{ - struct sockaddr *sa; - int i; - - if (n == 0) - return -1; - for (i = 1; i; i <<= 1) { - if (i & n) { [truncated at 1000 lines; 674 more skipped]
19 years, 8 months
1
0
0
0
[chorns] 14736: Clean object files for static libraries
by chorns@svn.reactos.com
Clean object files for static libraries Modified: branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/mingw.cpp Modified: branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler .cpp Modified: branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler .h Added: branches/xmlbuildsystem/reactos/tools/rsym.mak Modified: branches/xmlbuildsystem/reactos/tools/tools.mak _____ Modified: branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/mingw.cpp --- branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/mingw.cpp 2005-04-21 21:01:05 UTC (rev 14735) +++ branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/mingw.cpp 2005-04-22 09:19:18 UTC (rev 14736) @@ -427,6 +427,7 @@ GenerateGlobalCFlagsAndProperties ( "=", ProjectNode.non_if_data ); + fprintf ( fMakefile, "PROJECT_RCFLAGS := $(PROJECT_CFLAGS)\n" ); fprintf ( fMakefile, "PROJECT_WIDLFLAGS := $(PROJECT_CFLAGS)\n" ); fprintf ( fMakefile, "PROJECT_LFLAGS := %s\n", _____ Modified: branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler .cpp --- branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler .cpp 2005-04-21 21:01:05 UTC (rev 14735) +++ branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler .cpp 2005-04-22 09:19:18 UTC (rev 14736) @@ -429,11 +429,11 @@ if ( 0 == clean_files.size() ) return; fprintf ( fMakefile, ".PHONY: %s_clean\n", module.name.c_str() ); - fprintf ( fMakefile, "%s_clean:\n\t-@$(rm)", module.name.c_str() ); + fprintf ( fMakefile, "%s_clean:\n\t-@${rm}", module.name.c_str() ); for ( size_t i = 0; i < clean_files.size(); i++ ) { if ( 9==((i+1)%10) ) - fprintf ( fMakefile, " 2>$(NUL)\n\t-@$(rm)" ); + fprintf ( fMakefile, " 2>$(NUL)\n\t-@${rm}" ); fprintf ( fMakefile, " %s", clean_files[i].c_str() ); } fprintf ( fMakefile, " 2>$(NUL)\n" ); @@ -1147,13 +1147,58 @@ } void -MingwModuleHandler::GenerateCleanObjectsAsYouGoCode ( const string& files ) +MergeStringVector ( const vector<string>& input, + vector<string>& output ) { + int wrap_at = 25; + string s; + int wrap_count = -1; + for ( size_t i = 0; i < input.size (); i++ ) + { + if ( input[i].size () == 0 ) + continue; + if ( wrap_count++ == wrap_at ) + { + output.push_back ( s ); + s = ""; + wrap_count = 0; + } + else if ( s.size () > 0) + s += " "; + s += input[i]; + } + if ( s.length () > 0 ) + output.push_back ( s ); +} + +void +MingwModuleHandler::GetObjectsVector ( const IfableData& data, + vector<string>& objectFiles ) const +{ + for ( size_t i = 0; i < data.files.size (); i++ ) + { + File& file = *data.files[i]; + objectFiles.push_back ( GetObjectFilename ( file.name, NULL ) ); + } +} + +void +MingwModuleHandler::GenerateCleanObjectsAsYouGoCode () const +{ if ( backend->cleanAsYouGo ) { - fprintf ( fMakefile, - "\t-@${rm} %s 2>$(NUL)\n", - files.c_str () ); + vector<string> objectFiles; + GetObjectsVector ( module.non_if_data, + objectFiles ); + vector<string> lines; + MergeStringVector ( objectFiles, + lines ); + for ( size_t i = 0; i < lines.size (); i++ ) + { + fprintf ( fMakefile, + "\t-@${rm} %s 2>$(NUL)\n", + lines[i].c_str () ); + } } } @@ -1226,7 +1271,7 @@ "\t-@${rm} %s 2>$(NUL)\n", temp_exp.c_str () ); - GenerateCleanObjectsAsYouGoCode ( objectsMacro ); + GenerateCleanObjectsAsYouGoCode (); } else { @@ -1239,7 +1284,7 @@ libsMacro.c_str (), GetLinkerMacro ().c_str () ); - GenerateCleanObjectsAsYouGoCode ( objectsMacro ); + GenerateCleanObjectsAsYouGoCode (); } GenerateBuildMapCode (); @@ -1362,6 +1407,8 @@ ar.c_str (), objs_macro.c_str ()); + GenerateCleanObjectsAsYouGoCode (); + return archiveFilename; } _____ Modified: branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler .h --- branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler .h 2005-04-21 21:01:05 UTC (rev 14735) +++ branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler .h 2005-04-22 09:19:18 UTC (rev 14736) @@ -38,6 +38,8 @@ string_list* pclean_files ); std::string GetModuleTargets ( const Module& module ); + void GetObjectsVector ( const IfableData& data, + std::vector<std::string>& objectFiles ) const; void GenerateObjectMacro(); void GenerateTargetMacro(); void GenerateOtherMacros(); @@ -77,7 +79,7 @@ std::string GetLinkingDependenciesMacro () const; std::string GetLibsMacro () const; std::string GetLinkerMacro () const; - void GenerateCleanObjectsAsYouGoCode ( const std::string& files ); + void GenerateCleanObjectsAsYouGoCode () const; void GenerateLinkerCommand ( const std::string& dependencies, const std::string& linker, const std::string& linkerParameters, _____ Added: branches/xmlbuildsystem/reactos/tools/rsym.mak --- branches/xmlbuildsystem/reactos/tools/rsym.mak 2005-04-21 21:01:05 UTC (rev 14735) +++ branches/xmlbuildsystem/reactos/tools/rsym.mak 2005-04-22 09:19:18 UTC (rev 14736) @@ -0,0 +1,41 @@ +RSYM_BASE = $(TOOLS_BASE) +RSYM_BASE_ = $(RSYM_BASE)$(SEP) + +RSYM_INT = $(INTERMEDIATE_)$(RSYM_BASE) +RSYM_INT_ = $(RSYM_INT)$(SEP) +RSYM_OUT = $(OUTPUT_)$(RSYM_BASE) +RSYM_OUT_ = $(RSYM_OUT)$(SEP) + +RSYM_TARGET = \ + $(EXEPREFIX)$(RSYM_OUT_)rsym$(EXEPOSTFIX) + +RSYM_SOURCES = \ + $(RSYM_BASE_)rsym.c \ + $(RSYM_BASE_)rsym_common.c + +RSYM_OBJECTS = \ + $(addprefix $(INTERMEDIATE_), $(RSYM_SOURCES:.c=.o)) + +RSYM_HOST_CFLAGS = -g -Werror -Wall + +RSYM_HOST_LFLAGS = -g + +.PHONY: rsym +rsym: $(RSYM_TARGET) + +$(RSYM_TARGET): $(RSYM_OBJECTS) | $(RSYM_OUT) + $(ECHO_LD) + ${host_gcc} $(RSYM_OBJECTS) $(RSYM_HOST_LFLAGS) -o $@ + +$(RSYM_INT_)rsym.o: $(RSYM_BASE_)rsym.c | $(RSYM_INT) + $(ECHO_CC) + ${host_gcc} $(RSYM_HOST_CFLAGS) -c $< -o $@ + +$(RSYM_INT_)rsym_common.o: $(RSYM_BASE_)rsym_common.c | $(RSYM_INT) + $(ECHO_CC) + ${host_gcc} $(RSYM_HOST_CFLAGS) -c $< -o $@ + +.PHONY: rsym_clean +rsym_clean: + -@$(nrm) $(RSYM_TARGET) $(RSYM_OBJECTS) 2>$(NUL) +clean: rsym_clean Property changes on: branches/xmlbuildsystem/reactos/tools/rsym.mak ___________________________________________________________________ Name: svn:eol-style + native _____ Modified: branches/xmlbuildsystem/reactos/tools/tools.mak --- branches/xmlbuildsystem/reactos/tools/tools.mak 2005-04-21 21:01:05 UTC (rev 14735) +++ branches/xmlbuildsystem/reactos/tools/tools.mak 2005-04-22 09:19:18 UTC (rev 14736) @@ -15,49 +15,8 @@ ${mkdir} $@ endif -RSYM_BASE = $(TOOLS_BASE) -RSYM_BASE_ = $(RSYM_BASE)$(SEP) -RSYM_INT = $(INTERMEDIATE_)$(RSYM_BASE) -RSYM_INT_ = $(RSYM_INT)$(SEP) -RSYM_OUT = $(OUTPUT_)$(RSYM_BASE) -RSYM_OUT_ = $(RSYM_OUT)$(SEP) - -RSYM_TARGET = \ - $(EXEPREFIX)$(RSYM_OUT_)rsym$(EXEPOSTFIX) - -RSYM_SOURCES = \ - $(RSYM_BASE_)rsym.c \ - $(RSYM_BASE_)rsym_common.c - -RSYM_OBJECTS = \ - $(addprefix $(INTERMEDIATE_), $(RSYM_SOURCES:.c=.o)) - -RSYM_HOST_CFLAGS = -g -Werror -Wall - -RSYM_HOST_LFLAGS = -g - -.PHONY: rsym -rsym: $(RSYM_TARGET) - -$(RSYM_TARGET): $(RSYM_OBJECTS) | $(RSYM_OUT) - $(ECHO_LD) - ${host_gcc} $(RSYM_OBJECTS) $(RSYM_HOST_LFLAGS) -o $@ - -$(RSYM_INT_)rsym.o: $(RSYM_BASE_)rsym.c | $(RSYM_INT) - $(ECHO_CC) - ${host_gcc} $(RSYM_HOST_CFLAGS) -c $< -o $@ - -$(RSYM_INT_)rsym_common.o: $(RSYM_BASE_)rsym_common.c | $(RSYM_INT) - $(ECHO_CC) - ${host_gcc} $(RSYM_HOST_CFLAGS) -c $< -o $@ - -.PHONY: rsym_clean -rsym_clean: - -@$(rm) $(RSYM_TARGET) $(RSYM_OBJECTS) 2>$(NUL) -clean: rsym_clean - - +include tools/rsym.mak include tools/bin2res/bin2res.mak include tools/buildno/buildno.mak include tools/cabman/cabman.mak
19 years, 8 months
1
0
0
0
[gvg] 14735: Sync to Wine-20050419:
by gvg@svn.reactos.com
Sync to Wine-20050419: Robert Shearman <rob(a)codeweavers.com> - Fix TB_GETBUTTONSIZE to return the correct width/height for no buttons. - Use ES_AUTOHSCROLL for edit box. - Fix size passed to SPI_NONCLIENTMETRICS. - iSelectedImage is allowed to be 0. - Use SetWindowPos to move the buddy window into position instead of destroying it and recreating it at the new position. - Clear the background in WM_VSCROLL to avoid problems with antialiased text drawing on top of itself multiple times. Dimitrie O. Paun <dpaun(a)rogers.com> - Use {Alloc,ReAlloc,Free}() instead of Heap{Alloc,ReAlloc,Free}(). - Fix a memory leak in toolbar. Avoid casts. - Complete unicodification of the toolbar common control. - Move a header comment for consistency with the other controls. - Very small alignment fixes. - Add support for LVN_ODSTATECHANGED. - Minor typo fixes. - Handle wParam in WM_PAINT properly: if non-null, it is the hdc we are supposed to use to draw into. - Complete unicodification of the propsheet common control. - Complete unicodification of the flatsb common control. - Pull the WM_TIMER handling into its own function. - ANIMATE_DrawFrame shouldn't worry about locking, the lock should be held by the caller. - Delete the critical section when freeing up the infoPtr. - Audit the control against Comctl32.dll version 6.0. - Proper handling of GWL_STYLE. - Implement WM_CLOSE. Fix WM_SIZE implementation. - Small cleanups. - Cleanup and simplify the painting code. - Fix a potential bug along the way. - Unicodification and typesafe interfaces. - Complete unicodification. - Complete unicodification of the rebar common control. - Add Robert Shearman's explanation about WM_NCPAINT. - Move testing comments in a more appropriate place. - Proper handling for GWL_STYLE. - Store and use hwndSelf in the PAGER_INFO. - Pass the infoPtr around instead of hwnd. - Use proper types in the function signatures. - Fix a few return statements. - MonthCal unicodification. - Tab unicodification. - Keep track of WS_DISABLED explicitely, as it doesn't generate a WM_STYLECHANGED message. - Minor cleanups. - Complete unicodification of the tooltips common control. - Complete the unicodification of comctl32undoc. - Complete unicodification of the header common control. - Complete unicodification of the treeview common control. - Audit the code against Comctl32.dll version 6.0. - Handle notification and styles as in the other controls. - Maintain the const for strings throughout parsing. Francois Gouget <fgouget(a)free.fr> - Assorted spelling fixes. Jakob Eriksson <jakov(a)vmlinux.org> - Get rid of HeapAlloc casts. - Eliminate HeapAlloc casts. Alexandre Julliard <julliard(a)winehq.org> - Revert changes to the painting code, the WM_CTLCOLORSTATIC message should not be sent from the animation thread. Duane Clark <dclark(a)akamail.com> - Misc rectangle fixes. - The date should be initialized from local time. - Monday is day number '1'. - Set day of week when a day is selected in the calender. - Use fixed width fields in datetime. - DTS_TIMEFORMAT is a two bit field, so test accordingly. - Reposition and resize the updown control when the datetime control is resized. - Respond to updown inputs. - The datetime should be initialized with local time. - Add support for direct keyboard input to numeric fields. - Hour '0' corresponds to 12AM. Vitaliy Margolen <wine-devel(a)kievinfo.com> - Draw only visible tabs. - Don't redraw if no information has changed. - Fixed endless redraw loop if app using callback for images and/or text. - Keep color changes made by app for the current draw cycle. - Send notifies after invalidating changed areas. - Don't use custom draw returned colors for control. C. Scott Ananian <cscott(a)cscott.net> - UPDOWN_GetBuddyInt should not fail when the control is empty. Peter Berg Larsen <pebl(a)math.ku.dk> - Replace strncpy with memcpy or lstrcpyn. Huw Davies <huw(a)codeweavers.com> - The depth of the colour bitmap needs to match that of the screen. Jason Edmeades <us(a)the-edmeades.demon.co.uk> - Make the treeview correctly search when the top index is selected. Evan Deaubl <wine(a)warpedview.com> - TREEVIEW_DoSelectItem should not do any of the TVGN_FIRSTVISIBLE work if the newSelect parameter is NULL. Eric Pouech <pouech-eric(a)wanadoo.fr> - Removed excessive statement (break after return or goto, not useful break, not needed vars...) Modified: trunk/reactos/include/wine/commctrl.h Modified: trunk/reactos/lib/comctl32/animate.c Modified: trunk/reactos/lib/comctl32/comboex.c Modified: trunk/reactos/lib/comctl32/comctl32undoc.c Modified: trunk/reactos/lib/comctl32/comctl_Sv.rc Modified: trunk/reactos/lib/comctl32/commctrl.c Modified: trunk/reactos/lib/comctl32/datetime.c Modified: trunk/reactos/lib/comctl32/flatsb.c Modified: trunk/reactos/lib/comctl32/header.c Modified: trunk/reactos/lib/comctl32/imagelist.c Modified: trunk/reactos/lib/comctl32/listview.c Modified: trunk/reactos/lib/comctl32/monthcal.c Modified: trunk/reactos/lib/comctl32/pager.c Modified: trunk/reactos/lib/comctl32/propsheet.c Modified: trunk/reactos/lib/comctl32/rebar.c Modified: trunk/reactos/lib/comctl32/syslink.c Modified: trunk/reactos/lib/comctl32/tab.c Modified: trunk/reactos/lib/comctl32/toolbar.c Modified: trunk/reactos/lib/comctl32/tooltips.c Modified: trunk/reactos/lib/comctl32/treeview.c Modified: trunk/reactos/lib/comctl32/updown.c Modified: trunk/reactos/w32api/include/commctrl.h _____ Modified: trunk/reactos/include/wine/commctrl.h --- trunk/reactos/include/wine/commctrl.h 2005-04-21 16:28:44 UTC (rev 14734) +++ trunk/reactos/include/wine/commctrl.h 2005-04-21 21:01:05 UTC (rev 14735) @@ -61,6 +61,16 @@ #define SB_SETBORDERS (WM_USER+5) #define FLATSB_CLASSA "flatsb_class32" +#if defined(__GNUC__) +# define FLATSB_CLASSW (const WCHAR []){ 'f','l','a','t','s','b','_', \ + 'c','l','a','s','s','3','2',0 } +#elif defined(_MSC_VER) +# define FLATSB_CLASSW L"flatsb_class32" +#else +static const WCHAR FLATSB_CLASSW[] = { 'f','l','a','t','s','b','_', + 'c','l','a','s','s','3','2',0 }; +#endif + #define DRAGLISTMSGSTRINGA "commctrl_DragListMsg" #if defined(__GNUC__) # define DRAGLISTMSGSTRINGW (const WCHAR []){ 'c','o','m','m','c','t','r','l', \ _____ Modified: trunk/reactos/lib/comctl32/animate.c --- trunk/reactos/lib/comctl32/animate.c 2005-04-21 16:28:44 UTC (rev 14734) +++ trunk/reactos/lib/comctl32/animate.c 2005-04-21 21:01:05 UTC (rev 14735) @@ -3,7 +3,8 @@ * Animation control * * Copyright 1998, 1999 Eric Kohl - * 1999 Eric Pouech + * Copyright 1999 Eric Pouech + * Copyright 2005 Dimitrie O. Paun * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,12 +21,16 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * NOTES - * I will only improve this control once in a while. - * Eric <ekohl(a)abo.rhein-zeitung.de> * + * This code was audited for completeness against the documented features + * of Comctl32.dll version 6.0 on Mar. 15, 2005, by Dimitrie O. Paun. + * + * Unless otherwise noted, we believe this code to be complete, as per + * the specification mentioned above. + * If you discover missing features, or bugs, please note them below. + * * TODO: * - check for the 'rec ' list in some AVI files - * - concurrent access to infoPtr */ #define COM_NO_WINDOWS_H @@ -59,6 +64,7 @@ HMMIO hMMio; /* handle to mmio stream */ HWND hwndSelf; HWND hwndNotify; + DWORD dwStyle; /* information on the loaded AVI file */ MainAVIHeader mah; AVIStreamHeader ash; @@ -86,23 +92,23 @@ HBITMAP hbmPrevFrame; } ANIMATE_INFO; -#define ANIMATE_GetInfoPtr(hWnd) ((ANIMATE_INFO *)GetWindowLongPtrW(hWnd, 0)) #define ANIMATE_COLOR_NONE 0xffffffff -static void ANIMATE_Notify(ANIMATE_INFO* infoPtr, UINT notif) +static void ANIMATE_Notify(ANIMATE_INFO *infoPtr, UINT notif) { - SendMessageA(infoPtr->hwndNotify, WM_COMMAND, + SendMessageW(infoPtr->hwndNotify, WM_COMMAND, MAKEWPARAM(GetDlgCtrlID(infoPtr->hwndSelf), notif), (LPARAM)infoPtr->hwndSelf); } -static BOOL ANIMATE_LoadResA(ANIMATE_INFO *infoPtr, HINSTANCE hInst, LPSTR lpName) +static BOOL ANIMATE_LoadResW(ANIMATE_INFO *infoPtr, HINSTANCE hInst, LPWSTR lpName) { + static const WCHAR aviW[] = { 'A', 'V', 'I', 0 }; HRSRC hrsrc; MMIOINFO mminfo; LPVOID lpAvi; - hrsrc = FindResourceA(hInst, lpName, "AVI"); + hrsrc = FindResourceW(hInst, lpName, aviW); if (!hrsrc) return FALSE; @@ -118,8 +124,9 @@ mminfo.fccIOProc = FOURCC_MEM; mminfo.pchBuffer = (LPSTR)lpAvi; mminfo.cchBuffer = SizeofResource(hInst, hrsrc); - infoPtr->hMMio = mmioOpenA(NULL, &mminfo, MMIO_READ); - if (!infoPtr->hMMio) { + infoPtr->hMMio = mmioOpenW(NULL, &mminfo, MMIO_READ); + if (!infoPtr->hMMio) + { FreeResource(infoPtr->hRes); return FALSE; } @@ -128,19 +135,15 @@ } -static BOOL ANIMATE_LoadFileA(ANIMATE_INFO *infoPtr, LPSTR lpName) +static BOOL ANIMATE_LoadFileW(ANIMATE_INFO *infoPtr, LPWSTR lpName) { - infoPtr->hMMio = mmioOpenA((LPSTR)lpName, NULL, - MMIO_ALLOCBUF | MMIO_READ | MMIO_DENYWRITE); + infoPtr->hMMio = mmioOpenW(lpName, 0, MMIO_ALLOCBUF | MMIO_READ | MMIO_DENYWRITE); - if (!infoPtr->hMMio) - return FALSE; - - return TRUE; + return (BOOL)infoPtr->hMMio; } -static LRESULT ANIMATE_DoStop(ANIMATE_INFO *infoPtr) +static BOOL ANIMATE_DoStop(ANIMATE_INFO *infoPtr) { EnterCriticalSection(&infoPtr->cs); @@ -187,28 +190,25 @@ FreeResource(infoPtr->hRes); infoPtr->hRes = 0; } - HeapFree(GetProcessHeap(), 0, infoPtr->lpIndex); + Free (infoPtr->lpIndex); infoPtr->lpIndex = NULL; if (infoPtr->hic) { fnIC.fnICClose(infoPtr->hic); infoPtr->hic = 0; } - HeapFree(GetProcessHeap(), 0, infoPtr->inbih); + Free (infoPtr->inbih); infoPtr->inbih = NULL; - HeapFree(GetProcessHeap(), 0, infoPtr->outbih); + Free (infoPtr->outbih); infoPtr->outbih = NULL; - HeapFree(GetProcessHeap(), 0, infoPtr->indata); + Free (infoPtr->indata); infoPtr->indata = NULL; - HeapFree(GetProcessHeap(), 0, infoPtr->outdata); + Free (infoPtr->outdata); infoPtr->outdata = NULL; if( infoPtr->hbmPrevFrame ) { DeleteObject(infoPtr->hbmPrevFrame); infoPtr->hbmPrevFrame = 0; } - infoPtr->indata = infoPtr->outdata = NULL; - infoPtr->hwndSelf = 0; - infoPtr->hMMio = 0; memset(&infoPtr->mah, 0, sizeof(infoPtr->mah)); memset(&infoPtr->ash, 0, sizeof(infoPtr->ash)); @@ -217,7 +217,7 @@ infoPtr->transparentColor = ANIMATE_COLOR_NONE; } -static void ANIMATE_TransparentBlt(ANIMATE_INFO* infoPtr, HDC hdcDest, HDC hdcSource) +static void ANIMATE_TransparentBlt(ANIMATE_INFO *infoPtr, HDC hdcDest, HDC hdcSource) { HDC hdcMask; HBITMAP hbmMask; @@ -249,7 +249,7 @@ DeleteDC(hdcMask); } -static LRESULT ANIMATE_PaintFrame(ANIMATE_INFO* infoPtr, HDC hDC) +static BOOL ANIMATE_PaintFrame(ANIMATE_INFO* infoPtr, HDC hDC) { void* pBitmapData = NULL; LPBITMAPINFO pBitmapInfo = NULL; @@ -273,7 +273,8 @@ nWidth = infoPtr->outbih->biWidth; nHeight = infoPtr->outbih->biHeight; - } else + } + else { pBitmapData = infoPtr->indata; pBitmapInfo = (LPBITMAPINFO)infoPtr->inbih; @@ -302,7 +303,7 @@ infoPtr->transparentColor = GetPixel(hdcMem,0,0); } - if(GetWindowLongA(infoPtr->hwndSelf, GWL_STYLE) & ACS_TRANSPARENT) + if(infoPtr->dwStyle & ACS_TRANSPARENT) { HDC hdcFinal = CreateCompatibleDC(hDC); HBITMAP hbmFinal = CreateCompatibleBitmap(hDC,nWidth, nHeight); @@ -325,15 +326,15 @@ DeleteDC(hdcFinal); DeleteObject(infoPtr->hbmPrevFrame); infoPtr->hbmPrevFrame = hbmFinal; - } + } - if (GetWindowLongA(infoPtr->hwndSelf, GWL_STYLE) & ACS_CENTER) + if (infoPtr->dwStyle & ACS_CENTER) { - RECT rect; + RECT rect; - GetWindowRect(infoPtr->hwndSelf, &rect); - nOffsetX = ((rect.right - rect.left) - nWidth)/2; - nOffsetY = ((rect.bottom - rect.top) - nHeight)/2; + GetWindowRect(infoPtr->hwndSelf, &rect); + nOffsetX = ((rect.right - rect.left) - nWidth)/2; + nOffsetY = ((rect.bottom - rect.top) - nHeight)/2; } BitBlt(hDC, nOffsetX, nOffsetY, nWidth, nHeight, hdcMem, 0, 0, SRCCOPY); @@ -342,21 +343,18 @@ return TRUE; } -static LRESULT ANIMATE_DrawFrame(ANIMATE_INFO* infoPtr) +static BOOL ANIMATE_DrawFrame(ANIMATE_INFO *infoPtr) { HDC hDC; TRACE("Drawing frame %d (loop %d)\n", infoPtr->currFrame, infoPtr->nLoop); - EnterCriticalSection(&infoPtr->cs); - mmioSeek(infoPtr->hMMio, infoPtr->lpIndex[infoPtr->currFrame], SEEK_SET); mmioRead(infoPtr->hMMio, infoPtr->indata, infoPtr->ash.dwSuggestedBufferSize); if (infoPtr->hic && fnIC.fnICDecompress(infoPtr->hic, 0, infoPtr->inbih, infoPtr->indata, infoPtr->outbih, infoPtr->outdata) != ICERR_OK) { - LeaveCriticalSection(&infoPtr->cs); WARN("Decompression error\n"); return FALSE; } @@ -374,14 +372,27 @@ } } } - LeaveCriticalSection(&infoPtr->cs); return TRUE; } +static LRESULT ANIMATE_Timer(ANIMATE_INFO *infoPtr) +{ + /* FIXME: we should pass the hDC instead of 0 to WM_CTLCOLORSTATIC */ + if (infoPtr->dwStyle & ACS_TRANSPARENT) + infoPtr->hbrushBG = (HBRUSH)SendMessageW(infoPtr->hwndNotify, + WM_CTLCOLORSTATIC, + 0, (LPARAM)infoPtr->hwndSelf); + EnterCriticalSection(&infoPtr->cs); + ANIMATE_DrawFrame(infoPtr); + LeaveCriticalSection(&infoPtr->cs); + + return 0; +} + static DWORD CALLBACK ANIMATE_AnimationThread(LPVOID ptr_) { - ANIMATE_INFO* infoPtr = (ANIMATE_INFO*)ptr_; + ANIMATE_INFO *infoPtr = (ANIMATE_INFO *)ptr_; HANDLE event; DWORD timeout; @@ -400,10 +411,8 @@ return TRUE; } -static LRESULT ANIMATE_Play(HWND hWnd, WPARAM wParam, LPARAM lParam) +static LRESULT ANIMATE_Play(ANIMATE_INFO *infoPtr, UINT cRepeat, WORD wFrom, WORD wTo) { - ANIMATE_INFO *infoPtr = ANIMATE_GetInfoPtr(hWnd); - /* nothing opened */ if (!infoPtr->hMMio) return FALSE; @@ -413,9 +422,9 @@ return TRUE; } - infoPtr->nFromFrame = (INT)LOWORD(lParam); - infoPtr->nToFrame = (INT)HIWORD(lParam); - infoPtr->nLoop = (INT)wParam; + infoPtr->nFromFrame = wFrom; + infoPtr->nToFrame = wTo; + infoPtr->nLoop = cRepeat; if (infoPtr->nToFrame == 0xFFFF) infoPtr->nToFrame = infoPtr->mah.dwTotalFrames - 1; @@ -429,25 +438,25 @@ infoPtr->currFrame = infoPtr->nFromFrame; - if (GetWindowLongA(hWnd, GWL_STYLE) & ACS_TIMER) { + if (infoPtr->dwStyle & ACS_TIMER) + { TRACE("Using a timer\n"); /* create a timer to display AVI */ - infoPtr->uTimer = SetTimer(hWnd, 1, infoPtr->mah.dwMicroSecPerFrame / 1000, NULL); - } else { - if(GetWindowLongA(hWnd, GWL_STYLE) & ACS_TRANSPARENT) - { - infoPtr->hbrushBG = (HBRUSH)SendMessageA(infoPtr->hwndNotify, - WM_CTLCOLORSTATIC, 0, (LPARAM)hWnd); - } + infoPtr->uTimer = SetTimer(infoPtr->hwndSelf, 1, + infoPtr->mah.dwMicroSecPerFrame / 1000, NULL); + } + else + { + if(infoPtr->dwStyle & ACS_TRANSPARENT) + infoPtr->hbrushBG = (HBRUSH)SendMessageW(infoPtr->hwndNotify, + WM_CTLCOLORSTATIC, 0, + (LPARAM)infoPtr->hwndSelf); TRACE("Using an animation thread\n"); infoPtr->hStopEvent = CreateEventW( NULL, TRUE, FALSE, NULL ); - infoPtr->hThread = CreateThread(0,0,ANIMATE_AnimationThread,(LPVOID)infoPtr, 0, &infoPtr->threadId); - if(!infoPtr->hThread) - { - ERR("Could not create animation thread!\n"); - return FALSE; - } + infoPtr->hThread = CreateThread(0, 0, ANIMATE_AnimationThread, + (LPVOID)infoPtr, 0, &infoPtr->threadId); + if(!infoPtr->hThread) return FALSE; } @@ -548,7 +557,7 @@ return FALSE; } - infoPtr->inbih = HeapAlloc(GetProcessHeap(), 0, mmckInfo.cksize); + infoPtr->inbih = Alloc(mmckInfo.cksize); if (!infoPtr->inbih) { WARN("Can't alloc input BIH\n"); return FALSE; @@ -595,12 +604,9 @@ /* FIXME: should handle the 'rec ' LIST when present */ - infoPtr->lpIndex = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, - infoPtr->mah.dwTotalFrames * sizeof(DWORD)); - if (!infoPtr->lpIndex) { - WARN("Can't alloc index array\n"); + infoPtr->lpIndex = Alloc(infoPtr->mah.dwTotalFrames * sizeof(DWORD)); + if (!infoPtr->lpIndex) return FALSE; - } numFrame = insize = 0; while (mmioDescend(infoPtr->hMMio, &mmckInfo, &mmckList, 0) == 0 && @@ -620,17 +626,15 @@ infoPtr->ash.dwSuggestedBufferSize = insize; } - infoPtr->indata = HeapAlloc(GetProcessHeap(), 0, infoPtr->ash.dwSuggestedBufferSize); - if (!infoPtr->indata) { - WARN("Can't alloc input buffer\n"); + infoPtr->indata = Alloc(infoPtr->ash.dwSuggestedBufferSize); + if (!infoPtr->indata) return FALSE; - } return TRUE; } -static BOOL ANIMATE_GetAviCodec(ANIMATE_INFO *infoPtr) +static BOOL ANIMATE_GetAviCodec(ANIMATE_INFO *infoPtr) { DWORD outSize; @@ -653,23 +657,20 @@ outSize = fnIC.fnICSendMessage(infoPtr->hic, ICM_DECOMPRESS_GET_FORMAT, (DWORD)infoPtr->inbih, 0L); - infoPtr->outbih = HeapAlloc(GetProcessHeap(), 0, outSize); - if (!infoPtr->outbih) { - WARN("Can't alloc output BIH\n"); + infoPtr->outbih = Alloc(outSize); + if (!infoPtr->outbih) return FALSE; - } if (fnIC.fnICSendMessage(infoPtr->hic, ICM_DECOMPRESS_GET_FORMAT, - (DWORD)infoPtr->inbih, (DWORD)infoPtr->outbih) != outSize) { + (DWORD)infoPtr->inbih, (DWORD)infoPtr->outbih) != outSize) + { WARN("Can't get output BIH\n"); return FALSE; } - infoPtr->outdata = HeapAlloc(GetProcessHeap(), 0, infoPtr->outbih->biSizeImage); - if (!infoPtr->outdata) { - WARN("Can't alloc output buffer\n"); + infoPtr->outdata = Alloc(infoPtr->outbih->biSizeImage); + if (!infoPtr->outdata) return FALSE; - } if (fnIC.fnICSendMessage(infoPtr->hic, ICM_DECOMPRESS_BEGIN, (DWORD)infoPtr->inbih, (DWORD)infoPtr->outbih) != ICERR_OK) { @@ -680,74 +681,93 @@ return TRUE; } -static LRESULT ANIMATE_OpenA(HWND hWnd, WPARAM wParam, LPARAM lParam) + +static BOOL ANIMATE_OpenW(ANIMATE_INFO *infoPtr, HINSTANCE hInstance, LPWSTR lpszName) { - ANIMATE_INFO *infoPtr = ANIMATE_GetInfoPtr(hWnd); - HINSTANCE hInstance = (HINSTANCE)wParam; - ANIMATE_Free(infoPtr); - infoPtr->hwndSelf = hWnd; - if (!lParam) { + if (!lpszName) + { TRACE("Closing avi!\n"); /* installer of thebat! v1.62 requires FALSE here */ return (infoPtr->hMMio != 0); } if (!hInstance) - hInstance = (HINSTANCE)GetWindowLongPtrW(hWnd, GWLP_HINSTANCE); + hInstance = (HINSTANCE)GetWindowLongPtrW(infoPtr->hwndSelf, GWLP_HINSTANCE); - if (HIWORD(lParam)) { - TRACE("(\"%s\");\n", (LPSTR)lParam); + if (HIWORD(lpszName)) + { + TRACE("(\"%s\");\n", debugstr_w(lpszName)); - if (!ANIMATE_LoadResA(infoPtr, hInstance, (LPSTR)lParam)) { + if (!ANIMATE_LoadResW(infoPtr, hInstance, lpszName)) + { TRACE("No AVI resource found!\n"); - if (!ANIMATE_LoadFileA(infoPtr, (LPSTR)lParam)) { + if (!ANIMATE_LoadFileW(infoPtr, lpszName)) + { WARN("No AVI file found!\n"); return FALSE; } } - } else { - TRACE("(%u);\n", (WORD)LOWORD(lParam)); + } + else + { + TRACE("(%u);\n", (WORD)(DWORD)lpszName); - if (!ANIMATE_LoadResA(infoPtr, hInstance, - MAKEINTRESOURCEA((INT)lParam))) { + if (!ANIMATE_LoadResW(infoPtr, hInstance, MAKEINTRESOURCEW((INT)lpszName))) + { WARN("No AVI resource found!\n"); return FALSE; } } - if (!ANIMATE_GetAviInfo(infoPtr)) { + if (!ANIMATE_GetAviInfo(infoPtr)) + { WARN("Can't get AVI information\n"); ANIMATE_Free(infoPtr); return FALSE; } - if (!ANIMATE_GetAviCodec(infoPtr)) { + if (!ANIMATE_GetAviCodec(infoPtr)) + { WARN("Can't get AVI Codec\n"); ANIMATE_Free(infoPtr); return FALSE; } - if (!GetWindowLongA(hWnd, GWL_STYLE) & ACS_CENTER) { - SetWindowPos(hWnd, 0, 0, 0, infoPtr->mah.dwWidth, infoPtr->mah.dwHeight, + if (!(infoPtr->dwStyle & ACS_CENTER)) + SetWindowPos(infoPtr->hwndSelf, 0, 0, 0, infoPtr->mah.dwWidth, infoPtr->mah.dwHeight, SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOZORDER); - } - if (GetWindowLongA(hWnd, GWL_STYLE) & ACS_AUTOPLAY) { - return ANIMATE_Play(hWnd, -1, (LPARAM)MAKELONG(0, infoPtr->mah.dwTotalFrames-1)); - } + if (infoPtr->dwStyle & ACS_AUTOPLAY) + return ANIMATE_Play(infoPtr, -1, 0, infoPtr->mah.dwTotalFrames - 1); return TRUE; } -/* << ANIMATE_Open32W >> */ +static BOOL ANIMATE_OpenA(ANIMATE_INFO *infoPtr, HINSTANCE hInstance, LPSTR lpszName) +{ + LPWSTR lpwszName; + LRESULT result; + INT len; -static LRESULT ANIMATE_Stop(HWND hWnd, WPARAM wParam, LPARAM lParam) + if (!HIWORD(lpszName)) + return ANIMATE_OpenW(infoPtr, hInstance, (LPWSTR)lpszName); + + len = MultiByteToWideChar(CP_ACP, 0, lpszName, -1, NULL, 0); + lpwszName = Alloc(len * sizeof(WCHAR)); + if (!lpwszName) return FALSE; + MultiByteToWideChar(CP_ACP, 0, lpszName, -1, lpwszName, len); + + result = ANIMATE_OpenW(infoPtr, hInstance, lpwszName); + Free (lpwszName); + return result; +} + + +static BOOL ANIMATE_Stop(ANIMATE_INFO *infoPtr) { - ANIMATE_INFO *infoPtr = ANIMATE_GetInfoPtr(hWnd); - /* nothing opened */ if (!infoPtr->hMMio) return FALSE; @@ -757,18 +777,14 @@ } -static LRESULT ANIMATE_Create(HWND hWnd, WPARAM wParam, LPARAM lParam) +static BOOL ANIMATE_Create(HWND hWnd, LPCREATESTRUCTW lpcs) { - ANIMATE_INFO* infoPtr; + static const WCHAR msvfw32W[] = { 'm', 's', 'v', 'f', 'w', '3', '2', '.', 'd', 'l', 'l', 0 }; + ANIMATE_INFO *infoPtr; - if (!fnIC.hModule) /* FIXME: not thread safe */ + if (!fnIC.hModule) { - /* since there's a circular dep between msvfw32 and comctl32, we could either: - * - fix the build chain to allow this circular dep - * - handle it by hand - * AJ wants the latter :-( - */ - fnIC.hModule = LoadLibraryA("msvfw32.dll"); + fnIC.hModule = LoadLibraryW(msvfw32W); if (!fnIC.hModule) return FALSE; fnIC.fnICOpen = (void*)GetProcAddress(fnIC.hModule, "ICOpen"); @@ -779,19 +795,17 @@ /* allocate memory for info structure */ infoPtr = (ANIMATE_INFO *)Alloc(sizeof(ANIMATE_INFO)); - if (!infoPtr) { - ERR("could not allocate info memory!\n"); - return 0; - } + if (!infoPtr) return FALSE; /* store crossref hWnd <-> info structure */ SetWindowLongPtrW(hWnd, 0, (DWORD_PTR)infoPtr); infoPtr->hwndSelf = hWnd; - infoPtr->hwndNotify = ((LPCREATESTRUCTA)lParam)->hwndParent; + infoPtr->hwndNotify = lpcs->hwndParent; infoPtr->transparentColor = ANIMATE_COLOR_NONE; infoPtr->hbmPrevFrame = 0; + infoPtr->dwStyle = lpcs->style; - TRACE("Animate style=0x%08lx, parent=%p\n", GetWindowLongA(hWnd, GWL_STYLE), infoPtr->hwndNotify); + TRACE("Animate style=0x%08lx, parent=%p\n", infoPtr->dwStyle, infoPtr->hwndNotify); InitializeCriticalSection(&infoPtr->cs); @@ -799,97 +813,98 @@ } -static LRESULT ANIMATE_Destroy(HWND hWnd, WPARAM wParam, LPARAM lParam) +static LRESULT ANIMATE_Destroy(ANIMATE_INFO *infoPtr) { - ANIMATE_INFO *infoPtr = ANIMATE_GetInfoPtr(hWnd); - - /* free avi data */ ANIMATE_Free(infoPtr); /* free animate info data */ + SetWindowLongPtrW(infoPtr->hwndSelf, 0, 0); + + DeleteCriticalSection(&infoPtr->cs); Free(infoPtr); - SetWindowLongPtrW(hWnd, 0, 0); return 0; } -static LRESULT ANIMATE_EraseBackground(HWND hWnd, WPARAM wParam, LPARAM lParam) +static BOOL ANIMATE_EraseBackground(ANIMATE_INFO *infoPtr, HDC hdc) { - ANIMATE_INFO *infoPtr = ANIMATE_GetInfoPtr(hWnd); RECT rect; HBRUSH hBrush = 0; - if(GetWindowLongA(hWnd, GWL_STYLE) & ACS_TRANSPARENT) + if(infoPtr->dwStyle & ACS_TRANSPARENT) { - hBrush = (HBRUSH)SendMessageA(infoPtr->hwndNotify,WM_CTLCOLORSTATIC, - wParam, (LPARAM)hWnd); + hBrush = (HBRUSH)SendMessageW(infoPtr->hwndNotify, WM_CTLCOLORSTATIC, + (WPARAM)hdc, (LPARAM)infoPtr->hwndSelf); } - GetClientRect(hWnd, &rect); - FillRect((HDC)wParam, &rect, hBrush ? hBrush : GetCurrentObject((HDC)wParam, OBJ_BRUSH)); + GetClientRect(infoPtr->hwndSelf, &rect); + FillRect(hdc, &rect, hBrush ? hBrush : GetCurrentObject(hdc, OBJ_BRUSH)); return TRUE; } -static LRESULT WINAPI ANIMATE_Size(HWND hWnd, WPARAM wParam, LPARAM lParam) + +static LRESULT ANIMATE_StyleChanged(ANIMATE_INFO *infoPtr, WPARAM wStyleType, LPSTYLESTRUCT lpss) { - if (GetWindowLongA(hWnd, GWL_STYLE) & ACS_CENTER) { - InvalidateRect(hWnd, NULL, TRUE); - } - return TRUE; + TRACE("(styletype=%x, styleOld=0x%08lx, styleNew=0x%08lx)\n", + wStyleType, lpss->styleOld, lpss->styleNew); + + if (wStyleType != GWL_STYLE) return 0; + + infoPtr->dwStyle = lpss->styleNew; + + InvalidateRect(infoPtr->hwndSelf, NULL, TRUE); + return 0; } + static LRESULT WINAPI ANIMATE_WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { + ANIMATE_INFO *infoPtr = (ANIMATE_INFO *)GetWindowLongPtrW(hWnd, 0); + TRACE("hwnd=%p msg=%x wparam=%x lparam=%lx\n", hWnd, uMsg, wParam, lParam); - if (!ANIMATE_GetInfoPtr(hWnd) && (uMsg != WM_NCCREATE)) - return DefWindowProcA(hWnd, uMsg, wParam, lParam); + if (!infoPtr && (uMsg != WM_NCCREATE)) + return DefWindowProcW(hWnd, uMsg, wParam, lParam); switch (uMsg) { case ACM_OPENA: - return ANIMATE_OpenA(hWnd, wParam, lParam); + return ANIMATE_OpenA(infoPtr, (HINSTANCE)wParam, (LPSTR)lParam); case ACM_OPENW: - FIXME("ACM_OPENW: stub!\n"); - /* return ANIMATE_Open32W(hWnd, wParam, lParam); */ - return 0; + return ANIMATE_OpenW(infoPtr, (HINSTANCE)wParam, (LPWSTR)lParam); case ACM_PLAY: - return ANIMATE_Play(hWnd, wParam, lParam); + return ANIMATE_Play(infoPtr, (INT)wParam, LOWORD(lParam), HIWORD(lParam)); case ACM_STOP: - return ANIMATE_Stop(hWnd, wParam, lParam); + return ANIMATE_Stop(infoPtr); + case WM_CLOSE: + ANIMATE_Free(infoPtr); + return 0; + case WM_NCCREATE: - return ANIMATE_Create(hWnd, wParam, lParam); + return ANIMATE_Create(hWnd, (LPCREATESTRUCTW)lParam); case WM_NCHITTEST: return HTTRANSPARENT; case WM_DESTROY: - return ANIMATE_Destroy(hWnd, wParam, lParam); + return ANIMATE_Destroy(infoPtr); case WM_ERASEBKGND: - return ANIMATE_EraseBackground(hWnd, wParam, lParam); + return ANIMATE_EraseBackground(infoPtr, (HDC)wParam); - /* case WM_STYLECHANGED: FIXME shall we do something ?? */ + case WM_STYLECHANGED: + return ANIMATE_StyleChanged(infoPtr, wParam, (LPSTYLESTRUCT)lParam); case WM_TIMER: - if (GetWindowLongA(hWnd, GWL_STYLE) & ACS_TRANSPARENT) - { - ANIMATE_INFO* infoPtr = ANIMATE_GetInfoPtr(hWnd); - infoPtr->hbrushBG = (HBRUSH)SendMessageA(infoPtr->hwndNotify, - WM_CTLCOLORSTATIC, - wParam, (LPARAM)hWnd); - } - return ANIMATE_DrawFrame(ANIMATE_GetInfoPtr(hWnd)); + return ANIMATE_Timer(infoPtr); case WM_PAINT: { - ANIMATE_INFO* infoPtr = ANIMATE_GetInfoPtr(hWnd); - /* the animation isn't playing, or has not decompressed * (and displayed) the first frame yet, don't paint */ @@ -897,13 +912,13 @@ !infoPtr->hbmPrevFrame) { /* default paint handling */ - return DefWindowProcA(hWnd, uMsg, wParam, lParam); + return DefWindowProcW(hWnd, uMsg, wParam, lParam); } - if (GetWindowLongA(hWnd, GWL_STYLE) & ACS_TRANSPARENT) - infoPtr->hbrushBG = (HBRUSH)SendMessageA(infoPtr->hwndNotify, - WM_CTLCOLORSTATIC, - wParam, (LPARAM)hWnd); + if (infoPtr->dwStyle & ACS_TRANSPARENT) + infoPtr->hbrushBG = (HBRUSH)SendMessageW(infoPtr->hwndNotify, + WM_CTLCOLORSTATIC, + wParam, (LPARAM)infoPtr->hwndSelf); if (wParam) { @@ -913,48 +928,50 @@ } else { - PAINTSTRUCT ps; - HDC hDC = BeginPaint(hWnd, &ps); + PAINTSTRUCT ps; + HDC hDC = BeginPaint(infoPtr->hwndSelf, &ps); EnterCriticalSection(&infoPtr->cs); ANIMATE_PaintFrame(infoPtr, hDC); LeaveCriticalSection(&infoPtr->cs); - EndPaint(hWnd, &ps); - } + EndPaint(infoPtr->hwndSelf, &ps); + } } - break; + break; case WM_SIZE: - return ANIMATE_Size(hWnd, wParam, lParam); + if (infoPtr->dwStyle & ACS_CENTER) + InvalidateRect(infoPtr->hwndSelf, NULL, TRUE); + return DefWindowProcW(hWnd, uMsg, wParam, lParam); default: if ((uMsg >= WM_USER) && (uMsg < WM_APP)) ERR("unknown msg %04x wp=%08x lp=%08lx\n", uMsg, wParam, lParam); - return DefWindowProcA(hWnd, uMsg, wParam, lParam); + return DefWindowProcW(hWnd, uMsg, wParam, lParam); } return 0; } void ANIMATE_Register(void) { - WNDCLASSA wndClass; + WNDCLASSW wndClass; - ZeroMemory(&wndClass, sizeof(WNDCLASSA)); + ZeroMemory(&wndClass, sizeof(WNDCLASSW)); wndClass.style = CS_GLOBALCLASS | CS_DBLCLKS; wndClass.lpfnWndProc = ANIMATE_WindowProc; wndClass.cbClsExtra = 0; wndClass.cbWndExtra = sizeof(ANIMATE_INFO *); - wndClass.hCursor = LoadCursorA(0, (LPSTR)IDC_ARROW); + wndClass.hCursor = LoadCursorW(0, (LPCWSTR)IDC_ARROW); wndClass.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1); - wndClass.lpszClassName = ANIMATE_CLASSA; + wndClass.lpszClassName = ANIMATE_CLASSW; - RegisterClassA(&wndClass); + RegisterClassW(&wndClass); } void ANIMATE_Unregister(void) { - UnregisterClassA(ANIMATE_CLASSA, NULL); + UnregisterClassW(ANIMATE_CLASSW, NULL); } _____ Modified: trunk/reactos/lib/comctl32/comboex.c --- trunk/reactos/lib/comctl32/comboex.c 2005-04-21 16:28:44 UTC (rev 14734) +++ trunk/reactos/lib/comctl32/comboex.c 2005-04-21 21:01:05 UTC (rev 14735) @@ -121,7 +121,11 @@ /* Offset between image and text */ #define CBE_SEP 4 -#define COMBOEX_SUBCLASS_PROP "CCComboEx32SubclassInfo" +static const WCHAR COMBOEX_SUBCLASS_PROP[] = { + 'C','C','C','o','m','b','o','E','x','3','2', + 'S','u','b','c','l','a','s','s','I','n','f','o',0 +}; + #define COMBOEX_GetInfoPtr(hwnd) ((COMBOEX_INFO *)GetWindowLongPtrW (hwnd, 0)) @@ -317,13 +321,14 @@ static void COMBOEX_GetComboFontSize (COMBOEX_INFO *infoPtr, SIZE *size) { + static const WCHAR strA[] = { 'A', 0 }; HFONT nfont, ofont; HDC mydc; mydc = GetDC (0); /* why the entire screen???? */ nfont = (HFONT)SendMessageW (infoPtr->hwndCombo, WM_GETFONT, 0, 0); ofont = (HFONT) SelectObject (mydc, nfont); - GetTextExtentPointA (mydc, "A", 1, size); + GetTextExtentPointW (mydc, strA, 1, size); SelectObject (mydc, ofont); ReleaseDC (0, mydc); TRACE("selected font hwnd=%p, height=%ld\n", nfont, size->cy); @@ -949,7 +954,7 @@ /* Native version of ComboEx creates the ComboBox with DROPDOWNLIST */ /* specified. It then creates it's own version of the EDIT control */ /* and makes the ComboBox the parent. This is because a normal */ - /* DROPDOWNLIST does not have a EDIT control, but we need one. */ + /* DROPDOWNLIST does not have an EDIT control, but we need one. */ /* We also need to place the edit control at the proper location */ /* (allow space for the icons). */ @@ -976,7 +981,7 @@ * Setup a property to hold the pointer to the COMBOBOXEX * data structure. */ - SetPropA(infoPtr->hwndCombo, COMBOEX_SUBCLASS_PROP, hwnd); + SetPropW(infoPtr->hwndCombo, COMBOEX_SUBCLASS_PROP, hwnd); infoPtr->prevComboWndProc = (WNDPROC)SetWindowLongPtrW(infoPtr->hwndCombo, GWLP_WNDPROC, (DWORD_PTR)COMBOEX_ComboWndProc); infoPtr->font = (HFONT)SendMessageW (infoPtr->hwndCombo, WM_GETFONT, 0, 0); @@ -1005,7 +1010,7 @@ * Setup a property to hold the pointer to the COMBOBOXEX * data structure. */ - SetPropA(infoPtr->hwndEdit, COMBOEX_SUBCLASS_PROP, hwnd); + SetPropW(infoPtr->hwndEdit, COMBOEX_SUBCLASS_PROP, hwnd); infoPtr->prevEditWndProc = (WNDPROC)SetWindowLongPtrW(infoPtr->hwndEdit, GWLP_WNDPROC, (DWORD_PTR)COMBOEX_EditWndProc); infoPtr->font = (HFONT)SendMessageW(infoPtr->hwndCombo, WM_GETFONT, 0, 0); @@ -1547,11 +1552,12 @@ static LRESULT COMBOEX_MeasureItem (COMBOEX_INFO *infoPtr, MEASUREITEMSTRUCT *mis) { + static const WCHAR strW[] = { 'W', 0 }; SIZE mysize; HDC hdc; hdc = GetDC (0); - GetTextExtentPointA (hdc, "W", 1, &mysize); + GetTextExtentPointW (hdc, strW, 1, &mysize); ReleaseDC (0, hdc); mis->itemHeight = mysize.cy + CBE_EXTRA; @@ -1647,7 +1653,7 @@ static LRESULT WINAPI COMBOEX_EditWndProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { - HWND hwndComboex = (HWND)GetPropA(hwnd, COMBOEX_SUBCLASS_PROP); + HWND hwndComboex = (HWND)GetPropW(hwnd, COMBOEX_SUBCLASS_PROP); COMBOEX_INFO *infoPtr = COMBOEX_GetInfoPtr (hwndComboex); NMCBEENDEDITW cbeend; WCHAR edit_text[260]; @@ -1694,7 +1700,7 @@ case VK_ESCAPE: /* native version seems to do following for COMBOEX */ /* - * GetWindowTextA(Edit,&?, 0x104) x + * GetWindowTextW(Edit,&?, 0x104) x * CB_GETCURSEL to Combo rets -1 x * WM_NOTIFY to COMBOEX parent (rebar) x * (CBEN_ENDEDIT{A|W} @@ -1735,7 +1741,7 @@ case VK_RETURN: /* native version seems to do following for COMBOEX */ /* - * GetWindowTextA(Edit,&?, 0x104) x + * GetWindowTextW(Edit,&?, 0x104) x * CB_GETCURSEL to Combo rets -1 x * CB_GETCOUNT to Combo rets 0 * if >0 loop @@ -1846,7 +1852,7 @@ static LRESULT WINAPI COMBOEX_ComboWndProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { - HWND hwndComboex = (HWND)GetPropA(hwnd, COMBOEX_SUBCLASS_PROP); + HWND hwndComboex = (HWND)GetPropW(hwnd, COMBOEX_SUBCLASS_PROP); COMBOEX_INFO *infoPtr = COMBOEX_GetInfoPtr (hwndComboex); NMCBEENDEDITW cbeend; NMMOUSE nmmse; @@ -1955,7 +1961,7 @@ * Native does: * * GetFocus() retns AA - * GetWindowTextA(Edit) + * GetWindowTextW(Edit) * CB_GETCURSEL(Combo) (got -1) * WM_NOTIFY(CBEN_ENDEDITA) with CBENF_KILLFOCUS * CB_GETCURSEL(Combo) (got -1) @@ -2019,7 +2025,7 @@ INT selected = SendMessageW (infoPtr->hwndCombo, CB_GETCURSEL, 0, 0); - /* lstrlenA( lastworkingURL ) */ + /* lstrlenW( lastworkingURL ) */ GetWindowTextW (infoPtr->hwndEdit, edit_text, 260); if (selected == -1) { _____ Modified: trunk/reactos/lib/comctl32/comctl32undoc.c --- trunk/reactos/lib/comctl32/comctl32undoc.c 2005-04-21 16:28:44 UTC (rev 14734) +++ trunk/reactos/lib/comctl32/comctl32undoc.c 2005-04-21 21:01:05 UTC (rev 14735) @@ -88,6 +88,8 @@ typedef HRESULT (CALLBACK *DPALOADPROC)(LPLOADDATA,IStream*,LPARAM); +static const WCHAR strMRUList[] = { 'M','R','U','L','i','s','t',0 }; + /*********************************************************************** *** * DPA_LoadStream [COMCTL32.9] * @@ -558,7 +560,7 @@ BOOL isUnicode; /* is compare fn Unicode */ DWORD wineFlags; /* internal flags */ DWORD cursize; /* current size of realMRU */ - LPSTR realMRU; /* pointer to string of index names */ + LPWSTR realMRU; /* pointer to string of index names */ LPWINEMRUITEM *array; /* array of pointers to data */ /* in 'a' to 'z' order */ } WINEMRULIST, *LPWINEMRULIST; @@ -603,12 +605,12 @@ } if (mp->wineFlags & WMRUF_CHANGED) { mp->wineFlags &= ~WMRUF_CHANGED; - err = RegSetValueExA(newkey, "MRUList", 0, REG_SZ, - mp->realMRU, strlen(mp->realMRU) + 1); + err = RegSetValueExW(newkey, strMRUList, 0, REG_SZ, (LPBYTE)mp->realMRU, + (strlenW(mp->realMRU) + 1)*sizeof(WCHAR)); if (err) { ERR("error saving MRUList, err=%d\n", err); } - TRACE("saving MRUList=/%s/\n", mp->realMRU); + TRACE("saving MRUList=/%s/\n", debugstr_w(mp->realMRU)); } realname[1] = 0; for(i=0; i<mp->cursize; i++) { @@ -768,7 +770,7 @@ if ((replace = FindMRUData (hList, lpData, cbData, NULL)) >= 0) { /* Item exists, just move it to the front */ - LPSTR pos = strchr(mp->realMRU, replace + 'a'); + LPWSTR pos = strchrW(mp->realMRU, replace + 'a'); while (pos > mp->realMRU) { pos[0] = pos[-1]; @@ -961,7 +963,7 @@ /* get space to save indices that will turn into names * but in order of most to least recently used */ - mp->realMRU = Alloc(mp->extview.nMaxItems + 2); + mp->realMRU = Alloc((mp->extview.nMaxItems + 2) * sizeof(WCHAR)); /* get space to save pointers to actual data in order of * 'a' to 'z' (0 to n). @@ -988,14 +990,14 @@ /* get values from key 'MRUList' */ if (newkey) { datasize = mp->extview.nMaxItems + 1; - if((err=RegQueryValueExA( newkey, "MRUList", 0, &type, mp->realMRU, - &datasize))) { + if((err=RegQueryValueExW( newkey, strMRUList, 0, &type, + (LPBYTE)mp->realMRU, &datasize))) { /* not present - set size to 1 (will become 0 later) */ datasize = 1; *mp->realMRU = 0; } [truncated at 1000 lines; 6108 more skipped]
19 years, 8 months
1
0
0
0
[mbosma] 14734: PackageManager: Uploaded forgotten File
by mbosma@svn.reactos.com
PackageManager: Uploaded forgotten File Added: trunk/rosapps/packmgr/lib/options.cpp _____ Added: trunk/rosapps/packmgr/lib/options.cpp --- trunk/rosapps/packmgr/lib/options.cpp 2005-04-21 16:18:29 UTC (rev 14733) +++ trunk/rosapps/packmgr/lib/options.cpp 2005-04-21 16:28:44 UTC (rev 14734) @@ -0,0 +1,76 @@ +//////////////////////////////////////////////////////// +// +// options.cpp +// +// Settting and Loading Options +// +// +// Maarten Bosma, 09.01.2004 +// maarten.paul(a)bosma.de +// +//////////////////////////////////////////////////////////////////// + +#include "package.hpp" +#include "log.h" +#include "expat.h" + + +int PML_XmlDownload (pTree tree, const char* url, void* usrdata, + XML_StartElementHandler start, XML_EndElementHandler end, XML_CharacterDataHandler text) ; + + +// expat callback for start of a "node" tag +void opt_start (void* usrdata, const char* tag, const char** arg) +{ + TREE* tree = (TREE*)usrdata; + + if (!strcmp(tag, "source")) + { + tree->sources.push_back((char*)NULL); + tree->field = &tree->sources.back(); + } +} + +// expat callback for end of a "node" tag +void opt_end (void* usrdata, const char* tag) +{ + TREE* tree = (TREE*)usrdata; + + tree->field = NULL; +} + +// expat callback for end of a "node" tag +void opt_text (void* usrdata, const char* data, int len) +{ + TREE* tree = (TREE*)usrdata; + + if(!tree->field) + return; + + *tree->field = new char[len+1]; + strncpy(*tree->field, data, len); + (*tree->field)[len] = '\0'; +} + + +int CreateOptions (TREE* tree) +{ +// string source; + +// ifstream file ("help.txt", ios_base::in); + Log("* Creating options,xml"); + + return ERR_OK; +} + +int LoadOptions (TREE* tree) +{ + int error; + + error = PML_XmlDownload(tree, "file://options.xml", (void*)tree, opt_start, opt_end, opt_text); + if(!error) + return ERR_OK; + + CreateOptions(tree); + return PML_XmlDownload(tree, "file://options.xml", (void*)tree, opt_start, opt_end, opt_text); +}
19 years, 8 months
1
0
0
0
← Newer
1
...
12
13
14
15
16
17
18
...
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