Merge 25584, 25588.
authorAleksey Bragin <aleksey@reactos.org>
Mon, 5 Feb 2007 20:14:59 +0000 (20:14 +0000)
committerAleksey Bragin <aleksey@reactos.org>
Mon, 5 Feb 2007 20:14:59 +0000 (20:14 +0000)
svn path=/branches/ros-branch-0_3_1/; revision=25730

reactos/dll/win32/syssetup/syssetup.rc
reactos/dll/win32/syssetup/syssetup_It.rc [new file with mode: 0644]
reactos/ntoskrnl/ex/init.c
reactos/ntoskrnl/ex/pushlock.c
reactos/ntoskrnl/include/internal/ex.h

index 9899ffe..61b331d 100644 (file)
@@ -51,3 +51,4 @@ IDR_GPL RT_TEXT "COPYING"
 #include "syssetup_Es.rc"
 #include "syssetup_Hu.rc"
 #include "syssetup_Uk.rc"
+#include "syssetup_It.rc"
diff --git a/reactos/dll/win32/syssetup/syssetup_It.rc b/reactos/dll/win32/syssetup/syssetup_It.rc
new file mode 100644 (file)
index 0000000..c1c011d
--- /dev/null
@@ -0,0 +1,214 @@
+/*
+ * PROJECT:     System Setup
+ * LICENSE:     GPL - See COPYING in the top level directory
+ * FILE:        dll/win32/syssetup/syssetup_It.rc
+ * PURPOSE:     Italian Translation of dll/win32/syssetup/syssetup_En.rc
+ * PROGRAMMERS: Copyright (C) 2004 Filip Navara
+ *              Copyright (C) 2004 Eric Kohl
+ *              Copyright (C) 2007 Daniele Forsi (dforsi at gmail.com) Italian Translation
+ */
+
+LANGUAGE LANG_ITALIAN, SUBLANG_ITALIAN
+
+
+IDD_WELCOMEPAGE DIALOG DISCARDABLE  0, 0, 317, 193
+STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
+CAPTION "Installazione di ReactOS"
+FONT 8, "MS Shell Dlg"
+BEGIN
+    LTEXT "Benvenuti alla configurazione guidata di ReactOS.", IDC_WELCOMETITLE, 115, 8, 195, 24
+    LTEXT "Questa procedura guidata installa ReactOS su questo computer. La procedura "\
+          "deve raccogliere alcune informazioni sull'utente e sul computer "\
+          "per configurare ReactOS adeguatamente.", IDC_STATIC, 115, 40, 195, 100
+    LTEXT "Selezionare Continua per proseguire con la configurazione.", IDC_STATIC, 115, 169, 195, 17
+END
+
+
+IDD_ACKPAGE DIALOGEX 0, 0, 317, 143
+STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
+CAPTION "Installazione di ReactOS"
+FONT 8, "MS Shell Dlg", 0, 0, 0x0
+BEGIN
+    LTEXT           "Gli sviluppatori di ReactOS desiderano citare i seguenti progetti Open Source, "\
+                    "che sono stati usati (in tutto o in parte) per creare ReactOS:",
+                    IDC_STATIC,15,7,286,19
+    LISTBOX         IDC_PROJECTS,15,30,286,75,LBS_NOSEL | LBS_HASSTRINGS | 
+                    LBS_NOINTEGRALHEIGHT | WS_VSCROLL
+    LTEXT           "ReactOS è soggetto alla licenza GPL, per cui se si desidera riusarlo o ridistribuirlo "\
+                    "(in tutto o in parte) è necessario rispettare la GPL",
+                    IDC_STATIC,15,110,227,19
+    PUSHBUTTON      "&Mostra la GPL...",IDC_VIEWGPL,251,110,50,19
+    LTEXT           "Selezionare Continua per proseguire con la configurazione.",IDC_STATIC,15,136,
+                    195,17
+END
+
+
+IDD_OWNERPAGE DIALOG DISCARDABLE  0, 0, 317, 143
+STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
+CAPTION "Installazione di ReactOS"
+FONT 8, "MS Shell Dlg"
+BEGIN
+    LTEXT "Scrivere il proprio nome completo e il nome della propria ditta o organizzazione.",
+          IDC_STATIC, 54, 7, 242, 21
+    LTEXT "No&me:", IDC_STATIC, 54, 37, 44, 8
+    EDITTEXT IDC_OWNERNAME, 132, 35, 163, 14, WS_VISIBLE | WS_TABSTOP | ES_AUTOHSCROLL
+    LTEXT "&Organizzazione:", IDC_STATIC, 54, 57, 44, 8
+    EDITTEXT IDC_OWNERORGANIZATION, 132, 55, 163, 14, WS_VISIBLE | WS_TABSTOP | ES_AUTOHSCROLL
+END
+
+
+IDD_COMPUTERPAGE DIALOG DISCARDABLE  0, 0, 317, 143
+STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
+CAPTION "Installazione di ReactOS"
+FONT 8, "MS Shell Dlg"
+BEGIN
+    LTEXT "Scrivere un nome per il computer che sia lungo al massimo 63 caratteri. "\
+          "Se si è in rete, il nome del computer deve essere univoco.",
+          IDC_STATIC, 54, 7, 250, 24
+    LTEXT "Nome del &computer:", IDC_STATIC, 54, 38, 75, 8
+    EDITTEXT IDC_COMPUTERNAME, 132, 35, 163, 14, WS_VISIBLE | WS_TABSTOP | ES_AUTOHSCROLL | ES_UPPERCASE
+    LTEXT "Questa procedura creerà su questo computer un account utente chiamato Administrator. "\
+          "Si potrà usare questo account se si necessita l'accesso completo al computer.",
+          IDC_STATIC, 54, 57, 250, 25
+    LTEXT "Scrivere una password per Administrator che sia lunga al massimo 14 caratteri.",
+          IDC_STATIC, 54, 87, 250, 8
+    LTEXT "Password per &Administrator:", IDC_STATIC, 54, 104, 75, 8
+    EDITTEXT IDC_ADMINPASSWORD1, 132, 101, 172, 14, WS_VISIBLE | WS_TABSTOP | ES_PASSWORD
+    LTEXT "C&onfermare la password:", IDC_STATIC, 54, 123, 75, 8
+    EDITTEXT IDC_ADMINPASSWORD2, 132, 120, 172, 14, WS_VISIBLE | WS_TABSTOP | ES_PASSWORD
+END
+
+
+IDD_LOCALEPAGE DIALOG DISCARDABLE  0, 0, 317, 143
+STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
+CAPTION "Installazione di ReactOS"
+FONT 8, "MS Shell Dlg"
+BEGIN
+    LTEXT "Le impostazioni linguistiche del sistema devono coincidere con la lingua degli applicativi "\
+          "che si desidera usare. Le impostazioni linguistiche dell'utente stabiliscono come appaiono "\
+          "i numeri, i valori monetari e le date.", IDC_STATIC, 53, 7, 253, 20
+    LTEXT "", IDC_LOCALETEXT, 53, 29, 250, 16
+    LTEXT "Per cambiare le impostazioni linguistiche del sistema o dell'utente, selezionare Personalizza.",
+          IDC_STATIC, 53, 60, 184, 8
+    PUSHBUTTON "&Personalizza...", IDC_CUSTOMLOCALE, 245, 57, 50, 14
+    LTEXT "Il formato della tastiera stabilisce i caratteri che appaiono quando si preme un tasto.",
+          IDC_STATIC, 53, 86, 253, 8
+    LTEXT "", IDC_LAYOUTTEXT, 53, 100, 250, 16
+    LTEXT "Per cambiare il formato della tastiera, selezionare Personalizza.",
+          IDC_STATIC, 53, 126, 184, 8
+    PUSHBUTTON "P&ersonalizza...", IDC_CUSTOMLAYOUT, 245, 122, 50, 14
+END
+
+
+IDD_DATETIMEPAGE DIALOG DISCARDABLE  0, 0, 317, 143
+STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
+CAPTION "Installazione di ReactOS"
+FONT 8, "MS Shell Dlg"
+BEGIN
+    LTEXT "Data e ora", IDC_STATIC, 53, 7, 253, 8
+    CONTROL "", IDC_DATEPICKER, "SysDateTimePick32",
+            DTS_LONGDATEFORMAT | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 53, 17, 137, 14
+    CONTROL "", IDC_TIMEPICKER, "SysDateTimePick32",
+            DTS_TIMEFORMAT | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 200, 17, 54, 14
+    LTEXT "Fuso orario", IDC_STATIC, 53, 42, 253, 8
+    COMBOBOX IDC_TIMEZONELIST, 53, 52, 201, 93,
+             CBS_DROPDOWNLIST | WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_VSCROLL
+    AUTOCHECKBOX "Cambia automaticamente con l'ora &legale",
+                 IDC_AUTODAYLIGHT, 53, 124, 201, 10
+END
+
+
+IDD_PROCESSPAGE DIALOG 0, 0, 317, 143
+STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
+CAPTION "Installazione di ReactOS"
+FONT 8, "MS Shell Dlg"
+BEGIN
+    LTEXT "", IDC_ACTIVITY, 53, 7, 253, 20
+    LTEXT "", IDC_ITEM, 53, 29, 253, 20
+    CONTROL "", IDC_PROCESSPROGRESS, "msctls_progress32",
+            PBS_SMOOTH | WS_CHILD | WS_VISIBLE | WS_BORDER, 53, 70, 253, 8
+END
+
+
+IDD_FINISHPAGE DIALOG DISCARDABLE  0, 0, 317, 193
+STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
+CAPTION "L'installazione di ReactOS è completata"
+FONT 8, "MS Shell Dlg"
+BEGIN
+    LTEXT "Completamento della procedura guidata di installazione di ReactOS", IDC_FINISHTITLE, 115, 8, 195, 24
+    LTEXT "La procedura guidata di installazione di ReactOS è completata.\n\n" \
+          "Selezionando Fine, il computer sarà riavviato.", IDC_STATIC, 115, 40, 195, 100
+    CONTROL "", IDC_RESTART_PROGRESS, "msctls_progress32", PBS_SMOOTH | WS_CHILD | WS_VISIBLE | WS_BORDER, 115, 138, 188, 12
+    LTEXT "Se c'è un CD in un lettore, è necessario rimuoverlo. Poi, per riavviare "\
+          "il computer, selezionare Fine.", IDC_STATIC, 115, 169, 195, 17
+END
+
+
+IDD_GPL DIALOG 0, 0, 333, 230
+STYLE DS_CENTER | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
+CAPTION "GNU General Public License"
+FONT 8, "MS Shell Dlg"
+BEGIN
+    EDITTEXT        IDC_GPL_TEXT,7,7,319,190,ES_MULTILINE | ES_AUTOHSCROLL | 
+                    ES_READONLY | WS_VSCROLL
+    DEFPUSHBUTTON   "OK",IDOK,141,209,50,14
+END
+
+
+STRINGTABLE
+BEGIN
+    IDS_ACKTITLE         "Riconoscimenti"
+    IDS_ACKSUBTITLE      "Le spalle su cui ReactOS poggia e le informazioni sulla licenza"
+    IDS_OWNERTITLE       "Personalizzare il software"
+    IDS_OWNERSUBTITLE    "La procedura usa queste informazioni su di voi per personalizzare ReactOS."
+    IDS_COMPUTERTITLE    "Il nome del computer e la password di Administrator"
+    IDS_COMPUTERSUBTITLE "È necessario fornire un nome e una password di Administrator per il proprio computer."
+    IDS_LOCALETITLE      "Impostazioni regionali"
+    IDS_LOCALESUBTITLE   "È possibile personalizzare ReactOS per regioni e lingue differenti."
+    IDS_DATETIMETITLE    "Data e ora"
+    IDS_DATETIMESUBTITLE "Impostare la data e l'ora corrette per il proprio computer."
+    IDS_PROCESSTITLE     "Titolo della pagina di avanzamento"
+    IDS_PROCESSSUBTITLE  "Sottotitolo della pagina di avanzamento"
+END
+
+STRINGTABLE
+BEGIN
+    IDS_CMT_WINEFILE    "Lancia Winefile"
+    IDS_CMT_IBROWSER   "Lancia iBrowser"
+    IDS_CMT_GETFIREFOX "Scarica/installa Firefox"
+    IDS_CMT_DOWNLOADER  "Scarica e installa varie applicazioni"
+END
+
+STRINGTABLE
+BEGIN
+    IDS_ACCESSORIES     "Accessori"
+    IDS_CMT_CALC        "Calcolatrice"
+    IDS_CMT_CMD         "Apri la finestra dei comandi"
+    IDS_CMT_EXPLORER    "Lancia Explorer"
+    IDS_CMT_NOTEPAD     "Lancia l'editor dei testi"
+    IDS_CMT_REGEDIT     "Lancia l'editor del registro"
+    IDS_CMT_WORDPAD     "Lancia l'editor dei documenti"
+    IDS_CMT_SCREENSHOT  "Salva una schermata"
+END
+
+STRINGTABLE
+BEGIN
+    IDS_GAMES              "Giochi"
+    IDS_CMT_SOLITAIRE  "Solitario"
+    IDS_CMT_WINEMINE   "Campo minato"
+END
+
+STRINGTABLE
+BEGIN
+IDS_REACTOS_SETUP                  "Installazione di ReactOS"
+    IDS_UNKNOWN_ERROR           "Errore sconosciuto"
+    IDS_REGISTERING_COMPONENTS  "Registrazione dei componenti..."
+    IDS_LOADLIBRARY_FAILED         "LoadLibrary fallito: "
+    IDS_GETPROCADDR_FAILED         "GetProcAddr fallito: "
+    IDS_REGSVR_FAILED           "DllRegisterServer fallito: "
+    IDS_DLLINSTALL_FAILED          "DllInstall fallito: "
+    IDS_TIMEOUT                                "Tempo scaduto durante la registrazione"
+    IDS_REASON_UNKNOWN          ""
+END
+
+/* EOF */
index 068d5d9..6673931 100644 (file)
@@ -1,11 +1,11 @@
 /*
-* PROJECT:         ReactOS Kernel
-* LICENSE:         GPL - See COPYING in the top level directory
-* FILE:            ntoskrnl/ex/init.c
-* PURPOSE:         Executive Initialization Code
-* PROGRAMMERS:     Alex Ionescu (alex.ionescu@reactos.org)
-*                  Eric Kohl (ekohl@rz-online.de)
-*/
+ * PROJECT:         ReactOS Kernel
+ * LICENSE:         GPL - See COPYING in the top level directory
+ * FILE:            ntoskrnl/ex/init.c
+ * PURPOSE:         Executive Initialization Code
+ * PROGRAMMERS:     Alex Ionescu (alex.ionescu@reactos.org)
+ *                  Eric Kohl (ekohl@rz-online.de)
+ */
 
 /* INCLUDES ******************************************************************/
 
index 80103ea..f2a943b 100644 (file)
@@ -341,6 +341,33 @@ ExTimedWaitForUnblockPushLock(IN PEX_PUSH_LOCK PushLock,
     return Status;
 }
 
+/*++
+ * @name ExWaitForUnblockPushLock
+ *
+ *     The ExWaitForUnblockPushLock routine waits for a pushlock
+ *     to be unblocked, for a specified internal.
+ *
+ * @param PushLock
+ *        Pointer to a pushlock whose waiter list needs to be optimized.
+ *
+ * @param WaitBlock
+ *        Pointer to the pushlock's wait block.
+ *
+ * @return STATUS_SUCCESS is the pushlock is now unblocked, otherwise the error
+ *         code returned by KeWaitForSingleObject.
+ *
+ * @remarks If the wait fails, then a manual unblock is attempted.
+ *
+ *--*/
+VOID
+FASTCALL
+ExWaitForUnblockPushLock(IN PEX_PUSH_LOCK PushLock,
+                         IN PEX_PUSH_LOCK_WAIT_BLOCK WaitBlock)
+{
+    /* Call the timed function with no timeout */
+    ExTimedWaitForUnblockPushLock(PushLock, WaitBlock, NULL);
+}
+
 /*++
  * @name ExBlockPushLock
  *
@@ -360,25 +387,33 @@ ExTimedWaitForUnblockPushLock(IN PEX_PUSH_LOCK PushLock,
 VOID
 FASTCALL
 ExBlockPushLock(PEX_PUSH_LOCK PushLock,
-                PVOID WaitBlock)
+                PVOID pWaitBlock)
 {
-    PVOID NewValue, OldValue;
+    PEX_PUSH_LOCK_WAIT_BLOCK WaitBlock = pWaitBlock;
+    EX_PUSH_LOCK NewValue, OldValue;
+    
+    /* Detect invalid wait block alignment */
+    ASSERT((ULONG_PTR)pWaitBlock & 0x10);
 
     /* Set the waiting bit */
-    ((PEX_PUSH_LOCK_WAIT_BLOCK)WaitBlock)->Flags |= EX_PUSH_LOCK_FLAGS_WAIT;
-
-    /* Link the wait blocks */
-    ((PEX_PUSH_LOCK_WAIT_BLOCK)WaitBlock)->Next = PushLock->Ptr;
+    WaitBlock->Flags = EX_PUSH_LOCK_FLAGS_WAIT;
+    
+    /* Get the old value */
+    OldValue = *PushLock;
 
-    /* Try to set this one as the wait block now */
-    NewValue = PushLock->Ptr;
+    /* Start block loop */
     for (;;)
     {
+        /* Link the wait blocks */
+        WaitBlock->Next = OldValue.Ptr;
+
         /* Set the new wait block value */
-        OldValue = InterlockedCompareExchangePointer(&PushLock->Ptr,
-                                                     WaitBlock,
-                                                     NewValue);
-        if (OldValue == NewValue) break;
+        NewValue.Ptr = InterlockedCompareExchangePointer(&PushLock->Ptr,
+                                                         WaitBlock,
+                                                         OldValue.Ptr);
+        if (OldValue.Ptr == NewValue.Ptr) break;
+        
+        /* Try again with the new value */
         NewValue = OldValue;
     }
 }
@@ -404,7 +439,7 @@ VOID
 FASTCALL
 ExfAcquirePushLockExclusive(PEX_PUSH_LOCK PushLock)
 {
-    EX_PUSH_LOCK_WAIT_BLOCK WaitBlock;
+    DEFINE_WAIT_BLOCK(WaitBlock);
     EX_PUSH_LOCK OldValue = *PushLock, NewValue, TempValue;
     BOOLEAN NeedWake;
     ULONG i;
@@ -435,23 +470,23 @@ ExfAcquirePushLockExclusive(PEX_PUSH_LOCK PushLock)
         else
         {
             /* We'll have to create a Waitblock */
-            WaitBlock.Flags = EX_PUSH_LOCK_FLAGS_EXCLUSIVE |
-                              EX_PUSH_LOCK_FLAGS_WAIT;
-            WaitBlock.Previous = NULL;
+            WaitBlock->Flags = EX_PUSH_LOCK_FLAGS_EXCLUSIVE |
+                               EX_PUSH_LOCK_FLAGS_WAIT;
+            WaitBlock->Previous = NULL;
             NeedWake = FALSE;
 
             /* Check if there is already a waiter */
             if (OldValue.Waiting)
             {
                 /* Nobody is the last waiter yet */
-                WaitBlock.Last = NULL;
+                WaitBlock->Last = NULL;
 
                 /* We are an exclusive waiter */
-                WaitBlock.ShareCount = 0;
+                WaitBlock->ShareCount = 0;
 
                 /* Set the current Wait Block pointer */
-                WaitBlock.Next = (PEX_PUSH_LOCK_WAIT_BLOCK)((ULONG_PTR)
-                                  OldValue.Ptr &~ EX_PUSH_LOCK_PTR_BITS);
+                WaitBlock->Next = (PEX_PUSH_LOCK_WAIT_BLOCK)((ULONG_PTR)
+                                   OldValue.Ptr &~ EX_PUSH_LOCK_PTR_BITS);
 
                 /* Point to ours */
                 NewValue.Value = (OldValue.Value & EX_PUSH_LOCK_MULTIPLE_SHARED) |
@@ -466,10 +501,10 @@ ExfAcquirePushLockExclusive(PEX_PUSH_LOCK PushLock)
             else
             {
                 /* We are the first waiter, so loop the wait block */
-                WaitBlock.Last = &WaitBlock;
+                WaitBlock->Last = WaitBlock;
 
                 /* Set the share count */
-                WaitBlock.ShareCount = OldValue.Shared;
+                WaitBlock->ShareCount = OldValue.Shared;
 
                 /* Check if someone is sharing this pushlock */
                 if (OldValue.Shared > 1)
@@ -483,7 +518,7 @@ ExfAcquirePushLockExclusive(PEX_PUSH_LOCK PushLock)
                 else
                 {
                     /* No shared count */
-                    WaitBlock.ShareCount = 0;
+                    WaitBlock->ShareCount = 0;
 
                     /* Point to our wait block */
                     NewValue.Value = EX_PUSH_LOCK_LOCK |
@@ -494,10 +529,10 @@ ExfAcquirePushLockExclusive(PEX_PUSH_LOCK PushLock)
 
 #if DBG
             /* Setup the Debug Wait Block */
-            WaitBlock.Signaled = 0;
-            WaitBlock.OldValue = OldValue;
-            WaitBlock.NewValue = NewValue;
-            WaitBlock.PushLock = PushLock;
+            WaitBlock->Signaled = 0;
+            WaitBlock->OldValue = OldValue;
+            WaitBlock->NewValue = NewValue;
+            WaitBlock->PushLock = PushLock;
 #endif
 
             /* Sanity check */
@@ -524,26 +559,26 @@ ExfAcquirePushLockExclusive(PEX_PUSH_LOCK PushLock)
             }
 
             /* Set up the Wait Gate */
-            KeInitializeGate(&WaitBlock.WakeGate);
+            KeInitializeGate(&WaitBlock->WakeGate);
 
             /* Now spin on the push lock if necessary */
             i = ExPushLockSpinCount;
-            if ((i) && (WaitBlock.Flags & EX_PUSH_LOCK_WAITING))
+            if ((i) && (WaitBlock->Flags & EX_PUSH_LOCK_WAITING))
             {
                 /* Spin */
                 while (--i) YieldProcessor();
             }
 
             /* Now try to remove the wait bit */
-            if (InterlockedBitTestAndReset(&WaitBlock.Flags, 1))
+            if (InterlockedBitTestAndReset(&WaitBlock->Flags, 1))
             {
                 /* Nobody removed it already, let's do a full wait */
-                KeWaitForGate(&WaitBlock.WakeGate, WrPushLock, KernelMode);
-                ASSERT(WaitBlock.Signaled);
+                KeWaitForGate(&WaitBlock->WakeGate, WrPushLock, KernelMode);
+                ASSERT(WaitBlock->Signaled);
             }
 
             /* We shouldn't be shared anymore */
-            ASSERT((WaitBlock.ShareCount == 0));
+            ASSERT((WaitBlock->ShareCount == 0));
 
             /* Loop again */
             OldValue = NewValue;
@@ -570,7 +605,7 @@ VOID
 FASTCALL
 ExfAcquirePushLockShared(PEX_PUSH_LOCK PushLock)
 {
-    EX_PUSH_LOCK_WAIT_BLOCK WaitBlock;
+    DEFINE_WAIT_BLOCK(WaitBlock);
     EX_PUSH_LOCK OldValue = *PushLock, NewValue;
     BOOLEAN NeedWake;
     ULONG i;
@@ -614,20 +649,20 @@ ExfAcquirePushLockShared(PEX_PUSH_LOCK PushLock)
         else
         {
             /* We'll have to create a Waitblock */
-            WaitBlock.Flags = EX_PUSH_LOCK_FLAGS_WAIT;
-            WaitBlock.ShareCount = 0;
+            WaitBlock->Flags = EX_PUSH_LOCK_FLAGS_WAIT;
+            WaitBlock->ShareCount = 0;
             NeedWake = FALSE;
-            WaitBlock.Previous = NULL;
+            WaitBlock->Previous = NULL;
 
             /* Check if there is already a waiter */
             if (OldValue.Waiting)
             {
                 /* Set the current Wait Block pointer */
-                WaitBlock.Next = (PEX_PUSH_LOCK_WAIT_BLOCK)((ULONG_PTR)
-                                 OldValue.Ptr &~ EX_PUSH_LOCK_PTR_BITS);
+                WaitBlock->Next = (PEX_PUSH_LOCK_WAIT_BLOCK)((ULONG_PTR)
+                                   OldValue.Ptr &~ EX_PUSH_LOCK_PTR_BITS);
 
                 /* Nobody is the last waiter yet */
-                WaitBlock.Last = NULL;
+                WaitBlock->Last = NULL;
 
                 /* Point to ours */
                 NewValue.Value = (OldValue.Value & (EX_PUSH_LOCK_MULTIPLE_SHARED |
@@ -642,7 +677,7 @@ ExfAcquirePushLockShared(PEX_PUSH_LOCK PushLock)
             else
             {
                 /* We are the first waiter, so loop the wait block */
-                WaitBlock.Last = &WaitBlock;
+                WaitBlock->Last = WaitBlock;
 
                 /* Point to our wait block */
                 NewValue.Value = (OldValue.Value & (EX_PUSH_LOCK_MULTIPLE_SHARED |
@@ -656,10 +691,10 @@ ExfAcquirePushLockShared(PEX_PUSH_LOCK PushLock)
 
 #if DBG
             /* Setup the Debug Wait Block */
-            WaitBlock.Signaled = 0;
-            WaitBlock.OldValue = OldValue;
-            WaitBlock.NewValue = NewValue;
-            WaitBlock.PushLock = PushLock;
+            WaitBlock->Signaled = 0;
+            WaitBlock->OldValue = OldValue;
+            WaitBlock->NewValue = NewValue;
+            WaitBlock->PushLock = PushLock;
 #endif
 
             /* Write the new value */
@@ -683,26 +718,26 @@ ExfAcquirePushLockShared(PEX_PUSH_LOCK PushLock)
             }
 
             /* Set up the Wait Gate */
-            KeInitializeGate(&WaitBlock.WakeGate);
+            KeInitializeGate(&WaitBlock->WakeGate);
 
             /* Now spin on the push lock if necessary */
             i = ExPushLockSpinCount;
-            if ((i) && (WaitBlock.Flags & EX_PUSH_LOCK_WAITING))
+            if ((i) && (WaitBlock->Flags & EX_PUSH_LOCK_WAITING))
             {
                 /* Spin */
                 while (--i) YieldProcessor();
             }
 
             /* Now try to remove the wait bit */
-            if (InterlockedBitTestAndReset(&WaitBlock.Flags, 1))
+            if (InterlockedBitTestAndReset(&WaitBlock->Flags, 1))
             {
                 /* Fast-path did not work, we need to do a full wait */
-                KeWaitForGate(&WaitBlock.WakeGate, WrPushLock, KernelMode);
-                ASSERT(WaitBlock.Signaled);
+                KeWaitForGate(&WaitBlock->WakeGate, WrPushLock, KernelMode);
+                ASSERT(WaitBlock->Signaled);
             }
 
             /* We shouldn't be shared anymore */
-            ASSERT((WaitBlock.ShareCount == 0));
+            ASSERT((WaitBlock->ShareCount == 0));
         }
     }
 }
@@ -1004,7 +1039,7 @@ VOID
 FASTCALL
 ExfReleasePushLockExclusive(PEX_PUSH_LOCK PushLock)
 {
-    EX_PUSH_LOCK NewValue;
+    EX_PUSH_LOCK NewValue, WakeValue;
     EX_PUSH_LOCK OldValue = *PushLock;
 
     /* Loop until we can change */
@@ -1024,7 +1059,8 @@ ExfReleasePushLockExclusive(PEX_PUSH_LOCK PushLock)
             /* Sanity check */
             ASSERT(NewValue.Waking && !NewValue.Locked);
 
-            /* Write the New Value */
+            /* Write the New Value. Save our original value for waking */
+            WakeValue = NewValue;
             NewValue.Ptr = InterlockedCompareExchangePointer(PushLock,
                                                              NewValue.Ptr,
                                                              OldValue.Ptr);
@@ -1032,14 +1068,10 @@ ExfReleasePushLockExclusive(PEX_PUSH_LOCK PushLock)
             /* Check if the value changed behind our back */
             if (NewValue.Value != OldValue.Value)
             {
-                /* Loop again */
-                OldValue = NewValue;
-                continue;
+                /* Wake the Pushlock */
+                ExfWakePushLock(PushLock, WakeValue);
+                break;
             }
-
-            /* Wake the Pushlock */
-            ExfWakePushLock(PushLock, NewValue);
-            break;
         }
         else
         {
@@ -1056,10 +1088,10 @@ ExfReleasePushLockExclusive(PEX_PUSH_LOCK PushLock)
 
             /* Check if the value changed behind our back */
             if (NewValue.Value == OldValue.Value) break;
-
-            /* Loop again */
-            OldValue = NewValue;
         }
+
+        /* Loop again */
+        OldValue = NewValue;
     }
 }
 
@@ -1128,7 +1160,7 @@ ExfUnblockPushLock(PEX_PUSH_LOCK PushLock,
     KIRQL OldIrql = DISPATCH_LEVEL;
 
     /* Get the wait block and erase the previous one */
-    WaitBlock = InterlockedExchangePointer(PushLock->Ptr, 0);
+    WaitBlock = InterlockedExchangePointer(&PushLock->Ptr, NULL);
     if (WaitBlock)
     {
         /* Check if there is a linked pushlock and raise IRQL appropriately */
@@ -1144,7 +1176,7 @@ ExfUnblockPushLock(PEX_PUSH_LOCK PushLock,
             if (InterlockedBitTestAndReset(&WaitBlock->Flags, 1))
             {
                 /* Nobody removed the flag before us, so signal the event */
-                KeSetEventBoostPriority(&WaitBlock->WakeEvent, IO_NO_INCREMENT);
+                KeSetEventBoostPriority(&WaitBlock->WakeEvent, NULL);
             }
 
             /* Check if there was a next block */
@@ -1161,6 +1193,6 @@ ExfUnblockPushLock(PEX_PUSH_LOCK PushLock,
            EX_PUSH_LOCK_FLAGS_WAIT))
     {
         /* Wait for the pushlock to be unblocked */
-        ExTimedWaitForUnblockPushLock(PushLock, CurrentWaitBlock, NULL);
+        ExWaitForUnblockPushLock(PushLock, CurrentWaitBlock);
     }
 }
index bcf3471..f730c7a 100644 (file)
@@ -49,6 +49,36 @@ PVOID ExpNlsSectionPointer;
 #define ExRundownCompleted                              _ExRundownCompleted
 #define ExGetPreviousMode                               KeGetPreviousMode
 
+//
+// Detect GCC 4.1.2+
+//
+#if (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) < 40102
+
+//
+// Broken GCC with Alignment Bug. We'll do alignment ourselves at higher cost.
+//
+#define DEFINE_WAIT_BLOCK(x)                                \
+    struct _AlignHack                                       \
+    {                                                       \
+        UCHAR Hack[15];                                     \
+        EX_PUSH_LOCK_WAIT_BLOCK UnalignedBlock;             \
+    } WaitBlockBuffer;                                      \
+    PEX_PUSH_LOCK_WAIT_BLOCK x = (PEX_PUSH_LOCK_WAIT_BLOCK) \
+        ((ULONG_PTR)&WaitBlockBuffer.UnalignedBlock &~ 0xF);
+        
+#else
+
+//
+// This is only for compatibility; the compiler will optimize the extra
+// local variable (the actual pointer) away, so we don't take any perf hit
+// by doing this.
+//
+#define DEFINE_WAIT_BLOCK(x)                                \
+    EX_PUSH_LOCK_WAIT_BLOCK WaitBlockBuffer;                \
+    PEX_PUSH_LOCK_WAIT_BLOCK x = &WaitBlockBuffer;
+    
+#endif
+
 /* INITIALIZATION FUNCTIONS *************************************************/
 
 VOID
@@ -498,6 +528,23 @@ _ExRundownCompleted(IN PEX_RUNDOWN_REF RunRef)
 
 /* PUSHLOCKS *****************************************************************/
 
+/* FIXME: VERIFY THESE! */
+
+VOID
+FASTCALL
+ExBlockPushLock(PEX_PUSH_LOCK PushLock,
+                PVOID WaitBlock);
+
+VOID
+FASTCALL
+ExfUnblockPushLock(PEX_PUSH_LOCK PushLock,
+                   PVOID CurrentWaitBlock);
+
+VOID
+FASTCALL
+ExWaitForUnblockPushLock(IN PEX_PUSH_LOCK PushLock,
+                         IN PEX_PUSH_LOCK_WAIT_BLOCK WaitBlock);
+
 /*++
  * @name ExInitializePushLock
  * INTERNAL MACRO
@@ -653,12 +700,16 @@ VOID
 FORCEINLINE
 ExWaitOnPushLock(PEX_PUSH_LOCK PushLock)
 {
-    /* Acquire the lock */
-    ExfAcquirePushLockExclusive(PushLock);
-    ASSERT(PushLock->Locked);
+    /* Check if we're locked */
+    if (PushLock->Locked)
+    {
+        /* Acquire the lock */
+        ExfAcquirePushLockExclusive(PushLock);
+        ASSERT(PushLock->Locked);
 
-    /* Release it */
-    ExfReleasePushLockExclusive(PushLock);
+        /* Release it */
+        ExfReleasePushLockExclusive(PushLock);
+    }
 }
 
 /*++