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
November 2011
----- 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
16 participants
274 discussions
Start a n
N
ew thread
[ion] 54284: [KERNEL32]: Rearrange and rename some base functions. [KERNEL32]: Fix some error cases in the helper string functions. [KERNEL32]: Implement BasepIsRealtimeAllowed. [KERNEL32]: Don't n...
by ion@svn.reactos.org
Author: ion Date: Thu Nov 3 00:30:44 2011 New Revision: 54284 URL:
http://svn.reactos.org/svn/reactos?rev=54284&view=rev
Log: [KERNEL32]: Rearrange and rename some base functions. [KERNEL32]: Fix some error cases in the helper string functions. [KERNEL32]: Implement BasepIsRealtimeAllowed. [KERNEL32]: Don't need RPL_MASK when setting up the CONTEXT, this now matches what Windows sets up (and also helps us validate the kernel is doing the right thing). Modified: trunk/reactos/dll/win32/kernel32/client/dllmain.c trunk/reactos/dll/win32/kernel32/client/environ.c trunk/reactos/dll/win32/kernel32/client/fiber.c trunk/reactos/dll/win32/kernel32/client/file/filemap.c trunk/reactos/dll/win32/kernel32/client/loader.c trunk/reactos/dll/win32/kernel32/client/proc.c trunk/reactos/dll/win32/kernel32/client/thread.c trunk/reactos/dll/win32/kernel32/client/utils.c trunk/reactos/dll/win32/kernel32/include/base_x.h trunk/reactos/dll/win32/kernel32/include/kernel32.h Modified: trunk/reactos/dll/win32/kernel32/client/dllmain.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/client/…
============================================================================== --- trunk/reactos/dll/win32/kernel32/client/dllmain.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/kernel32/client/dllmain.c [iso-8859-1] Thu Nov 3 00:30:44 2011 @@ -61,60 +61,6 @@ #define SESSION_DIR L"\\Sessions" /* FUNCTIONS *****************************************************************/ - -NTSTATUS -WINAPI -BaseGetNamedObjectDirectory(VOID) -{ - OBJECT_ATTRIBUTES ObjectAttributes; - NTSTATUS Status; - - InitializeObjectAttributes(&ObjectAttributes, - &BaseStaticServerData->NamedObjectDirectory, - OBJ_CASE_INSENSITIVE, - NULL, - NULL); - - Status = NtOpenDirectoryObject(&BaseNamedObjectDirectory, - DIRECTORY_ALL_ACCESS & - ~(DELETE | WRITE_DAC | WRITE_OWNER), - &ObjectAttributes); - if (!NT_SUCCESS(Status)) return Status; - - DPRINT("Opened BNO: %lx\n", BaseNamedObjectDirectory); - return Status; -} - -/* - * @unimplemented - */ -BOOL -WINAPI -BaseQueryModuleData(IN LPSTR ModuleName, - IN LPSTR Unknown, - IN PVOID Unknown2, - IN PVOID Unknown3, - IN PVOID Unknown4) -{ - DPRINT1("BaseQueryModuleData called: %s %s %x %x %x\n", - ModuleName, - Unknown, - Unknown2, - Unknown3, - Unknown4); - return FALSE; -} - -/* - * @unimplemented - */ -NTSTATUS -WINAPI -BaseProcessInitPostImport(VOID) -{ - /* FIXME: Initialize TS pointers */ - return STATUS_SUCCESS; -} BOOL WINAPI @@ -388,9 +334,6 @@ RtlDeleteCriticalSection (&ConsoleLock); } RtlDeleteCriticalSection (&BaseDllDirectoryLock); - - /* Close object base directory */ - NtClose(hBaseDir); } break; Modified: trunk/reactos/dll/win32/kernel32/client/environ.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/client/…
============================================================================== --- trunk/reactos/dll/win32/kernel32/client/environ.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/kernel32/client/environ.c [iso-8859-1] Thu Nov 3 00:30:44 2011 @@ -68,7 +68,7 @@ Buffer = RtlAllocateHeap(RtlGetProcessHeap(), 0, UniSize * sizeof(WCHAR)); if (!Buffer) { - Status = STATUS_NO_MEMORY;; + Status = STATUS_NO_MEMORY; goto Quickie; } Modified: trunk/reactos/dll/win32/kernel32/client/fiber.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/client/…
============================================================================== --- trunk/reactos/dll/win32/kernel32/client/fiber.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/kernel32/client/fiber.c [iso-8859-1] Thu Nov 3 00:30:44 2011 @@ -237,11 +237,11 @@ Fiber->Context.ContextFlags = (dwFlags & FIBER_FLAG_FLOAT_SWITCH) ? CONTEXT_FLOATING_POINT : 0; /* initialize the context for the fiber */ - BasepInitializeContext(&Fiber->Context, - lpParameter, - lpStartAddress, - InitialTeb.StackBase, - 2); + BaseInitializeContext(&Fiber->Context, + lpParameter, + lpStartAddress, + InitialTeb.StackBase, + 2); /* Return the Fiber */ return Fiber; Modified: trunk/reactos/dll/win32/kernel32/client/file/filemap.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/client/…
============================================================================== --- trunk/reactos/dll/win32/kernel32/client/file/filemap.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/kernel32/client/file/filemap.c [iso-8859-1] Thu Nov 3 00:30:44 2011 @@ -80,7 +80,7 @@ if (lpName) RtlInitUnicodeString(&SectionName, lpName); /* Now convert the object attributes */ - ObjectAttributes = BasepConvertObjectAttributes(&LocalAttributes, + ObjectAttributes = BaseFormatObjectAttributes(&LocalAttributes, lpFileMappingAttributes, lpName ? &SectionName : NULL); @@ -244,6 +244,7 @@ /* * @implemented */ + /* FIXME: Convert to the new macros */ HANDLE NTAPI OpenFileMappingA(DWORD dwDesiredAccess, @@ -286,6 +287,7 @@ /* * @implemented */ + /* FIXME: Convert to the new macros */ HANDLE NTAPI OpenFileMappingW(DWORD dwDesiredAccess, Modified: trunk/reactos/dll/win32/kernel32/client/loader.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/client/…
============================================================================== --- trunk/reactos/dll/win32/kernel32/client/loader.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/kernel32/client/loader.c [iso-8859-1] Thu Nov 3 00:30:44 2011 @@ -1175,4 +1175,35 @@ STUB; } +/* + * @unimplemented + */ +BOOL +WINAPI +BaseQueryModuleData(IN LPSTR ModuleName, + IN LPSTR Unknown, + IN PVOID Unknown2, + IN PVOID Unknown3, + IN PVOID Unknown4) +{ + DPRINT1("BaseQueryModuleData called: %s %s %x %x %x\n", + ModuleName, + Unknown, + Unknown2, + Unknown3, + Unknown4); + return FALSE; +} + +/* + * @unimplemented + */ +NTSTATUS +WINAPI +BaseProcessInitPostImport(VOID) +{ + /* FIXME: Initialize TS pointers */ + return STATUS_SUCCESS; +} + /* EOF */ Modified: trunk/reactos/dll/win32/kernel32/client/proc.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/client/…
============================================================================== --- trunk/reactos/dll/win32/kernel32/client/proc.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/kernel32/client/proc.c [iso-8859-1] Thu Nov 3 00:30:44 2011 @@ -193,14 +193,14 @@ &InitialTeb); /* Create the Thread's Context */ - BasepInitializeContext(&Context, + BaseInitializeContext(&Context, NtCurrentPeb(), SectionImageInfo->TransferAddress, InitialTeb.StackBase, 0); /* Convert the thread attributes */ - ObjectAttributes = BasepConvertObjectAttributes(&LocalObjectAttributes, + ObjectAttributes = BaseFormatObjectAttributes(&LocalObjectAttributes, lpThreadAttributes, NULL); @@ -319,7 +319,7 @@ else if(dwCreationFlags & REALTIME_PRIORITY_CLASS) { /* Check for Privilege First */ - if (BasepCheckRealTimePrivilege()) + if (BasepIsRealtimeAllowed(TRUE)) { ReturnClass = PROCESS_PRIORITY_CLASS_REALTIME; } @@ -2654,7 +2654,7 @@ } /* Initialize the process object attributes */ - ObjectAttributes = BasepConvertObjectAttributes(&LocalObjectAttributes, + ObjectAttributes = BaseFormatObjectAttributes(&LocalObjectAttributes, lpProcessAttributes, NULL); Modified: trunk/reactos/dll/win32/kernel32/client/thread.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/client/…
============================================================================== --- trunk/reactos/dll/win32/kernel32/client/thread.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/kernel32/client/thread.c [iso-8859-1] Thu Nov 3 00:30:44 2011 @@ -149,14 +149,14 @@ } /* Create Initial Context */ - BasepInitializeContext(&Context, + BaseInitializeContext(&Context, lpParameter, lpStartAddress, InitialTeb.StackBase, 1); /* initialize the attributes for the thread object */ - ObjectAttributes = BasepConvertObjectAttributes(&LocalObjectAttributes, + ObjectAttributes = BaseFormatObjectAttributes(&LocalObjectAttributes, lpThreadAttributes, NULL); @@ -171,7 +171,7 @@ TRUE); if(!NT_SUCCESS(Status)) { - BasepFreeStack(hProcess, &InitialTeb); + BaseFreeThreadStack(hProcess, &InitialTeb); BaseSetLastNTError(Status); return NULL; } Modified: trunk/reactos/dll/win32/kernel32/client/utils.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/client/…
============================================================================== --- trunk/reactos/dll/win32/kernel32/client/utils.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/kernel32/client/utils.c [iso-8859-1] Thu Nov 3 00:30:44 2011 @@ -7,7 +7,7 @@ * Pierre Schweitzer (pierre.schweitzer(a)reactos.org) */ -/* INCLUDES ****************************************************************/ +/* INCLUDES ******************************************************************/ #include <k32.h> #ifdef _M_IX86 @@ -19,11 +19,34 @@ #define NDEBUG #include <debug.h> -/* GLOBALS ******************************************************************/ +/* GLOBALS ********************************************************************/ PRTL_CONVERT_STRING Basep8BitStringToUnicodeString; -/* FUNCTIONS ****************************************************************/ +/* FUNCTIONS ******************************************************************/ + +NTSTATUS +WINAPI +BaseGetNamedObjectDirectory(VOID) +{ + OBJECT_ATTRIBUTES ObjectAttributes; + NTSTATUS Status; + + InitializeObjectAttributes(&ObjectAttributes, + &BaseStaticServerData->NamedObjectDirectory, + OBJ_CASE_INSENSITIVE, + NULL, + NULL); + + Status = NtOpenDirectoryObject(&BaseNamedObjectDirectory, + DIRECTORY_ALL_ACCESS & + ~(DELETE | WRITE_DAC | WRITE_OWNER), + &ObjectAttributes); + if (!NT_SUCCESS(Status)) return Status; + + DPRINT("Opened BNO: %lx\n", BaseNamedObjectDirectory); + return Status; +} VOID NTAPI @@ -66,21 +89,29 @@ NTSTATUS Status; /* Initialize an ANSI String */ - if (!NT_SUCCESS(RtlInitAnsiStringEx(&AnsiString, String))) + Status = RtlInitAnsiStringEx(&AnsiString, String); + if (!NT_SUCCESS(Status)) + { + Status = STATUS_BUFFER_OVERFLOW; + } + else + { + /* Convert it */ + Status = Basep8BitStringToUnicodeString(StaticString, &AnsiString, FALSE); + } + + if (NT_SUCCESS(Status)) return StaticString; + + if (Status == STATUS_BUFFER_OVERFLOW) { SetLastError(ERROR_FILENAME_EXCED_RANGE); - return NULL; - } - - /* Convert it */ - Status = Basep8BitStringToUnicodeString(StaticString, &AnsiString, FALSE); - if (!NT_SUCCESS(Status)) + } + else { BaseSetLastNTError(Status); - return NULL; - } - - return StaticString; + } + + return NULL; } /* @@ -93,33 +124,37 @@ { ANSI_STRING AnsiString; NTSTATUS Status; - - DPRINT("Basep8BitStringToDynamicUnicodeString\n"); /* Initialize an ANSI String */ - if (!NT_SUCCESS(RtlInitAnsiStringEx(&AnsiString, String))) - { - SetLastError(ERROR_BUFFER_OVERFLOW); - return FALSE; - } - - /* Convert it */ - Status = Basep8BitStringToUnicodeString(UnicodeString, &AnsiString, TRUE); - - /* Handle failure */ + Status = RtlInitAnsiStringEx(&AnsiString, String); if (!NT_SUCCESS(Status)) { + Status = STATUS_BUFFER_OVERFLOW; + } + else + { + /* Convert it */ + Status = Basep8BitStringToUnicodeString(UnicodeString, &AnsiString, FALSE); + } + + if (NT_SUCCESS(Status)) return TRUE; + + if (Status == STATUS_BUFFER_OVERFLOW) + { + SetLastError(ERROR_FILENAME_EXCED_RANGE); + } + else + { BaseSetLastNTError(Status); - return FALSE; - } - - /* Return Status */ - return TRUE; + } + + return FALSE; } /* * Allocates space from the Heap and converts an Ansi String into it */ + /*NOTE: API IS A HACK */ VOID WINAPI BasepAnsiStringToHeapUnicodeString(IN LPCSTR AnsiString, @@ -127,12 +162,12 @@ { ANSI_STRING AnsiTemp; UNICODE_STRING UnicodeTemp; - + DPRINT("BasepAnsiStringToHeapUnicodeString\n"); - + /* First create the ANSI_STRING */ RtlInitAnsiString(&AnsiTemp, AnsiString); - + if (NT_SUCCESS(RtlAnsiStringToUnicodeString(&UnicodeTemp, &AnsiTemp, TRUE))) @@ -163,49 +198,48 @@ */ POBJECT_ATTRIBUTES WINAPI -BasepConvertObjectAttributes(OUT POBJECT_ATTRIBUTES ObjectAttributes, - IN PSECURITY_ATTRIBUTES SecurityAttributes OPTIONAL, - IN PUNICODE_STRING ObjectName) -{ - ULONG Attributes = 0; - HANDLE RootDirectory = 0; - PVOID SecurityDescriptor = NULL; - BOOLEAN NeedOba = FALSE; - - DPRINT("BasepConvertObjectAttributes. Security: %p, Name: %p\n", +BaseFormatObjectAttributes(OUT POBJECT_ATTRIBUTES ObjectAttributes, + IN PSECURITY_ATTRIBUTES SecurityAttributes OPTIONAL, + IN PUNICODE_STRING ObjectName) +{ + ULONG Attributes; + HANDLE RootDirectory; + PVOID SecurityDescriptor; + DPRINT("BaseFormatObjectAttributes. Security: %p, Name: %p\n", SecurityAttributes, ObjectName); - + /* Get the attributes if present */ if (SecurityAttributes) { Attributes = SecurityAttributes->bInheritHandle ? OBJ_INHERIT : 0; SecurityDescriptor = SecurityAttributes->lpSecurityDescriptor; - NeedOba = TRUE; - } - + } + else + { + if (!ObjectName) return NULL; + Attributes = 0; + SecurityDescriptor = NULL; + } + if (ObjectName) { Attributes |= OBJ_OPENIF; RootDirectory = hBaseDir; - NeedOba = TRUE; - } - + } + else + { + RootDirectory = NULL; + } + + /* Create the Object Attributes */ + InitializeObjectAttributes(ObjectAttributes, + ObjectName, + Attributes, + RootDirectory, + SecurityDescriptor); DPRINT("Attributes: %lx, RootDirectory: %lx, SecurityDescriptor: %p\n", Attributes, RootDirectory, SecurityDescriptor); - - /* Create the Object Attributes */ - if (NeedOba) - { - InitializeObjectAttributes(ObjectAttributes, - ObjectName, - Attributes, - RootDirectory, - SecurityDescriptor); - return ObjectAttributes; - } - - /* Nothing to return */ - return NULL; + return ObjectAttributes; } /* @@ -223,10 +257,10 @@ PIMAGE_NT_HEADERS Headers; ULONG_PTR Stack = 0; BOOLEAN UseGuard = FALSE; - + DPRINT("BasepCreateStack (hProcess: %lx, Max: %lx, Current: %lx)\n", hProcess, StackReserve, StackCommit); - + /* Get some memory information */ Status = NtQuerySystemInformation(SystemBasicInformation, &SystemBasicInfo, @@ -237,17 +271,17 @@ DPRINT1("Failure to query system info\n"); return Status; } - + /* Use the Image Settings if we are dealing with the current Process */ if (hProcess == NtCurrentProcess()) { /* Get the Image Headers */ Headers = RtlImageNtHeader(NtCurrentPeb()->ImageBaseAddress); - + /* If we didn't get the parameters, find them ourselves */ - StackReserve = (StackReserve) ? + StackReserve = (StackReserve) ? StackReserve : Headers->OptionalHeader.SizeOfStackReserve; - StackCommit = (StackCommit) ? + StackCommit = (StackCommit) ? StackCommit : Headers->OptionalHeader.SizeOfStackCommit; } else @@ -257,7 +291,7 @@ SystemBasicInfo.AllocationGranularity; StackCommit = (StackCommit) ? StackCommit : SystemBasicInfo.PageSize; } - + /* Align everything to Page Size */ StackReserve = ROUND_UP(StackReserve, SystemBasicInfo.AllocationGranularity); StackCommit = ROUND_UP(StackCommit, SystemBasicInfo.PageSize); @@ -265,7 +299,7 @@ StackCommit = StackReserve; #endif DPRINT("StackReserve: %lx, StackCommit: %lx\n", StackReserve, StackCommit); - + /* Reserve memory for the stack */ Status = ZwAllocateVirtualMemory(hProcess, (PVOID*)&Stack, @@ -278,16 +312,16 @@ DPRINT1("Failure to reserve stack\n"); return Status; } - + /* Now set up some basic Initial TEB Parameters */ InitialTeb->AllocatedStackBase = (PVOID)Stack; InitialTeb->StackBase = (PVOID)(Stack + StackReserve); InitialTeb->PreviousStackBase = NULL; InitialTeb->PreviousStackLimit = NULL; - + /* Update the Stack Position */ Stack += StackReserve - StackCommit; - + /* Check if we will need a guard page */ if (StackReserve > StackCommit) { @@ -295,7 +329,7 @@ StackCommit += SystemBasicInfo.PageSize; UseGuard = TRUE; } - + /* Allocate memory for the stack */ Status = ZwAllocateVirtualMemory(hProcess, (PVOID*)&Stack, @@ -308,17 +342,17 @@ DPRINT1("Failure to allocate stack\n"); return Status; } - + /* Now set the current Stack Limit */ InitialTeb->StackLimit = (PVOID)Stack; - + /* Create a guard page */ if (UseGuard) { SIZE_T GuardPageSize = SystemBasicInfo.PageSize; ULONG Dummy; - - /* Attempt maximum space possible */ + + /* Attempt maximum space possible */ Status = ZwProtectVirtualMemory(hProcess, (PVOID*)&Stack, &GuardPageSize, @@ -329,35 +363,35 @@ DPRINT1("Failure to create guard page\n"); return Status; } - + /* Update the Stack Limit keeping in mind the Guard Page */ InitialTeb->StackLimit = (PVOID)((ULONG_PTR)InitialTeb->StackLimit - GuardPageSize); } - + /* We are done! */ return STATUS_SUCCESS; } VOID WINAPI -BasepFreeStack(HANDLE hProcess, - PINITIAL_TEB InitialTeb) +BaseFreeThreadStack(IN HANDLE hProcess, + IN PINITIAL_TEB InitialTeb) { SIZE_T Dummy = 0; - + /* Free the Stack */ NtFreeVirtualMemory(hProcess, &InitialTeb->AllocatedStackBase, &Dummy, MEM_RELEASE); } - + /* * Creates the Initial Context for a Thread or Fiber */ VOID WINAPI -BasepInitializeContext(IN PCONTEXT Context, +BaseInitializeContext(IN PCONTEXT Context, IN PVOID Parameter, IN PVOID StartAddress, IN PVOID StackAddress, @@ -365,7 +399,7 @@ { #ifdef _M_IX86 ULONG ContextFlags; - DPRINT("BasepInitializeContext: %p\n", Context); + DPRINT("BaseInitializeContext: %p\n", Context); /* Setup the Initial Win32 Thread Context */ Context->Eax = (ULONG)StartAddress; @@ -374,11 +408,11 @@ /* The other registers are undefined */ /* Setup the Segments */ - Context->SegFs = KGDT_R3_TEB | RPL_MASK; - Context->SegEs = KGDT_R3_DATA | RPL_MASK; - Context->SegDs = KGDT_R3_DATA | RPL_MASK; - Context->SegCs = KGDT_R3_CODE | RPL_MASK; - Context->SegSs = KGDT_R3_DATA | RPL_MASK; + Context->SegFs = KGDT_R3_TEB; + Context->SegEs = KGDT_R3_DATA; + Context->SegDs = KGDT_R3_DATA; + Context->SegCs = KGDT_R3_CODE; + Context->SegSs = KGDT_R3_DATA; Context->SegGs = 0; /* Set the Context Flags */ @@ -426,7 +460,7 @@ } #elif defined(_M_AMD64) - DPRINT("BasepInitializeContext: %p\n", Context); + DPRINT("BaseInitializeContext: %p\n", Context); /* Setup the Initial Win32 Thread Context */ Context->Rax = (ULONG_PTR)StartAddress; @@ -473,11 +507,24 @@ /* * Checks if the privilege for Real-Time Priority is there */ -BOOLEAN -WINAPI -BasepCheckRealTimePrivilege(VOID) -{ - return TRUE; +PVOID +WINAPI +BasepIsRealtimeAllowed(IN BOOLEAN Keep) +{ + ULONG Privilege = SE_INC_BASE_PRIORITY_PRIVILEGE; + PVOID State; + NTSTATUS Status; + + Status = RtlAcquirePrivilege(&Privilege, TRUE, FALSE, &State); + if (!NT_SUCCESS(Status)) return NULL; + + if (Keep) + { + RtlReleasePrivilege(State); + State = (PVOID)TRUE; + } + + return State; } /* @@ -494,9 +541,9 @@ NTSTATUS Status; HANDLE hFile = NULL; IO_STATUS_BLOCK IoStatusBlock; - + DPRINT("BasepMapFile\n"); - + /* Zero out the Relative Directory */ RelativeName.ContainingDirectory = NULL; @@ -511,7 +558,7 @@ DPRINT("ApplicationName %wZ\n", ApplicationName); DPRINT("RelativeName %wZ\n", &RelativeName.RelativeName); - + /* Did we get a relative name? */ if (RelativeName.RelativeName.Length) { @@ -538,7 +585,7 @@ BaseSetLastNTError(Status); return Status; } - + /* Create a section for this file */ Status = NtCreateSection(hSection, SECTION_ALL_ACCESS, @@ -548,7 +595,7 @@ SEC_IMAGE, hFile); NtClose(hFile); - + /* Return status */ DPRINT("Section: %lx for file: %lx\n", *hSection, hFile); return Status; Modified: trunk/reactos/dll/win32/kernel32/include/base_x.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/include…
============================================================================== --- trunk/reactos/dll/win32/kernel32/include/base_x.h [iso-8859-1] (original) +++ trunk/reactos/dll/win32/kernel32/include/base_x.h [iso-8859-1] Thu Nov 3 00:30:44 2011 @@ -88,7 +88,7 @@ // wraps the usual code path required to create an NT object based on a Unicode // (Wide) Win32 object creation API. // -// It makes use of BasepConvertObjectAttributes and allows for a custom access +// It makes use of BaseFormatObjectAttributes and allows for a custom access // mode to be used, and also sets the correct error codes in case of a collision // #define CreateNtObjectFromWin32ApiPrologue \ @@ -100,7 +100,7 @@ POBJECT_ATTRIBUTES ObjectAttributes = &LocalAttributes; #define CreateNtObjectFromWin32ApiBody(ntobj, sec, name, access, ...) \ if (name) RtlInitUnicodeString(&ObjectName, name); \ - ObjectAttributes = BasepConvertObjectAttributes(&LocalAttributes, \ + ObjectAttributes = BaseFormatObjectAttributes(&LocalAttributes, \ sec, \ name ? &ObjectName : NULL); \ Status = NtCreate##ntobj(&Handle, access, ObjectAttributes, ##__VA_ARGS__); Modified: trunk/reactos/dll/win32/kernel32/include/kernel32.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/include…
============================================================================== --- trunk/reactos/dll/win32/kernel32/include/kernel32.h [iso-8859-1] (original) +++ trunk/reactos/dll/win32/kernel32/include/kernel32.h [iso-8859-1] Thu Nov 3 00:30:44 2011 @@ -167,7 +167,7 @@ POBJECT_ATTRIBUTES WINAPI -BasepConvertObjectAttributes(OUT POBJECT_ATTRIBUTES ObjectAttributes, +BaseFormatObjectAttributes(OUT POBJECT_ATTRIBUTES ObjectAttributes, IN PSECURITY_ATTRIBUTES SecurityAttributes OPTIONAL, IN PUNICODE_STRING ObjectName); @@ -180,7 +180,7 @@ VOID WINAPI -BasepInitializeContext(IN PCONTEXT Context, +BaseInitializeContext(IN PCONTEXT Context, IN PVOID Parameter, IN PVOID StartAddress, IN PVOID StackAddress, @@ -202,8 +202,8 @@ VOID WINAPI -BasepFreeStack(HANDLE hProcess, - PINITIAL_TEB InitialTeb); +BaseFreeThreadStack(IN HANDLE hProcess, + IN PINITIAL_TEB InitialTeb); __declspec(noreturn) VOID @@ -216,9 +216,9 @@ WINAPI BaseProcessStartup(PPROCESS_START_ROUTINE lpStartAddress); -BOOLEAN -WINAPI -BasepCheckRealTimePrivilege(VOID); +PVOID +WINAPI +BasepIsRealtimeAllowed(IN BOOLEAN Keep); VOID WINAPI @@ -241,6 +241,11 @@ IN BOOLEAN AllocateMemory); extern PRTL_CONVERT_STRING Basep8BitStringToUnicodeString; +extern HANDLE BaseNamedObjectDirectory; + +NTSTATUS +WINAPI +BaseGetNamedObjectDirectory(VOID); NTSTATUS WINAPI
13 years, 1 month
1
0
0
0
[jgardou] 54283: [KERNEL32] - Small performance improvement : Directly reference dll when getting its handle instead of just checking it's there and then load it
by jgardou@svn.reactos.org
Author: jgardou Date: Wed Nov 2 23:37:38 2011 New Revision: 54283 URL:
http://svn.reactos.org/svn/reactos?rev=54283&view=rev
Log: [KERNEL32] - Small performance improvement : Directly reference dll when getting its handle instead of just checking it's there and then load it Modified: trunk/reactos/dll/ntdll/def/ntdll.pspec trunk/reactos/dll/ntdll/def/ntdll.spec trunk/reactos/dll/win32/kernel32/client/loader.c trunk/reactos/include/ndk/umfuncs.h trunk/reactos/include/psdk/winternl.h Modified: trunk/reactos/dll/ntdll/def/ntdll.pspec URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/ntdll/def/ntdll.pspec?…
============================================================================== --- trunk/reactos/dll/ntdll/def/ntdll.pspec [iso-8859-1] (original) +++ trunk/reactos/dll/ntdll/def/ntdll.pspec [iso-8859-1] Wed Nov 2 23:37:38 2011 @@ -85,7 +85,7 @@ @ stdcall LdrFindResource_U(long ptr long ptr) //@ stdcall LdrFlushAlternateResourceModules @ stdcall LdrGetDllHandle(wstr long ptr ptr) -//@ stdcall LdrGetDllHandleEx +@ stdcall LdrGetDllHandleEx(long wstr long ptr ptr) @ stdcall LdrGetProcedureAddress(ptr ptr long ptr) //@ stdcall LdrHotPatchRoutine //@ stdcall LdrInitShimEngineDynamic Modified: trunk/reactos/dll/ntdll/def/ntdll.spec URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/ntdll/def/ntdll.spec?r…
============================================================================== --- trunk/reactos/dll/ntdll/def/ntdll.spec [iso-8859-1] (original) +++ trunk/reactos/dll/ntdll/def/ntdll.spec [iso-8859-1] Wed Nov 2 23:37:38 2011 @@ -83,7 +83,7 @@ @ stdcall LdrFindResource_U(long ptr long ptr) ;@ stdcall LdrFlushAlternateResourceModules @ stdcall LdrGetDllHandle(wstr long ptr ptr) -;@ stdcall LdrGetDllHandleEx +@ stdcall LdrGetDllHandleEx(long wstr long ptr ptr) @ stdcall LdrGetProcedureAddress(ptr ptr long ptr) ;@ stdcall LdrHotPatchRoutine ;@ stdcall LdrInitShimEngineDynamic Modified: trunk/reactos/dll/win32/kernel32/client/loader.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/client/…
============================================================================== --- trunk/reactos/dll/win32/kernel32/client/loader.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/kernel32/client/loader.c [iso-8859-1] Wed Nov 2 23:37:38 2011 @@ -413,13 +413,13 @@ if (dwFlags & LOAD_LIBRARY_AS_DATAFILE) { /* If the image is loaded as a datafile, try to get its handle */ - Status = LdrGetDllHandle(SearchPath, NULL, &DllName, (PVOID*)&hInst); + Status = LdrGetDllHandleEx(0, SearchPath, NULL, &DllName, (PVOID*)&hInst); if (!NT_SUCCESS(Status)) { /* It's not loaded yet - so load it up */ Status = BasepLoadLibraryAsDatafile(SearchPath, DllName.Buffer, &hInst); - _SEH2_YIELD(goto done;) } + _SEH2_YIELD(goto done;) } /* Call the API Properly */ Modified: trunk/reactos/include/ndk/umfuncs.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/ndk/umfuncs.h?rev=…
============================================================================== --- trunk/reactos/include/ndk/umfuncs.h [iso-8859-1] (original) +++ trunk/reactos/include/ndk/umfuncs.h [iso-8859-1] Wed Nov 2 23:37:38 2011 @@ -215,6 +215,14 @@ IN PUNICODE_STRING DllName, OUT PVOID *DllHandle ); + +NTSTATUS +NTAPI +LdrGetDllHandleEx(IN ULONG Flags, + IN PWSTR DllPath OPTIONAL, + IN PULONG DllCharacteristics OPTIONAL, + IN PUNICODE_STRING DllName, + OUT PVOID *DllHandle OPTIONAL); NTSTATUS NTAPI Modified: trunk/reactos/include/psdk/winternl.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/psdk/winternl.h?re…
============================================================================== --- trunk/reactos/include/psdk/winternl.h [iso-8859-1] (original) +++ trunk/reactos/include/psdk/winternl.h [iso-8859-1] Wed Nov 2 23:37:38 2011 @@ -1813,6 +1813,7 @@ NTSTATUS WINAPI LdrFindResourceDirectory_U(HMODULE,const LDR_RESOURCE_INFO*,ULONG,const IMAGE_RESOURCE_DIRECTORY**); NTSTATUS WINAPI LdrFindResource_U(HMODULE,const LDR_RESOURCE_INFO*,ULONG,const IMAGE_RESOURCE_DATA_ENTRY**); NTSTATUS WINAPI LdrGetDllHandle(ULONG, ULONG, const UNICODE_STRING*, HMODULE*); +NTSTATUS WINAPI LdrGetDllHandleEx(ULONG,PWSTR,PULONG,PUNICODE_STRING,PVOID); NTSTATUS WINAPI LdrGetProcedureAddress(HMODULE, const ANSI_STRING*, ULONG, void**); void WINAPI LdrInitializeThunk(HANDLE,ULONG,ULONG,ULONG); NTSTATUS WINAPI LdrLoadDll(LPCWSTR, DWORD, const UNICODE_STRING*, HMODULE*);
13 years, 1 month
1
0
0
0
[khornicek] 54282: [KERNEL32] Fix GetEnvironmentStringsA/W. See issue #6633 for more details.
by khornicek@svn.reactos.org
Author: khornicek Date: Wed Nov 2 20:10:02 2011 New Revision: 54282 URL:
http://svn.reactos.org/svn/reactos?rev=54282&view=rev
Log: [KERNEL32] Fix GetEnvironmentStringsA/W. See issue #6633 for more details. Modified: trunk/reactos/dll/win32/kernel32/client/environ.c Modified: trunk/reactos/dll/win32/kernel32/client/environ.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/client/…
============================================================================== --- trunk/reactos/dll/win32/kernel32/client/environ.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/kernel32/client/environ.c [iso-8859-1] Wed Nov 2 20:10:02 2011 @@ -294,18 +294,18 @@ do { - p += wcslen(Environment) + 1; + p += wcslen(p) + 1; } while (*p); - Length = p - Environment + sizeof(UNICODE_NULL); - - Status = RtlUnicodeToMultiByteSize(&Size, Environment, Length); + Length = p - Environment + 1; + + Status = RtlUnicodeToMultiByteSize(&Size, Environment, Length * sizeof(WCHAR)); if (NT_SUCCESS(Status)) { Buffer = RtlAllocateHeap(RtlGetProcessHeap(), 0, Size); if (Buffer) { - Status = RtlUnicodeToOemN(Buffer, Size, 0, Environment, Length); + Status = RtlUnicodeToOemN(Buffer, Size, 0, Environment, Length * sizeof(WCHAR)); if (!NT_SUCCESS(Status)) { RtlFreeHeap(RtlGetProcessHeap(), 0, Buffer); @@ -344,15 +344,15 @@ do { - p += wcslen(Environment) + 1; + p += wcslen(p) + 1; } while (*p); - Length = p - Environment + sizeof(UNICODE_NULL); - - p = RtlAllocateHeap(RtlGetProcessHeap(), 0, Length); + Length = p - Environment + 1; + + p = RtlAllocateHeap(RtlGetProcessHeap(), 0, Length * sizeof(WCHAR)); if (p) { - RtlCopyMemory(p, Environment, Length); + RtlCopyMemory(p, Environment, Length * sizeof(WCHAR)); } else {
13 years, 1 month
1
0
0
0
[ekohl] 54281: [SYSDM] Handle the user wait interval.
by ekohl@svn.reactos.org
Author: ekohl Date: Tue Nov 1 17:47:18 2011 New Revision: 54281 URL:
http://svn.reactos.org/svn/reactos?rev=54281&view=rev
Log: [SYSDM] Handle the user wait interval. Modified: trunk/reactos/dll/cpl/sysdm/hardprof.c Modified: trunk/reactos/dll/cpl/sysdm/hardprof.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/sysdm/hardprof.c?r…
============================================================================== --- trunk/reactos/dll/cpl/sysdm/hardprof.c [iso-8859-1] (original) +++ trunk/reactos/dll/cpl/sysdm/hardprof.c [iso-8859-1] Tue Nov 1 17:47:18 2011 @@ -35,6 +35,109 @@ } +static +DWORD +GetUserWaitInterval(VOID) +{ + DWORD dwWaitInterval = 30; + DWORD dwSize; + HKEY hKey; + + if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, + L"System\\CurrentControlSet\\Control\\IDConfigDB", + 0, + KEY_QUERY_VALUE, + &hKey)) + return dwWaitInterval; + + dwSize = sizeof(DWORD); + RegQueryValueExW(hKey, + L"UserWaitInterval", + NULL, + NULL, + (LPBYTE)&dwWaitInterval, + &dwSize); + + RegCloseKey(hKey); + + return dwWaitInterval; +} + + +static +VOID +SetUserWaitInterval(DWORD dwWaitInterval) +{ + HKEY hKey; + + if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, + L"System\\CurrentControlSet\\Control\\IDConfigDB", + 0, + KEY_SET_VALUE, + &hKey)) + return; + + RegSetValueExW(hKey, + L"UserWaitInterval", + 0, + REG_DWORD, + (LPBYTE)&dwWaitInterval, + sizeof(DWORD)); + + RegCloseKey(hKey); +} + + +static +VOID +OnInitDialog(HWND hwndDlg) +{ + DWORD dwWaitInterval; + + SendMessage(GetDlgItem(hwndDlg, IDC_HRDPROFUP), + BM_SETIMAGE,(WPARAM)IMAGE_ICON, + (LPARAM)(HANDLE)LoadIcon(hApplet, MAKEINTRESOURCE(IDI_UP))); + SendMessage(GetDlgItem(hwndDlg, IDC_HRDPROFDWN), + BM_SETIMAGE,(WPARAM)IMAGE_ICON, + (LPARAM)(HANDLE)LoadIcon(hApplet, MAKEINTRESOURCE(IDI_DOWN))); + + + SendDlgItemMessageW(hwndDlg, IDC_HRDPROFUPDWN, UDM_SETRANGE, (WPARAM)0, (LPARAM)MAKELONG((SHORT)500, 0)); + + dwWaitInterval = GetUserWaitInterval(); + if (dwWaitInterval == (DWORD)-1) + { + CheckDlgButton(hwndDlg, IDC_HRDPROFWAIT, BST_CHECKED); + SendDlgItemMessageW(hwndDlg, IDC_HRDPROFUPDWN, UDM_SETPOS, 0, 30); + EnableWindow(GetDlgItem(hwndDlg, IDC_HRDPROFEDIT), FALSE); + } + else + { + CheckDlgButton(hwndDlg, IDC_HRDPROFSELECT, BST_CHECKED); + SendDlgItemMessageW(hwndDlg, IDC_HRDPROFUPDWN, UDM_SETPOS, 0, dwWaitInterval); + } +} + + +static +VOID +OnOk(HWND hwndDlg) +{ + DWORD dwWaitInterval; + + if (IsDlgButtonChecked(hwndDlg, IDC_HRDPROFWAIT) == BST_CHECKED) + { + dwWaitInterval = (DWORD)-1; + } + else + { + dwWaitInterval = LOWORD(SendDlgItemMessageW(hwndDlg, IDC_HRDPROFUPDWN, UDM_GETPOS, 0, 0)); + } + + SetUserWaitInterval(dwWaitInterval); +} + + /* Property page dialog callback */ INT_PTR CALLBACK HardProfDlgProc(HWND hwndDlg, @@ -49,18 +152,8 @@ switch (uMsg) { case WM_INITDIALOG: - { - SendMessage(GetDlgItem(hwndDlg, IDC_HRDPROFUP), - BM_SETIMAGE,(WPARAM)IMAGE_ICON, - (LPARAM)(HANDLE)LoadIcon(hApplet, MAKEINTRESOURCE(IDI_UP))); - SendMessage(GetDlgItem(hwndDlg, IDC_HRDPROFDWN), - BM_SETIMAGE,(WPARAM)IMAGE_ICON, - (LPARAM)(HANDLE)LoadIcon(hApplet, MAKEINTRESOURCE(IDI_DOWN))); - - SendDlgItemMessageW(hwndDlg, IDC_HRDPROFUPDWN, UDM_SETRANGE, (WPARAM) 0, (LPARAM) MAKELONG((short) 500, 0)); - //SendDlgItemMessageW(hwndDlg, IDC_HRDPROFUPDWN, UDM_SETPOS, (WPARAM) 0, (LPARAM) MAKELONG((short) 30, 0)); - } - break; + OnInitDialog(hwndDlg); + break; case WM_COMMAND: switch (LOWORD(wParam)) @@ -72,7 +165,17 @@ (DLGPROC)RenameProfDlgProc); break; + case IDC_HRDPROFWAIT: + EnableWindow(GetDlgItem(hwndDlg, IDC_HRDPROFEDIT), FALSE); + return TRUE; + + case IDC_HRDPROFSELECT: + EnableWindow(GetDlgItem(hwndDlg, IDC_HRDPROFEDIT), TRUE); + return TRUE; + case IDOK: + OnOk(hwndDlg); + case IDCANCEL: EndDialog(hwndDlg, LOWORD(wParam));
13 years, 1 month
1
0
0
0
← Newer
1
...
25
26
27
28
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
Results per page:
10
25
50
100
200