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
August 2006
----- 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
19 participants
447 discussions
Start a n
N
ew thread
[gedmurphy] 23850: forgot to turn debugging off
by gedmurphy@svn.reactos.org
Author: gedmurphy Date: Fri Sep 1 02:51:28 2006 New Revision: 23850 URL:
http://svn.reactos.org/svn/reactos?rev=23850&view=rev
Log: forgot to turn debugging off Modified: trunk/reactos/base/applications/sc/control.c trunk/reactos/base/applications/sc/create.c trunk/reactos/base/applications/sc/sc.h Modified: trunk/reactos/base/applications/sc/control.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/sc/contr…
============================================================================== --- trunk/reactos/base/applications/sc/control.c (original) +++ trunk/reactos/base/applications/sc/control.c Fri Sep 1 02:51:28 2006 @@ -56,7 +56,7 @@ break; case SERVICE_CONTROL_SHUTDOWN: - dwDesiredAccess = -1; + dwDesiredAccess = 0; break; } Modified: trunk/reactos/base/applications/sc/create.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/sc/creat…
============================================================================== --- trunk/reactos/base/applications/sc/create.c (original) +++ trunk/reactos/base/applications/sc/create.c Fri Sep 1 02:51:28 2006 @@ -37,7 +37,7 @@ _tprintf(_T("error control - %lu\n"), dwErrorControl); _tprintf(_T("Binary path - %s\n"), lpBinaryPathName); _tprintf(_T("load order group - %s\n"), lpLoadOrderGroup); - _tprintf(_T("tag - %lu\n"), lpdwTagId); + _tprintf(_T("tag - %lu\n"), *lpdwTagId); _tprintf(_T("dependincies - %s\n"), lpDependencies); _tprintf(_T("account start name - %s\n"), lpServiceStartName); _tprintf(_T("account password - %s\n"), lpPassword); Modified: trunk/reactos/base/applications/sc/sc.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/sc/sc.h?…
============================================================================== --- trunk/reactos/base/applications/sc/sc.h (original) +++ trunk/reactos/base/applications/sc/sc.h Fri Sep 1 02:51:28 2006 @@ -3,7 +3,7 @@ #include <stdio.h> #include <tchar.h> -#define SCDBG +//#define SCDBG VOID PrintService(LPCTSTR ServiceName, LPSERVICE_STATUS pStatus); VOID PrintServiceEx(LPCTSTR ServiceName, LPSERVICE_STATUS_PROCESS pStatus);
18 years, 3 months
1
0
0
0
[ion] 23849: - Some cleanups - Add support for recovering from user-mode win32k callback fault. - Also add support for debug register saving/reloading during user-mode callbacks and return.
by ion@svn.reactos.org
Author: ion Date: Thu Aug 31 22:10:11 2006 New Revision: 23849 URL:
http://svn.reactos.org/svn/reactos?rev=23849&view=rev
Log: - Some cleanups - Add support for recovering from user-mode win32k callback fault. - Also add support for debug register saving/reloading during user-mode callbacks and return. Modified: trunk/reactos/include/ndk/asm.h trunk/reactos/lib/rtl/i386/debug_asm.S trunk/reactos/ntoskrnl/ke/i386/cpu.S trunk/reactos/ntoskrnl/ke/i386/trap.s trunk/reactos/ntoskrnl/ke/i386/usercall_asm.S Modified: trunk/reactos/include/ndk/asm.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/ndk/asm.h?rev=2384…
============================================================================== --- trunk/reactos/include/ndk/asm.h (original) +++ trunk/reactos/include/ndk/asm.h Thu Aug 31 22:10:11 2006 @@ -430,6 +430,7 @@ #define STATUS_ACCESS_VIOLATION 0xC0000005 #define STATUS_INVALID_SYSTEM_SERVICE 0xC000001C #define STATUS_NO_CALLBACK_ACTIVE 0xC0000258 +#define STATUS_CALLBACK_POP_STACK 0xC0000423 #define STATUS_ARRAY_BOUNDS_EXCEEDED 0xC000008C #define STATUS_ILLEGAL_INSTRUCTION 0xC000001D #define STATUS_BREAKPOINT 0x80000003 Modified: trunk/reactos/lib/rtl/i386/debug_asm.S URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/rtl/i386/debug_asm.S?r…
============================================================================== --- trunk/reactos/lib/rtl/i386/debug_asm.S (original) +++ trunk/reactos/lib/rtl/i386/debug_asm.S Thu Aug 31 22:10:11 2006 @@ -10,23 +10,35 @@ /* GLOBALS ****************************************************************/ -.globl _DbgBreakPoint@0 -.globl _DbgBreakPointWithStatus@4 -.globl _DbgUserBreakPoint@0 -.globl _DebugService@20 +.globl _DbgBreakPoint@0 +.globl _DbgBreakPointWithStatus@4 +.globl _DbgUserBreakPoint@0 +.globl _DebugService@20 +.globl _DbgBreakPointNoBugCheck@0 /* FUNCTIONS ***************************************************************/ +.func DbgBreakPointNoBugCheck@0 +_DbgBreakPointNoBugCheck@0: + int 3 + ret +.endfunc + +.func DbgBreakPoint@0 _DbgBreakPoint@0: _DbgUserBreakPoint@0: int 3 ret - +.endfunc + +.func DbgBreakPointWithStatus@4 _DbgBreakPointWithStatus@4: mov eax, [esp+4] int 3 ret 4 +.endfunc +.func DebugService@20 _DebugService@20: /* Setup the stack */ @@ -58,4 +70,4 @@ /* Return */ leave ret 20 - +.endfunc Modified: trunk/reactos/ntoskrnl/ke/i386/cpu.S URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/i386/cpu.S?rev…
============================================================================== --- trunk/reactos/ntoskrnl/ke/i386/cpu.S (original) +++ trunk/reactos/ntoskrnl/ke/i386/cpu.S Thu Aug 31 22:10:11 2006 @@ -11,30 +11,19 @@ #include <asm.h> .intel_syntax noprefix -/* GLOBALS ****************************************************************/ - - /* FUNCTIONS ****************************************************************/ - -.global _DbgBreakPointNoBugCheck@0 -.func DbgBreakPointNoBugCheck@0 -_DbgBreakPointNoBugCheck@0: - int 3 - ret -.endfunc .globl _KeFlushCurrentTb@0 .func KeFlushCurrentTb@0 _KeFlushCurrentTb@0: + /* Check for global page support */ test byte ptr [_Ke386GlobalPagesEnabled], 0xff jz .L1 /* Modifying the PSE, PGE or PAE Flag in CR4 causes the TLB to be flushed */ mov eax, cr4 -.att_syntax /* Older binutils versions don't support ~ for .intel_syntax */ - and $~CR4_PGE, %eax -.intel_syntax noprefix + and eax, ~CR4_PGE mov cr4, eax or eax, CR4_PGE mov cr4, eax @@ -47,25 +36,4 @@ ret .endfunc -.globl _KiCoprocessorError@0 -.func KiCoprocessorError@0 -_KiCoprocessorError@0: - /* Get the NPX Thread's Initial stack */ - mov eax, [fs:KPCR_NPX_THREAD] - mov eax, [eax+KTHREAD_INITIAL_STACK] - - /* Make space for the FPU Save area */ - sub eax, SIZEOF_FX_SAVE_AREA - - /* Set the CR0 State */ - mov dword ptr [eax+FN_CR0_NPX_STATE], 8 - - /* Update it */ - mov eax, cr0 - or eax, 8 - mov cr0, eax - - /* Return to caller */ - ret -.endfunc Modified: trunk/reactos/ntoskrnl/ke/i386/trap.s URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/i386/trap.s?re…
============================================================================== --- trunk/reactos/ntoskrnl/ke/i386/trap.s (original) +++ trunk/reactos/ntoskrnl/ke/i386/trap.s Thu Aug 31 22:10:11 2006 @@ -55,6 +55,7 @@ /* And special system-defined software traps: */ .globl _NtRaiseException@12 .globl _NtContinue@8 +.globl _KiCoprocessorError@0 /* Interrupt template entrypoints */ .globl _KiInterruptTemplate @@ -1472,6 +1473,28 @@ ret .endfunc +.func KiCoprocessorError@0 +_KiCoprocessorError@0: + + /* Get the NPX Thread's Initial stack */ + mov eax, [fs:KPCR_NPX_THREAD] + mov eax, [eax+KTHREAD_INITIAL_STACK] + + /* Make space for the FPU Save area */ + sub eax, SIZEOF_FX_SAVE_AREA + + /* Set the CR0 State */ + mov dword ptr [eax+FN_CR0_NPX_STATE], 8 + + /* Update it */ + mov eax, cr0 + or eax, 8 + mov cr0, eax + + /* Return to caller */ + ret +.endfunc + /* UNEXPECTED INTERRUPT HANDLERS **********************************************/ .globl _KiStartUnexpectedRange@0 Modified: trunk/reactos/ntoskrnl/ke/i386/usercall_asm.S URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/i386/usercall_…
============================================================================== --- trunk/reactos/ntoskrnl/ke/i386/usercall_asm.S (original) +++ trunk/reactos/ntoskrnl/ke/i386/usercall_asm.S Thu Aug 31 22:10:11 2006 @@ -127,9 +127,7 @@ mov [ebx+KTHREAD_CALLBACK_STACK], esp /* Align stack on 16-byte boundary */ -.att_syntax /* Older binutils versions don't support ~ for intel_syntax */ - and $~15,%esp -.intel_syntax noprefix + and esp, ~15 mov edi, esp /* Set destination and origin NPX Areas */ @@ -178,13 +176,16 @@ lea esi, [edx+KTRAP_FRAME_FS] rep movsd - /* VMWARE Hack because ES/DS sometimes gets smashed when returning to User-Mode. Investigate! */ - mov dword ptr [esp+KTRAP_FRAME_DS], KGDT_R3_DATA + RPL_MASK - mov dword ptr [esp+KTRAP_FRAME_ES], KGDT_R3_DATA + RPL_MASK - - /* FIXME: Copy debug registers if needed */ + /* Copy DR7 */ + mov edi, [edx+KTRAP_FRAME_DR7] + test edi, ~DR7_RESERVED_MASK + mov [esp+KTRAP_FRAME_DR7], edi + + /* Check if we need to save debug registers */ + jnz SaveDebug /* Get user-mode dispatcher address and set it as EIP */ +SetEip: mov eax, _KeUserCallbackDispatcher mov [esp+KTRAP_FRAME_EIP], eax @@ -204,6 +205,15 @@ /* Exit to user-mode */ jmp _KiServiceExit + +SaveDebug: + + /* Copy all 5 DRs */ + mov ecx, 5 + lea edi, [esp+KTRAP_FRAME_DR0] + lea esi, [edx+KTRAP_FRAME_DR0] + rep movsd + jmp SetEip GrowFailed: /* Restore registers */ @@ -294,11 +304,19 @@ mov edx, [esi+FN_CR0_NPX_STATE] mov [ebx+FN_CR0_NPX_STATE], edx - /* Get saved trap frame and clear DR7 */ + /* Check if we failed in user mode */ + cmp ebp, STATUS_CALLBACK_POP_STACK mov edi, [ecx+CBSTACK_TRAP_FRAME] + jz UserFault + +CheckDebug: + + /* Clear DR7 */ and dword ptr [edi+KTRAP_FRAME_DR7], 0 - /* FIXME: Restore debug regs */ + /* Check if debugging was active */ + test byte ptr [eax+KTHREAD_DEBUG_ACTIVE], 0xFF + jnz RestoreDebug /* Get TSS */ mov edx, fs:[KPCR_TSS] @@ -336,12 +354,41 @@ add esp, 8 jmp edx +UserFault: + /* Set size to copy */ + mov ecx, (KTRAP_FRAME_V86_ES - KTRAP_FRAME_FS) / 4 + + /* Check if this was V86 mode */ + mov esi, [eax+KTHREAD_TRAP_FRAME] + test dword ptr [esi+KTRAP_FRAME_EFLAGS], EFLAGS_V86_MASK + + /* Save EDI and load destination */ + mov edx, edi + lea edi, [edi+KTRAP_FRAME_FS] + jz NotV86 + add ecx, 16 / 4 + +NotV86: + /* Set source and copy */ + lea esi, [esi+KTRAP_FRAME_FS] + rep movsd + + /* Restore ECX and ECX */ + mov ecx, [eax+KTHREAD_CALLBACK_STACK] + mov edi, edx + jmp CheckDebug + +RestoreDebug: + + /* Not yet supported */ + int 3 + jmp $ + NoStack: /* Return failure */ mov eax, STATUS_NO_CALLBACK_ACTIVE ret 12 - .endfunc /*++ @@ -450,5 +497,4 @@ pop edi pop esi ret 8 - .endfunc
18 years, 3 months
1
0
0
0
[gedmurphy] 23848: first commit of an overhaul of sc.exe - establish a connection to the SCM for each separate request, allowing the minimum privlidges required, instead of a generic (over privlidged) one. - start to move service printing to separate functions and reduce code duplication - make output 100% as per Windows - fix some commands, e.g. 'interrogate' - improve error checking - improve code structure
by gedmurphy@svn.reactos.org
Author: gedmurphy Date: Thu Aug 31 21:59:02 2006 New Revision: 23848 URL:
http://svn.reactos.org/svn/reactos?rev=23848&view=rev
Log: first commit of an overhaul of sc.exe - establish a connection to the SCM for each separate request, allowing the minimum privlidges required, instead of a generic (over privlidged) one. - start to move service printing to separate functions and reduce code duplication - make output 100% as per Windows - fix some commands, e.g. 'interrogate' - improve error checking - improve code structure Added: trunk/reactos/base/applications/sc/print.c Modified: trunk/reactos/base/applications/sc/control.c trunk/reactos/base/applications/sc/create.c trunk/reactos/base/applications/sc/delete.c trunk/reactos/base/applications/sc/query.c trunk/reactos/base/applications/sc/sc.c trunk/reactos/base/applications/sc/sc.h trunk/reactos/base/applications/sc/sc.rbuild trunk/reactos/base/applications/sc/sc.rc trunk/reactos/base/applications/sc/start.c trunk/reactos/base/applications/sc/usage.c Modified: trunk/reactos/base/applications/sc/control.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/sc/contr…
============================================================================== --- trunk/reactos/base/applications/sc/control.c (original) +++ trunk/reactos/base/applications/sc/control.c Thu Aug 31 21:59:02 2006 @@ -1,61 +1,95 @@ /* - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS SC utility - * FILE: subsys/system/sc/control.c - * PURPOSE: control ReactOS services - * PROGRAMMERS: Ged Murphy (gedmurphy(a)gmail.com) - * REVISIONS: - * Ged Murphy 20/10/05 Created + * PROJECT: ReactOS Services + * LICENSE: GPL - See COPYING in the top level directory + * FILE: base/system/sc/control.c + * PURPOSE: Stops, pauses and resumes a service + * COPYRIGHT: Copyright 2005 - 2006 Ged Murphy <gedmurphy(a)gmail.com> * */ #include "sc.h" -/* - * handles the following commands: - * control, continue, interrogate, pause, stop - */ +BOOL +Control(DWORD Control, + LPCTSTR ServiceName, + LPCTSTR *Args, + INT ArgCount) +{ + SC_HANDLE hSCManager = NULL; + SC_HANDLE hSc = NULL; + SERVICE_STATUS Status; + DWORD dwDesiredAccess = 0; -BOOL Control(DWORD Control, LPCTSTR ServiceName, LPCTSTR *Args) +#ifdef SCDBG { - SC_HANDLE hSc; - SERVICE_STATUS Status; - -#ifdef SCDBG - /* testing */ - _tprintf(_T("service to control - %s\n\n"), ServiceName); - _tprintf(_T("command - %lu\n\n"), Control); - _tprintf(_T("Arguments :\n")); - while (*Args) + LPCTSTR *TmpArgs = Args; + INT TmpCnt = ArgCount; + _tprintf(_T("service to control - %s\n"), ServiceName); + _tprintf(_T("command - %lu\n"), Control); + _tprintf(_T("Arguments:\n")); + while (TmpCnt) { - printf("%s\n", *Args); - Args++; + _tprintf(_T(" %s\n"), *TmpArgs); + TmpArgs++; + TmpCnt--; } + _tprintf(_T("\n")); +} #endif /* SCDBG */ - hSc = OpenService(hSCManager, ServiceName, - SERVICE_INTERROGATE | SERVICE_PAUSE_CONTINUE | - SERVICE_STOP | SERVICE_USER_DEFINED_CONTROL | - SERVICE_QUERY_STATUS); + switch (Control) + { + case SERVICE_CONTROL_STOP: + dwDesiredAccess = SERVICE_STOP; + break; - if (hSc == NULL) - { - _tprintf(_T("openService failed\n")); - ReportLastError(); - return FALSE; + case SERVICE_CONTROL_PAUSE: + dwDesiredAccess = SERVICE_PAUSE_CONTINUE; + break; + + case SERVICE_CONTROL_CONTINUE: + dwDesiredAccess = SERVICE_PAUSE_CONTINUE; + break; + + case SERVICE_CONTROL_INTERROGATE: + dwDesiredAccess = SERVICE_INTERROGATE; + break; + + case SERVICE_CONTROL_SHUTDOWN: + dwDesiredAccess = -1; + break; + } - if (! ControlService(hSc, Control, &Status)) + hSCManager = OpenSCManager(NULL, + NULL, + SC_MANAGER_CONNECT); + if (hSCManager != NULL) { - _tprintf(_T("[SC] controlService FAILED %lu:\n\n"), GetLastError()); - ReportLastError(); - return FALSE; + hSc = OpenService(hSCManager, + ServiceName, + dwDesiredAccess); + if (hSc != NULL) + { + if (ControlService(hSc, + Control, + &Status)) + { + PrintService(ServiceName, + &Status); + + CloseServiceHandle(hSc); + CloseServiceHandle(hSCManager); + + return TRUE; + } + } + else + _tprintf(_T("[SC] OpenService FAILED %lu:\n\n"), GetLastError()); } - CloseServiceHandle(hSc); - - /* print the status information */ - - return TRUE; - + ReportLastError(); + if (hSc) CloseServiceHandle(hSc); + if (hSCManager) CloseServiceHandle(hSCManager); + return FALSE; } Modified: trunk/reactos/base/applications/sc/create.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/sc/creat…
============================================================================== --- trunk/reactos/base/applications/sc/create.c (original) +++ trunk/reactos/base/applications/sc/create.c Thu Aug 31 21:59:02 2006 @@ -1,11 +1,9 @@ /* - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS SC utility - * FILE: subsys/system/sc/create.c - * PURPOSE: control ReactOS services - * PROGRAMMERS: Ged Murphy (gedmurphy(a)gmail.com) - * REVISIONS: - * Ged Murphy 20/10/05 Created + * PROJECT: ReactOS Services + * LICENSE: GPL - See COPYING in the top level directory + * FILE: base/system/sc/create.c + * PURPOSE: Create a service + * COPYRIGHT: Copyright 2005 - 2006 Ged Murphy <gedmurphy(a)gmail.com> * */ @@ -13,46 +11,81 @@ BOOL Create(LPCTSTR ServiceName, LPCTSTR *ServiceArgs) { + SC_HANDLE hSCManager; SC_HANDLE hSc; - LPCTSTR BinaryPathName = *++ServiceArgs; -// LPCTSTR *Options = ++ServiceArgs; - - if ((! ServiceName) || (! BinaryPathName)) - return CreateUsage(); + BOOL bRet = FALSE; -#ifdef SCDBG - /* testing */ - printf("service to create - %s\n", ServiceName); - printf("Binary path - %s\n", BinaryPathName); - printf("Arguments :\n"); - while (*Options) + DWORD dwServiceType = SERVICE_WIN32_OWN_PROCESS; + DWORD dwStartType = SERVICE_DEMAND_START; + DWORD dwErrorControl = SERVICE_ERROR_NORMAL; + LPCTSTR lpBinaryPathName = NULL; + LPCTSTR lpLoadOrderGroup = NULL; + LPDWORD lpdwTagId = NULL; + LPCTSTR lpDependencies = NULL; + LPCTSTR lpServiceStartName = NULL; + LPCTSTR lpPassword = NULL; + + /* quick hack to get it working */ + lpBinaryPathName = *ServiceArgs; + +#ifdef SCDBG +{ + _tprintf(_T("service name - %s\n"), ServiceName); + _tprintf(_T("display name - %s\n"), ServiceName); + _tprintf(_T("service type - %lu\n"), dwServiceType); + _tprintf(_T("start type - %lu\n"), dwStartType); + _tprintf(_T("error control - %lu\n"), dwErrorControl); + _tprintf(_T("Binary path - %s\n"), lpBinaryPathName); + _tprintf(_T("load order group - %s\n"), lpLoadOrderGroup); + _tprintf(_T("tag - %lu\n"), lpdwTagId); + _tprintf(_T("dependincies - %s\n"), lpDependencies); + _tprintf(_T("account start name - %s\n"), lpServiceStartName); + _tprintf(_T("account password - %s\n"), lpPassword); +} +#endif + + if (!ServiceName) { - printf("%s\n", *Options); - Options++; + CreateUsage(); + return FALSE; } -#endif + + hSCManager = OpenSCManager(NULL, + NULL, + SC_MANAGER_CREATE_SERVICE); + if (hSCManager == NULL) + { + ReportLastError(); + return FALSE; + } + hSc = CreateService(hSCManager, ServiceName, ServiceName, SERVICE_ALL_ACCESS, - SERVICE_WIN32_OWN_PROCESS, - SERVICE_DEMAND_START, - SERVICE_ERROR_NORMAL, - BinaryPathName, - NULL, - NULL, - NULL, - NULL, - NULL); + dwServiceType, + dwStartType, + dwErrorControl, + lpBinaryPathName, + lpLoadOrderGroup, + lpdwTagId, + lpDependencies, + lpServiceStartName, + lpPassword); if (hSc == NULL) { - _tprintf(_T("CreateService failed\n")); ReportLastError(); - return FALSE; + CloseServiceHandle(hSCManager); + } + else + { + _tprintf(_T("[SC] CreateService SUCCESS\n")); + + CloseServiceHandle(hSc); + CloseServiceHandle(hSCManager); + bRet = TRUE; } - _tprintf(_T("[SC] CreateService SUCCESS\n")); - CloseServiceHandle(hSc); - return TRUE; + return bRet; } Modified: trunk/reactos/base/applications/sc/delete.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/sc/delet…
============================================================================== --- trunk/reactos/base/applications/sc/delete.c (original) +++ trunk/reactos/base/applications/sc/delete.c Thu Aug 31 21:59:02 2006 @@ -1,11 +1,9 @@ /* - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS SC utility - * FILE: subsys/system/sc/delete.c - * PURPOSE: control ReactOS services - * PROGRAMMERS: Ged Murphy (gedmurphy(a)gmail.com) - * REVISIONS: - * Ged Murphy 20/10/05 Created + * PROJECT: ReactOS Services + * LICENSE: GPL - See COPYING in the top level directory + * FILE: base/system/sc/delete.c + * PURPOSE: Delete a service + * COPYRIGHT: Copyright 2005 - 2006 Ged Murphy <gedmurphy(a)gmail.com> * */ @@ -13,30 +11,39 @@ BOOL Delete(LPCTSTR ServiceName) { - SC_HANDLE hSc; + SC_HANDLE hSCManager = NULL; + SC_HANDLE hSc = NULL; -#ifdef SCDBG - /* testing */ - printf("service to delete - %s\n\n", ServiceName); +#ifdef SCDBG +{ + _tprintf(_T("service to delete - %s\n\n"), ServiceName); +} #endif - hSc = OpenService(hSCManager, ServiceName, DELETE); + hSCManager = OpenSCManager(NULL, + NULL, + SC_MANAGER_CONNECT); + if (hSCManager != NULL) + { + hSc = OpenService(hSCManager, ServiceName, DELETE); + if (hSc != NULL) + { + if (DeleteService(hSc)) + { + _tprintf(_T("[SC] DeleteService SUCCESS\n")); - if (hSc == NULL) - { - _tprintf(_T("openService failed\n")); - ReportLastError(); - return FALSE; + CloseServiceHandle(hSc); + CloseServiceHandle(hSCManager); + + return TRUE; + } + } } - if (! DeleteService(hSc)) - { - _tprintf(_T("DeleteService failed\n")); - ReportLastError(); - return FALSE; - } + ReportLastError(); - _tprintf(_T("[SC] DeleteService SUCCESS\n")); - CloseServiceHandle(hSc); - return TRUE; + if (hSc) CloseServiceHandle(hSc); + if (hSCManager) CloseServiceHandle(hSCManager); + + return FALSE; } Added: trunk/reactos/base/applications/sc/print.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/sc/print…
============================================================================== --- trunk/reactos/base/applications/sc/print.c (added) +++ trunk/reactos/base/applications/sc/print.c Thu Aug 31 21:59:02 2006 @@ -1,0 +1,84 @@ +#include "sc.h" + + +VOID +PrintServiceEx(LPCTSTR lpServiceName, + LPSERVICE_STATUS_PROCESS pStatusEx) +{ + SERVICE_STATUS Status; + + /*FIXME: quick hack, assign values 1 by 1 */ + CopyMemory(&Status, pStatusEx, sizeof(SERVICE_STATUS)); + + PrintService(lpServiceName, + &Status); + + _tprintf(_T("\tPID : %lu\n"), + pStatusEx->dwProcessId); + _tprintf(_T("\tFLAGS : %lu\n"), + pStatusEx->dwServiceFlags); +} + + +VOID +PrintService(LPCTSTR lpServiceName, + LPSERVICE_STATUS pStatus) +{ + _tprintf(_T("SERVICE_NAME: %s\n"), lpServiceName); + + _tprintf(_T("\tTYPE : %x "), + (unsigned int)pStatus->dwServiceType); + switch (pStatus->dwServiceType) + { + case 1 : _tprintf(_T("KERNEL_DRIVER\n")); break; + case 2 : _tprintf(_T("FILE_SYSTEM_DRIVER\n")); break; + case 16 : _tprintf(_T("WIN32_OWN_PROCESS\n")); break; + case 32 : _tprintf(_T("WIN32_SHARE_PROCESS\n")); break; + default : _tprintf(_T("\n")); break; + } + + _tprintf(_T("\tSTATE : %x "), + (unsigned int)pStatus->dwCurrentState); + + switch (pStatus->dwCurrentState) + { + case 1 : _tprintf(_T("STOPPED\n")); break; + case 2 : _tprintf(_T("START_PENDING\n")); break; + case 3 : _tprintf(_T("STOP_PENDING\n")); break; + case 4 : _tprintf(_T("RUNNING\n")); break; + case 5 : _tprintf(_T("CONTINUE_PENDING\n")); break; + case 6 : _tprintf(_T("PAUSE_PENDING\n")); break; + case 7 : _tprintf(_T("PAUSED\n")); break; + default : _tprintf(_T("\n")); break; + } + + _tprintf(_T("\t\t\t\t(")); + + if (pStatus->dwControlsAccepted & SERVICE_ACCEPT_STOP) + _tprintf(_T("STOPPABLE,")); + else + _tprintf(_T("NOT_STOPPABLE,")); + + if (pStatus->dwControlsAccepted & SERVICE_ACCEPT_PAUSE_CONTINUE) + _tprintf(_T("PAUSABLE,")); + else + _tprintf(_T("NOT_PAUSABLE,")); + + if (pStatus->dwControlsAccepted & SERVICE_ACCEPT_SHUTDOWN) + _tprintf(_T("???")); + else + _tprintf(_T("IGNORES_SHUTDOWN")); + + _tprintf(_T(")\n")); + + _tprintf(_T("\tWIN32_EXIT_CODE : %d (0x%x)\n"), + (unsigned int)pStatus->dwWin32ExitCode, + (unsigned int)pStatus->dwWin32ExitCode); + _tprintf(_T("\tSERVICE_EXIT_CODE : %d (0x%x)\n"), + (unsigned int)pStatus->dwServiceSpecificExitCode, + (unsigned int)pStatus->dwServiceSpecificExitCode); + _tprintf(_T("\tCHECKPOINT : 0x%x\n"), + (unsigned int)pStatus->dwCheckPoint); + _tprintf(_T("\tWAIT_HINT : 0x%x\n"), + (unsigned int)pStatus->dwWaitHint); +} Modified: trunk/reactos/base/applications/sc/query.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/sc/query…
============================================================================== --- trunk/reactos/base/applications/sc/query.c (original) +++ trunk/reactos/base/applications/sc/query.c Thu Aug 31 21:59:02 2006 @@ -17,7 +17,7 @@ #include "sc.h" /* local function decs */ -VOID PrintService(BOOL bExtended); +VOID PrintService2(BOOL bExtended); BOOL EnumServices(DWORD ServiceType, DWORD ServiceState); BOOL QueryService(LPCTSTR ServiceName, BOOL bExtended); @@ -33,14 +33,14 @@ { /* get default values */ EnumServices(SERVICE_WIN32, SERVICE_ACTIVE); - + /* print default values */ - PrintService(bExtended); + PrintService2(bExtended); } else if (_tcsicmp(ServiceName, _T("type=")) == 0) { LPCTSTR Type = *ServiceArgs; - + if (_tcsicmp(Type, _T("driver")) == 0) EnumServices(SERVICE_DRIVER, SERVICE_ACTIVE); else if (_tcsicmp(Type, _T("service")) == 0) @@ -52,8 +52,8 @@ _tprintf(_T("\nERROR following \"type=\"!\n")); _tprintf(_T("Must be \"driver\" or \"service\" or \"all\"\n")); } - - PrintService(bExtended); + + PrintService2(bExtended); } else if(_tcsicmp(ServiceName, _T("state=")) == 0) { @@ -68,8 +68,8 @@ _tprintf(_T("\nERROR following \"state=\"!\n")); _tprintf(_T("Must be \"active\" or \"inactive\" or \"all\"\n")); } - - PrintService(bExtended); + + PrintService2(bExtended); } /* else if(_tcsicmp(ServiceName, _T("bufsize="))) @@ -82,7 +82,7 @@ { QueryService(ServiceName, bExtended); } - + return TRUE; } @@ -90,11 +90,21 @@ BOOL QueryService(LPCTSTR ServiceName, BOOL bExtended) { + SC_HANDLE hSCManager; SERVICE_STATUS_PROCESS *pServiceInfo = NULL; SC_HANDLE hSc; DWORD BufSiz = 0; DWORD BytesNeeded = 0; DWORD Ret; + + hSCManager = OpenSCManager(NULL, + NULL, + SC_MANAGER_CONNECT); + if (hSCManager == NULL) + { + ReportLastError(); + return FALSE; + } hSc = OpenService(hSCManager, ServiceName, SERVICE_QUERY_STATUS); @@ -143,7 +153,7 @@ } } - + _tprintf(_T("SERVICE_NAME: %s\n"), ServiceName); _tprintf(_T("\tTYPE : %x "), @@ -193,7 +203,7 @@ _tprintf(_T("\tFLAGS : %lu\n"), pServiceInfo->dwServiceFlags); } - + HeapFree(GetProcessHeap(), 0, pServiceInfo); return TRUE; @@ -203,10 +213,20 @@ BOOL EnumServices(DWORD ServiceType, DWORD ServiceState) { + SC_HANDLE hSCManager; DWORD BufSize = 0; DWORD BytesNeeded = 0; DWORD ResumeHandle = 0; DWORD Ret; + + hSCManager = OpenSCManager(NULL, + NULL, + SC_MANAGER_ENUMERATE_SERVICE); + if (hSCManager == NULL) + { + ReportLastError(); + return FALSE; + } /* determine required buffer size */ Ret = EnumServicesStatusEx(hSCManager, @@ -262,10 +282,10 @@ VOID -PrintService(BOOL bExtended) +PrintService2(BOOL bExtended) { DWORD i; - + for (i=0; i < NumServices; i++) { @@ -322,6 +342,6 @@ _tprintf(_T("\n")); } - + _tprintf(_T("number : %lu\n"), NumServices); } Modified: trunk/reactos/base/applications/sc/sc.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/sc/sc.c?…
============================================================================== --- trunk/reactos/base/applications/sc/sc.c (original) +++ trunk/reactos/base/applications/sc/sc.c Thu Aug 31 21:59:02 2006 @@ -1,11 +1,9 @@ /* - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS SC utility - * FILE: subsys/system/sc/sc.c - * PURPOSE: control ReactOS services - * PROGRAMMERS: Ged Murphy (gedmurphy(a)gmail.com) - * REVISIONS: - * Ged Murphy 20/10/05 Created + * PROJECT: ReactOS Services + * LICENSE: GPL - See COPYING in the top level directory + * FILE: base/system/sc/sc.c + * PURPOSE: parse command line + * COPYRIGHT: Copyright 2005 - 2006 Ged Murphy <gedmurphy(a)gmail.com> * */ @@ -13,13 +11,14 @@ SC_HANDLE hSCManager; -DWORD ReportLastError(VOID) +VOID +ReportLastError(VOID) { LPVOID lpMsgBuf; DWORD RetVal; DWORD ErrorCode = GetLastError(); - if (ErrorCode != ERROR_SUCCESS) + if (ErrorCode != ERROR_SUCCESS) { RetVal = FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | @@ -34,106 +33,133 @@ if (RetVal != 0) { _tprintf(_T("%s"), (LPTSTR)lpMsgBuf); - LocalFree(lpMsgBuf); - /* return number of TCHAR's stored in output buffer - * excluding '\0' - as FormatMessage does*/ - return RetVal; - } - } - return 0; -} - - -INT ScControl(LPTSTR MachineName, // remote machine name - LPCTSTR Command, // sc command - LPCTSTR ServiceName, // name of service - LPCTSTR *ServiceArgs, // any options - DWORD ArgCount) // argument counter -{ - /* count trailing arguments */ - ArgCount -= 3; - - if (MachineName) + } + } +} + + +static INT +ScControl(LPCTSTR Server, // remote machine name + LPCTSTR Command, // sc command + LPCTSTR ServiceName, // name of service + LPCTSTR *ServiceArgs, // any options + DWORD ArgCount) // argument counter +{ + if (Server) { _tprintf(_T("Remote service control is not yet implemented\n")); return 2; } - - /* if we are emurating the services, we don't need administrator access */ - if ( (_tcsicmp(Command, _T("query")) == 0) || (_tcsicmp(Command, _T("queryex")) == 0) ) - hSCManager = OpenSCManager(MachineName, NULL, SC_MANAGER_ENUMERATE_SERVICE); - else - hSCManager = OpenSCManager(MachineName, NULL, SC_MANAGER_ALL_ACCESS); - if (hSCManager == NULL) - { - _tprintf(_T("[SC] OpenSCManager FAILED %lu:\n\n"), GetLastError()); - ReportLastError(); - return -1; - } - - /* emurate command */ - if (_tcsicmp(Command, _T("query")) == 0) - Query(ServiceName, ServiceArgs, FALSE); - - else if (_tcsicmp(Command, _T("queryex")) == 0) - Query(ServiceName, ServiceArgs, TRUE); - - else if (_tcsicmp(Command, _T("start")) == 0) - { - if (ServiceName) - Start(ServiceName, ServiceArgs, ArgCount); + + if (!lstrcmpi(Command, _T("query"))) + { + Query(ServiceName, + ServiceArgs, + FALSE); + } + else if (!lstrcmpi(Command, _T("queryex"))) + { + Query(ServiceName, + ServiceArgs, + TRUE); + } + else if (!lstrcmpi(Command, _T("start"))) + { + if (ServiceName) + { + Start(ServiceName, + ServiceArgs, + ArgCount); + } else StartUsage(); } - else if (_tcsicmp(Command, _T("pause")) == 0) - { - if (ServiceName) - Control(SERVICE_CONTROL_PAUSE, ServiceName, ServiceArgs); + else if (!lstrcmpi(Command, _T("pause"))) + { + if (ServiceName) + { + Control(SERVICE_CONTROL_PAUSE, + ServiceName, + ServiceArgs, + ArgCount); + } else PauseUsage(); } - else if (_tcsicmp(Command, _T("interrogate")) == 0) - { - if (ServiceName) - Control(SERVICE_CONTROL_INTERROGATE, ServiceName, ServiceArgs); + else if (!lstrcmpi(Command, _T("interrogate"))) + { + if (ServiceName) + { + Control(SERVICE_CONTROL_INTERROGATE, + ServiceName, + ServiceArgs, + ArgCount); + } else InterrogateUsage(); } - else if (_tcsicmp(Command, _T("stop")) == 0) - { - if (ServiceName) - Control(SERVICE_CONTROL_STOP, ServiceName, ServiceArgs); + else if (!lstrcmpi(Command, _T("stop"))) + { + if (ServiceName) + { + Control(SERVICE_CONTROL_STOP, + ServiceName, + ServiceArgs, + ArgCount); + } else StopUsage(); } - else if (_tcsicmp(Command, _T("continue")) == 0) - { - if (ServiceName) - Control(SERVICE_CONTROL_CONTINUE, ServiceName, ServiceArgs); + else if (!lstrcmpi(Command, _T("continue"))) + { + if (ServiceName) + { + Control(SERVICE_CONTROL_CONTINUE, + ServiceName, + ServiceArgs, + ArgCount); + } else ContinueUsage(); } - else if (_tcsicmp(Command, _T("delete")) == 0) + else if (!lstrcmpi(Command, _T("delete"))) { if (ServiceName) Delete(ServiceName); else DeleteUsage(); } - else if (_tcsicmp(Command, _T("create")) == 0) + else if (!lstrcmpi(Command, _T("create"))) { if (*ServiceArgs) - Create(ServiceName, ServiceArgs); + Create(ServiceName, + ServiceArgs); else CreateUsage(); } - else if (_tcsicmp(Command, _T("control")) == 0) - { - if (ServiceName) - Control(0, ServiceName, ServiceArgs); - else - ContinueUsage(); + else if (!lstrcmpi(Command, _T("control"))) + { + INT CtlValue; + + CtlValue = _ttoi(ServiceArgs[0]); + ServiceArgs++; + ArgCount--; + + if (ServiceName) + { + if ((CtlValue >=128) && CtlValue <= 255) + { + Control(CtlValue, + ServiceName, + ServiceArgs, + ArgCount); + + return 0; + } + } + + ContinueUsage(); } return 0; } @@ -144,31 +170,47 @@ int _tmain(int argc, LPCTSTR argv[]) { - LPTSTR MachineName = NULL; // remote machine - LPCTSTR Command = NULL; // sc command - LPCTSTR ServiceName = NULL; // Name of service + LPCTSTR Server = NULL; // remote machine + LPCTSTR Command = NULL; // sc command + LPCTSTR ServiceName = NULL; // name of service if (argc < 2) - return MainUsage(); + { + MainUsage(); + return -1; + } /* get server name */ if ((argv[1][0] == '\\') && (argv[1][1] == '\\')) { if (argc < 3) - return MainUsage(); - - _tcscpy(MachineName, argv[1]); + { + MainUsage(); + return -1; + } + + Server = argv[1]; Command = argv[2]; if (argc > 3) ServiceName = argv[3]; - return ScControl(MachineName, Command, ServiceName, &argv[4], argc); + + return ScControl(Server, + Command, + ServiceName, + &argv[4], + argc-4); } else { Command = argv[1]; if (argc > 2) ServiceName = argv[2]; - return ScControl(MachineName, Command, ServiceName, &argv[3], argc); + + return ScControl(Server, + Command, + ServiceName, + &argv[3], + argc-3); } } @@ -191,13 +233,13 @@ } swprintf(argvW[i], L"%hs", argv[i]); } - + if (j == 0) { /* no error converting the parameters, call wmain() */ Ret = wmain(argc, (LPCTSTR *)argvW); } - + /* free the arguments */ for (i = 0; i < argc; i++) { @@ -206,7 +248,7 @@ } free(argvW); } - + return Ret; } #endif Modified: trunk/reactos/base/applications/sc/sc.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/sc/sc.h?…
============================================================================== --- trunk/reactos/base/applications/sc/sc.h (original) +++ trunk/reactos/base/applications/sc/sc.h Thu Aug 31 21:59:02 2006 @@ -3,28 +3,29 @@ #include <stdio.h> #include <tchar.h> -extern SC_HANDLE hSCManager; // declared in sc.c +#define SCDBG -//#define SCDBG +VOID PrintService(LPCTSTR ServiceName, LPSERVICE_STATUS pStatus); +VOID PrintServiceEx(LPCTSTR ServiceName, LPSERVICE_STATUS_PROCESS pStatus); /* control functions */ BOOL Query(LPCTSTR ServiceName, LPCTSTR *ServiceArgs, BOOL bExtended); BOOL Start(LPCTSTR ServiceName, LPCTSTR *ServiceArgs, INT ArgCount); BOOL Create(LPCTSTR ServiceName, LPCTSTR *ServiceArgs); BOOL Delete(LPCTSTR ServiceName); -BOOL Control(DWORD Control, LPCTSTR ServiceName, LPCTSTR *Args); +BOOL Control(DWORD Control, LPCTSTR ServiceName, LPCTSTR *Args, INT ArgCount); /* print and error functions */ -DWORD ReportLastError(VOID); +VOID ReportLastError(VOID); /* usage functions */ -INT MainUsage(VOID); -INT StartUsage(VOID); -INT PauseUsage(VOID); -INT InterrogateUsage(VOID); -INT ContinueUsage(VOID); -INT StopUsage(VOID); -INT ConfigUsage(VOID); -INT DescriptionUsage(VOID); -INT DeleteUsage(VOID); -INT CreateUsage(VOID); +VOID MainUsage(VOID); +VOID StartUsage(VOID); +VOID PauseUsage(VOID); +VOID InterrogateUsage(VOID); +VOID ContinueUsage(VOID); +VOID StopUsage(VOID); +VOID ConfigUsage(VOID); +VOID DescriptionUsage(VOID); +VOID DeleteUsage(VOID); +VOID CreateUsage(VOID); Modified: trunk/reactos/base/applications/sc/sc.rbuild URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/sc/sc.rb…
============================================================================== --- trunk/reactos/base/applications/sc/sc.rbuild (original) +++ trunk/reactos/base/applications/sc/sc.rbuild Thu Aug 31 21:59:02 2006 @@ -7,12 +7,13 @@ <define name="_UNICODE" /> <library>kernel32</library> <library>advapi32</library> - <file>sc.c</file> - <file>start.c</file> - <file>query.c</file> <file>control.c</file> <file>create.c</file> <file>delete.c</file> + <file>print.c</file> + <file>query.c</file> + <file>sc.c</file> + <file>start.c</file> <file>usage.c</file> <file>sc.rc</file> <pch>sc.h</pch> Modified: trunk/reactos/base/applications/sc/sc.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/sc/sc.rc…
============================================================================== --- trunk/reactos/base/applications/sc/sc.rc (original) +++ trunk/reactos/base/applications/sc/sc.rc Thu Aug 31 21:59:02 2006 @@ -1,4 +1,10 @@ +#include <windows.h> +#include <commctrl.h> +#include "resource.h" + #define REACTOS_STR_FILE_DESCRIPTION "Services control application\0" #define REACTOS_STR_INTERNAL_NAME "sc\0" #define REACTOS_STR_ORIGINAL_FILENAME "sc.exe\0" #include <reactos/version.rc> + +//#include "En.rc" Modified: trunk/reactos/base/applications/sc/start.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/sc/start…
============================================================================== --- trunk/reactos/base/applications/sc/start.c (original) +++ trunk/reactos/base/applications/sc/start.c Thu Aug 31 21:59:02 2006 @@ -1,11 +1,9 @@ /* - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS SC utility - * FILE: subsys/system/sc/start.c - * PURPOSE: control ReactOS services - * PROGRAMMERS: Ged Murphy (gedmurphy(a)gmail.com) - * REVISIONS: - * Ged Murphy 20/10/05 Created + * PROJECT: ReactOS Services + * LICENSE: GPL - See COPYING in the top level directory + * FILE: base/system/sc/start.c + * PURPOSE: Start a service + * COPYRIGHT: Copyright 2005 - 2006 Ged Murphy <gedmurphy(a)gmail.com> * */ @@ -13,99 +11,91 @@ BOOL Start(LPCTSTR ServiceName, LPCTSTR *ServiceArgs, INT ArgCount) { - SC_HANDLE hSc; - SERVICE_STATUS_PROCESS ServiceStatus, ServiceStatus2; - DWORD BytesNeeded; + SC_HANDLE hSCManager = NULL; + SC_HANDLE hSc = NULL; + LPSERVICE_STATUS_PROCESS pServiceInfo = NULL; + DWORD BufSiz = 0; + DWORD BytesNeeded = 0; + DWORD Ret; -#ifdef SCDBG - /* testing */ - _tprintf(_T("service to start - %s\n\n"), ServiceName); - _tprintf(_T("Arguments :\n")); - while (*ServiceArgs) +#ifdef SCDBG +{ + LPCTSTR *TmpArgs = ServiceArgs; + INT TmpCnt = ArgCount; + _tprintf(_T("service to control - %s\n"), ServiceName); + _tprintf(_T("Arguments:\n")); + while (TmpCnt) { - printf("%s\n", *ServiceArgs); - ServiceArgs++; + _tprintf(_T(" %s\n"), *TmpArgs); + TmpArgs++; + TmpCnt--; } -#endif + _tprintf(_T("\n")); +} +#endif /* SCDBG */ - /* get a handle to the service requested for starting */ - hSc = OpenService(hSCManager, ServiceName, SERVICE_ALL_ACCESS); + hSCManager = OpenSCManager(NULL, + NULL, + SC_MANAGER_CONNECT); + if (hSCManager == NULL) + goto fail; + + hSc = OpenService(hSCManager, + ServiceName, + SERVICE_START | SERVICE_QUERY_STATUS); if (hSc == NULL) { _tprintf(_T("openService failed\n")); - ReportLastError(); - return FALSE; + goto fail; } - /* start the service opened */ - if (! StartService(hSc, ArgCount, ServiceArgs)) + if (! StartService(hSc, + ArgCount, + ServiceArgs)) { _tprintf(_T("[SC] StartService FAILED %lu:\n\n"), GetLastError()); - ReportLastError(); - return FALSE; - } - - if (! QueryServiceStatusEx( - hSc, - SC_STATUS_PROCESS_INFO, - (LPBYTE)&ServiceStatus, - sizeof(SERVICE_STATUS_PROCESS), - &BytesNeeded)) - { - _tprintf(_T("QueryServiceStatusEx 1 failed\n")); - ReportLastError(); - return FALSE; + goto fail; } - - while (ServiceStatus.dwCurrentState == SERVICE_START_PENDING) + Ret = QueryServiceStatusEx(hSc, + SC_STATUS_PROCESS_INFO, + NULL, + BufSiz, + &BytesNeeded); + if ((Ret != 0) || (GetLastError() != ERROR_INSUFFICIENT_BUFFER)) //FIXME: check this + goto fail; + + + pServiceInfo = (LPSERVICE_STATUS_PROCESS)HeapAlloc(GetProcessHeap(), + 0, + BytesNeeded); + if (pServiceInfo == NULL) + goto fail; + + if (!QueryServiceStatusEx(hSc, + SC_STATUS_PROCESS_INFO, + (LPBYTE)pServiceInfo, + BytesNeeded, + &BytesNeeded)) { - /* wait before checking status */ - Sleep(ServiceStatus.dwWaitHint); - - /* check status again */ - if (! QueryServiceStatusEx( - hSc, - SC_STATUS_PROCESS_INFO, - (LPBYTE)&ServiceStatus, - sizeof(SERVICE_STATUS_PROCESS), - &BytesNeeded)) - { - _tprintf(_T("QueryServiceStatusEx 2 failed\n")); - ReportLastError(); - return FALSE; - } + goto fail; } - QueryServiceStatusEx(hSc, SC_STATUS_PROCESS_INFO, (LPBYTE)&ServiceStatus2, - sizeof(SERVICE_STATUS_PROCESS), &BytesNeeded); + PrintServiceEx(ServiceName, + pServiceInfo); + HeapFree(GetProcessHeap(), 0, pServiceInfo); CloseServiceHandle(hSc); - - if (ServiceStatus.dwCurrentState == SERVICE_RUNNING) - { - _tprintf(_T("\nSERVICE_NAME: %s\n"), ServiceName); - _tprintf(_T("\tTYPE : %lu\n"), ServiceStatus2.dwServiceType); - _tprintf(_T("\tSTATE : %lu\n"), ServiceStatus2.dwCurrentState); - _tprintf(_T("\tWIN32_EXIT_CODE : %lu\n"), ServiceStatus2.dwWin32ExitCode); - _tprintf(_T("\tCHECKPOINT : %lu\n"), ServiceStatus2.dwCheckPoint); - _tprintf(_T("\tWAIT_HINT : %lu\n"), ServiceStatus2.dwWaitHint); - _tprintf(_T("\tPID : %lu\n"), ServiceStatus2.dwProcessId); - _tprintf(_T("\tFLAGS : %lu\n"), ServiceStatus2.dwServiceFlags); + CloseServiceHandle(hSCManager); - return TRUE; - } - else - { - _tprintf(_T("Failed to start %s\n"), ServiceName); - _tprintf(_T("Curent state: %lu\n"), ServiceStatus.dwCurrentState); - _tprintf(_T("Exit code: %lu\n"), ServiceStatus.dwWin32ExitCode); - _tprintf(_T("Service Specific exit code: %lu\n"), - ServiceStatus.dwServiceSpecificExitCode); - _tprintf(_T("Check point: %lu\n"), ServiceStatus.dwCheckPoint); - _tprintf(_T("Wait hint: %lu\n"), ServiceStatus.dwWaitHint); - - return FALSE; - } + return TRUE; + +fail: + ReportLastError(); + if (pServiceInfo) HeapFree(GetProcessHeap(), 0, pServiceInfo); + if (hSc) CloseServiceHandle(hSc); + if (hSCManager) CloseServiceHandle(hSCManager); + return FALSE; + } Modified: trunk/reactos/base/applications/sc/usage.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/sc/usage…
============================================================================== --- trunk/reactos/base/applications/sc/usage.c (original) +++ trunk/reactos/base/applications/sc/usage.c Thu Aug 31 21:59:02 2006 @@ -10,7 +10,7 @@ */ #include "sc.h" -INT MainUsage(VOID) +VOID MainUsage(VOID) { INT c; @@ -88,84 +88,67 @@ _T("sc query type= service type= interact - Enumerates all interactive services\n")); // _T("sc query type= driver group= NDIS - Enumerates all NDIS drivers\n")); } - - - return 0; } -INT StartUsage(VOID) +VOID StartUsage(VOID) { _tprintf(_T("DESCRIPTION:\n") _T(" Starts a service running.\n") _T("USAGE:\n") _T(" sc <server> start [service name] <arg1> <arg2> ...\n")); - - return 0; } -INT PauseUsage(VOID) +VOID PauseUsage(VOID) { _tprintf(_T("DESCRIPTION:\n") _T(" Sends a PAUSE control request to a service.\n") _T("USAGE:\n") _T(" sc <server> pause [service name]\n")); - - return 0; } -INT InterrogateUsage(VOID) +VOID InterrogateUsage(VOID) { _tprintf(_T("DESCRIPTION:\n") _T(" Sends an INTERROGATE control request to a service.\n") _T("USAGE:\n") _T(" sc <server> interrogate [service name]\n")); - - return 0; } -INT StopUsage(VOID) +VOID StopUsage(VOID) { _tprintf(_T("DESCRIPTION:\n") _T(" Sends an STOP control request to a service.\n") _T("USAGE:\n") _T(" sc <server> stop [service name]\n")); - - return 0; } -INT ContinueUsage(VOID) +VOID ContinueUsage(VOID) { _tprintf(_T("DESCRIPTION:\n") _T(" Sends an CONTINUE control request to a service.\n") _T("USAGE:\n") _T(" sc <server> continue [service name]\n")); - - return 0; } -INT ConfigUsage(VOID) +VOID ConfigUsage(VOID) { _tprintf(_T("not yet implemented\n")); - - return 0; } -INT DescriptionUsage(VOID) +VOID DescriptionUsage(VOID) { _tprintf(_T("DESCRIPTION:\n") _T(" Sets the description string for a service.\n") _T("USAGE:\n") _T(" sc <server> description [service name]\n")); - - return 0; } -INT DeleteUsage(VOID) +VOID DeleteUsage(VOID) { _tprintf(_T("DESCRIPTION:\n") _T(" Deletes a service entry from the registry.\n") @@ -174,11 +157,9 @@ _T(" for deletion.\n") _T("USAGE:\n") _T(" sc <server> delete [service name]\n")); - - return 0; } -INT CreateUsage(VOID) +VOID CreateUsage(VOID) { _tprintf(_T("Creates a service entry in the registry and Service Database.\n") _T("SYNTAX:\n") @@ -199,6 +180,4 @@ _T(" (default = LocalSystem)\n") _T(" DisplayName= <display name>\n") _T(" password= <password>\n")); - - return 0; }
18 years, 3 months
1
0
0
0
[pborobia] 23847: * add more clipboard formats definitions * move definition to right place
by pborobia@svn.reactos.org
Author: pborobia Date: Thu Aug 31 21:37:49 2006 New Revision: 23847 URL:
http://svn.reactos.org/svn/reactos?rev=23847&view=rev
Log: * add more clipboard formats definitions * move definition to right place Modified: branches/clipboard/include/psdk/winuser.h branches/clipboard/subsystems/win32/win32k/ntuser/clipboard.c Modified: branches/clipboard/include/psdk/winuser.h URL:
http://svn.reactos.org/svn/reactos/branches/clipboard/include/psdk/winuser.…
============================================================================== --- branches/clipboard/include/psdk/winuser.h (original) +++ branches/clipboard/include/psdk/winuser.h Thu Aug 31 21:37:49 2006 @@ -54,6 +54,8 @@ #define HCBT_KEYSKIPPED 7 #define HCBT_SYSCOMMAND 8 #define HCBT_SETFOCUS 9 + +/* Predefined Clipboard Formats */ #define CF_TEXT 1 #define CF_BITMAP 2 #define CF_METAFILEPICT 3 @@ -68,9 +70,24 @@ #define CF_WAVE 12 #define CF_UNICODETEXT 13 #define CF_ENHMETAFILE 14 -#define CF_HDROP 15 -#define CF_LOCALE 16 -#define CF_MAX 17 + +#if(WINVER >= 0x0400) +#define CF_HDROP 15 +#define CF_LOCALE 16 +#endif + +#if(WINVER >= 0x0500) +#define CF_DIBV5 17 +#endif + +#if(WINVER >= 0x0500) +#define CF_MAX 18 +#elif(WINVER >= 0x0400) +#define CF_MAX 17 +#else +#define CF_MAX 15 +#endif + #define CF_OWNERDISPLAY 128 #define CF_DSPTEXT 129 #define CF_DSPBITMAP 130 @@ -80,6 +97,7 @@ #define CF_PRIVATELAST 767 #define CF_GDIOBJFIRST 768 #define CF_GDIOBJLAST 1023 + #define HKL_NEXT 1 #define HKL_PREV 0 #define KLF_ACTIVATE 1 Modified: branches/clipboard/subsystems/win32/win32k/ntuser/clipboard.c URL:
http://svn.reactos.org/svn/reactos/branches/clipboard/subsystems/win32/win3…
============================================================================== --- branches/clipboard/subsystems/win32/win32k/ntuser/clipboard.c (original) +++ branches/clipboard/subsystems/win32/win32k/ntuser/clipboard.c Thu Aug 31 21:37:49 2006 @@ -11,8 +11,6 @@ #define DEBUG #include <debug.h> - -#define CF_DIBV5 17 #define DATA_DELAYED_RENDER 0 #define DATA_SYNTHESIZED_RENDER -1
18 years, 3 months
1
0
0
0
[ekohl] 23846: Pass additional arguments to a service when it is started by a call to StartService.
by ekohl@svn.reactos.org
Author: ekohl Date: Thu Aug 31 21:16:19 2006 New Revision: 23846 URL:
http://svn.reactos.org/svn/reactos?rev=23846&view=rev
Log: Pass additional arguments to a service when it is started by a call to StartService. Modified: trunk/reactos/base/system/services/database.c trunk/reactos/base/system/services/driver.c trunk/reactos/base/system/services/rpcserver.c trunk/reactos/base/system/services/services.h trunk/reactos/dll/win32/advapi32/service/sctrl.c trunk/reactos/include/reactos/wine/winnt.h Modified: trunk/reactos/base/system/services/database.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/system/services/datab…
============================================================================== --- trunk/reactos/base/system/services/database.c (original) +++ trunk/reactos/base/system/services/database.c Thu Aug 31 21:16:19 2006 @@ -528,14 +528,14 @@ } -static NTSTATUS -ScmSendStartCommand(PSERVICE Service, LPWSTR Arguments) +static DWORD +ScmSendStartCommand(PSERVICE Service, + LPWSTR Arguments) { PSCM_START_PACKET StartPacket; DWORD TotalLength; -#if 0 + DWORD ArgsLength = 0; DWORD Length; -#endif PWSTR Ptr; DWORD Count; @@ -543,7 +543,6 @@ /* Calculate the total length of the start command line */ TotalLength = wcslen(Service->lpServiceName) + 1; -#if 0 if (Arguments != NULL) { Ptr = Arguments; @@ -551,18 +550,20 @@ { Length = wcslen(Ptr) + 1; TotalLength += Length; + ArgsLength += Length; Ptr += Length; - } - } -#endif + DPRINT("Arg: %S\n", Ptr); + } + } TotalLength++; + DPRINT("ArgsLength: %ld\nTotalLength: %ld\n\n", ArgsLength, TotalLength); /* Allocate start command packet */ StartPacket = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(SCM_START_PACKET) + (TotalLength - 1) * sizeof(WCHAR)); if (StartPacket == NULL) - return STATUS_INSUFFICIENT_RESOURCES; + return ERROR_NOT_ENOUGH_MEMORY; StartPacket->Command = SCM_START_COMMAND; StartPacket->Size = TotalLength; @@ -570,8 +571,14 @@ wcscpy(Ptr, Service->lpServiceName); Ptr += (wcslen(Service->lpServiceName) + 1); - /* FIXME: Copy argument list */ - + /* Copy argument list */ + if (Arguments != NULL) + { + memcpy(Ptr, Arguments, ArgsLength); + Ptr += ArgsLength; + } + + /* Terminate the argument list */ *Ptr = 0; /* Send the start command */ @@ -583,18 +590,20 @@ /* FIXME: Read the reply */ + /* Release the start command packet */ HeapFree(GetProcessHeap(), 0, StartPacket); DPRINT("ScmSendStartCommand() done\n"); - return STATUS_SUCCESS; -} - - -static NTSTATUS -ScmStartUserModeService(PSERVICE Service) + return ERROR_SUCCESS; +} + + +static DWORD +ScmStartUserModeService(PSERVICE Service, + LPWSTR lpArgs) { RTL_QUERY_REGISTRY_TABLE QueryTable[3]; PROCESS_INFORMATION ProcessInformation; @@ -603,6 +612,7 @@ ULONG Type; BOOL Result; NTSTATUS Status; + DWORD dwError = ERROR_SUCCESS; RtlInitUnicodeString(&ImagePath, NULL); @@ -626,7 +636,7 @@ if (!NT_SUCCESS(Status)) { DPRINT1("RtlQueryRegistryValues() failed (Status %lx)\n", Status); - return Status; + return RtlNtStatusToDosError(Status); } DPRINT("ImagePath: '%S'\n", ImagePath.Buffer); DPRINT("Type: %lx\n", Type); @@ -644,7 +654,7 @@ if (Service->ControlPipeHandle == INVALID_HANDLE_VALUE) { DPRINT1("Failed to create control pipe!\n"); - return STATUS_UNSUCCESSFUL; + return GetLastError(); } StartupInfo.cb = sizeof(StartupInfo); @@ -669,12 +679,13 @@ if (!Result) { + dwError = GetLastError(); /* Close control pipe */ CloseHandle(Service->ControlPipeHandle); Service->ControlPipeHandle = INVALID_HANDLE_VALUE; DPRINT1("Starting '%S' failed!\n", Service->lpServiceName); - return STATUS_UNSUCCESSFUL; + return dwError; } DPRINT("Process Id: %lu Handle %lx\n", @@ -706,20 +717,21 @@ &dwRead, NULL)) { + dwError = GetLastError(); DPRINT1("Reading the service control pipe failed (Error %lu)\n", - GetLastError()); - Status = STATUS_UNSUCCESSFUL; + dwError); } else { DPRINT("Received process id %lu\n", dwProcessId); /* Send start command */ - Status = ScmSendStartCommand(Service, NULL); + dwError = ScmSendStartCommand(Service, lpArgs); } } else { + dwError = GetLastError(); DPRINT("Connecting control pipe failed!\n"); /* Close control pipe */ @@ -727,22 +739,21 @@ Service->ControlPipeHandle = INVALID_HANDLE_VALUE; Service->ProcessId = 0; Service->ThreadId = 0; - Status = STATUS_UNSUCCESSFUL; } /* Close process and thread handle */ CloseHandle(ProcessInformation.hThread); CloseHandle(ProcessInformation.hProcess); - return Status; -} - - -NTSTATUS -ScmStartService(PSERVICE Service) + return dwError; +} + + +DWORD +ScmStartService(PSERVICE Service, LPWSTR lpArgs) { PSERVICE_GROUP Group = Service->lpGroup; - NTSTATUS Status; + DWORD dwError = ERROR_SUCCESS; DPRINT("ScmStartService() called\n"); @@ -752,19 +763,19 @@ if (Service->Status.dwServiceType & SERVICE_DRIVER) { /* Load driver */ - Status = ScmLoadDriver(Service); - if (Status == STATUS_SUCCESS) + dwError = ScmLoadDriver(Service); + if (dwError == ERROR_SUCCESS) Service->Status.dwControlsAccepted = SERVICE_ACCEPT_STOP; } else { /* Start user-mode service */ - Status = ScmStartUserModeService(Service); - } - - DPRINT("ScmStartService() done (Status %lx)\n", Status); - - if (NT_SUCCESS(Status)) + dwError = ScmStartUserModeService(Service, lpArgs); + } + + DPRINT("ScmStartService() done (Error %lu)\n", dwError); + + if (dwError == ERROR_SUCCESS) { if (Group != NULL) { @@ -802,7 +813,7 @@ } #endif - return Status; + return dwError; } @@ -846,7 +857,7 @@ (CurrentService->dwTag == CurrentGroup->TagArray[i])) { CurrentService->ServiceVisited = TRUE; - ScmStartService(CurrentService); + ScmStartService(CurrentService, NULL); } ServiceEntry = ServiceEntry->Flink; @@ -864,7 +875,7 @@ (CurrentService->ServiceVisited == FALSE)) { CurrentService->ServiceVisited = TRUE; - ScmStartService(CurrentService); + ScmStartService(CurrentService, NULL); } ServiceEntry = ServiceEntry->Flink; @@ -884,7 +895,7 @@ (CurrentService->ServiceVisited == FALSE)) { CurrentService->ServiceVisited = TRUE; - ScmStartService(CurrentService); + ScmStartService(CurrentService, NULL); } ServiceEntry = ServiceEntry->Flink; @@ -901,7 +912,7 @@ (CurrentService->ServiceVisited == FALSE)) { CurrentService->ServiceVisited = TRUE; - ScmStartService(CurrentService); + ScmStartService(CurrentService, NULL); } ServiceEntry = ServiceEntry->Flink; Modified: trunk/reactos/base/system/services/driver.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/system/services/drive…
============================================================================== --- trunk/reactos/base/system/services/driver.c (original) +++ trunk/reactos/base/system/services/driver.c Thu Aug 31 21:16:19 2006 @@ -11,12 +11,13 @@ /* FUNCTIONS ****************************************************************/ -NTSTATUS +DWORD ScmLoadDriver(PSERVICE lpService) { WCHAR szDriverPath[MAX_PATH]; UNICODE_STRING DriverPath; NTSTATUS Status; + DWORD dwError = ERROR_SUCCESS; /* Build the driver path */ wcscpy(szDriverPath, @@ -34,7 +35,12 @@ /* FIXME: Release privilege */ - return Status; + if (!NT_SUCCESS(Status)) + { + dwError = RtlNtStatusToDosError(Status); + } + + return dwError; } Modified: trunk/reactos/base/system/services/rpcserver.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/system/services/rpcse…
============================================================================== --- trunk/reactos/base/system/services/rpcserver.c (original) +++ trunk/reactos/base/system/services/rpcserver.c Thu Aug 31 21:16:19 2006 @@ -1755,7 +1755,6 @@ DWORD dwError = ERROR_SUCCESS; PSERVICE_HANDLE hSvc; PSERVICE lpService = NULL; - NTSTATUS Status; DPRINT1("ScmrStartServiceW() called\n"); @@ -1790,12 +1789,7 @@ return ERROR_SERVICE_MARKED_FOR_DELETE; /* Start the service */ - Status = ScmStartService(lpService); - if (!NT_SUCCESS(Status)) - { - DPRINT("ScmStartService failed!\n"); - return RtlNtStatusToDosError(Status); - } + dwError = ScmStartService(lpService, (LPWSTR)lpServiceArgBuffer); return dwError; } @@ -2099,7 +2093,6 @@ DWORD dwError = ERROR_SUCCESS; PSERVICE_HANDLE hSvc; PSERVICE lpService = NULL; - NTSTATUS Status; DPRINT1("ScmrStartServiceA() called\n"); @@ -2136,9 +2129,9 @@ /* FIXME: Convert argument vector to Unicode */ /* Start the service */ - Status = ScmStartService(lpService); - if (!NT_SUCCESS(Status)) - return RtlNtStatusToDosError(Status); + dwError = ScmStartService(lpService, NULL); + + /* FIXME: Free argument vector */ return dwError; } Modified: trunk/reactos/base/system/services/services.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/system/services/servi…
============================================================================== --- trunk/reactos/base/system/services/services.h (original) +++ trunk/reactos/base/system/services/services.h Thu Aug 31 21:16:19 2006 @@ -88,6 +88,8 @@ DWORD ScmCreateServiceDatabase(VOID); VOID ScmGetBootAndSystemDriverState(VOID); VOID ScmAutoStartServices(VOID); +DWORD ScmStartService(PSERVICE Service, + LPWSTR lpArgs); PSERVICE ScmGetServiceEntryByName(LPWSTR lpServiceName); PSERVICE ScmGetServiceEntryByDisplayName(LPWSTR lpDisplayName); @@ -99,7 +101,7 @@ /* driver.c */ -NTSTATUS ScmLoadDriver(PSERVICE lpService); +DWORD ScmLoadDriver(PSERVICE lpService); DWORD ScmUnloadDriver(PSERVICE lpService); DWORD ScmControlDriver(PSERVICE lpService, DWORD dwControl, @@ -121,8 +123,6 @@ /* services.c */ VOID PrintString(LPCSTR fmt, ...); -NTSTATUS ScmStartService(PSERVICE Service); - /* EOF */ Modified: trunk/reactos/dll/win32/advapi32/service/sctrl.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/advapi32/service…
============================================================================== --- trunk/reactos/dll/win32/advapi32/service/sctrl.c (original) +++ trunk/reactos/dll/win32/advapi32/service/sctrl.c Thu Aug 31 21:16:19 2006 @@ -90,17 +90,24 @@ PACTIVE_SERVICE lpService; DWORD dwArgCount = 0; DWORD dwLength = 0; + DWORD dwLen; + LPWSTR lpPtr; lpService = (PACTIVE_SERVICE)Context; DPRINT("ScServiceMainStub() called\n"); /* Count arguments */ - while (lpService->Arguments[dwLength]) - { - dwLength += wcslen(&lpService->Arguments[dwLength]) + 1; + lpPtr = lpService->Arguments; + while (*lpPtr) + { + DPRINT("arg: %S\n", *lpPtr); + dwLen = wcslen(lpPtr) + 1; dwArgCount++; - } + dwLength += dwLen; + lpPtr += dwLen; + } + DPRINT("dwArgCount: %ld\ndwLength: %ld\n", dwArgCount, dwLength); /* Build the argument vector and call the main service routine */ if (lpService->bUnicode) @@ -241,6 +248,7 @@ PACTIVE_SERVICE lpService; HANDLE ThreadHandle; + DPRINT("ScStartService() called\n"); DPRINT("Size: %lu\n", StartPacket->Size); DPRINT("Service: %S\n", &StartPacket->Arguments[0]); Modified: trunk/reactos/include/reactos/wine/winnt.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/reactos/wine/winnt…
============================================================================== --- trunk/reactos/include/reactos/wine/winnt.h (original) +++ trunk/reactos/include/reactos/wine/winnt.h Thu Aug 31 21:16:19 2006 @@ -38,6 +38,8 @@ #define LANG_RHAETO_ROMANCE 0x17 #define LANG_SAAMI 0x3b #define LANG_SORBIAN 0x2e +#define LANG_LOWER_SORBIAN 0x2e +#define LANG_UPPER_SORBIAN 0x2e #define LANG_SUTU 0x30 #define LANG_TSONGA 0x31 #define LANG_TSWANA 0x32
18 years, 3 months
1
0
0
0
[ion] 23845: - Remove some deprecated code and custom ROS exports/code.
by ion@svn.reactos.org
Author: ion Date: Thu Aug 31 21:10:58 2006 New Revision: 23845 URL:
http://svn.reactos.org/svn/reactos?rev=23845&view=rev
Log: - Remove some deprecated code and custom ROS exports/code. Modified: trunk/reactos/ntoskrnl/ex/init.c trunk/reactos/ntoskrnl/ke/i386/gdt.c trunk/reactos/ntoskrnl/ke/i386/kernel.c trunk/reactos/ntoskrnl/ke/i386/main_asm.S trunk/reactos/ntoskrnl/ke/i386/tss.c trunk/reactos/ntoskrnl/ke/main.c trunk/reactos/ntoskrnl/ntoskrnl.def Modified: trunk/reactos/ntoskrnl/ex/init.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ex/init.c?rev=238…
============================================================================== --- trunk/reactos/ntoskrnl/ex/init.c (original) +++ trunk/reactos/ntoskrnl/ex/init.c Thu Aug 31 21:10:58 2006 @@ -565,21 +565,7 @@ if (KdPollBreakIn()) DbgBreakPointWithStatus (DBG_STATUS_CONTROL_C); /* Initialize all processors */ - while (!HalAllProcessorsStarted()) { - - PVOID ProcessorStack; - - /* Set up the Kernel and Process Manager for this CPU */ - KePrepareForApplicationProcessorInit(KeNumberProcessors); - KeCreateApplicationProcessorIdleThread(KeNumberProcessors); - - /* Allocate a stack for use when booting the processor */ - ProcessorStack = RVA(Ki386InitialStackArray[((int)KeNumberProcessors)], KERNEL_STACK_SIZE); - - /* Tell HAL a new CPU is being started */ - HalStartNextProcessor(0, (ULONG)ProcessorStack - 2*sizeof(FX_SAVE_AREA)); - KeNumberProcessors++; - } + HalAllProcessorsStarted(); /* Do Phase 1 HAL Initalization */ HalInitSystem(1, (PLOADER_PARAMETER_BLOCK)&KeLoaderBlock); Modified: trunk/reactos/ntoskrnl/ke/i386/gdt.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/i386/gdt.c?rev…
============================================================================== --- trunk/reactos/ntoskrnl/ke/i386/gdt.c (original) +++ trunk/reactos/ntoskrnl/ke/i386/gdt.c Thu Aug 31 21:10:58 2006 @@ -48,12 +48,6 @@ static KSPIN_LOCK GdtLock; /* FUNCTIONS *****************************************************************/ - -VOID -KiGdtPrepareForApplicationProcessorInit(ULONG Id) -{ - KiGdtArray[Id] = ExAllocatePool(NonPagedPool, sizeof(USHORT) * 4 * 11); -} VOID KiInitializeGdt(PKPCR Pcr) @@ -247,36 +241,4 @@ KeReleaseSpinLock(&GdtLock, oldIrql); } -VOID -KeDumpGdtSelector(ULONG Entry) -{ - USHORT a, b, c, d; - ULONG RawLimit; - - a = KiBootGdt[Entry*4]; - b = KiBootGdt[Entry*4 + 1]; - c = KiBootGdt[Entry*4 + 2]; - d = KiBootGdt[Entry*4 + 3]; - - DbgPrint("Base: %x\n", b + ((c & 0xff) * (1 << 16)) + - ((d & 0xff00) * (1 << 16))); - RawLimit = a + ((d & 0xf) * (1 << 16)); - if (d & 0x80) - { - DbgPrint("Limit: %x\n", RawLimit * 4096); - } - else - { - DbgPrint("Limit: %x\n", RawLimit); - } - DbgPrint("Accessed: %d\n", (c & 0x100) >> 8); - DbgPrint("Type: %x\n", (c & 0xe00) >> 9); - DbgPrint("System: %d\n", (c & 0x1000) >> 12); - DbgPrint("DPL: %d\n", (c & 0x6000) >> 13); - DbgPrint("Present: %d\n", (c & 0x8000) >> 15); - DbgPrint("AVL: %x\n", (d & 0x10) >> 4); - DbgPrint("D: %d\n", (d & 0x40) >> 6); - DbgPrint("G: %d\n", (d & 0x80) >> 7); -} - /* EOF */ Modified: trunk/reactos/ntoskrnl/ke/i386/kernel.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/i386/kernel.c?…
============================================================================== --- trunk/reactos/ntoskrnl/ke/i386/kernel.c (original) +++ trunk/reactos/ntoskrnl/ke/i386/kernel.c Thu Aug 31 21:10:58 2006 @@ -41,8 +41,6 @@ #if defined (ALLOC_PRAGMA) #pragma alloc_text(INIT, Ki386GetCpuId) -#pragma alloc_text(INIT, KeCreateApplicationProcessorIdleThread) -#pragma alloc_text(INIT, KePrepareForApplicationProcessorInit) #pragma alloc_text(INIT, KeInit1) #pragma alloc_text(INIT, KeInit2) #pragma alloc_text(INIT, Ki386SetProcessorFeatures) @@ -185,148 +183,6 @@ Ki386Cpuid(0x80000006, &Dummy, &Dummy, &Ecx, &Dummy); Pcr->SecondLevelCacheSize = Ecx >> 16; } -} - -VOID -KeApplicationProcessorInitDispatcher(VOID) -{ - KIRQL oldIrql; - oldIrql = KeAcquireDispatcherDatabaseLock(); - IdleProcessorMask |= (1 << KeGetCurrentProcessorNumber()); - KeReleaseDispatcherDatabaseLock(oldIrql); -} - -VOID -INIT_FUNCTION -KeCreateApplicationProcessorIdleThread(ULONG Id) -{ - PETHREAD IdleThread; - PKPRCB Prcb = ((PKPCR)((ULONG_PTR)KPCR_BASE + Id * PAGE_SIZE))->Prcb; - - PsInitializeIdleOrFirstThread(PsIdleProcess, - &IdleThread, - NULL, - KernelMode, - FALSE); - IdleThread->Tcb.State = Running; - IdleThread->Tcb.FreezeCount = 0; - IdleThread->Tcb.Affinity = 1 << Id; - IdleThread->Tcb.UserAffinity = 1 << Id; - IdleThread->Tcb.Priority = LOW_PRIORITY; - IdleThread->Tcb.BasePriority = LOW_PRIORITY; - Prcb->IdleThread = &IdleThread->Tcb; - Prcb->CurrentThread = &IdleThread->Tcb; - - Ki386InitialStackArray[Id] = (PVOID)IdleThread->Tcb.StackLimit; - - DPRINT("IdleThread for Processor %d has PID %d\n", - Id, IdleThread->Cid.UniqueThread); -} - -VOID -INIT_FUNCTION -NTAPI -KePrepareForApplicationProcessorInit(ULONG Id) -{ - PFN_TYPE PrcPfn; - PKIPCR Pcr; - PKIPCR BootPcr; - - DPRINT("KePrepareForApplicationProcessorInit(Id %d)\n", Id); - - BootPcr = (PKIPCR)KPCR_BASE; - Pcr = (PKIPCR)((ULONG_PTR)KPCR_BASE + Id * PAGE_SIZE); - - MmRequestPageMemoryConsumer(MC_NPPOOL, TRUE, &PrcPfn); - MmCreateVirtualMappingForKernel((PVOID)Pcr, - PAGE_READWRITE, - &PrcPfn, - 1); - /* - * Create a PCR for this processor - */ - memset(Pcr, 0, PAGE_SIZE); - Pcr->Number = Id; - Pcr->SetMember = 1 << Id; - Pcr->NtTib.Self = &Pcr->NtTib; - Pcr->Self = (PKPCR)Pcr; - Pcr->Prcb = &Pcr->PrcbData; - Pcr->Irql = SYNCH_LEVEL; - - Pcr->PrcbData.SetMember = 1 << Id; - Pcr->PrcbData.MHz = BootPcr->PrcbData.MHz; - Pcr->StallScaleFactor = BootPcr->StallScaleFactor; - - /* Mark the end of the exception handler list */ - Pcr->NtTib.ExceptionList = (PVOID)-1; - - KiGdtPrepareForApplicationProcessorInit(Id); - - KeActiveProcessors |= 1 << Id; -} - -VOID -NTAPI -KeApplicationProcessorInit(VOID) -{ - ULONG Offset; - PKIPCR Pcr; - - DPRINT("KeApplicationProcessorInit()\n"); - - if (Ke386GlobalPagesEnabled) - { - /* Enable global pages */ - Ke386SetCr4(Ke386GetCr4() | X86_CR4_PGE); - } - - - Offset = InterlockedIncrementUL(&PcrsAllocated) - 1; - Pcr = (PKIPCR)((ULONG_PTR)KPCR_BASE + Offset * PAGE_SIZE); - - /* - * Initialize the GDT - */ - KiInitializeGdt((PKPCR)Pcr); - - /* Get processor information. */ - Ki386GetCpuId(); - - /* Check FPU/MMX/SSE support. */ - KiCheckFPU(); - - KeInitDpc(Pcr->Prcb); - InitializeListHead(&Pcr->PrcbData.WaitListHead); - - if (Pcr->PrcbData.FeatureBits & X86_FEATURE_SYSCALL) - { - extern void KiFastCallEntry(void); - - /* CS Selector of the target segment. */ - Ke386Wrmsr(0x174, KGDT_R0_CODE, 0); - /* Target ESP. */ - Ke386Wrmsr(0x175, 0, 0); - /* Target EIP. */ - Ke386Wrmsr(0x176, (ULONG_PTR)KiFastCallEntry, 0); - } - - /* - * It is now safe to process interrupts - */ - KeLowerIrql(DISPATCH_LEVEL); - - /* - * Initialize the TSS - */ - Ki386ApplicationProcessorInitializeTSS(); - - /* - * Initialize a default LDT - */ - Ki386InitializeLdt(); - - /* Now we can enable interrupts. */ - Ke386EnableInterrupts(); } VOID @@ -423,42 +279,8 @@ } p1 = p2; } -#if 0 - /* - * FIXME: - * Make the detection of the noexecute feature more portable. - */ - if(KPCR->PrcbData.CpuType == 0xf && - RtlCompareMemory("AuthenticAMD", KPCR->PrcbData.VendorString, 12) == 12) - { - if (NoExecute) - { - ULONG Flags, l, h; - Ke386SaveFlags(Flags); - Ke386DisableInterrupts(); - - Ke386Rdmsr(0xc0000080, l, h); - l |= (1 << 11); - Ke386Wrmsr(0xc0000080, l, h); - Ke386NoExecute = TRUE; - Ke386RestoreFlags(Flags); - } - } - else - { - NoExecute=FALSE; - } -#endif Ke386Pae = Ke386GetCr4() & X86_CR4_PAE ? TRUE : FALSE; -#if 0 - /* Enable PAE mode */ - if ((Pae && (KPCR->PrcbData.FeatureBits & X86_FEATURE_PAE)) || NoExecute) - { - MiEnablePAE((PVOID*)LastKernelAddress); - Ke386PaeEnabled = TRUE; - } -#endif if (KPCR->PrcbData.FeatureBits & X86_FEATURE_SYSCALL) { extern void KiFastCallEntry(void); Modified: trunk/reactos/ntoskrnl/ke/i386/main_asm.S URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/i386/main_asm.…
============================================================================== --- trunk/reactos/ntoskrnl/ke/i386/main_asm.S (original) +++ trunk/reactos/ntoskrnl/ke/i386/main_asm.S Thu Aug 31 21:10:58 2006 @@ -64,7 +64,7 @@ * Call the application processor initialization code */ pushl $0 - call _KiSystemStartup + call _KiSystemStartup@4 .m1: /* Load the initial kernel stack */ Modified: trunk/reactos/ntoskrnl/ke/i386/tss.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/i386/tss.c?rev…
============================================================================== --- trunk/reactos/ntoskrnl/ke/i386/tss.c (original) +++ trunk/reactos/ntoskrnl/ke/i386/tss.c Thu Aug 31 21:10:58 2006 @@ -39,149 +39,6 @@ extern VOID KiTrap8(VOID); /* FUNCTIONS *****************************************************************/ - -BOOL STDCALL -Ke386IoSetAccessProcess(PEPROCESS Process, BOOL EnableDisable) -{ - KIRQL oldIrql; - USHORT Offset; - - if(EnableDisable > 1) return FALSE; - Offset = (EnableDisable) ? (USHORT) FIELD_OFFSET(KTSS, IoMaps) : 0xffff; - - oldIrql = KeRaiseIrqlToSynchLevel(); - Process->Pcb.IopmOffset = Offset; - - if(PsGetCurrentProcess() == Process) - { - KeGetCurrentKPCR()->TSS->IoMapBase = Offset; - } - - KeLowerIrql(oldIrql); - return TRUE; -} - - -BOOL STDCALL -Ke386SetIoAccessMap(DWORD MapNumber, PULONG IOMapStart) -{ - KIRQL oldIrql; - - if(MapNumber != 1) return FALSE; - - oldIrql = KeRaiseIrqlToSynchLevel(); - - memcpy(&KeGetCurrentKPCR()->TSS->IoMaps[0], - IOMapStart, - 0x2000); - - KeGetCurrentKPCR()->TSS->IoMapBase = KeGetCurrentProcess()->IopmOffset; - KeLowerIrql(oldIrql); - return TRUE; -} - -BOOL STDCALL -Ke386QueryIoAccessMap(DWORD MapNumber, PULONG IOMapStart) -{ - KIRQL oldIrql; - - if(MapNumber == 0x0) - { - memset(IOMapStart, 0xff, 0x2000); - return TRUE; - } else if(MapNumber != 1) return FALSE; - - oldIrql = KeRaiseIrqlToSynchLevel(); - - memcpy(IOMapStart, - &KeGetCurrentKPCR()->TSS->IoMaps[0], - 0x2000); - - KeLowerIrql(oldIrql); - return TRUE; -} - -VOID -Ki386ApplicationProcessorInitializeTSS(VOID) -{ - ULONG cr3_; - PKTSS Tss; - PKTSS TrapTss; - PVOID TrapStack; - ULONG Id; - PUSHORT Gdt; - ULONG base, length; - - Id = KeGetCurrentProcessorNumber(); - Gdt = KeGetCurrentKPCR()->GDT; - - Ke386GetPageTableDirectory(cr3_); - - Tss = ExAllocatePool(NonPagedPool, sizeof(KTSS)); - TrapTss = ExAllocatePool(NonPagedPool, sizeof(KTSSNOIOPM)); - TrapStack = ExAllocatePool(NonPagedPool, KERNEL_STACK_SIZE); - - Ki386TssArray[Id] = Tss; - Ki386TrapTssArray[Id] = (KTSSNOIOPM*)TrapTss; - Ki386TrapStackArray[Id] = TrapStack; - KeGetCurrentKPCR()->TSS = Tss; - - /* Initialize the boot TSS. */ - Tss->Esp0 = (ULONG)Ki386InitialStackArray[Id] + KERNEL_STACK_SIZE; /* FIXME: - sizeof(FX_SAVE_AREA)? */ - Tss->Ss0 = KGDT_R0_DATA; - Tss->IoMapBase = 0xFFFF; /* No i/o bitmap */ - Tss->LDT = 0; - - /* - * Initialize a descriptor for the TSS - */ - base = (ULONG)Tss; - length = sizeof(KTSS) - 1; - - Gdt[(KGDT_TSS / 2) + 0] = (USHORT)(length & 0xFFFF); - Gdt[(KGDT_TSS / 2) + 1] = (USHORT)(base & 0xFFFF); - Gdt[(KGDT_TSS / 2) + 2] = (USHORT)(((base & 0xFF0000) >> 16) | 0x8900); - Gdt[(KGDT_TSS / 2) + 3] = (USHORT)(((length & 0xF0000) >> 16) | - ((base & 0xFF000000) >> 16)); - - /* Initialize the TSS used for handling double faults. */ - TrapTss->Flags = 0; - TrapTss->Esp0 = ((ULONG)TrapStack + KERNEL_STACK_SIZE); /* FIXME: - sizeof(FX_SAVE_AREA)? */ - TrapTss->Ss0 = KGDT_R0_DATA; - TrapTss->Cs = KGDT_R0_CODE; - TrapTss->Eip = (ULONG)KiTrap8; - TrapTss->Ds = KGDT_R0_DATA; - TrapTss->Es = KGDT_R0_DATA; - TrapTss->Fs = KGDT_R0_PCR; - TrapTss->IoMapBase = 0xFFFF; /* No i/o bitmap */ - TrapTss->LDT = 0; - - /* - * Initialize a descriptor for the trap TSS. - */ - base = (ULONG)TrapTss; - length = sizeof(KTSSNOIOPM) - 1; - - Gdt[(KGDT_DF_TSS / 2) + 0] = (USHORT)(length & 0xFFFF); - Gdt[(KGDT_DF_TSS / 2) + 1] = (USHORT)(base & 0xFFFF); - Gdt[(KGDT_DF_TSS / 2) + 2] = (USHORT)(((base & 0xFF0000) >> 16) | 0x8900); - Gdt[(KGDT_DF_TSS / 2) + 3] = (USHORT)(((length & 0xF0000) >> 16) | - ((base & 0xFF000000) >> 16)); - - /* - * Load the task register - */ -#if defined(__GNUC__) - __asm__("ltr %%ax" - : /* no output */ - : "a" (KGDT_TSS)); -#elif defined(_MSC_VER) - __asm mov ax, KGDT_TSS - __asm ltr ax -#else -#error Unknown compiler for inline assembler -#endif -} VOID INIT_FUNCTION Ki386BootInitializeTSS(VOID) Modified: trunk/reactos/ntoskrnl/ke/main.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/main.c?rev=238…
============================================================================== --- trunk/reactos/ntoskrnl/ke/main.c (original) +++ trunk/reactos/ntoskrnl/ke/main.c Thu Aug 31 21:10:58 2006 @@ -66,8 +66,6 @@ extern unsigned int _image_base__; ULONG_PTR KERNEL_BASE = (ULONG_PTR)&_image_base__; -VOID INIT_FUNCTION _main(ULONG MultiBootMagic, PROS_LOADER_PARAMETER_BLOCK _LoaderBlock); - #if defined (ALLOC_PRAGMA) #pragma alloc_text(INIT, _main) #endif @@ -87,55 +85,39 @@ } VOID -#ifdef __GNUC__ -__attribute((noinline)) -#endif +NTAPI KiSystemStartup(BOOLEAN BootProcessor) { DPRINT("KiSystemStartup(%d)\n", BootProcessor); - /* Initialize the Application Processor */ - if (!BootProcessor) KeApplicationProcessorInit(); - /* Initialize the Processor with HAL */ HalInitializeProcessor(KeNumberProcessors, (PLOADER_PARAMETER_BLOCK)&KeLoaderBlock); - /* Load the Kernel if this is the Boot CPU, else inialize the App CPU only */ - if (BootProcessor) { - - /* Initialize the Kernel Executive */ - ExpInitializeExecutive(); - - /* Create the IOPM Save Area */ - Ki386IopmSaveArea = ExAllocatePoolWithTag(NonPagedPool, - PAGE_SIZE * 2, - TAG('K', 'e', ' ', ' ')); - - /* Free Initial Memory */ - MiFreeInitMemory(); + /* Initialize the Kernel Executive */ + ExpInitializeExecutive(); + + /* Create the IOPM Save Area */ + Ki386IopmSaveArea = ExAllocatePoolWithTag(NonPagedPool, + PAGE_SIZE * 2, + TAG('K', 'e', ' ', ' ')); + + /* Free Initial Memory */ + MiFreeInitMemory(); /* Never returns */ #if 0 - /* FIXME: - * The initial thread isn't a real ETHREAD object, we cannot call PspExitThread. - */ - PspExitThread(STATUS_SUCCESS); + /* FIXME: + * The initial thread isn't a real ETHREAD object, we cannot call PspExitThread. + */ + PspExitThread(STATUS_SUCCESS); #else - while (1) { - LARGE_INTEGER Timeout; - Timeout.QuadPart = 0x7fffffffffffffffLL; - KeDelayExecutionThread(KernelMode, FALSE, &Timeout); - } + while (1) + { + LARGE_INTEGER Timeout; + Timeout.QuadPart = 0x7fffffffffffffffLL; + KeDelayExecutionThread(KernelMode, FALSE, &Timeout); + } #endif - } else { - - /* Do application processor initialization */ - KeApplicationProcessorInitDispatcher(); - - /* Lower IRQL and go to Idle Thread */ - KeLowerIrql(PASSIVE_LEVEL); - PsIdleThreadMain(NULL); - } /* Bug Check and loop forever if anything failed */ KEBUGCHECK(0); Modified: trunk/reactos/ntoskrnl/ntoskrnl.def URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ntoskrnl.def?rev=…
============================================================================== --- trunk/reactos/ntoskrnl/ntoskrnl.def (original) +++ trunk/reactos/ntoskrnl/ntoskrnl.def Thu Aug 31 21:10:58 2006 @@ -513,9 +513,6 @@ KdPowerTransition@4 KdpServiceDispatcher@12 Ke386CallBios@8 -Ke386IoSetAccessProcess@8 -Ke386QueryIoAccessMap@8 -Ke386SetIoAccessMap@8 @KeAcquireGuardedMutex@4 @KeAcquireGuardedMutexUnsafe@4 KeAcquireSpinLockAtDpcLevel@4
18 years, 3 months
1
0
0
0
[weiden] 23844: Add stubs for the condition variable functions
by weiden@svn.reactos.org
Author: weiden Date: Thu Aug 31 20:56:49 2006 New Revision: 23844 URL:
http://svn.reactos.org/svn/reactos?rev=23844&view=rev
Log: Add stubs for the condition variable functions Added: trunk/reactos/dll/win32/kernel32/synch/condvar.c (with props) trunk/reactos/lib/rtl/condvar.c (with props) Modified: trunk/reactos/dll/ntdll/def/ntdll.def trunk/reactos/dll/win32/kernel32/kernel32.def trunk/reactos/dll/win32/kernel32/kernel32.rbuild trunk/reactos/include/psdk/winbase.h trunk/reactos/lib/rtl/rtl.rbuild Modified: trunk/reactos/dll/ntdll/def/ntdll.def URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/ntdll/def/ntdll.def?re…
============================================================================== --- trunk/reactos/dll/ntdll/def/ntdll.def (original) +++ trunk/reactos/dll/ntdll/def/ntdll.def Thu Aug 31 20:56:49 2006 @@ -505,6 +505,7 @@ RtlInitUnicodeStringEx@8 ;RtlInitializeAtomPackage RtlInitializeBitMap@12 +RtlInitializeConditionVariable@4 RtlInitializeContext@20 RtlInitializeCriticalSection@4 RtlInitializeCriticalSectionAndSpinCount@8 @@ -650,6 +651,8 @@ ;RtlSetUserFlagsHeap RtlSetUserValueHeap@16 RtlSizeHeap@12 +RtlSleepConditionVariableCS@12 +RtlSleepConditionVariableSRW@16 RtlSplay@4 ;RtlStartRXact RtlStringFromGUID@8 @@ -703,6 +706,8 @@ RtlValidateUnicodeString@8 RtlVerifyVersionInfo@16 ;RtlWalkHeap +RtlWakeAllConditionVariable@4 +RtlWakeConditionVariable@4 RtlWriteRegistryValue@24 ;RtlZeroHeap RtlZeroMemory@8 Modified: trunk/reactos/dll/win32/kernel32/kernel32.def URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/kernel3…
============================================================================== --- trunk/reactos/dll/win32/kernel32/kernel32.def (original) +++ trunk/reactos/dll/win32/kernel32/kernel32.def Thu Aug 31 20:56:49 2006 @@ -586,6 +586,7 @@ HeapValidate@12 HeapWalk@8 InitAtomTable@4 +InitializeConditionVariable(a)4=NTDLL.RtlInitializeConditionVariable InitializeCriticalSection@4 InitializeCriticalSectionAndSpinCount@8 InitializeSListHead(a)4=NTDLL.RtlInitializeSListHead @@ -900,6 +901,8 @@ SignalObjectAndWait@16 SizeofResource@8 Sleep@4 +SleepConditionVariableCS@12 +SleepConditionVariableSRW@16 SleepEx@8 SuspendThread@4 SwitchToFiber@4 @@ -954,6 +957,8 @@ VirtualQuery@12 VirtualQueryEx@16 VirtualUnlock@8 +WakeAllConditionVariable(a)4=NTDLL.RtlWakeAllConditionVariable +WakeConditionVariable(a)4=NTDLL.RtlWakeConditionVariable WaitCommEvent@12 WaitForDebugEvent@8 WaitForMultipleObjects@16 Modified: trunk/reactos/dll/win32/kernel32/kernel32.rbuild URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/kernel3…
============================================================================== --- trunk/reactos/dll/win32/kernel32/kernel32.rbuild (original) +++ trunk/reactos/dll/win32/kernel32/kernel32.rbuild Thu Aug 31 20:56:49 2006 @@ -94,6 +94,7 @@ <file>lstring.c</file> </directory> <directory name="synch"> + <file>condvar.c</file> <file>critical.c</file> <file>event.c</file> <file>mutex.c</file> Added: trunk/reactos/dll/win32/kernel32/synch/condvar.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/synch/c…
============================================================================== --- trunk/reactos/dll/win32/kernel32/synch/condvar.c (added) +++ trunk/reactos/dll/win32/kernel32/synch/condvar.c Thu Aug 31 20:56:49 2006 @@ -1,0 +1,97 @@ +/* COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS system libraries + * PURPOSE: Condition Variable functions + * PROGRAMMER: Thomas Weidenmueller <w3seek(a)reactos.com> + */ + +/* File contains Vista Semantics */ +#undef _WIN32_WINNT +#define _WIN32_WINNT 0x0600 + +#include <k32.h> + +#define NDEBUG +#include "../include/debug.h" + +/* FIXME: Move these RTL declarations to the NDK */ +NTSTATUS +NTAPI +RtlSleepConditionVariableCS(IN OUT PRTL_CONDITION_VARIABLE ConditionVariable, + IN OUT PRTL_CRITICAL_SECTION CriticalSection, + IN PLARGE_INTEGER TimeOut OPTIONAL); + +NTSTATUS +NTAPI +RtlSleepConditionVariableSRW(IN OUT PRTL_CONDITION_VARIABLE ConditionVariable, + IN OUT PRTL_SRWLOCK SRWLock, + IN PLARGE_INTEGER TimeOut OPTIONAL, + IN ULONG Flags); + +/* PUBLIC FUNCTIONS ***********************************************************/ + +/* + * @implemented + */ +BOOL +WINAPI +SleepConditionVariableCS(IN OUT PCONDITION_VARIABLE ConditionVariable, + IN OUT PCRITICAL_SECTION CriticalSection, + IN DWORD dwMilliseconds) +{ + NTSTATUS Status; + LARGE_INTEGER TimeOut; + PLARGE_INTEGER TimeOutPtr = NULL; + + if (dwMilliseconds != INFINITE) + { + TimeOut.QuadPart = UInt32x32To64(-10000, dwMilliseconds); + TimeOutPtr = &TimeOut; + } + + Status = RtlSleepConditionVariableCS((PRTL_CONDITION_VARIABLE)ConditionVariable, + (PRTL_CRITICAL_SECTION)CriticalSection, + TimeOutPtr); + + if (!NT_SUCCESS(Status)) + { + SetLastErrorByStatus(Status); + return FALSE; + } + + return TRUE; +} + + +/* + * @implemented + */ +BOOL +WINAPI +SleepConditionVariableSRW(IN OUT PCONDITION_VARIABLE ConditionVariable, + IN OUT PSRWLOCK SRWLock, + IN DWORD dwMilliseconds, + IN ULONG Flags) +{ + NTSTATUS Status; + LARGE_INTEGER TimeOut; + PLARGE_INTEGER TimeOutPtr = NULL; + + if (dwMilliseconds != INFINITE) + { + TimeOut.QuadPart = UInt32x32To64(-10000, dwMilliseconds); + TimeOutPtr = &TimeOut; + } + + Status = RtlSleepConditionVariableSRW((PRTL_CONDITION_VARIABLE)ConditionVariable, + (PRTL_SRWLOCK)SRWLock, + TimeOutPtr, + Flags); + + if (!NT_SUCCESS(Status)) + { + SetLastErrorByStatus(Status); + return FALSE; + } + + return TRUE; +} Propchange: trunk/reactos/dll/win32/kernel32/synch/condvar.c ------------------------------------------------------------------------------ svn:eol-style = native Modified: trunk/reactos/include/psdk/winbase.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/psdk/winbase.h?rev…
============================================================================== --- trunk/reactos/include/psdk/winbase.h (original) +++ trunk/reactos/include/psdk/winbase.h Thu Aug 31 20:56:49 2006 @@ -1058,6 +1058,7 @@ } JOB_SET_ARRAY, *PJOB_SET_ARRAY; #if (_WIN32_WINNT >= 0x0600) typedef RTL_SRWLOCK SRWLOCK, *PSRWLOCK; +typedef RTL_CONDITION_VARIABLE CONDITION_VARIABLE, *PCONDITION_VARIABLE; #endif typedef DWORD(WINAPI *LPPROGRESS_ROUTINE)(LARGE_INTEGER,LARGE_INTEGER,LARGE_INTEGER,LARGE_INTEGER,DWORD,DWORD,HANDLE,HANDLE,LPVOID); typedef void(WINAPI *LPFIBER_START_ROUTINE)(PVOID); @@ -1662,6 +1663,9 @@ BOOL WINAPI ImpersonateSelf(SECURITY_IMPERSONATION_LEVEL); BOOL WINAPI InitAtomTable(DWORD); BOOL WINAPI InitializeAcl(PACL,DWORD,DWORD); +#if (_WIN32_WINNT >= 0x0600) +VOID WINAPI InitializeConditionVariable(PCONDITION_VARIABLE); +#endif VOID WINAPI InitializeCriticalSection(LPCRITICAL_SECTION); BOOL WINAPI InitializeCriticalSectionAndSpinCount(LPCRITICAL_SECTION,DWORD); DWORD WINAPI SetCriticalSectionSpinCount(LPCRITICAL_SECTION,DWORD); @@ -1978,6 +1982,10 @@ DWORD WINAPI SignalObjectAndWait(HANDLE,HANDLE,DWORD,BOOL); DWORD WINAPI SizeofResource(HINSTANCE,HRSRC); void WINAPI Sleep(DWORD); +#if (_WIN32_WINNT >= 0x0600) +BOOL WINAPI SleepConditionVariableCS(PCONDITION_VARIABLE,PCRITICAL_SECTION,DWORD); +BOOL WINAPI SleepConditionVariableSRW(PCONDITION_VARIABLE,PSRWLOCK,DWORD,ULONG); +#endif DWORD WINAPI SleepEx(DWORD,BOOL); DWORD WINAPI SuspendThread(HANDLE); void WINAPI SwitchToFiber(PVOID); @@ -2024,6 +2032,10 @@ DWORD WINAPI WaitForSingleObjectEx(HANDLE,DWORD,BOOL); BOOL WINAPI WaitNamedPipeA(LPCSTR,DWORD); BOOL WINAPI WaitNamedPipeW(LPCWSTR,DWORD); +#if (_WIN32_WINNT >= 0x0600) +VOID WINAPI WakeConditionVariable(PCONDITION_VARIABLE); +VOID WINAPI WakeAllConditionVariable(PCONDITION_VARIABLE); +#endif BOOL WINAPI WinLoadTrustProvider(GUID*); BOOL WINAPI WriteFile(HANDLE,PCVOID,DWORD,PDWORD,LPOVERLAPPED); BOOL WINAPI WriteFileEx(HANDLE,PCVOID,DWORD,LPOVERLAPPED,LPOVERLAPPED_COMPLETION_ROUTINE); Added: trunk/reactos/lib/rtl/condvar.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/rtl/condvar.c?rev=2384…
============================================================================== --- trunk/reactos/lib/rtl/condvar.c (added) +++ trunk/reactos/lib/rtl/condvar.c Thu Aug 31 20:56:49 2006 @@ -1,0 +1,61 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS system libraries + * PURPOSE: Condition Variable Routines + * PROGRAMMER: Thomas Weidenmueller <w3seek(a)reactos.com> + */ + +/* INCLUDES *****************************************************************/ + +#include <rtl.h> + +#define NDEBUG +#include <debug.h> + +/* FUNCTIONS *****************************************************************/ + +VOID +NTAPI +RtlInitializeConditionVariable(OUT PRTL_CONDITION_VARIABLE ConditionVariable) +{ + ConditionVariable->Ptr = NULL; +} + + +VOID +NTAPI +RtlWakeConditionVariable(IN OUT PRTL_CONDITION_VARIABLE ConditionVariable) +{ + UNIMPLEMENTED; +} + + +VOID +NTAPI +RtlWakeAllConditionVariable(IN OUT PRTL_CONDITION_VARIABLE ConditionVariable) +{ + UNIMPLEMENTED; +} + + +NTSTATUS +NTAPI +RtlSleepConditionVariableCS(IN OUT PRTL_CONDITION_VARIABLE ConditionVariable, + IN OUT PRTL_CRITICAL_SECTION CriticalSection, + IN PLARGE_INTEGER TimeOut OPTIONAL) +{ + UNIMPLEMENTED; + return STATUS_NOT_IMPLEMENTED; +} + + +NTSTATUS +NTAPI +RtlSleepConditionVariableSRW(IN OUT PRTL_CONDITION_VARIABLE ConditionVariable, + IN OUT PRTL_SRWLOCK SRWLock, + IN PLARGE_INTEGER TimeOut OPTIONAL, + IN ULONG Flags) +{ + UNIMPLEMENTED; + return STATUS_NOT_IMPLEMENTED; +} Propchange: trunk/reactos/lib/rtl/condvar.c ------------------------------------------------------------------------------ svn:eol-style = native Modified: trunk/reactos/lib/rtl/rtl.rbuild URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/rtl/rtl.rbuild?rev=238…
============================================================================== --- trunk/reactos/lib/rtl/rtl.rbuild (original) +++ trunk/reactos/lib/rtl/rtl.rbuild Thu Aug 31 20:56:49 2006 @@ -47,6 +47,7 @@ <file>bitmap.c</file> <file>bootdata.c</file> <file>compress.c</file> + <file>condvar.c</file> <file>crc32.c</file> <file>critical.c</file> <file>dbgbuffer.c</file>
18 years, 3 months
1
0
0
0
[fireball] 23843: Change a very ugly done DbgPrint() function to a good implementation. Now Freeldr shows all DPRINTs from e.g. cmlib correctly.
by fireball@svn.reactos.org
Author: fireball Date: Thu Aug 31 20:08:17 2006 New Revision: 23843 URL:
http://svn.reactos.org/svn/reactos?rev=23843&view=rev
Log: Change a very ugly done DbgPrint() function to a good implementation. Now Freeldr shows all DPRINTs from e.g. cmlib correctly. Modified: trunk/reactos/boot/freeldr/freeldr/reactos/reactos.c Modified: trunk/reactos/boot/freeldr/freeldr/reactos/reactos.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/react…
============================================================================== --- trunk/reactos/boot/freeldr/freeldr/reactos/reactos.c (original) +++ trunk/reactos/boot/freeldr/freeldr/reactos/reactos.c Thu Aug 31 20:08:17 2006 @@ -870,10 +870,33 @@ #undef DbgPrint ULONG -DbgPrint(const char *Fmt, ...) -{ - UiMessageBox(Fmt); - return 0; +DbgPrint(const char *Format, ...) +{ + va_list ap; + CHAR Buffer[512]; + ULONG Length; + + va_start(ap, Format); + + /* Construct a string */ + Length = _vsnprintf(Buffer, 512, Format, ap); + + /* Check if we went past the buffer */ + if (Length == -1) + { + /* Terminate it if we went over-board */ + Buffer[sizeof(Buffer) - 1] = '\n'; + + /* Put maximum */ + Length = sizeof(Buffer); + } + + /* Show it as a message box */ + UiMessageBox(Buffer); + + /* Cleanup and exit */ + va_end(ap); + return 0; } /* EOF */
18 years, 3 months
1
0
0
0
[fireball] 23842: Sylvain Petreolle: Partly fix unicode build of cmd (a typo)
by fireball@svn.reactos.org
Author: fireball Date: Thu Aug 31 18:14:42 2006 New Revision: 23842 URL:
http://svn.reactos.org/svn/reactos?rev=23842&view=rev
Log: Sylvain Petreolle: Partly fix unicode build of cmd (a typo) Modified: trunk/reactos/base/shell/cmd/cmdinput.c Modified: trunk/reactos/base/shell/cmd/cmdinput.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/cmd/cmdinput.c?…
============================================================================== --- trunk/reactos/base/shell/cmd/cmdinput.c (original) +++ trunk/reactos/base/shell/cmd/cmdinput.c Thu Aug 31 18:14:42 2006 @@ -521,7 +521,7 @@ } #ifdef _UNICODE ch = ir.Event.KeyEvent.uChar.UnicodeChar; - if ((ch >= 32 && (charcount != (maxlen - 2)) && bCharInput) + if (ch >= 32 && (charcount != (maxlen - 2)) && bCharInput) #else ch = ir.Event.KeyEvent.uChar.AsciiChar; if ((UCHAR)ch >= 32 && (charcount != (maxlen - 2)) && bCharInput)
18 years, 3 months
1
0
0
0
[hpoussin] 23841: Add ATTACH_PARENT_PROCESS constant
by hpoussin@svn.reactos.org
Author: hpoussin Date: Thu Aug 31 18:11:33 2006 New Revision: 23841 URL:
http://svn.reactos.org/svn/reactos?rev=23841&view=rev
Log: Add ATTACH_PARENT_PROCESS constant Modified: trunk/reactos/include/psdk/wincon.h Modified: trunk/reactos/include/psdk/wincon.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/psdk/wincon.h?rev=…
============================================================================== --- trunk/reactos/include/psdk/wincon.h (original) +++ trunk/reactos/include/psdk/wincon.h Thu Aug 31 18:11:33 2006 @@ -160,6 +160,7 @@ BOOL WINAPI AllocConsole(void); #if (_WIN32_WINNT >= 0x0501) +#define ATTACH_PARENT_PROCESS (DWORD)-1 BOOL WINAPI AttachConsole(DWORD); #endif HANDLE WINAPI CreateConsoleScreenBuffer(DWORD,DWORD,CONST SECURITY_ATTRIBUTES*,DWORD,LPVOID);
18 years, 3 months
1
0
0
0
← Newer
1
2
3
4
...
45
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
Results per page:
10
25
50
100
200