#ifndef _CSRSERVER_H
#define _CSRSERVER_H
+#ifdef _MSC_VER
+#pragma warning(push)
+#pragma warning (disable:4201)
+#endif
+
/* DEPENDENCIES **************************************************************/
/* TYPES **********************************************************************/
ULONG Reserved;
ULONG ShutdownLevel;
ULONG ShutdownFlags;
- PVOID ServerData[];
+ PVOID ServerData[ANYSIZE_ARRAY];
} CSR_PROCESS, *PCSR_PROCESS;
typedef struct _CSR_THREAD
PCHAR Arguments[]
);
+#ifdef _MSC_VER
+#pragma warning(pop)
+#endif
+
#endif
ULONG Reply;
/* Probably because of the way GDI is loaded, this has to be done here */
- Teb->GdiClientPID = HandleToUlong(Teb->Cid.UniqueProcess);
- Teb->GdiClientTID = HandleToUlong(Teb->Cid.UniqueThread);
+ Teb->GdiClientPID = HandleToUlong(Teb->ClientId.UniqueProcess);
+ Teb->GdiClientTID = HandleToUlong(Teb->ClientId.UniqueThread);
/* Set up the timeout for the connect (30 seconds) */
TimeOut.QuadPart = -30 * 1000 * 1000 * 10;
while (TRUE)
{
/* Make sure the real CID is set */
- Teb->RealClientId = Teb->Cid;
+ Teb->RealClientId = Teb->ClientId;
/* Wait for a message to come through */
Status = NtReplyWaitReceivePort(CsrApiPort,
/* Increase the static thread count */
_InterlockedIncrement((PLONG)&CsrpStaticThreadCount);
}
- _SEH_EXCEPT(CsrUnhandledExceptionFilter)
+ _SEH2_EXCEPT(CsrUnhandledExceptionFilter(_SEH2_GetExceptionInformation()))
{
ReplyMsg = NULL;
}
RemotePortView.ViewBase = NULL;
/* Save the Process ID */
- ConnectInfo->ProcessId = NtCurrentTeb()->Cid.UniqueProcess;
+ ConnectInfo->ProcessId = NtCurrentTeb()->ClientId.UniqueProcess;
/* Accept the Connection */
Status = NtAcceptConnectPort(&hPort,
CsrClientThreadSetup();
/* Save pointer to this thread in TEB */
- CsrThread = CsrLocateThreadInProcess(NULL, &Teb->Cid);
+ CsrThread = CsrLocateThreadInProcess(NULL, &Teb->ClientId);
if (CsrThread) Teb->CsrClientThread = CsrThread;
/* Return it */
if (!CaptureBuffer)
{
/* In this case, check only the Process ID */
- if (NtCurrentTeb()->Cid.UniqueProcess ==
+ if (NtCurrentTeb()->ClientId.UniqueProcess ==
ApiMessage->Header.ClientId.UniqueProcess)
{
/* There is a match, validation succeeded */
@ stdcall CsrLockThreadByClientId(ptr ptr)
@ stdcall CsrMoveSatisfiedWait(ptr ptr)
@ stdcall CsrNotifyWait(ptr long ptr ptr)
-@ stdcall CsrPopulateDosDevices(ptr ptr)
+@ stdcall CsrPopulateDosDevices()
@ stdcall CsrQueryApiPort()
@ stdcall CsrReferenceThread(ptr)
@ stdcall CsrRevertToSelf()
@ stdcall CsrSetCallingSpooler(long)
@ stdcall CsrSetForegroundPriority(ptr)
@ stdcall CsrShutdownProcesses(ptr long)
-@ stdcall CsrUnhandledExceptionFilter(ptr ptr)
+@ stdcall CsrUnhandledExceptionFilter(ptr)
@ stdcall CsrUnlockProcess(ptr)
@ stdcall CsrUnlockThread(ptr)
@ stdcall CsrValidateMessageBuffer(ptr ptr long long)
}
}
}
+ /* FIXME: Loop never ends! */
}
}
BOOL
NTAPI
-DllMain(HANDLE hDll,
- DWORD dwReason,
- LPVOID lpReserved)
+DllMainCRTStartup(HANDLE hDll,
+ DWORD dwReason,
+ LPVOID lpReserved)
{
/* We don't do much */
+ UNREFERENCED_PARAMETER(hDll);
+ UNREFERENCED_PARAMETER(dwReason);
+ UNREFERENCED_PARAMETER(lpReserved);
return TRUE;
}
/* Set up the minimal information for it */
InitializeListHead(&CsrRootProcess->ListLink);
CsrRootProcess->ProcessHandle = (HANDLE)-1;
- CsrRootProcess->ClientId = NtCurrentTeb()->Cid;
+ CsrRootProcess->ClientId = NtCurrentTeb()->ClientId;
/* Initialize the Thread Hash List */
for (i = 0; i < 256; i++) InitializeListHead(&CsrThreadHashTable[i]);
* @remarks None.
*
*--*/
-_SEH_FILTER(CsrUnhandledExceptionFilter)
+LONG
+NTAPI
+CsrUnhandledExceptionFilter(IN PEXCEPTION_POINTERS ExceptionInfo)
{
- struct _EXCEPTION_POINTERS *ExceptionInfo = _SEH_GetExceptionPointers();
SYSTEM_KERNEL_DEBUGGER_INFORMATION DebuggerInfo;
EXCEPTION_DISPOSITION Result = EXCEPTION_EXECUTE_HANDLER;
BOOLEAN OldValue;
#include <windows.h>
#include <winnt.h>
#include <ndk/ntndk.h>
-#include <helper.h>
/* CSR Header */
#include <csr/server.h>
/* PSEH for SEH Support */
-#include <pseh/pseh.h>
+#include <pseh/pseh2.h>
/* DEFINES *******************************************************************/
#define CSR_PORT_NAME L"ApiPort"
#define UNICODE_PATH_SEP L"\\"
+#define ROUND_UP(n, align) ROUND_DOWN(((ULONG)n) + (align) - 1, (align))
+#define ROUND_DOWN(n, align) (((ULONG)n) & ~((align) - 1l))
+
/* DATA **********************************************************************/
extern ULONG CsrTotalPerProcessDataLength;
IN NTSTATUS ExitStatus
);
-_SEH_FILTER(CsrUnhandledExceptionFilter);
+LONG
+NTAPI
+CsrUnhandledExceptionFilter(
+ IN PEXCEPTION_POINTERS ExceptionInfo
+);
VOID
NTAPI
KPRIORITY BasePriority = (8 + 1) + 4;
NTSTATUS Status;
ULONG Response;
+ UNREFERENCED_PARAMETER(envp);
+ UNREFERENCED_PARAMETER(DebugFlag);
+
/* Set the Priority */
NtSetInformationProcess(NtCurrentProcess(),