Fix bugcheck code and make debugging easier for unhandled exceptions/spinlocks. fixg a race condition with tab+b, fix irql to be high_level, fix calling unsafe function by caching bugcode data, fix support for smp by using IPI, fix not-breakpointing when no debugger is there, implement KeBugCheck callbacks with Reason, fix callbacks not being called, fix proper breakpoint during bugcheck, fix errenous assert, merge with 13774.
Modified: branches/alex_devel_branch/reactos/Makefile
Modified: branches/alex_devel_branch/reactos/boot/freeldr/bootsect/Makefile
Modified: branches/alex_devel_branch/reactos/boot/freeldr/fdebug/Makefile
Modified: branches/alex_devel_branch/reactos/boot/freeldr/freeldr/Makefile
Modified: branches/alex_devel_branch/reactos/boot/freeldr/install/Makefile
Modified: branches/alex_devel_branch/reactos/boot/freeldr/tools/Makefile
Modified: branches/alex_devel_branch/reactos/bootdata/hivesys.inf
Modified: branches/alex_devel_branch/reactos/bootdata/packages/reactos.dff
Modified: branches/alex_devel_branch/reactos/drivers/video/videoprt/videoprt.c
Modified: branches/alex_devel_branch/reactos/hal/halx86/generic/display.c
Modified: branches/alex_devel_branch/reactos/include/ddk/fsfuncs.h
Modified: branches/alex_devel_branch/reactos/include/ntos/zwtypes.h
Modified: branches/alex_devel_branch/reactos/lib/cpl/desk/de.rc
Modified: branches/alex_devel_branch/reactos/lib/crt/conio/ungetch.c
Modified: branches/alex_devel_branch/reactos/lib/crt/makefile
Modified: branches/alex_devel_branch/reactos/lib/crt/stdio/fopen.c
Modified: branches/alex_devel_branch/reactos/lib/crt/stdio/fprintf.c
Added: branches/alex_devel_branch/reactos/lib/crt/stdio/fwprintf.c
Added: branches/alex_devel_branch/reactos/lib/crt/stdio/wfopen.c
Modified: branches/alex_devel_branch/reactos/ntoskrnl/ex/init.c
Modified: branches/alex_devel_branch/reactos/ntoskrnl/ex/sysinfo.c
Modified: branches/alex_devel_branch/reactos/ntoskrnl/fs/notify.c
Modified: branches/alex_devel_branch/reactos/ntoskrnl/include/internal/ifs.h
Modified: branches/alex_devel_branch/reactos/ntoskrnl/include/internal/ke.h
Modified: branches/alex_devel_branch/reactos/ntoskrnl/io/iomgr.c
Modified: branches/alex_devel_branch/reactos/ntoskrnl/kd/kdebug.c
Modified: branches/alex_devel_branch/reactos/ntoskrnl/ke/apc.c
Modified: branches/alex_devel_branch/reactos/ntoskrnl/ke/bug.c
Modified: branches/alex_devel_branch/reactos/ntoskrnl/ke/catch.c
Modified: branches/alex_devel_branch/reactos/ntoskrnl/ke/i386/brkpoint.c
Modified: branches/alex_devel_branch/reactos/ntoskrnl/ke/i386/kernel.c
Modified: branches/alex_devel_branch/reactos/ntoskrnl/ke/spinlock.c
Modified: branches/alex_devel_branch/reactos/ntoskrnl/ke/wait.c
Modified: branches/alex_devel_branch/reactos/ntoskrnl/ntoskrnl.mc
Modified: branches/alex_devel_branch/reactos/ntoskrnl/ob/handle.c
Deleted: branches/alex_devel_branch/reactos/subsys/system/regedt32/
Added: branches/alex_devel_branch/reactos/subsys/system/sndvol32/De.rc
Modified: branches/alex_devel_branch/reactos/subsys/system/sndvol32/sndvol32.rc
Modified: branches/alex_devel_branch/reactos/subsys/system/taskmgr/De.rc
Modified: branches/alex_devel_branch/reactos/subsys/system/vmwinst/De.rc
Modified: branches/alex_devel_branch/reactos/subsys/system/winlogon/De.rc

Modified: branches/alex_devel_branch/reactos/Makefile
--- branches/alex_devel_branch/reactos/Makefile	2005-03-01 22:56:51 UTC (rev 13792)
+++ branches/alex_devel_branch/reactos/Makefile	2005-03-02 02:55:16 UTC (rev 13793)
@@ -103,7 +103,7 @@
 
 # System applications
 # autochk cmd format services setup usetup welcome winlogon msiexec 
-SYS_APPS = autochk calc cmd explorer expand format ibrowser msiexec regedt32 regsvr32 \
+SYS_APPS = autochk calc cmd explorer expand format ibrowser msiexec regsvr32 \
   reporterror services setup taskmgr userinit usetup welcome vmwinst rundll32 \
   winlogon regedit winefile notepad reactos lsass
 

Modified: branches/alex_devel_branch/reactos/boot/freeldr/bootsect/Makefile
--- branches/alex_devel_branch/reactos/boot/freeldr/bootsect/Makefile	2005-03-01 22:56:51 UTC (rev 13792)
+++ branches/alex_devel_branch/reactos/boot/freeldr/bootsect/Makefile	2005-03-02 02:55:16 UTC (rev 13793)
@@ -32,26 +32,26 @@
 	@$(MAKE) --no-print-directory -C $(FREELDR_TOOLS_PATH)
 
 dosmbr.bin : dosmbr.asm
-	@echo ===================================================== Assembling dosmbr
+	@echo freeldr: Assembling dosmbr
 	@$(NASM_CMD) $(NFLAGS) -o dosmbr.bin -f bin dosmbr.asm
 
 fat.bin : fat.asm $(BIN2C)
-	@echo ===================================================== Assembling fat
+	@echo freeldr: Assembling fat
 	@$(NASM_CMD) $(NFLAGS) -o fat.bin -f bin fat.asm
 	@$(BIN2C) fat.bin fat.h fat_data
 
 
 fat32.bin : fat32.asm $(BIN2C)
-	@echo ===================================================== Assembling fat32
+	@echo freeldr: Assembling fat32
 	@$(NASM_CMD) $(NFLAGS) -o fat32.bin -f bin fat32.asm
 	@$(BIN2C) fat32.bin fat32.h fat32_data
 
 isoboot.bin : isoboot.asm
-	@echo ===================================================== Assembling isoboot
+	@echo freeldr: Assembling isoboot
 	@$(NASM_CMD) $(NFLAGS) -o isoboot.bin -f bin isoboot.asm
 
 ext2.bin : ext2.asm
-	@echo ===================================================== Assembling ext2
+	@echo freeldr: Assembling ext2
 	@$(NASM_CMD) $(NFLAGS) -o ext2.bin -f bin ext2.asm
 	@$(BIN2C) ext2.bin ext2.h ext2_data
 
@@ -77,4 +77,4 @@
 clean:
 	@-$(RM) *.bin
 	@-$(RM) *.h
-	@echo Clean ALL done.
+	@echo freeldr: Clean ALL done.

Modified: branches/alex_devel_branch/reactos/boot/freeldr/fdebug/Makefile
--- branches/alex_devel_branch/reactos/boot/freeldr/fdebug/Makefile	2005-03-01 22:56:51 UTC (rev 13792)
+++ branches/alex_devel_branch/reactos/boot/freeldr/fdebug/Makefile	2005-03-02 02:55:16 UTC (rev 13793)
@@ -30,23 +30,23 @@
 all: fdebug.exe
 
 fdebug.exe: $(OBJS)
-	@echo ===================================================== LINKING fdebug
+	@echo freeldr: LINKING fdebug
 	$(CC) $(FLAGS) -o fdebug.exe $(OBJS) -lgdi32 -lcomdlg32 -Wl,--subsystem,windows
 
 fdebug.res: fdebug.rc resource.h
-	@echo ===================================================== Compiling $*
+	@echo freeldr: Compiling $*
 	$(RC) -o fdebug.res fdebug.rc -O coff
 
 fdebug.o: fdebug.c rs232.h
-	@echo ===================================================== Compiling $*
+	@echo freeldr: Compiling $*
 	$(CC) $(FLAGS) -o fdebug.o -c fdebug.c
 
 rs232.o: rs232.c rs232.h
-	@echo ===================================================== Compiling $*
+	@echo freeldr: Compiling $*
 	$(CC) $(FLAGS) -o rs232.o -c rs232.c
 
 clean:
 	@-$(RM) *.o
 	@-$(RM) *.res
 	@-$(RM) *.exe
-	@echo Clean ALL done.
+	@echo freeldr: Clean ALL done.

Modified: branches/alex_devel_branch/reactos/boot/freeldr/freeldr/Makefile
--- branches/alex_devel_branch/reactos/boot/freeldr/freeldr/Makefile	2005-03-01 22:56:51 UTC (rev 13792)
+++ branches/alex_devel_branch/reactos/boot/freeldr/freeldr/Makefile	2005-03-02 02:55:16 UTC (rev 13793)
@@ -57,7 +57,7 @@
 	@-$(RM) setupldr.sys
 	@-$(RM) setupldr.map
 	@$(MAKE) --no-print-directory -C $(FREELDR_TOOLS_PATH)
-	@echo Clean ALL done.
+	@echo freeldr: Clean ALL done.
 
 #############################################
 
@@ -259,11 +259,11 @@
 
 
 all : freeldr.sys setupldr.sys
-	@echo Make ALL done.
+	@echo freeldr: Make ALL done.
 
 
 freeldr.sys : $(ALL_OBJS) $(PATH_TO_TOP)/dk/w32/lib/librossym.a
-	@echo ===================================================== LINKING $@
+	@echo freeldr: LINKING $@
 	@$(LD) $(LFLAGS) -o freeldr.exe $(F_OBJS) $(PATH_TO_TOP)/dk/w32/lib/librossym.a
 ifeq ($(FULL_MAP),yes)
 	@$(OBJDUMP) -d -S freeldr.exe > freeldr.map
@@ -274,7 +274,7 @@
 
 
 setupldr.sys : $(ALL_OBJS)
-	@echo ===================================================== LINKING $@
+	@echo freeldr: LINKING $@
 	@$(LD) $(LFLAGS) -Map setupldr.map -o setupldr.exe $(S_OBJS)
 ifeq ($(FULL_MAP),yes)
 	@$(OBJDUMP) -d -S setupldr.exe > setupldr.map
@@ -285,15 +285,15 @@
 
 
 %.o :: %.c
-	@echo ===================================================== Compiling $*
+	@echo freeldr: Compiling $*
 	@$(CC) $(CFLAGS) -o $@ -c $<
 	@$(DEPTOOL) $*.d
 
 %.o :: %.S
-	@echo ===================================================== Assembling $*
+	@echo freeldr: Assembling $*
 	@$(CC) $(CFLAGS) -o $@ -c $<
 	@$(DEPTOOL) $*.d
 
 %.o :: %.asm
-	@echo ===================================================== Assembling $*
+	@echo freeldr: Assembling $*
 	@$(NASM_CMD) $(NASMFLAGS) -o $@ $<

Modified: branches/alex_devel_branch/reactos/boot/freeldr/install/Makefile
--- branches/alex_devel_branch/reactos/boot/freeldr/install/Makefile	2005-03-01 22:56:51 UTC (rev 13792)
+++ branches/alex_devel_branch/reactos/boot/freeldr/install/Makefile	2005-03-02 02:55:16 UTC (rev 13793)
@@ -35,18 +35,18 @@
 	@$(MAKE) --no-print-directory -C ../bootsect
 
 install.exe: $(OBJS)
-	@echo ===================================================== LINKING install
+	@echo freeldr: LINKING install
 	$(CC) $(FLAGS) -o install.exe $(OBJS)
 
 install.o: install.c install.h volume.h
-	@echo ===================================================== Compiling $*
+	@echo freeldr: Compiling $*
 	$(CC) $(FLAGS) -o install.o -c install.c
 
 volume.o: volume.c volume.h install.h
-	@echo ===================================================== Compiling $*
+	@echo freeldr: Compiling $*
 	$(CC) $(FLAGS) -o volume.o -c volume.c
 
 clean:
 	@-$(RM) *.o
 	@-$(RM) *.exe
-	@echo Clean ALL done.
+	@echo freeldr: Clean ALL done.

Modified: branches/alex_devel_branch/reactos/boot/freeldr/tools/Makefile
--- branches/alex_devel_branch/reactos/boot/freeldr/tools/Makefile	2005-03-01 22:56:51 UTC (rev 13792)
+++ branches/alex_devel_branch/reactos/boot/freeldr/tools/Makefile	2005-03-02 02:55:16 UTC (rev 13793)
@@ -25,16 +25,16 @@
 			bin2c$(EXE_POSTFIX)
 
 all : $(TOOLS)
-	@echo Tools are up to date.
+	@echo freeldr: Tools are up to date.
 
 % :: all
 
 %$(EXE_POSTFIX): %.c
-	@echo ===================================================== Compiling $*
+	@echo freeldr: Compiling $*
 	@$(HOST_CC) -Wall -O3 -o $@ $<
 
 
 .PHONY : clean
 clean:
 	@-$(RM) $(TOOLS)
-	@echo Clean ALL done.
+	@echo freeldr: Clean ALL done.

Modified: branches/alex_devel_branch/reactos/bootdata/hivesys.inf
--- branches/alex_devel_branch/reactos/bootdata/hivesys.inf	2005-03-01 22:56:51 UTC (rev 13792)
+++ branches/alex_devel_branch/reactos/bootdata/hivesys.inf	2005-03-02 02:55:16 UTC (rev 13793)
@@ -257,10 +257,10 @@
 ; Subsystems
 HKLM,"SYSTEM\CurrentControlSet\Control\Session Manager\Subsystems","Debug",0x00020000,""
 HKLM,"SYSTEM\CurrentControlSet\Control\Session Manager\Subsystems","Kmode",0x00020000,"%SystemRoot%\system32\win32k.sys"
-HKLM,"SYSTEM\CurrentControlSet\Control\Session Manager\Subsystems","Optional",0x00070000,"Posix Os2"
+HKLM,"SYSTEM\CurrentControlSet\Control\Session Manager\Subsystems","Optional",0x00070001,50,00,6f,00,73,00,69,00,78,00,00,00,4f,00,73,00,32,00,00,00,00,00
 HKLM,"SYSTEM\CurrentControlSet\Control\Session Manager\Subsystems","Os2",0x00020000,"%SystemRoot%\system32\os2ss.exe"
 HKLM,"SYSTEM\CurrentControlSet\Control\Session Manager\Subsystems","Posix",0x00020000,"%SystemRoot%\system32\psxss.exe"
-HKLM,"SYSTEM\CurrentControlSet\Control\Session Manager\Subsystems","Required",0x00070000,"Debug Windows"
+HKLM,"SYSTEM\CurrentControlSet\Control\Session Manager\Subsystems","Required",0x00070001,44,00,65,00,62,00,75,00,67,00,00,00,57,00,69,00,6e,00,64,00,6f,00,77,00,73,00,00,00,00,00
 HKLM,"SYSTEM\CurrentControlSet\Control\Session Manager\Subsystems","Windows",0x00020000,"%SystemRoot%\system32\csrss.exe"
 
 ; 3Com 3c905 Driver

Modified: branches/alex_devel_branch/reactos/bootdata/packages/reactos.dff
--- branches/alex_devel_branch/reactos/bootdata/packages/reactos.dff	2005-03-01 22:56:51 UTC (rev 13792)
+++ branches/alex_devel_branch/reactos/bootdata/packages/reactos.dff	2005-03-02 02:55:16 UTC (rev 13793)
@@ -149,7 +149,6 @@
 subsys\system\format\format.exe         1
 subsys\system\notepad\notepad.exe       1
 subsys\system\regedit\regedit.exe       4
-subsys\system\regedt32\regedt32.exe     1
 subsys\system\regsvr32\regsvr32.exe     1
 subsys\system\reporterror\reporterror.exe 1
 subsys\system\rundll32\rundll32.exe     1

Modified: branches/alex_devel_branch/reactos/drivers/video/videoprt/videoprt.c
--- branches/alex_devel_branch/reactos/drivers/video/videoprt/videoprt.c	2005-03-01 22:56:51 UTC (rev 13792)
+++ branches/alex_devel_branch/reactos/drivers/video/videoprt/videoprt.c	2005-03-02 02:55:16 UTC (rev 13793)
@@ -492,7 +492,7 @@
 
 VOID FASTCALL 
 IntAttachToCSRSS(PEPROCESS *CallingProcess, PEPROCESS *PrevAttachedProcess) 
-{ 
+{    
    *CallingProcess = PsGetCurrentProcess(); 
    if (*CallingProcess != Csrss) 
    { 

Modified: branches/alex_devel_branch/reactos/hal/halx86/generic/display.c
--- branches/alex_devel_branch/reactos/hal/halx86/generic/display.c	2005-03-01 22:56:51 UTC (rev 13792)
+++ branches/alex_devel_branch/reactos/hal/halx86/generic/display.c	2005-03-02 02:55:16 UTC (rev 13793)
@@ -502,7 +502,7 @@
       HalWriteGc(0x05, 0x00); /* Write mode 0; read mode 0. */
       HalWriteGc(0x06, 0x05); /* Set graphics. */
       memcpy(GraphVideoBuffer, SavedTextFont[i], FONT_AMOUNT);
-    }
+  }
 
   HalBlankScreen(TRUE);
 
@@ -519,6 +519,7 @@
   HalWriteSeq(0x04, Seq4);
 }
 
+
 VOID STATIC
 HalRestoreMode(VOID)
 {
@@ -628,7 +629,6 @@
     }
 }
 
-
 /* PUBLIC FUNCTIONS *********************************************************/
 
 VOID STDCALL
@@ -637,6 +637,7 @@
  * FUNCTION: Release ownership of display back to HAL
  */
 {
+
   if (HalResetDisplayParameters == NULL)
     return;
 
@@ -645,12 +646,14 @@
 
   if (!HalResetDisplayParameters(SizeX, SizeY))
     {
+
       HalRestoreMode();
       HalRestoreFont();
-      HalRestorePalette();
+      HalRestorePalette();                
     }
   HalOwnsDisplay = TRUE;
   HalClearDisplay(CHAR_ATTRIBUTE);
+
 }
 
 

Modified: branches/alex_devel_branch/reactos/include/ddk/fsfuncs.h
--- branches/alex_devel_branch/reactos/include/ddk/fsfuncs.h	2005-03-01 22:56:51 UTC (rev 13792)
+++ branches/alex_devel_branch/reactos/include/ddk/fsfuncs.h	2005-03-02 02:55:16 UTC (rev 13793)
@@ -617,7 +617,7 @@
 	);
 
 VOID STDCALL
-FsRtlNotifyInitializeSync(IN OUT PNOTIFY_SYNC NotifySync);
+FsRtlNotifyInitializeSync(IN OUT PNOTIFY_SYNC *NotifySync);
 
 NTSTATUS STDCALL
 FsRtlNotifyVolumeEvent(IN PFILE_OBJECT FileObject,

Modified: branches/alex_devel_branch/reactos/include/ntos/zwtypes.h
--- branches/alex_devel_branch/reactos/include/ntos/zwtypes.h	2005-03-01 22:56:51 UTC (rev 13792)
+++ branches/alex_devel_branch/reactos/include/ntos/zwtypes.h	2005-03-02 02:55:16 UTC (rev 13793)
@@ -1102,10 +1102,11 @@
 */
 
 typedef struct _FILE_NOTIFY_INFORMATION {
-	ULONG Action;
-	ULONG FileNameLength;
-	WCHAR FileName[0]; 
-} FILE_NOTIFY_INFORMATION;
+   ULONG NextEntryOffset;
+   ULONG Action;
+   ULONG NameLength;
+   WCHAR Name[1];
+} FILE_NOTIFY_INFORMATION, *PFILE_NOTIFY_INFORMATION;
 
 #define FSCTL_GET_VOLUME_BITMAP			0x9006F
 #define FSCTL_GET_RETRIEVAL_POINTERS		0x90073

Modified: branches/alex_devel_branch/reactos/lib/cpl/desk/de.rc
--- branches/alex_devel_branch/reactos/lib/cpl/desk/de.rc	2005-03-01 22:56:51 UTC (rev 13792)
+++ branches/alex_devel_branch/reactos/lib/cpl/desk/de.rc	2005-03-02 02:55:16 UTC (rev 13793)
@@ -49,10 +49,10 @@
 STRINGTABLE
 BEGIN
     IDS_CPLNAME "Anzeige"
-    IDS_CPLDESCRIPTION "Passt die Darstellung des Hintergrundbildes und des Bildschrimschoners an."
+    IDS_CPLDESCRIPTION "Passt die Darstellung des Hintergrundbildes und des Bildschirmschoners an."
 
     IDS_NONE "(Keine)"
     IDS_CENTER "Zentriert"
     IDS_STRETCH "Gestreckt"
-    IDS_TILE "Nebeneinnander"
+    IDS_TILE "Nebeneinander"
 END

Modified: branches/alex_devel_branch/reactos/lib/crt/conio/ungetch.c
--- branches/alex_devel_branch/reactos/lib/crt/conio/ungetch.c	2005-03-01 22:56:51 UTC (rev 13792)
+++ branches/alex_devel_branch/reactos/lib/crt/conio/ungetch.c	2005-03-02 02:55:16 UTC (rev 13793)
@@ -10,11 +10,12 @@
  *              28/12/98: Created
  */
 
+#include <stdio.h>
 #include <conio.h>
 #include <internal/console.h>
 
-#define EOF -1
 
+
 int char_avail = 0;
 int ungot_char = 0;
 

Modified: branches/alex_devel_branch/reactos/lib/crt/makefile
--- branches/alex_devel_branch/reactos/lib/crt/makefile	2005-03-01 22:56:51 UTC (rev 13792)
+++ branches/alex_devel_branch/reactos/lib/crt/makefile	2005-03-02 02:55:16 UTC (rev 13793)
@@ -274,7 +274,9 @@
 	stdio/fileno.o \
 	stdio/flsbuf.o \
 	stdio/fopen.o \
+	stdio/wfopen.o \
 	stdio/fprintf.o \
+	stdio/fwprintf.o \
 	stdio/fputc.o \
 	stdio/fputchar.o \
 	stdio/fputs.o \

Modified: branches/alex_devel_branch/reactos/lib/crt/stdio/fopen.c
--- branches/alex_devel_branch/reactos/lib/crt/stdio/fopen.c	2005-03-01 22:56:51 UTC (rev 13792)
+++ branches/alex_devel_branch/reactos/lib/crt/stdio/fopen.c	2005-03-02 02:55:16 UTC (rev 13793)
@@ -30,13 +30,14 @@
 #include <string.h>
 #include <io.h>
 #include <fcntl.h>
+#include <tchar.h>
 #include <internal/file.h>
 
 //might change fopen(file,mode) -> fsopen(file,mode,_SH_DENYNO);
 
 
 
-FILE* fopen(const char *file, const char *mode)
+FILE* _tfopen(const _TCHAR *file, const _TCHAR *mode)
 {
   FILE *f;
   int fd, rw, oflags = 0;
@@ -50,28 +51,28 @@
   if (f == NULL)
     return NULL;
 
-  rw = (strchr(mode, '+') == NULL) ? 0 : 1;
-  if (strchr(mode, 'a'))
+  rw = (_tcschr(mode, '+') == NULL) ? 0 : 1;
+  if (_tcschr(mode, 'a'))
     oflags = O_CREAT | (rw ? O_RDWR : O_WRONLY);
-  if (strchr(mode, 'r'))
+  if (_tcschr(mode, 'r'))
     oflags = rw ? O_RDWR : O_RDONLY;
-  if (strchr(mode, 'w'))
+  if (_tcschr(mode, 'w'))
     oflags = O_TRUNC | O_CREAT | (rw ? O_RDWR : O_WRONLY);
-  if (strchr(mode, 't'))
+  if (_tcschr(mode, 't'))
     oflags |= O_TEXT;
-  else if (strchr(mode, 'b'))
+  else if (_tcschr(mode, 'b'))
     oflags |= O_BINARY;
   else
     oflags |= (_fmode& (O_TEXT|O_BINARY));
 
-  fd = _open(file, oflags, 0);
+  fd = _topen(file, oflags, 0);
   if (fd < 0)
     return NULL;
 
 // msvcrt ensures that writes will end up at the end of file in append mode
 // we just move the file pointer to the end of file initially
 
-  if (strchr(mode, 'a'))
+  if (_tcschr(mode, 'a'))
     _lseek(fd, 0, SEEK_END);
 
   f->_cnt = 0;
@@ -79,14 +80,14 @@
   f->_bufsiz = 0;
   if (rw)
     f->_flag = _IOREAD | _IOWRT;
-  else if (strchr(mode, 'r'))
+  else if (_tcschr(mode, 'r'))
     f->_flag = _IOREAD;
   else
     f->_flag = _IOWRT;
 
-  if (strchr(mode, 't'))
+  if (_tcschr(mode, 't'))
     f->_flag |= _IOTEXT;
-  else if (strchr(mode, 'b'))
+  else if (_tcschr(mode, 'b'))
     f->_flag |= _IOBINARY;
   else if (_fmode& O_BINARY)
     f->_flag |= _IOBINARY;
@@ -94,64 +95,3 @@
   f->_base = f->_ptr = NULL;
   return f;
 }
-
-/*
- * @implemented
- */
-FILE* _wfopen(const wchar_t *file, const wchar_t *mode)
-{
-  FILE *f;
-  int fd, rw, oflags = 0;
-   
-  if (file == 0)
-    return 0;
-  if (mode == 0)
-    return 0;
-
-  f = __alloc_file();
-  if (f == NULL)
-    return NULL;
-
-  rw = (wcschr(mode, L'+') == NULL) ? 0 : 1;
-  if (wcschr(mode, L'a'))
-    oflags = O_CREAT | (rw ? O_RDWR : O_WRONLY);
-  if (wcschr(mode, L'r'))
-    oflags = rw ? O_RDWR : O_RDONLY;
-  if (wcschr(mode, L'w'))
-    oflags = O_TRUNC | O_CREAT | (rw ? O_RDWR : O_WRONLY);
-  if (wcschr(mode, L't'))
-    oflags |= O_TEXT;
-  else if (wcschr(mode, L'b'))
-    oflags |= O_BINARY;
-  else
-    oflags |= (_fmode& (O_TEXT|O_BINARY));
-
-  fd = _wopen(file, oflags, 0);
-  if (fd < 0)
-    return NULL;
-
-// msvcrt ensures that writes will end up at the end of file in append mode
-// we just move the file pointer to the end of file initially
-  if (wcschr(mode, 'a'))
-    _lseek(fd, 0, SEEK_END);
-
-  f->_cnt = 0;
-  f->_file = fd;
-  f->_bufsiz = 0;
-  if (rw)
-    f->_flag = _IOREAD | _IOWRT;
-  else if (wcschr(mode, L'r'))
-    f->_flag = _IOREAD;
-  else
-    f->_flag = _IOWRT;
-
-  if (wcschr(mode, L't'))
-    f->_flag |= _IOTEXT;
-  else if (wcschr(mode, L'b'))
-    f->_flag |= _IOBINARY;
-  else if (_fmode& O_BINARY)
-    f->_flag |= _IOBINARY;
-
-  f->_base = f->_ptr = NULL;
-  return f;
-}

Modified: branches/alex_devel_branch/reactos/lib/crt/stdio/fprintf.c
--- branches/alex_devel_branch/reactos/lib/crt/stdio/fprintf.c	2005-03-01 22:56:51 UTC (rev 13792)
+++ branches/alex_devel_branch/reactos/lib/crt/stdio/fprintf.c	2005-03-02 02:55:16 UTC (rev 13793)
@@ -1,16 +1,17 @@
 /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
 #include <stdio.h>
 #include <wchar.h>
+#include <tchar.h>
 #include <internal/file.h>
 
 /*
  * @implemented
  */
 int
-fprintf(register FILE *iop, const char *fmt, ...)
+_ftprintf(register FILE *iop, const _TCHAR *fmt, ...)
 {
   int len;
-  char localbuf[BUFSIZ];
+  _TCHAR localbuf[BUFSIZ];
   va_list a=0;
   
 
@@ -18,38 +19,9 @@
   if (iop->_flag & _IONBF)
   {
     iop->_flag &= ~_IONBF;
-    iop->_ptr = iop->_base = localbuf;
-    iop->_bufsiz = BUFSIZ;
-    len = vfprintf(iop,fmt,a);
-    fflush(iop);
-    iop->_flag |= _IONBF;
-    iop->_base = NULL;
-    iop->_bufsiz = 0;
-    iop->_cnt = 0;
-  }
-  else
-    len = vfprintf(iop, fmt, a);
-  return ferror(iop) ? EOF : len;
-}
-
-/*
- * @implemented
- */
-int
-fwprintf(register FILE *iop, const wchar_t *fmt, ...)
-{
-  int len;
-  wchar_t localbuf[BUFSIZ];
-  va_list a=0;
-  
-
-  va_start( a, fmt ); 
-  if (iop->_flag & _IONBF)
-  {
-    iop->_flag &= ~_IONBF;
     iop->_ptr = iop->_base = (char *)localbuf;
     iop->_bufsiz = BUFSIZ;
-    len = vfwprintf(iop,fmt,a);
+    len = _vftprintf(iop,fmt,a);
     fflush(iop);
     iop->_flag |= _IONBF;
     iop->_base = NULL;
@@ -57,6 +29,6 @@
     iop->_cnt = 0;
   }
   else
-    len = vfwprintf(iop, fmt, a);
-  return ferror(iop) ? EOF : len;
+    len = _vftprintf(iop, fmt, a);
+  return ferror(iop) ? -1 : len;
 }

Copied: branches/alex_devel_branch/reactos/lib/crt/stdio/fwprintf.c (from rev 13792, trunk/reactos/lib/crt/stdio/fwprintf.c)

Copied: branches/alex_devel_branch/reactos/lib/crt/stdio/wfopen.c (from rev 13792, trunk/reactos/lib/crt/stdio/wfopen.c)

Modified: branches/alex_devel_branch/reactos/ntoskrnl/ex/init.c
--- branches/alex_devel_branch/reactos/ntoskrnl/ex/init.c	2005-03-01 22:56:51 UTC (rev 13792)
+++ branches/alex_devel_branch/reactos/ntoskrnl/ex/init.c	2005-03-02 02:55:16 UTC (rev 13793)
@@ -25,6 +25,7 @@
 extern ULONG_PTR LastKrnlPhysAddr;
 extern ULONG_PTR LastKernelAddress;
 extern LOADER_MODULE KeLoaderModules[64];
+extern PRTL_MESSAGE_RESOURCE_DATA KiBugCodeMessages;
 
 /* FUNCTIONS ****************************************************************/
 
@@ -119,7 +120,7 @@
                                       &ObjectAttributes);
     
     /* Free the String */
-    RtlFreeUnicodeString (&ArcName);
+    RtlFreeUnicodeString(&ArcName);
     
     /* Check for Success */
     if (!NT_SUCCESS(Status)) {
@@ -373,6 +374,9 @@
     LARGE_INTEGER Timeout;
     HANDLE ProcessHandle;
     HANDLE ThreadHandle;
+    PRTL_MESSAGE_RESOURCE_DATA BugCheckData;
+    LDR_RESOURCE_INFO ResourceInfo;
+    PIMAGE_RESOURCE_DATA_ENTRY ResourceDataEntry;
     NTSTATUS Status;
 
     /* Check if the structures match the ASM offset constants */
@@ -410,6 +414,36 @@
     /* Bring back the IRQL to Passive */
     KeLowerIrql(PASSIVE_LEVEL);
     
+    /* Cache the Bugcheck Message Strings. Prepare the Lookup Data */
+    ResourceInfo.Type = 11;
+    ResourceInfo.Name = 1;
+    ResourceInfo.Language = 9;
+    
+    /* Do the lookup. Note that NTOSKRNL must be the first module! */
+    Status = LdrFindResource_U((PVOID)KeLoaderModules[0].ModStart,
+                               &ResourceInfo,
+                               RESOURCE_DATA_LEVEL,
+                               &ResourceDataEntry);
+    
+    /* Make sure it worked */
+    if (NT_SUCCESS(Status)) {
+        
+        DPRINT1("Found Bugcheck Resource Data!\n");
+        
+        /* Now actually get a pointer to it */
+        Status = LdrAccessResource((PVOID)KeLoaderModules[0].ModStart,
+                                   ResourceDataEntry,
+                                   (PVOID*)&BugCheckData,
+                                   NULL);
+        
+        /* Make sure it worked */
+        if (NT_SUCCESS(Status)) {
+
+            DPRINT1("Got Pointer to Bugcheck Resource Data!\n");
+            KiBugCodeMessages = BugCheckData;
+        }
+    }
+    
     /* Load basic Security for other Managers */
     if (!SeInit1()) KEBUGCHECK(SECURITY_INITIALIZATION_FAILED);
 

Modified: branches/alex_devel_branch/reactos/ntoskrnl/ex/sysinfo.c
--- branches/alex_devel_branch/reactos/ntoskrnl/ex/sysinfo.c	2005-03-01 22:56:51 UTC (rev 13792)
+++ branches/alex_devel_branch/reactos/ntoskrnl/ex/sysinfo.c	2005-03-02 02:55:16 UTC (rev 13793)
@@ -825,13 +825,111 @@
 	return (STATUS_NOT_IMPLEMENTED);
 }
 
+
+VOID
+ObpGetNextHandleByProcessCount(PSYSTEM_HANDLE_TABLE_ENTRY_INFO pshi,
+                               PEPROCESS Process,
+                               int Count);
+
 /* Class 16 - Handle Information */
 QSI_DEF(SystemHandleInformation)
 {
-	/* FIXME */
-	DPRINT1("NtQuerySystemInformation - SystemHandleInformation not implemented\n");
-	return (STATUS_NOT_IMPLEMENTED);
+
+        PSYSTEM_HANDLE_INFORMATION Shi = 
+        	(PSYSTEM_HANDLE_INFORMATION) Buffer;
+
+        DPRINT("NtQuerySystemInformation - SystemHandleInformation\n");
+
+	if (Size < sizeof (SYSTEM_HANDLE_INFORMATION))
+        {
+		* ReqSize = sizeof (SYSTEM_HANDLE_INFORMATION);
+		return (STATUS_INFO_LENGTH_MISMATCH);
+	}
+
+	DPRINT("SystemHandleInformation 1\n");
+
+	PEPROCESS pr, syspr;
+	int curSize, i = 0;
+	ULONG hCount = 0;
+		
+        /* First Calc Size from Count. */
+        syspr = PsGetNextProcess(NULL);
+	pr = syspr;
+
+        do
+	  {
+            hCount = hCount + ObpGetHandleCountByHandleTable(&pr->HandleTable);
+
+            curSize = sizeof(SYSTEM_HANDLE_INFORMATION)+
+                        (  (sizeof(SYSTEM_HANDLE_TABLE_ENTRY_INFO) * hCount) - 
+                           (sizeof(SYSTEM_HANDLE_TABLE_ENTRY_INFO) ));
+
+            Shi->NumberOfHandles = hCount;
+
+           if (curSize > Size)
+             {
+               DPRINT1("SystemHandleInformation 2\n");
+               *ReqSize = curSize;
+               if (pr != NULL)
+	         {
+	            ObDereferenceObject(pr);
+	         }
+               return (STATUS_INFO_LENGTH_MISMATCH);
+             }
+
+	    pr = PsGetNextProcess(pr);
+
+	    if ((pr == syspr) || (pr == NULL))
+		break;
+        } while ((pr != syspr) && (pr != NULL));
+
+	if (pr != NULL)
+	  {
+	    ObDereferenceObject(pr);
+	  }
+
+	DPRINT("SystemHandleInformation 3\n");
+
+        /* Now get Handles from all processs. */
+        syspr = PsGetNextProcess(NULL);
+	pr = syspr;
+
+	 do
+	  {
+            int Count = 0, HandleCount = 0;
+
+            HandleCount = ObpGetHandleCountByHandleTable(&pr->HandleTable);
+
+            for (Count = 0; HandleCount > 0 ; HandleCount--)
+               {
+                 ObpGetNextHandleByProcessCount( &Shi->Handles[i], pr, Count);
+                 Count++;
+                 i++;
+               }
+
+	    pr = PsGetNextProcess(pr);
+
+	    if ((pr == syspr) || (pr == NULL))
+		break;
+	   } while ((pr != syspr) && (pr != NULL));
+
+
+	if (pr != NULL)
+	  {
+	    ObDereferenceObject(pr);
+	  }
+
+	DPRINT("SystemHandleInformation 4\n");
+	return (STATUS_SUCCESS);
+
 }
+/*
+SSI_DEF(SystemHandleInformation)
+{
+	
+	return (STATUS_SUCCESS);
+}
+*/
 
 /* Class 17 -  Information */
 QSI_DEF(SystemObjectInformation)

Modified: branches/alex_devel_branch/reactos/ntoskrnl/fs/notify.c
--- branches/alex_devel_branch/reactos/ntoskrnl/fs/notify.c	2005-03-01 22:56:51 UTC (rev 13792)
+++ branches/alex_devel_branch/reactos/ntoskrnl/fs/notify.c	2005-03-02 02:55:16 UTC (rev 13793)
@@ -5,14 +5,141 @@
  * FILE:            ntoskrnl/fs/notify.c
  * PURPOSE:         No purpose listed.
  *
- * PROGRAMMERS:     No programmer listed.
+ * PROGRAMMERS:     Gunnar Dalsnes
  */
 
 #include <ntoskrnl.h>
-#define NDEBUG
+
+//#define NDEBUG
 #include <internal/debug.h>
 
+
+PAGED_LOOKASIDE_LIST    NotifyEntryLookaside;
+
+#define FSRTL_NOTIFY_TAG TAG('N','O','T','I')
+
+typedef struct _NOTIFY_ENTRY
+{
+   LIST_ENTRY ListEntry;
+   PSTRING FullDirectoryName;
+   BOOLEAN WatchTree;
+   BOOLEAN IgnoreBuffer;
+   BOOLEAN PendingChanges;
+   ULONG CompletionFilter;
+   LIST_ENTRY IrpQueue;
+   PVOID Fcb;
+   PCHECK_FOR_TRAVERSE_ACCESS TraverseCallback;
+   PSECURITY_SUBJECT_CONTEXT SubjectContext;
+   PVOID FsContext;
+   BOOLEAN Unicode;
+   BOOLEAN BufferExhausted;
+   PVOID Buffer; /* Buffer == NULL equals IgnoreBuffer == TRUE */
+   ULONG BufferSize;   
+   ULONG NextEntryOffset;   
+   PFILE_NOTIFY_INFORMATION PrevEntry;
+} NOTIFY_ENTRY, *PNOTIFY_ENTRY;
+
+
 /**********************************************************************
+ * NAME                    PRIVATE
+ * FsRtlpInitNotifyImplementation
+ *
+ */
+VOID
+STDCALL INIT_FUNCTION
+FsRtlpInitNotifyImplementation(VOID)
+{
+   ExInitializePagedLookasideList( &NotifyEntryLookaside,
+                                    NULL,
+                                    NULL,
+                                    0,
+                                    sizeof(NOTIFY_ENTRY),
+                                    FSRTL_NOTIFY_TAG,
+                                    0
+                                    );
+
+   
+}
+
+
+
+static
+inline
+BOOLEAN
+FsRtlpIsUnicodePath(
+   PSTRING Path
+   )
+{
+   ASSERT(Path->Length);
+   
+   if (Path->Length == 1) return FALSE; 
+    
+   if (*(WCHAR*)Path->Buffer == '\\') return TRUE;
+   
+   return FALSE;
+}
+
+
+/**********************************************************************
+ * NAME                    PRIVATE
+ * FsRtlpNotifyCancelRoutine
+ *
+ */
+static
+VOID
+STDCALL 
+FsRtlpNotifyCancelRoutine(
+   IN PDEVICE_OBJECT DeviceObject, 
+   IN PIRP Irp
+   )
+{
+   PFAST_MUTEX Lock;
+
+   //don't need this since we have our own sync. protecting irp cancellation
+   IoReleaseCancelSpinLock(Irp->CancelIrql); 
+
+   Lock = (PFAST_MUTEX)Irp->Tail.Overlay.DriverContext[3];
+
+   ExAcquireFastMutex(Lock );
+   
+   RemoveEntryList(&Irp->Tail.Overlay.ListEntry);
+   
+   ExReleaseFastMutex(Lock);
+
+   Irp->IoStatus.Status = STATUS_CANCELLED;
+   Irp->IoStatus.Information = 0;
+
+   IoCompleteRequest(Irp, IO_NO_INCREMENT);
+   
+}
+
+
+
+static
+PNOTIFY_ENTRY
+FASTCALL
+FsRtlpFindNotifyEntry(
+   PLIST_ENTRY NotifyList,
+   PVOID FsContext
+   )
+{
+   PLIST_ENTRY EnumEntry;
+   PNOTIFY_ENTRY NotifyEntry;
+   
+   LIST_FOR_EACH(EnumEntry, NotifyList)
+   {
+      NotifyEntry = CONTAINING_RECORD(EnumEntry, NOTIFY_ENTRY, ListEntry);
+      
+      if (NotifyEntry->FsContext == FsContext)
+      {
+         return NotifyEntry;
+      }
+   }
+
+   return NULL;   
+}
+
+/**********************************************************************
  * NAME							EXPORTED
  *	FsRtlNotifyChangeDirectory@28
  *
@@ -57,7 +184,8 @@
  *	FsRtlNotifyCleanup@12
  *
  * DESCRIPTION
- *	
+ *	 Called by FSD when all handles to FileObject (identified by FsContext) are closed
+ *
  * ARGUMENTS
  *
  * RETURN VALUE
@@ -72,6 +200,61 @@
 	IN	PVOID		FsContext
 	)
 {
+   PNOTIFY_ENTRY NotifyEntry;
+   LIST_ENTRY CompletedListHead;
+   PLIST_ENTRY TmpEntry;
+   PIRP Irp;
+   
+   InitializeListHead(&CompletedListHead);
+   
+   ExAcquireFastMutex((PFAST_MUTEX)NotifySync);   
+   
+   NotifyEntry = FsRtlpFindNotifyEntry(NotifyList, FsContext);
+   
+   if (NotifyEntry)
+   {
+      /* free buffered changes */
+      if (NotifyEntry->Buffer)
+      {
+         ExFreePool(NotifyEntry->Buffer);
+      }
+
+      /* cancel(?) pending irps */
+      while (!IsListEmpty(&NotifyEntry->IrpQueue))
+      {
+         TmpEntry = RemoveHeadList(&NotifyEntry->IrpQueue);
+         Irp = CONTAINING_RECORD(TmpEntry , IRP, Tail.Overlay.ListEntry);
+
+         /* irp cancelation bolilerplate */
+         if (!IoSetCancelRoutine(Irp, NULL))
+         {  
+            //The cancel routine will be called. When we release the lock it will complete the irp.
+            InitializeListHead(&Irp->Tail.Overlay.ListEntry);
+            continue;
+         }
+
+         Irp->IoStatus.Status = STATUS_NOTIFY_CLEANUP; /* FIXME: correct status? */
+         Irp->IoStatus.Information = 0;
+
+         /* avoid holding lock while completing irp */
+         InsertTailList(&CompletedListHead, &Irp->Tail.Overlay.ListEntry);
+      }
+         
+      /* Unlink and free the NotifyStruct */
+      RemoveEntryList(&NotifyEntry->ListEntry);
+      ExFreeToPagedLookasideList(&NotifyEntryLookaside, NotifyEntry);
+   }
+   
+   ExReleaseFastMutex((PFAST_MUTEX)NotifySync);
+   
+   /* complete defered irps */
+   while (!IsListEmpty(&CompletedListHead)) 
+   {
+      TmpEntry = RemoveHeadList(&CompletedListHead);
+      Irp = CONTAINING_RECORD(TmpEntry , IRP, Tail.Overlay.ListEntry);
+      IoCompleteRequest(Irp, IO_NO_INCREMENT);     
+   }
+   
 }
 
 
@@ -119,6 +302,77 @@
 }
 
 
+
+static
+VOID
[truncated at 1000 lines; 1657 more skipped]