mirror of
https://github.com/reactos/reactos.git
synced 2025-01-13 01:22:03 +00:00
[KERNEL32]
- Code committed in revision 846 was lazily initializing command line options with a first call to GetCommandLine. However, this is not really thread-safe. Move initialization to DLL_PROCESS_ATTACH, where it should actually happen. See issue #5347 for more details. svn path=/trunk/; revision=47113
This commit is contained in:
parent
c47421927e
commit
a2464ecca7
3 changed files with 10 additions and 17 deletions
|
@ -190,3 +190,7 @@ IntGetCodePageEntry(UINT CodePage);
|
|||
|
||||
LPWSTR
|
||||
GetDllLoadPath(LPCWSTR lpModule);
|
||||
|
||||
VOID
|
||||
WINAPI
|
||||
InitCommandLines(VOID);
|
||||
|
|
|
@ -330,6 +330,9 @@ DllMain(HANDLE hDll,
|
|||
wcscpy(SystemDirectory.Buffer, WindowsDirectory.Buffer);
|
||||
wcscat(SystemDirectory.Buffer, L"\\System32");
|
||||
|
||||
/* Initialize command line */
|
||||
InitCommandLines();
|
||||
|
||||
/* Open object base directory */
|
||||
Status = OpenBaseDirectory(&hBaseDir);
|
||||
if (!NT_SUCCESS(Status))
|
||||
|
|
|
@ -27,19 +27,17 @@ static BOOL bCommandLineInitialized = FALSE;
|
|||
|
||||
/* FUNCTIONS ****************************************************************/
|
||||
|
||||
static
|
||||
VOID
|
||||
WINAPI
|
||||
InitCommandLines(VOID)
|
||||
{
|
||||
PRTL_USER_PROCESS_PARAMETERS Params;
|
||||
|
||||
/* FIXME - not thread-safe! */
|
||||
|
||||
// get command line
|
||||
/* get command line */
|
||||
Params = NtCurrentPeb()->ProcessParameters;
|
||||
RtlNormalizeProcessParams (Params);
|
||||
|
||||
// initialize command line buffers
|
||||
/* initialize command line buffers */
|
||||
CommandLineStringW.Length = Params->CommandLine.Length;
|
||||
CommandLineStringW.MaximumLength = CommandLineStringW.Length + sizeof(WCHAR);
|
||||
CommandLineStringW.Buffer = RtlAllocateHeap(GetProcessHeap(),
|
||||
|
@ -80,13 +78,7 @@ LPSTR
|
|||
WINAPI
|
||||
GetCommandLineA(VOID)
|
||||
{
|
||||
if (bCommandLineInitialized == FALSE)
|
||||
{
|
||||
InitCommandLines();
|
||||
}
|
||||
|
||||
DPRINT("CommandLine \'%s\'\n", CommandLineStringA.Buffer);
|
||||
|
||||
return CommandLineStringA.Buffer;
|
||||
}
|
||||
|
||||
|
@ -98,13 +90,7 @@ LPWSTR
|
|||
WINAPI
|
||||
GetCommandLineW(VOID)
|
||||
{
|
||||
if (bCommandLineInitialized == FALSE)
|
||||
{
|
||||
InitCommandLines();
|
||||
}
|
||||
|
||||
DPRINT("CommandLine \'%S\'\n", CommandLineStringW.Buffer);
|
||||
|
||||
return CommandLineStringW.Buffer;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue