mirror of
https://github.com/ApfelTeeSaft/reactos.git
synced 2026-08-30 19:26:05 +00:00
Merge 13511:13830 from trunk
svn path=/branches/xmlbuildsystem/; revision=13833
This commit is contained in:
+2
-1
@@ -60,7 +60,8 @@ PREAUTO := \
|
||||
include$(SEP)reactos$(SEP)errcodes.h \
|
||||
lib$(SEP)kernel32$(SEP)errcodes.rc
|
||||
|
||||
Makefile.auto: $(RMKDIR_TARGET) $(BUILDNO_TARGET) $(NCI_SERVICE_FILES) $(WMC_TARGET) $(CDMAKE_TARGET) $(RBUILD_TARGET) $(PREAUTO)
|
||||
Makefile.auto: $(RMKDIR_TARGET) $(BUILDNO_TARGET) $(NCI_SERVICE_FILES) $(WMC_TARGET) $(WRC_TARGET) \
|
||||
$(CDMAKE_TARGET) $(RBUILD_TARGET) $(PREAUTO)
|
||||
tools$(SEP)rbuild$(SEP)rbuild$(EXEPOSTFIX) mingw
|
||||
# $(MAKE) $(MAKECMDGOALS)
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ include $(PATH_TO_TOP)/rules.mak
|
||||
|
||||
# Console system utilities
|
||||
# cabman cat net objdir partinfo pice ps sc stats
|
||||
UTIL_APPS = cat objdir partinfo pnpdump sc shutdown stats tickcount consw rundll32 ps
|
||||
UTIL_APPS = cat objdir partinfo pnpdump sc shutdown stats tickcount consw ps
|
||||
|
||||
UTIL_NET_APPS = arp finger ftp ipconfig netstat ping route telnet whois
|
||||
|
||||
|
||||
@@ -32,26 +32,26 @@ $(BIN2C) :
|
||||
@$(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 @@ bootcd_dirs:
|
||||
clean:
|
||||
@-$(RM) *.bin
|
||||
@-$(RM) *.h
|
||||
@echo Clean ALL done.
|
||||
@echo freeldr: Clean ALL done.
|
||||
|
||||
@@ -30,23 +30,23 @@ OBJS = rs232.o fdebug.o fdebug.res
|
||||
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.
|
||||
|
||||
@@ -57,7 +57,7 @@ clean:
|
||||
@-$(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_OBJS = $(COMMON_OBJS) \
|
||||
|
||||
|
||||
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 @@ endif
|
||||
|
||||
|
||||
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 @@ endif
|
||||
|
||||
|
||||
%.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 $@ $<
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* FILE: boot/freeldr/freeldr/multiboot.c
|
||||
* PURPOSE: ReactOS Loader
|
||||
* PROGRAMMERS: Alex Ionescu ([email protected])
|
||||
* Hartmutt Birr - SMP/PAE Code
|
||||
* Hartmut Birr - SMP/PAE Code
|
||||
*/
|
||||
|
||||
#include <freeldr.h>
|
||||
@@ -54,7 +54,7 @@
|
||||
#define ApicPageTableIndexPae (APIC_BASE >> 21)
|
||||
|
||||
|
||||
#define KernelEntryPoint (KernelEntry - KERNEL_BASE_PHYS) + KernelBase
|
||||
#define KernelEntryPoint (KernelEntry - KERNEL_BASE_PHYS) + KernelBase
|
||||
|
||||
/* Load Address of Next Module */
|
||||
ULONG_PTR NextModuleBase = 0;
|
||||
@@ -217,7 +217,7 @@ FrLdrSetupPae(ULONG Magic)
|
||||
/* Jump to Kernel */
|
||||
PagedJump = (ASMCODE)KernelEntryPoint;
|
||||
PagedJump(Magic, &LoaderBlock);
|
||||
}
|
||||
}
|
||||
|
||||
/*++
|
||||
* FrLdrGetKernelBase
|
||||
@@ -239,27 +239,24 @@ VOID
|
||||
FASTCALL
|
||||
FrLdrGetKernelBase(VOID)
|
||||
{
|
||||
PCHAR p1;
|
||||
PCHAR p2;
|
||||
PCHAR p;
|
||||
|
||||
/* Read Command Line */
|
||||
for(p1 = (PCHAR)&LoaderBlock.CommandLine; *p1 && (p2 = strchr(p1, '/')); p2++) {
|
||||
p = (PCHAR)LoaderBlock.CommandLine;
|
||||
while ((p = strchr(p, '/')) != NULL) {
|
||||
|
||||
/* Find "/3GB" */
|
||||
if (!strnicmp(p2, "3GB", 3)) {
|
||||
if (!strnicmp(p + 1, "3GB", 3)) {
|
||||
|
||||
/* Make sure there's nothing following it */
|
||||
if (p2[3] == ' ' || p2[3] == 0) {
|
||||
if (p[4] == ' ' || p[4] == 0) {
|
||||
|
||||
/* Use 3GB */
|
||||
KernelBase = 0xC0000000;
|
||||
|
||||
} else {
|
||||
|
||||
/* Use 2GB */
|
||||
KernelBase = 0x80000000;
|
||||
}
|
||||
}
|
||||
|
||||
p++;
|
||||
}
|
||||
|
||||
/* Set KernelBase */
|
||||
|
||||
@@ -35,18 +35,18 @@ all: ../bootsect/fat.h ../bootsect/fat32.h install.exe
|
||||
@$(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.
|
||||
|
||||
@@ -25,16 +25,16 @@ TOOLS = deptool$(EXE_POSTFIX) \
|
||||
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.
|
||||
|
||||
@@ -254,6 +254,15 @@ HKLM,"SYSTEM\CurrentControlSet\Control\Session Manager\KnownDlls","kernel32",0x0
|
||||
HKLM,"SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management","PagingFiles",0x00010000, \
|
||||
"C:\reactos\pagefile.sys"
|
||||
|
||||
; 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",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",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
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\3c90x","ErrorControl",0x00010001,0x00000000
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\3c90x","Group",0x00000000,"NDIS"
|
||||
@@ -573,7 +582,7 @@ HKLM,"SYSTEM\CurrentControlSet\Services\usbuhci","Type",0x00010001,0x00000001
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\usbuhci","ErrorControl",0x00010001,0x00000001
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\usbuhci","Start",0x00010001,0x00000003
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\usbuhci","Group",0x00000000,"Base"
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\usbuhci","Type",0x00020000,"System32\DRIVERS\usbuhci.sys"
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\usbuhci","ImagePath",0x00020000,"System32\DRIVERS\usbuhci.sys"
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\usbuhci","Tag",0x00010001,0x0000000f
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\usbuhci","DisplayName",0x00000000,"ReactOS USB UHCI controller miniport driver"
|
||||
;hard coded values for VMWARE
|
||||
@@ -582,6 +591,21 @@ HKLM,"SYSTEM\CurrentControlSet\Services\usbuhci\Enum","Count",0x00010001,0x00000
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\usbuhci\Enum","NextInstance",0x00010001,0x00000001
|
||||
HKLM,"SYSTEM\CurrentControlSet\Enum\PCI\VEN_8086&DEV_7112&SUBSYS_197615AD&REV_00\0000","Service",0x0000000,"usbuhci"
|
||||
|
||||
;USB OHCI Driver (Cromwell), especially the same name as windows OHCI miniport
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\usbohci","Type",0x00010001,0x00000001
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\usbohci","ErrorControl",0x00010001,0x00000001
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\usbohci","Start",0x00010001,0x00000003
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\usbohci","Group",0x00000000,"Base"
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\usbohci","ImagePath",0x00020000,"System32\drivers\ohci.sys"
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\usbohci","Tag",0x00010001,0x0000000f
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\usbohci","DisplayName",0x00000000,"ReactOS USB OHCI cromwell-type driver"
|
||||
;hard coded values for Virtual PC 6/7 (Mac)
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\usbohci\Enum","0",0x00000000,"PCI\VEN_2955&DEV_6E61&SUBSYS_6E612955&REV_11\0000"
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\usbohci\Enum","Count",0x00010001,0x00000001
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\usbohci\Enum","NextInstance",0x00010001,0x00000001
|
||||
HKLM,"SYSTEM\CurrentControlSet\Enum\PCI\VEN_2955&DEV_6E61&SUBSYS_6E612955&REV_11\0000","Service",0x0000000,"usbohci"
|
||||
|
||||
|
||||
; ReactOS PCNet NIC driver
|
||||
; To use the AMD supplied driver change the driver name to pcntn5m.sys
|
||||
;
|
||||
|
||||
@@ -74,7 +74,6 @@ lib\dinput\dinput.dll 1
|
||||
lib\dinput8\dinput8.dll 1
|
||||
lib\dsound\dsound.dll 1
|
||||
lib\dxdiagn\dxdiagn.dll 1
|
||||
lib\expat\expat.dll 1
|
||||
lib\fmifs\fmifs.dll 1
|
||||
lib\freetype\freetype.dll 1
|
||||
lib\gdi32\gdi32.dll 1
|
||||
@@ -97,6 +96,7 @@ lib\mesa32\mesa32.dll 1
|
||||
lib\midimap\midimap.dll 1
|
||||
lib\mmdrv\mmdrv.dll 1
|
||||
lib\mpr\mpr.dll 1
|
||||
lib\msacm\msacm32.dll 1
|
||||
lib\msafd\msafd.dll 1
|
||||
lib\msgina\msgina.dll 1
|
||||
lib\msimg32\msimg32.dll 1
|
||||
@@ -120,7 +120,6 @@ lib\smdll\smdll.dll 1
|
||||
lib\syssetup\syssetup.dll 1
|
||||
lib\twain\twain_32.dll 1
|
||||
lib\urlmon\urlmon.dll 1
|
||||
lib\unicode\wine_unicode.dll 1
|
||||
lib\user32\user32.dll 1
|
||||
lib\userenv\userenv.dll 1
|
||||
lib\version\version.dll 1
|
||||
@@ -151,9 +150,9 @@ subsys\system\ibrowser\ibrowser.exe 1
|
||||
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
|
||||
subsys\system\services\services.exe 1
|
||||
subsys\system\setup\setup.exe 1
|
||||
subsys\system\taskmgr\taskmgr.exe 1
|
||||
|
||||
@@ -22,7 +22,6 @@ cdrom.sys = 3
|
||||
class2.sys = 3
|
||||
disk.sys = 3
|
||||
floppy.sys = 3
|
||||
hal.dll = 2
|
||||
keyboard.sys = 3
|
||||
l_intl.nls = 2
|
||||
ntfs.sys = 3
|
||||
@@ -48,6 +47,15 @@ DefaultLayout = 00000409
|
||||
|
||||
[Computer]
|
||||
pci_up = "Standard-PC"
|
||||
pci_mp = "Standard-PC Multiprocessor"
|
||||
|
||||
[Files.pci_up]
|
||||
; <filename> = <directory_id>,<new name>
|
||||
hal.dll = 2
|
||||
|
||||
[Files.pci_mp]
|
||||
; <filename> = <directory_id>,<new name>
|
||||
halmp.dll = 2,hal.dll
|
||||
|
||||
[Display]
|
||||
;<id> = <user friendly name>,<spare>,<service key name>
|
||||
|
||||
+3
-3
@@ -7,12 +7,12 @@ ARCH := i386
|
||||
|
||||
|
||||
#
|
||||
# Which cpu should reactos optimze for
|
||||
# Which cpu should reactos optimize for
|
||||
# example : i486, i586, pentium, pentium2, pentium3, pentium4
|
||||
# athlon-xp, athlon-mp, k6-2,
|
||||
#
|
||||
# see gcc manual for more cpu name and which cpu it can
|
||||
# be optimze for.
|
||||
# see gcc manual for more cpu names and which cpus it can
|
||||
# be optimized for.
|
||||
#
|
||||
|
||||
OARCH := i486
|
||||
|
||||
+57
-28
@@ -10,8 +10,8 @@ please add it.
|
||||
If you find that a function in ReactOS that is not implemented properly
|
||||
and is based on WINE sources, check the latest Winehq CVS and see if
|
||||
it has been fixed there. If so, please submit a patch to
|
||||
ros-kernel@reactos.com. Otherwise please send a patch to both
|
||||
[email protected] and ros-kernel@reactos.com
|
||||
ros-dev@reactos.com. Otherwise please send a patch to both
|
||||
[email protected] and ros-dev@reactos.com
|
||||
|
||||
When porting a dll from WINE to ReactOS please take a look at how
|
||||
comctl32 has been imported. We start by creating a makefile that has
|
||||
@@ -26,51 +26,52 @@ This will allow you to use the WINE tools and librarys with very little
|
||||
work to import a new dll.
|
||||
|
||||
The following build tools are derived from Wine.
|
||||
reactos/tools/makedep # fast dependancy tool
|
||||
reactos/tools/bin2res # Resource to binary converter
|
||||
reactos/tools/winebuild # Wine Build tool for Creating *.def files
|
||||
reactos/tools/winebuild # Synced to Wine-20050211
|
||||
reactos/tools/wmc # Wine Message Compiler
|
||||
|
||||
reactos/tools/wrc # Synced to Wine-20050211
|
||||
|
||||
The following shared libraries are a 100% port from Winehq sources.
|
||||
|
||||
reactos/lib/cabinet # Synced to Wine-20050111
|
||||
reactos/lib/comctl32 # Synced to Wine-20050111
|
||||
reactos/lib/comdlg32 # Synced to Wine-20050111
|
||||
reactos/lib/dinput # Synced to Wine-20050111
|
||||
reactos/lib/dinput8 # Synced to Wine-20050111
|
||||
reactos/lib/icmp # Synced to Wine-20050111
|
||||
reactos/lib/cabinet # Synced to Wine-20050211
|
||||
reactos/lib/comctl32 # Synced to Wine-20050211
|
||||
reactos/lib/comdlg32 # Synced to Wine-20050211
|
||||
reactos/lib/dinput # Synced to Wine-20050211
|
||||
reactos/lib/dinput8 # Synced to Wine-20050211
|
||||
reactos/lib/icmp # Synced to Wine-20050211
|
||||
reactos/lib/iphlpapi # Out of sync
|
||||
reactos/lib/imagehlp # Patches for BindImage need review and submission to winehq.
|
||||
reactos/lib/msvcrt20 # Out of sync
|
||||
reactos/lib/mpr # Synced to Wine-20050111
|
||||
reactos/lib/mpr # Synced to Wine-20050211
|
||||
reactos/lib/msacm # Out of sync
|
||||
reactos/lib/msi # Synced to Wine-20050111
|
||||
reactos/lib/msimg32 # Synced to Wine-20050211
|
||||
reactos/lib/msi # Synced to Wine-20050211
|
||||
reactos/lib/msvideo # Out of sync
|
||||
reactos/lib/netapi32 # Out of sync
|
||||
reactos/lib/odbc32 # In sync. Depends on port of Linux ODBC.
|
||||
reactos/lib/ole32 # Synced to Wine-20050111
|
||||
reactos/lib/oleaut32 # Synced to Wine-20050111
|
||||
reactos/lib/oledlg # Synced to Wine-20050111
|
||||
reactos/lib/olepro32 # Synced to Wine-20050111
|
||||
reactos/lib/richedit # Synced to Wine-20050111
|
||||
reactos/lib/rpcrt4 # Synced to Wine-20050111
|
||||
reactos/lib/ole32 # Synced to Wine-20050211
|
||||
reactos/lib/oleaut32 # Synced to Wine-20050211
|
||||
reactos/lib/oledlg # Synced to Wine-20050211
|
||||
reactos/lib/olepro32 # Synced to Wine-20050211
|
||||
reactos/lib/richedit # Synced to Wine-20050211
|
||||
reactos/lib/rpcrt4 # Synced to Wine-20050211
|
||||
reactos/lib/setupapi # Synced to Wine-20050125 # CVS
|
||||
reactos/lib/shell32 # Synced to Wine-20050111
|
||||
reactos/lib/shdocvw # Synced to Wine-20050111
|
||||
reactos/lib/shlwapi # Synced to Wine-20050111
|
||||
reactos/lib/shell32 # Synced to Wine-20050211
|
||||
reactos/lib/shdocvw # Synced to Wine-20050211
|
||||
reactos/lib/shlwapi # Synced to Wine-20050211
|
||||
reactos/lib/twain # Out of sync
|
||||
reactos/lib/unicode # Dependancy on this lib needs to be removed. Synced to Wine-20050111
|
||||
reactos/lib/urlmon # Synced to Wine-20050111
|
||||
reactos/lib/unicode # Dependancy on this lib needs to be removed. Synced to Wine-20050211
|
||||
reactos/lib/urlmon # Synced to Wine-20050211
|
||||
reactos/lib/version # Out of sync
|
||||
reactos/lib/wininet # Out of sync
|
||||
reactos/lib/winmm # Synced to Wine-20050111
|
||||
reactos/lib/winmm/midimap # Synced to Wine-20050111
|
||||
reactos/lib/winmm/wavemap # Synced to Wine-20050111
|
||||
reactos/lib/winmm # Synced to Wine-20050211
|
||||
reactos/lib/winmm/midimap # Synced to Wine-20050211
|
||||
reactos/lib/winmm/wavemap # Synced to Wine-20050211
|
||||
|
||||
ReactOS shares the following programs with Winehq.
|
||||
reactos/subsys/system/regedit # Out of sync
|
||||
reactos/subsys/system/expand # Out of sync
|
||||
reactos/subsys/system/msiexec # Synced to Wine-20050211
|
||||
|
||||
In addition the following libs, dlls and source files are mostly based on code ported
|
||||
from Winehq CVS. If you are looking to update something in these files
|
||||
@@ -80,7 +81,7 @@ reactos/lib/imm32 #
|
||||
reactos/lib/uuid #
|
||||
|
||||
advapi32 -
|
||||
reactos/lib/advapi32/crypyto/*.c # Synced to Wine-20041201
|
||||
reactos/lib/advapi32/crypt/*.c # ekohl says we're not sharing this
|
||||
|
||||
gdi32 -
|
||||
reactos/lib/gdi32/objects/linedda.c # Out of sync
|
||||
@@ -100,3 +101,31 @@ User32 -
|
||||
reactos/lib/user32/misc/wsprintf.c # Out of sync
|
||||
reactos/lib/user32/windows/mdi.c # Out of sync
|
||||
|
||||
- Cd to the parent directory of your top-level "reactos" directory
|
||||
- Check out the Wine release: "cvs -d :pserver:[email protected]:2401/home/wine co wine -r Wine-20050211"
|
||||
- Create "vendor" directory (as a sibling of your top-level "reactos" directory)
|
||||
- Cd to the vendor dir and check out the current vendor drop:
|
||||
"svn co svn://svn.reactos.com/vendor/wine".
|
||||
- For each component shared with Wine (e.g. cabinet):
|
||||
"del vendor\wine\dlls\cabinet\current\*"
|
||||
"copy wine\dlls\cabinet vendor\wine\dlls\cabinet\current"
|
||||
"del vendor\wine\dlls\cabinet\current\.cvsignore"
|
||||
Check svn status, svn add/delete files as needed
|
||||
Tag new Wine release "svn copy vendor\wine\dlls\cabinet\current vendor\wine\dlls\cabinet\Wine-20050211"
|
||||
- Commit the vendor drop: svn commit vendor\wine -m "Wine-20050211 vendor drop"
|
||||
- Determine the revision number of the last Wine tag by looking at http://svn.reactos.com/viewcvs/tags/
|
||||
and finding the last Wine-yyyymmdd-sync tag, e.g. Wine-20050111-sync had rev 13007
|
||||
- For each component shared with Wine (e.g. cabinet):
|
||||
- "cd reactos\lib\cabinet"
|
||||
- Check for changes in the ReactOS tree: "svn diff -r 13007" (13007 is the revno of the previous sync).
|
||||
If any changes are found, see if they're present in the Wine code. If not, submit to WineHQ
|
||||
if apropriate.
|
||||
- Merge in Wine changes:
|
||||
"svn merge svn://svn.reactos.com/vendor/wine/dlls/cabinet/Wine-20050111
|
||||
svn://svn.reactos.com/vendor/wine/dlls/cabinet/current"
|
||||
- Fix any merge conflicts
|
||||
- Build and test (building will sometimes require adjusting header files)
|
||||
- Check which files were changed: "svn status"
|
||||
- For each of the changed files, get the WineHQ CVS log. Copy author and CVS commit message into a
|
||||
commit log
|
||||
- Commit changed files "svn commit" using generated commit log as commit message
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
|
||||
#include <ddk/ntifs.h>
|
||||
|
||||
#define USE_ROS_CC_AND_FS
|
||||
|
||||
#define CDFS_BASIC_SECTOR 2048
|
||||
#define CDFS_PRIMARY_DESCRIPTOR_LOCATION 16
|
||||
#define BLOCKSIZE CDFS_BASIC_SECTOR
|
||||
|
||||
@@ -54,7 +54,11 @@ CdfsCleanupFile(PDEVICE_EXTENSION DeviceExt,
|
||||
/* Uninitialize file cache if initialized for this file object. */
|
||||
if (FileObject->SectionObjectPointer && FileObject->SectionObjectPointer->SharedCacheMap)
|
||||
{
|
||||
#ifdef USE_ROS_CC_AND_FS
|
||||
CcRosReleaseFileCache (FileObject);
|
||||
#else
|
||||
CcUninitializeCacheMap (FileObject, NULL, NULL);
|
||||
#endif
|
||||
}
|
||||
|
||||
return STATUS_SUCCESS;
|
||||
|
||||
@@ -241,6 +241,7 @@ CdfsFCBInitializeCache(PVCB Vcb,
|
||||
Fcb->FileObject = FileObject;
|
||||
Fcb->DevExt = Vcb;
|
||||
|
||||
#ifdef USE_ROS_AND_FS
|
||||
Status = CcRosInitializeFileCache(FileObject,
|
||||
PAGE_SIZE);
|
||||
if (!NT_SUCCESS(Status))
|
||||
@@ -248,6 +249,14 @@ CdfsFCBInitializeCache(PVCB Vcb,
|
||||
DbgPrint("CcRosInitializeFileCache failed\n");
|
||||
KEBUGCHECK(0);
|
||||
}
|
||||
#else
|
||||
Status = STATUS_SUCCESS;
|
||||
CcInitializeCacheMap(FileObject,
|
||||
(PCC_FILE_SIZES)(&Fcb->RFCB.AllocationSize),
|
||||
FALSE,
|
||||
NULL,
|
||||
NULL);
|
||||
#endif
|
||||
|
||||
ObDereferenceObject(FileObject);
|
||||
Fcb->Flags |= FCB_CACHE_INITIALIZED;
|
||||
@@ -411,7 +420,6 @@ CdfsAttachFCBToFileObject(PDEVICE_EXTENSION Vcb,
|
||||
PFCB Fcb,
|
||||
PFILE_OBJECT FileObject)
|
||||
{
|
||||
NTSTATUS Status;
|
||||
PCCB newCCB;
|
||||
|
||||
newCCB = ExAllocatePoolWithTag(NonPagedPool, sizeof(CCB), TAG_CCB);
|
||||
@@ -426,9 +434,11 @@ CdfsAttachFCBToFileObject(PDEVICE_EXTENSION Vcb,
|
||||
FileObject->FsContext2 = newCCB;
|
||||
newCCB->PtrFileObject = FileObject;
|
||||
Fcb->DevExt = Vcb;
|
||||
|
||||
|
||||
if (CdfsFCBIsDirectory(Fcb))
|
||||
{
|
||||
#ifdef USE_ROS_CC_AND_FS
|
||||
NTSTATUS Status;
|
||||
Status = CcRosInitializeFileCache(FileObject,
|
||||
PAGE_SIZE);
|
||||
if (!NT_SUCCESS(Status))
|
||||
@@ -436,6 +446,13 @@ CdfsAttachFCBToFileObject(PDEVICE_EXTENSION Vcb,
|
||||
DbgPrint("CcRosInitializeFileCache failed\n");
|
||||
KEBUGCHECK(0);
|
||||
}
|
||||
#else
|
||||
CcInitializeCacheMap(FileObject,
|
||||
(PCC_FILE_SIZES)(&Fcb->RFCB.AllocationSize),
|
||||
FALSE,
|
||||
NULL,
|
||||
NULL);
|
||||
#endif
|
||||
Fcb->Flags |= FCB_CACHE_INITIALIZED;
|
||||
}
|
||||
|
||||
|
||||
@@ -402,7 +402,7 @@ CdfsMountVolume(PDEVICE_OBJECT DeviceObject,
|
||||
|
||||
Fcb->Entry.ExtentLocationL = 0;
|
||||
Fcb->Entry.DataLengthL = (DeviceExt->CdInfo.VolumeSpaceSize + DeviceExt->CdInfo.VolumeOffset) * BLOCKSIZE;
|
||||
|
||||
#ifdef USE_ROS_CC_AND_FS
|
||||
Status = CcRosInitializeFileCache(DeviceExt->StreamFileObject,
|
||||
PAGE_SIZE);
|
||||
if (!NT_SUCCESS (Status))
|
||||
@@ -410,7 +410,13 @@ CdfsMountVolume(PDEVICE_OBJECT DeviceObject,
|
||||
DbgPrint("CcRosInitializeFileCache failed\n");
|
||||
goto ByeBye;
|
||||
}
|
||||
|
||||
#else
|
||||
CcInitializeCacheMap(DeviceExt->StreamFileObject,
|
||||
(PCC_FILE_SIZES)(&Fcb->RFCB.AllocationSize),
|
||||
TRUE,
|
||||
NULL,
|
||||
NULL);
|
||||
#endif
|
||||
ExInitializeResourceLite(&DeviceExt->VcbResource);
|
||||
ExInitializeResourceLite(&DeviceExt->DirResource);
|
||||
|
||||
|
||||
@@ -86,7 +86,15 @@ CdfsReadFile(PDEVICE_EXTENSION DeviceExt,
|
||||
|
||||
if (FileObject->PrivateCacheMap == NULL)
|
||||
{
|
||||
#ifdef ROS_USE_CC_AND_FS
|
||||
CcRosInitializeFileCache(FileObject, PAGE_SIZE);
|
||||
#else
|
||||
CcInitializeCacheMap(FileObject,
|
||||
(PCC_FILE_SIZES)(&Fcb->RFCB.AllocationSize),
|
||||
FALSE,
|
||||
NULL,
|
||||
NULL);
|
||||
#endif
|
||||
}
|
||||
|
||||
FileOffset.QuadPart = (LONGLONG)ReadOffset;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
* FILE: services/fs/np/create.c
|
||||
* FILE: drivers/fs/np/create.c
|
||||
* PURPOSE: Named pipe filesystem
|
||||
* PROGRAMMER: David Welch <welch@cwcom.net>
|
||||
*/
|
||||
@@ -48,17 +48,18 @@ static PNPFS_FCB
|
||||
NpfsFindListeningServerInstance(PNPFS_PIPE Pipe)
|
||||
{
|
||||
PLIST_ENTRY CurrentEntry;
|
||||
PNPFS_FCB ServerFcb;
|
||||
PNPFS_WAITER_ENTRY Waiter;
|
||||
|
||||
CurrentEntry = Pipe->ServerFcbListHead.Flink;
|
||||
while (CurrentEntry != &Pipe->ServerFcbListHead)
|
||||
CurrentEntry = Pipe->WaiterListHead.Flink;
|
||||
while (CurrentEntry != &Pipe->WaiterListHead)
|
||||
{
|
||||
ServerFcb = CONTAINING_RECORD(CurrentEntry, NPFS_FCB, FcbListEntry);
|
||||
if (ServerFcb->PipeState == FILE_PIPE_LISTENING_STATE)
|
||||
Waiter = CONTAINING_RECORD(CurrentEntry, NPFS_WAITER_ENTRY, Entry);
|
||||
if (Waiter->Fcb->PipeState == FILE_PIPE_LISTENING_STATE)
|
||||
{
|
||||
DPRINT("Server found! Fcb %p\n", ServerFcb);
|
||||
return ServerFcb;
|
||||
DPRINT("Server found! Fcb %p\n", Waiter->Fcb);
|
||||
return Waiter->Fcb;
|
||||
}
|
||||
|
||||
CurrentEntry = CurrentEntry->Flink;
|
||||
}
|
||||
|
||||
@@ -66,6 +67,35 @@ NpfsFindListeningServerInstance(PNPFS_PIPE Pipe)
|
||||
}
|
||||
|
||||
|
||||
static VOID
|
||||
NpfsSignalAndRemoveListeningServerInstance(PNPFS_PIPE Pipe,
|
||||
PNPFS_FCB Fcb)
|
||||
{
|
||||
PLIST_ENTRY CurrentEntry;
|
||||
PNPFS_WAITER_ENTRY Waiter;
|
||||
|
||||
CurrentEntry = Pipe->WaiterListHead.Flink;
|
||||
while (CurrentEntry != &Pipe->WaiterListHead)
|
||||
{
|
||||
Waiter = CONTAINING_RECORD(CurrentEntry, NPFS_WAITER_ENTRY, Entry);
|
||||
if (Waiter->Fcb == Fcb)
|
||||
{
|
||||
DPRINT("Server found! Fcb %p\n", Waiter->Fcb);
|
||||
|
||||
KeSetEvent(Waiter->Irp->UserEvent, 0, FALSE);
|
||||
Waiter->Irp->UserIosb->Status = FILE_PIPE_CONNECTED_STATE;
|
||||
Waiter->Irp->UserIosb->Information = 0;
|
||||
IoCompleteRequest(Waiter->Irp, IO_NO_INCREMENT);
|
||||
|
||||
RemoveEntryList(&Waiter->Entry);
|
||||
ExFreePool(Waiter);
|
||||
return;
|
||||
}
|
||||
CurrentEntry = CurrentEntry->Flink;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
NTSTATUS STDCALL
|
||||
NpfsCreate(PDEVICE_OBJECT DeviceObject,
|
||||
PIRP Irp)
|
||||
@@ -164,9 +194,9 @@ NpfsCreate(PDEVICE_OBJECT DeviceObject,
|
||||
ClientFcb->PipeState = SpecialAccess ? 0 : FILE_PIPE_DISCONNECTED_STATE;
|
||||
|
||||
/* Initialize data list. */
|
||||
if (Pipe->InboundQuota)
|
||||
if (Pipe->OutboundQuota)
|
||||
{
|
||||
ClientFcb->Data = ExAllocatePool(NonPagedPool, Pipe->InboundQuota);
|
||||
ClientFcb->Data = ExAllocatePool(NonPagedPool, Pipe->OutboundQuota);
|
||||
if (ClientFcb->Data == NULL)
|
||||
{
|
||||
DPRINT("No memory!\n");
|
||||
@@ -185,8 +215,8 @@ NpfsCreate(PDEVICE_OBJECT DeviceObject,
|
||||
ClientFcb->ReadPtr = ClientFcb->Data;
|
||||
ClientFcb->WritePtr = ClientFcb->Data;
|
||||
ClientFcb->ReadDataAvailable = 0;
|
||||
ClientFcb->WriteQuotaAvailable = Pipe->InboundQuota;
|
||||
ClientFcb->MaxDataLength = Pipe->InboundQuota;
|
||||
ClientFcb->WriteQuotaAvailable = Pipe->OutboundQuota;
|
||||
ClientFcb->MaxDataLength = Pipe->OutboundQuota;
|
||||
KeInitializeSpinLock(&ClientFcb->DataListLock);
|
||||
KeInitializeEvent(&ClientFcb->ConnectEvent, SynchronizationEvent, FALSE);
|
||||
KeInitializeEvent(&ClientFcb->Event, SynchronizationEvent, FALSE);
|
||||
@@ -206,9 +236,8 @@ NpfsCreate(PDEVICE_OBJECT DeviceObject,
|
||||
ClientFcb->PipeState = FILE_PIPE_CONNECTED_STATE;
|
||||
ServerFcb->PipeState = FILE_PIPE_CONNECTED_STATE;
|
||||
|
||||
/* Wake server thread */
|
||||
DPRINT("Setting the ConnectEvent for %x\n", ServerFcb);
|
||||
KeSetEvent(&ServerFcb->ConnectEvent, 0, FALSE);
|
||||
/* Signal the server thread and remove it from the waiter list */
|
||||
NpfsSignalAndRemoveListeningServerInstance(Pipe, ServerFcb);
|
||||
}
|
||||
|
||||
KeUnlockMutex(&Pipe->FcbListLock);
|
||||
@@ -318,6 +347,7 @@ NpfsCreateNamedPipe(PDEVICE_OBJECT DeviceObject,
|
||||
|
||||
InitializeListHead(&Pipe->ServerFcbListHead);
|
||||
InitializeListHead(&Pipe->ClientFcbListHead);
|
||||
InitializeListHead(&Pipe->WaiterListHead);
|
||||
KeInitializeMutex(&Pipe->FcbListLock, 0);
|
||||
|
||||
Pipe->PipeType = Buffer->NamedPipeType;
|
||||
@@ -381,9 +411,9 @@ NpfsCreateNamedPipe(PDEVICE_OBJECT DeviceObject,
|
||||
KeUnlockMutex(&DeviceExt->PipeListLock);
|
||||
}
|
||||
|
||||
if (Pipe->OutboundQuota)
|
||||
if (Pipe->InboundQuota)
|
||||
{
|
||||
Fcb->Data = ExAllocatePool(NonPagedPool, Pipe->OutboundQuota);
|
||||
Fcb->Data = ExAllocatePool(NonPagedPool, Pipe->InboundQuota);
|
||||
if (Fcb->Data == NULL)
|
||||
{
|
||||
ExFreePool(Fcb);
|
||||
@@ -407,8 +437,8 @@ NpfsCreateNamedPipe(PDEVICE_OBJECT DeviceObject,
|
||||
Fcb->ReadPtr = Fcb->Data;
|
||||
Fcb->WritePtr = Fcb->Data;
|
||||
Fcb->ReadDataAvailable = 0;
|
||||
Fcb->WriteQuotaAvailable = Pipe->OutboundQuota;
|
||||
Fcb->MaxDataLength = Pipe->OutboundQuota;
|
||||
Fcb->WriteQuotaAvailable = Pipe->InboundQuota;
|
||||
Fcb->MaxDataLength = Pipe->InboundQuota;
|
||||
KeInitializeSpinLock(&Fcb->DataListLock);
|
||||
|
||||
Pipe->CurrentInstances++;
|
||||
@@ -442,9 +472,8 @@ NpfsCreateNamedPipe(PDEVICE_OBJECT DeviceObject,
|
||||
|
||||
|
||||
NTSTATUS STDCALL
|
||||
NpfsClose(
|
||||
PDEVICE_OBJECT DeviceObject,
|
||||
PIRP Irp)
|
||||
NpfsClose(PDEVICE_OBJECT DeviceObject,
|
||||
PIRP Irp)
|
||||
{
|
||||
PNPFS_DEVICE_EXTENSION DeviceExt;
|
||||
PIO_STACK_LOCATION IoStack;
|
||||
@@ -493,10 +522,8 @@ NpfsClose(
|
||||
{
|
||||
if (Fcb->OtherSide)
|
||||
{
|
||||
#ifndef FIN_WORKAROUND_READCLOSE
|
||||
Fcb->OtherSide->PipeState = FILE_PIPE_CLOSING_STATE;
|
||||
Fcb->OtherSide->OtherSide = NULL;
|
||||
#endif
|
||||
/*
|
||||
* Signaling the write event. If is possible that an other
|
||||
* thread waits for an empty buffer.
|
||||
@@ -504,39 +531,15 @@ NpfsClose(
|
||||
KeSetEvent(&Fcb->OtherSide->Event, IO_NO_INCREMENT, FALSE);
|
||||
}
|
||||
|
||||
#ifndef FIN_WORKAROUND_READCLOSE
|
||||
Fcb->PipeState = 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
FileObject->FsContext = NULL;
|
||||
|
||||
#ifndef FIN_WORKAROUND_READCLOSE
|
||||
RemoveEntryList(&Fcb->FcbListEntry);
|
||||
if (Fcb->Data)
|
||||
ExFreePool(Fcb->Data);
|
||||
ExFreePool(Fcb);
|
||||
#else
|
||||
Fcb->PipeState = FILE_PIPE_CLOSING_STATE;
|
||||
if (Fcb->OtherSide == NULL ||
|
||||
Fcb->OtherSide->PipeState == FILE_PIPE_CLOSING_STATE)
|
||||
{
|
||||
if (Server && Fcb->OtherSide != NULL &&
|
||||
Fcb->OtherSide->PipeState == FILE_PIPE_CLOSING_STATE)
|
||||
{
|
||||
RemoveEntryList(&Fcb->OtherSide->FcbListEntry);
|
||||
if (Fcb->OtherSide->Data)
|
||||
ExFreePool(Fcb->OtherSide->Data);
|
||||
ExFreePool(Fcb->OtherSide);
|
||||
}
|
||||
|
||||
RemoveEntryList(&Fcb->FcbListEntry);
|
||||
if (Fcb->Data)
|
||||
ExFreePool(Fcb->Data);
|
||||
|
||||
ExFreePool(Fcb);
|
||||
}
|
||||
#endif
|
||||
|
||||
KeUnlockMutex(&Pipe->FcbListLock);
|
||||
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
* FILE: services/fs/np/finfo.c
|
||||
* FILE: drivers/fs/np/finfo.c
|
||||
* PURPOSE: Named pipe filesystem
|
||||
* PROGRAMMER: Eric Kohl <ekohl@rz-online.de>
|
||||
* PROGRAMMER: Eric Kohl
|
||||
*/
|
||||
|
||||
/* INCLUDES ******************************************************************/
|
||||
@@ -36,7 +36,7 @@ NpfsQueryPipeInformation(PDEVICE_OBJECT DeviceObject,
|
||||
// Info->CompletionMode =
|
||||
|
||||
*BufferLength -= sizeof(FILE_PIPE_INFORMATION);
|
||||
return(STATUS_SUCCESS);
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
@@ -76,7 +76,7 @@ NpfsQueryLocalPipeInformation(PDEVICE_OBJECT DeviceObject,
|
||||
}
|
||||
|
||||
*BufferLength -= sizeof(FILE_PIPE_LOCAL_INFORMATION);
|
||||
return(STATUS_SUCCESS);
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
@@ -93,24 +93,24 @@ NpfsQueryInformation(PDEVICE_OBJECT DeviceObject,
|
||||
PVOID SystemBuffer;
|
||||
ULONG BufferLength;
|
||||
NTSTATUS Status;
|
||||
|
||||
|
||||
DPRINT("NpfsQueryInformation(DeviceObject %p Irp %p)\n", DeviceObject, Irp);
|
||||
|
||||
|
||||
IoStack = IoGetCurrentIrpStackLocation (Irp);
|
||||
FileInformationClass = IoStack->Parameters.QueryFile.FileInformationClass;
|
||||
DeviceExtension = DeviceObject->DeviceExtension;
|
||||
FileObject = IoStack->FileObject;
|
||||
Fcb = (PNPFS_FCB)FileObject->FsContext;
|
||||
Pipe = Fcb->Pipe;
|
||||
|
||||
|
||||
SystemBuffer = Irp->AssociatedIrp.SystemBuffer;
|
||||
BufferLength = IoStack->Parameters.QueryFile.Length;
|
||||
|
||||
|
||||
DPRINT("Pipe name: %wZ\n", &Pipe->PipeName);
|
||||
DPRINT("FileInformationClass %d\n", FileInformationClass);
|
||||
DPRINT("SystemBuffer %p\n", SystemBuffer);
|
||||
DPRINT("BufferLength %lu\n", BufferLength);
|
||||
|
||||
|
||||
switch (FileInformationClass)
|
||||
{
|
||||
case FilePipeInformation:
|
||||
@@ -134,7 +134,7 @@ NpfsQueryInformation(PDEVICE_OBJECT DeviceObject,
|
||||
default:
|
||||
Status = STATUS_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
|
||||
Irp->IoStatus.Status = Status;
|
||||
if (NT_SUCCESS(Status))
|
||||
Irp->IoStatus.Information =
|
||||
@@ -142,8 +142,8 @@ NpfsQueryInformation(PDEVICE_OBJECT DeviceObject,
|
||||
else
|
||||
Irp->IoStatus.Information = 0;
|
||||
IoCompleteRequest (Irp, IO_NO_INCREMENT);
|
||||
|
||||
return(Status);
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
@@ -196,7 +196,7 @@ NpfsSetInformation(PDEVICE_OBJECT DeviceObject,
|
||||
IoCompleteRequest(Irp,
|
||||
IO_NO_INCREMENT);
|
||||
|
||||
return(Status);
|
||||
return Status;
|
||||
}
|
||||
|
||||
/* EOF */
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
* FILE: services/fs/np/fsctrl.c
|
||||
* FILE: drivers/fs/np/fsctrl.c
|
||||
* PURPOSE: Named pipe filesystem
|
||||
* PROGRAMMER: David Welch <welch@cwcom.net>
|
||||
* Eric Kohl <ekohl@rz-online.de>
|
||||
* Eric Kohl
|
||||
*/
|
||||
|
||||
/* INCLUDES ******************************************************************/
|
||||
@@ -18,8 +18,66 @@
|
||||
|
||||
/* FUNCTIONS *****************************************************************/
|
||||
|
||||
static VOID
|
||||
NpfsListeningCancelRoutine(IN PDEVICE_OBJECT DeviceObject,
|
||||
IN PIRP Irp)
|
||||
{
|
||||
PNPFS_WAITER_ENTRY Waiter;
|
||||
|
||||
DPRINT1("NpfsListeningCancelRoutine() called\n");
|
||||
/* FIXME: Not tested. */
|
||||
|
||||
Waiter = Irp->Tail.Overlay.DriverContext[0];
|
||||
|
||||
RemoveEntryList(&Waiter->Entry);
|
||||
ExFreePool(Waiter);
|
||||
|
||||
IoReleaseCancelSpinLock(Irp->CancelIrql);
|
||||
|
||||
Irp->IoStatus.Status = STATUS_CANCELLED;
|
||||
Irp->IoStatus.Information = 0;
|
||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
||||
}
|
||||
|
||||
|
||||
static NTSTATUS
|
||||
NpfsConnectPipe(PNPFS_FCB Fcb)
|
||||
NpfsAddListeningServerInstance(PIRP Irp,
|
||||
PNPFS_FCB Fcb)
|
||||
{
|
||||
PNPFS_WAITER_ENTRY Entry;
|
||||
KIRQL OldIrql;
|
||||
|
||||
Entry = ExAllocatePool(NonPagedPool, sizeof(NPFS_WAITER_ENTRY));
|
||||
if (Entry == NULL)
|
||||
return STATUS_INSUFFICIENT_RESOURCES;
|
||||
|
||||
Entry->Irp = Irp;
|
||||
Entry->Fcb = Fcb;
|
||||
InsertTailList(&Fcb->Pipe->WaiterListHead, &Entry->Entry);
|
||||
|
||||
IoAcquireCancelSpinLock(&OldIrql);
|
||||
if (!Irp->Cancel)
|
||||
{
|
||||
Irp->Tail.Overlay.DriverContext[0] = Entry;
|
||||
IoMarkIrpPending(Irp);
|
||||
IoSetCancelRoutine(Irp, NpfsListeningCancelRoutine);
|
||||
IoReleaseCancelSpinLock(OldIrql);
|
||||
return STATUS_PENDING;
|
||||
}
|
||||
/* IRP has already been cancelled */
|
||||
IoReleaseCancelSpinLock(OldIrql);
|
||||
|
||||
DPRINT1("FIXME: Remove waiter entry!\n");
|
||||
RemoveEntryList(&Entry->Entry);
|
||||
ExFreePool(Entry);
|
||||
|
||||
return STATUS_CANCELLED;
|
||||
}
|
||||
|
||||
|
||||
static NTSTATUS
|
||||
NpfsConnectPipe(PIRP Irp,
|
||||
PNPFS_FCB Fcb)
|
||||
{
|
||||
PNPFS_PIPE Pipe;
|
||||
PLIST_ENTRY current_entry;
|
||||
@@ -88,29 +146,18 @@ NpfsConnectPipe(PNPFS_FCB Fcb)
|
||||
current_entry = current_entry->Flink;
|
||||
}
|
||||
|
||||
KeUnlockMutex(&Pipe->FcbListLock);
|
||||
|
||||
/* no listening client fcb found */
|
||||
DPRINT("No listening client fcb found -- waiting for client\n");
|
||||
|
||||
Fcb->PipeState = FILE_PIPE_LISTENING_STATE;
|
||||
|
||||
Status = KeWaitForSingleObject(&Fcb->ConnectEvent,
|
||||
UserRequest,
|
||||
KernelMode,
|
||||
FALSE,
|
||||
NULL);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
DPRINT("KeWaitForSingleObject() failed (Status %lx)\n", Status);
|
||||
return Status;
|
||||
}
|
||||
Status = NpfsAddListeningServerInstance(Irp, Fcb);
|
||||
|
||||
Fcb->PipeState = FILE_PIPE_CONNECTED_STATE;
|
||||
KeUnlockMutex(&Pipe->FcbListLock);
|
||||
|
||||
DPRINT("Client Fcb: %p\n", Fcb->OtherSide);
|
||||
DPRINT("NpfsConnectPipe() done (Status %lx)\n", Status);
|
||||
|
||||
return STATUS_PIPE_CONNECTED;
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
@@ -327,7 +374,6 @@ NpfsPeekPipe(PIRP Irp,
|
||||
}
|
||||
|
||||
|
||||
|
||||
NTSTATUS STDCALL
|
||||
NpfsFileSystemControl(PDEVICE_OBJECT DeviceObject,
|
||||
PIRP Irp)
|
||||
@@ -366,7 +412,7 @@ NpfsFileSystemControl(PDEVICE_OBJECT DeviceObject,
|
||||
|
||||
case FSCTL_PIPE_LISTEN:
|
||||
DPRINT("Connecting pipe %wZ\n", &Pipe->PipeName);
|
||||
Status = NpfsConnectPipe(Fcb);
|
||||
Status = NpfsConnectPipe(Irp, Fcb);
|
||||
break;
|
||||
|
||||
case FSCTL_PIPE_PEEK:
|
||||
@@ -439,12 +485,15 @@ NpfsFileSystemControl(PDEVICE_OBJECT DeviceObject,
|
||||
Status = STATUS_UNSUCCESSFUL;
|
||||
}
|
||||
|
||||
Irp->IoStatus.Status = Status;
|
||||
Irp->IoStatus.Information = 0;
|
||||
if (Status != STATUS_PENDING)
|
||||
{
|
||||
Irp->IoStatus.Status = Status;
|
||||
Irp->IoStatus.Information = 0;
|
||||
|
||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
||||
}
|
||||
|
||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
||||
|
||||
return(Status);
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
* FILE: services/fs/np/mount.c
|
||||
* FILE: drivers/fs/np/mount.c
|
||||
* PURPOSE: Named pipe filesystem
|
||||
* PROGRAMMER: David Welch <welch@cwcom.net>
|
||||
*/
|
||||
@@ -64,7 +64,7 @@ DriverEntry(PDRIVER_OBJECT DriverObject,
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
DPRINT("Failed to create named pipe device! (Status %x)\n", Status);
|
||||
return(Status);
|
||||
return Status;
|
||||
}
|
||||
|
||||
/* initialize the device object */
|
||||
@@ -81,7 +81,7 @@ DriverEntry(PDRIVER_OBJECT DriverObject,
|
||||
DeviceExtension->DefaultQuota = 8 * PAGE_SIZE;
|
||||
DeviceExtension->MaxQuota = 64 * PAGE_SIZE;
|
||||
|
||||
return(STATUS_SUCCESS);
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
/* EOF */
|
||||
|
||||
@@ -1,13 +1,7 @@
|
||||
/* $Id$ */
|
||||
|
||||
#ifndef __SERVICES_FS_NP_NPFS_H
|
||||
#define __SERVICES_FS_NP_NPFS_H
|
||||
|
||||
/*
|
||||
* Hacky support for delayed closing of pipes. We need this to support
|
||||
* reading from pipe the was closed on one end.
|
||||
*/
|
||||
#define FIN_WORKAROUND_READCLOSE
|
||||
#ifndef __DRIVERS_FS_NP_NPFS_H
|
||||
#define __DRIVERS_FS_NP_NPFS_H
|
||||
|
||||
typedef struct _NPFS_DEVICE_EXTENSION
|
||||
{
|
||||
@@ -25,6 +19,7 @@ typedef struct _NPFS_PIPE
|
||||
KMUTEX FcbListLock;
|
||||
LIST_ENTRY ServerFcbListHead;
|
||||
LIST_ENTRY ClientFcbListHead;
|
||||
LIST_ENTRY WaiterListHead;
|
||||
ULONG PipeType;
|
||||
ULONG ReadMode;
|
||||
ULONG WriteMode;
|
||||
@@ -58,6 +53,14 @@ typedef struct _NPFS_FCB
|
||||
KSPIN_LOCK DataListLock; /* Data queue lock */
|
||||
} NPFS_FCB, *PNPFS_FCB;
|
||||
|
||||
typedef struct _NPFS_WAITER_ENTRY
|
||||
{
|
||||
LIST_ENTRY Entry;
|
||||
PIRP Irp;
|
||||
PNPFS_PIPE Pipe;
|
||||
PNPFS_FCB Fcb;
|
||||
} NPFS_WAITER_ENTRY, *PNPFS_WAITER_ENTRY;
|
||||
|
||||
|
||||
extern NPAGED_LOOKASIDE_LIST NpfsPipeDataLookasideList;
|
||||
|
||||
@@ -70,8 +73,6 @@ extern NPAGED_LOOKASIDE_LIST NpfsPipeDataLookasideList;
|
||||
|
||||
#define KeUnlockMutex(x) KeReleaseMutex(x, FALSE);
|
||||
|
||||
#define CP DPRINT("\n");
|
||||
|
||||
|
||||
NTSTATUS STDCALL NpfsCreate(PDEVICE_OBJECT DeviceObject, PIRP Irp);
|
||||
NTSTATUS STDCALL NpfsCreateNamedPipe(PDEVICE_OBJECT DeviceObject, PIRP Irp);
|
||||
@@ -89,4 +90,4 @@ NTSTATUS STDCALL NpfsSetInformation(PDEVICE_OBJECT DeviceObject, PIRP Irp);
|
||||
|
||||
NTSTATUS STDCALL NpfsQueryVolumeInformation (PDEVICE_OBJECT DeviceObject, PIRP Irp);
|
||||
|
||||
#endif /* __SERVICES_FS_NP_NPFS_H */
|
||||
#endif /* __DRIVERS_FS_NP_NPFS_H */
|
||||
|
||||
+80
-109
@@ -2,7 +2,7 @@
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
* FILE: services/fs/np/rw.c
|
||||
* FILE: drivers/fs/np/rw.c
|
||||
* PURPOSE: Named pipe filesystem
|
||||
* PROGRAMMER: David Welch <welch@cwcom.net>
|
||||
*/
|
||||
@@ -16,8 +16,6 @@
|
||||
#define NDEBUG
|
||||
#include <debug.h>
|
||||
|
||||
#define FIN_WORKAROUND_READCLOSE
|
||||
|
||||
/* FUNCTIONS *****************************************************************/
|
||||
|
||||
#ifndef NDEBUG
|
||||
@@ -60,7 +58,7 @@ NpfsRead(PDEVICE_OBJECT DeviceObject,
|
||||
KIRQL OldIrql;
|
||||
ULONG Information;
|
||||
PNPFS_FCB Fcb;
|
||||
PNPFS_FCB ReadFcb;
|
||||
PNPFS_FCB WriterFcb;
|
||||
PNPFS_PIPE Pipe;
|
||||
ULONG Length;
|
||||
PVOID Buffer;
|
||||
@@ -74,21 +72,7 @@ NpfsRead(PDEVICE_OBJECT DeviceObject,
|
||||
FileObject = IoStack->FileObject;
|
||||
Fcb = FileObject->FsContext;
|
||||
Pipe = Fcb->Pipe;
|
||||
ReadFcb = Fcb->OtherSide;
|
||||
|
||||
if (ReadFcb == NULL)
|
||||
{
|
||||
DPRINT("Pipe is NOT connected!\n");
|
||||
if (Fcb->PipeState == FILE_PIPE_LISTENING_STATE)
|
||||
Status = STATUS_PIPE_LISTENING;
|
||||
else if (Fcb->PipeState == FILE_PIPE_DISCONNECTED_STATE)
|
||||
Status = STATUS_PIPE_DISCONNECTED;
|
||||
else
|
||||
Status = STATUS_PIPE_BROKEN;
|
||||
Information = 0;
|
||||
DPRINT("%x\n", Status);
|
||||
goto done;
|
||||
}
|
||||
WriterFcb = Fcb->OtherSide;
|
||||
|
||||
if (Irp->MdlAddress == NULL)
|
||||
{
|
||||
@@ -98,7 +82,7 @@ NpfsRead(PDEVICE_OBJECT DeviceObject,
|
||||
goto done;
|
||||
}
|
||||
|
||||
if (ReadFcb->Data == NULL)
|
||||
if (Fcb->Data == NULL)
|
||||
{
|
||||
DPRINT("Pipe is NOT readable!\n");
|
||||
Status = STATUS_UNSUCCESSFUL;
|
||||
@@ -106,31 +90,22 @@ NpfsRead(PDEVICE_OBJECT DeviceObject,
|
||||
goto done;
|
||||
}
|
||||
|
||||
#ifdef FIN_WORKAROUND_READCLOSE
|
||||
if (ReadFcb->ReadDataAvailable == 0 &&
|
||||
ReadFcb->PipeState == FILE_PIPE_CLOSING_STATE)
|
||||
{
|
||||
DPRINT("Other end of pipe is closed!\n");
|
||||
Status = STATUS_PIPE_BROKEN;
|
||||
Information = 0;
|
||||
goto done;
|
||||
}
|
||||
#endif
|
||||
|
||||
Status = STATUS_SUCCESS;
|
||||
Length = IoStack->Parameters.Read.Length;
|
||||
Information = 0;
|
||||
|
||||
Buffer = MmGetSystemAddressForMdl(Irp->MdlAddress);
|
||||
KeAcquireSpinLock(&ReadFcb->DataListLock, &OldIrql);
|
||||
KeAcquireSpinLock(&Fcb->DataListLock, &OldIrql);
|
||||
while (1)
|
||||
{
|
||||
/* FIXME: check if in blocking mode */
|
||||
if (ReadFcb->ReadDataAvailable == 0)
|
||||
if (Fcb->ReadDataAvailable == 0)
|
||||
{
|
||||
KeResetEvent(&Fcb->Event);
|
||||
KeSetEvent(&ReadFcb->Event, IO_NO_INCREMENT, FALSE);
|
||||
KeReleaseSpinLock(&ReadFcb->DataListLock, OldIrql);
|
||||
if (Fcb->PipeState == FILE_PIPE_CONNECTED_STATE)
|
||||
{
|
||||
KeSetEvent(&WriterFcb->Event, IO_NO_INCREMENT, FALSE);
|
||||
}
|
||||
KeReleaseSpinLock(&Fcb->DataListLock, OldIrql);
|
||||
if (Information > 0)
|
||||
{
|
||||
Status = STATUS_SUCCESS;
|
||||
@@ -153,56 +128,45 @@ NpfsRead(PDEVICE_OBJECT DeviceObject,
|
||||
NULL);
|
||||
DPRINT("Finished waiting (%S)! Status: %x\n", Pipe->PipeName.Buffer, Status);
|
||||
|
||||
#ifndef FIN_WORKAROUND_READCLOSE
|
||||
/*
|
||||
* It's possible that the event was signaled because the
|
||||
* other side of pipe was closed.
|
||||
*/
|
||||
if (Fcb->PipeState != FILE_PIPE_CONNECTED_STATE)
|
||||
{
|
||||
DPRINT("PipeState: %x\n", Fcb->PipeState);
|
||||
Status = STATUS_PIPE_BROKEN;
|
||||
goto done;
|
||||
}
|
||||
#endif
|
||||
KeAcquireSpinLock(&ReadFcb->DataListLock, &OldIrql);
|
||||
KeAcquireSpinLock(&Fcb->DataListLock, &OldIrql);
|
||||
}
|
||||
|
||||
if (Pipe->ReadMode == FILE_PIPE_BYTE_STREAM_MODE)
|
||||
{
|
||||
DPRINT("Byte stream mode\n");
|
||||
/* Byte stream mode */
|
||||
while (Length > 0 && ReadFcb->ReadDataAvailable > 0)
|
||||
while (Length > 0 && Fcb->ReadDataAvailable > 0)
|
||||
{
|
||||
CopyLength = RtlRosMin(ReadFcb->ReadDataAvailable, Length);
|
||||
if (ReadFcb->ReadPtr + CopyLength <= ReadFcb->Data + ReadFcb->MaxDataLength)
|
||||
CopyLength = RtlRosMin(Fcb->ReadDataAvailable, Length);
|
||||
if (Fcb->ReadPtr + CopyLength <= Fcb->Data + Fcb->MaxDataLength)
|
||||
{
|
||||
memcpy(Buffer, ReadFcb->ReadPtr, CopyLength);
|
||||
ReadFcb->ReadPtr += CopyLength;
|
||||
if (ReadFcb->ReadPtr == ReadFcb->Data + ReadFcb->MaxDataLength)
|
||||
memcpy(Buffer, Fcb->ReadPtr, CopyLength);
|
||||
Fcb->ReadPtr += CopyLength;
|
||||
if (Fcb->ReadPtr == Fcb->Data + Fcb->MaxDataLength)
|
||||
{
|
||||
ReadFcb->ReadPtr = ReadFcb->Data;
|
||||
Fcb->ReadPtr = Fcb->Data;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
TempLength = ReadFcb->Data + ReadFcb->MaxDataLength - ReadFcb->ReadPtr;
|
||||
memcpy(Buffer, ReadFcb->ReadPtr, TempLength);
|
||||
memcpy(Buffer + TempLength, ReadFcb->Data, CopyLength - TempLength);
|
||||
ReadFcb->ReadPtr = ReadFcb->Data + CopyLength - TempLength;
|
||||
TempLength = Fcb->Data + Fcb->MaxDataLength - Fcb->ReadPtr;
|
||||
memcpy(Buffer, Fcb->ReadPtr, TempLength);
|
||||
memcpy(Buffer + TempLength, Fcb->Data, CopyLength - TempLength);
|
||||
Fcb->ReadPtr = Fcb->Data + CopyLength - TempLength;
|
||||
}
|
||||
|
||||
Buffer += CopyLength;
|
||||
Length -= CopyLength;
|
||||
Information += CopyLength;
|
||||
|
||||
ReadFcb->ReadDataAvailable -= CopyLength;
|
||||
ReadFcb->WriteQuotaAvailable += CopyLength;
|
||||
Fcb->ReadDataAvailable -= CopyLength;
|
||||
Fcb->WriteQuotaAvailable += CopyLength;
|
||||
}
|
||||
|
||||
if (Length == 0)
|
||||
{
|
||||
KeSetEvent(&ReadFcb->Event, IO_NO_INCREMENT, FALSE);
|
||||
KeSetEvent(&WriterFcb->Event, IO_NO_INCREMENT, FALSE);
|
||||
KeResetEvent(&Fcb->Event);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -211,11 +175,11 @@ NpfsRead(PDEVICE_OBJECT DeviceObject,
|
||||
DPRINT("Message mode\n");
|
||||
|
||||
/* Message mode */
|
||||
if (ReadFcb->ReadDataAvailable)
|
||||
if (Fcb->ReadDataAvailable)
|
||||
{
|
||||
/* Truncate the message if the receive buffer is too small */
|
||||
CopyLength = RtlRosMin(ReadFcb->ReadDataAvailable, Length);
|
||||
memcpy(Buffer, ReadFcb->Data, CopyLength);
|
||||
CopyLength = RtlRosMin(Fcb->ReadDataAvailable, Length);
|
||||
memcpy(Buffer, Fcb->Data, CopyLength);
|
||||
|
||||
#ifndef NDEBUG
|
||||
DPRINT("Length %d Buffer %x\n",CopyLength,Buffer);
|
||||
@@ -223,28 +187,34 @@ NpfsRead(PDEVICE_OBJECT DeviceObject,
|
||||
#endif
|
||||
|
||||
Information = CopyLength;
|
||||
ReadFcb->ReadDataAvailable = 0;
|
||||
ReadFcb->WriteQuotaAvailable = ReadFcb->MaxDataLength;
|
||||
|
||||
if (Fcb->ReadDataAvailable > Length)
|
||||
{
|
||||
memmove(Fcb->Data, Fcb->Data + Length,
|
||||
Fcb->ReadDataAvailable - Length);
|
||||
Fcb->ReadDataAvailable -= Length;
|
||||
Status = STATUS_MORE_ENTRIES;
|
||||
}
|
||||
else
|
||||
{
|
||||
Fcb->ReadDataAvailable = 0;
|
||||
Fcb->WriteQuotaAvailable = Fcb->MaxDataLength;
|
||||
}
|
||||
}
|
||||
|
||||
if (Information > 0)
|
||||
{
|
||||
KeSetEvent(&ReadFcb->Event, IO_NO_INCREMENT, FALSE);
|
||||
if (Fcb->PipeState == FILE_PIPE_CONNECTED_STATE)
|
||||
{
|
||||
KeSetEvent(&WriterFcb->Event, IO_NO_INCREMENT, FALSE);
|
||||
}
|
||||
KeResetEvent(&Fcb->Event);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef FIN_WORKAROUND_READCLOSE
|
||||
if (ReadFcb->ReadDataAvailable == 0 &&
|
||||
ReadFcb->PipeState == FILE_PIPE_CLOSING_STATE)
|
||||
{
|
||||
DPRINT("Other end of pipe is closed!\n");
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
KeReleaseSpinLock(&ReadFcb->DataListLock, OldIrql);
|
||||
KeReleaseSpinLock(&Fcb->DataListLock, OldIrql);
|
||||
|
||||
done:
|
||||
Irp->IoStatus.Status = Status;
|
||||
@@ -265,6 +235,7 @@ NpfsWrite(PDEVICE_OBJECT DeviceObject,
|
||||
PIO_STACK_LOCATION IoStack;
|
||||
PFILE_OBJECT FileObject;
|
||||
PNPFS_FCB Fcb = NULL;
|
||||
PNPFS_FCB ReaderFcb;
|
||||
PNPFS_PIPE Pipe = NULL;
|
||||
PUCHAR Buffer;
|
||||
NTSTATUS Status = STATUS_SUCCESS;
|
||||
@@ -283,6 +254,7 @@ NpfsWrite(PDEVICE_OBJECT DeviceObject,
|
||||
DPRINT("Pipe name %wZ\n", &FileObject->FileName);
|
||||
|
||||
Fcb = FileObject->FsContext;
|
||||
ReaderFcb = Fcb->OtherSide;
|
||||
Pipe = Fcb->Pipe;
|
||||
|
||||
Length = IoStack->Parameters.Write.Length;
|
||||
@@ -297,7 +269,7 @@ NpfsWrite(PDEVICE_OBJECT DeviceObject,
|
||||
goto done;
|
||||
}
|
||||
|
||||
if (Fcb->OtherSide == NULL)
|
||||
if (ReaderFcb == NULL)
|
||||
{
|
||||
DPRINT("Pipe is NOT connected!\n");
|
||||
if (Fcb->PipeState == FILE_PIPE_LISTENING_STATE)
|
||||
@@ -310,7 +282,7 @@ NpfsWrite(PDEVICE_OBJECT DeviceObject,
|
||||
goto done;
|
||||
}
|
||||
|
||||
if (Fcb->Data == NULL)
|
||||
if (ReaderFcb->Data == NULL)
|
||||
{
|
||||
DPRINT("Pipe is NOT writable!\n");
|
||||
Status = STATUS_UNSUCCESSFUL;
|
||||
@@ -321,7 +293,7 @@ NpfsWrite(PDEVICE_OBJECT DeviceObject,
|
||||
Status = STATUS_SUCCESS;
|
||||
Buffer = MmGetSystemAddressForMdl (Irp->MdlAddress);
|
||||
|
||||
KeAcquireSpinLock(&Fcb->DataListLock, &OldIrql);
|
||||
KeAcquireSpinLock(&ReaderFcb->DataListLock, &OldIrql);
|
||||
#ifndef NDEBUG
|
||||
DPRINT("Length %d Buffer %x Offset %x\n",Length,Buffer,Offset);
|
||||
HexDump(Buffer, Length);
|
||||
@@ -329,11 +301,10 @@ NpfsWrite(PDEVICE_OBJECT DeviceObject,
|
||||
|
||||
while(1)
|
||||
{
|
||||
if (Fcb->WriteQuotaAvailable == 0)
|
||||
if (ReaderFcb->WriteQuotaAvailable == 0)
|
||||
{
|
||||
KeResetEvent(&Fcb->Event);
|
||||
KeSetEvent(&Fcb->OtherSide->Event, IO_NO_INCREMENT, FALSE);
|
||||
KeReleaseSpinLock(&Fcb->DataListLock, OldIrql);
|
||||
KeSetEvent(&ReaderFcb->Event, IO_NO_INCREMENT, FALSE);
|
||||
KeReleaseSpinLock(&ReaderFcb->DataListLock, OldIrql);
|
||||
if (Fcb->PipeState != FILE_PIPE_CONNECTED_STATE)
|
||||
{
|
||||
Status = STATUS_PIPE_BROKEN;
|
||||
@@ -348,7 +319,6 @@ NpfsWrite(PDEVICE_OBJECT DeviceObject,
|
||||
NULL);
|
||||
DPRINT("Finished waiting (%S)! Status: %x\n", Pipe->PipeName.Buffer, Status);
|
||||
|
||||
#ifndef FIN_WORKAROUND_READCLOSE
|
||||
/*
|
||||
* It's possible that the event was signaled because the
|
||||
* other side of pipe was closed.
|
||||
@@ -359,44 +329,44 @@ NpfsWrite(PDEVICE_OBJECT DeviceObject,
|
||||
Status = STATUS_PIPE_BROKEN;
|
||||
goto done;
|
||||
}
|
||||
#endif
|
||||
KeAcquireSpinLock(&Fcb->DataListLock, &OldIrql);
|
||||
KeAcquireSpinLock(&ReaderFcb->DataListLock, &OldIrql);
|
||||
}
|
||||
|
||||
if (Pipe->WriteMode == FILE_PIPE_BYTE_STREAM_MODE)
|
||||
{
|
||||
DPRINT("Byte stream mode\n");
|
||||
while (Length > 0 && Fcb->WriteQuotaAvailable > 0)
|
||||
while (Length > 0 && ReaderFcb->WriteQuotaAvailable > 0)
|
||||
{
|
||||
CopyLength = RtlRosMin(Length, Fcb->WriteQuotaAvailable);
|
||||
if (Fcb->WritePtr + CopyLength <= Fcb->Data + Fcb->MaxDataLength)
|
||||
CopyLength = RtlRosMin(Length, ReaderFcb->WriteQuotaAvailable);
|
||||
if (ReaderFcb->WritePtr + CopyLength <= ReaderFcb->Data + ReaderFcb->MaxDataLength)
|
||||
{
|
||||
memcpy(Fcb->WritePtr, Buffer, CopyLength);
|
||||
Fcb->WritePtr += CopyLength;
|
||||
if (Fcb->WritePtr == Fcb->Data + Fcb->MaxDataLength)
|
||||
memcpy(ReaderFcb->WritePtr, Buffer, CopyLength);
|
||||
ReaderFcb->WritePtr += CopyLength;
|
||||
if (ReaderFcb->WritePtr == ReaderFcb->Data + ReaderFcb->MaxDataLength)
|
||||
{
|
||||
Fcb->WritePtr = Fcb->Data;
|
||||
ReaderFcb->WritePtr = ReaderFcb->Data;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
TempLength = Fcb->Data + Fcb->MaxDataLength - Fcb->WritePtr;
|
||||
memcpy(Fcb->WritePtr, Buffer, TempLength);
|
||||
memcpy(Fcb->Data, Buffer + TempLength, CopyLength - TempLength);
|
||||
Fcb->WritePtr = Fcb->Data + CopyLength - TempLength;
|
||||
TempLength = ReaderFcb->Data + ReaderFcb->MaxDataLength - ReaderFcb->WritePtr;
|
||||
memcpy(ReaderFcb->WritePtr, Buffer, TempLength);
|
||||
memcpy(ReaderFcb->Data, Buffer + TempLength, CopyLength - TempLength);
|
||||
ReaderFcb->WritePtr = ReaderFcb->Data + CopyLength - TempLength;
|
||||
}
|
||||
|
||||
Buffer += CopyLength;
|
||||
Length -= CopyLength;
|
||||
Information += CopyLength;
|
||||
|
||||
Fcb->ReadDataAvailable += CopyLength;
|
||||
Fcb->WriteQuotaAvailable -= CopyLength;
|
||||
ReaderFcb->ReadDataAvailable += CopyLength;
|
||||
ReaderFcb->WriteQuotaAvailable -= CopyLength;
|
||||
}
|
||||
|
||||
if (Length == 0)
|
||||
{
|
||||
KeSetEvent(&Fcb->OtherSide->Event, IO_NO_INCREMENT, FALSE);
|
||||
KeSetEvent(&ReaderFcb->Event, IO_NO_INCREMENT, FALSE);
|
||||
KeResetEvent(&Fcb->Event);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -405,23 +375,24 @@ NpfsWrite(PDEVICE_OBJECT DeviceObject,
|
||||
DPRINT("Message mode\n");
|
||||
if (Length > 0)
|
||||
{
|
||||
CopyLength = RtlRosMin(Length, Fcb->WriteQuotaAvailable);
|
||||
memcpy(Fcb->Data, Buffer, CopyLength);
|
||||
CopyLength = RtlRosMin(Length, ReaderFcb->WriteQuotaAvailable);
|
||||
memcpy(ReaderFcb->Data, Buffer, CopyLength);
|
||||
|
||||
Information = CopyLength;
|
||||
Fcb->ReadDataAvailable = CopyLength;
|
||||
Fcb->WriteQuotaAvailable = 0;
|
||||
ReaderFcb->ReadDataAvailable = CopyLength;
|
||||
ReaderFcb->WriteQuotaAvailable = 0;
|
||||
}
|
||||
|
||||
if (Information > 0)
|
||||
{
|
||||
KeSetEvent(&Fcb->OtherSide->Event, IO_NO_INCREMENT, FALSE);
|
||||
KeSetEvent(&ReaderFcb->Event, IO_NO_INCREMENT, FALSE);
|
||||
KeResetEvent(&Fcb->Event);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
KeReleaseSpinLock(&Fcb->DataListLock, OldIrql);
|
||||
KeReleaseSpinLock(&ReaderFcb->DataListLock, OldIrql);
|
||||
|
||||
done:
|
||||
Irp->IoStatus.Status = Status;
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
* FILE: services/fs/npfs/volume.c
|
||||
* FILE: drivers/fs/npfs/volume.c
|
||||
* PURPOSE: Named pipe filesystem
|
||||
* PROGRAMMER: Eric Kohl <ekohl@rz-online.de>
|
||||
* PROGRAMMER: Eric Kohl
|
||||
*/
|
||||
|
||||
/* INCLUDES *****************************************************************/
|
||||
@@ -23,20 +23,20 @@ static NTSTATUS
|
||||
NpfsQueryFsDeviceInformation(PFILE_FS_DEVICE_INFORMATION FsDeviceInfo,
|
||||
PULONG BufferLength)
|
||||
{
|
||||
DPRINT("NpfsQueryFsDeviceInformation()\n");
|
||||
DPRINT("FsDeviceInfo = %p\n", FsDeviceInfo);
|
||||
|
||||
if (*BufferLength < sizeof(FILE_FS_DEVICE_INFORMATION))
|
||||
return(STATUS_BUFFER_OVERFLOW);
|
||||
|
||||
FsDeviceInfo->DeviceType = FILE_DEVICE_NAMED_PIPE;
|
||||
FsDeviceInfo->Characteristics = 0;
|
||||
|
||||
*BufferLength -= sizeof(FILE_FS_DEVICE_INFORMATION);
|
||||
|
||||
DPRINT("NpfsQueryFsDeviceInformation() finished.\n");
|
||||
|
||||
return(STATUS_SUCCESS);
|
||||
DPRINT("NpfsQueryFsDeviceInformation()\n");
|
||||
DPRINT("FsDeviceInfo = %p\n", FsDeviceInfo);
|
||||
|
||||
if (*BufferLength < sizeof(FILE_FS_DEVICE_INFORMATION))
|
||||
return STATUS_BUFFER_OVERFLOW;
|
||||
|
||||
FsDeviceInfo->DeviceType = FILE_DEVICE_NAMED_PIPE;
|
||||
FsDeviceInfo->Characteristics = 0;
|
||||
|
||||
*BufferLength -= sizeof(FILE_FS_DEVICE_INFORMATION);
|
||||
|
||||
DPRINT("NpfsQueryFsDeviceInformation() finished.\n");
|
||||
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
@@ -44,22 +44,22 @@ static NTSTATUS
|
||||
NpfsQueryFsAttributeInformation(PFILE_FS_ATTRIBUTE_INFORMATION FsAttributeInfo,
|
||||
PULONG BufferLength)
|
||||
{
|
||||
DPRINT("NpfsQueryFsAttributeInformation() called.\n");
|
||||
DPRINT("FsAttributeInfo = %p\n", FsAttributeInfo);
|
||||
|
||||
if (*BufferLength < sizeof(FILE_FS_ATTRIBUTE_INFORMATION) + 8)
|
||||
return(STATUS_BUFFER_OVERFLOW);
|
||||
|
||||
FsAttributeInfo->FileSystemAttributes = FILE_CASE_PRESERVED_NAMES;
|
||||
FsAttributeInfo->MaximumComponentNameLength = 255;
|
||||
FsAttributeInfo->FileSystemNameLength = 8;
|
||||
wcscpy(FsAttributeInfo->FileSystemName,
|
||||
L"NPFS");
|
||||
|
||||
DPRINT("NpfsQueryFsAttributeInformation() finished.\n");
|
||||
*BufferLength -= (sizeof(FILE_FS_ATTRIBUTE_INFORMATION) + 8);
|
||||
|
||||
return(STATUS_SUCCESS);
|
||||
DPRINT("NpfsQueryFsAttributeInformation() called.\n");
|
||||
DPRINT("FsAttributeInfo = %p\n", FsAttributeInfo);
|
||||
|
||||
if (*BufferLength < sizeof(FILE_FS_ATTRIBUTE_INFORMATION) + 8)
|
||||
return STATUS_BUFFER_OVERFLOW;
|
||||
|
||||
FsAttributeInfo->FileSystemAttributes = FILE_CASE_PRESERVED_NAMES;
|
||||
FsAttributeInfo->MaximumComponentNameLength = 255;
|
||||
FsAttributeInfo->FileSystemNameLength = 8;
|
||||
wcscpy(FsAttributeInfo->FileSystemName,
|
||||
L"NPFS");
|
||||
|
||||
DPRINT("NpfsQueryFsAttributeInformation() finished.\n");
|
||||
*BufferLength -= (sizeof(FILE_FS_ATTRIBUTE_INFORMATION) + 8);
|
||||
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
@@ -67,54 +67,53 @@ NTSTATUS STDCALL
|
||||
NpfsQueryVolumeInformation(PDEVICE_OBJECT DeviceObject,
|
||||
PIRP Irp)
|
||||
{
|
||||
PIO_STACK_LOCATION Stack;
|
||||
FS_INFORMATION_CLASS FsInformationClass;
|
||||
NTSTATUS Status = STATUS_SUCCESS;
|
||||
PVOID SystemBuffer;
|
||||
ULONG BufferLength;
|
||||
|
||||
/* PRECONDITION */
|
||||
assert(DeviceObject != NULL);
|
||||
assert(Irp != NULL);
|
||||
|
||||
DPRINT("NpfsQueryVolumeInformation(DeviceObject %x, Irp %x)\n",
|
||||
DeviceObject,
|
||||
Irp);
|
||||
|
||||
Stack = IoGetCurrentIrpStackLocation (Irp);
|
||||
FsInformationClass = Stack->Parameters.QueryVolume.FsInformationClass;
|
||||
BufferLength = Stack->Parameters.QueryVolume.Length;
|
||||
SystemBuffer = Irp->AssociatedIrp.SystemBuffer;
|
||||
|
||||
DPRINT("FsInformationClass %d\n", FsInformationClass);
|
||||
DPRINT("SystemBuffer %x\n", SystemBuffer);
|
||||
|
||||
switch (FsInformationClass)
|
||||
{
|
||||
case FileFsDeviceInformation:
|
||||
Status = NpfsQueryFsDeviceInformation(SystemBuffer,
|
||||
&BufferLength);
|
||||
break;
|
||||
|
||||
case FileFsAttributeInformation:
|
||||
Status = NpfsQueryFsAttributeInformation(SystemBuffer,
|
||||
&BufferLength);
|
||||
break;
|
||||
|
||||
default:
|
||||
Status = STATUS_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
Irp->IoStatus.Status = Status;
|
||||
if (NT_SUCCESS(Status))
|
||||
Irp->IoStatus.Information =
|
||||
Stack->Parameters.QueryVolume.Length - BufferLength;
|
||||
else
|
||||
Irp->IoStatus.Information = 0;
|
||||
IoCompleteRequest(Irp,
|
||||
IO_NO_INCREMENT);
|
||||
|
||||
return(Status);
|
||||
PIO_STACK_LOCATION Stack;
|
||||
FS_INFORMATION_CLASS FsInformationClass;
|
||||
NTSTATUS Status = STATUS_SUCCESS;
|
||||
PVOID SystemBuffer;
|
||||
ULONG BufferLength;
|
||||
|
||||
/* PRECONDITION */
|
||||
ASSERT(DeviceObject != NULL);
|
||||
ASSERT(Irp != NULL);
|
||||
|
||||
DPRINT("NpfsQueryVolumeInformation(DeviceObject %x, Irp %x)\n",
|
||||
DeviceObject,
|
||||
Irp);
|
||||
|
||||
Stack = IoGetCurrentIrpStackLocation(Irp);
|
||||
FsInformationClass = Stack->Parameters.QueryVolume.FsInformationClass;
|
||||
BufferLength = Stack->Parameters.QueryVolume.Length;
|
||||
SystemBuffer = Irp->AssociatedIrp.SystemBuffer;
|
||||
|
||||
DPRINT("FsInformationClass %d\n", FsInformationClass);
|
||||
DPRINT("SystemBuffer %x\n", SystemBuffer);
|
||||
|
||||
switch (FsInformationClass)
|
||||
{
|
||||
case FileFsDeviceInformation:
|
||||
Status = NpfsQueryFsDeviceInformation(SystemBuffer,
|
||||
&BufferLength);
|
||||
break;
|
||||
|
||||
case FileFsAttributeInformation:
|
||||
Status = NpfsQueryFsAttributeInformation(SystemBuffer,
|
||||
&BufferLength);
|
||||
break;
|
||||
|
||||
default:
|
||||
Status = STATUS_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
Irp->IoStatus.Status = Status;
|
||||
if (NT_SUCCESS(Status))
|
||||
Irp->IoStatus.Information = Stack->Parameters.QueryVolume.Length - BufferLength;
|
||||
else
|
||||
Irp->IoStatus.Information = 0;
|
||||
IoCompleteRequest(Irp,
|
||||
IO_NO_INCREMENT);
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
/* EOF */
|
||||
|
||||
@@ -155,7 +155,11 @@ NtfsReleaseFCB(PDEVICE_EXTENSION Vcb,
|
||||
if (Fcb->RefCount <= 0 && !NtfsFCBIsDirectory(Fcb))
|
||||
{
|
||||
RemoveEntryList(&Fcb->FcbListEntry);
|
||||
#ifdef USE_ROS_CC_AND_FS
|
||||
CcRosReleaseFileCache(Fcb->FileObject);
|
||||
#else
|
||||
CcUninitializeCacheMap (Fcb->FileObject, NULL, NULL);
|
||||
#endif
|
||||
NtfsDestroyFCB(Fcb);
|
||||
}
|
||||
KeReleaseSpinLock(&Vcb->FcbListLock, oldIrql);
|
||||
@@ -241,7 +245,7 @@ NtfsFCBInitializeCache(PVCB Vcb,
|
||||
newCCB->PtrFileObject = FileObject;
|
||||
Fcb->FileObject = FileObject;
|
||||
Fcb->DevExt = Vcb;
|
||||
|
||||
#ifdef ROS_USE_CC_AND_FS
|
||||
Status = CcRosInitializeFileCache(FileObject,
|
||||
CACHEPAGESIZE(Vcb));
|
||||
if (!NT_SUCCESS(Status))
|
||||
@@ -249,7 +253,14 @@ NtfsFCBInitializeCache(PVCB Vcb,
|
||||
DbgPrint("CcRosInitializeFileCache failed\n");
|
||||
KEBUGCHECK(0);
|
||||
}
|
||||
|
||||
#else
|
||||
Status = STATUS_SUCCESS;
|
||||
CcInitializeCacheMap(FileObject,
|
||||
(PCC_FILE_SIZES)(&Fcb->RFCB.AllocationSize),
|
||||
FALSE,
|
||||
NULL,
|
||||
NULL);
|
||||
#endif
|
||||
ObDereferenceObject(FileObject);
|
||||
Fcb->Flags |= FCB_CACHE_INITIALIZED;
|
||||
|
||||
@@ -394,7 +405,6 @@ NtfsAttachFCBToFileObject(PDEVICE_EXTENSION Vcb,
|
||||
PFCB Fcb,
|
||||
PFILE_OBJECT FileObject)
|
||||
{
|
||||
NTSTATUS Status;
|
||||
PCCB newCCB;
|
||||
|
||||
newCCB = ExAllocatePoolWithTag(NonPagedPool, sizeof(CCB), TAG_CCB);
|
||||
@@ -412,6 +422,8 @@ NtfsAttachFCBToFileObject(PDEVICE_EXTENSION Vcb,
|
||||
|
||||
if (!(Fcb->Flags & FCB_CACHE_INITIALIZED))
|
||||
{
|
||||
#ifdef ROS_USE_CC_AND_FS
|
||||
NTSTATUS Status;
|
||||
Status = CcRosInitializeFileCache(FileObject,
|
||||
CACHEPAGESIZE(Vcb));
|
||||
if (!NT_SUCCESS(Status))
|
||||
@@ -419,6 +431,13 @@ NtfsAttachFCBToFileObject(PDEVICE_EXTENSION Vcb,
|
||||
DbgPrint("CcRosInitializeFileCache failed\n");
|
||||
KEBUGCHECK(0);
|
||||
}
|
||||
#else
|
||||
CcInitializeCacheMap(FileObject,
|
||||
(PCC_FILE_SIZES)(&Fcb->RFCB.AllocationSize),
|
||||
FALSE,
|
||||
NULL,
|
||||
NULL);
|
||||
#endif
|
||||
Fcb->Flags |= FCB_CACHE_INITIALIZED;
|
||||
}
|
||||
|
||||
|
||||
@@ -387,7 +387,7 @@ NtfsMountVolume(PDEVICE_OBJECT DeviceObject,
|
||||
|
||||
// Fcb->Entry.ExtentLocationL = 0;
|
||||
// Fcb->Entry.DataLengthL = DeviceExt->CdInfo.VolumeSpaceSize * BLOCKSIZE;
|
||||
|
||||
#ifdef ROS_USE_CC_AND_FS
|
||||
Status = CcRosInitializeFileCache(DeviceExt->StreamFileObject,
|
||||
CACHEPAGESIZE(DeviceExt));
|
||||
if (!NT_SUCCESS (Status))
|
||||
@@ -395,7 +395,13 @@ NtfsMountVolume(PDEVICE_OBJECT DeviceObject,
|
||||
DbgPrint("CcRosInitializeFileCache() failed (Status %lx)\n", Status);
|
||||
goto ByeBye;
|
||||
}
|
||||
|
||||
#else
|
||||
CcInitializeCacheMap(DeviceExt->StreamFileObject,
|
||||
(PCC_FILE_SIZES)(&Fcb->RFCB.AllocationSize),
|
||||
FALSE,
|
||||
NULL,
|
||||
NULL);
|
||||
#endif
|
||||
ExInitializeResourceLite(&DeviceExt->DirResource);
|
||||
// ExInitializeResourceLite(&DeviceExt->FatResource);
|
||||
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
|
||||
#include <ddk/ntifs.h>
|
||||
|
||||
#define USE_ROS_CC_AND_FS
|
||||
|
||||
|
||||
#define CACHEPAGESIZE(pDeviceExt) \
|
||||
((pDeviceExt)->NtfsInfo.BytesPerCluster > PAGE_SIZE ? \
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
|
||||
/* FUNCTIONS ***************************************************************/
|
||||
|
||||
NTSTATUS STDCALL
|
||||
static NTSTATUS STDCALL
|
||||
VfatReadWritePartialCompletion (IN PDEVICE_OBJECT DeviceObject,
|
||||
IN PIRP Irp,
|
||||
IN PVOID Context)
|
||||
@@ -272,9 +272,9 @@ VfatWriteDiskPartial (IN PVFAT_IRP_CONTEXT IrpContext,
|
||||
NTSTATUS
|
||||
VfatBlockDeviceIoControl (IN PDEVICE_OBJECT DeviceObject,
|
||||
IN ULONG CtlCode,
|
||||
IN PVOID InputBuffer,
|
||||
IN PVOID InputBuffer OPTIONAL,
|
||||
IN ULONG InputBufferSize,
|
||||
IN OUT PVOID OutputBuffer,
|
||||
IN OUT PVOID OutputBuffer OPTIONAL,
|
||||
IN OUT PULONG OutputBufferSize,
|
||||
IN BOOLEAN Override)
|
||||
{
|
||||
|
||||
@@ -186,7 +186,7 @@ FindFile (PDEVICE_EXTENSION DeviceExt,
|
||||
*/
|
||||
{
|
||||
PWCHAR PathNameBuffer;
|
||||
ULONG PathNameBufferLength;
|
||||
USHORT PathNameBufferLength;
|
||||
NTSTATUS Status;
|
||||
PVOID Context = NULL;
|
||||
PVOID Page;
|
||||
|
||||
@@ -33,7 +33,7 @@ FsdDosDateTimeToSystemTime (PDEVICE_EXTENSION DeviceExt, USHORT DosDate, USHORT
|
||||
|
||||
TimeFields.Day = pddate->Day;
|
||||
TimeFields.Month = pddate->Month;
|
||||
TimeFields.Year = DeviceExt->BaseDateYear + pddate->Year;
|
||||
TimeFields.Year = (CSHORT)(DeviceExt->BaseDateYear + pddate->Year);
|
||||
|
||||
RtlTimeFieldsToTime (&TimeFields, &LocalTime);
|
||||
ExLocalTimeToSystemTime(&LocalTime, SystemTime);
|
||||
@@ -261,7 +261,7 @@ VfatGetFileBothInformation (PVFAT_DIRENTRY_CONTEXT DirContext,
|
||||
pInfo->NextEntryOffset =
|
||||
ULONG_ROUND_UP (sizeof (FILE_BOTH_DIR_INFORMATION) + DirContext->LongNameU.Length);
|
||||
RtlCopyMemory(pInfo->ShortName, DirContext->ShortNameU.Buffer, DirContext->ShortNameU.Length);
|
||||
pInfo->ShortNameLength = DirContext->ShortNameU.Length;
|
||||
pInfo->ShortNameLength = (CCHAR)DirContext->ShortNameU.Length;
|
||||
RtlCopyMemory (pInfo->FileName, DirContext->LongNameU.Buffer, DirContext->LongNameU.Length);
|
||||
// pInfo->FileIndex=;
|
||||
FsdDosDateTimeToSystemTime (DeviceExt, DirContext->DirEntry.Fat.CreationDate,
|
||||
|
||||
@@ -45,7 +45,7 @@ VfatUpdateEntry (PVFATFCB pFcb)
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
ASSERT (pFcb->parrentFcb);
|
||||
ASSERT (pFcb->parentFcb);
|
||||
|
||||
Offset.u.HighPart = 0;
|
||||
Offset.u.LowPart = dirIndex * SizeDirEntry;
|
||||
|
||||
@@ -72,7 +72,7 @@ vfatSplitPathName(PUNICODE_STRING PathNameU, PUNICODE_STRING DirNameU, PUNICODE_
|
||||
VOID
|
||||
vfatInitFcb(PVFATFCB Fcb, PUNICODE_STRING NameU)
|
||||
{
|
||||
ULONG PathNameBufferLength;
|
||||
USHORT PathNameBufferLength;
|
||||
|
||||
if (NameU)
|
||||
PathNameBufferLength = NameU->Length + sizeof(WCHAR);
|
||||
@@ -460,7 +460,7 @@ vfatMakeFCBFromDirEntry(PVCB vcb,
|
||||
{
|
||||
PVFATFCB rcFCB;
|
||||
PWCHAR PathNameBuffer;
|
||||
ULONG PathNameLength;
|
||||
USHORT PathNameLength;
|
||||
ULONG Size;
|
||||
ULONG hash;
|
||||
|
||||
@@ -583,7 +583,7 @@ vfatAttachFCBToFileObject (PDEVICE_EXTENSION vcb,
|
||||
fileObject->SectionObjectPointer = &fcb->SectionObjectPointers;
|
||||
fileObject->FsContext = fcb;
|
||||
fileObject->FsContext2 = newCCB;
|
||||
DPRINT ("file open: fcb:%x PathName:%wZ file size: %d\n", fcb, &fcb->PathNameU, fcb->entry.FileSize);
|
||||
DPRINT ("file open: fcb:%x PathName:%wZ\n", fcb, &fcb->PathNameU);
|
||||
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -109,8 +109,8 @@ VfatHasFileSystem(PDEVICE_OBJECT DeviceToMount,
|
||||
}
|
||||
else if (DiskGeometry.MediaType == RemovableMedia &&
|
||||
PartitionInfo.PartitionNumber > 0 &&
|
||||
PartitionInfo.StartingOffset.QuadPart == 0LL &&
|
||||
PartitionInfo.PartitionLength.QuadPart > 0LL)
|
||||
PartitionInfo.StartingOffset.QuadPart == 0 &&
|
||||
PartitionInfo.PartitionLength.QuadPart > 0)
|
||||
{
|
||||
/* This is possible a removable media formated as super floppy */
|
||||
*RecognizedFS = TRUE;
|
||||
@@ -298,7 +298,7 @@ VfatHasFileSystem(PDEVICE_OBJECT DeviceToMount,
|
||||
FatInfo.SectorsPerCluster = BootFatX->SectorsPerCluster;
|
||||
FatInfo.rootDirectorySectors = BootFatX->SectorsPerCluster;
|
||||
FatInfo.BytesPerCluster = BootFatX->SectorsPerCluster * DiskGeometry.BytesPerSector;
|
||||
FatInfo.Sectors = PartitionInfo.PartitionLength.QuadPart / DiskGeometry.BytesPerSector;
|
||||
FatInfo.Sectors = (ULONG)(PartitionInfo.PartitionLength.QuadPart / DiskGeometry.BytesPerSector);
|
||||
if (FatInfo.Sectors / FatInfo.SectorsPerCluster < 65525)
|
||||
{
|
||||
DPRINT("FATX16\n");
|
||||
|
||||
@@ -12,13 +12,7 @@
|
||||
|
||||
/* INCLUDES *****************************************************************/
|
||||
|
||||
#include <ddk/ntddk.h>
|
||||
#include <wchar.h>
|
||||
#include <ntos/minmax.h>
|
||||
|
||||
#define NDEBUG
|
||||
#include <debug.h>
|
||||
|
||||
#include "vfat.h"
|
||||
|
||||
/*
|
||||
@@ -728,7 +722,7 @@ VfatRead(PVFAT_IRP_CONTEXT IrpContext)
|
||||
{
|
||||
DPRINT("VfatReadFile returned STATUS_VERIFY_REQUIRED\n");
|
||||
DeviceToVerify = IoGetDeviceToVerify(PsGetCurrentThread());
|
||||
IoSetDeviceToVerify(PsGetCurrentThread(), NULL);
|
||||
IoSetDeviceToVerify(PsGetCurrentThread(), DeviceToVerify);
|
||||
Status = IoVerifyVolume (DeviceToVerify, FALSE);
|
||||
|
||||
if (NT_SUCCESS(Status))
|
||||
|
||||
@@ -14,6 +14,34 @@
|
||||
|
||||
/* FUNCTIONS ****************************************************************/
|
||||
|
||||
NTSTATUS
|
||||
VfatDiskShutDown(PVCB Vcb)
|
||||
{
|
||||
PIRP Irp;
|
||||
KEVENT Event;
|
||||
NTSTATUS Status;
|
||||
IO_STATUS_BLOCK IoStatus;
|
||||
|
||||
KeInitializeEvent(&Event, NotificationEvent, FALSE);
|
||||
Irp = IoBuildSynchronousFsdRequest(IRP_MJ_SHUTDOWN, Vcb->StorageDevice,
|
||||
NULL, 0, NULL, &Event, &IoStatus);
|
||||
if (Irp)
|
||||
{
|
||||
Status = IoCallDriver(Vcb->StorageDevice, Irp);
|
||||
if (Status == STATUS_PENDING)
|
||||
{
|
||||
KeWaitForSingleObject(&Event, Executive, KernelMode, FALSE, NULL);
|
||||
Status = IoStatus.Status;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Status = IoStatus.Status;
|
||||
}
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
NTSTATUS STDCALL
|
||||
VfatShutdown(PDEVICE_OBJECT DeviceObject, PIRP Irp)
|
||||
{
|
||||
@@ -37,15 +65,24 @@ VfatShutdown(PDEVICE_OBJECT DeviceObject, PIRP Irp)
|
||||
|
||||
ExAcquireResourceExclusiveLite(&DeviceExt->DirResource, TRUE);
|
||||
Status = VfatFlushVolume(DeviceExt, DeviceExt->VolumeFcb);
|
||||
ExReleaseResourceLite(&DeviceExt->DirResource);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
if (NT_SUCCESS(Status))
|
||||
{
|
||||
Status = VfatDiskShutDown(DeviceExt);
|
||||
if (!NT_SUCCESS(Status))
|
||||
DPRINT1("VfatDiskShutDown failed, status = %x\n", Status);
|
||||
}
|
||||
else
|
||||
{
|
||||
DPRINT1("VfatFlushVolume failed, status = %x\n", Status);
|
||||
Irp->IoStatus.Status = Status;
|
||||
}
|
||||
ExReleaseResourceLite(&DeviceExt->DirResource);
|
||||
|
||||
/* FIXME: Unmount the logical volume */
|
||||
|
||||
if (!NT_SUCCESS(Status))
|
||||
Irp->IoStatus.Status = Status;
|
||||
}
|
||||
ExReleaseResourceLite(&VfatGlobalData->VolumeListLock);
|
||||
ExReleaseResourceLite(&VfatGlobalData->VolumeListLock);
|
||||
|
||||
/* FIXME: Free all global acquired resources */
|
||||
|
||||
@@ -53,13 +90,13 @@ VfatShutdown(PDEVICE_OBJECT DeviceObject, PIRP Irp)
|
||||
}
|
||||
else
|
||||
{
|
||||
Irp->IoStatus.Status = STATUS_INVALID_DEVICE_REQUEST;
|
||||
Status = STATUS_INVALID_DEVICE_REQUEST;
|
||||
}
|
||||
|
||||
Irp->IoStatus.Status = Status;
|
||||
Irp->IoStatus.Information = 0;
|
||||
|
||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
||||
|
||||
return(Status);
|
||||
}
|
||||
|
||||
|
||||
@@ -28,6 +28,7 @@ typedef struct _ROS_QUERY_LCN_MAPPING { LARGE_INTEGER LcnDiskOffset; } ROS_QUERY
|
||||
#define ROUND_UP(N, S) ((((N) + (S) - 1) / (S)) * (S))
|
||||
#define ROUND_DOWN(N, S) ((N) - ((N) % (S)))
|
||||
|
||||
#include <pshpack1.h>
|
||||
struct _BootSector
|
||||
{
|
||||
unsigned char magic0, res0, magic1;
|
||||
@@ -45,7 +46,7 @@ struct _BootSector
|
||||
unsigned char VolumeLabel[11], SysType[8];
|
||||
unsigned char Res2[448];
|
||||
unsigned short Signatur1;
|
||||
} __attribute__((packed));
|
||||
};
|
||||
|
||||
struct _BootSector32
|
||||
{
|
||||
@@ -73,7 +74,7 @@ struct _BootSector32
|
||||
unsigned char VolumeLabel[11], SysType[8]; // 71
|
||||
unsigned char Res2[420]; // 90
|
||||
unsigned short Signature1; // 510
|
||||
} __attribute__((packed));
|
||||
};
|
||||
|
||||
struct _BootSectorFatX
|
||||
{
|
||||
@@ -83,7 +84,7 @@ struct _BootSectorFatX
|
||||
unsigned short FATCount; // 12
|
||||
unsigned long Unknown; // 14
|
||||
unsigned char Unused[4078]; // 18
|
||||
} __attribute__((packed));
|
||||
};
|
||||
|
||||
struct _FsInfoSector
|
||||
{
|
||||
@@ -94,10 +95,61 @@ struct _FsInfoSector
|
||||
unsigned long NextCluster; // 492
|
||||
unsigned char Res7[12]; // 496
|
||||
unsigned long Signatur2; // 508
|
||||
} __attribute__((packed));
|
||||
};
|
||||
|
||||
typedef struct _BootSector BootSector;
|
||||
|
||||
struct _FATDirEntry
|
||||
{
|
||||
union
|
||||
{
|
||||
struct { unsigned char Filename[8], Ext[3]; };
|
||||
unsigned char ShortName[11];
|
||||
};
|
||||
unsigned char Attrib;
|
||||
unsigned char lCase;
|
||||
unsigned char CreationTimeMs;
|
||||
unsigned short CreationTime,CreationDate,AccessDate;
|
||||
unsigned short FirstClusterHigh; // higher
|
||||
unsigned short UpdateTime; //time create/update
|
||||
unsigned short UpdateDate; //date create/update
|
||||
unsigned short FirstCluster;
|
||||
unsigned long FileSize;
|
||||
};
|
||||
|
||||
typedef struct _FATDirEntry FAT_DIR_ENTRY, *PFAT_DIR_ENTRY;
|
||||
|
||||
struct _FATXDirEntry
|
||||
{
|
||||
unsigned char FilenameLength; // 0
|
||||
unsigned char Attrib; // 1
|
||||
unsigned char Filename[42]; // 2
|
||||
unsigned long FirstCluster; // 44
|
||||
unsigned long FileSize; // 48
|
||||
unsigned short UpdateTime; // 52
|
||||
unsigned short UpdateDate; // 54
|
||||
unsigned short CreationTime; // 56
|
||||
unsigned short CreationDate; // 58
|
||||
unsigned short AccessTime; // 60
|
||||
unsigned short AccessDate; // 62
|
||||
};
|
||||
|
||||
struct _slot
|
||||
{
|
||||
unsigned char id; // sequence number for slot
|
||||
WCHAR name0_4[5]; // first 5 characters in name
|
||||
unsigned char attr; // attribute byte
|
||||
unsigned char reserved; // always 0
|
||||
unsigned char alias_checksum; // checksum for 8.3 alias
|
||||
WCHAR name5_10[6]; // 6 more characters in name
|
||||
unsigned char start[2]; // starting cluster number
|
||||
WCHAR name11_12[2]; // last 2 characters in name
|
||||
};
|
||||
|
||||
typedef struct _slot slot;
|
||||
|
||||
#include <poppack.h>
|
||||
|
||||
#define VFAT_CASE_LOWER_BASE 8 // base is lower case
|
||||
#define VFAT_CASE_LOWER_EXT 16 // extension is lower case
|
||||
|
||||
@@ -120,37 +172,6 @@ typedef struct _BootSector BootSector;
|
||||
#define FAT_ENTRIES_PER_PAGE (PAGE_SIZE / sizeof (FAT_DIR_ENTRY))
|
||||
#define FATX_ENTRIES_PER_PAGE (PAGE_SIZE / sizeof (FATX_DIR_ENTRY))
|
||||
|
||||
struct _FATDirEntry
|
||||
{
|
||||
unsigned char Filename[8], Ext[3];
|
||||
unsigned char Attrib;
|
||||
unsigned char lCase;
|
||||
unsigned char CreationTimeMs;
|
||||
unsigned short CreationTime,CreationDate,AccessDate;
|
||||
unsigned short FirstClusterHigh; // higher
|
||||
unsigned short UpdateTime; //time create/update
|
||||
unsigned short UpdateDate; //date create/update
|
||||
unsigned short FirstCluster;
|
||||
unsigned long FileSize;
|
||||
} __attribute__((packed));
|
||||
|
||||
typedef struct _FATDirEntry FAT_DIR_ENTRY, *PFAT_DIR_ENTRY;
|
||||
|
||||
struct _FATXDirEntry
|
||||
{
|
||||
unsigned char FilenameLength; // 0
|
||||
unsigned char Attrib; // 1
|
||||
unsigned char Filename[42]; // 2
|
||||
unsigned long FirstCluster; // 44
|
||||
unsigned long FileSize; // 48
|
||||
unsigned short UpdateTime; // 52
|
||||
unsigned short UpdateDate; // 54
|
||||
unsigned short CreationTime; // 56
|
||||
unsigned short CreationDate; // 58
|
||||
unsigned short AccessTime; // 60
|
||||
unsigned short AccessDate; // 62
|
||||
} __attribute__((packed));
|
||||
|
||||
typedef struct _FATXDirEntry FATX_DIR_ENTRY, *PFATX_DIR_ENTRY;
|
||||
|
||||
union _DIR_ENTRY
|
||||
@@ -161,21 +182,6 @@ union _DIR_ENTRY
|
||||
|
||||
typedef union _DIR_ENTRY DIR_ENTRY, *PDIR_ENTRY;
|
||||
|
||||
struct _slot
|
||||
{
|
||||
unsigned char id; // sequence number for slot
|
||||
WCHAR name0_4[5]; // first 5 characters in name
|
||||
unsigned char attr; // attribute byte
|
||||
unsigned char reserved; // always 0
|
||||
unsigned char alias_checksum; // checksum for 8.3 alias
|
||||
WCHAR name5_10[6]; // 6 more characters in name
|
||||
unsigned char start[2]; // starting cluster number
|
||||
WCHAR name11_12[2]; // last 2 characters in name
|
||||
} __attribute__((packed));
|
||||
|
||||
|
||||
typedef struct _slot slot;
|
||||
|
||||
#define BLOCKSIZE 512
|
||||
|
||||
#define FAT16 (1)
|
||||
|
||||
@@ -204,7 +204,7 @@ FsdSetFsLabelInformation(PDEVICE_OBJECT DeviceObject,
|
||||
LabelLen = FsLabelInfo->VolumeLabelLength / sizeof(WCHAR);
|
||||
RtlZeroMemory(&VolumeLabelDirEntry, SizeDirEntry);
|
||||
StringW.Buffer = FsLabelInfo->VolumeLabel;
|
||||
StringW.Length = StringW.MaximumLength = FsLabelInfo->VolumeLabelLength;
|
||||
StringW.Length = StringW.MaximumLength = (USHORT)FsLabelInfo->VolumeLabelLength;
|
||||
StringO.Buffer = cString;
|
||||
StringO.Length = 0;
|
||||
StringO.MaximumLength = 42;
|
||||
@@ -288,7 +288,7 @@ FsdSetFsLabelInformation(PDEVICE_OBJECT DeviceObject,
|
||||
}
|
||||
|
||||
/* Update volume label in memory */
|
||||
DeviceObject->Vpb->VolumeLabelLength = FsLabelInfo->VolumeLabelLength;
|
||||
DeviceObject->Vpb->VolumeLabelLength = (USHORT)FsLabelInfo->VolumeLabelLength;
|
||||
RtlCopyMemory(DeviceObject->Vpb->VolumeLabel, FsLabelInfo->VolumeLabel, DeviceObject->Vpb->VolumeLabelLength);
|
||||
|
||||
return Status;
|
||||
|
||||
@@ -10,8 +10,6 @@
|
||||
|
||||
#include "precomp.h"
|
||||
|
||||
extern VOID DrainSignals();
|
||||
|
||||
int TCPSocketState(void *ClientData,
|
||||
void *WhichSocket,
|
||||
void *WhichConnection,
|
||||
@@ -32,10 +30,9 @@ int TCPSocketState(void *ClientData,
|
||||
if( !Connection ) {
|
||||
TI_DbgPrint(DEBUG_TCP,("Socket closing.\n"));
|
||||
Connection = FileFindConnectionByContext( WhichSocket );
|
||||
if( !Connection ) {
|
||||
TcpipRecursiveMutexLeave( &TCPLock );
|
||||
if( !Connection )
|
||||
return 0;
|
||||
} else
|
||||
else
|
||||
TI_DbgPrint(DEBUG_TCP,("Found socket %x\n", Connection));
|
||||
}
|
||||
|
||||
|
||||
@@ -40,18 +40,13 @@
|
||||
struct listener_mgr;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Used to maintain information about processes that wish to be
|
||||
* notified when I/O becomes possible.
|
||||
*/
|
||||
struct selinfo {
|
||||
#if defined(OSKIT)
|
||||
struct listener_mgr *si_sel;
|
||||
#endif /* OSKIT */
|
||||
pid_t si_pid; /* process to be notified */
|
||||
short si_flags; /* see below */
|
||||
};
|
||||
#define SI_COLL 0x0001 /* collision occurred */
|
||||
/* Included to suppress warnings about struct socket being declared in the
|
||||
* parameter list. Selinfo reoredered with struct socket. */
|
||||
|
||||
struct selinfo;
|
||||
struct socket;
|
||||
|
||||
#include <sys/socketvar.h>
|
||||
|
||||
#ifdef KERNEL
|
||||
struct proc;
|
||||
|
||||
@@ -40,6 +40,25 @@
|
||||
#include <sys/filedesc.h> /* for struct filedesc */
|
||||
#include <sys/select.h> /* for struct selinfo */
|
||||
|
||||
/* Warning suppression */
|
||||
struct sockaddr;
|
||||
|
||||
/*
|
||||
* Used to maintain information about processes that wish to be
|
||||
* notified when I/O becomes possible.
|
||||
*
|
||||
* Moved from sys/select.h and replaced with an #include.
|
||||
*/
|
||||
struct selinfo {
|
||||
#if defined(OSKIT)
|
||||
struct listener_mgr *si_sel;
|
||||
#endif /* OSKIT */
|
||||
pid_t si_pid; /* process to be notified */
|
||||
short si_flags; /* see below */
|
||||
};
|
||||
#define SI_COLL 0x0001 /* collision occurred */
|
||||
|
||||
|
||||
/*
|
||||
* Kernel structure per socket.
|
||||
* Contains send and receive buffer queues,
|
||||
|
||||
@@ -125,9 +125,11 @@ void printf __P((const char *, ...));
|
||||
#include <oskitfreebsd.h>
|
||||
#include <oskitdebug.h>
|
||||
|
||||
|
||||
int __cdecl vprintf(const char *, va_list);
|
||||
|
||||
static inline int log ( int blah, const char* fmt, ... )
|
||||
#define log bsd_log
|
||||
static inline int bsd_log ( int blah, const char* fmt, ... )
|
||||
{
|
||||
va_list arg;
|
||||
int i;
|
||||
|
||||
@@ -312,7 +312,7 @@ in_pcbladdr(inp, nam, plocal_sin)
|
||||
* Don't do pcblookup call here; return interface in plocal_sin
|
||||
* and exit to caller, that will do the lookup.
|
||||
*/
|
||||
*plocal_sin = ia->ia_ifa.ifa_addr;
|
||||
*plocal_sin = (struct sockaddr_in *)ia->ia_ifa.ifa_addr;
|
||||
OS_DbgPrint(OSK_MID_TRACE,("plocal sin %x\n",
|
||||
(*plocal_sin)->sin_addr.s_addr));
|
||||
|
||||
|
||||
@@ -120,6 +120,9 @@ int OskitTCPSocket( void *context,
|
||||
so->so_connection = context;
|
||||
so->so_state = SS_NBIO;
|
||||
so->so_error = 0;
|
||||
so->so_q = so->so_q0 = NULL;
|
||||
so->so_qlen = 0;
|
||||
so->so_head = NULL;
|
||||
*aso = so;
|
||||
}
|
||||
return error;
|
||||
@@ -362,7 +365,7 @@ int OskitTCPAccept( void *socket,
|
||||
*/
|
||||
so = head->so_q;
|
||||
|
||||
inp = so ? so->so_pcb : 0;
|
||||
inp = so ? (struct inpcb *)so->so_pcb : NULL;
|
||||
if( inp ) {
|
||||
((struct sockaddr_in *)AddrOut)->sin_addr.s_addr =
|
||||
inp->inp_faddr.s_addr;
|
||||
@@ -377,14 +380,16 @@ int OskitTCPAccept( void *socket,
|
||||
*newso = so;
|
||||
|
||||
/*so->so_state &= ~SS_COMP;*/
|
||||
so->so_q = NULL;
|
||||
|
||||
mnam.m_data = &sa;
|
||||
mnam.m_data = (char *)&sa;
|
||||
mnam.m_len = sizeof(sa);
|
||||
|
||||
(void) soaccept(so, &mnam);
|
||||
|
||||
so->so_state = SS_NBIO | SS_ISCONNECTED;
|
||||
so->so_q = so->so_q0 = NULL;
|
||||
so->so_qlen = 0;
|
||||
so->so_head = 0;
|
||||
|
||||
OS_DbgPrint(OSK_MID_TRACE,("error = %d\n", error));
|
||||
if (name) {
|
||||
@@ -447,7 +452,7 @@ void OskitTCPSetAddress( void *socket,
|
||||
OSK_UINT RemoteAddress,
|
||||
OSK_UI16 RemotePort ) {
|
||||
struct socket *so = socket;
|
||||
struct inpcb *inp = so->so_pcb;
|
||||
struct inpcb *inp = (struct inpcb *)so->so_pcb;
|
||||
inp->inp_laddr.s_addr = LocalAddress;
|
||||
inp->inp_lport = LocalPort;
|
||||
inp->inp_faddr.s_addr = RemoteAddress;
|
||||
@@ -460,7 +465,7 @@ void OskitTCPGetAddress( void *socket,
|
||||
OSK_UINT *RemoteAddress,
|
||||
OSK_UI16 *RemotePort ) {
|
||||
struct socket *so = socket;
|
||||
struct inpcb *inp = so ? so->so_pcb : 0;
|
||||
struct inpcb *inp = so ? (struct inpcb *)so->so_pcb : NULL;
|
||||
if( inp ) {
|
||||
*LocalAddress = inp->inp_laddr.s_addr;
|
||||
*LocalPort = inp->inp_lport;
|
||||
@@ -584,7 +589,7 @@ struct ifaddr *ifa_ifwithnet(addr)
|
||||
|
||||
if( ifaddr )
|
||||
{
|
||||
sin = (struct sockaddr *)&ifaddr->ifa_addr;
|
||||
sin = (struct sockaddr_in *)&ifaddr->ifa_addr;
|
||||
|
||||
OS_DbgPrint(OSK_MID_TRACE,("ifaddr->addr = %x\n",
|
||||
sin->sin_addr.s_addr));
|
||||
|
||||
@@ -314,8 +314,8 @@ ifa_ifwithroute(flags, dst, gateway)
|
||||
register struct ifaddr *ifa;
|
||||
|
||||
OS_DbgPrint(OSK_MID_TRACE,("Called: flags %\n", flags));
|
||||
OskitDumpBuffer( dst, sizeof(*dst) );
|
||||
OskitDumpBuffer( gateway, sizeof(*gateway) );
|
||||
OskitDumpBuffer( (void *)dst, sizeof(*dst) );
|
||||
OskitDumpBuffer( (void *)gateway, sizeof(*gateway) );
|
||||
|
||||
if ((flags & RTF_GATEWAY) == 0) {
|
||||
/*
|
||||
|
||||
@@ -123,7 +123,7 @@ static VOID ProcessClose( PAFD_FCB FCB ) {
|
||||
PIRP NextIrp;
|
||||
|
||||
AFD_DbgPrint(MID_TRACE,("Socket shutdown from remote side\n"));
|
||||
|
||||
|
||||
/* Kill remaining recv irps */
|
||||
while( !IsListEmpty( &FCB->PendingIrpList[FUNCTION_RECV] ) ) {
|
||||
NextIrpEntry =
|
||||
@@ -138,7 +138,7 @@ static VOID ProcessClose( PAFD_FCB FCB ) {
|
||||
}
|
||||
|
||||
/* Handle closing signal */
|
||||
FCB->PollState |= AFD_EVENT_DISCONNECT;
|
||||
FCB->PollState |= AFD_EVENT_DISCONNECT | SOCKET_STATE_EOF_READ;
|
||||
|
||||
PollReeval( FCB->DeviceExt, FCB->FileObject );
|
||||
}
|
||||
@@ -270,7 +270,8 @@ AfdConnectedSocketReadData(PDEVICE_OBJECT DeviceObject, PIRP Irp,
|
||||
|
||||
if( !SocketAcquireStateLock( FCB ) ) return LostSocket( Irp, FALSE );
|
||||
|
||||
if( FCB->State != SOCKET_STATE_CONNECTED ) {
|
||||
if( FCB->State != SOCKET_STATE_CONNECTED &&
|
||||
FCB->State != SOCKET_STATE_CONNECTING ) {
|
||||
AFD_DbgPrint(MID_TRACE,("Called recv on wrong kind of socket (s%x)\n",
|
||||
FCB->State));
|
||||
return STATUS_UNSUCCESSFUL;
|
||||
@@ -307,15 +308,19 @@ AfdConnectedSocketReadData(PDEVICE_OBJECT DeviceObject, PIRP Irp,
|
||||
Status = STATUS_SUCCESS;
|
||||
}
|
||||
} else {
|
||||
AFD_DbgPrint(MID_TRACE,("EOF Happened already\n"));
|
||||
FCB->Recv.Content = 0;
|
||||
FCB->Recv.BytesUsed = 0;
|
||||
Status = STATUS_END_OF_FILE;
|
||||
if( FCB->PollState & SOCKET_STATE_EOF_READ )
|
||||
Status = STATUS_END_OF_FILE;
|
||||
else
|
||||
Status = STATUS_SUCCESS;
|
||||
|
||||
AFD_DbgPrint(MID_TRACE,("EOF Happened already\n"));
|
||||
FCB->Recv.Content = 0;
|
||||
FCB->Recv.BytesUsed = 0;
|
||||
|
||||
ProcessClose( FCB );
|
||||
|
||||
return UnlockAndMaybeComplete
|
||||
( FCB, STATUS_SUCCESS, Irp, 0, NULL, FALSE);
|
||||
( FCB, Status, Irp, 0, NULL, FALSE);
|
||||
}
|
||||
|
||||
if( NT_SUCCESS(Status) ) {
|
||||
|
||||
@@ -44,6 +44,7 @@
|
||||
#define SOCKET_STATE_CONNECTED 3
|
||||
#define SOCKET_STATE_LISTENING 4
|
||||
#define SOCKET_STATE_MASK 0x0000ffff
|
||||
#define SOCKET_STATE_EOF_READ 0x20000000
|
||||
#define SOCKET_STATE_LOCKED 0x40000000
|
||||
#define SOCKET_STATE_NEW 0x80000000
|
||||
#define SOCKET_STATE_CLOSED 0x00000100
|
||||
|
||||
@@ -603,7 +603,7 @@ MiniQueryInformation(
|
||||
Adapter->NdisMiniportBlock.MiniportAdapterContext,
|
||||
Oid,
|
||||
Adapter->QueryBuffer,
|
||||
Size,
|
||||
Adapter->QueryBufferLength,
|
||||
BytesWritten,
|
||||
&BytesNeeded);
|
||||
}
|
||||
@@ -1290,14 +1290,14 @@ NdisIPnPStartDevice(
|
||||
NTSTATUS Status;
|
||||
UINT SelectedMediumIndex = 0;
|
||||
NDIS_OID AddressOID;
|
||||
BOOLEAN Success;
|
||||
BOOLEAN Success = FALSE;
|
||||
ULONG ResourceCount;
|
||||
ULONG ResourceListSize;
|
||||
UNICODE_STRING ParamName;
|
||||
PNDIS_CONFIGURATION_PARAMETER ConfigParam;
|
||||
NDIS_HANDLE ConfigHandle;
|
||||
ULONG Size;
|
||||
KIRQL OldIrql;
|
||||
/* FIXME - KIRQL OldIrql; */
|
||||
|
||||
/*
|
||||
* Prepare wrapper context used by HW and configuration routines.
|
||||
@@ -1461,7 +1461,7 @@ NdisIPnPStartDevice(
|
||||
/* FIXME: Support other types of media */
|
||||
NDIS_DbgPrint(MIN_TRACE, ("error: unsupported media\n"));
|
||||
ASSERT(FALSE);
|
||||
KeReleaseSpinLock(&Adapter->NdisMiniportBlock.Lock, OldIrql);
|
||||
/* FIXME - KeReleaseSpinLock(&Adapter->NdisMiniportBlock.Lock, OldIrql); */
|
||||
return STATUS_UNSUCCESSFUL;
|
||||
}
|
||||
|
||||
@@ -1564,6 +1564,8 @@ NdisIDispatchPnp(
|
||||
break;
|
||||
|
||||
case IRP_MN_STOP_DEVICE:
|
||||
/* FIXME */
|
||||
Status = STATUS_UNSUCCESSFUL;
|
||||
break;
|
||||
Status = NdisIForwardIrpAndWait(Adapter, Irp);
|
||||
if (NT_SUCCESS(Status) && NT_SUCCESS(Irp->IoStatus.Status))
|
||||
@@ -1576,7 +1578,8 @@ NdisIDispatchPnp(
|
||||
|
||||
default:
|
||||
IoSkipCurrentIrpStackLocation(Irp);
|
||||
return IoCallDriver(Adapter->NdisMiniportBlock.NextDeviceObject, Irp);
|
||||
Status = IoCallDriver(Adapter->NdisMiniportBlock.NextDeviceObject, Irp);
|
||||
break;
|
||||
}
|
||||
|
||||
return Status;
|
||||
|
||||
@@ -471,8 +471,10 @@ NTSTATUS FileCloseConnection(
|
||||
|
||||
Connection = Request->Handle.ConnectionContext;
|
||||
|
||||
TcpipRecursiveMutexEnter( &TCPLock, TRUE );
|
||||
TCPClose(Connection);
|
||||
DeleteConnectionEndpoint(Connection);
|
||||
TcpipRecursiveMutexLeave( &TCPLock );
|
||||
|
||||
TI_DbgPrint(MAX_TRACE, ("Leaving.\n"));
|
||||
|
||||
|
||||
@@ -1327,6 +1327,8 @@ AtapiIdentifyDevice(IN ULONG CommandPort,
|
||||
DrvParms->TMSectorCountHi,
|
||||
DrvParms->TMSectorCountLo,
|
||||
(ULONG)((DrvParms->TMSectorCountHi << 16) + DrvParms->TMSectorCountLo));
|
||||
DPRINT("SupportedFeatures83: %x, EnabledFeatures86 %x\n", DrvParms->SupportedFeatures83, DrvParms->EnabledFeatures86);
|
||||
DPRINT("Max48BitAddress: %I64d\n", *(PULONGLONG)DrvParms->Max48BitAddress);
|
||||
if (DrvParms->TMFieldsValid & 0x0004)
|
||||
{
|
||||
if ((DrvParms->UltraDmaModes >> 8) && (DrvParms->UltraDmaModes & 0xff))
|
||||
@@ -1952,7 +1954,7 @@ AtapiReadCapacity(PATAPI_MINIPORT_EXTENSION DeviceExtension,
|
||||
{
|
||||
PREAD_CAPACITY_DATA CapacityData;
|
||||
PIDE_DRIVE_IDENTIFY DeviceParams;
|
||||
ULONG LastSector;
|
||||
LARGE_INTEGER LastSector;
|
||||
|
||||
DPRINT("SCSIOP_READ_CAPACITY: TargetId: %lu\n", Srb->TargetId);
|
||||
CapacityData = (PREAD_CAPACITY_DATA)Srb->DataBuffer;
|
||||
@@ -1964,14 +1966,33 @@ AtapiReadCapacity(PATAPI_MINIPORT_EXTENSION DeviceExtension,
|
||||
/* Calculate last sector (big-endian). */
|
||||
if (DeviceParams->Capabilities & IDE_DRID_LBA_SUPPORTED)
|
||||
{
|
||||
LastSector = (ULONG)((DeviceParams->TMSectorCountHi << 16) +
|
||||
DeviceParams->TMSectorCountLo) - 1;
|
||||
if (DeviceExtension->DeviceFlags[Srb->TargetId] & DEVICE_48BIT_ADDRESS)
|
||||
{
|
||||
((PUSHORT)&LastSector)[0] = DeviceParams->Max48BitAddress[0];
|
||||
((PUSHORT)&LastSector)[1] = DeviceParams->Max48BitAddress[1];
|
||||
((PUSHORT)&LastSector)[2] = DeviceParams->Max48BitAddress[2];
|
||||
((PUSHORT)&LastSector)[3] = DeviceParams->Max48BitAddress[3];
|
||||
LastSector.QuadPart -= 1;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
LastSector.u.HighPart = 0;
|
||||
LastSector.u.LowPart = (ULONG)((DeviceParams->TMSectorCountHi << 16) +
|
||||
DeviceParams->TMSectorCountLo)-1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
LastSector = (ULONG)(DeviceParams->LogicalCyls *
|
||||
DeviceParams->LogicalHeads *
|
||||
DeviceParams->SectorsPerTrack)-1;
|
||||
LastSector.u.HighPart = 0;
|
||||
LastSector.u.LowPart = (ULONG)(DeviceParams->LogicalCyls *
|
||||
DeviceParams->LogicalHeads *
|
||||
DeviceParams->SectorsPerTrack)-1;
|
||||
}
|
||||
if (LastSector.u.HighPart)
|
||||
{
|
||||
DPRINT1("Disk is too large for our implementation (%I64d sectors\n", LastSector.QuadPart);
|
||||
KEBUGCHECK(0);
|
||||
}
|
||||
|
||||
CapacityData->LogicalBlockAddress = (((PUCHAR)&LastSector)[0] << 24) |
|
||||
@@ -1996,10 +2017,10 @@ AtapiReadWrite(PATAPI_MINIPORT_EXTENSION DeviceExtension,
|
||||
PIDE_DRIVE_IDENTIFY DeviceParams;
|
||||
ULONG StartingSector;
|
||||
ULONG SectorCount;
|
||||
UCHAR CylinderHigh;
|
||||
UCHAR CylinderLow;
|
||||
UCHAR CylinderHigh[2];
|
||||
UCHAR CylinderLow[2];
|
||||
UCHAR DrvHead;
|
||||
UCHAR SectorNumber;
|
||||
UCHAR SectorNumber[2];
|
||||
UCHAR Command;
|
||||
ULONG Retries;
|
||||
UCHAR Status;
|
||||
@@ -2025,47 +2046,61 @@ AtapiReadWrite(PATAPI_MINIPORT_EXTENSION DeviceExtension,
|
||||
Srb->DataTransferLength,
|
||||
SectorCount);
|
||||
|
||||
if (DeviceParams->Capabilities & IDE_DRID_LBA_SUPPORTED)
|
||||
if (DeviceExtension->DeviceFlags[Srb->TargetId] & DEVICE_48BIT_ADDRESS)
|
||||
{
|
||||
SectorNumber = StartingSector & 0xff;
|
||||
CylinderLow = (StartingSector >> 8) & 0xff;
|
||||
CylinderHigh = (StartingSector >> 16) & 0xff;
|
||||
DrvHead = ((StartingSector >> 24) & 0x0f) |
|
||||
(Srb->TargetId ? IDE_DH_DRV1 : 0) |
|
||||
IDE_DH_LBA;
|
||||
}
|
||||
else
|
||||
{
|
||||
SectorNumber = (StartingSector % DeviceParams->SectorsPerTrack) + 1;
|
||||
StartingSector /= DeviceParams->SectorsPerTrack;
|
||||
DrvHead = (StartingSector % DeviceParams->LogicalHeads) |
|
||||
(Srb->TargetId ? IDE_DH_DRV1 : 0);
|
||||
StartingSector /= DeviceParams->LogicalHeads;
|
||||
CylinderLow = StartingSector & 0xff;
|
||||
CylinderHigh = StartingSector >> 8;
|
||||
}
|
||||
SectorNumber[0] = StartingSector & 0xff;
|
||||
CylinderLow[0] = (StartingSector >> 8) & 0xff;
|
||||
CylinderHigh[0] = (StartingSector >> 16) & 0xff;
|
||||
SectorNumber[1] = (StartingSector >> 24) & 0xff;
|
||||
CylinderLow[1] = 0;
|
||||
CylinderHigh[1] = 0;
|
||||
DrvHead = (Srb->TargetId ? IDE_DH_DRV1 : 0) | IDE_DH_LBA;
|
||||
|
||||
if (DrvHead & IDE_DH_LBA)
|
||||
DPRINT("%s:BUS=%04x:DRV=%d:LBA48=1:BLK=%08d:SC=%02x:CM=%02x\n",
|
||||
(Srb->SrbFlags & SRB_FLAGS_DATA_IN) ? "READ" : "WRITE",
|
||||
DeviceExtension->CommandPortBase,
|
||||
DrvHead & IDE_DH_DRV1 ? 1 : 0,
|
||||
(SectorNumber[1] << 24) +
|
||||
(CylinderHigh[0] << 16) + (CylinderLow[0] << 8) + DectorNumberLow[0],
|
||||
SectorCount,
|
||||
Command);
|
||||
}
|
||||
else if (DeviceParams->Capabilities & IDE_DRID_LBA_SUPPORTED)
|
||||
{
|
||||
SectorNumber[0] = StartingSector & 0xff;
|
||||
CylinderLow[0] = (StartingSector >> 8) & 0xff;
|
||||
CylinderHigh[0] = (StartingSector >> 16) & 0xff;
|
||||
DrvHead = ((StartingSector >> 24) & 0x0f) |
|
||||
(Srb->TargetId ? IDE_DH_DRV1 : 0) |
|
||||
IDE_DH_LBA;
|
||||
|
||||
DPRINT("%s:BUS=%04x:DRV=%d:LBA=1:BLK=%08d:SC=%02x:CM=%02x\n",
|
||||
(Srb->SrbFlags & SRB_FLAGS_DATA_IN) ? "READ" : "WRITE",
|
||||
DeviceExtension->CommandPortBase,
|
||||
DrvHead & IDE_DH_DRV1 ? 1 : 0,
|
||||
((DrvHead & 0x0f) << 24) +
|
||||
(CylinderHigh << 16) + (CylinderLow << 8) + SectorNumber,
|
||||
(CylinderHigh[0] << 16) + (CylinderLow[0] << 8) + SectorNumber[0],
|
||||
SectorCount,
|
||||
Command);
|
||||
}
|
||||
else
|
||||
{
|
||||
SectorNumber[0] = (StartingSector % DeviceParams->SectorsPerTrack) + 1;
|
||||
StartingSector /= DeviceParams->SectorsPerTrack;
|
||||
DrvHead = (StartingSector % DeviceParams->LogicalHeads) |
|
||||
(Srb->TargetId ? IDE_DH_DRV1 : 0);
|
||||
StartingSector /= DeviceParams->LogicalHeads;
|
||||
CylinderLow[0] = StartingSector & 0xff;
|
||||
CylinderHigh[0] = StartingSector >> 8;
|
||||
|
||||
DPRINT("%s:BUS=%04x:DRV=%d:LBA=0:CH=%02x:CL=%02x:HD=%01x:SN=%02x:SC=%02x:CM=%02x\n",
|
||||
(Srb->SrbFlags & SRB_FLAGS_DATA_IN) ? "READ" : "WRITE",
|
||||
DeviceExtension->CommandPortBase,
|
||||
DrvHead & IDE_DH_DRV1 ? 1 : 0,
|
||||
CylinderHigh,
|
||||
CylinderLow,
|
||||
CylinderHigh[0],
|
||||
CylinderLow[0],
|
||||
DrvHead & 0x0f,
|
||||
SectorNumber,
|
||||
SectorNumber[0],
|
||||
SectorCount,
|
||||
Command);
|
||||
}
|
||||
@@ -2119,11 +2154,21 @@ AtapiReadWrite(PATAPI_MINIPORT_EXTENSION DeviceExtension,
|
||||
#endif
|
||||
|
||||
/* Setup command parameters */
|
||||
if (DeviceExtension->DeviceFlags[Srb->TargetId] & DEVICE_48BIT_ADDRESS)
|
||||
{
|
||||
IDEWritePrecomp(DeviceExtension->CommandPortBase, 0);
|
||||
IDEWriteSectorCount(DeviceExtension->CommandPortBase, SectorCount >> 8);
|
||||
IDEWriteSectorNum(DeviceExtension->CommandPortBase, SectorNumber[1]);
|
||||
IDEWriteCylinderLow(DeviceExtension->CommandPortBase, CylinderLow[1]);
|
||||
IDEWriteCylinderHigh(DeviceExtension->CommandPortBase, CylinderHigh[1]);
|
||||
}
|
||||
|
||||
IDEWritePrecomp(DeviceExtension->CommandPortBase, 0);
|
||||
IDEWriteSectorCount(DeviceExtension->CommandPortBase, SectorCount);
|
||||
IDEWriteSectorNum(DeviceExtension->CommandPortBase, SectorNumber);
|
||||
IDEWriteCylinderHigh(DeviceExtension->CommandPortBase, CylinderHigh);
|
||||
IDEWriteCylinderLow(DeviceExtension->CommandPortBase, CylinderLow);
|
||||
IDEWriteSectorCount(DeviceExtension->CommandPortBase, SectorCount & 0xff);
|
||||
IDEWriteSectorNum(DeviceExtension->CommandPortBase, SectorNumber[0]);
|
||||
IDEWriteCylinderLow(DeviceExtension->CommandPortBase, CylinderLow[0]);
|
||||
IDEWriteCylinderHigh(DeviceExtension->CommandPortBase, CylinderHigh[0]);
|
||||
|
||||
IDEWriteDriveHead(DeviceExtension->CommandPortBase, IDE_DH_FIXED | DrvHead);
|
||||
|
||||
#ifdef ENABLE_DMA
|
||||
@@ -2135,7 +2180,14 @@ AtapiReadWrite(PATAPI_MINIPORT_EXTENSION DeviceExtension,
|
||||
if (DeviceExtension->UseDma)
|
||||
{
|
||||
Handler = AtapiDmaInterrupt;
|
||||
Command = Srb->SrbFlags & SRB_FLAGS_DATA_IN ? IDE_CMD_READ_DMA : IDE_CMD_WRITE_DMA;
|
||||
if (DeviceExtension->DeviceFlags[Srb->TargetId] & DEVICE_48BIT_ADDRESS)
|
||||
{
|
||||
Command = Srb->SrbFlags & SRB_FLAGS_DATA_IN ? IDE_CMD_READ_DMA_EXT : IDE_CMD_WRITE_DMA_EXT;
|
||||
}
|
||||
else
|
||||
{
|
||||
Command = Srb->SrbFlags & SRB_FLAGS_DATA_IN ? IDE_CMD_READ_DMA : IDE_CMD_WRITE_DMA;
|
||||
}
|
||||
}
|
||||
else
|
||||
#endif
|
||||
@@ -2143,11 +2195,25 @@ AtapiReadWrite(PATAPI_MINIPORT_EXTENSION DeviceExtension,
|
||||
Handler = Srb->SrbFlags & SRB_FLAGS_DATA_IN ? AtapiReadInterrupt : AtapiWriteInterrupt;
|
||||
if (DeviceExtension->DeviceFlags[Srb->TargetId] & DEVICE_MULTI_SECTOR_CMD)
|
||||
{
|
||||
Command = Srb->SrbFlags & SRB_FLAGS_DATA_IN ? IDE_CMD_READ_MULTIPLE : IDE_CMD_WRITE_MULTIPLE;
|
||||
if (DeviceExtension->DeviceFlags[Srb->TargetId] & DEVICE_48BIT_ADDRESS)
|
||||
{
|
||||
Command = Srb->SrbFlags & SRB_FLAGS_DATA_IN ? IDE_CMD_READ_MULTIPLE_EXT : IDE_CMD_WRITE_MULTIPLE_EXT;
|
||||
}
|
||||
else
|
||||
{
|
||||
Command = Srb->SrbFlags & SRB_FLAGS_DATA_IN ? IDE_CMD_READ_MULTIPLE : IDE_CMD_WRITE_MULTIPLE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Command = Srb->SrbFlags & SRB_FLAGS_DATA_IN ? IDE_CMD_READ : IDE_CMD_WRITE;
|
||||
if (DeviceExtension->DeviceFlags[Srb->TargetId] & DEVICE_48BIT_ADDRESS)
|
||||
{
|
||||
Command = Srb->SrbFlags & SRB_FLAGS_DATA_IN ? IDE_CMD_READ_EXT : IDE_CMD_WRITE_EXT;
|
||||
}
|
||||
else
|
||||
{
|
||||
Command = Srb->SrbFlags & SRB_FLAGS_DATA_IN ? IDE_CMD_READ : IDE_CMD_WRITE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2231,7 +2297,7 @@ AtapiFlushCache(PATAPI_MINIPORT_EXTENSION DeviceExtension,
|
||||
DPRINT("SCSIOP_SYNCRONIZE_CACHE: TargetId: %lu\n",
|
||||
Srb->TargetId);
|
||||
|
||||
if (!(DeviceExtension->DeviceFlags[Srb->TargetId] & DEVICE_NO_FLUSH))
|
||||
if (DeviceExtension->DeviceFlags[Srb->TargetId] & DEVICE_NO_FLUSH)
|
||||
{
|
||||
/*
|
||||
* NOTE: Don't flush the cache for CD/DVD drives. Although
|
||||
@@ -2240,9 +2306,16 @@ AtapiFlushCache(PATAPI_MINIPORT_EXTENSION DeviceExtension,
|
||||
* it doesn't make sense to flush cache on devices we don't
|
||||
* write to.
|
||||
*/
|
||||
return STATUS_SUCCESS;
|
||||
return SRB_STATUS_INVALID_REQUEST;
|
||||
}
|
||||
|
||||
if (!(DeviceExtension->DeviceParams[Srb->TargetId].SupportedFeatures83 & 0x1000))
|
||||
{
|
||||
/* The device states it doesn't support the command */
|
||||
DPRINT("The drive doesn't support FLUSH_CACHE\n");
|
||||
return SRB_STATUS_INVALID_REQUEST;
|
||||
}
|
||||
|
||||
/* Wait for BUSY to clear */
|
||||
for (Retries = 0; Retries < IDE_MAX_BUSY_RETRIES; Retries++)
|
||||
{
|
||||
@@ -2267,7 +2340,9 @@ AtapiFlushCache(PATAPI_MINIPORT_EXTENSION DeviceExtension,
|
||||
ScsiPortStallExecution(10);
|
||||
|
||||
/* Issue command to drive */
|
||||
AtapiExecuteCommand(DeviceExtension, IDE_CMD_FLUSH_CACHE, AtapiNoDataInterrupt);
|
||||
AtapiExecuteCommand(DeviceExtension,
|
||||
DeviceExtension->DeviceFlags[Srb->TargetId] & DEVICE_48BIT_ADDRESS ? IDE_CMD_FLUSH_CACHE_EXT : IDE_CMD_FLUSH_CACHE,
|
||||
AtapiNoDataInterrupt);
|
||||
|
||||
/* Wait for controller ready */
|
||||
for (Retries = 0; Retries < IDE_MAX_WRITE_RETRIES; Retries++)
|
||||
|
||||
@@ -64,21 +64,27 @@ extern "C" {
|
||||
#define IDE_REG_COMMAND 0x0007
|
||||
|
||||
/* IDE/ATA commands */
|
||||
#define IDE_CMD_RESET 0x08
|
||||
#define IDE_CMD_READ 0x20
|
||||
#define IDE_CMD_READ_RETRY 0x21
|
||||
#define IDE_CMD_WRITE 0x30
|
||||
#define IDE_CMD_WRITE_RETRY 0x31
|
||||
#define IDE_CMD_PACKET 0xA0
|
||||
#define IDE_CMD_READ_MULTIPLE 0xC4
|
||||
#define IDE_CMD_WRITE_MULTIPLE 0xC5
|
||||
#define IDE_CMD_READ_DMA 0xC8
|
||||
#define IDE_CMD_WRITE_DMA 0xCA
|
||||
#define IDE_CMD_FLUSH_CACHE 0xE7
|
||||
#define IDE_CMD_FLUSH_CACHE_EXT 0xEA
|
||||
#define IDE_CMD_IDENT_ATA_DRV 0xEC
|
||||
#define IDE_CMD_IDENT_ATAPI_DRV 0xA1
|
||||
#define IDE_CMD_GET_MEDIA_STATUS 0xDA
|
||||
#define IDE_CMD_RESET 0x08
|
||||
#define IDE_CMD_READ 0x20
|
||||
#define IDE_CMD_READ_ONCE 0x21
|
||||
#define IDE_CMD_READ_EXT 0x24 /* 48 bit */
|
||||
#define IDE_CMD_READ_DMA_EXT 0x25 /* 48 bit */
|
||||
#define IDE_CMD_READ_MULTIPLE_EXT 0x29 /* 48 bit */
|
||||
#define IDE_CMD_WRITE 0x30
|
||||
#define IDE_CMD_WRITE_ONCE 0x31
|
||||
#define IDE_CMD_WRITE_EXT 0x34 /* 48 bit */
|
||||
#define IDE_CMD_WRITE_DMA_EXT 0x35 /* 48 bit */
|
||||
#define IDE_CMD_WRITE_MULTIPLE_EXT 0x39 /* 48 bit */
|
||||
#define IDE_CMD_PACKET 0xA0
|
||||
#define IDE_CMD_READ_MULTIPLE 0xC4
|
||||
#define IDE_CMD_WRITE_MULTIPLE 0xC5
|
||||
#define IDE_CMD_READ_DMA 0xC8
|
||||
#define IDE_CMD_WRITE_DMA 0xCA
|
||||
#define IDE_CMD_FLUSH_CACHE 0xE7
|
||||
#define IDE_CMD_FLUSH_CACHE_EXT 0xEA /* 48 bit */
|
||||
#define IDE_CMD_IDENT_ATA_DRV 0xEC
|
||||
#define IDE_CMD_IDENT_ATAPI_DRV 0xA1
|
||||
#define IDE_CMD_GET_MEDIA_STATUS 0xDA
|
||||
|
||||
//
|
||||
// Access macros for command registers
|
||||
|
||||
@@ -406,10 +406,26 @@ DiskClassCheckReadWrite(IN PDEVICE_OBJECT DeviceObject,
|
||||
return(STATUS_INVALID_PARAMETER);
|
||||
}
|
||||
|
||||
|
||||
|
||||
IrpStack = IoGetCurrentIrpStackLocation(Irp);
|
||||
EndingOffset.QuadPart = IrpStack->Parameters.Read.ByteOffset.QuadPart +
|
||||
IrpStack->Parameters.Read.Length;
|
||||
|
||||
|
||||
DPRINT("Ending %I64d, and RealEnding %I64d! PartSize %I64d\n",EndingOffset.QuadPart,
|
||||
DeviceExtension->PartitionLength.QuadPart,
|
||||
DeviceExtension->PartitionLength.QuadPart /
|
||||
DeviceExtension->DiskGeometry->BytesPerSector);
|
||||
|
||||
if ((DeviceObject->Characteristics & FILE_REMOVABLE_MEDIA) &&
|
||||
(DeviceExtension->DiskGeometry->MediaType == RemovableMedia))
|
||||
{
|
||||
/* Assume if removable media and if Partition length is 0, Partition not built yet! */
|
||||
if (DeviceExtension->PartitionLength.QuadPart == 0)
|
||||
return(STATUS_SUCCESS);
|
||||
}
|
||||
|
||||
if (EndingOffset.QuadPart > DeviceExtension->PartitionLength.QuadPart)
|
||||
{
|
||||
Irp->IoStatus.Status = STATUS_INVALID_PARAMETER;
|
||||
|
||||
@@ -62,13 +62,16 @@
|
||||
int STDCALL usb_hcd_pci_probe (struct pci_dev *dev, const struct pci_device_id *id)
|
||||
{
|
||||
struct hc_driver *driver;
|
||||
unsigned long resource, len;
|
||||
PHYSICAL_ADDRESS resource;
|
||||
unsigned long len;
|
||||
void *base;
|
||||
struct usb_hcd *hcd;
|
||||
int retval, region;
|
||||
char buf [8];
|
||||
//char *bufp = buf;
|
||||
|
||||
printk("usbcore: usb_hcd_pci_probe() called\n");
|
||||
|
||||
if (usb_disabled())
|
||||
return -ENODEV;
|
||||
|
||||
@@ -103,7 +106,8 @@ clean_1:
|
||||
}
|
||||
|
||||
} else { // UHCI
|
||||
resource = len = 0;
|
||||
//resource = 0;
|
||||
len = 0;
|
||||
for (region = 0; region < PCI_ROM_RESOURCE; region++) {
|
||||
if (!(pci_resource_flags (dev, region) & IORESOURCE_IO))
|
||||
continue;
|
||||
@@ -118,7 +122,7 @@ clean_1:
|
||||
dbg ("no i/o regions available");
|
||||
return -EBUSY;
|
||||
}
|
||||
base = (void *) resource;
|
||||
base = NULL; //(void *) resource; // this isn't possible
|
||||
}
|
||||
|
||||
// driver->start(), later on, will transfer device from
|
||||
@@ -165,7 +169,7 @@ clean_3:
|
||||
if (request_irq (dev->irq, usb_hcd_irq, SA_SHIRQ, hcd->description, hcd)
|
||||
!= 0) {
|
||||
dev_err (hcd->controller,
|
||||
"request interrupt %s failed\n", bufp);
|
||||
"request interrupt %s failed\n", buf);
|
||||
retval = -EBUSY;
|
||||
goto clean_3;
|
||||
}
|
||||
@@ -173,7 +177,7 @@ clean_3:
|
||||
|
||||
hcd->regs = base;
|
||||
hcd->region = region;
|
||||
dev_info (hcd->controller, "irq %s, %s %p\n", bufp,
|
||||
dev_info (hcd->controller, "irq %s, %s %p\n", buf,
|
||||
(driver->flags & HCD_MEMORY) ? "pci mem" : "io base",
|
||||
base);
|
||||
|
||||
|
||||
@@ -161,6 +161,56 @@ struct usb_operations {
|
||||
|
||||
struct pt_regs;
|
||||
|
||||
// new struct from 2.6
|
||||
struct hc_driver {
|
||||
const char *description; /* "ehci-hcd" etc */
|
||||
|
||||
/* irq handler */
|
||||
irqreturn_t (*irq) (struct usb_hcd *hcd, struct pt_regs *regs);
|
||||
|
||||
int flags;
|
||||
#define HCD_MEMORY 0x0001 /* HC regs use memory (else I/O) */
|
||||
#define HCD_USB11 0x0010 /* USB 1.1 */
|
||||
#define HCD_USB2 0x0020 /* USB 2.0 */
|
||||
|
||||
/* called to init HCD and root hub */
|
||||
int (*reset) (struct usb_hcd *hcd);
|
||||
int (*start) (struct usb_hcd *hcd);
|
||||
|
||||
/* called after all devices were suspended */
|
||||
int (*suspend) (struct usb_hcd *hcd, u32 state);
|
||||
|
||||
/* called before any devices get resumed */
|
||||
int (*resume) (struct usb_hcd *hcd);
|
||||
|
||||
/* cleanly make HCD stop writing memory and doing I/O */
|
||||
void (*stop) (struct usb_hcd *hcd);
|
||||
|
||||
/* return current frame number */
|
||||
int (*get_frame_number) (struct usb_hcd *hcd);
|
||||
|
||||
/* memory lifecycle */
|
||||
struct usb_hcd *(*hcd_alloc) (void);
|
||||
void (*hcd_free) (struct usb_hcd *hcd);
|
||||
|
||||
/* manage i/o requests, device state */
|
||||
int (*urb_enqueue) (struct usb_hcd *hcd, struct urb *urb,
|
||||
int mem_flags);
|
||||
int (*urb_dequeue) (struct usb_hcd *hcd, struct urb *urb);
|
||||
|
||||
/* hw synch, freeing endpoint resources that urb_dequeue can't */
|
||||
void (*endpoint_disable)(struct usb_hcd *hcd,
|
||||
struct hcd_dev *dev, int bEndpointAddress);
|
||||
|
||||
/* root hub support */
|
||||
int (*hub_status_data) (struct usb_hcd *hcd, char *buf);
|
||||
int (*hub_control) (struct usb_hcd *hcd,
|
||||
u16 typeReq, u16 wValue, u16 wIndex,
|
||||
char *buf, u16 wLength);
|
||||
};
|
||||
|
||||
// old version, "just in case"
|
||||
#if 0
|
||||
struct hc_driver {
|
||||
const char *description; /* "ehci-hcd" etc */
|
||||
|
||||
@@ -206,6 +256,7 @@ struct hc_driver {
|
||||
u16 typeReq, u16 wValue, u16 wIndex,
|
||||
char *buf, u16 wLength);
|
||||
};
|
||||
#endif
|
||||
|
||||
extern void STDCALL usb_hcd_giveback_urb (struct usb_hcd *hcd, struct urb *urb, struct pt_regs *regs);
|
||||
extern void STDCALL usb_bus_init (struct usb_bus *bus);
|
||||
|
||||
@@ -1148,7 +1148,12 @@ static int hub_thread(void *__hub)
|
||||
do {
|
||||
|
||||
hub_events();
|
||||
wait_event_interruptible(khubd_wait, !list_empty(&hub_event_list));
|
||||
|
||||
//FIXME: Correct this
|
||||
//wait_event_interruptible(khubd_wait, !list_empty(&hub_event_list)); // interruptable_sleep_on analog - below
|
||||
while (!list_empty(&hub_event_list)) {
|
||||
interruptible_sleep_on(&khubd_wait);
|
||||
}
|
||||
|
||||
if (current->flags & PF_FREEZE)
|
||||
refrigerator(PF_IOTHREAD);
|
||||
@@ -1185,6 +1190,10 @@ int usb_hub_init(void)
|
||||
{
|
||||
pid_t pid;
|
||||
|
||||
// ReactOS-specific
|
||||
// Create Event object, initialize other sync events
|
||||
KeInitializeEvent(&khubd_wait, NotificationEvent, TRUE); // signalled state
|
||||
|
||||
if (usb_register(&hub_driver) < 0) {
|
||||
err("Unable to register USB hub driver");
|
||||
return -1;
|
||||
|
||||
@@ -6,7 +6,7 @@ TARGET_NAME = usbcore
|
||||
|
||||
TARGET_DDKLIBS = ntoskrnl.a
|
||||
|
||||
TARGET_CFLAGS = -Wall -I$(PATH_TO_TOP)/ntoskrnl/include
|
||||
TARGET_CFLAGS = -Wall -I$(PATH_TO_TOP)/ntoskrnl/include -DDEBUG_MODE
|
||||
|
||||
TARGET_OBJECTS = \
|
||||
message.o hcd.o hcd-pci.o hub.o usb.o config.o urb.o \
|
||||
@@ -16,3 +16,7 @@ TARGET_OBJECTS = \
|
||||
include $(PATH_TO_TOP)/rules.mak
|
||||
|
||||
include $(TOOLS_PATH)/helper.mk
|
||||
|
||||
# Automatic dependency tracking
|
||||
DEP_OBJECTS := $(TARGET_OBJECTS)
|
||||
include $(PATH_TO_TOP)/tools/depend.mk
|
||||
|
||||
@@ -15,6 +15,9 @@
|
||||
|
||||
#include "hcd.h" /* for usbcore internals */
|
||||
|
||||
// ReactOS specific: No WAITQUEUEs here
|
||||
#define wake_up(a) do {} while(0)
|
||||
|
||||
struct usb_api_data {
|
||||
wait_queue_head_t wqh;
|
||||
int done;
|
||||
|
||||
@@ -1042,7 +1042,7 @@ static void set_device_description (struct usb_device *dev)
|
||||
"USB device %04x:%04x (%s)",
|
||||
vendor_id, product_id, mfgr_str);
|
||||
}
|
||||
//usbprintk("USB connected: %s\n",dev->dev.name);
|
||||
usbprintk("USB connected: %s\n",dev->dev.name);
|
||||
kfree(buf);
|
||||
}
|
||||
|
||||
@@ -1227,6 +1227,7 @@ int usb_new_device(struct usb_device *dev, struct device *parent)
|
||||
"usb-%s-%s interface %d",
|
||||
dev->bus->bus_name, dev->devpath,
|
||||
desc->bInterfaceNumber);
|
||||
DPRINT1("usb_new_device: %s\n", interface->dev.name);
|
||||
}
|
||||
dev_dbg (&dev->dev, "%s - registering interface %s\n", __FUNCTION__, interface->dev.bus_id);
|
||||
device_add (&interface->dev);
|
||||
@@ -1510,7 +1511,7 @@ int STDCALL usb_disabled(void)
|
||||
/*
|
||||
* Init
|
||||
*/
|
||||
static int __init usb_init(void)
|
||||
int STDCALL __init usb_init(void)
|
||||
{
|
||||
if (nousb) {
|
||||
info("USB support disabled\n");
|
||||
@@ -1530,7 +1531,7 @@ static int __init usb_init(void)
|
||||
/*
|
||||
* Cleanup
|
||||
*/
|
||||
static void __exit usb_exit(void)
|
||||
void STDCALL __exit usb_exit(void)
|
||||
{
|
||||
/* This will matter if shutdown/reboot does exitcalls. */
|
||||
if (nousb)
|
||||
|
||||
@@ -4,13 +4,60 @@
|
||||
*/
|
||||
|
||||
#include <ddk/ntddk.h>
|
||||
#include <debug.h>
|
||||
|
||||
NTSTATUS AddDevice(PDRIVER_OBJECT DriverObject, PDEVICE_OBJECT pdo)
|
||||
{
|
||||
DbgPrint("usbcore: AddDevice called\n");
|
||||
|
||||
/* we need to do kind of this stuff here (as usual)
|
||||
PDEVICE_OBJECT fdo;
|
||||
IoCreateDevice(..., &fdo);
|
||||
pdx->LowerDeviceObject =
|
||||
IoAttachDeviceToDeviceStack(fdo, pdo);*/
|
||||
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
VOID DriverUnload(PDRIVER_OBJECT DriverObject)
|
||||
{
|
||||
// nothing to do here yet
|
||||
}
|
||||
|
||||
// Dispatch PNP
|
||||
NTSTATUS DispatchPnp(PDEVICE_OBJECT fdo, PIRP Irp)
|
||||
{
|
||||
ULONG fcn;
|
||||
PIO_STACK_LOCATION stack;
|
||||
|
||||
stack = IoGetCurrentIrpStackLocation(Irp);
|
||||
fcn = stack->MinorFunction;
|
||||
DbgPrint("IRP_MJ_PNP, fcn=%d\n", fcn);
|
||||
|
||||
if (fcn == IRP_MN_REMOVE_DEVICE)
|
||||
{
|
||||
IoDeleteDevice(fdo);
|
||||
}
|
||||
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
NTSTATUS DispatchPower(PDEVICE_OBJECT fido, PIRP Irp)
|
||||
{
|
||||
DbgPrint("IRP_MJ_POWER dispatch\n");
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
/*
|
||||
* Standard DriverEntry method.
|
||||
*/
|
||||
NTSTATUS STDCALL
|
||||
DriverEntry(IN PVOID Context1, IN PVOID Context2)
|
||||
DriverEntry(IN PDRIVER_OBJECT DriverObject, IN PUNICODE_STRING RegPath)
|
||||
{
|
||||
DriverObject->DriverUnload = DriverUnload;
|
||||
DriverObject->DriverExtension->AddDevice = AddDevice;
|
||||
DriverObject->MajorFunction[IRP_MJ_PNP] = DispatchPnp;
|
||||
DriverObject->MajorFunction[IRP_MJ_POWER] = DispatchPower;
|
||||
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
; Exports definition file for usbcore.sys
|
||||
;
|
||||
EXPORTS
|
||||
usb_init@0
|
||||
usb_exit@0
|
||||
usb_init_urb@4
|
||||
usb_alloc_urb@8
|
||||
usb_free_urb@4
|
||||
|
||||
@@ -6,7 +6,7 @@ TARGET_NAME = ohci
|
||||
|
||||
TARGET_DDKLIBS = ntoskrnl.a usbcore.a
|
||||
|
||||
TARGET_CFLAGS = -Wall -I$(PATH_TO_TOP)/ntoskrnl/include
|
||||
TARGET_CFLAGS = -Wall -I$(PATH_TO_TOP)/ntoskrnl/include -DDEBUG_MODE
|
||||
|
||||
TARGET_OBJECTS = \
|
||||
ohci-hcd.o ohci_main.o ../sys/ros_wrapper.o ../sys/linuxwrapper.o
|
||||
@@ -14,3 +14,7 @@ TARGET_OBJECTS = \
|
||||
include $(PATH_TO_TOP)/rules.mak
|
||||
|
||||
include $(TOOLS_PATH)/helper.mk
|
||||
|
||||
# Automatic dependency tracking
|
||||
DEP_OBJECTS := $(TARGET_OBJECTS)
|
||||
include $(PATH_TO_TOP)/tools/depend.mk
|
||||
|
||||
@@ -471,7 +471,7 @@ static int hc_start (struct ohci_hcd *ohci)
|
||||
|
||||
/* a reset clears this */
|
||||
writel ((u32) ohci->hcca_dma, &ohci->regs->hcca);
|
||||
// usbprintk("HCCA: %p \n",ohci->regs->hcca);
|
||||
usbprintk("HCCA: %p \n",ohci->regs->hcca);
|
||||
|
||||
/* force default fmInterval (we won't adjust it); init thresholds
|
||||
* for last FS and LS packets, reserve 90% for periodic.
|
||||
|
||||
@@ -38,6 +38,8 @@ ohci_pci_start (struct usb_hcd *hcd)
|
||||
struct ohci_hcd *ohci = hcd_to_ohci (hcd);
|
||||
int ret;
|
||||
|
||||
DPRINT("ohci_pci_start()\n");
|
||||
|
||||
if (hcd->pdev) {
|
||||
ohci->hcca = pci_alloc_consistent (hcd->pdev,
|
||||
sizeof *ohci->hcca, &ohci->hcca_dma);
|
||||
@@ -86,23 +88,27 @@ ohci_pci_start (struct usb_hcd *hcd)
|
||||
|
||||
}
|
||||
|
||||
memset (ohci->hcca, 0, sizeof (struct ohci_hcca));
|
||||
memset (ohci->hcca, 0, sizeof (struct ohci_hcca));
|
||||
if ((ret = ohci_mem_init (ohci)) < 0) {
|
||||
ohci_stop (hcd);
|
||||
return ret;
|
||||
}
|
||||
ohci->regs = hcd->regs;
|
||||
|
||||
DPRINT("Controller memory init done\n");
|
||||
|
||||
if (hc_reset (ohci) < 0) {
|
||||
ohci_stop (hcd);
|
||||
return -ENODEV;
|
||||
}
|
||||
DPRINT("Controller reset done\n");
|
||||
|
||||
if (hc_start (ohci) < 0) {
|
||||
ohci_err (ohci, "can't start\n");
|
||||
ohci_stop (hcd);
|
||||
return -EBUSY;
|
||||
}
|
||||
DPRINT("Controller start done\n");
|
||||
|
||||
#ifdef DEBUG
|
||||
ohci_dump (ohci, 1);
|
||||
@@ -352,7 +358,7 @@ static const struct hc_driver ohci_pci_hc_driver = {
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
|
||||
static const struct pci_device_id __devinitdata pci_ids [] = { {
|
||||
const struct pci_device_id __devinitdata pci_ids [] = { {
|
||||
|
||||
/* handle any USB OHCI controller */
|
||||
.class = (PCI_CLASS_SERIAL_USB << 8) | 0x10,
|
||||
@@ -370,7 +376,7 @@ static const struct pci_device_id __devinitdata pci_ids [] = { {
|
||||
MODULE_DEVICE_TABLE (pci, pci_ids);
|
||||
|
||||
/* pci driver glue; this is a "new style" PCI driver module */
|
||||
static struct pci_driver ohci_pci_driver = {
|
||||
struct pci_driver ohci_pci_driver = {
|
||||
.name = (char *) hcd_name,
|
||||
.id_table = pci_ids,
|
||||
|
||||
@@ -384,22 +390,23 @@ static struct pci_driver ohci_pci_driver = {
|
||||
};
|
||||
|
||||
|
||||
static int __init ohci_hcd_pci_init (void)
|
||||
int ohci_hcd_pci_init (void)
|
||||
{
|
||||
printk (KERN_DEBUG "%s: " DRIVER_INFO " (PCI)\n", hcd_name);
|
||||
if (usb_disabled())
|
||||
return -ENODEV;
|
||||
|
||||
printk (KERN_DEBUG "%s: block sizes: ed %Zd td %Zd\n", hcd_name,
|
||||
sizeof (struct ed), sizeof (struct td));
|
||||
// causes page fault in reactos
|
||||
//printk (KERN_DEBUG "%s: block sizes: ed %Zd td %Zd\n", hcd_name,
|
||||
// sizeof (struct ed), sizeof (struct td));
|
||||
return pci_module_init (&ohci_pci_driver);
|
||||
}
|
||||
module_init (ohci_hcd_pci_init);
|
||||
/*module_init (ohci_hcd_pci_init);*/
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
|
||||
static void __exit ohci_hcd_pci_cleanup (void)
|
||||
void ohci_hcd_pci_cleanup (void)
|
||||
{
|
||||
pci_unregister_driver (&ohci_pci_driver);
|
||||
}
|
||||
module_exit (ohci_hcd_pci_cleanup);
|
||||
/*module_exit (ohci_hcd_pci_cleanup);*/
|
||||
|
||||
@@ -240,10 +240,22 @@ struct ohci_regs {
|
||||
#define OHCI_CTRL_RWE (1 << 10) /* remote wakeup enable */
|
||||
|
||||
/* pre-shifted values for HCFS */
|
||||
# define OHCI_USB_RESET (0 << 6)
|
||||
# define OHCI_USB_RESUME (1 << 6)
|
||||
# define OHCI_USB_OPER (2 << 6)
|
||||
# define OHCI_USB_SUSPEND (3 << 6)
|
||||
#define OHCI_USB_RESET (0 << 6)
|
||||
#define OHCI_USB_RESUME (1 << 6)
|
||||
#define OHCI_USB_OPER (2 << 6)
|
||||
#define OHCI_USB_SUSPEND (3 << 6)
|
||||
|
||||
// HCFS itself
|
||||
static char *hcfs2string (int state)
|
||||
{
|
||||
switch (state) {
|
||||
case OHCI_USB_RESET: return "reset";
|
||||
case OHCI_USB_RESUME: return "resume";
|
||||
case OHCI_USB_OPER: return "operational";
|
||||
case OHCI_USB_SUSPEND: return "suspend";
|
||||
}
|
||||
return "?";
|
||||
}
|
||||
|
||||
/*
|
||||
* HcCommandStatus (cmdstatus) register masks
|
||||
|
||||
@@ -1,16 +1,309 @@
|
||||
/*
|
||||
ReactOS specific functions for ohci module
|
||||
ReactOS specific functions for OHCI module
|
||||
by Aleksey Bragin (aleksey@reactos.com)
|
||||
Some parts of code are inspired (or even just copied) from ReactOS Videoport driver
|
||||
*/
|
||||
|
||||
#include <ddk/ntddk.h>
|
||||
#include <debug.h>
|
||||
#include "../linux/linux_wrapper.h"
|
||||
#include "ohci_main.h"
|
||||
|
||||
// declare basic init funcs
|
||||
void init_wrapper(struct pci_dev *probe_dev);
|
||||
int ohci_hcd_pci_init (void);
|
||||
void ohci_hcd_pci_cleanup (void);
|
||||
int STDCALL usb_init(void);
|
||||
void STDCALL usb_exit(void);
|
||||
extern struct pci_driver ohci_pci_driver;
|
||||
extern const struct pci_device_id pci_ids[];
|
||||
|
||||
|
||||
|
||||
// This should be removed, but for testing purposes it's here
|
||||
struct pci_dev *dev;
|
||||
//struct pci_device_id *dev_id;
|
||||
|
||||
|
||||
#define USB_OHCI_TAG TAG('u','s','b','o')
|
||||
|
||||
NTSTATUS STDCALL AddDevice(PDRIVER_OBJECT DriverObject, PDEVICE_OBJECT pdo)
|
||||
{
|
||||
PDEVICE_OBJECT fdo;
|
||||
NTSTATUS Status;
|
||||
WCHAR DeviceBuffer[20];
|
||||
UNICODE_STRING DeviceName;
|
||||
POHCI_DRIVER_EXTENSION DriverExtension;
|
||||
POHCI_DEVICE_EXTENSION DeviceExtension;
|
||||
ULONG Size, DeviceNumber;
|
||||
|
||||
DPRINT1("ohci: AddDevice called\n");
|
||||
|
||||
// Allocate driver extension now
|
||||
DriverExtension = IoGetDriverObjectExtension(DriverObject, DriverObject);
|
||||
if (DriverExtension == NULL)
|
||||
{
|
||||
Status = IoAllocateDriverObjectExtension(
|
||||
DriverObject,
|
||||
DriverObject,
|
||||
sizeof(OHCI_DRIVER_EXTENSION),
|
||||
(PVOID *)&DriverExtension);
|
||||
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
DPRINT1("Allocating DriverObjectExtension failed.\n");
|
||||
return Status;
|
||||
}
|
||||
}
|
||||
|
||||
// Create a unicode device name
|
||||
DeviceNumber = 0; //TODO: Allocate new device number every time
|
||||
swprintf(DeviceBuffer, L"\\Device\\USBFDO-%lu", DeviceNumber);
|
||||
RtlInitUnicodeString(&DeviceName, DeviceBuffer);
|
||||
|
||||
Status = IoCreateDevice(DriverObject,
|
||||
sizeof(OHCI_DEVICE_EXTENSION)/* + DriverExtension->InitializationData.HwDeviceExtensionSize*/,
|
||||
&DeviceName,
|
||||
FILE_DEVICE_CONTROLLER,
|
||||
0,
|
||||
FALSE,
|
||||
&fdo);
|
||||
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
DPRINT("IoCreateDevice call failed with status 0x%08x\n", Status);
|
||||
return Status;
|
||||
}
|
||||
|
||||
// zerofill device extension
|
||||
DeviceExtension = (POHCI_DEVICE_EXTENSION)pdo->DeviceExtension;
|
||||
RtlZeroMemory(DeviceExtension, sizeof(OHCI_DEVICE_EXTENSION));
|
||||
DeviceExtension->NextDeviceObject = IoAttachDeviceToDeviceStack(fdo, pdo);
|
||||
|
||||
fdo->Flags &= ~DO_DEVICE_INITIALIZING;
|
||||
|
||||
// Initialize device extension
|
||||
DeviceExtension->DeviceNumber = DeviceNumber;
|
||||
DeviceExtension->PhysicalDeviceObject = pdo;
|
||||
DeviceExtension->FunctionalDeviceObject = fdo;
|
||||
DeviceExtension->DriverExtension = DriverExtension;
|
||||
|
||||
/* Get bus number from the upper level bus driver. */
|
||||
Size = sizeof(ULONG);
|
||||
Status = IoGetDeviceProperty(
|
||||
pdo,
|
||||
DevicePropertyBusNumber,
|
||||
Size,
|
||||
&DeviceExtension->SystemIoBusNumber,
|
||||
&Size);
|
||||
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
DPRINT("Couldn't get an information from bus driver. Panic!!!\n");
|
||||
return Status;
|
||||
}
|
||||
|
||||
DPRINT("Done AddDevice\n");
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
VOID STDCALL DriverUnload(PDRIVER_OBJECT DriverObject)
|
||||
{
|
||||
DPRINT1("DriverUnload()\n");
|
||||
|
||||
// Exit usb device
|
||||
usb_exit();
|
||||
|
||||
// Remove device (ohci_pci_driver.remove)
|
||||
ohci_pci_driver.remove(dev);
|
||||
|
||||
ExFreePool(dev->slot_name);
|
||||
ExFreePool(dev);
|
||||
|
||||
// Perform some cleanup
|
||||
ohci_hcd_pci_cleanup();
|
||||
}
|
||||
|
||||
NTSTATUS InitLinuxWrapper(PDEVICE_OBJECT DeviceObject)
|
||||
{
|
||||
NTSTATUS Status;
|
||||
POHCI_DEVICE_EXTENSION DeviceExtension = (POHCI_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
|
||||
|
||||
// Fill generic linux structs
|
||||
dev = ExAllocatePoolWithTag(PagedPool, sizeof(struct pci_dev), USB_OHCI_TAG);
|
||||
|
||||
init_wrapper(dev);
|
||||
dev->irq = DeviceExtension->InterruptLevel;
|
||||
dev->dev_ext = (PVOID)DeviceExtension;
|
||||
dev->slot_name = ExAllocatePoolWithTag(NonPagedPool, 128, USB_OHCI_TAG); // 128 max len for slot name
|
||||
|
||||
strcpy(dev->dev.name, "OpenHCI PCI-USB Controller");
|
||||
strcpy(dev->slot_name, "OHCD PCI Slot");
|
||||
|
||||
// Init the OHCI HCD. Probe will be called automatically, but will fail because id=NULL
|
||||
Status = ohci_hcd_pci_init();
|
||||
//FIXME: Check status returned value
|
||||
|
||||
// Init core usb
|
||||
usb_init();
|
||||
|
||||
// Probe device with real id now
|
||||
ohci_pci_driver.probe(dev, pci_ids);
|
||||
|
||||
DPRINT("InitLinuxWrapper() done\n");
|
||||
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
NTSTATUS STDCALL
|
||||
OHCD_PnPStartDevice(IN PDEVICE_OBJECT DeviceObject,
|
||||
IN PIRP Irp)
|
||||
{
|
||||
PIO_STACK_LOCATION Stack = IoGetCurrentIrpStackLocation(Irp);
|
||||
PDRIVER_OBJECT DriverObject;
|
||||
POHCI_DRIVER_EXTENSION DriverExtension;
|
||||
POHCI_DEVICE_EXTENSION DeviceExtension;
|
||||
PCM_RESOURCE_LIST AllocatedResources;
|
||||
|
||||
/*
|
||||
* Get the initialization data we saved in VideoPortInitialize.
|
||||
*/
|
||||
DriverObject = DeviceObject->DriverObject;
|
||||
DriverExtension = IoGetDriverObjectExtension(DriverObject, DriverObject);
|
||||
DeviceExtension = (POHCI_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
|
||||
|
||||
/*
|
||||
* Store some resources in the DeviceExtension.
|
||||
*/
|
||||
AllocatedResources = Stack->Parameters.StartDevice.AllocatedResources;
|
||||
if (AllocatedResources != NULL)
|
||||
{
|
||||
CM_FULL_RESOURCE_DESCRIPTOR *FullList;
|
||||
CM_PARTIAL_RESOURCE_DESCRIPTOR *Descriptor;
|
||||
ULONG ResourceCount;
|
||||
ULONG ResourceListSize;
|
||||
|
||||
/* Save the resource list */
|
||||
ResourceCount = AllocatedResources->List[0].PartialResourceList.Count;
|
||||
ResourceListSize =
|
||||
FIELD_OFFSET(CM_RESOURCE_LIST, List[0].PartialResourceList.
|
||||
PartialDescriptors[ResourceCount]);
|
||||
DeviceExtension->AllocatedResources = ExAllocatePool(PagedPool, ResourceListSize);
|
||||
if (DeviceExtension->AllocatedResources == NULL)
|
||||
{
|
||||
return STATUS_INSUFFICIENT_RESOURCES;
|
||||
}
|
||||
|
||||
RtlCopyMemory(DeviceExtension->AllocatedResources,
|
||||
AllocatedResources,
|
||||
ResourceListSize);
|
||||
|
||||
/* Get the interrupt level/vector - needed by HwFindAdapter sometimes */
|
||||
for (FullList = AllocatedResources->List;
|
||||
FullList < AllocatedResources->List + AllocatedResources->Count;
|
||||
FullList++)
|
||||
{
|
||||
/* FIXME: Is this ASSERT ok for resources from the PNP manager? */
|
||||
/*ASSERT(FullList->InterfaceType == PCIBus &&
|
||||
FullList->BusNumber == DeviceExtension->SystemIoBusNumber &&
|
||||
1 == FullList->PartialResourceList.Version &&
|
||||
1 == FullList->PartialResourceList.Revision);*/
|
||||
for (Descriptor = FullList->PartialResourceList.PartialDescriptors;
|
||||
Descriptor < FullList->PartialResourceList.PartialDescriptors + FullList->PartialResourceList.Count;
|
||||
Descriptor++)
|
||||
{
|
||||
if (Descriptor->Type == CmResourceTypeInterrupt)
|
||||
{
|
||||
DeviceExtension->InterruptLevel = Descriptor->u.Interrupt.Level;
|
||||
DeviceExtension->InterruptVector = Descriptor->u.Interrupt.Vector;
|
||||
}
|
||||
else if (Descriptor->Type == CmResourceTypeMemory)
|
||||
{
|
||||
DeviceExtension->BaseAddress = Descriptor->u.Memory.Start;
|
||||
DeviceExtension->BaseAddrLength = Descriptor->u.Memory.Length;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
DPRINT1("Interrupt level: 0x%x Interrupt Vector: 0x%x\n",
|
||||
DeviceExtension->InterruptLevel,
|
||||
DeviceExtension->InterruptVector);
|
||||
|
||||
/*
|
||||
* Init wrapper with this object
|
||||
*/
|
||||
return InitLinuxWrapper(DeviceObject);
|
||||
}
|
||||
|
||||
// Dispatch PNP
|
||||
NTSTATUS STDCALL DispatchPnp(PDEVICE_OBJECT DeviceObject, PIRP Irp)
|
||||
{
|
||||
PIO_STACK_LOCATION IrpSp;
|
||||
NTSTATUS Status;
|
||||
|
||||
IrpSp = IoGetCurrentIrpStackLocation(Irp);
|
||||
|
||||
switch (IrpSp->MinorFunction)
|
||||
{
|
||||
case IRP_MN_START_DEVICE:
|
||||
//Status = IntVideoPortForwardIrpAndWait(DeviceObject, Irp);
|
||||
//if (NT_SUCCESS(Status) && NT_SUCCESS(Irp->IoStatus.Status))
|
||||
|
||||
Status = OHCD_PnPStartDevice(DeviceObject, Irp);
|
||||
Irp->IoStatus.Status = Status;
|
||||
Irp->IoStatus.Information = 0;
|
||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
||||
break;
|
||||
|
||||
|
||||
case IRP_MN_REMOVE_DEVICE:
|
||||
case IRP_MN_QUERY_REMOVE_DEVICE:
|
||||
case IRP_MN_CANCEL_REMOVE_DEVICE:
|
||||
case IRP_MN_SURPRISE_REMOVAL:
|
||||
|
||||
case IRP_MN_STOP_DEVICE:
|
||||
//Status = IntVideoPortForwardIrpAndWait(DeviceObject, Irp);
|
||||
//if (NT_SUCCESS(Status) && NT_SUCCESS(Irp->IoStatus.Status))
|
||||
Status = STATUS_SUCCESS;
|
||||
Irp->IoStatus.Status = Status;
|
||||
Irp->IoStatus.Information = 0;
|
||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
||||
|
||||
IoDeleteDevice(DeviceObject); // just delete device for now
|
||||
break;
|
||||
|
||||
case IRP_MN_QUERY_STOP_DEVICE:
|
||||
case IRP_MN_CANCEL_STOP_DEVICE:
|
||||
Status = STATUS_SUCCESS;
|
||||
Irp->IoStatus.Status = STATUS_SUCCESS;
|
||||
Irp->IoStatus.Information = 0;
|
||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
||||
break;
|
||||
|
||||
default:
|
||||
return STATUS_NOT_IMPLEMENTED;
|
||||
break;
|
||||
}
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
NTSTATUS STDCALL DispatchPower(PDEVICE_OBJECT fido, PIRP Irp)
|
||||
{
|
||||
DbgPrint("IRP_MJ_POWER dispatch\n");
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
/*
|
||||
* Standard DriverEntry method.
|
||||
*/
|
||||
NTSTATUS STDCALL
|
||||
DriverEntry(IN PVOID Context1, IN PVOID Context2)
|
||||
DriverEntry(IN PDRIVER_OBJECT DriverObject, IN PUNICODE_STRING RegPath)
|
||||
{
|
||||
DriverObject->DriverUnload = DriverUnload;
|
||||
DriverObject->DriverExtension->AddDevice = AddDevice;
|
||||
DriverObject->MajorFunction[IRP_MJ_PNP] = DispatchPnp;
|
||||
DriverObject->MajorFunction[IRP_MJ_POWER] = DispatchPower;
|
||||
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
* OHCI WDM/PNP driver
|
||||
*
|
||||
* Copyright (C) 2005 ReactOS Team
|
||||
*
|
||||
* Author: Aleksey Bragin (aleksey@reactos.com)
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef OHCI_MAIN_H
|
||||
#define OHCI_MAIN_H
|
||||
|
||||
typedef struct _OHCI_DRIVER_EXTENSION
|
||||
{
|
||||
//OHCI_HW_INITIALIZATION_DATA InitializationData;
|
||||
PVOID HwContext;
|
||||
//UNICODE_STRING RegistryPath;
|
||||
} OHCI_DRIVER_EXTENSION, *POHCI_DRIVER_EXTENSION;
|
||||
|
||||
typedef struct _OHCI_DEVICE_EXTENSTION
|
||||
{
|
||||
ULONG DeviceNumber;
|
||||
PDEVICE_OBJECT PhysicalDeviceObject;
|
||||
PDEVICE_OBJECT FunctionalDeviceObject;
|
||||
PDEVICE_OBJECT NextDeviceObject;
|
||||
//UNICODE_STRING RegistryPath;
|
||||
PKINTERRUPT InterruptObject;
|
||||
KSPIN_LOCK InterruptSpinLock;
|
||||
PCM_RESOURCE_LIST AllocatedResources;
|
||||
ULONG InterruptVector;
|
||||
ULONG InterruptLevel;
|
||||
PHYSICAL_ADDRESS BaseAddress;
|
||||
ULONG BaseAddrLength;
|
||||
ULONG AdapterInterfaceType;
|
||||
ULONG SystemIoBusNumber;
|
||||
ULONG SystemIoSlotNumber;
|
||||
LIST_ENTRY AddressMappingListHead;
|
||||
//KDPC DpcObject;
|
||||
OHCI_DRIVER_EXTENSION *DriverExtension;
|
||||
ULONG DeviceOpened;
|
||||
//KMUTEX DeviceLock;
|
||||
//CHAR MiniPortDeviceExtension[1];
|
||||
} OHCI_DEVICE_EXTENSION, *POHCI_DEVICE_EXTENSION;
|
||||
|
||||
|
||||
#endif
|
||||
@@ -12,6 +12,9 @@
|
||||
*
|
||||
* All structs and prototypes are based on kernel source 2.5.72
|
||||
*
|
||||
* Modified by Aleksey Bragin (aleksey@reactos.com) for ReactOS needs
|
||||
*
|
||||
*
|
||||
* #include <standard-GPL-header.h>
|
||||
*/
|
||||
|
||||
@@ -145,6 +148,14 @@ struct completion {
|
||||
wait_queue_head_t wait;
|
||||
};
|
||||
|
||||
// windows lookaside list head
|
||||
typedef void* kmem_cache_t;
|
||||
|
||||
struct dma_pool
|
||||
{
|
||||
int dummy;
|
||||
};
|
||||
|
||||
/* from mod_devicetable.h */
|
||||
|
||||
struct usb_device_id {
|
||||
@@ -205,6 +216,7 @@ struct pci_dev {
|
||||
int base[4];
|
||||
int flags[4];
|
||||
void * data;
|
||||
void * dev_ext; // link to Windows DeviceExtension
|
||||
};
|
||||
|
||||
struct pci_bus {
|
||||
@@ -285,6 +297,8 @@ struct usbdevfs_hub_portinfo
|
||||
#define MODULE_DESCRIPTION(a)
|
||||
#define MODULE_LICENSE(a)
|
||||
#define MODULE_DEVICE_TABLE(type,name) void* module_table_##name=&name
|
||||
#define MODULE_PARM(a,b)
|
||||
#define MODULE_PARM_DESC(a,b)
|
||||
|
||||
#define __devinit
|
||||
#define __exit
|
||||
@@ -312,6 +326,10 @@ struct usbdevfs_hub_portinfo
|
||||
#define unlikely(x) (x)
|
||||
#define prefetch(x) 1
|
||||
|
||||
#define inw(x) READ_PORT_USHORT((PUSHORT)(x))
|
||||
#define outw(x,p) WRITE_PORT_USHORT((PUSHORT)(p),(x))
|
||||
#define outl(x,p) WRITE_PORT_ULONG((PUSHORT)(p),(x))
|
||||
|
||||
/* The kernel macro for list_for_each_entry makes nonsense (have no clue
|
||||
* why, this is just the same definition...) */
|
||||
|
||||
@@ -371,7 +389,7 @@ struct usbdevfs_hub_portinfo
|
||||
#define down_read(a) do {} while(0)
|
||||
#define up_read(a) do {} while(0)
|
||||
|
||||
#define DECLARE_WAIT_QUEUE_HEAD(x) int x
|
||||
#define DECLARE_WAIT_QUEUE_HEAD(x) KEVENT x
|
||||
|
||||
#define DECLARE_COMPLETION(x) struct completion x
|
||||
|
||||
@@ -382,6 +400,8 @@ struct usbdevfs_hub_portinfo
|
||||
|
||||
|
||||
/* PCI */
|
||||
#define to_pci_dev(n) container_of(n, struct pci_dev, dev)
|
||||
|
||||
#define pci_pool_create(a,b,c,d,e) (void*)1
|
||||
|
||||
#define pci_pool_alloc(a,b,c) my_pci_pool_alloc(a,b,c)
|
||||
@@ -426,6 +446,16 @@ int my_pci_module_init(struct pci_driver *x);
|
||||
#define bus_register(a) do {} while(0)
|
||||
#define bus_unregister(a) do {} while(0)
|
||||
|
||||
/* DMA */
|
||||
//#define dma_pool_alloc(a,b,c) my_dma_pool_alloc((a),(b),(c))
|
||||
#define dma_pool_alloc(a,b,c) pci_pool_alloc(a,b,c)
|
||||
#define dma_pool_create(a,b,c,d,e) pci_pool_create(a,b,c,d,e)
|
||||
#define dma_pool_free(a,b,c) pci_pool_free(a,b,c)
|
||||
#define dma_pool_destroy(a) pci_pool_destroy(a)
|
||||
|
||||
#define dma_alloc_coherent(a,b,c,d) NULL
|
||||
#define dma_free_coherent(a,b,c,d) do {} while(0)
|
||||
|
||||
#define dma_map_single(a,b,c,d) ((u32)(b)&0xfffffff)
|
||||
#define dma_unmap_single(a,b,c,d) do {} while(0)
|
||||
#define pci_unmap_single(a,b,c,d) do {} while(0)
|
||||
@@ -450,11 +480,15 @@ int my_pci_module_init(struct pci_driver *x);
|
||||
#define PCI_ROM_RESOURCE 0
|
||||
#define IORESOURCE_IO 1
|
||||
|
||||
#define DECLARE_WAITQUEUE(a,b) wait_queue_head_t a=0
|
||||
#define init_waitqueue_head(a) do {} while(0)
|
||||
#define DECLARE_WAITQUEUE(a,b) KEVENT a=0
|
||||
#define init_waitqueue_head(a) my_init_waitqueue_head(a)
|
||||
#define add_wait_queue(a,b) do {} while(0)
|
||||
#define remove_wait_queue(a,b) do {} while(0)
|
||||
void my_init_waitqueue_head(PKEVENT a);
|
||||
|
||||
VOID KeMemoryBarrier(VOID);
|
||||
|
||||
#define mb() KeMemoryBarrier()
|
||||
#define wmb() __asm__ __volatile__ ("": : :"memory")
|
||||
#define rmb() __asm__ __volatile__ ("lock; addl $0,0(%%esp)": : :"memory")
|
||||
|
||||
@@ -475,15 +509,41 @@ void my_wait_for_completion(struct completion*);
|
||||
#define daemonize(a) do {} while(0)
|
||||
#define allow_signal(a) do {} while(0)
|
||||
#define wait_event_interruptible(x,y) do {} while(0)
|
||||
|
||||
#define interruptible_sleep_on(a) my_interruptible_sleep_on(a)
|
||||
void my_interruptible_sleep_on(PKEVENT evnt);
|
||||
|
||||
#define flush_scheduled_work() do {} while(0)
|
||||
#define refrigerator(x) do {} while(0)
|
||||
#define signal_pending(x) 1 // fall through threads
|
||||
#define complete_and_exit(a,b) return 0
|
||||
|
||||
#define kill_proc(a,b,c) 0
|
||||
//#define kill_proc(a,b,c) 0
|
||||
#define kill_proc(a,b,c) my_kill_proc(a, b, c);
|
||||
int my_kill_proc(int pid, int signal, int unk);
|
||||
|
||||
#define yield() do {} while(0)
|
||||
#define cpu_relax() do {} while(0)
|
||||
|
||||
#define WARN_ON(a) do {} while(0)
|
||||
|
||||
/*------------------------------------------------------------------------*/
|
||||
/* Lookaside lists funcs */
|
||||
/*------------------------------------------------------------------------*/
|
||||
#define kmem_cache_create(a,b,c,d,e,f) my_kmem_cache_create((a),(b),(c),(d),(e),(f))
|
||||
#define kmem_cache_destroy(a) my_kmem_cache_destroy((a))
|
||||
#define kmem_cache_alloc(co, flags) my_kmem_cache_alloc((co), (flags))
|
||||
#define kmem_cache_free(co, ptr) my_kmem_cache_free((co), (ptr))
|
||||
|
||||
kmem_cache_t *my_kmem_cache_create(const char *tag, size_t alloc_size,
|
||||
size_t offset, unsigned long flags,
|
||||
void *ctor,
|
||||
void *dtor);
|
||||
|
||||
void my_kmem_cache_destroy(kmem_cache_t *co);
|
||||
void *my_kmem_cache_alloc(kmem_cache_t *co, int flags);
|
||||
void my_kmem_cache_free(kmem_cache_t *co, void *ptr);
|
||||
|
||||
/*------------------------------------------------------------------------*/
|
||||
/* Kernel macros */
|
||||
/*------------------------------------------------------------------------*/
|
||||
@@ -528,7 +588,7 @@ void my_wait_for_completion(struct completion*);
|
||||
/*------------------------------------------------------------------------*/
|
||||
#ifdef DEBUG_MODE
|
||||
#define dev_printk(lvl,x,f,arg...) printk(f, ## arg)
|
||||
#define dev_dbg(x,f,arg...) do {} while (0) //printk(f, ## arg)
|
||||
#define dev_dbg(x,f,arg...) printk(f, ## arg)
|
||||
#define dev_info(x,f,arg...) printk(f,## arg)
|
||||
#define dev_warn(x,f,arg...) printk(f,## arg)
|
||||
#define dev_err(x,f,arg...) printk(f,## arg)
|
||||
@@ -551,6 +611,21 @@ void my_wait_for_completion(struct completion*);
|
||||
#define PCI_DEVFN(a,b) 0
|
||||
#define PCI_SLOT(a) 0
|
||||
|
||||
/**
|
||||
* PCI_DEVICE_CLASS - macro used to describe a specific pci device class
|
||||
* @dev_class: the class, subclass, prog-if triple for this device
|
||||
* @dev_class_mask: the class mask for this device
|
||||
*
|
||||
* This macro is used to create a struct pci_device_id that matches a
|
||||
* specific PCI class. The vendor, device, subvendor, and subdevice
|
||||
* fields will be set to PCI_ANY_ID.
|
||||
*/
|
||||
#define PCI_DEVICE_CLASS(dev_class,dev_class_mask) \
|
||||
.class = (dev_class), .class_mask = (dev_class_mask), \
|
||||
.vendor = PCI_ANY_ID, .device = PCI_ANY_ID, \
|
||||
.subvendor = PCI_ANY_ID, .subdevice = PCI_ANY_ID
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------*/
|
||||
/* Stuff from kernel */
|
||||
/*------------------------------------------------------------------------*/
|
||||
@@ -639,6 +714,9 @@ static void __inline__ mod_timer(struct timer_list* t, int ex)
|
||||
add_timer(t);
|
||||
}
|
||||
|
||||
#define time_after_eq(a,b) \
|
||||
(((long)(a) - (long)(b) >= 0))
|
||||
|
||||
/*------------------------------------------------------------------------*/
|
||||
/* Device driver and process related stuff */
|
||||
/*------------------------------------------------------------------------*/
|
||||
@@ -670,7 +748,7 @@ int my_device_unregister(struct device *dev);
|
||||
int my_schedule_timeout(int x);
|
||||
|
||||
#define wake_up(x) my_wake_up(x)
|
||||
void my_wake_up(void*);
|
||||
void my_wake_up(PKEVENT);
|
||||
|
||||
// cannot be mapped via macro due to collision with urb->complete
|
||||
static void __inline__ complete(struct completion *p)
|
||||
@@ -681,7 +759,7 @@ static void __inline__ complete(struct completion *p)
|
||||
}
|
||||
|
||||
#define kernel_thread(a,b,c) my_kernel_thread(a,b,c)
|
||||
int my_kernel_thread(int (*handler)(void*), void* parm, int flags);
|
||||
int my_kernel_thread(int STDCALL (*handler)(void*), void* parm, int flags);
|
||||
|
||||
/*------------------------------------------------------------------------*/
|
||||
/* PCI, simple and inlined... */
|
||||
@@ -714,7 +792,7 @@ struct my_irqs {
|
||||
|
||||
void handle_irqs(int irq);
|
||||
void inc_jiffies(int);
|
||||
void init_wrapper(void);
|
||||
void init_wrapper(struct pci_dev *pci_dev);
|
||||
void do_all_timers(void);
|
||||
|
||||
#define __KERNEL_DS 0x18
|
||||
|
||||
@@ -1,29 +1,45 @@
|
||||
// PCI -> HAL interface
|
||||
// this file is part of linux_wrapper.h
|
||||
|
||||
//FIXME: Move this file, make its definitions more general
|
||||
#include "../host/ohci_main.h"
|
||||
|
||||
/*
|
||||
Initialize device before it's used by a driver. Ask low-level code to enable I/O and memory.
|
||||
Wake up the device if it was suspended. Beware, this function can fail.
|
||||
*/
|
||||
static int __inline__ pci_enable_device(struct pci_dev *dev)
|
||||
{
|
||||
DPRINT1("pci_enable_device() called...\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Get physical address where resource x resides
|
||||
static unsigned long __inline__ pci_resource_start (struct pci_dev *dev, int x)
|
||||
static PHYSICAL_ADDRESS __inline__ pci_resource_start (struct pci_dev *dev, int x)
|
||||
{
|
||||
// HalGetBusData...
|
||||
// HalAssignSlotResources ?
|
||||
return dev->base[x];
|
||||
POHCI_DEVICE_EXTENSION dev_ext = (POHCI_DEVICE_EXTENSION)dev->dev_ext;
|
||||
DPRINT1("pci_resource_start() called, x=0x%x\n", x);
|
||||
|
||||
//FIXME: Take x into account
|
||||
return dev_ext->BaseAddress;
|
||||
//return dev->base[x];
|
||||
}
|
||||
|
||||
// ???
|
||||
static unsigned long __inline__ pci_resource_len (struct pci_dev *dev, int x){return 0;}
|
||||
static unsigned long __inline__ pci_resource_len (struct pci_dev *dev, int x)
|
||||
{
|
||||
POHCI_DEVICE_EXTENSION ext = (POHCI_DEVICE_EXTENSION)dev->dev_ext;
|
||||
|
||||
DPRINT1("pci_resource_len() called, x=0x%x\n", x);
|
||||
|
||||
//FIXME: Take x into account
|
||||
return ext->BaseAddrLength;
|
||||
}
|
||||
|
||||
// ???
|
||||
static int __inline__ pci_resource_flags(struct pci_dev *dev, int x)
|
||||
{
|
||||
DPRINT1("pci_resource_flags() called, x=0x%x\n");
|
||||
return dev->flags[x];
|
||||
}
|
||||
|
||||
@@ -35,6 +51,7 @@ static int __inline__ pci_set_master(struct pci_dev *dev) {return 0;}
|
||||
// Store pointer to data for this device
|
||||
static int __inline__ pci_set_drvdata(struct pci_dev *dev, void* d)
|
||||
{
|
||||
DPRINT1("pci_set_drvdata() called...\n");
|
||||
dev->data=(void*)d;
|
||||
return 0;
|
||||
}
|
||||
@@ -42,6 +59,7 @@ static int __inline__ pci_set_drvdata(struct pci_dev *dev, void* d)
|
||||
// Get pointer to previously saved data
|
||||
static void __inline__ *pci_get_drvdata(struct pci_dev *dev)
|
||||
{
|
||||
DPRINT1("pci_get_drvdata() called...\n");
|
||||
return dev->data;
|
||||
}
|
||||
|
||||
@@ -59,16 +77,25 @@ start begin of region
|
||||
n length of region
|
||||
name name of requester
|
||||
*/
|
||||
static int __inline__ request_region(unsigned long addr, unsigned long len, const char * d){return 0;}
|
||||
static int __inline__ request_region(PHYSICAL_ADDRESS addr, unsigned long len, const char * d)
|
||||
{
|
||||
DPRINT1("request_region(): addr=0x%x, len=0x%x\n", addr, len);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
Unmap I/O memory from kernel address space.
|
||||
|
||||
Parameters:
|
||||
addr virtual start address
|
||||
|
||||
*/
|
||||
static int __inline__ iounmap(void* p)
|
||||
{
|
||||
DPRINT1("iounmap(): p=0x%x. FIXME - how to obtain len of mapped region?\n", p);
|
||||
|
||||
//MmUnnapIoSpace(p);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -79,7 +106,11 @@ Parameters:
|
||||
start begin of region
|
||||
n length of region
|
||||
*/
|
||||
static int __inline__ release_region(unsigned long addr, unsigned long len){return 0;}
|
||||
static int __inline__ release_region(PHYSICAL_ADDRESS addr, unsigned long len)
|
||||
{
|
||||
DPRINT1("release_region(): addr=0x%x, len=0x%x\n", addr, len);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
Allocate I/O memory region.
|
||||
@@ -89,8 +120,9 @@ start begin of region
|
||||
n length of region
|
||||
name name of requester
|
||||
*/
|
||||
static int __inline__ request_mem_region(unsigned long addr, unsigned long len, const char * d)
|
||||
static int __inline__ request_mem_region(PHYSICAL_ADDRESS addr, unsigned long len, const char * d)
|
||||
{
|
||||
DPRINT1("request_mem_region(): addr=0x%x, len=0x%x\n", addr, len);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -104,10 +136,12 @@ size size of physical address range
|
||||
Returns:
|
||||
virtual start address of mapped range
|
||||
*/
|
||||
static void __inline__ *ioremap_nocache(unsigned long addr, unsigned long len)
|
||||
static void __inline__ *ioremap_nocache(PHYSICAL_ADDRESS addr, unsigned long len)
|
||||
{
|
||||
// MmMapIoSpace ?
|
||||
return (void*)addr;
|
||||
// MmMapIoSpace with NoCache param
|
||||
DPRINT1("ioremap_nocache(): addr=0x%x, len=0x%x\n", addr, len);
|
||||
|
||||
return MmMapIoSpace(addr, len, MmNonCached);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -117,7 +151,8 @@ Parameters:
|
||||
start begin of region
|
||||
n length of region
|
||||
*/
|
||||
static int __inline__ release_mem_region(unsigned long addr, unsigned long len)
|
||||
static int __inline__ release_mem_region(PHYSICAL_ADDRESS addr, unsigned long len)
|
||||
{
|
||||
DPRINT1("release_mem_region(): addr=0x%x, len=0x%x\n", addr, len);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -5,7 +5,10 @@
|
||||
#define PCI_DEVICE_ID_NS_87560_LIO 0x000e
|
||||
#define PCI_VENDOR_ID_AMD 0x1022
|
||||
#define PCI_VENDOR_ID_OPTI 0x1045
|
||||
#define PCI_VENDOR_ID_VIA 0x1106
|
||||
#define PCI_VENDOR_ID_INTEL 0x8086
|
||||
|
||||
#define PCI_CLASS_SERIAL_USB (PCI_CLASS_SERIAL_BUS_CTLR << 8 + PCI_SUBCLASS_SB_USB)
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@ static int drvs_num;
|
||||
* Helper functions for top-level system
|
||||
*/
|
||||
/*------------------------------------------------------------------------*/
|
||||
void init_wrapper(void)
|
||||
void init_wrapper(struct pci_dev *probe_dev)
|
||||
{
|
||||
int n;
|
||||
for(n=0;n<MAX_TIMERS;n++)
|
||||
@@ -58,7 +58,7 @@ void init_wrapper(void)
|
||||
my_jiffies=0;
|
||||
num_irqs=0;
|
||||
my_current=&act_cur;
|
||||
pci_probe_dev=NULL;
|
||||
pci_probe_dev=probe_dev;
|
||||
|
||||
for(n=0;n<MAX_IRQS;n++)
|
||||
{
|
||||
@@ -108,12 +108,40 @@ void do_all_timers(void)
|
||||
}
|
||||
/*------------------------------------------------------------------------*/
|
||||
// Purpose: Remember thread procedure and data in global var
|
||||
int my_kernel_thread(int (*handler)(void*), void* parm, int flags)
|
||||
// ReactOS Purpose: Create real kernel thread
|
||||
int my_kernel_thread(int STDCALL (*handler)(void*), void* parm, int flags)
|
||||
{
|
||||
thread_handler=handler;
|
||||
thread_parm=parm;
|
||||
return 42; // PID :-)
|
||||
HANDLE hThread;
|
||||
//thread_handler=handler;
|
||||
//thread_parm=parm;
|
||||
//return 42; // PID :-)
|
||||
|
||||
ASSERT(KeGetCurrentIrql() == PASSIVE_LEVEL);
|
||||
|
||||
PsCreateSystemThread(&hThread,
|
||||
THREAD_ALL_ACCESS,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
(PKSTART_ROUTINE)handler,
|
||||
parm);
|
||||
|
||||
return (int)hThread; // FIXME: Correct?
|
||||
}
|
||||
|
||||
// Kill the process
|
||||
int my_kill_proc(int pid, int signal, int unk)
|
||||
{
|
||||
HANDLE hThread;
|
||||
|
||||
// TODO: Implement actual process killing
|
||||
|
||||
hThread = (HANDLE)pid;
|
||||
ZwClose(hThread);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------*/
|
||||
/* Device management
|
||||
* As simple as possible, but as complete as necessary ...
|
||||
@@ -182,9 +210,17 @@ void my_device_initialize(struct device *dev)
|
||||
{
|
||||
}
|
||||
/*------------------------------------------------------------------------*/
|
||||
void my_wake_up(void* p)
|
||||
void my_wake_up(PKEVENT evnt)
|
||||
{
|
||||
need_wakeup=1;
|
||||
|
||||
KeSetEvent(evnt, 0, FALSE); // Signal event
|
||||
}
|
||||
/*------------------------------------------------------------------------*/
|
||||
void my_init_waitqueue_head(PKEVENT evnt)
|
||||
{
|
||||
// this is used only in core/message.c, and it isn't needed there
|
||||
//KeInitializeEvent(evnt, NotificationEvent, TRUE); // signalled state
|
||||
}
|
||||
/*------------------------------------------------------------------------*/
|
||||
/* wait until woken up (only one wait allowed!) */
|
||||
@@ -228,6 +264,12 @@ void my_wait_for_completion(struct completion *x)
|
||||
// printk("wait for completion done %i\n",x->done);
|
||||
}
|
||||
/*------------------------------------------------------------------------*/
|
||||
void my_interruptible_sleep_on(PKEVENT evnt)
|
||||
{
|
||||
KeWaitForSingleObject(evnt, Executive, KernelMode, FALSE, NULL);
|
||||
KeClearEvent(evnt); // reset to not-signalled
|
||||
}
|
||||
/*------------------------------------------------------------------------*/
|
||||
// Helper for pci_module_init
|
||||
/*------------------------------------------------------------------------*/
|
||||
int my_pci_module_init(struct pci_driver *x)
|
||||
@@ -269,3 +311,54 @@ int my_free_irq(int irq, void* p)
|
||||
return 0;
|
||||
}
|
||||
/*------------------------------------------------------------------------*/
|
||||
// Lookaside funcs
|
||||
/*------------------------------------------------------------------------*/
|
||||
kmem_cache_t *my_kmem_cache_create(const char *tag, size_t alloc_size,
|
||||
size_t offset, unsigned long flags,
|
||||
void *ctor,
|
||||
void *dtor)
|
||||
{
|
||||
//TODO: Take in account ctor and dtor - callbacks for alloc/free, flags and offset
|
||||
//FIXME: We assume this cache is always NPaged
|
||||
PNPAGED_LOOKASIDE_LIST Lookaside;
|
||||
ULONG Tag=0x11223344; //FIXME: Make this from tag
|
||||
|
||||
Lookaside = ExAllocatePool(NonPagedPool, sizeof(NPAGED_LOOKASIDE_LIST));
|
||||
|
||||
ExInitializeNPagedLookasideList(
|
||||
Lookaside,
|
||||
NULL,
|
||||
NULL,
|
||||
0,
|
||||
alloc_size,
|
||||
Tag,
|
||||
0);
|
||||
|
||||
return (kmem_cache_t *)Lookaside;
|
||||
}
|
||||
/*------------------------------------------------------------------------*/
|
||||
void my_kmem_cache_destroy(kmem_cache_t *co)
|
||||
{
|
||||
ExDeleteNPagedLookasideList((PNPAGED_LOOKASIDE_LIST)co);
|
||||
|
||||
ExFreePool(co);
|
||||
}
|
||||
/*------------------------------------------------------------------------*/
|
||||
void *my_kmem_cache_alloc(kmem_cache_t *co, int flags)
|
||||
{
|
||||
return ExAllocateFromNPagedLookasideList((PNPAGED_LOOKASIDE_LIST)co);
|
||||
}
|
||||
/*------------------------------------------------------------------------*/
|
||||
void my_kmem_cache_free(kmem_cache_t *co, void *ptr)
|
||||
{
|
||||
ExFreeToNPagedLookasideList((PNPAGED_LOOKASIDE_LIST)co, ptr);
|
||||
}
|
||||
/*------------------------------------------------------------------------*/
|
||||
// DMA, not used now
|
||||
/*------------------------------------------------------------------------*/
|
||||
void *my_dma_pool_alloc(struct dma_pool *pool, int gfp_flags, dma_addr_t *dma_handle)
|
||||
{
|
||||
// HalAllocCommonBuffer
|
||||
// But ideally IoGetDmaAdapter
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -12,3 +12,4 @@ void wait_ms(int mils);
|
||||
#define CONFIG_PCI
|
||||
|
||||
#include "linux/usb.h"
|
||||
#include "linux/pci_ids.h"
|
||||
@@ -384,6 +384,8 @@ HalReadDmaCounter(
|
||||
PADAPTER_OBJECT AdapterObject)
|
||||
{
|
||||
UNIMPLEMENTED;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -682,6 +684,8 @@ STDCALL
|
||||
KdPortDisableInterrupts()
|
||||
{
|
||||
UNIMPLEMENTED;
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
@@ -690,6 +694,8 @@ STDCALL
|
||||
KdPortEnableInterrupts()
|
||||
{
|
||||
UNIMPLEMENTED;
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
@@ -709,6 +715,8 @@ KeAcquireSpinLockRaiseToSynch(
|
||||
PKSPIN_LOCK SpinLock)
|
||||
{
|
||||
UNIMPLEMENTED;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -99,7 +99,7 @@ static BOOLEAN UdelayCalibrated = FALSE;
|
||||
* For supported compilers we use inline assembler. For the others,
|
||||
* portable plain C.
|
||||
*/
|
||||
VOID STDCALL
|
||||
VOID STDCALL __attribute__((noinline))
|
||||
__KeStallExecutionProcessor(ULONG Loops)
|
||||
{
|
||||
if (!Loops)
|
||||
|
||||
@@ -417,13 +417,13 @@ HalQueryDisplayOwnership();
|
||||
static inline BYTE Ki386ReadFsByte(ULONG offset)
|
||||
{
|
||||
BYTE b;
|
||||
__asm__ __volatile__("movb %%fs:(%1),%0":"=g" (b):"0" (offset));
|
||||
__asm__ __volatile__("movb %%fs:(%1),%0":"=q" (b):"0" (offset));
|
||||
return b;
|
||||
}
|
||||
|
||||
static inline VOID Ki386WriteFsByte(ULONG offset, BYTE value)
|
||||
{
|
||||
__asm__ __volatile__("movb %0,%%fs:(%1)"::"r" (value), "r" (offset));
|
||||
__asm__ __volatile__("movb %0,%%fs:(%1)"::"q" (value), "r" (offset));
|
||||
}
|
||||
|
||||
#elif defined(_MSC_VER)
|
||||
|
||||
@@ -412,16 +412,10 @@ typedef enum _SID_NAME_USE {
|
||||
|
||||
#ifndef _DISABLE_TIDENTS
|
||||
# ifdef UNICODE
|
||||
# ifndef _T
|
||||
# define _T(quote) L##quote
|
||||
# endif /* _T */
|
||||
# ifndef _TEXT
|
||||
# define TEXT(quote) L##quote
|
||||
# endif /* _TEXT */
|
||||
# else /* UNICODE */
|
||||
# ifndef _T
|
||||
# define _T(quote) quote
|
||||
# endif /* _T */
|
||||
# ifndef _TEXT
|
||||
# define TEXT(quote) quote
|
||||
# endif /* _TEXT */
|
||||
|
||||
@@ -34,8 +34,8 @@
|
||||
*
|
||||
* USAGE
|
||||
*
|
||||
* This library follows exactly the same interface as the Microsoft Cancel-Safe Queue
|
||||
* routines (IoCsqXxx()). As such, the authoritative reference is the
|
||||
* This library follows exactly the same interface as the Microsoft Cancel-Safe
|
||||
* Queue routines (IoCsqXxx()). As such, the authoritative reference is the
|
||||
* current DDK. There is also a DDK sample called "cancel" that has an
|
||||
* example of how to use this code. I have also provided a sample driver
|
||||
* that makes use of this queue. Finally, please do read the header and the
|
||||
|
||||
@@ -129,7 +129,7 @@ typedef union _SLIST_HEADER
|
||||
ULONGLONG Alignment;
|
||||
struct
|
||||
{
|
||||
SINGLE_LIST_ENTRY Next;
|
||||
SLIST_ENTRY Next;
|
||||
USHORT Depth;
|
||||
USHORT Sequence;
|
||||
}; /* now anonymous */
|
||||
|
||||
@@ -617,7 +617,7 @@ FsRtlNotifyReportChange (
|
||||
);
|
||||
|
||||
VOID STDCALL
|
||||
FsRtlNotifyInitializeSync(IN OUT PNOTIFY_SYNC NotifySync);
|
||||
FsRtlNotifyInitializeSync(IN OUT PNOTIFY_SYNC *NotifySync);
|
||||
|
||||
NTSTATUS STDCALL
|
||||
FsRtlNotifyVolumeEvent(IN PFILE_OBJECT FileObject,
|
||||
|
||||
@@ -246,6 +246,12 @@ KeQueryTimeIncrement (
|
||||
VOID
|
||||
);
|
||||
|
||||
ULONGLONG
|
||||
STDCALL
|
||||
KeQueryInterruptTime(
|
||||
VOID
|
||||
);
|
||||
|
||||
VOID
|
||||
STDCALL
|
||||
KeRaiseIrql (
|
||||
|
||||
@@ -403,7 +403,7 @@ NTSTATUS STDCALL PsLookupProcessThreadByCid(IN PCLIENT_ID Cid,
|
||||
OUT struct _ETHREAD **Thread);
|
||||
/* OUT PETHREAD *Thread); */
|
||||
|
||||
NTSTATUS STDCALL PsLookupThreadByThreadId(IN PVOID ThreadId,
|
||||
NTSTATUS STDCALL PsLookupThreadByThreadId(IN HANDLE ThreadId,
|
||||
OUT struct _ETHREAD **Thread);
|
||||
/* OUT PETHREAD *Thread); */
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ typedef ULONG KAFFINITY, *PKAFFINITY;
|
||||
/*
|
||||
* Various other types (all quite pointless)
|
||||
*/
|
||||
typedef CCHAR KPROCESSOR_MODE;
|
||||
typedef UCHAR KPROCESSOR_MODE;
|
||||
typedef UCHAR KIRQL;
|
||||
typedef KIRQL* PKIRQL;
|
||||
typedef ULONG IO_ALLOCATION_ACTION;
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
See the file COPYING for copying permission.
|
||||
*/
|
||||
|
||||
#ifndef XmlParse_INCLUDED
|
||||
#define XmlParse_INCLUDED 1
|
||||
#ifndef Expat_INCLUDED
|
||||
#define Expat_INCLUDED 1
|
||||
|
||||
#ifdef __VMS
|
||||
/* 0 1 2 3 0 1 2 3
|
||||
@@ -15,98 +15,15 @@
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#if defined(_MSC_EXTENSIONS) && !defined(__BEOS__) && !defined(__CYGWIN__)
|
||||
#define XML_USE_MSC_EXTENSIONS 1
|
||||
#endif
|
||||
|
||||
/* Expat tries very hard to make the API boundary very specifically
|
||||
defined. There are two macros defined to control this boundary;
|
||||
each of these can be defined before including this header to
|
||||
achieve some different behavior, but doing so it not recommended or
|
||||
tested frequently.
|
||||
|
||||
XMLCALL - The calling convention to use for all calls across the
|
||||
"library boundary." This will default to cdecl, and
|
||||
try really hard to tell the compiler that's what we
|
||||
want.
|
||||
|
||||
XMLIMPORT - Whatever magic is needed to note that a function is
|
||||
to be imported from a dynamically loaded library
|
||||
(.dll, .so, or .sl, depending on your platform).
|
||||
|
||||
The XMLCALL macro was added in Expat 1.95.7. The only one which is
|
||||
expected to be directly useful in client code is XMLCALL.
|
||||
|
||||
Note that on at least some Unix versions, the Expat library must be
|
||||
compiled with the cdecl calling convention as the default since
|
||||
system headers may assume the cdecl convention.
|
||||
*/
|
||||
#ifndef XMLCALL
|
||||
#if defined(XML_USE_MSC_EXTENSIONS)
|
||||
#define XMLCALL __cdecl
|
||||
#elif defined(__GNUC__) && defined(__i386)
|
||||
//MF#define XMLCALL __attribute__((cdecl))
|
||||
#define XMLCALL//MF
|
||||
#else
|
||||
/* For any platform which uses this definition and supports more than
|
||||
one calling convention, we need to extend this definition to
|
||||
declare the convention used on that platform, if it's possible to
|
||||
do so.
|
||||
|
||||
If this is the case for your platform, please file a bug report
|
||||
with information on how to identify your platform via the C
|
||||
pre-processor and how to specify the same calling convention as the
|
||||
platform's malloc() implementation.
|
||||
*/
|
||||
#define XMLCALL
|
||||
#endif
|
||||
#endif /* not defined XMLCALL */
|
||||
|
||||
|
||||
#if !defined(XML_STATIC) && !defined(XMLIMPORT)
|
||||
#ifndef XML_BUILDING_EXPAT
|
||||
/* using Expat from an application */
|
||||
|
||||
#ifdef XML_USE_MSC_EXTENSIONS
|
||||
#define XMLIMPORT __declspec(dllimport)
|
||||
#endif
|
||||
|
||||
#endif
|
||||
#endif /* not defined XML_STATIC */
|
||||
|
||||
/* If we didn't define it above, define it away: */
|
||||
#ifndef XMLIMPORT
|
||||
#define XMLIMPORT
|
||||
#endif
|
||||
|
||||
|
||||
#define XMLPARSEAPI(type) XMLIMPORT type XMLCALL
|
||||
#include "expat_external.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifdef XML_UNICODE_WCHAR_T
|
||||
#define XML_UNICODE
|
||||
#endif
|
||||
|
||||
struct XML_ParserStruct;
|
||||
typedef struct XML_ParserStruct *XML_Parser;
|
||||
|
||||
#ifdef XML_UNICODE /* Information is UTF-16 encoded. */
|
||||
#ifdef XML_UNICODE_WCHAR_T
|
||||
typedef wchar_t XML_Char;
|
||||
typedef wchar_t XML_LChar;
|
||||
#else
|
||||
typedef unsigned short XML_Char;
|
||||
typedef char XML_LChar;
|
||||
#endif /* XML_UNICODE_WCHAR_T */
|
||||
#else /* Information is UTF-8 encoded. */
|
||||
typedef char XML_Char;
|
||||
typedef char XML_LChar;
|
||||
#endif /* XML_UNICODE */
|
||||
|
||||
/* Should this be defined using stdbool.h when C99 is available? */
|
||||
typedef unsigned char XML_Bool;
|
||||
#define XML_TRUE ((XML_Bool) 1)
|
||||
@@ -130,7 +47,7 @@ enum XML_Status {
|
||||
#define XML_STATUS_ERROR XML_STATUS_ERROR
|
||||
XML_STATUS_OK = 1,
|
||||
#define XML_STATUS_OK XML_STATUS_OK
|
||||
XML_STATUS_SUSPENDED = 2,
|
||||
XML_STATUS_SUSPENDED = 2
|
||||
#define XML_STATUS_SUSPENDED XML_STATUS_SUSPENDED
|
||||
};
|
||||
|
||||
@@ -162,12 +79,23 @@ enum XML_Error {
|
||||
XML_ERROR_ENTITY_DECLARED_IN_PE,
|
||||
XML_ERROR_FEATURE_REQUIRES_XML_DTD,
|
||||
XML_ERROR_CANT_CHANGE_FEATURE_ONCE_PARSING,
|
||||
/* Added in 1.95.7. */
|
||||
XML_ERROR_UNBOUND_PREFIX,
|
||||
/* Added in 1.95.8. */
|
||||
XML_ERROR_UNDECLARING_PREFIX,
|
||||
XML_ERROR_INCOMPLETE_PE,
|
||||
XML_ERROR_XML_DECL,
|
||||
XML_ERROR_TEXT_DECL,
|
||||
XML_ERROR_PUBLICID,
|
||||
XML_ERROR_SUSPENDED,
|
||||
XML_ERROR_NOT_SUSPENDED,
|
||||
XML_ERROR_ABORTED,
|
||||
XML_ERROR_FINISHED,
|
||||
XML_ERROR_SUSPEND_PE
|
||||
XML_ERROR_SUSPEND_PE,
|
||||
/* Added in 2.0. */
|
||||
XML_ERROR_RESERVED_PREFIX_XML,
|
||||
XML_ERROR_RESERVED_PREFIX_XMLNS,
|
||||
XML_ERROR_RESERVED_NAMESPACE_URI
|
||||
};
|
||||
|
||||
enum XML_Content_Type {
|
||||
@@ -266,9 +194,9 @@ XML_SetXmlDeclHandler(XML_Parser parser,
|
||||
|
||||
|
||||
typedef struct {
|
||||
void *(XMLCALL *malloc_fcn)(size_t size);
|
||||
void *(XMLCALL *realloc_fcn)(void *ptr, size_t size);
|
||||
void (XMLCALL *free_fcn)(void *ptr);
|
||||
void *(*malloc_fcn)(size_t size);
|
||||
void *(*realloc_fcn)(void *ptr, size_t size);
|
||||
void (*free_fcn)(void *ptr);
|
||||
} XML_Memory_Handling_Suite;
|
||||
|
||||
/* Constructs a new parser; encoding is the encoding specified by the
|
||||
@@ -285,8 +213,8 @@ XML_ParserCreate(const XML_Char *encoding);
|
||||
URI, the namespace separator character, and the local part of the
|
||||
name. If the namespace separator is '\0' then the namespace URI
|
||||
and the local part will be concatenated without any separator.
|
||||
When a namespace is not declared, the name and prefix will be
|
||||
passed through without expansion.
|
||||
It is a programming error to use the separator '\0' with namespace
|
||||
triplets (see XML_SetReturnNSTriplet).
|
||||
*/
|
||||
XMLPARSEAPI(XML_Parser)
|
||||
XML_ParserCreateNS(const XML_Char *encoding, XML_Char namespaceSeparator);
|
||||
@@ -766,6 +694,9 @@ XML_UseParserAsHandlerArg(XML_Parser parser);
|
||||
specified in the document. In such a case the parser will call the
|
||||
externalEntityRefHandler with a value of NULL for the systemId
|
||||
argument (the publicId and context arguments will be NULL as well).
|
||||
Note: For the purpose of checking WFC: Entity Declared, passing
|
||||
useDTD == XML_TRUE will make the parser behave as if the document
|
||||
had a DTD with an external subset.
|
||||
Note: If this function is called, then this must be done before
|
||||
the first call to XML_Parse or XML_ParseBuffer, since it will
|
||||
have no effect after that. Returns
|
||||
@@ -1051,7 +982,8 @@ enum XML_FeatureEnum {
|
||||
XML_FEATURE_CONTEXT_BYTES,
|
||||
XML_FEATURE_MIN_SIZE,
|
||||
XML_FEATURE_SIZEOF_XML_CHAR,
|
||||
XML_FEATURE_SIZEOF_XML_LCHAR
|
||||
XML_FEATURE_SIZEOF_XML_LCHAR,
|
||||
XML_FEATURE_NS
|
||||
/* Additional features must be added to the end of this enum. */
|
||||
};
|
||||
|
||||
@@ -1078,4 +1010,4 @@ XML_GetFeatureList(void);
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* not XmlParse_INCLUDED */
|
||||
#endif /* not Expat_INCLUDED */
|
||||
@@ -0,0 +1,101 @@
|
||||
/* Copyright (c) 1998, 1999, 2000 Thai Open Source Software Center Ltd
|
||||
See the file COPYING for copying permission.
|
||||
*/
|
||||
|
||||
#ifndef Expat_External_INCLUDED
|
||||
#define Expat_External_INCLUDED 1
|
||||
|
||||
/* External API definitions */
|
||||
|
||||
#if defined(_MSC_EXTENSIONS) && !defined(__BEOS__) && !defined(__CYGWIN__)
|
||||
#define XML_USE_MSC_EXTENSIONS 1
|
||||
#endif
|
||||
|
||||
/* Expat tries very hard to make the API boundary very specifically
|
||||
defined. There are two macros defined to control this boundary;
|
||||
each of these can be defined before including this header to
|
||||
achieve some different behavior, but doing so it not recommended or
|
||||
tested frequently.
|
||||
|
||||
XMLCALL - The calling convention to use for all calls across the
|
||||
"library boundary." This will default to cdecl, and
|
||||
try really hard to tell the compiler that's what we
|
||||
want.
|
||||
|
||||
XMLIMPORT - Whatever magic is needed to note that a function is
|
||||
to be imported from a dynamically loaded library
|
||||
(.dll, .so, or .sl, depending on your platform).
|
||||
|
||||
The XMLCALL macro was added in Expat 1.95.7. The only one which is
|
||||
expected to be directly useful in client code is XMLCALL.
|
||||
|
||||
Note that on at least some Unix versions, the Expat library must be
|
||||
compiled with the cdecl calling convention as the default since
|
||||
system headers may assume the cdecl convention.
|
||||
*/
|
||||
#ifndef XMLCALL
|
||||
#if defined(XML_USE_MSC_EXTENSIONS)
|
||||
#define XMLCALL __cdecl
|
||||
#elif defined(__GNUC__) && defined(__i386)
|
||||
#define XMLCALL __attribute__((cdecl))
|
||||
#else
|
||||
/* For any platform which uses this definition and supports more than
|
||||
one calling convention, we need to extend this definition to
|
||||
declare the convention used on that platform, if it's possible to
|
||||
do so.
|
||||
|
||||
If this is the case for your platform, please file a bug report
|
||||
with information on how to identify your platform via the C
|
||||
pre-processor and how to specify the same calling convention as the
|
||||
platform's malloc() implementation.
|
||||
*/
|
||||
#define XMLCALL
|
||||
#endif
|
||||
#endif /* not defined XMLCALL */
|
||||
|
||||
|
||||
#if !defined(XML_STATIC) && !defined(XMLIMPORT)
|
||||
#ifndef XML_BUILDING_EXPAT
|
||||
/* using Expat from an application */
|
||||
|
||||
#ifdef XML_USE_MSC_EXTENSIONS
|
||||
#define XMLIMPORT __declspec(dllimport)
|
||||
#endif
|
||||
|
||||
#endif
|
||||
#endif /* not defined XML_STATIC */
|
||||
|
||||
/* If we didn't define it above, define it away: */
|
||||
#ifndef XMLIMPORT
|
||||
#define XMLIMPORT
|
||||
#endif
|
||||
|
||||
|
||||
#define XMLPARSEAPI(type) XMLIMPORT type XMLCALL
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifdef XML_UNICODE_WCHAR_T
|
||||
#define XML_UNICODE
|
||||
#endif
|
||||
|
||||
#ifdef XML_UNICODE /* Information is UTF-16 encoded. */
|
||||
#ifdef XML_UNICODE_WCHAR_T
|
||||
typedef wchar_t XML_Char;
|
||||
typedef wchar_t XML_LChar;
|
||||
#else
|
||||
typedef unsigned short XML_Char;
|
||||
typedef char XML_LChar;
|
||||
#endif /* XML_UNICODE_WCHAR_T */
|
||||
#else /* Information is UTF-8 encoded. */
|
||||
typedef char XML_Char;
|
||||
typedef char XML_LChar;
|
||||
#endif /* XML_UNICODE */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* not Expat_External_INCLUDED */
|
||||
@@ -0,0 +1,8 @@
|
||||
|
||||
#ifndef __LSASRV_H
|
||||
#define __LSASRV_H
|
||||
|
||||
NTSTATUS STDCALL
|
||||
LsapInitLsa(VOID);
|
||||
|
||||
#endif /* __LSASRV_H */
|
||||
@@ -1,86 +0,0 @@
|
||||
/*
|
||||
* alloc.h
|
||||
*
|
||||
* Memory management functions. Because most of these functions are
|
||||
* actually declared in stdlib.h I have decided to simply include that
|
||||
* header file. This file is included by malloc.h. My head hurts...
|
||||
*
|
||||
* NOTE: In the version of the Standard C++ Library from Cygnus there
|
||||
* is also an alloc.h which needs to be on your include path. Most of
|
||||
* the time I think the most sensible option would be to get rid of
|
||||
* this file.
|
||||
*
|
||||
* This file is part of the Mingw32 package.
|
||||
*
|
||||
* Contributors:
|
||||
* Created by Colin Peters <colin@bird.fu.is.saga-u.ac.jp>
|
||||
*
|
||||
* THIS SOFTWARE IS NOT COPYRIGHTED
|
||||
*
|
||||
* This source code is offered for use in the public domain. You may
|
||||
* use, modify or distribute it freely.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful but
|
||||
* WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
|
||||
* DISCLAIMED. This includes but is not limited to warranties of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* $Revision: 1.5 $
|
||||
* $Author$
|
||||
* $Date$
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __STRICT_ANSI__
|
||||
|
||||
#ifndef _ALLOC_H_
|
||||
#define _ALLOC_H_
|
||||
|
||||
#include <msvcrt/stdlib.h>
|
||||
|
||||
#ifndef RC_INVOKED
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* The structure used to walk through the heap with _heapwalk.
|
||||
* TODO: This is a guess at the internals of this structure.
|
||||
*/
|
||||
typedef struct _heapinfo
|
||||
{
|
||||
void* ptr;
|
||||
unsigned int size;
|
||||
int in_use;
|
||||
} _HEAPINFO;
|
||||
|
||||
int _heapwalk(_HEAPINFO* pHeapinfo);
|
||||
|
||||
#ifdef __GNUC__
|
||||
#ifdef USE_C_ALLOCA
|
||||
void* C_alloca(size_t size);
|
||||
#define _alloca(x) C_alloca(x)
|
||||
#else /* USE_C_ALLOCA */
|
||||
#define _alloca(x) __builtin_alloca(x)
|
||||
#endif /* USE_C_ALLOCA */
|
||||
#else /* __GNUC__ */
|
||||
void* _alloca(size_t size);
|
||||
#endif /* __GNUC__ */
|
||||
|
||||
|
||||
#ifndef _NO_OLDNAMES
|
||||
#define heapwalk(x) _heapwalk(x)
|
||||
#define alloca(s) _alloca(s)
|
||||
#endif /* Not _NO_OLDNAMES */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* Not RC_INVOKED */
|
||||
|
||||
#endif /* Not _ALLOC_H_ */
|
||||
|
||||
#endif /* Not __STRICT_ANSI__ */
|
||||
|
||||
@@ -1,69 +0,0 @@
|
||||
/*
|
||||
* assert.h
|
||||
*
|
||||
* Define the assert macro for debug output.
|
||||
*
|
||||
* This file is part of the Mingw32 package.
|
||||
*
|
||||
* Contributors:
|
||||
* Created by Colin Peters <colin@bird.fu.is.saga-u.ac.jp>
|
||||
*
|
||||
* THIS SOFTWARE IS NOT COPYRIGHTED
|
||||
*
|
||||
* This source code is offered for use in the public domain. You may
|
||||
* use, modify or distribute it freely.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful but
|
||||
* WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
|
||||
* DISCLAIMED. This includes but is not limited to warranties of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* $Revision: 1.4 $
|
||||
* $Author$
|
||||
* $Date$
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _ASSERT_H_
|
||||
#define _ASSERT_H_
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifdef NDEBUG
|
||||
|
||||
/*
|
||||
* If not debugging, assert does nothing.
|
||||
*/
|
||||
#define assert(x) ((void)0)
|
||||
|
||||
#else /* debugging enabled */
|
||||
|
||||
/*
|
||||
* CRTDLL nicely supplies a function which does the actual output and
|
||||
* call to abort.
|
||||
*/
|
||||
#ifndef __ATTRIB_NORETURN
|
||||
#ifdef __GNUC__
|
||||
#define _ATTRIB_NORETURN __attribute__ ((noreturn))
|
||||
#else /* Not __GNUC__ */
|
||||
#define _ATTRIB_NORETURN
|
||||
#endif /* __GNUC__ */
|
||||
#endif
|
||||
|
||||
void _assert(const char* szExpression, const char* szFileName, int nLine) _ATTRIB_NORETURN;
|
||||
|
||||
/*
|
||||
* Definition of the assert macro.
|
||||
*/
|
||||
#define assert(x) if(!(x)) _assert( #x , __FILE__, __LINE__);
|
||||
#endif /* NDEBUG */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* Not _ASSERT_H_ */
|
||||
|
||||
@@ -1,63 +0,0 @@
|
||||
/*
|
||||
* conio.h
|
||||
*
|
||||
* Low level console I/O functions. Pretty please try to use the ANSI
|
||||
* standard ones if you are writing new code.
|
||||
*
|
||||
* This file is part of the Mingw32 package.
|
||||
*
|
||||
* Contributors:
|
||||
* Created by Colin Peters <colin@bird.fu.is.saga-u.ac.jp>
|
||||
*
|
||||
* THIS SOFTWARE IS NOT COPYRIGHTED
|
||||
*
|
||||
* This source code is offered for use in the public domain. You may
|
||||
* use, modify or distribute it freely.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful but
|
||||
* WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
|
||||
* DISCLAIMED. This includes but is not limited to warranties of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* $Revision: 1.4 $
|
||||
* $Author$
|
||||
* $Date$
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __STRICT_ANSI__
|
||||
|
||||
#ifndef _CONIO_H_
|
||||
#define _CONIO_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
char* _cgets(char*);
|
||||
int _cprintf(const char*, ...);
|
||||
int _cputs(const char*);
|
||||
int _cscanf(char*, ...);
|
||||
int _getch(void);
|
||||
int _getche(void);
|
||||
int _kbhit(void);
|
||||
int _putch(int);
|
||||
int _ungetch(int);
|
||||
|
||||
#ifndef _NO_OLDNAMES
|
||||
#define getch _getch
|
||||
#define getche _getche
|
||||
#define kbhit _kbhit
|
||||
#define putch(cPut) _putch(cPut)
|
||||
#define ungetch(cUnget) _ungetch(cUnget)
|
||||
#endif /* Not _NO_OLDNAMES */
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* Not _CONIO_H_ */
|
||||
|
||||
#endif /* Not __STRICT_ANSI__ */
|
||||
@@ -1,146 +0,0 @@
|
||||
/*
|
||||
* ctype.h
|
||||
*
|
||||
* Functions for testing character types and converting characters.
|
||||
*
|
||||
* This file is part of the Mingw32 package.
|
||||
*
|
||||
* Contributors:
|
||||
* Created by Colin Peters <colin@bird.fu.is.saga-u.ac.jp>
|
||||
*
|
||||
* THIS SOFTWARE IS NOT COPYRIGHTED
|
||||
*
|
||||
* This source code is offered for use in the public domain. You may
|
||||
* use, modify or distribute it freely.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful but
|
||||
* WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
|
||||
* DISCLAIMED. This includes but is not limited to warranties of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* $Revision: 1.10 $
|
||||
* $Author$
|
||||
* $Date$
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _CTYPE_H_
|
||||
#define _CTYPE_H_
|
||||
|
||||
#define __need_wchar_t
|
||||
#define __need_wint_t
|
||||
#include <msvcrt/stddef.h>
|
||||
|
||||
|
||||
/*
|
||||
* The following flags are used to tell iswctype and _isctype what character
|
||||
* types you are looking for.
|
||||
*/
|
||||
#define _UPPER 0x0001
|
||||
#define _LOWER 0x0002
|
||||
#define _DIGIT 0x0004
|
||||
#define _SPACE 0x0008 /* HT LF VT FF CR SP */
|
||||
#define _PUNCT 0x0010
|
||||
#define _CONTROL 0x0020
|
||||
#define _BLANK 0x0040 /* this is SP only, not SP and HT as in C99 */
|
||||
#define _HEX 0x0080
|
||||
#define _LEADBYTE 0x8000
|
||||
|
||||
#define _ALPHA 0x0103
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
int isalnum(int);
|
||||
int isalpha(int);
|
||||
int iscntrl(int);
|
||||
int isdigit(int);
|
||||
int isgraph(int);
|
||||
int islower(int);
|
||||
int isprint(int);
|
||||
int ispunct(int);
|
||||
int isspace(int);
|
||||
int isupper(int);
|
||||
int isxdigit(int);
|
||||
|
||||
#ifndef __STRICT_ANSI__
|
||||
int _isctype (unsigned int, int);
|
||||
#endif
|
||||
|
||||
/* These are the ANSI versions, with correct checking of argument */
|
||||
int tolower(int);
|
||||
int toupper(int);
|
||||
|
||||
/*
|
||||
* NOTE: The above are not old name type wrappers, but functions exported
|
||||
* explicitly by MSVCRT/CRTDLL. However, underscored versions are also
|
||||
* exported.
|
||||
*/
|
||||
#ifndef __STRICT_ANSI__
|
||||
/*
|
||||
* These are the cheap non-std versions: The return values are undefined
|
||||
* if the argument is not ASCII char or is not of appropriate case
|
||||
*/
|
||||
int _tolower(int);
|
||||
int _toupper(int);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* TODO: MB_CUR_MAX should be defined here (if not already defined, since
|
||||
* it should also be defined in stdlib.h). It is supposed to be the
|
||||
* maximum number of bytes in a multi-byte character in the current
|
||||
* locale. Perhaps accessible through the __mb_curr_max_dll entry point,
|
||||
* but I think (again) that that is a variable pointer, which leads to
|
||||
* problems under the current Cygwin compiler distribution.
|
||||
*/
|
||||
|
||||
typedef int wctype_t;
|
||||
|
||||
|
||||
/* Wide character equivalents */
|
||||
#ifndef WEOF
|
||||
#define WEOF (wchar_t)(0xFFFF)
|
||||
#endif
|
||||
|
||||
int iswalnum(wint_t);
|
||||
int iswalpha(wint_t);
|
||||
int iswascii(wint_t);
|
||||
int iswcntrl(wint_t);
|
||||
int iswctype(wint_t, wctype_t);
|
||||
int is_wctype(wint_t, wctype_t); /* Obsolete! */
|
||||
int iswdigit(wint_t);
|
||||
int iswgraph(wint_t);
|
||||
int iswlower(wint_t);
|
||||
int iswprint(wint_t);
|
||||
int iswpunct(wint_t);
|
||||
int iswspace(wint_t);
|
||||
int iswupper(wint_t);
|
||||
int iswxdigit(wint_t);
|
||||
|
||||
wchar_t towlower(wchar_t);
|
||||
wchar_t towupper(wchar_t);
|
||||
|
||||
int isleadbyte(int);
|
||||
|
||||
#ifndef __STRICT_ANSI__
|
||||
int __isascii(int);
|
||||
int __toascii(int);
|
||||
int __iscsymf(int); /* Valid first character in C symbol */
|
||||
int __iscsym(int); /* Valid character in C symbol (after first) */
|
||||
|
||||
#ifndef _NO_OLDNAMES
|
||||
#define isascii(c) __isascii(c)
|
||||
#define toascii(c) _toascii(c)
|
||||
#define iscsymf(c) __iscsymf(c)
|
||||
#define iscsym(c) __iscsym(c)
|
||||
#endif /* Not _NO_OLDNAMES */
|
||||
|
||||
#endif /* Not __STRICT_ANSI__ */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* Not _CTYPE_H_ */
|
||||
@@ -1,149 +0,0 @@
|
||||
/*
|
||||
* dir.h
|
||||
*
|
||||
* Functions for working with directories and path names.
|
||||
* This file OBSOLESCENT and only provided for backward compatibility.
|
||||
* Please use io.h instead.
|
||||
*
|
||||
* This file is part of the Mingw32 package.
|
||||
*
|
||||
* Contributors:
|
||||
* Created by Colin Peters <colin@bird.fu.is.saga-u.ac.jp>
|
||||
*
|
||||
* THIS SOFTWARE IS NOT COPYRIGHTED
|
||||
*
|
||||
* This source code is offered for use in the public domain. You may
|
||||
* use, modify or distribute it freely.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful but
|
||||
* WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
|
||||
* DISCLAIMED. This includes but is not limited to warranties of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* $Revision: 1.6 $
|
||||
* $Author$
|
||||
* $Date$
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __STRICT_ANSI__
|
||||
|
||||
#ifndef _DIR_H_
|
||||
#define _DIR_H_
|
||||
|
||||
#include <msvcrt/stdio.h> /* To get FILENAME_MAX... ugly. */
|
||||
#include <msvcrt/sys/types.h> /* To get time_t. */
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Attributes of files as returned by _findfirst et al.
|
||||
*/
|
||||
#define _A_NORMAL 0x00000000
|
||||
#define _A_RDONLY 0x00000001
|
||||
#define _A_HIDDEN 0x00000002
|
||||
#define _A_SYSTEM 0x00000004
|
||||
#define _A_VOLID 0x00000008
|
||||
#define _A_SUBDIR 0x00000010
|
||||
#define _A_ARCH 0x00000020
|
||||
|
||||
#ifndef _FSIZE_T_DEFINED
|
||||
typedef unsigned long _fsize_t;
|
||||
#define _FSIZE_T_DEFINED
|
||||
#endif
|
||||
|
||||
/*
|
||||
* The following structures are filled in by _findfirst or _findnext when
|
||||
* they succeed in finding a match.
|
||||
*/
|
||||
struct _finddata_t
|
||||
{
|
||||
unsigned attrib; /* Attributes, see constants above. */
|
||||
time_t time_create;
|
||||
time_t time_access; /* always midnight local time */
|
||||
time_t time_write;
|
||||
_fsize_t size;
|
||||
char name[FILENAME_MAX]; /* may include spaces. */
|
||||
};
|
||||
|
||||
struct _finddatai64_t
|
||||
{
|
||||
unsigned attrib; /* Attributes, see constants above. */
|
||||
time_t time_create;
|
||||
time_t time_access; /* always midnight local time */
|
||||
time_t time_write;
|
||||
__int64 size;
|
||||
char name[FILENAME_MAX]; /* may include spaces. */
|
||||
};
|
||||
|
||||
struct _wfinddata_t
|
||||
{
|
||||
unsigned attrib; /* Attributes, see constants above. */
|
||||
time_t time_create;
|
||||
time_t time_access; /* always midnight local time */
|
||||
time_t time_write;
|
||||
_fsize_t size;
|
||||
wchar_t name[FILENAME_MAX]; /* may include spaces. */
|
||||
};
|
||||
|
||||
struct _wfinddatai64_t
|
||||
{
|
||||
unsigned attrib; /* Attributes, see constants above. */
|
||||
time_t time_create;
|
||||
time_t time_access; /* always midnight local time */
|
||||
time_t time_write;
|
||||
__int64 size;
|
||||
wchar_t name[FILENAME_MAX]; /* may include spaces. */
|
||||
};
|
||||
|
||||
/*
|
||||
* Functions for searching for files. _findfirst returns -1 if no match
|
||||
* is found. Otherwise it returns a handle to be used in _findnext and
|
||||
* _findclose calls. _findnext also returns -1 if no match could be found,
|
||||
* and 0 if a match was found. Call _findclose when you are finished.
|
||||
*/
|
||||
int _findclose(int nHandle);
|
||||
int _findfirst(const char* szFilespec, struct _finddata_t* find);
|
||||
int _findnext(int nHandle, struct _finddata_t* find);
|
||||
int _findfirsti64(const char* szFilespec, struct _finddatai64_t* find);
|
||||
int _findnexti64(int nHandle, struct _finddatai64_t* find);
|
||||
/* Wide character versions */
|
||||
int _wfindfirst(const wchar_t *_name, struct _wfinddata_t *result);
|
||||
int _wfindfirsti64(const wchar_t *_name, struct _wfinddatai64_t *result);
|
||||
int _wfindnext(int handle, struct _wfinddata_t *result);
|
||||
int _wfindnexti64(int handle, struct _wfinddatai64_t *result);
|
||||
|
||||
int _chdir(const char* szPath);
|
||||
char* _getcwd(char* caBuffer, int nBufferSize);
|
||||
int _mkdir(const char* szPath);
|
||||
char* _mktemp(char* szTemplate);
|
||||
int _rmdir(const char* szPath);
|
||||
|
||||
/* Wide character versions */
|
||||
int _wchdir(const wchar_t *szPath);
|
||||
wchar_t* _wgetcwd(wchar_t *buffer, int maxlen);
|
||||
int _wmkdir(const wchar_t *_path);
|
||||
wchar_t* _wmktemp(wchar_t *_template);
|
||||
int _wrmdir(const wchar_t *_path);
|
||||
|
||||
|
||||
#ifndef _NO_OLDNAMES
|
||||
|
||||
int chdir(const char* szPath);
|
||||
char* getcwd(char* caBuffer, int nBufferSize);
|
||||
int mkdir(const char* szPath);
|
||||
char* mktemp(char* szTemplate);
|
||||
int rmdir(const char* szPath);
|
||||
|
||||
#endif /* Not _NO_OLDNAMES */
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* Not _DIR_H_ */
|
||||
|
||||
#endif /* Not __STRICT_ANSI__ */
|
||||
@@ -1,81 +0,0 @@
|
||||
/*
|
||||
* direct.h
|
||||
*
|
||||
* Functions for manipulating paths and directories (included from io.h)
|
||||
* plus functions for setting the current drive.
|
||||
*
|
||||
* This file is part of the Mingw32 package.
|
||||
*
|
||||
* Contributors:
|
||||
* Created by Colin Peters <colin@bird.fu.is.saga-u.ac.jp>
|
||||
*
|
||||
* THIS SOFTWARE IS NOT COPYRIGHTED
|
||||
*
|
||||
* This source code is offered for use in the public domain. You may
|
||||
* use, modify or distribute it freely.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful but
|
||||
* WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
|
||||
* DISCLAIMED. This includes but is not limited to warranties of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* $Revision: 1.4 $
|
||||
* $Author$
|
||||
* $Date$
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _DIRECT_H_
|
||||
#define _DIRECT_H_
|
||||
|
||||
#ifndef _WCHAR_T_
|
||||
typedef unsigned short wchar_t;
|
||||
#define _WCHAR_T_
|
||||
#endif
|
||||
|
||||
#ifndef _SIZE_T_
|
||||
typedef unsigned int size_t;
|
||||
#define _SIZE_T_
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct _diskfree_t {
|
||||
unsigned short total_clusters;
|
||||
unsigned short avail_clusters;
|
||||
unsigned short sectors_per_cluster;
|
||||
unsigned short bytes_per_sector;
|
||||
};
|
||||
|
||||
int _getdrive(void);
|
||||
int _chdrive(int);
|
||||
char* _getcwd(char*, int);
|
||||
|
||||
unsigned int _getdiskfree(unsigned int, struct _diskfree_t*);
|
||||
|
||||
int _chdir(const char*);
|
||||
int _mkdir(const char*);
|
||||
int _rmdir(const char*);
|
||||
|
||||
#define chdir _chdir
|
||||
#define getcwd _getcwd
|
||||
#define mkdir _mkdir
|
||||
#define rmdir _rmdir
|
||||
|
||||
char* _getdcwd(int nDrive, char* caBuffer, int nBufLen);
|
||||
|
||||
wchar_t* _wgetcwd(wchar_t *buffer, int maxlen);
|
||||
wchar_t* _wgetdcwd(int nDrive, wchar_t* caBuffer, int nBufLen);
|
||||
|
||||
int _wchdir(const wchar_t* _path);
|
||||
int _wmkdir(const wchar_t* _path);
|
||||
int _wrmdir(const wchar_t* _path);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* Not _DIRECT_H_ */
|
||||
|
||||
@@ -1,120 +0,0 @@
|
||||
/*
|
||||
* errno.h
|
||||
*
|
||||
* Error numbers and access to error reporting.
|
||||
*
|
||||
* This file is part of the Mingw32 package.
|
||||
*
|
||||
* Contributors:
|
||||
* Created by Colin Peters <colin@bird.fu.is.saga-u.ac.jp>
|
||||
*
|
||||
* THIS SOFTWARE IS NOT COPYRIGHTED
|
||||
*
|
||||
* This source code is offered for use in the public domain. You may
|
||||
* use, modify or distribute it freely.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful but
|
||||
* WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
|
||||
* DISCLAIMED. This includes but is not limited to warranties of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* $Revision: 1.7 $
|
||||
* $Author$
|
||||
* $Date$
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _ERRNO_H_
|
||||
#define _ERRNO_H_
|
||||
|
||||
/*
|
||||
* Error numbers.
|
||||
* TODO: Can't be sure of some of these assignments, I guessed from the
|
||||
* names given by strerror and the defines in the Cygnus errno.h. A lot
|
||||
* of the names from the Cygnus errno.h are not represented, and a few
|
||||
* of the descriptions returned by strerror do not obviously match
|
||||
* their error naming.
|
||||
*/
|
||||
#define EPERM 1 /* Operation not permitted */
|
||||
#define ENOFILE 2 /* No such file or directory */
|
||||
#define ENOENT 2
|
||||
#define ESRCH 3 /* No such process */
|
||||
#define EINTR 4 /* Interrupted function call */
|
||||
#define EIO 5 /* Input/output error */
|
||||
#define ENXIO 6 /* No such device or address */
|
||||
#define E2BIG 7 /* Arg list too long */
|
||||
#define ENOEXEC 8 /* Exec format error */
|
||||
#define EBADF 9 /* Bad file descriptor */
|
||||
#define ECHILD 10 /* No child processes */
|
||||
#define EAGAIN 11 /* Resource temporarily unavailable */
|
||||
#define ENOMEM 12 /* Not enough space */
|
||||
#define EACCES 13 /* Permission denied */
|
||||
#define EFAULT 14 /* Bad address */
|
||||
/* 15 - Unknown Error */
|
||||
#define EBUSY 16 /* strerror reports "Resource device" */
|
||||
#define EEXIST 17 /* File exists */
|
||||
#define EXDEV 18 /* Improper link (cross-device link?) */
|
||||
#define ENODEV 19 /* No such device */
|
||||
#define ENOTDIR 20 /* Not a directory */
|
||||
#define EISDIR 21 /* Is a directory */
|
||||
#define EINVAL 22 /* Invalid argument */
|
||||
#define ENFILE 23 /* Too many open files in system */
|
||||
#define EMFILE 24 /* Too many open files */
|
||||
#define ENOTTY 25 /* Inappropriate I/O control operation */
|
||||
/* 26 - Unknown Error */
|
||||
#define EFBIG 27 /* File too large */
|
||||
#define ENOSPC 28 /* No space left on device */
|
||||
#define ESPIPE 29 /* Invalid seek (seek on a pipe?) */
|
||||
#define EROFS 30 /* Read-only file system */
|
||||
#define EMLINK 31 /* Too many links */
|
||||
#define EPIPE 32 /* Broken pipe */
|
||||
#define EDOM 33 /* Domain error (math functions) */
|
||||
#define ERANGE 34 /* Result too large (possibly too small) */
|
||||
/* 35 - Unknown Error */
|
||||
#define EDEADLOCK 36 /* Resource deadlock avoided (non-Cyg) */
|
||||
#define EDEADLK 36
|
||||
/* 37 - Unknown Error */
|
||||
#define ENAMETOOLONG 38 /* Filename too long (91 in Cyg?) */
|
||||
#define ENOLCK 39 /* No locks available (46 in Cyg?) */
|
||||
#define ENOSYS 40 /* Function not implemented (88 in Cyg?) */
|
||||
#define ENOTEMPTY 41 /* Directory not empty (90 in Cyg?) */
|
||||
#define EILSEQ 42 /* Illegal byte sequence */
|
||||
|
||||
/*
|
||||
* NOTE: ENAMETOOLONG and ENOTEMPTY conflict with definitions in the
|
||||
* sockets.h header provided with windows32api-0.1.2.
|
||||
* You should go and put an #if 0 ... #endif around the whole block
|
||||
* of errors (look at the comment above them).
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Definitions of macros for the 'variables' errno, _doserrno, sys_nerr and
|
||||
* sys_errlist.
|
||||
*/
|
||||
int* _errno(void);
|
||||
#define errno (*_errno())
|
||||
|
||||
int* __doserrno(void);
|
||||
#define _doserrno (*__doserrno())
|
||||
|
||||
/* One of the MSVCRTxx libraries */
|
||||
|
||||
extern int* __imp__sys_nerr;
|
||||
#ifndef sys_nerr
|
||||
#define sys_nerr (*__imp__sys_nerr)
|
||||
#endif
|
||||
|
||||
extern char** __imp__sys_errlist;
|
||||
#ifndef sys_errlist
|
||||
#define sys_errlist (__imp__sys_errlist)
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* Not _ERRNO_H_ */
|
||||
@@ -1,130 +0,0 @@
|
||||
/*
|
||||
* fcntl.h
|
||||
*
|
||||
* Access constants for _open. Note that the permissions constants are
|
||||
* in sys/stat.h (ick).
|
||||
*
|
||||
* This code is part of the Mingw32 package.
|
||||
*
|
||||
* Contributors:
|
||||
* Created by Colin Peters <colin@bird.fu.is.saga-u.ac.jp>
|
||||
*
|
||||
* THIS SOFTWARE IS NOT COPYRIGHTED
|
||||
*
|
||||
* This source code is offered for use in the public domain. You may
|
||||
* use, modify or distribute it freely.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful but
|
||||
* WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
|
||||
* DISCLAIMED. This includes but is not limited to warranties of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* $Revision: 1.6 $
|
||||
* $Author$
|
||||
* $Date$
|
||||
*
|
||||
*/
|
||||
/* Appropriated for Reactos Crtdll by Ariadne */
|
||||
/* added _O_RANDOM_O_SEQUENTIAL _O_SHORT_LIVED*/
|
||||
/* changed fmode_dll */
|
||||
|
||||
#ifndef _FCNTL_H_
|
||||
#define _FCNTL_H_
|
||||
|
||||
/*
|
||||
* It appears that fcntl.h should include io.h for compatibility...
|
||||
*/
|
||||
#include <msvcrt/io.h>
|
||||
|
||||
/*
|
||||
* This variable determines the default file mode.
|
||||
* TODO: Which flags work?
|
||||
*/
|
||||
#if 0
|
||||
#ifdef __MSVCRT__ // || _MSVCRT_LIB_
|
||||
extern unsigned int* __imp__fmode;
|
||||
#define _fmode (*__imp__fmode)
|
||||
#else
|
||||
/* CRTDLL */
|
||||
extern unsigned int* _fmode_dll;
|
||||
#define _fmode (*_fmode_dll)
|
||||
#endif
|
||||
#endif /* 0 */
|
||||
|
||||
/*
|
||||
* NOTE: This is the correct definition to build crtdll.
|
||||
* It is NOT valid outside of crtdll.
|
||||
*/
|
||||
extern unsigned int* _fmode_dll;
|
||||
#ifndef __USE_W32API
|
||||
extern unsigned int _fmode;
|
||||
#endif
|
||||
|
||||
/* Specifiy one of these flags to define the access mode. */
|
||||
#define _O_RDONLY 0
|
||||
#define _O_WRONLY 1
|
||||
#define _O_RDWR 2
|
||||
|
||||
/* Mask for access mode bits in the _open flags. */
|
||||
#define _O_ACCMODE (O_RDONLY|O_WRONLY|O_RDWR)
|
||||
|
||||
#define _O_APPEND 0x0008 /* Writes will add to the end of the file. */
|
||||
#define _O_RANDOM 0x0010
|
||||
#define _O_SEQUENTIAL _O_RANDOM
|
||||
#define _O_TEMPORARY 0x0040 /* Make the file dissappear after closing.
|
||||
* WARNING: Even if not created by _open! */
|
||||
#define _O_NOINHERIT 0x0080
|
||||
|
||||
#define _O_CREAT 0x0100 /* Create the file if it does not exist. */
|
||||
#define _O_TRUNC 0x0200 /* Truncate the file if it does exist. */
|
||||
#define _O_EXCL 0x0400 /* Open only if the file does not exist. */
|
||||
|
||||
#define _O_SHORT_LIVED 0x1000
|
||||
|
||||
/* NOTE: Text is the default even if the given _O_TEXT bit is not on. */
|
||||
#define _O_TEXT 0x4000 /* CR-LF in file becomes LF in memory. */
|
||||
#define _O_BINARY 0x8000 /* Input and output is not translated. */
|
||||
#define _O_RAW _O_BINARY
|
||||
|
||||
|
||||
#ifndef __STRICT_ANSI__
|
||||
#ifndef _NO_OLDNAMES
|
||||
|
||||
/* POSIX/Non-ANSI names for increased portability */
|
||||
#define O_RDONLY _O_RDONLY
|
||||
#define O_WRONLY _O_WRONLY
|
||||
#define O_RDWR _O_RDWR
|
||||
#define O_ACCMODE _O_ACCMODE
|
||||
#define O_APPEND _O_APPEND
|
||||
#define O_CREAT _O_CREAT
|
||||
#define O_TRUNC _O_TRUNC
|
||||
#define O_EXCL _O_EXCL
|
||||
#define O_TEXT _O_TEXT
|
||||
#define O_BINARY _O_BINARY
|
||||
#define O_TEMPORARY _O_TEMPORARY
|
||||
#define O_NOINHERIT _O_NOINHERIT
|
||||
|
||||
#define O_RANDOM _O_RANDOM
|
||||
#define O_SEQUENTIAL _O_RANDOM
|
||||
#define O_SHORT_LIVED _O_SHORT_LIVED
|
||||
|
||||
#endif /* Not _NO_OLDNAMES */
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
int _setmode (int, int);
|
||||
|
||||
#ifndef _NO_OLDNAMES
|
||||
int setmode (int, int);
|
||||
#endif /* Not _NO_OLDNAMES */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* Not __STRICT_ANSI__ */
|
||||
|
||||
#endif /* Not _FCNTL_H_ */
|
||||
|
||||
@@ -1,214 +0,0 @@
|
||||
/*
|
||||
* float.h
|
||||
*
|
||||
* Constants related to floating point arithmetic.
|
||||
*
|
||||
* Also included here are some non-ANSI bits for accessing the floating
|
||||
* point controller.
|
||||
*
|
||||
* NOTE: GCC provides float.h, and it is probably more accurate than this,
|
||||
* but it doesn't include the non-standard stuff for accessing the
|
||||
* fp controller. (TODO: Move those bits elsewhere?) Thus it is
|
||||
* probably not a good idea to use the GCC supplied version instead
|
||||
* of this header.
|
||||
*
|
||||
* This file is part of the Mingw32 package.
|
||||
*
|
||||
* Contributors:
|
||||
* Created by Colin Peters <colin@bird.fu.is.saga-u.ac.jp>
|
||||
*
|
||||
* THIS SOFTWARE IS NOT COPYRIGHTED
|
||||
*
|
||||
* This source code is offered for use in the public domain. You may
|
||||
* use, modify or distribute it freely.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful but
|
||||
* WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
|
||||
* DISCLAIMED. This includes but is not limited to warranties of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* $Revision: 1.5 $
|
||||
* $Author$
|
||||
* $Date$
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _FLOAT_H_
|
||||
#define _FLOAT_H_
|
||||
|
||||
|
||||
#define FLT_ROUNDS 1
|
||||
#define FLT_GUARD 1
|
||||
#define FLT_NORMALIZE 1
|
||||
|
||||
/*
|
||||
* The characteristics of float.
|
||||
*/
|
||||
|
||||
/* The radix for floating point representation. */
|
||||
#define FLT_RADIX 2
|
||||
|
||||
/* Decimal digits of precision. */
|
||||
#define FLT_DIG 6
|
||||
|
||||
/* Smallest number such that 1+x != 1 */
|
||||
#define FLT_EPSILON 1.19209290e-07F
|
||||
|
||||
/* The number of base FLT_RADIX digits in the mantissa. */
|
||||
#define FLT_MANT_DIG 24
|
||||
|
||||
/* The maximum floating point number. */
|
||||
#define FLT_MAX 3.40282347e+38F
|
||||
|
||||
/* Maximum n such that FLT_RADIX^n - 1 is representable. */
|
||||
#define FLT_MAX_EXP 128
|
||||
|
||||
/* Maximum n such that 10^n is representable. */
|
||||
#define FLT_MAX_10_EXP 38
|
||||
|
||||
/* Minimum normalized floating-point number. */
|
||||
#define FLT_MIN 1.17549435e-38F
|
||||
|
||||
/* Minimum n such that FLT_RADIX^n is a normalized number. */
|
||||
#define FLT_MIN_EXP (-125)
|
||||
|
||||
/* Minimum n such that 10^n is a normalized number. */
|
||||
#define FLT_MIN_10_EXP (-37)
|
||||
|
||||
|
||||
/*
|
||||
* The characteristics of double.
|
||||
*/
|
||||
#define DBL_DIG 15
|
||||
#define DBL_EPSILON 1.1102230246251568e-16
|
||||
#define DBL_MANT_DIG 53
|
||||
#define DBL_MAX 1.7976931348623157e+308
|
||||
#define DBL_MAX_EXP 1024
|
||||
#define DBL_MAX_10_EXP 308
|
||||
#define DBL_MIN 2.2250738585072014e-308
|
||||
#define DBL_MIN_EXP (-1021)
|
||||
#define DBL_MIN_10_EXP (-307)
|
||||
|
||||
|
||||
/*
|
||||
* The characteristics of long double.
|
||||
* NOTE: long double is the same as double.
|
||||
*/
|
||||
#define LDBL_DIG 15
|
||||
#define LDBL_EPSILON 1.1102230246251568e-16L
|
||||
#define LDBL_MANT_DIG 53
|
||||
#define LDBL_MAX 1.7976931348623157e+308L
|
||||
#define LDBL_MAX_EXP 1024
|
||||
#define LDBL_MAX_10_EXP 308
|
||||
#define LDBL_MIN 2.2250738585072014e-308L
|
||||
#define LDBL_MIN_EXP (-1021)
|
||||
#define LDBL_MIN_10_EXP (-307)
|
||||
|
||||
|
||||
/*
|
||||
* Functions and definitions for controlling the FPU.
|
||||
*/
|
||||
#ifndef __STRICT_ANSI__
|
||||
|
||||
/* TODO: These constants are only valid for x86 machines */
|
||||
|
||||
/* Control word masks for unMask */
|
||||
#define _MCW_EM 0x0008001F /* Error masks */
|
||||
#define _MCW_IC 0x00040000 /* Infinity */
|
||||
#define _MCW_RC 0x00000300 /* Rounding */
|
||||
#define _MCW_PC 0x00030000 /* Precision */
|
||||
|
||||
/* Control word values for unNew (use with related unMask above) */
|
||||
#define _EM_INVALID 0x00000010
|
||||
#define _EM_DENORMAL 0x00080000
|
||||
#define _EM_ZERODIVIDE 0x00000008
|
||||
#define _EM_OVERFLOW 0x00000004
|
||||
#define _EM_UNDERFLOW 0x00000002
|
||||
#define _EM_INEXACT 0x00000001
|
||||
#define _IC_AFFINE 0x00040000
|
||||
#define _IC_PROJECTIVE 0x00000000
|
||||
#define _RC_CHOP 0x00000300
|
||||
#define _RC_UP 0x00000200
|
||||
#define _RC_DOWN 0x00000100
|
||||
#define _RC_NEAR 0x00000000
|
||||
#define _PC_24 0x00020000
|
||||
#define _PC_53 0x00010000
|
||||
#define _PC_64 0x00000000
|
||||
|
||||
/* Return values for fpclass. */
|
||||
#define _FPCLASS_SNAN 0x0001 /* Signaling "Not a Number" */
|
||||
#define _FPCLASS_QNAN 0x0002 /* Quiet "Not a Number" */
|
||||
#define _FPCLASS_NINF 0x0004 /* Negative Infinity */
|
||||
#define _FPCLASS_NN 0x0008 /* Negative Normal */
|
||||
#define _FPCLASS_ND 0x0010 /* Negative Denormal */
|
||||
#define _FPCLASS_NZ 0x0020 /* Negative Zero */
|
||||
#define _FPCLASS_PZ 0x0040 /* Positive Zero */
|
||||
#define _FPCLASS_PD 0x0080 /* Positive Denormal */
|
||||
#define _FPCLASS_PN 0x0100 /* Positive Normal */
|
||||
#define _FPCLASS_PINF 0x0200 /* Positive Infinity */
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/* Set the FPU control word as cw = (cw & ~unMask) | (unNew & unMask),
|
||||
* i.e. change the bits in unMask to have the values they have in unNew,
|
||||
* leaving other bits unchanged. */
|
||||
unsigned int _controlfp(unsigned int unNew, unsigned int unMask);
|
||||
unsigned int _control87(unsigned int unNew, unsigned int unMask);
|
||||
|
||||
|
||||
unsigned int _clearfp(void); /* Clear the FPU status word */
|
||||
unsigned int _statusfp(void); /* Report the FPU status word */
|
||||
#define _clear87 _clearfp
|
||||
#define _status87 _statusfp
|
||||
|
||||
|
||||
/*
|
||||
MSVCRT.dll _fpreset initializes the control register to 0x27f,
|
||||
the status register to zero and the tag word to 0FFFFh.
|
||||
This differs from asm instruction finit/fninit which set control
|
||||
word to 0x37f (64 bit mantissa precison rather than 53 bit).
|
||||
By default, the mingw version of _fpreset sets fp control as
|
||||
per fninit. To use the MSVCRT.dll _fpreset, include CRT_fp8.o when
|
||||
building your application.
|
||||
*/
|
||||
void _fpreset(void); /* Reset the FPU */
|
||||
|
||||
/* Global 'variable' for the current floating point error code. */
|
||||
int* __fpecode(void);
|
||||
#define _fpecode (*(__fpecode()))
|
||||
|
||||
/*
|
||||
* IEEE recommended functions. MS puts them in float.h
|
||||
* but they really belong in math.h.
|
||||
*/
|
||||
|
||||
double _chgsign (double);
|
||||
double _copysign (double, double);
|
||||
double _logb (double);
|
||||
double _nextafter (double, double);
|
||||
double _scalb (double, long);
|
||||
|
||||
int _finite (double);
|
||||
int _fpclass (double);
|
||||
int _isnan (double);
|
||||
|
||||
int _isinf (double); /* not exported */
|
||||
int _isnanl (long double); /* not exported */
|
||||
int _isinfl (long double); /* not exported */
|
||||
|
||||
#define isnan(x) _isnan(x)
|
||||
#define isinf(x) _isinf(x)
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* Not __STRICT_ANSI__ */
|
||||
|
||||
#endif /* _FLOAT_H_ */
|
||||
|
||||
@@ -1,33 +0,0 @@
|
||||
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
|
||||
#ifndef __dj_include_libc_atexit_h__
|
||||
#define __dj_include_libc_dosexec_h__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifndef __dj_ENFORCE_ANSI_FREESTANDING
|
||||
|
||||
#ifndef __STRICT_ANSI__
|
||||
|
||||
#ifndef _POSIX_SOURCE
|
||||
|
||||
struct __atexit {
|
||||
struct __atexit* __next;
|
||||
void (*__function)(void);
|
||||
};
|
||||
|
||||
extern struct __atexit* __atexit_ptr;
|
||||
|
||||
#endif /* !_POSIX_SOURCE */
|
||||
#endif /* !__STRICT_ANSI__ */
|
||||
#endif /* !__dj_ENFORCE_ANSI_FREESTANDING */
|
||||
|
||||
#ifndef __dj_ENFORCE_FUNCTION_CALLS
|
||||
#endif /* !__dj_ENFORCE_FUNCTION_CALLS */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __dj_include_libc_dosexec_h__ */
|
||||
@@ -1,12 +0,0 @@
|
||||
/* console.h */
|
||||
|
||||
#ifndef __MSVCRT_INTERNAL_CONSOLE_H
|
||||
#define __MSVCRT_INTERNAL_CONSOLE_H
|
||||
|
||||
extern int char_avail;
|
||||
extern int ungot_char;
|
||||
|
||||
#endif /* __MSVCRT_INTERNAL_CONSOLE_H */
|
||||
|
||||
/* EOF */
|
||||
|
||||
@@ -1,79 +0,0 @@
|
||||
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
|
||||
|
||||
#ifndef __dj_include_libc_file_h__
|
||||
#define __dj_include_libc_file_h__
|
||||
|
||||
#include <msvcrt/stdio.h>
|
||||
#include <msvcrt/fcntl.h>
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifndef __dj_ENFORCE_ANSI_FREESTANDING
|
||||
#ifndef __STRICT_ANSI__
|
||||
#ifndef _POSIX_SOURCE
|
||||
|
||||
#ifndef _IORMONCL
|
||||
#define _IORMONCL 004000 /* remove on close, for temp files */
|
||||
#endif
|
||||
/* if _flag & _IORMONCL, ._name_to_remove needs freeing */
|
||||
|
||||
#ifndef _IOUNGETC
|
||||
#define _IOUNGETC 010000 /* there is an ungetc'ed character in the buffer */
|
||||
#endif
|
||||
|
||||
/* might need check for IO_APPEND aswell */
|
||||
#define OPEN4WRITING(f) ((((f)->_flag & _IOWRT) == _IOWRT))
|
||||
#define OPEN4READING(f) ((((f)->_flag & _IOREAD) == _IOREAD))
|
||||
|
||||
/* might need check for IO_APPEND aswell */
|
||||
#define WRITE_STREAM(f) ((((f)->_flag & _IOWRT) == _IOWRT))
|
||||
#define READ_STREAM(f) ((((f)->_flag & _IOREAD) == _IOREAD))
|
||||
|
||||
char __validfp(FILE*);
|
||||
int __set_errno(int err);
|
||||
int __set_doserrno(int error);
|
||||
void* filehnd(int fn);
|
||||
char __is_text_file(FILE*);
|
||||
int __fileno_alloc(void* hFile, int mode);
|
||||
int _doprnt(const char* fmt, va_list args, FILE *);
|
||||
int _doscan(FILE* iop, const char* fmt, va_list argp);
|
||||
int __fileno_dup2(int handle1, int handle2);
|
||||
int __fileno_getmode(int _fd);
|
||||
int __fileno_setmode(int _fd, int _newmode);
|
||||
int __fileno_close(int _fd);
|
||||
void sigabort_handler(int sig);
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
void UnixTimeToFileTime(time_t unix_time, FILETIME* filetime, DWORD remainder);
|
||||
time_t FileTimeToUnixTime(const FILETIME* filetime, DWORD *remainder);
|
||||
|
||||
#endif /* !_POSIX_SOURCE */
|
||||
#endif /* !__STRICT_ANSI__ */
|
||||
#endif /* !__dj_ENFORCE_ANSI_FREESTANDING */
|
||||
|
||||
#ifndef __dj_ENFORCE_FUNCTION_CALLS
|
||||
#endif /* !__dj_ENFORCE_FUNCTION_CALLS */
|
||||
|
||||
#define __FILE_REC_MAX 20
|
||||
typedef struct __file_rec
|
||||
{
|
||||
struct __file_rec* next;
|
||||
int count;
|
||||
FILE* files[__FILE_REC_MAX];
|
||||
} __file_rec;
|
||||
|
||||
extern __file_rec* __file_rec_list;
|
||||
|
||||
void _dosmaperr(unsigned long oserrcode);
|
||||
|
||||
extern int __fmode;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __dj_include_libc_file_h__ */
|
||||
@@ -1,12 +0,0 @@
|
||||
/* stdio.h */
|
||||
|
||||
#ifndef __MSVCRT_INTERNAL_STDIO_H
|
||||
#define __MSVCRT_INTERNAL_STDIO_H
|
||||
|
||||
int __vfscanf(FILE* s, const char* format, va_list argptr);
|
||||
int __vscanf(const char* format, va_list arg);
|
||||
int __vsscanf(const char* s,const char* format, va_list arg);
|
||||
|
||||
#endif /* __MSVCRT_INTERNAL_STDIO_H */
|
||||
|
||||
/* EOF */
|
||||
@@ -1,168 +0,0 @@
|
||||
/*
|
||||
* io.h
|
||||
*
|
||||
* System level I/O functions and types.
|
||||
*
|
||||
* This file is part of the Mingw32 package.
|
||||
*
|
||||
* Contributors:
|
||||
* Created by Colin Peters <colin@bird.fu.is.saga-u.ac.jp>
|
||||
*
|
||||
* THIS SOFTWARE IS NOT COPYRIGHTED
|
||||
*
|
||||
* This source code is offered for use in the public domain. You may
|
||||
* use, modify or distribute it freely.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful but
|
||||
* WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
|
||||
* DISCLAIMED. This includes but is not limited to warranties of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* $Revision: 1.5 $
|
||||
* $Author$
|
||||
* $Date$
|
||||
*
|
||||
*/
|
||||
/* Appropriated for Reactos Crtdll by Ariadne */
|
||||
/* added D_OK */
|
||||
/* changed get_osfhandle and open_osfhandle */
|
||||
/* added fileno as macro */
|
||||
|
||||
#ifndef __STRICT_ANSI__
|
||||
|
||||
#ifndef _IO_H_
|
||||
#define _IO_H_
|
||||
|
||||
#include <msvcrt/sys/types.h>
|
||||
|
||||
#include <msvcrt/sys/stat.h>
|
||||
|
||||
|
||||
/* We need the definition of FILE anyway... */
|
||||
#include <msvcrt/stdio.h>
|
||||
|
||||
/* MSVC's io.h contains the stuff from dir.h, so I will too.
|
||||
* NOTE: This also defines off_t, the file offset type, through
|
||||
* and inclusion of sys/types.h */
|
||||
#include <msvcrt/dir.h>
|
||||
|
||||
/* TODO: Maximum number of open handles has not been tested, I just set
|
||||
* it the same as FOPEN_MAX. */
|
||||
#define HANDLE_MAX FOPEN_MAX
|
||||
|
||||
|
||||
/* Some defines for _access nAccessMode (MS doesn't define them, but
|
||||
* it doesn't seem to hurt to add them). */
|
||||
#define F_OK 0 /* Check for file existence */
|
||||
#define W_OK 2 /* Check for write permission */
|
||||
#define R_OK 4 /* Check for read permission */
|
||||
/* TODO: Is this safe? X_OK not supported directly... */
|
||||
#define X_OK R_OK /* Check for execute permission */
|
||||
#define D_OK 0x10
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
int _access (const char*, int);
|
||||
int _chsize (int, long);
|
||||
int _close (int);
|
||||
int _commit(int);
|
||||
|
||||
/* NOTE: The only significant bit in unPermissions appears to be bit 7 (0x80),
|
||||
* the "owner write permission" bit (on FAT). */
|
||||
int _creat (const char*, int);
|
||||
int _dup (int);
|
||||
int _dup2 (int, int);
|
||||
long _filelength (int);
|
||||
int _fileno (FILE*);
|
||||
void* _get_osfhandle (int);
|
||||
int _isatty (int);
|
||||
|
||||
int _chmod (const char* szPath, int nMode);
|
||||
__int64 _filelengthi64(int nHandle);
|
||||
|
||||
/* In a very odd turn of events this function is excluded from those
|
||||
* files which define _STREAM_COMPAT. This is required in order to
|
||||
* build GNU libio because of a conflict with _eof in streambuf.h
|
||||
* line 107. Actually I might just be able to change the name of
|
||||
* the enum member in streambuf.h... we'll see. TODO */
|
||||
#ifndef _STREAM_COMPAT
|
||||
int _eof (int);
|
||||
#endif
|
||||
|
||||
/* LK_... locking commands defined in sys/locking.h. */
|
||||
int _locking (int, int, long);
|
||||
|
||||
off_t _lseek(int, off_t, int);
|
||||
|
||||
/* Optional third argument is unsigned unPermissions. */
|
||||
int _open (const char*, int, ...);
|
||||
|
||||
int _open_osfhandle (void*, int);
|
||||
int _pipe (int*, unsigned int, int);
|
||||
size_t _read(int, void*, size_t);
|
||||
|
||||
/* SH_... flags for nShFlags defined in share.h
|
||||
* Optional fourth argument is unsigned unPermissions */
|
||||
int _sopen (char*, int, int, int);
|
||||
|
||||
long _tell(int);
|
||||
/* Should umask be in sys/stat.h and/or sys/types.h instead? */
|
||||
unsigned _umask(unsigned);
|
||||
int _unlink(const char*);
|
||||
size_t _write(int, const void*, size_t);
|
||||
|
||||
__int64 _lseeki64(int _fildes, __int64 _offset, int _whence);
|
||||
__int64 _telli64(int nHandle);
|
||||
|
||||
/* Wide character versions. Also declared in wchar.h. */
|
||||
/* Not in crtdll.dll */
|
||||
int _waccess(const wchar_t*, int);
|
||||
int _wchmod(const wchar_t*, int);
|
||||
int _wcreat(const wchar_t*, int);
|
||||
|
||||
int _wunlink(const wchar_t*);
|
||||
int _wopen(const wchar_t*, int, ...);
|
||||
int _wsopen(wchar_t*, int, int, int);
|
||||
|
||||
|
||||
#ifndef _NO_OLDNAMES
|
||||
/*
|
||||
* Non-underscored versions of non-ANSI functions to improve portability.
|
||||
* These functions live in libmoldname.a.
|
||||
*/
|
||||
|
||||
#define access _access
|
||||
#define chmod _chmod
|
||||
#define chsize _chsize
|
||||
#define close _close
|
||||
#define creat _creat
|
||||
#define dup _dup
|
||||
#define dup2 _dup2
|
||||
#define eof _eof
|
||||
#define filelength _filelength
|
||||
#define fileno(f) ((f)->_file)
|
||||
#define isatty _isatty
|
||||
#define lseek _lseek
|
||||
#define open _open
|
||||
#define read _read
|
||||
#define sopen(path,access,shflag,mode) _open((path), (access)|(shflag), (mode))
|
||||
#define tell(file) _lseek(_file, 0, SEEK_CUR)
|
||||
#define umask _umask
|
||||
#define unlink _unlink
|
||||
#define write _write
|
||||
|
||||
|
||||
#endif /* Not _NO_OLDNAMES */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _IO_H_ not defined */
|
||||
|
||||
#endif /* Not strict ANSI */
|
||||
|
||||
@@ -1,87 +0,0 @@
|
||||
/*
|
||||
* locale.h
|
||||
*
|
||||
* Functions and types for localization (ie. changing the appearance of
|
||||
* output based on the standards of a certain country).
|
||||
*
|
||||
* This file is part of the Mingw32 package.
|
||||
*
|
||||
* Contributors:
|
||||
* Created by Colin Peters <colin@bird.fu.is.saga-u.ac.jp>
|
||||
*
|
||||
* THIS SOFTWARE IS NOT COPYRIGHTED
|
||||
*
|
||||
* This source code is offered for use in the public domain. You may
|
||||
* use, modify or distribute it freely.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful but
|
||||
* WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
|
||||
* DISCLAIMED. This includes but is not limited to warranties of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* $Revision: 1.4 $
|
||||
* $Author$
|
||||
* $Date$
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _LOCALE_H_
|
||||
#define _LOCALE_H_
|
||||
|
||||
|
||||
/*
|
||||
* NOTE: I have tried to test this, but I am limited by my knowledge of
|
||||
* locale issues. The structure does not bomb if you look at the
|
||||
* values, and 'decimal_point' even seems to be correct. But the
|
||||
* rest of the values are, by default, not particularly useful
|
||||
* (read meaningless and not related to the international settings
|
||||
* of the system).
|
||||
*/
|
||||
|
||||
#define LC_ALL 0
|
||||
#define LC_COLLATE 1
|
||||
#define LC_CTYPE 2
|
||||
#define LC_MONETARY 3
|
||||
#define LC_NUMERIC 4
|
||||
#define LC_TIME 5
|
||||
#define LC_MIN LC_ALL
|
||||
#define LC_MAX LC_TIME
|
||||
|
||||
/*
|
||||
* The structure returned by 'localeconv'.
|
||||
*/
|
||||
struct lconv
|
||||
{
|
||||
char* decimal_point;
|
||||
char* thousands_sep;
|
||||
char* grouping;
|
||||
char* int_curr_symbol;
|
||||
char* currency_symbol;
|
||||
char* mon_decimal_point;
|
||||
char* mon_thousands_sep;
|
||||
char* mon_grouping;
|
||||
char* positive_sign;
|
||||
char* negative_sign;
|
||||
char int_frac_digits;
|
||||
char frac_digits;
|
||||
char p_cs_precedes;
|
||||
char p_sep_by_space;
|
||||
char n_cs_precedes;
|
||||
char n_sep_by_space;
|
||||
char p_sign_posn;
|
||||
char n_sign_posn;
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
char* setlocale(int, const char*);
|
||||
struct lconv* localeconv(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* Not _LOCALE_H_ */
|
||||
|
||||
@@ -1,53 +0,0 @@
|
||||
/*
|
||||
* malloc.h
|
||||
*
|
||||
* Support for programs which want to use malloc.h to get memory management
|
||||
* functions. Unless you absolutely need some of these functions and they are
|
||||
* not in the ANSI headers you should use the ANSI standard header files
|
||||
* instead.
|
||||
*
|
||||
* This file is part of the Mingw32 package.
|
||||
*
|
||||
* Contributors:
|
||||
* Created by Colin Peters <colin@bird.fu.is.saga-u.ac.jp>
|
||||
*
|
||||
* THIS SOFTWARE IS NOT COPYRIGHTED
|
||||
*
|
||||
* This source code is offered for use in the public domain. You may
|
||||
* use, modify or distribute it freely.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful but
|
||||
* WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
|
||||
* DISCLAIMED. This includes but is not limited to warranties of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* $Revision: 1.4 $
|
||||
* $Author$
|
||||
* $Date$
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __STRICT_ANSI__
|
||||
|
||||
#ifndef _MALLOC_H_
|
||||
#define _MALLOC_H_
|
||||
|
||||
#include <msvcrt/alloc.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
int _heapchk(void); /* Verify heap integrety. */
|
||||
int _heapmin(void); /* Return unused heap to the OS. */
|
||||
int _heapset(unsigned int);
|
||||
size_t _msize(void*);
|
||||
void* _expand(void*, size_t);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* Not _MALLOC_H_ */
|
||||
|
||||
#endif /* Not __STRICT_ANSI__ */
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user