Author: cgutman
Date: Sat Jul 25 04:01:13 2009
New Revision: 42187
URL: http://svn.reactos.org/svn/reactos?rev=42187&view=rev
Log:
ws2_32_new compatibility fixes
- Use Sleep() to wait when we have no interfaces because select() will fail and return without waiting
- Use WSAGetLastError() instead of errno
Modified:
trunk/reactos/base/services/dhcp/dispatch.c
Modified: trunk/reactos/base/services/dhcp/dispatch.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/services/dhcp/dispatc…
==============================================================================
--- trunk/reactos/base/services/dhcp/dispatch.c [iso-8859-1] (original)
+++ trunk/reactos/base/services/dhcp/dispatch.c [iso-8859-1] Sat Jul 25 04:01:13 2009
@@ -63,7 +63,7 @@
void
dispatch(void)
{
- int count, i, to_msec, nfds;
+ int count, i, to_msec, nfds, err;
struct protocol *l;
fd_set fds;
time_t howlong, cur_time;
@@ -122,10 +122,9 @@
}
if (i == 0) {
- /* No interfaces for now, set the select timeout reasonably so
- * we can recover from that condition later. */
- timeval.tv_sec = 5;
- timeval.tv_usec = 0;
+ /* Wait for 5 seconds before looking for more interfaces */
+ Sleep(5000);
+ continue;
} else {
/* Wait for a packet or a timeout... XXX */
timeval.tv_sec = to_msec / 1000;
@@ -156,12 +155,9 @@
/* Not likely to be transitory... */
if (count == SOCKET_ERROR) {
- if (errno == EAGAIN || errno == EINTR) {
- continue;
- } else {
- error("poll: %s", strerror(errno));
- break;
- }
+ err = WSAGetLastError();
+ error("poll: %d", err);
+ break;
}
i = 0;
Author: fireball
Date: Fri Jul 24 23:00:17 2009
New Revision: 42181
URL: http://svn.reactos.org/svn/reactos?rev=42181&view=rev
Log:
- Implement desktop_close_handle. It is the second place in winstation.c which directly relies on ETHREAD's internal members for enumerating threads of a process. Should be reimplemented in a more compatible way, but so far it works in ReactOS and Windows 2003.
- Sticked // FIXME where appropriate.
Modified:
branches/arwinss/reactos/subsystems/win32/win32k/wine/winstation.c
Modified: branches/arwinss/reactos/subsystems/win32/win32k/wine/winstation.c
URL: http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/subsystems/win3…
==============================================================================
--- branches/arwinss/reactos/subsystems/win32/win32k/wine/winstation.c [iso-8859-1] (original)
+++ branches/arwinss/reactos/subsystems/win32/win32k/wine/winstation.c [iso-8859-1] Fri Jul 24 23:00:17 2009
@@ -249,18 +249,45 @@
static int desktop_close_handle( struct object *obj, PPROCESSINFO process, obj_handle_t handle )
{
-#if 0
- struct thread *thread;
+ PLIST_ENTRY ListHead, Entry;
+ PETHREAD FoundThread = NULL;
+ PTHREADINFO ThreadInfo;
/* check if the handle is currently used by the process or one of its threads */
if (process->desktop == handle) return 0;
- LIST_FOR_EACH_ENTRY( thread, &process->thread_list, struct thread, proc_entry )
- if (thread->desktop == handle) return 0;
+
+ // FIXME: This code relies on ETHREAD internals!
+
+ /* Lock the process */
+ KeEnterCriticalRegion();
+ ExfAcquirePushLockShared(&process->peProcess->ProcessLock);
+
+ Entry = process->peProcess->ThreadListHead.Flink;
+
+ ListHead = &process->peProcess->ThreadListHead;
+ while (ListHead != Entry)
+ {
+ /* Get the Thread */
+ FoundThread = CONTAINING_RECORD(Entry, ETHREAD, ThreadListEntry);
+ ThreadInfo = PsGetThreadWin32Thread(FoundThread);
+ if (ThreadInfo && ThreadInfo->desktop == handle)
+ {
+ /* Unlock the process */
+ ExfReleasePushLockShared(&process->peProcess->ProcessLock);
+ KeLeaveCriticalRegion();
+
+ return 0;
+ }
+
+ /* Go to the next thread */
+ Entry = Entry->Flink;
+ }
+
+ /* Unlock the process */
+ ExfReleasePushLockShared(&process->peProcess->ProcessLock);
+ KeLeaveCriticalRegion();
+
return 1;
-#else
- UNIMPLEMENTED;
- return 1;
-#endif
}
static void desktop_destroy( struct object *obj )
@@ -306,6 +333,8 @@
if (!(old_desktop = get_desktop_obj( process, process->desktop, 0 ))) clear_error();
process->desktop = handle;
+
+ // FIXME: This code relies on ETHREAD internals!
/* Lock the process */
KeEnterCriticalRegion();