Author: sginsberg
Date: Sat Aug 8 18:50:27 2009
New Revision: 42525
URL:
http://svn.reactos.org/svn/reactos?rev=42525&view=rev
Log:
- Fix compilation of csrsrv:
- helper.h does not exist anymore, so define what was used in srv.h instead
- Complete migration to PSEH2
- TEB's Cid was renamed to ClientId -- update the code
- Rename DllMain to DllMainCRTStartup as this is what we link a native dll to
- Fix some incorrect entries in the .spec
- Also fix some /W4 warnings. Add a note to CsrPopulateDosDevicesDirectory that the code
is incomplete and will never stop looping (spotted by /W4).
- Does not link completely yet due to some missing function stubs.
Modified:
trunk/reactos/include/reactos/subsys/csr/server.h
trunk/reactos/subsystems/csr/csrsrv/api.c
trunk/reactos/subsystems/csr/csrsrv/csrsrv.spec
trunk/reactos/subsystems/csr/csrsrv/init.c
trunk/reactos/subsystems/csr/csrsrv/process.c
trunk/reactos/subsystems/csr/csrsrv/server.c
trunk/reactos/subsystems/csr/csrsrv/srv.h
trunk/reactos/subsystems/csr/main.c
Modified: trunk/reactos/include/reactos/subsys/csr/server.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/reactos/subsys/csr…
==============================================================================
--- trunk/reactos/include/reactos/subsys/csr/server.h [iso-8859-1] (original)
+++ trunk/reactos/include/reactos/subsys/csr/server.h [iso-8859-1] Sat Aug 8 18:50:27
2009
@@ -6,6 +6,11 @@
*/
#ifndef _CSRSERVER_H
#define _CSRSERVER_H
+
+#ifdef _MSC_VER
+#pragma warning(push)
+#pragma warning (disable:4201)
+#endif
/* DEPENDENCIES **************************************************************/
@@ -42,7 +47,7 @@
ULONG Reserved;
ULONG ShutdownLevel;
ULONG ShutdownFlags;
- PVOID ServerData[];
+ PVOID ServerData[ANYSIZE_ARRAY];
} CSR_PROCESS, *PCSR_PROCESS;
typedef struct _CSR_THREAD
@@ -325,4 +330,8 @@
PCHAR Arguments[]
);
+#ifdef _MSC_VER
+#pragma warning(pop)
#endif
+
+#endif
Modified: trunk/reactos/subsystems/csr/csrsrv/api.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/csr/csrsrv/api.…
==============================================================================
--- trunk/reactos/subsystems/csr/csrsrv/api.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/csr/csrsrv/api.c [iso-8859-1] Sat Aug 8 18:50:27 2009
@@ -342,8 +342,8 @@
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;
@@ -374,7 +374,7 @@
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,
@@ -525,7 +525,7 @@
/* Increase the static thread count */
_InterlockedIncrement((PLONG)&CsrpStaticThreadCount);
}
- _SEH_EXCEPT(CsrUnhandledExceptionFilter)
+
_SEH2_EXCEPT(CsrUnhandledExceptionFilter(_SEH2_GetExceptionInformation()))
{
ReplyMsg = NULL;
}
@@ -751,7 +751,7 @@
RemotePortView.ViewBase = NULL;
/* Save the Process ID */
- ConnectInfo->ProcessId = NtCurrentTeb()->Cid.UniqueProcess;
+ ConnectInfo->ProcessId = NtCurrentTeb()->ClientId.UniqueProcess;
/* Accept the Connection */
Status = NtAcceptConnectPort(&hPort,
@@ -1072,7 +1072,7 @@
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 */
@@ -1346,7 +1346,7 @@
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 */
Modified: trunk/reactos/subsystems/csr/csrsrv/csrsrv.spec
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/csr/csrsrv/csrs…
==============================================================================
--- trunk/reactos/subsystems/csr/csrsrv/csrsrv.spec [iso-8859-1] (original)
+++ trunk/reactos/subsystems/csr/csrsrv/csrsrv.spec [iso-8859-1] Sat Aug 8 18:50:27 2009
@@ -19,7 +19,7 @@
@ 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()
@@ -28,7 +28,7 @@
@ 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)
Modified: trunk/reactos/subsystems/csr/csrsrv/init.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/csr/csrsrv/init…
==============================================================================
--- trunk/reactos/subsystems/csr/csrsrv/init.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/csr/csrsrv/init.c [iso-8859-1] Sat Aug 8 18:50:27 2009
@@ -126,6 +126,7 @@
}
}
}
+ /* FIXME: Loop never ends! */
}
}
@@ -1221,11 +1222,14 @@
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;
}
Modified: trunk/reactos/subsystems/csr/csrsrv/process.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/csr/csrsrv/proc…
==============================================================================
--- trunk/reactos/subsystems/csr/csrsrv/process.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/csr/csrsrv/process.c [iso-8859-1] Sat Aug 8 18:50:27 2009
@@ -94,7 +94,7 @@
/* 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]);
Modified: trunk/reactos/subsystems/csr/csrsrv/server.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/csr/csrsrv/serv…
==============================================================================
--- trunk/reactos/subsystems/csr/csrsrv/server.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/csr/csrsrv/server.c [iso-8859-1] Sat Aug 8 18:50:27 2009
@@ -598,9 +598,10 @@
* @remarks None.
*
*--*/
-_SEH_FILTER(CsrUnhandledExceptionFilter)
-{
- struct _EXCEPTION_POINTERS *ExceptionInfo = _SEH_GetExceptionPointers();
+LONG
+NTAPI
+CsrUnhandledExceptionFilter(IN PEXCEPTION_POINTERS ExceptionInfo)
+{
SYSTEM_KERNEL_DEBUGGER_INFORMATION DebuggerInfo;
EXCEPTION_DISPOSITION Result = EXCEPTION_EXECUTE_HANDLER;
BOOLEAN OldValue;
Modified: trunk/reactos/subsystems/csr/csrsrv/srv.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/csr/csrsrv/srv.…
==============================================================================
--- trunk/reactos/subsystems/csr/csrsrv/srv.h [iso-8859-1] (original)
+++ trunk/reactos/subsystems/csr/csrsrv/srv.h [iso-8859-1] Sat Aug 8 18:50:27 2009
@@ -8,13 +8,12 @@
#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 *******************************************************************/
@@ -50,6 +49,9 @@
#define SB_PORT_NAME L"SbAbiPort"
#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 **********************************************************************/
@@ -345,7 +347,11 @@
IN NTSTATUS ExitStatus
);
-_SEH_FILTER(CsrUnhandledExceptionFilter);
+LONG
+NTAPI
+CsrUnhandledExceptionFilter(
+ IN PEXCEPTION_POINTERS ExceptionInfo
+);
VOID
NTAPI
Modified: trunk/reactos/subsystems/csr/main.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/csr/main.c?rev=…
==============================================================================
--- trunk/reactos/subsystems/csr/main.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/csr/main.c [iso-8859-1] Sat Aug 8 18:50:27 2009
@@ -68,6 +68,9 @@
KPRIORITY BasePriority = (8 + 1) + 4;
NTSTATUS Status;
ULONG Response;
+ UNREFERENCED_PARAMETER(envp);
+ UNREFERENCED_PARAMETER(DebugFlag);
+
/* Set the Priority */
NtSetInformationProcess(NtCurrentProcess(),