mirror of
https://github.com/reactos/reactos.git
synced 2025-05-19 09:10:56 +00:00
[CSRSRV]
- Use a variable ServerDll instead of using each time CsrLoadedServerDll[i], as it is done in some other places. - Clean the code (remove extra-parentheses). - Zero-out the memory buffer allocated for CsrSrvSharedStaticServerData. svn path=/branches/ros-csrss/; revision=57701
This commit is contained in:
parent
cbc3e80b5a
commit
bc0af6b272
4 changed files with 21 additions and 11 deletions
|
@ -54,7 +54,7 @@ CallHardError(IN PCSR_THREAD ThreadData,
|
||||||
ServerDll = CsrLoadedServerDll[i];
|
ServerDll = CsrLoadedServerDll[i];
|
||||||
|
|
||||||
/* Make sure it's valid and that it has callback */
|
/* Make sure it's valid and that it has callback */
|
||||||
if ((ServerDll) && (ServerDll->HardErrorCallback))
|
if (ServerDll && ServerDll->HardErrorCallback)
|
||||||
{
|
{
|
||||||
ServerDll->HardErrorCallback(ThreadData, HardErrorMessage);
|
ServerDll->HardErrorCallback(ThreadData, HardErrorMessage);
|
||||||
}
|
}
|
||||||
|
|
|
@ -437,7 +437,7 @@ CsrRemoveProcess(IN PCSR_PROCESS CsrProcess)
|
||||||
ServerDll = CsrLoadedServerDll[i];
|
ServerDll = CsrLoadedServerDll[i];
|
||||||
|
|
||||||
/* Check if it's valid and if it has a Disconnect Callback */
|
/* Check if it's valid and if it has a Disconnect Callback */
|
||||||
if ((ServerDll) && (ServerDll->DisconnectCallback))
|
if (ServerDll && ServerDll->DisconnectCallback)
|
||||||
{
|
{
|
||||||
/* Call it */
|
/* Call it */
|
||||||
ServerDll->DisconnectCallback(CsrProcess);
|
ServerDll->DisconnectCallback(CsrProcess);
|
||||||
|
@ -530,6 +530,7 @@ CsrCreateProcess(IN HANDLE hProcess,
|
||||||
PCSR_THREAD CurrentThread = CsrGetClientThread();
|
PCSR_THREAD CurrentThread = CsrGetClientThread();
|
||||||
CLIENT_ID CurrentCid;
|
CLIENT_ID CurrentCid;
|
||||||
PCSR_PROCESS CurrentProcess;
|
PCSR_PROCESS CurrentProcess;
|
||||||
|
PCSR_SERVER_DLL ServerDll;
|
||||||
PVOID ProcessData;
|
PVOID ProcessData;
|
||||||
ULONG i;
|
ULONG i;
|
||||||
PCSR_PROCESS CsrProcess;
|
PCSR_PROCESS CsrProcess;
|
||||||
|
@ -564,8 +565,11 @@ CsrCreateProcess(IN HANDLE hProcess,
|
||||||
ProcessData = &CurrentProcess->ServerData[CSR_SERVER_DLL_MAX];
|
ProcessData = &CurrentProcess->ServerData[CSR_SERVER_DLL_MAX];
|
||||||
for (i = 0; i < CSR_SERVER_DLL_MAX; i++)
|
for (i = 0; i < CSR_SERVER_DLL_MAX; i++)
|
||||||
{
|
{
|
||||||
|
/* Get the current Server */
|
||||||
|
ServerDll = CsrLoadedServerDll[i];
|
||||||
|
|
||||||
/* Check if the DLL is Loaded and has Per Process Data */
|
/* Check if the DLL is Loaded and has Per Process Data */
|
||||||
if ((CsrLoadedServerDll[i]) && (CsrLoadedServerDll[i]->SizeOfProcessData))
|
if (ServerDll && ServerDll->SizeOfProcessData)
|
||||||
{
|
{
|
||||||
/* Set the pointer */
|
/* Set the pointer */
|
||||||
CsrProcess->ServerData[i] = ProcessData;
|
CsrProcess->ServerData[i] = ProcessData;
|
||||||
|
@ -573,11 +577,11 @@ CsrCreateProcess(IN HANDLE hProcess,
|
||||||
/* Copy the Data */
|
/* Copy the Data */
|
||||||
RtlMoveMemory(ProcessData,
|
RtlMoveMemory(ProcessData,
|
||||||
CurrentProcess->ServerData[i],
|
CurrentProcess->ServerData[i],
|
||||||
CsrLoadedServerDll[i]->SizeOfProcessData);
|
ServerDll->SizeOfProcessData);
|
||||||
|
|
||||||
/* Update next data pointer */
|
/* Update next data pointer */
|
||||||
ProcessData = (PVOID)((ULONG_PTR)ProcessData +
|
ProcessData = (PVOID)((ULONG_PTR)ProcessData +
|
||||||
CsrLoadedServerDll[i]->SizeOfProcessData);
|
ServerDll->SizeOfProcessData);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1305,7 +1309,9 @@ CsrShutdownProcesses(IN PLUID CallerLuid,
|
||||||
{
|
{
|
||||||
/* Get the current server */
|
/* Get the current server */
|
||||||
ServerDll = CsrLoadedServerDll[i];
|
ServerDll = CsrLoadedServerDll[i];
|
||||||
if ((ServerDll) && (ServerDll->ShutdownProcessCallback))
|
|
||||||
|
/* Check if it's valid and if it has a Shutdown Process Callback */
|
||||||
|
if (ServerDll && ServerDll->ShutdownProcessCallback)
|
||||||
{
|
{
|
||||||
/* Release the lock, make the callback, and acquire it back */
|
/* Release the lock, make the callback, and acquire it back */
|
||||||
CsrReleaseProcessLock();
|
CsrReleaseProcessLock();
|
||||||
|
|
|
@ -421,7 +421,7 @@ CsrSrvCreateSharedSection(IN PCHAR ParameterValue)
|
||||||
|
|
||||||
/* Now allocate space from the heap for the Shared Data */
|
/* Now allocate space from the heap for the Shared Data */
|
||||||
CsrSrvSharedStaticServerData = RtlAllocateHeap(CsrSrvSharedSectionHeap,
|
CsrSrvSharedStaticServerData = RtlAllocateHeap(CsrSrvSharedSectionHeap,
|
||||||
0,
|
HEAP_ZERO_MEMORY,
|
||||||
CSR_SERVER_DLL_MAX * sizeof(PVOID));
|
CSR_SERVER_DLL_MAX * sizeof(PVOID));
|
||||||
if (!CsrSrvSharedStaticServerData) return STATUS_NO_MEMORY;
|
if (!CsrSrvSharedStaticServerData) return STATUS_NO_MEMORY;
|
||||||
|
|
||||||
|
|
|
@ -215,10 +215,11 @@ CsrSbCreateSession(IN PSB_API_MSG ApiMessage)
|
||||||
PSB_CREATE_SESSION_MSG CreateSession = &ApiMessage->CreateSession;
|
PSB_CREATE_SESSION_MSG CreateSession = &ApiMessage->CreateSession;
|
||||||
HANDLE hProcess, hThread;
|
HANDLE hProcess, hThread;
|
||||||
PCSR_PROCESS CsrProcess;
|
PCSR_PROCESS CsrProcess;
|
||||||
|
PCSR_THREAD CsrThread;
|
||||||
|
PCSR_SERVER_DLL ServerDll;
|
||||||
|
PVOID ProcessData;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
KERNEL_USER_TIMES KernelTimes;
|
KERNEL_USER_TIMES KernelTimes;
|
||||||
PCSR_THREAD CsrThread;
|
|
||||||
PVOID ProcessData;
|
|
||||||
ULONG i;
|
ULONG i;
|
||||||
|
|
||||||
/* Save the Process and Thread Handles */
|
/* Save the Process and Thread Handles */
|
||||||
|
@ -309,15 +310,18 @@ CsrSbCreateSession(IN PSB_API_MSG ApiMessage)
|
||||||
/* Loop every DLL */
|
/* Loop every DLL */
|
||||||
for (i = 0; i < CSR_SERVER_DLL_MAX; i++)
|
for (i = 0; i < CSR_SERVER_DLL_MAX; i++)
|
||||||
{
|
{
|
||||||
|
/* Get the current Server */
|
||||||
|
ServerDll = CsrLoadedServerDll[i];
|
||||||
|
|
||||||
/* Check if the DLL is loaded and has Process Data */
|
/* Check if the DLL is loaded and has Process Data */
|
||||||
if (CsrLoadedServerDll[i] && CsrLoadedServerDll[i]->SizeOfProcessData)
|
if (ServerDll && ServerDll->SizeOfProcessData)
|
||||||
{
|
{
|
||||||
/* Write the pointer to the data */
|
/* Write the pointer to the data */
|
||||||
CsrProcess->ServerData[i] = ProcessData;
|
CsrProcess->ServerData[i] = ProcessData;
|
||||||
|
|
||||||
/* Move to the next data location */
|
/* Move to the next data location */
|
||||||
ProcessData = (PVOID)((ULONG_PTR)ProcessData +
|
ProcessData = (PVOID)((ULONG_PTR)ProcessData +
|
||||||
CsrLoadedServerDll[i]->SizeOfProcessData);
|
ServerDll->SizeOfProcessData);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue