Author: gadamopoulos
Date: Wed Jul 13 17:57:40 2011
New Revision: 52672
URL: http://svn.reactos.org/svn/reactos?rev=52672&view=rev
Log:
[ntdll]
- Disable Server to server calls in csr because they do not work yet as our csr is not compatible with windows.
[user32]
- Call CsrClientConnectToServer when the dll is initialized in order to connect with the server and determine if user32 is running in the server process.
- Do not load user api hook if we are in the server process
- Fixes drawing the console window
Modified:
branches/GSoC_2011/ThemesSupport/dll/ntdll/csr/connect.c
branches/GSoC_2011/ThemesSupport/dll/win32/user32/include/user32.h
branches/GSoC_2011/ThemesSupport/dll/win32/user32/misc/dllmain.c
Modified: branches/GSoC_2011/ThemesSupport/dll/ntdll/csr/connect.c
URL: http://svn.reactos.org/svn/reactos/branches/GSoC_2011/ThemesSupport/dll/ntd…
==============================================================================
--- branches/GSoC_2011/ThemesSupport/dll/ntdll/csr/connect.c [iso-8859-1] (original)
+++ branches/GSoC_2011/ThemesSupport/dll/ntdll/csr/connect.c [iso-8859-1] Wed Jul 13 17:57:40 2011
@@ -74,7 +74,9 @@
ApiMessage->Header.u1.s1.TotalLength);
/* Check if we are already inside a CSR Server */
+#if 0
if (!InsideCsrProcess)
+#endif
{
/* Check if we got a a Capture Buffer */
if (CaptureBuffer)
@@ -148,6 +150,7 @@
ApiMessage->Status = Status;
}
}
+#if 0
else
{
/* This is a server-to-server call. Save our CID and do a direct call */
@@ -163,6 +166,7 @@
ApiMessage->Status = Status;
}
}
+#endif
/* Return the CSR Result */
DPRINT("Got back: 0x%lx\n", ApiMessage->Status);
Modified: branches/GSoC_2011/ThemesSupport/dll/win32/user32/include/user32.h
URL: http://svn.reactos.org/svn/reactos/branches/GSoC_2011/ThemesSupport/dll/win…
==============================================================================
--- branches/GSoC_2011/ThemesSupport/dll/win32/user32/include/user32.h [iso-8859-1] (original)
+++ branches/GSoC_2011/ThemesSupport/dll/win32/user32/include/user32.h [iso-8859-1] Wed Jul 13 17:57:40 2011
@@ -48,7 +48,7 @@
extern PPROCESSINFO g_ppi;
extern ULONG_PTR g_ulSharedDelta;
extern PSERVERINFO gpsi;
-extern BOOL gfServerProcess;
+extern BOOLEAN gfServerProcess;
#define HOOKID_TO_FLAG(HookId) (1 << ((HookId) + 1))
#define ISITHOOKED(HookId) (GetWin32ClientInfo()->fsHooks & HOOKID_TO_FLAG(HookId) ||\
@@ -75,11 +75,9 @@
if(IsInsideUserApiHook())
return;
- /* HACK! Please remove when gfServerProcess is correct */
-#if 0
if(gfServerProcess)
return;
-#endif
+
if(RtlIsThreadWithinLoaderCallout())
return;
Modified: branches/GSoC_2011/ThemesSupport/dll/win32/user32/misc/dllmain.c
URL: http://svn.reactos.org/svn/reactos/branches/GSoC_2011/ThemesSupport/dll/win…
==============================================================================
--- branches/GSoC_2011/ThemesSupport/dll/win32/user32/misc/dllmain.c [iso-8859-1] (original)
+++ branches/GSoC_2011/ThemesSupport/dll/win32/user32/misc/dllmain.c [iso-8859-1] Wed Jul 13 17:57:40 2011
@@ -13,7 +13,7 @@
PUSER_HANDLE_ENTRY gHandleEntries = NULL;
PSERVERINFO gpsi = NULL;
ULONG_PTR g_ulSharedDelta;
-BOOL gfServerProcess = FALSE;
+BOOLEAN gfServerProcess = FALSE;
WCHAR szAppInit[KEY_LENGTH];
@@ -198,7 +198,7 @@
{
USERCONNECT UserCon;
PVOID *KernelCallbackTable;
-
+
/* Set up the kernel callbacks. */
KernelCallbackTable = NtCurrentPeb()->KernelCallbackTable;
KernelCallbackTable[USER32_CALLBACK_WINDOWPROC] =
@@ -231,8 +231,8 @@
gHandleEntries = SharedPtrToUser(gHandleTable->handles);
RtlInitializeCriticalSection(&gcsUserApiHook);
- gfServerProcess = TRUE; // FIXME HAX! Used in CsrClientConnectToServer(,,,,&gfServerProcess);
-
+
+ CsrClientConnectToServer(L"\\Windows", 0, NULL, 0, &gfServerProcess);
//ERR("1 SI 0x%x : HT 0x%x : D 0x%x\n", UserCon.siClient.psi, UserCon.siClient.aheList, g_ulSharedDelta);
/* Allocate an index for user32 thread local data. */
Author: cgutman
Date: Tue Jul 12 21:31:36 2011
New Revision: 52667
URL: http://svn.reactos.org/svn/reactos?rev=52667&view=rev
Log:
[IP]
- Store the address of an outgoing NIC properly (gethostname() fix)
- Don't do an explicit bind if we don't have to (ws2_32_winetest sock hang fix)
Modified:
trunk/reactos/lib/drivers/ip/transport/tcp/accept.c
trunk/reactos/lib/drivers/ip/transport/tcp/tcp.c
Modified: trunk/reactos/lib/drivers/ip/transport/tcp/accept.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/drivers/ip/transport/t…
==============================================================================
--- trunk/reactos/lib/drivers/ip/transport/tcp/accept.c [iso-8859-1] (original)
+++ trunk/reactos/lib/drivers/ip/transport/tcp/accept.c [iso-8859-1] Tue Jul 12 21:31:36 2011
@@ -78,25 +78,36 @@
TI_DbgPrint(DEBUG_TCP,("Connection->SocketContext %x\n",
Connection->SocketContext));
- AddressToBind.sin_family = AF_INET;
- memcpy( &AddressToBind.sin_addr,
- &Connection->AddressFile->Address.Address.IPv4Address,
- sizeof(AddressToBind.sin_addr) );
- AddressToBind.sin_port = Connection->AddressFile->Port;
+ if (Connection->AddressFile->Port)
+ {
+ AddressToBind.sin_family = AF_INET;
+ memcpy( &AddressToBind.sin_addr,
+ &Connection->AddressFile->Address.Address.IPv4Address,
+ sizeof(AddressToBind.sin_addr) );
+ AddressToBind.sin_port = Connection->AddressFile->Port;
+ TI_DbgPrint(DEBUG_TCP,("AddressToBind - %x:%x\n", AddressToBind.sin_addr, AddressToBind.sin_port));
- TI_DbgPrint(DEBUG_TCP,("AddressToBind - %x:%x\n", AddressToBind.sin_addr, AddressToBind.sin_port));
+ /* Perform an explicit bind */
+ Status = TCPTranslateError(OskitTCPBind(Connection->SocketContext,
+ &AddressToBind,
+ sizeof(AddressToBind)));
+ }
+ else
+ {
+ /* An implicit bind will be performed */
+ Status = STATUS_SUCCESS;
+ }
- Status = TCPTranslateError( OskitTCPBind( Connection->SocketContext,
- &AddressToBind,
- sizeof(AddressToBind) ) );
+ if (NT_SUCCESS(Status))
+ Status = TCPTranslateError( OskitTCPListen( Connection->SocketContext, Backlog ) );
+
if (NT_SUCCESS(Status))
{
/* Check if we had an unspecified port */
if (!Connection->AddressFile->Port)
{
/* We did, so we need to copy back the port */
- Status = TCPGetSockAddress(Connection, (PTRANSPORT_ADDRESS)&LocalAddress, FALSE);
- if (NT_SUCCESS(Status))
+ if (NT_SUCCESS(TCPGetSockAddress(Connection, (PTRANSPORT_ADDRESS)&LocalAddress, FALSE)))
{
/* Allocate the port in the port bitmap */
Connection->AddressFile->Port = TCPAllocatePort(LocalAddress.Address[0].Address[0].sin_port);
@@ -106,9 +117,6 @@
}
}
}
-
- if (NT_SUCCESS(Status))
- Status = TCPTranslateError( OskitTCPListen( Connection->SocketContext, Backlog ) );
UnlockObject(Connection, OldIrql);
Modified: trunk/reactos/lib/drivers/ip/transport/tcp/tcp.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/drivers/ip/transport/t…
==============================================================================
--- trunk/reactos/lib/drivers/ip/transport/tcp/tcp.c [iso-8859-1] (original)
+++ trunk/reactos/lib/drivers/ip/transport/tcp/tcp.c [iso-8859-1] Tue Jul 12 21:31:36 2011
@@ -723,7 +723,7 @@
USHORT RemotePort;
TA_IP_ADDRESS LocalAddress;
PTDI_BUCKET Bucket;
- PNEIGHBOR_CACHE_ENTRY NCE;
+ PNEIGHBOR_CACHE_ENTRY NCE = NULL;
KIRQL OldIrql;
TI_DbgPrint(DEBUG_TCP,("TCPConnect: Called\n"));
@@ -762,37 +762,36 @@
UnlockObject(Connection, OldIrql);
return STATUS_NETWORK_UNREACHABLE;
}
-
- AddressToBind.sin_addr.s_addr = NCE->Interface->Unicast.Address.IPv4Address;
+ }
+
+ if (Connection->AddressFile->Port)
+ {
+ /* See if we had an unspecified bind address */
+ if (NCE)
+ {
+ /* We did, so use the interface unicast address associated with the route */
+ AddressToBind.sin_addr.s_addr = NCE->Interface->Unicast.Address.IPv4Address;
+ }
+ else
+ {
+ /* Bind address was explicit so use it */
+ AddressToBind.sin_addr.s_addr = Connection->AddressFile->Address.Address.IPv4Address;
+ }
+
+ AddressToBind.sin_port = Connection->AddressFile->Port;
+
+ /* Perform an explicit bind */
+ Status = TCPTranslateError(OskitTCPBind(Connection->SocketContext,
+ &AddressToBind,
+ sizeof(AddressToBind)));
}
else
{
- AddressToBind.sin_addr.s_addr = Connection->AddressFile->Address.Address.IPv4Address;
- }
-
- AddressToBind.sin_port = Connection->AddressFile->Port;
-
- Status = TCPTranslateError
- ( OskitTCPBind( Connection->SocketContext,
- &AddressToBind,
- sizeof(AddressToBind) ) );
-
- if (NT_SUCCESS(Status)) {
- /* Check if we had an unspecified port */
- if (!Connection->AddressFile->Port)
- {
- /* We did, so we need to copy back the port */
- Status = TCPGetSockAddress(Connection, (PTRANSPORT_ADDRESS)&LocalAddress, FALSE);
- if (NT_SUCCESS(Status))
- {
- /* Allocate the port in the port bitmap */
- Connection->AddressFile->Port = TCPAllocatePort(LocalAddress.Address[0].Address[0].sin_port);
-
- /* This should never fail */
- ASSERT(Connection->AddressFile->Port != 0xFFFF);
- }
- }
-
+ /* An implicit bind will be performed */
+ Status = STATUS_SUCCESS;
+ }
+
+ if (NT_SUCCESS(Status)) {
if (NT_SUCCESS(Status))
{
memcpy( &AddressToConnect.sin_addr,
@@ -804,7 +803,31 @@
( OskitTCPConnect( Connection->SocketContext,
&AddressToConnect,
sizeof(AddressToConnect) ) );
-
+
+ if (NT_SUCCESS(Status))
+ {
+ /* Check if we had an unspecified port */
+ if (!Connection->AddressFile->Port)
+ {
+ /* We did, so we need to copy back the port */
+ if (NT_SUCCESS(TCPGetSockAddress(Connection, (PTRANSPORT_ADDRESS)&LocalAddress, FALSE)))
+ {
+ /* Allocate the port in the port bitmap */
+ Connection->AddressFile->Port = TCPAllocatePort(LocalAddress.Address[0].Address[0].sin_port);
+
+ /* This should never fail */
+ ASSERT(Connection->AddressFile->Port != 0xFFFF);
+ }
+ }
+
+ /* Check if the address was unspecified */
+ if (AddrIsUnspecified(&Connection->AddressFile->Address))
+ {
+ /* It is, so store the address of the outgoing NIC */
+ Connection->AddressFile->Address = NCE->Interface->Unicast;
+ }
+ }
+
if (Status == STATUS_PENDING)
{
Bucket = ExAllocatePoolWithTag( NonPagedPool, sizeof(*Bucket), TDI_BUCKET_TAG );