[WINSRV] Use ARRAYSIZE() instead of hardcoding buffer size in GetProcessImageFileNameW call

This commit is contained in:
Hermès Bélusca-Maïto 2024-02-22 14:03:33 +01:00
parent e5db85276e
commit 2c0af91ba1
No known key found for this signature in database
GPG key ID: 3B2539C65E7B93D0
2 changed files with 2 additions and 4 deletions

View file

@ -49,7 +49,7 @@ NonConsoleProcessShutdown(IN PCSR_PROCESS Process,
/* Terminate this process */
#if DBG
WCHAR buffer[MAX_PATH];
if (!GetProcessImageFileNameW(Process->ProcessHandle, buffer, MAX_PATH))
if (!GetProcessImageFileNameW(Process->ProcessHandle, buffer, ARRAYSIZE(buffer)))
{
DPRINT1("Terminating process %x\n", Process->ClientId.UniqueProcess);
}
@ -58,7 +58,6 @@ NonConsoleProcessShutdown(IN PCSR_PROCESS Process,
DPRINT1("Terminating process %x (%S)\n", Process->ClientId.UniqueProcess, buffer);
}
#endif
NtTerminateProcess(Process->ProcessHandle, 0);
WaitForSingleObject(Process->ProcessHandle, ShutdownSettings.ProcessTerminateTimeout);
}

View file

@ -777,7 +777,7 @@ UserClientShutdown(IN PCSR_PROCESS CsrProcess,
#if DBG
{
WCHAR buffer[MAX_PATH];
if (!GetProcessImageFileNameW(CsrProcess->ProcessHandle, buffer, MAX_PATH))
if (!GetProcessImageFileNameW(CsrProcess->ProcessHandle, buffer, ARRAYSIZE(buffer)))
{
DPRINT1("Terminating process %x\n", CsrProcess->ClientId.UniqueProcess);
}
@ -788,7 +788,6 @@ UserClientShutdown(IN PCSR_PROCESS CsrProcess,
}
#endif
NtTerminateProcess(CsrProcess->ProcessHandle, 0);
WaitForSingleObject(CsrProcess->ProcessHandle, ShutdownSettings.ProcessTerminateTimeout);
/* We are done */