ReactOS.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
List overview
Download
Ros-diffs
June 2011
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
ros-diffs@reactos.org
25 participants
460 discussions
Start a n
N
ew thread
[tkreuzer] 52172: [FREELDR] Fix MSVC and amd64 build
by tkreuzer@svn.reactos.org
Author: tkreuzer Date: Fri Jun 10 12:55:14 2011 New Revision: 52172 URL:
http://svn.reactos.org/svn/reactos?rev=52172&view=rev
Log: [FREELDR] Fix MSVC and amd64 build Added: trunk/reactos/boot/freeldr/freeldr/arch/amd64/stubs.S (with props) trunk/reactos/boot/freeldr/freeldr/include/arch/i386/realmode.h (with props) Modified: trunk/reactos/boot/freeldr/freeldr/CMakeLists.txt trunk/reactos/boot/freeldr/freeldr/arch/amd64/arch.S trunk/reactos/boot/freeldr/freeldr/arch/amd64/loader.c trunk/reactos/boot/freeldr/freeldr/arch/i386/realmode.S trunk/reactos/boot/freeldr/freeldr/disk/disk.c trunk/reactos/boot/freeldr/freeldr/disk/scsiport.c trunk/reactos/boot/freeldr/freeldr/freeldr.c trunk/reactos/boot/freeldr/freeldr/include/arch/amd64/amd64.h trunk/reactos/boot/freeldr/freeldr/include/arch/amd64/machpc.h trunk/reactos/boot/freeldr/freeldr/include/disk.h trunk/reactos/boot/freeldr/freeldr/include/freeldr.h Modified: trunk/reactos/boot/freeldr/freeldr/CMakeLists.txt URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/CMake…
============================================================================== --- trunk/reactos/boot/freeldr/freeldr/CMakeLists.txt [iso-8859-1] (original) +++ trunk/reactos/boot/freeldr/freeldr/CMakeLists.txt [iso-8859-1] Fri Jun 10 12:55:14 2011 @@ -18,9 +18,14 @@ arch/i386/arch.S) endif() elseif(ARCH MATCHES amd64) - list(APPEND FREELDR_STARTUP_SOURCE - arch/i386/fathelp.S - arch/amd64/arch.S) + if(MSVC) + list(APPEND FREELDR_BASE64K_SOURCE + arch/amd64/stubs.S) + else() + list(APPEND FREELDR_STARTUP_SOURCE + arch/i386/fathelp.S + arch/amd64/arch.S) + endif() endif() if(ARCH MATCHES i386) @@ -39,12 +44,14 @@ arch/i386/i386bug.c) endif() elseif(ARCH MATCHES amd64) + if(NOT MSVC) list(APPEND FREELDR_BASE64K_SOURCE arch/i386/drvmap.S arch/i386/i386cpu.S arch/i386/i386idt.S arch/i386/i386trap.S arch/amd64/mb.S) + endif() endif() set_source_files_properties(${FREELDR_BASE64K_SOURCE} PROPERTIES COMPILE_DEFINITIONS "_NTHAL_") @@ -60,7 +67,7 @@ disk/disk.c disk/partition.c disk/ramdisk.c - disk/scsiport.c + #disk/scsiport.c fs/ext2.c fs/fat.c fs/fs.c @@ -148,6 +155,25 @@ arch/i386/xboxvideo.c windows/i386/ntsetup.c windows/i386/wlmemory.c) +elseif(ARCH MATCHES amd64) + list(APPEND FREELDR_ARCH_SOURCE + arch/amd64/loader.c + arch/i386/hardware.c + arch/i386/hwacpi.c + arch/i386/hwapm.c + arch/i386/hwpci.c + arch/i386/i386rtl.c + arch/i386/i386disk.c + arch/i386/i386vid.c + arch/i386/machpc.c + arch/i386/ntoskrnl.c + arch/i386/pccons.c + arch/i386/pcdisk.c + arch/i386/pcmem.c + arch/i386/pcrtc.c + arch/i386/pcvideo.c + windows/amd64/ntsetup.c + windows/amd64/wlmemory.c) else() #TBD endif() Modified: trunk/reactos/boot/freeldr/freeldr/arch/amd64/arch.S URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/arch/…
============================================================================== --- trunk/reactos/boot/freeldr/freeldr/arch/amd64/arch.S [iso-8859-1] (original) +++ trunk/reactos/boot/freeldr/freeldr/arch/amd64/arch.S [iso-8859-1] Fri Jun 10 12:55:14 2011 @@ -25,21 +25,21 @@ /* checkPoint Charlie - where it all began... */ mov si, offset CheckPoint0 - call writestr + call writestr /* Setup a real mode stack */ mov sp, stack16 /* Zero BootDrive and BootPartition */ xor eax, eax - mov BootDrive, eax - mov BootPartition, eax + mov FrldrBootDrive, eax + mov FrldrBootPartition, eax /* Store the boot drive */ - mov BootDrive, dl + mov FrldrBootDrive, dl /* Store the boot partition */ - mov BootPartition, dh + mov FrldrBootPartition, dh /* Load the GDT */ lgdt gdtptr @@ -50,16 +50,16 @@ /* checkPoint Charlie - where it all began... */ mov si, offset CheckPoint1 - call writestr - + call writestr + call x86_16_BuildPageTables - + /* checkPoint Charlie - where it all began... */ mov si, offset CheckPoint2 - call writestr + call writestr /* Check if CPU supports CPUID */ - + pushfd pop eax mov ebx, eax @@ -70,8 +70,8 @@ pop eax cmp eax,ebx jz NO_CPUID_SUPPORT_DETECTED - - /* CPUID support detected - getting the PAE/PGE */ + + /* CPUID support detected - getting the PAE/PGE */ mov eax,1 // Fn0000_0001 - PAE in EDX[6] cpuid @@ -79,24 +79,24 @@ and edx,0x00a0 test edx,edx // are PAE and PGE bits set? jz NO_X64_SUPPORT_DETECTED - + /* PAE and PGE are here */ - + xor edx, edx mov eax, 0x80000001 cpuid and edx, 0x20000000 test edx,edx jz NO_X64_SUPPORT_DETECTED - + /* X64 Processor */ - + /* checkPoint Charlie - where it all began... */ mov si, offset CheckPoint3 - call writestr + call writestr jmp switch64 - + NO_X64_SUPPORT_DETECTED: mov si, offset NotAnX64Processor // Loading message call writestr @@ -129,7 +129,7 @@ // mov ds, ax // mov word ptr ds:[0xb8002], 0x0e02 + '2' - + /* Return into real mode */ call x86_64_SwitchToReal .code16 @@ -169,7 +169,7 @@ ret /* - * We define 512 2MB pages at the start of memory, so we can access the first + * We define 512 2MB pages at the start of memory, so we can access the first * 1 GB as if paging was disabled */ x86_16_BuildPageTables: @@ -238,7 +238,7 @@ popad popfd ret - + writechr: pushf @@ -252,7 +252,7 @@ //.global x86_16_SwitchToLong x86_16_SwitchToLong: - + cli xor ax,ax @@ -332,7 +332,7 @@ /* Step 2 - disable long mode in EFER MSR */ // mov ecx, 0xC0000080 // Specify EFER MSR -// rdmsr +// rdmsr // and eax, ~0x00000100 // Disable EFER.LME // wrmsr @@ -408,12 +408,12 @@ .long gdt /* Base Address */ -.global BootDrive -BootDrive: +.global FrldrBootDrive +FrldrBootDrive: .long 0 - -.global BootPartition -BootPartition: + +.global FrldrBootPartition +FrldrBootPartition: .long 0 .global NotAnX64Processor @@ -431,12 +431,12 @@ CheckPoint0: .ascii "Starting FreeLoader..." .byte 0x0d, 0x0a, 0 - + .global CheckPoint1 CheckPoint1: .ascii "FreeLoader[16-bit]: building page tables..." .byte 0x0d, 0x0a, 0 - + .global CheckPoint2 CheckPoint2: .ascii "FreeLoader[16-bit]: checking CPU for x64 long mode..." Modified: trunk/reactos/boot/freeldr/freeldr/arch/amd64/loader.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/arch/…
============================================================================== --- trunk/reactos/boot/freeldr/freeldr/arch/amd64/loader.c [iso-8859-1] (original) +++ trunk/reactos/boot/freeldr/freeldr/arch/amd64/loader.c [iso-8859-1] Fri Jun 10 12:55:14 2011 @@ -27,7 +27,6 @@ ULONG_PTR GdtBase, IdtBase, TssBase; extern ROS_KERNEL_ENTRY_POINT KernelEntryPoint; -PPAGE_DIRECTORY_AMD64 pPML4; PVOID pIdt, pGdt; /* FUNCTIONS *****************************************************************/ Added: trunk/reactos/boot/freeldr/freeldr/arch/amd64/stubs.S URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/arch/…
============================================================================== --- trunk/reactos/boot/freeldr/freeldr/arch/amd64/stubs.S (added) +++ trunk/reactos/boot/freeldr/freeldr/arch/amd64/stubs.S [iso-8859-1] Fri Jun 10 12:55:14 2011 @@ -1,0 +1,48 @@ + + +#include <asm.inc> + +EXTERN BootMain:PROC + +.code64 + +/* 64 bit entry point */ +PUBLIC mainCRTStartup +mainCRTStartup: + jmp BootMain + +PUBLIC Int386 +Int386: + ret + +PUBLIC __lgdt +__lgdt: + +PUBLIC __ltr +__ltr: + +PUBLIC PxeCallApi +PxeCallApi: + .long 0 + +PUBLIC PageDirectoryStart +PageDirectoryStart: + .long 0 + +PUBLIC PageDirectoryEnd +PageDirectoryEnd: + .long 0 + +PUBLIC PnpBiosGetDeviceNode +PnpBiosGetDeviceNode: + .long 0 + +PUBLIC PnpBiosGetDeviceNodeCount +PnpBiosGetDeviceNodeCount: + .long 0 + +PUBLIC PnpBiosSupported +PnpBiosSupported: + .long 0 + +END Propchange: trunk/reactos/boot/freeldr/freeldr/arch/amd64/stubs.S ------------------------------------------------------------------------------ svn:eol-style = native Modified: trunk/reactos/boot/freeldr/freeldr/arch/i386/realmode.S URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/arch/…
============================================================================== --- trunk/reactos/boot/freeldr/freeldr/arch/i386/realmode.S [iso-8859-1] (original) +++ trunk/reactos/boot/freeldr/freeldr/arch/i386/realmode.S [iso-8859-1] Fri Jun 10 12:55:14 2011 @@ -14,10 +14,10 @@ // globals -PUBLIC _BootPartition -_BootPartition: -PUBLIC _BootDrive -_BootDrive: +PUBLIC _FrldrBootPartition +_FrldrBootPartition: +PUBLIC _FrldrBootDrive +_FrldrBootDrive: PUBLIC _PageDirectoryStart _PageDirectoryStart: Modified: trunk/reactos/boot/freeldr/freeldr/disk/disk.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/disk/…
============================================================================== --- trunk/reactos/boot/freeldr/freeldr/disk/disk.c [iso-8859-1] (original) +++ trunk/reactos/boot/freeldr/freeldr/disk/disk.c [iso-8859-1] Fri Jun 10 12:55:14 2011 @@ -132,18 +132,21 @@ /* FIXME */ else if (DiskReadBootRecord(FrldrBootDrive, 0, &MasterBootRecord)) { + ULONG BootPartition; + /* This is a hard disk */ - - if (!DiskGetActivePartitionEntry(FrldrBootDrive, &PartitionEntry, &FrldrBootPartition)) + if (!DiskGetActivePartitionEntry(FrldrBootDrive, &PartitionEntry, &BootPartition)) { DbgPrint("Invalid active partition information\n"); return FALSE; } - if (Size <= sizeof(Path) + 18 + strlen(Device) + strlen(Partition)) - { - return FALSE; - } + FrldrBootPartition = BootPartition; + + if (Size <= sizeof(Path) + 18 + strlen(Device) + strlen(Partition)) + { + return FALSE; + } strcpy(BootPath, Path); @@ -158,7 +161,7 @@ strcat(BootPath, "partition("); strcat(BootPath, Partition); strcat(BootPath, ")"); - } + } else { /* This is a CD-ROM drive */ Modified: trunk/reactos/boot/freeldr/freeldr/disk/scsiport.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/disk/…
============================================================================== --- trunk/reactos/boot/freeldr/freeldr/disk/scsiport.c [iso-8859-1] (original) +++ trunk/reactos/boot/freeldr/freeldr/disk/scsiport.c [iso-8859-1] Fri Jun 10 12:55:14 2011 @@ -10,6 +10,33 @@ #include <ntdddisk.h> #include <stdio.h> #include <stdarg.h> + +#undef ScsiPortLogError +#undef ScsiPortMoveMemory +#undef ScsiPortWritePortBufferUchar +#undef ScsiPortWritePortBufferUlong +#undef ScsiPortWritePortBufferUshort +#undef ScsiPortWritePortUchar +#undef ScsiPortWritePortUlong +#undef ScsiPortWritePortUshort +#undef ScsiPortWriteRegisterBufferUchar +#undef ScsiPortWriteRegisterBufferUlong +#undef ScsiPortWriteRegisterBufferUshort +#undef ScsiPortWriteRegisterUchar +#undef ScsiPortWriteRegisterUlong +#undef ScsiPortWriteRegisterUshort +#undef ScsiPortReadPortBufferUchar +#undef ScsiPortReadPortBufferUlong +#undef ScsiPortReadPortBufferUshort +#undef ScsiPortReadPortUchar +#undef ScsiPortReadPortUlong +#undef ScsiPortReadPortUshort +#undef ScsiPortReadRegisterBufferUchar +#undef ScsiPortReadRegisterBufferUlong +#undef ScsiPortReadRegisterBufferUshort +#undef ScsiPortReadRegisterUchar +#undef ScsiPortReadRegisterUlong +#undef ScsiPortReadRegisterUshort #define NDEBUG #include <debug.h> Modified: trunk/reactos/boot/freeldr/freeldr/freeldr.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/freel…
============================================================================== --- trunk/reactos/boot/freeldr/freeldr/freeldr.c [iso-8859-1] (original) +++ trunk/reactos/boot/freeldr/freeldr/freeldr.c [iso-8859-1] Fri Jun 10 12:55:14 2011 @@ -54,17 +54,6 @@ RunLoader(); } -#ifdef _MSC_VER -long _ftol2(double f) -{ - return _ftol(f); -} -long _ftol2_sse(double f) -{ - return _ftol(f); -} -#endif - // We need to emulate these, because the original ones don't work in freeldr int __cdecl wctomb(char *mbchar, wchar_t wchar) { Modified: trunk/reactos/boot/freeldr/freeldr/include/arch/amd64/amd64.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/inclu…
============================================================================== --- trunk/reactos/boot/freeldr/freeldr/include/arch/amd64/amd64.h [iso-8859-1] (original) +++ trunk/reactos/boot/freeldr/freeldr/include/arch/amd64/amd64.h [iso-8859-1] Fri Jun 10 12:55:14 2011 @@ -18,7 +18,9 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ +#ifndef __ASM__ #pragma once +#endif // This is needed because headers define wrong one for ReactOS #undef KIP0PCRADDRESS @@ -49,16 +51,15 @@ #define APIC_PHYS_BASE 0xfee00000 -#define NUM_PAGES_KERNEL +#define NUM_PAGES_KERNEL #ifndef ASM -typedef struct _PAGE_DIRECTORY_AMD64 -{ - HARDWARE_PTE Pde[512]; -} PAGE_DIRECTORY_AMD64, *PPAGE_DIRECTORY_AMD64; - VOID FrLdrSetupGdtIdt(VOID); + +#include <arch/i386/realmode.h> +#define FrldrBootDrive *((PULONG)BSS_BootDrive) +#define FrldrBootPartition *((PULONG)BSS_BootPartition) #endif Modified: trunk/reactos/boot/freeldr/freeldr/include/arch/amd64/machpc.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/inclu…
============================================================================== --- trunk/reactos/boot/freeldr/freeldr/include/arch/amd64/machpc.h [iso-8859-1] (original) +++ trunk/reactos/boot/freeldr/freeldr/include/arch/amd64/machpc.h [iso-8859-1] Fri Jun 10 12:55:14 2011 @@ -49,6 +49,7 @@ ULONG PcMemGetMemoryMap(PBIOS_MEMORY_MAP BiosMemoryMap, ULONG MaxMemoryMapSize); +BOOLEAN PcDiskGetBootPath(char *BootPath, unsigned Size); BOOLEAN PcDiskReadLogicalSectors(ULONG DriveNumber, ULONGLONG SectorNumber, ULONG SectorCount, PVOID Buffer); BOOLEAN PcDiskGetPartitionEntry(ULONG DriveNumber, ULONG PartitionNumber, PPARTITION_TABLE_ENTRY PartitionTableEntry); BOOLEAN PcDiskGetDriveGeometry(ULONG DriveNumber, PGEOMETRY DriveGeometry); Added: trunk/reactos/boot/freeldr/freeldr/include/arch/i386/realmode.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/inclu…
============================================================================== --- trunk/reactos/boot/freeldr/freeldr/include/arch/i386/realmode.h (added) +++ trunk/reactos/boot/freeldr/freeldr/include/arch/i386/realmode.h [iso-8859-1] Fri Jun 10 12:55:14 2011 @@ -1,0 +1,13 @@ + + +/* These addresses specify the realmode "BSS section" */ +#define BSS_START HEX(7000) +#define BSS_CallbackAddress BSS_START + 0 +#define BSS_CallbackReturn BSS_START + 8 +#define BSS_BootDrive BSS_START + 16 +#define BSS_BootPartition BSS_START + 20 + +#define PE_LOAD_BASE HEX(9000) +#define IMAGE_DOS_HEADER_e_lfanew 36 +#define IMAGE_FILE_HEADER_SIZE 20 +#define IMAGE_OPTIONAL_HEADER_AddressOfEntryPoint 16 Propchange: trunk/reactos/boot/freeldr/freeldr/include/arch/i386/realmode.h ------------------------------------------------------------------------------ svn:eol-style = native Modified: trunk/reactos/boot/freeldr/freeldr/include/disk.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/inclu…
============================================================================== --- trunk/reactos/boot/freeldr/freeldr/include/disk.h [iso-8859-1] (original) +++ trunk/reactos/boot/freeldr/freeldr/include/disk.h [iso-8859-1] Fri Jun 10 12:55:14 2011 @@ -123,8 +123,10 @@ BOOLEAN DiskReadLogicalSectors(ULONG DriveNumber, ULONGLONG SectorNumber, ULONG SectorCount, PVOID Buffer); // Implemented in i386disk.c BOOLEAN DiskIsDriveRemovable(ULONG DriveNumber); VOID DiskStopFloppyMotor(VOID); // Implemented in i386disk.c +#ifndef _M_AMD64 extern ULONG FrldrBootDrive; extern ULONG FrldrBootPartition; +#endif BOOLEAN DiskGetBootPath(char *BootPath, unsigned Size); Modified: trunk/reactos/boot/freeldr/freeldr/include/freeldr.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/inclu…
============================================================================== --- trunk/reactos/boot/freeldr/freeldr/include/freeldr.h [iso-8859-1] (original) +++ trunk/reactos/boot/freeldr/freeldr/include/freeldr.h [iso-8859-1] Fri Jun 10 12:55:14 2011 @@ -95,6 +95,7 @@ #elif defined(_M_AMD64) #include <arch/amd64/hardware.h> #include <arch/amd64/machpc.h> +#include <arch/i386/pxe.h> #include <internal/amd64/intrin_i.h> #endif /* misc files */
13 years, 6 months
1
0
0
0
[tkreuzer] 52171: {FREELDR] Rename global variables BootDrive to FrldrBootDrive and BootPartition to FrldrBootPartition
by tkreuzer@svn.reactos.org
Author: tkreuzer Date: Fri Jun 10 12:12:16 2011 New Revision: 52171 URL:
http://svn.reactos.org/svn/reactos?rev=52171&view=rev
Log: {FREELDR] Rename global variables BootDrive to FrldrBootDrive and BootPartition to FrldrBootPartition Modified: trunk/reactos/boot/freeldr/freeldr/arch/i386/arch.S trunk/reactos/boot/freeldr/freeldr/arch/i386/boot.S trunk/reactos/boot/freeldr/freeldr/arch/i386/hardware.c trunk/reactos/boot/freeldr/freeldr/arch/i386/linux.S trunk/reactos/boot/freeldr/freeldr/disk/disk.c trunk/reactos/boot/freeldr/freeldr/include/disk.h Modified: trunk/reactos/boot/freeldr/freeldr/arch/i386/arch.S URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/arch/…
============================================================================== --- trunk/reactos/boot/freeldr/freeldr/arch/i386/arch.S [iso-8859-1] (original) +++ trunk/reactos/boot/freeldr/freeldr/arch/i386/arch.S [iso-8859-1] Fri Jun 10 12:12:16 2011 @@ -50,14 +50,14 @@ /* Zero BootDrive and BootPartition */ xor eax, eax - mov dword ptr [_BootDrive], eax - mov dword ptr [_BootPartition], eax + mov dword ptr [_FrldrBootDrive], eax + mov dword ptr [_FrldrBootPartition], eax /* Store the boot drive */ - mov byte ptr [_BootDrive], dl + mov byte ptr [_FrldrBootDrive], dl /* Store the boot partition */ - mov byte ptr [_BootPartition], dh + mov byte ptr [_FrldrBootPartition], dh /* GO! */ push eax @@ -302,7 +302,7 @@ /* Align 32 bits boundary */ .align 4 - + /* Multiboot header */ MultibootHeader: /* magic */ @@ -400,12 +400,12 @@ mov eax, [ebx + MB_INFO_BOOT_DEVICE_OFFSET] shr eax, 16 inc al - mov byte ptr _BootPartition, al - mov byte ptr _BootDrive, ah + mov byte ptr _FrldrBootPartition, al + mov byte ptr _FrldrBootDrive, ah jmp mb6 mb5: /* No boot device known, assume first partition of first harddisk */ - mov byte ptr _BootDrive, HEX(80) - mov byte ptr _BootPartition, 1 + mov byte ptr _FrldrBootDrive, HEX(80) + mov byte ptr _FrldrBootPartition, 1 mb6: /* Check for command line */ mov eax, offset cmdline @@ -415,7 +415,7 @@ mb7: /* GO! */ - push eax + push eax call _BootMain mbfail: @@ -496,8 +496,8 @@ cmdline: .fill CMDLINE_SIZE, 1, 0 -EXTERN(_BootDrive) +EXTERN(_FrldrBootDrive) .long 0 - -EXTERN(_BootPartition) + +EXTERN(_FrldrBootPartition) .long 0 Modified: trunk/reactos/boot/freeldr/freeldr/arch/i386/boot.S URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/arch/…
============================================================================== --- trunk/reactos/boot/freeldr/freeldr/arch/i386/boot.S [iso-8859-1] (original) +++ trunk/reactos/boot/freeldr/freeldr/arch/i386/boot.S [iso-8859-1] Fri Jun 10 12:12:16 2011 @@ -31,7 +31,7 @@ .code16 /* Set the boot drive */ - movb (_BootDrive),%dl + movb (_FrldrBootDrive),%dl /* Load segment registers */ cli Modified: trunk/reactos/boot/freeldr/freeldr/arch/i386/hardware.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/arch/…
============================================================================== --- trunk/reactos/boot/freeldr/freeldr/arch/i386/hardware.c [iso-8859-1] (original) +++ trunk/reactos/boot/freeldr/freeldr/arch/i386/hardware.c [iso-8859-1] Fri Jun 10 12:12:16 2011 @@ -736,7 +736,7 @@ DPRINTM(DPRINT_HWDETECT, "Floppy count: %u\n", FloppyCount); - + Size = sizeof(CM_PARTIAL_RESOURCE_LIST) + 2 * sizeof(CM_PARTIAL_RESOURCE_DESCRIPTOR); PartialResourceList = MmHeapAlloc(Size); @@ -808,11 +808,11 @@ ULONG Size; ULONG i; BOOLEAN Changed; - + /* Count the number of visible drives */ DiskReportError(FALSE); DiskCount = 0; - + /* There are some really broken BIOSes out there. There are even BIOSes * that happily report success when you ask them to read from non-existent * harddisks. So, we set the buffer to known contents first, then try to @@ -838,7 +838,7 @@ DiskReportError(TRUE); DPRINTM(DPRINT_HWDETECT, "BIOS reports %d harddisk%s\n", (int)DiskCount, (DiskCount == 1) ? "": "s"); - + /* Allocate resource descriptor */ Size = sizeof(CM_PARTIAL_RESOURCE_LIST) + sizeof(CM_INT13_DRIVE_PARAMETER) * DiskCount; @@ -849,7 +849,7 @@ "Failed to allocate resource descriptor\n"); return NULL; } - + /* Initialize resource descriptor */ memset(PartialResourceList, 0, Size); PartialResourceList->Version = 1; @@ -860,7 +860,7 @@ PartialResourceList->PartialDescriptors[0].Flags = 0; PartialResourceList->PartialDescriptors[0].u.DeviceSpecificData.DataSize = sizeof(CM_INT13_DRIVE_PARAMETER) * DiskCount; - + /* Get harddisk Int13 geometry data */ Int13Drives = (PVOID)(((ULONG_PTR)PartialResourceList) + sizeof(CM_PARTIAL_RESOURCE_LIST)); for (i = 0; i < DiskCount; i++) @@ -872,7 +872,7 @@ Int13Drives[i].SectorsPerTrack = Geometry.Sectors; Int13Drives[i].MaxHeads = Geometry.Heads - 1; Int13Drives[i].NumberDrives = DiskCount; - + DPRINTM(DPRINT_HWDETECT, "Disk %x: %u Cylinders %u Heads %u Sectors %u Bytes\n", 0x80 + i, @@ -954,7 +954,7 @@ 0, &ControllerKey); DPRINTM(DPRINT_HWDETECT, "Created key: DiskController\\0\n"); - + /* Create and fill subkey for each harddisk */ for (i = 0; i < DiskCount; i++) { @@ -962,7 +962,7 @@ ULONG Size; CHAR Identifier[20]; - if (BootDrive == 0x80 + i) + if (FrldrBootDrive == 0x80 + i) BootDriveReported = TRUE; /* Get disk values */ @@ -986,15 +986,15 @@ MachDiskGetBootPath(BootPath, sizeof(BootPath)); /* Add it, if it's a floppy or cdrom */ - if ((BootDrive >= 0x80 && !BootDriveReported) || - DiskIsDriveRemovable(BootDrive)) + if ((FrldrBootDrive >= 0x80 && !BootDriveReported) || + DiskIsDriveRemovable(FrldrBootDrive)) { /* TODO: Check if it's really a cdrom drive */ ULONG* Buffer; ULONG Checksum = 0; /* Read the MBR */ - if (!MachDiskReadLogicalSectors(BootDrive, 16ULL, 1, (PVOID)DISKREADBUFFER)) + if (!MachDiskReadLogicalSectors(FrldrBootDrive, 16ULL, 1, (PVOID)DISKREADBUFFER)) { DPRINTM(DPRINT_HWDETECT, "Reading MBR failed\n"); return; @@ -1746,9 +1746,9 @@ Size, &ControllerKey); DPRINTM(DPRINT_HWDETECT, "Created key: KeyboardController\\0\n"); - + MmHeapFree(PartialResourceList); - + DetectKeyboardPeripheral(ControllerKey); } @@ -2049,14 +2049,14 @@ /* Create the 'System' key */ SystemKey = DetectSystem(); - + /* Detect buses */ DetectPciBios(SystemKey, &BusNumber); DetectApmBios(SystemKey, &BusNumber); DetectPnpBios(SystemKey, &BusNumber); DetectIsaBios(SystemKey, &BusNumber); DetectAcpiBios(SystemKey, &BusNumber); - + DPRINTM(DPRINT_HWDETECT, "DetectHardware() Done\n"); return SystemKey; Modified: trunk/reactos/boot/freeldr/freeldr/arch/i386/linux.S URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/arch/…
============================================================================== --- trunk/reactos/boot/freeldr/freeldr/arch/i386/linux.S [iso-8859-1] (original) +++ trunk/reactos/boot/freeldr/freeldr/arch/i386/linux.S [iso-8859-1] Fri Jun 10 12:12:16 2011 @@ -30,7 +30,7 @@ .code16 /* Set the boot drive */ - movb (_BootDrive),%dl + movb (_FrldrBootDrive),%dl /* Load segment registers */ cli @@ -66,7 +66,7 @@ .code16 /* Set the boot drive */ - movb (_BootDrive),%dl + movb (_FrldrBootDrive),%dl /* Load segment registers */ cli Modified: trunk/reactos/boot/freeldr/freeldr/disk/disk.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/disk/…
============================================================================== --- trunk/reactos/boot/freeldr/freeldr/disk/disk.c [iso-8859-1] (original) +++ trunk/reactos/boot/freeldr/freeldr/disk/disk.c [iso-8859-1] Fri Jun 10 12:12:16 2011 @@ -111,7 +111,7 @@ PARTITION_TABLE_ENTRY PartitionEntry; MASTER_BOOT_RECORD MasterBootRecord; - if (BootDrive < 0x80) + if (FrldrBootDrive < 0x80) { /* This is a floppy */ @@ -124,17 +124,17 @@ strcat(BootPath, "fdisk"); - _itoa(BootDrive, Device, 10); + _itoa(FrldrBootDrive, Device, 10); strcat(BootPath, "("); strcat(BootPath, Device); strcat(BootPath, ")"); } /* FIXME */ - else if (DiskReadBootRecord(BootDrive, 0, &MasterBootRecord)) + else if (DiskReadBootRecord(FrldrBootDrive, 0, &MasterBootRecord)) { /* This is a hard disk */ - if (!DiskGetActivePartitionEntry(BootDrive, &PartitionEntry, &BootPartition)) + if (!DiskGetActivePartitionEntry(FrldrBootDrive, &PartitionEntry, &FrldrBootPartition)) { DbgPrint("Invalid active partition information\n"); return FALSE; @@ -149,12 +149,12 @@ strcat(BootPath, "rdisk"); - _itoa(BootDrive - 0x80, Device, 10); + _itoa(FrldrBootDrive - 0x80, Device, 10); strcat(BootPath, "("); strcat(BootPath, Device); strcat(BootPath, ")"); - _itoa(BootPartition, Partition, 10); + _itoa(FrldrBootPartition, Partition, 10); strcat(BootPath, "partition("); strcat(BootPath, Partition); strcat(BootPath, ")"); @@ -172,7 +172,7 @@ strcat(BootPath, "cdrom"); - _itoa(BootDrive - 0x80, Device, 10); + _itoa(FrldrBootDrive - 0x80, Device, 10); strcat(BootPath, "("); strcat(BootPath, Device); strcat(BootPath, ")"); Modified: trunk/reactos/boot/freeldr/freeldr/include/disk.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/inclu…
============================================================================== --- trunk/reactos/boot/freeldr/freeldr/include/disk.h [iso-8859-1] (original) +++ trunk/reactos/boot/freeldr/freeldr/include/disk.h [iso-8859-1] Fri Jun 10 12:12:16 2011 @@ -123,8 +123,8 @@ BOOLEAN DiskReadLogicalSectors(ULONG DriveNumber, ULONGLONG SectorNumber, ULONG SectorCount, PVOID Buffer); // Implemented in i386disk.c BOOLEAN DiskIsDriveRemovable(ULONG DriveNumber); VOID DiskStopFloppyMotor(VOID); // Implemented in i386disk.c -extern ULONG BootDrive; -extern ULONG BootPartition; +extern ULONG FrldrBootDrive; +extern ULONG FrldrBootPartition; BOOLEAN DiskGetBootPath(char *BootPath, unsigned Size);
13 years, 6 months
1
0
0
0
[cmihail] 52170: [AFD, TCPIP] Bind issue seems solved now. Server app can be restarted without failing at binding. More information is at r52166. Patch by cgutman.
by cmihail@svn.reactos.org
Author: cmihail Date: Fri Jun 10 09:24:29 2011 New Revision: 52170 URL:
http://svn.reactos.org/svn/reactos?rev=52170&view=rev
Log: [AFD, TCPIP] Bind issue seems solved now. Server app can be restarted without failing at binding. More information is at r52166. Patch by cgutman. Modified: branches/GSoC_2011/TcpIpDriver/drivers/network/afd/afd/bind.c branches/GSoC_2011/TcpIpDriver/drivers/network/afd/afd/listen.c branches/GSoC_2011/TcpIpDriver/drivers/network/afd/afd/lock.c branches/GSoC_2011/TcpIpDriver/drivers/network/afd/afd/main.c branches/GSoC_2011/TcpIpDriver/drivers/network/afd/afd/write.c branches/GSoC_2011/TcpIpDriver/drivers/network/tcpip/tcpip/dispatch.c branches/GSoC_2011/TcpIpDriver/drivers/network/tcpip/tcpip/fileobjs.c branches/GSoC_2011/TcpIpDriver/drivers/network/tcpip/tcpip/main.c Modified: branches/GSoC_2011/TcpIpDriver/drivers/network/afd/afd/bind.c URL:
http://svn.reactos.org/svn/reactos/branches/GSoC_2011/TcpIpDriver/drivers/n…
============================================================================== --- branches/GSoC_2011/TcpIpDriver/drivers/network/afd/afd/bind.c [iso-8859-1] (original) +++ branches/GSoC_2011/TcpIpDriver/drivers/network/afd/afd/bind.c [iso-8859-1] Fri Jun 10 09:24:29 2011 @@ -65,6 +65,7 @@ PAFD_BIND_DATA BindReq; AFD_DbgPrint(MID_TRACE,("Called\n")); + DbgPrint("[AFD, AfdBindSocket] Called\n"); if ( !SocketAcquireStateLock( FCB ) ) return LostSocket( Irp ); @@ -109,6 +110,8 @@ if (NT_SUCCESS(Status)) FCB->State = SOCKET_STATE_BOUND; + DbgPrint("[AFD, AfdBindSocket] Leaving\n"); + /* MSAFD relies on us returning the address file handle in the IOSB */ return UnlockAndMaybeComplete( FCB, Status, Irp, (ULONG_PTR)FCB->AddressFile.Handle ); } Modified: branches/GSoC_2011/TcpIpDriver/drivers/network/afd/afd/listen.c URL:
http://svn.reactos.org/svn/reactos/branches/GSoC_2011/TcpIpDriver/drivers/n…
============================================================================== --- branches/GSoC_2011/TcpIpDriver/drivers/network/afd/afd/listen.c [iso-8859-1] (original) +++ branches/GSoC_2011/TcpIpDriver/drivers/network/afd/afd/listen.c [iso-8859-1] Fri Jun 10 09:24:29 2011 @@ -114,22 +114,22 @@ NTSTATUS Status = STATUS_SUCCESS; PAFD_FCB FCB = (PAFD_FCB)Context; PAFD_TDI_OBJECT_QELT Qelt; - PLIST_ENTRY NextIrpEntry, QeltEntry; + PLIST_ENTRY NextIrpEntry; PIRP NextIrp; DbgPrint("[AFD, ListenComplete] Called\n"); - if( !SocketAcquireStateLock( FCB ) ) + if ( !SocketAcquireStateLock( FCB ) ) return STATUS_FILE_CLOSED; FCB->ListenIrp.InFlightRequest = NULL; DbgPrint("[AFD, ListenComplete] FCB->State = 0x%x (should be 0x%x)\n", FCB->State, SOCKET_STATE_CLOSED); - if( FCB->State == SOCKET_STATE_CLOSED ) + if ( FCB->State == SOCKET_STATE_CLOSED ) { /* Cleanup our IRP queue because the FCB is being destroyed */ - while( !IsListEmpty( &FCB->PendingIrpList[FUNCTION_PREACCEPT] ) ) + while ( !IsListEmpty( &FCB->PendingIrpList[FUNCTION_PREACCEPT] ) ) { NextIrpEntry = RemoveHeadList(&FCB->PendingIrpList[FUNCTION_PREACCEPT]); NextIrp = CONTAINING_RECORD(NextIrpEntry, IRP, Tail.Overlay.ListEntry); @@ -140,13 +140,6 @@ IoCompleteRequest( NextIrp, IO_NETWORK_INCREMENT ); } - /* Free all pending connections */ - while( !IsListEmpty( &FCB->PendingConnections ) ) { - QeltEntry = RemoveHeadList(&FCB->PendingConnections); - Qelt = CONTAINING_RECORD(QeltEntry, AFD_TDI_OBJECT_QELT, ListEntry); - ExFreePool(Qelt); - } - /* Free ConnectionReturnInfo and ConnectionCallInfo */ if (FCB->ListenIrp.ConnectionReturnInfo) { @@ -165,7 +158,13 @@ } AFD_DbgPrint(MID_TRACE,("Completing listen request.\n")); - AFD_DbgPrint(MID_TRACE,("IoStatus was %x\n", FCB->ListenIrp.Iosb.Status)); + AFD_DbgPrint(MID_TRACE,("IoStatus was %x\n", Irp->IoStatus.Status)); + + if (Irp->IoStatus.Status != STATUS_SUCCESS) + { + SocketStateUnlock(FCB); + return Irp->IoStatus.Status; + } DbgPrint("[AFD, ListenComplete] Completing listen request.\n"); DbgPrint("[AFD, ListenComplete] IoStatus was %x\n", FCB->ListenIrp.Iosb.Status); @@ -202,7 +201,7 @@ } /* Satisfy a pre-accept request if one is available */ - if( !IsListEmpty( &FCB->PendingIrpList[FUNCTION_PREACCEPT] ) && + if ( !IsListEmpty( &FCB->PendingIrpList[FUNCTION_PREACCEPT] ) && !IsListEmpty( &FCB->PendingConnections ) ) { PLIST_ENTRY PendingIrp = @@ -240,7 +239,7 @@ } /* Trigger a select return if appropriate */ - if( !IsListEmpty( &FCB->PendingConnections ) ) + if ( !IsListEmpty( &FCB->PendingConnections ) ) { FCB->PollState |= AFD_EVENT_ACCEPT; FCB->PollStatus[FD_ACCEPT_BIT] = STATUS_SUCCESS; Modified: branches/GSoC_2011/TcpIpDriver/drivers/network/afd/afd/lock.c URL:
http://svn.reactos.org/svn/reactos/branches/GSoC_2011/TcpIpDriver/drivers/n…
============================================================================== --- branches/GSoC_2011/TcpIpDriver/drivers/network/afd/afd/lock.c [iso-8859-1] (original) +++ branches/GSoC_2011/TcpIpDriver/drivers/network/afd/afd/lock.c [iso-8859-1] Fri Jun 10 09:24:29 2011 @@ -252,10 +252,38 @@ } NTSTATUS LeaveIrpUntilLater( PAFD_FCB FCB, PIRP Irp, UINT Function ) { + NTSTATUS Status; + + /* Add the IRP to the queue in all cases (so AfdCancelHandler will work properly) */ InsertTailList( &FCB->PendingIrpList[Function], - &Irp->Tail.Overlay.ListEntry ); - IoMarkIrpPending(Irp); - (void)IoSetCancelRoutine(Irp, AfdCancelHandler); + &Irp->Tail.Overlay.ListEntry ); + + /* Acquire the cancel spin lock and check the cancel bit */ + IoAcquireCancelSpinLock(&Irp->CancelIrql); + if (!Irp->Cancel) + { + /* We are not cancelled; we're good to go so + * set the cancel routine, release the cancel spin lock, + * mark the IRP as pending, and + * return STATUS_PENDING to the caller + */ + (void)IoSetCancelRoutine(Irp, AfdCancelHandler); + IoReleaseCancelSpinLock(Irp->CancelIrql); + IoMarkIrpPending(Irp); + Status = STATUS_PENDING; + } + else + { + /* We were already cancelled before we were able to register our cancel routine + * so we are to call the cancel routine ourselves right here to cancel the IRP + * (which handles all the stuff we do above) and return STATUS_CANCELLED to the caller + */ + AfdCancelHandler(IoGetCurrentIrpStackLocation(Irp)->DeviceObject, + Irp); + Status = STATUS_CANCELLED; + } + SocketStateUnlock( FCB ); - return STATUS_PENDING; -} + + return Status; +} Modified: branches/GSoC_2011/TcpIpDriver/drivers/network/afd/afd/main.c URL:
http://svn.reactos.org/svn/reactos/branches/GSoC_2011/TcpIpDriver/drivers/n…
============================================================================== --- branches/GSoC_2011/TcpIpDriver/drivers/network/afd/afd/main.c [iso-8859-1] (original) +++ branches/GSoC_2011/TcpIpDriver/drivers/network/afd/afd/main.c [iso-8859-1] Fri Jun 10 09:24:29 2011 @@ -258,7 +258,7 @@ AFD_DbgPrint(MID_TRACE, ("AfdCreate(DeviceObject %p Irp %p)\n", DeviceObject, Irp)); - DbgPrint("[AfdCreate] Created socket\n"); + DbgPrint("[AFD, AfdCreate] Called\n"); DeviceExt = DeviceObject->DeviceExtension; FileObject = IrpSp->FileObject; @@ -368,6 +368,8 @@ Irp->IoStatus.Status = Status; IoCompleteRequest( Irp, IO_NETWORK_INCREMENT ); + DbgPrint("[AFD, AfdCreate] Leaving. Status = 0x%x\n"); + return Status; } @@ -383,10 +385,12 @@ DbgPrint("[AFD, AfdCleanupSocket] Called\n"); - if( !SocketAcquireStateLock( FCB ) ) return LostSocket(Irp); + if ( !SocketAcquireStateLock( FCB ) ) + return LostSocket(Irp); for (Function = 0; Function < MAX_FUNCTIONS; Function++) { + /* Cancel IRPs from MSAFD to AFD (pending IRPs) */ CurrentEntry = FCB->PendingIrpList[Function].Flink; while (CurrentEntry != &FCB->PendingIrpList[Function]) { @@ -415,15 +419,18 @@ PAFD_FCB FCB = FileObject->FsContext; UINT i; PAFD_IN_FLIGHT_REQUEST InFlightRequest[IN_FLIGHT_REQUESTS]; + PAFD_TDI_OBJECT_QELT Qelt; + PLIST_ENTRY QeltEntry; + AFD_DbgPrint(MID_TRACE, ("AfdClose(DeviceObject %p Irp %p)\n", DeviceObject, Irp)); - DbgPrint("[AfdCloseSocket] Called\n"); + DbgPrint("[AFD, AfdCloseSocket] Called\n"); if( !SocketAcquireStateLock( FCB ) ) return STATUS_FILE_CLOSED; - DbgPrint("[AfdCloseSocket] Setting closed state\n"); + DbgPrint("[AFD, AfdCloseSocket] Setting closed state\n"); FCB->State = SOCKET_STATE_CLOSED; FCB->PollState = AFD_EVENT_CLOSE; @@ -435,7 +442,8 @@ InFlightRequest[2] = &FCB->SendIrp; InFlightRequest[3] = &FCB->ConnectIrp; - /* Cancel our pending requests */ + /* Cancel our pending _In Flight_ IRPs + That is IRPs from AFD -> tcpip*/ for( i = 0; i < IN_FLIGHT_REQUESTS; i++ ) { if( InFlightRequest[i]->InFlightRequest ) @@ -448,6 +456,24 @@ KillSelectsForFCB( FCB->DeviceExt, FileObject, FALSE ); + ASSERT(IsListEmpty(&FCB->PendingIrpList[FUNCTION_CONNECT])); + ASSERT(IsListEmpty(&FCB->PendingIrpList[FUNCTION_SEND])); + ASSERT(IsListEmpty(&FCB->PendingIrpList[FUNCTION_RECV])); + ASSERT(IsListEmpty(&FCB->PendingIrpList[FUNCTION_PREACCEPT])); + + while (!IsListEmpty(&FCB->PendingConnections)) + { + QeltEntry = RemoveHeadList(&FCB->PendingConnections); + Qelt = CONTAINING_RECORD(QeltEntry, AFD_TDI_OBJECT_QELT, ListEntry); + + /* We have to close all pending connections or the listen won't get closed */ + TdiDisassociateAddressFile(Qelt->Object.Object); + ObDereferenceObject(Qelt->Object.Object); + ZwClose(Qelt->Object.Handle); + + ExFreePool(Qelt); + } + SocketStateUnlock( FCB ); if( FCB->EventSelect ) @@ -489,7 +515,7 @@ if( FCB->Connection.Object ) { TdiDisassociateAddressFile(FCB->Connection.Object); - ObDereferenceObject(FCB->Connection.Object); + ObDereferenceObject(FCB->Connection.Object); } if( FCB->AddressFile.Object ) @@ -499,7 +525,7 @@ { if (ZwClose(FCB->AddressFile.Handle) == STATUS_INVALID_HANDLE) { - DbgPrint("[AfdCloseSocket] INVALID ADDRESS FILE HANDLE VALUE: %x %x\n", FCB->AddressFile.Handle, FCB->AddressFile.Object); + DbgPrint("[AFD, AfdCloseSocket] INVALID ADDRESS FILE HANDLE VALUE: %x %x\n", FCB->AddressFile.Handle, FCB->AddressFile.Object); } } @@ -507,7 +533,7 @@ { if (ZwClose(FCB->Connection.Handle) == STATUS_INVALID_HANDLE) { - DbgPrint("[AfdCloseSocket] INVALID CONNECTION HANDLE VALUE: %x %x\n", FCB->Connection.Handle, FCB->Connection.Object); + DbgPrint("[AFD, AfdCloseSocket] INVALID CONNECTION HANDLE VALUE: %x %x\n", FCB->Connection.Handle, FCB->Connection.Object); } } @@ -521,7 +547,7 @@ IoCompleteRequest(Irp, IO_NETWORK_INCREMENT); AFD_DbgPrint(MID_TRACE, ("Returning success.\n")); - DbgPrint("[AfdCloseSocket] Leaving\n"); + DbgPrint("[AFD, AfdCloseSocket] Leaving\n"); return STATUS_SUCCESS; } @@ -793,6 +819,33 @@ return (Status); } +VOID +CleanupPendingIrp(PIRP Irp, PIO_STACK_LOCATION IrpSp, PAFD_ACTIVE_POLL Poll) +{ + PAFD_RECV_INFO RecvReq; + PAFD_SEND_INFO SendReq; + PAFD_POLL_INFO PollReq; + + if (IrpSp->Parameters.DeviceIoControl.IoControlCode == IOCTL_AFD_RECV || + IrpSp->MajorFunction == IRP_MJ_READ) + { + RecvReq = IrpSp->Parameters.DeviceIoControl.Type3InputBuffer; + UnlockBuffers(RecvReq->BufferArray, RecvReq->BufferCount, FALSE); + } + else if (IrpSp->Parameters.DeviceIoControl.IoControlCode == IOCTL_AFD_SEND || + IrpSp->MajorFunction == IRP_MJ_WRITE) + { + SendReq = IrpSp->Parameters.DeviceIoControl.Type3InputBuffer; + UnlockBuffers(SendReq->BufferArray, SendReq->BufferCount, FALSE); + } + else if (IrpSp->Parameters.DeviceIoControl.IoControlCode == IOCTL_AFD_SELECT) + { + PollReq = Irp->AssociatedIrp.SystemBuffer; + ZeroEvents(PollReq->Handles, PollReq->HandleCount); + SignalSocket(Poll, NULL, PollReq, STATUS_CANCELLED); + } +} + VOID NTAPI AfdCancelHandler(PDEVICE_OBJECT DeviceObject, PIRP Irp) @@ -800,39 +853,46 @@ PIO_STACK_LOCATION IrpSp = IoGetCurrentIrpStackLocation(Irp); PFILE_OBJECT FileObject = IrpSp->FileObject; PAFD_FCB FCB = FileObject->FsContext; - UINT Function; - PAFD_RECV_INFO RecvReq; - PAFD_SEND_INFO SendReq; + ULONG Function, IoctlCode; + PIRP CurrentIrp; PLIST_ENTRY CurrentEntry; - PIRP CurrentIrp; PAFD_DEVICE_EXTENSION DeviceExt = DeviceObject->DeviceExtension; KIRQL OldIrql; PAFD_ACTIVE_POLL Poll; - PAFD_POLL_INFO PollReq; IoReleaseCancelSpinLock(Irp->CancelIrql); - + if (!SocketAcquireStateLock(FCB)) return; - - ASSERT(IrpSp->MajorFunction == IRP_MJ_DEVICE_CONTROL); - - switch (IrpSp->Parameters.DeviceIoControl.IoControlCode) + + switch (IrpSp->MajorFunction) + { + case IRP_MJ_DEVICE_CONTROL: + IoctlCode = IrpSp->Parameters.DeviceIoControl.IoControlCode; + break; + + case IRP_MJ_READ: + IoctlCode = IOCTL_AFD_RECV; + break; + + case IRP_MJ_WRITE: + IoctlCode = IOCTL_AFD_SEND; + break; + + default: + ASSERT(FALSE); + SocketStateUnlock(FCB); + return; + } + + switch (IoctlCode) { case IOCTL_AFD_RECV: - RecvReq = IrpSp->Parameters.DeviceIoControl.Type3InputBuffer; - UnlockBuffers(RecvReq->BufferArray, RecvReq->BufferCount, FALSE); - /* Fall through */ - case IOCTL_AFD_RECV_DATAGRAM: Function = FUNCTION_RECV; break; case IOCTL_AFD_SEND: - SendReq = IrpSp->Parameters.DeviceIoControl.Type3InputBuffer; - UnlockBuffers(SendReq->BufferArray, SendReq->BufferCount, FALSE); - /* Fall through */ - case IOCTL_AFD_SEND_DATAGRAM: Function = FUNCTION_SEND; break; @@ -852,14 +912,13 @@ while (CurrentEntry != &DeviceExt->Polls) { Poll = CONTAINING_RECORD(CurrentEntry, AFD_ACTIVE_POLL, ListEntry); - CurrentIrp = Poll->Irp; - PollReq = CurrentIrp->AssociatedIrp.SystemBuffer; - - if (CurrentIrp == Irp) + + if (Irp == Poll->Irp) { - ZeroEvents(PollReq->Handles, PollReq->HandleCount); - SignalSocket(Poll, NULL, PollReq, STATUS_CANCELLED); - break; + CleanupPendingIrp(Irp, IrpSp, Poll); + KeReleaseSpinLock(&DeviceExt->Lock, OldIrql); + SocketStateUnlock(FCB); + return; } else { @@ -869,8 +928,9 @@ KeReleaseSpinLock(&DeviceExt->Lock, OldIrql); - /* IRP already completed by SignalSocket */ SocketStateUnlock(FCB); + + DbgPrint("WARNING!!! IRP cancellation race could lead to a process hang! (IOCTL_AFD_SELECT)\n"); return; default: @@ -887,7 +947,9 @@ if (CurrentIrp == Irp) { RemoveEntryList(CurrentEntry); - break; + CleanupPendingIrp(Irp, IrpSp, NULL); + UnlockAndMaybeComplete(FCB, STATUS_CANCELLED, Irp, 0); + return; } else { @@ -895,7 +957,9 @@ } } - UnlockAndMaybeComplete(FCB, STATUS_CANCELLED, Irp, 0); + SocketStateUnlock(FCB); + + DbgPrint("WARNING!!! IRP cancellation race could lead to a process hang! (Function: %d)\n", Function); } static VOID NTAPI Modified: branches/GSoC_2011/TcpIpDriver/drivers/network/afd/afd/write.c URL:
http://svn.reactos.org/svn/reactos/branches/GSoC_2011/TcpIpDriver/drivers/n…
============================================================================== --- branches/GSoC_2011/TcpIpDriver/drivers/network/afd/afd/write.c [iso-8859-1] (original) +++ branches/GSoC_2011/TcpIpDriver/drivers/network/afd/afd/write.c [iso-8859-1] Fri Jun 10 09:24:29 2011 @@ -185,9 +185,12 @@ FCB->SendIrp.InFlightRequest = NULL; /* Request is not in flight any longer */ - FCB->PollState |= AFD_EVENT_SEND; - FCB->PollStatus[FD_WRITE_BIT] = STATUS_SUCCESS; - PollReeval( FCB->DeviceExt, FCB->FileObject ); + if (Irp->IoStatus.Status == STATUS_SUCCESS) + { + FCB->PollState |= AFD_EVENT_SEND; + FCB->PollStatus[FD_WRITE_BIT] = STATUS_SUCCESS; + PollReeval( FCB->DeviceExt, FCB->FileObject ); + } if( FCB->State == SOCKET_STATE_CLOSED ) { /* Cleanup our IRP queue because the FCB is being destroyed */ Modified: branches/GSoC_2011/TcpIpDriver/drivers/network/tcpip/tcpip/dispatch.c URL:
http://svn.reactos.org/svn/reactos/branches/GSoC_2011/TcpIpDriver/drivers/n…
============================================================================== --- branches/GSoC_2011/TcpIpDriver/drivers/network/tcpip/tcpip/dispatch.c [iso-8859-1] (original) +++ branches/GSoC_2011/TcpIpDriver/drivers/network/tcpip/tcpip/dispatch.c [iso-8859-1] Fri Jun 10 09:24:29 2011 @@ -647,21 +647,22 @@ * when a new connection arrives. */ /* The important thing to note here is that the irp we'll complete belongs * to the socket to be accepted onto, not the listener */ - if( NT_SUCCESS(Status) && !Connection->AddressFile->Listener ) + if ( NT_SUCCESS(Status) && !Connection->AddressFile->Listener ) { Connection->AddressFile->Listener = TCPAllocateConnectionEndpoint( NULL ); - if( !Connection->AddressFile->Listener ) + if ( !Connection->AddressFile->Listener ) Status = STATUS_NO_MEMORY; - if( NT_SUCCESS(Status) ) { + if ( NT_SUCCESS(Status) ) + { Connection->AddressFile->Listener->AddressFile = Connection->AddressFile; - Status = TCPSocket( Connection->AddressFile->Listener, - Connection->AddressFile->Family, - SOCK_STREAM, - Connection->AddressFile->Protocol ); + Status = TCPSocket( Connection->AddressFile->Listener, + Connection->AddressFile->Family, + SOCK_STREAM, + Connection->AddressFile->Protocol ); } if ( NT_SUCCESS(Status) ) Modified: branches/GSoC_2011/TcpIpDriver/drivers/network/tcpip/tcpip/fileobjs.c URL:
http://svn.reactos.org/svn/reactos/branches/GSoC_2011/TcpIpDriver/drivers/n…
============================================================================== --- branches/GSoC_2011/TcpIpDriver/drivers/network/tcpip/tcpip/fileobjs.c [iso-8859-1] (original) +++ branches/GSoC_2011/TcpIpDriver/drivers/network/tcpip/tcpip/fileobjs.c [iso-8859-1] Fri Jun 10 09:24:29 2011 @@ -239,6 +239,7 @@ PADDRESS_FILE AddrFile; TI_DbgPrint(MID_TRACE, ("Called (Proto %d).\n", Protocol)); + DbgPrint("[TCPIP, FileOpenAddress] Called. Proto %d\n", Protocol); AddrFile = ExAllocatePoolWithTag(NonPagedPool, sizeof(ADDRESS_FILE), ADDR_FILE_TAG); @@ -359,6 +360,7 @@ &AddressFileListLock); TI_DbgPrint(MAX_TRACE, ("Leaving.\n")); + DbgPrint("[TCPIP, FileOpenAddress] Leaving\n"); return STATUS_SUCCESS; } @@ -376,6 +378,8 @@ { PADDRESS_FILE AddrFile = Request->Handle.AddressHandle; KIRQL OldIrql; + + DbgPrint("[TCPIP, FileCloseAddress] Called\n"); if (!Request->Handle.AddressHandle) return STATUS_INVALID_PARAMETER; @@ -393,6 +397,7 @@ DereferenceObject(AddrFile); TI_DbgPrint(MAX_TRACE, ("Leaving.\n")); + DbgPrint("[TCPIP, FileCloseAddress] Leaving\n"); return STATUS_SUCCESS; } Modified: branches/GSoC_2011/TcpIpDriver/drivers/network/tcpip/tcpip/main.c URL:
http://svn.reactos.org/svn/reactos/branches/GSoC_2011/TcpIpDriver/drivers/n…
============================================================================== --- branches/GSoC_2011/TcpIpDriver/drivers/network/tcpip/tcpip/main.c [iso-8859-1] (original) +++ branches/GSoC_2011/TcpIpDriver/drivers/network/tcpip/tcpip/main.c [iso-8859-1] Fri Jun 10 09:24:29 2011 @@ -260,43 +260,50 @@ PDEVICE_OBJECT DeviceObject, PIRP Irp) { - PIO_STACK_LOCATION IrpSp; - PTRANSPORT_CONTEXT Context; - TDI_REQUEST Request; - NTSTATUS Status; - - IrpSp = IoGetCurrentIrpStackLocation(Irp); - Context = IrpSp->FileObject->FsContext; - if (!Context) { - TI_DbgPrint(MIN_TRACE, ("Parameters are invalid.\n")); - return STATUS_INVALID_PARAMETER; - } - - switch ((ULONG_PTR)IrpSp->FileObject->FsContext2) { - case TDI_TRANSPORT_ADDRESS_FILE: - Request.Handle.AddressHandle = Context->Handle.AddressHandle; - Status = FileCloseAddress(&Request); - break; - - case TDI_CONNECTION_FILE: - Request.Handle.ConnectionContext = Context->Handle.ConnectionContext; - Status = FileCloseConnection(&Request); - break; - - case TDI_CONTROL_CHANNEL_FILE: - Request.Handle.ControlChannel = Context->Handle.ControlChannel; - Status = FileCloseControlChannel(&Request); - break; - - default: - DbgPrint("Unknown type %d\n", (ULONG_PTR)IrpSp->FileObject->FsContext2); - Status = STATUS_INVALID_PARAMETER; - break; - } - - Irp->IoStatus.Status = Status; - - return Irp->IoStatus.Status; + PIO_STACK_LOCATION IrpSp; + PTRANSPORT_CONTEXT Context; + TDI_REQUEST Request; + NTSTATUS Status; + + DbgPrint("[TCPIP, TiCloseFileObject] Called\n"); + + IrpSp = IoGetCurrentIrpStackLocation(Irp); + Context = IrpSp->FileObject->FsContext; + if (!Context) + { + TI_DbgPrint(MIN_TRACE, ("Parameters are invalid.\n")); + return STATUS_INVALID_PARAMETER; + } + + switch ((ULONG_PTR)IrpSp->FileObject->FsContext2) + { + case TDI_TRANSPORT_ADDRESS_FILE: + DbgPrint("[TCPIP, TiCloseFileObject] Closing address file\n"); + Request.Handle.AddressHandle = Context->Handle.AddressHandle; + Status = FileCloseAddress(&Request); + break; + + case TDI_CONNECTION_FILE: + Request.Handle.ConnectionContext = Context->Handle.ConnectionContext; + Status = FileCloseConnection(&Request); + break; + + case TDI_CONTROL_CHANNEL_FILE: + Request.Handle.ControlChannel = Context->Handle.ControlChannel; + Status = FileCloseControlChannel(&Request); + break; + + default: + DbgPrint("Unknown type %d\n", (ULONG_PTR)IrpSp->FileObject->FsContext2); + Status = STATUS_INVALID_PARAMETER; + break; + } + + Irp->IoStatus.Status = Status; + + DbgPrint("[TCPIP, TiCloseFileObject] Leaving. Status = 0x%x\n", Status); + + return Irp->IoStatus.Status; }
13 years, 6 months
1
0
0
0
[nyadav] 52169: [AUDSRV] More Style Fixes
by nyadav@svn.reactos.org
Author: nyadav Date: Fri Jun 10 07:00:52 2011 New Revision: 52169 URL:
http://svn.reactos.org/svn/reactos?rev=52169&view=rev
Log: [AUDSRV] More Style Fixes Modified: branches/nyadav-audio-branch/base/services/audsrv/mixer.c branches/nyadav-audio-branch/base/services/audsrv/rpc.c branches/nyadav-audio-branch/base/services/audsrv/stream.c branches/nyadav-audio-branch/dll/win32/audsrvapi/audsrvapi.c branches/nyadav-audio-branch/drivers/wdm/audio/backpln/audclient/audclient.c Modified: branches/nyadav-audio-branch/base/services/audsrv/mixer.c URL:
http://svn.reactos.org/svn/reactos/branches/nyadav-audio-branch/base/servic…
============================================================================== --- branches/nyadav-audio-branch/base/services/audsrv/mixer.c [iso-8859-1] (original) +++ branches/nyadav-audio-branch/base/services/audsrv/mixer.c [iso-8859-1] Fri Jun 10 07:00:52 2011 @@ -8,96 +8,106 @@ */ #include "audsrv.h" -void * MixS8(MixerEngine * mixer,int buffer) +void * MixS8(MixerEngine * mixer, + int buffer) { return NULL; } -void * MixS16(MixerEngine * mixer,int buffer) +void * MixS16(MixerEngine * mixer, + int buffer) { - int length=0; - short minsamplevalue,maxsamplevalue; - float coefficient = 1.0; - int streamcount = 0,i; - PSHORT localsinkbuf,localsrcbuf; - ServerStream * stream = mixer->serverstreamlist; + int length=0; + short minsamplevalue,maxsamplevalue; + float coefficient = 1.0; + int streamcount = 0,i; + PSHORT localsinkbuf,localsrcbuf; + ServerStream * stream = mixer->serverstreamlist; - /*TODOAssert(mixer->serverstreamlist == NULL)*/ + /*TODOAssert(mixer->serverstreamlist == NULL)*/ - /*Find the Longest Buffer within all ServerStreams*/ - length = stream->length_filtered; - while(stream->next != NULL) - { - if(stream->length_filtered > length && stream->ready == TRUE ) - length = stream->length_filtered; - stream = stream->next; - } + /*Find the Longest Buffer within all ServerStreams*/ + length = stream->length_filtered; + while(stream->next != NULL) + { + if(stream->length_filtered > length && stream->ready == TRUE ) + length = stream->length_filtered; + stream = stream->next; + } - /*Allocate MasterBuffer*/ + /*Allocate MasterBuffer*/ mixer->masterbuf[buffer] = HeapAlloc(GetProcessHeap(), 0, length); - localsinkbuf = mixer->masterbuf[buffer]; + localsinkbuf = mixer->masterbuf[buffer]; mixer->bytes_to_play = length; - /*Perform Actual Mixing*/ - stream = mixer->serverstreamlist; - minsamplevalue = *(short *) stream->minsamplevalue; - maxsamplevalue = *(short *) stream->maxsamplevalue; - while(stream->next != NULL) - { - localsrcbuf = stream->filteredbuf; - if(stream->ready == TRUE ) - { - if( *(short *)stream->maxsamplevalue != maxsamplevalue || - *(short *)stream->minsamplevalue != minsamplevalue ) - { - if( (float) maxsamplevalue / (float)*(short *)stream->maxsamplevalue < - (float) minsamplevalue / (float)*(short *)stream->minsamplevalue ) - coefficient = (float) maxsamplevalue / (float)*(short *)stream->maxsamplevalue; - else - coefficient = (float) minsamplevalue / (float)*(short *)stream->minsamplevalue; - - for(i=0;i<stream->length_filtered;i++) - { - localsinkbuf[i] = (short) (( (localsinkbuf[i] * streamcount) + ((short)((float) localsrcbuf[i] ) * coefficient) ) / (streamcount +1)); - } - } - } - stream->ready = 0; - streamcount++; - stream = stream->next; - } + /*Perform Actual Mixing*/ + stream = mixer->serverstreamlist; + minsamplevalue = *(short *) stream->minsamplevalue; + maxsamplevalue = *(short *) stream->maxsamplevalue; + while(stream->next != NULL) + { + localsrcbuf = stream->filteredbuf; + if(stream->ready == TRUE ) + { + if( *(short *)stream->maxsamplevalue != maxsamplevalue || + *(short *)stream->minsamplevalue != minsamplevalue ) + { + if( (float) maxsamplevalue / (float)*(short *)stream->maxsamplevalue < + (float) minsamplevalue / (float)*(short *)stream->minsamplevalue ) + coefficient = (float) maxsamplevalue / (float)*(short *)stream->maxsamplevalue; + else + coefficient = (float) minsamplevalue / (float)*(short *)stream->minsamplevalue; + + for(i=0;i<stream->length_filtered;i++) + { + localsinkbuf[i] = (short) (( (localsinkbuf[i] * streamcount) + ((short)((float) localsrcbuf[i] ) * coefficient) ) / (streamcount +1)); + } + } + } + stream->ready = 0; + streamcount++; + stream = stream->next; + } CopyMemory(mixer->masterbuf[buffer],mixer->serverstreamlist->filteredbuf,mixer->serverstreamlist->length_filtered); return NULL; } -void * MixS32(MixerEngine * mixer,int buffer) +void * MixS32(MixerEngine * mixer, + int buffer) { return NULL; } -void * MixS64(MixerEngine * mixer,int buffer) +void * MixS64(MixerEngine * mixer, + int buffer) { return NULL; } -void * MixU8(MixerEngine * mixer,int buffer) +void * MixU8(MixerEngine * mixer, + int buffer) { return NULL; } -void * MixU16(MixerEngine * mixer,int buffer) +void * MixU16(MixerEngine * mixer, + int buffer) { return NULL; } -void * MixU32(MixerEngine * mixer,int buffer) +void * MixU32(MixerEngine * mixer, + int buffer) { return NULL; } -void * MixU64(MixerEngine * mixer,int buffer) +void * MixU64(MixerEngine * mixer, + int buffer) { return NULL; } -void * MixFL32(MixerEngine * mixer,int buffer) +void * MixFL32(MixerEngine * mixer, + int buffer) { return NULL; } -void * MixFL64(MixerEngine * mixer,int buffer) +void * MixFL64(MixerEngine * mixer, + int buffer) { return NULL; } Modified: branches/nyadav-audio-branch/base/services/audsrv/rpc.c URL:
http://svn.reactos.org/svn/reactos/branches/nyadav-audio-branch/base/servic…
============================================================================== --- branches/nyadav-audio-branch/base/services/audsrv/rpc.c [iso-8859-1] (original) +++ branches/nyadav-audio-branch/base/services/audsrv/rpc.c [iso-8859-1] Fri Jun 10 07:00:52 2011 @@ -51,7 +51,15 @@ /*************************RPC Functions**********************************/ -long AUDInitStream( IN RPC_BINDING_HANDLE hBinding,LONG frequency,int channels,int bitspersample,int datatype, ULONG channelmask,int volume,int mute,float balance) +long AUDInitStream( IN RPC_BINDING_HANDLE hBinding, + LONG frequency, + int channels, + int bitspersample, + int datatype, + ULONG channelmask, + int volume, + int mute, + float balance ) { long stream; Modified: branches/nyadav-audio-branch/base/services/audsrv/stream.c URL:
http://svn.reactos.org/svn/reactos/branches/nyadav-audio-branch/base/servic…
============================================================================== --- branches/nyadav-audio-branch/base/services/audsrv/stream.c [iso-8859-1] (original) +++ branches/nyadav-audio-branch/base/services/audsrv/stream.c [iso-8859-1] Fri Jun 10 07:00:52 2011 @@ -88,7 +88,14 @@ /*Clean Stream's data*/ } -long AddStream(LONG frequency,int channels,int bitspersample,int datatype, ULONG channelmask,int volume,int mute,float balance) +long AddStream(LONG frequency, + int channels, + int bitspersample, + int datatype, + ULONG channelmask, + int volume, + int mute, + float balance ) { ServerStream * newstream,*localstream; DWORD dwID; Modified: branches/nyadav-audio-branch/dll/win32/audsrvapi/audsrvapi.c URL:
http://svn.reactos.org/svn/reactos/branches/nyadav-audio-branch/dll/win32/a…
============================================================================== --- branches/nyadav-audio-branch/dll/win32/audsrvapi/audsrvapi.c [iso-8859-1] (original) +++ branches/nyadav-audio-branch/dll/win32/audsrvapi/audsrvapi.c [iso-8859-1] Fri Jun 10 07:00:52 2011 @@ -14,7 +14,15 @@ /*Initialize an audio stream *Return -1 if callbacks are NULL pointers */ -WINAPI int InitStream (ClientStream * clientstream,LONG frequency,int channels,int bitspersample,int datatype, ULONG channelmask,int volume,int mute,float balance) +WINAPI int InitStream (ClientStream * clientstream, + LONG frequency, + int channels, + int bitspersample, + int datatype, + ULONG channelmask, + int volume, + int mute, + float balance) { long streamid; @@ -75,8 +83,8 @@ break; } - if(clientstream->dead) - break; + if(clientstream->dead) + break; /*Check Connection Status If not connected call Connect()*/ /*If connected Properly call the remote audsrv_play() function,This will be a blocking call, placing a dummy wait function here is a good idea.*/ @@ -98,17 +106,20 @@ return 0; } -WINAPI int Volume(ClientStream * clientstream, int * volume ) +WINAPI int Volume(ClientStream * clientstream, + int * volume ) { return 0; } -WINAPI int SetVolume(ClientStream * clientstream ,const int newvolume) +WINAPI int SetVolume(ClientStream * clientstream , + const int newvolume) { return 0; } -WINAPI int Write(ClientStream * clientstream ,const char * aData) +WINAPI int Write(ClientStream * clientstream , + const char * aData) { if(clientstream->dead) return -1; @@ -118,12 +129,14 @@ return 0; } -WINAPI int SetBalance(ClientStream * clientstream ,float balance) +WINAPI int SetBalance(ClientStream * clientstream , + float balance) { return 0; } -WINAPI int GetBalance(ClientStream * clientstream ,float * balance) +WINAPI int GetBalance(ClientStream * clientstream , + float * balance) { return 0; } Modified: branches/nyadav-audio-branch/drivers/wdm/audio/backpln/audclient/audclient.c URL:
http://svn.reactos.org/svn/reactos/branches/nyadav-audio-branch/drivers/wdm…
============================================================================== --- branches/nyadav-audio-branch/drivers/wdm/audio/backpln/audclient/audclient.c [iso-8859-1] (original) +++ branches/nyadav-audio-branch/drivers/wdm/audio/backpln/audclient/audclient.c [iso-8859-1] Fri Jun 10 07:00:52 2011 @@ -51,7 +51,8 @@ } int __cdecl -wmain(int argc, char* argv[]) +wmain(int argc, + char* argv[]) { int error; DWORD dwID;
13 years, 6 months
1
0
0
0
[tfaber] 52168: [KMTESTS] - add basic driver that can list/run tests and log messages
by tfaber@svn.reactos.org
Author: tfaber Date: Fri Jun 10 05:34:00 2011 New Revision: 52168 URL:
http://svn.reactos.org/svn/reactos?rev=52168&view=rev
Log: [KMTESTS] - add basic driver that can list/run tests and log messages Added: branches/GSoC_2011/KMTestSuite/kmtests/include/kmt_log.h (with props) branches/GSoC_2011/KMTestSuite/kmtests/include/kmt_test.h (with props) branches/GSoC_2011/KMTestSuite/kmtests/kmtest_drv/ (with props) branches/GSoC_2011/KMTestSuite/kmtests/kmtest_drv.rbuild (with props) branches/GSoC_2011/KMTestSuite/kmtests/kmtest_drv/kmtest_drv.c (with props) branches/GSoC_2011/KMTestSuite/kmtests/kmtest_drv/kmtest_drv.rc (with props) branches/GSoC_2011/KMTestSuite/kmtests/kmtest_drv/log.c (with props) branches/GSoC_2011/KMTestSuite/kmtests/kmtest_drv/testlist.c (with props) Modified: branches/GSoC_2011/KMTestSuite/kmtests/CMakeLists.txt branches/GSoC_2011/KMTestSuite/kmtests/directory.rbuild Modified: branches/GSoC_2011/KMTestSuite/kmtests/CMakeLists.txt URL:
http://svn.reactos.org/svn/reactos/branches/GSoC_2011/KMTestSuite/kmtests/C…
============================================================================== --- branches/GSoC_2011/KMTestSuite/kmtests/CMakeLists.txt [iso-8859-1] (original) +++ branches/GSoC_2011/KMTestSuite/kmtests/CMakeLists.txt [iso-8859-1] Fri Jun 10 05:34:00 2011 @@ -1,6 +1,32 @@ include_directories( include) +# +# subdirectories containing special-purpose drivers +# +#add_subdirectory(something) + +# +# kmtest_drv.sys driver +# +list(APPEND KMTEST_DRV_SOURCE + kmtest_drv/kmtest_drv.c + kmtest_drv/log.c + kmtest_drv/testlist.c + + kmtest_drv/kmtest_drv.rc) + +add_library(kmtest_drv SHARED ${KMTEST_DRV_SOURCE}) + +set_module_type(kmtest_drv kernelmodedriver) +target_link_libraries(kmtest_drv ${PSEH_LIB}) +add_importlibs(kmtest_drv ntoskrnl hal) + +add_cd_file(TARGET kmtest_drv DESTINATION reactos/system32/drivers FOR all) + +# +# kmtest.exe loader application +# set_rc_compiler() add_definitions(-D_DLL -D__USE_CRTIMP) Modified: branches/GSoC_2011/KMTestSuite/kmtests/directory.rbuild URL:
http://svn.reactos.org/svn/reactos/branches/GSoC_2011/KMTestSuite/kmtests/d…
============================================================================== --- branches/GSoC_2011/KMTestSuite/kmtests/directory.rbuild [iso-8859-1] (original) +++ branches/GSoC_2011/KMTestSuite/kmtests/directory.rbuild [iso-8859-1] Fri Jun 10 05:34:00 2011 @@ -5,4 +5,5 @@ <xi:include href="something/something_drv.rbuild" /> </directory>--> <xi:include href="kmtest.rbuild" /> + <xi:include href="kmtest_drv.rbuild" /> </group> Added: branches/GSoC_2011/KMTestSuite/kmtests/include/kmt_log.h URL:
http://svn.reactos.org/svn/reactos/branches/GSoC_2011/KMTestSuite/kmtests/i…
============================================================================== --- branches/GSoC_2011/KMTestSuite/kmtests/include/kmt_log.h (added) +++ branches/GSoC_2011/KMTestSuite/kmtests/include/kmt_log.h [iso-8859-1] Fri Jun 10 05:34:00 2011 @@ -1,0 +1,21 @@ +/* + * PROJECT: ReactOS kernel-mode tests + * LICENSE: GPLv2+ - See COPYING in the top level directory + * PURPOSE: Kernel-Mode Test Suite Driver logging function declarations + * PROGRAMMER: Thomas Faber <thfabba(a)gmx.de> + */ + +#ifndef _KMTEST_LOG_H_ +#define _KMTEST_LOG_H_ + +#include <ntddk.h> + +NTSTATUS LogInit(VOID); +VOID LogFree(VOID); + +VOID LogPrint(IN PCSTR Message); +VOID LogPrintF(IN PCSTR Format, ...); +VOID LogVPrintF(IN PCSTR Format, va_list Arguments); +SIZE_T LogRead(OUT PVOID Buffer, IN SIZE_T BufferSize); + +#endif /* !defined _KMTEST_LOG_H_ */ Propchange: branches/GSoC_2011/KMTestSuite/kmtests/include/kmt_log.h ------------------------------------------------------------------------------ svn:eol-style = native Added: branches/GSoC_2011/KMTestSuite/kmtests/include/kmt_test.h URL:
http://svn.reactos.org/svn/reactos/branches/GSoC_2011/KMTestSuite/kmtests/i…
============================================================================== --- branches/GSoC_2011/KMTestSuite/kmtests/include/kmt_test.h (added) +++ branches/GSoC_2011/KMTestSuite/kmtests/include/kmt_test.h [iso-8859-1] Fri Jun 10 05:34:00 2011 @@ -1,0 +1,25 @@ +/* + * PROJECT: ReactOS kernel-mode tests + * LICENSE: GPLv2+ - See COPYING in the top level directory + * PURPOSE: Kernel-Mode Test Suite test declarations + * PROGRAMMER: Thomas Faber <thfabba(a)gmx.de> + */ + +#ifndef _KMTEST_TEST_H_ +#define _KMTEST_TEST_H_ + +#include <kmt_log.h> + +typedef void KMT_TESTFUNC(void); + +typedef struct +{ + const char *TestName; + KMT_TESTFUNC *TestFunction; +} KMT_TEST, *PKMT_TEST; + +typedef const KMT_TEST CKMT_TEST, *PCKMT_TEST; + +extern const KMT_TEST TestList[]; + +#endif /* !defined _KMTEST_TEST_H_ */ Propchange: branches/GSoC_2011/KMTestSuite/kmtests/include/kmt_test.h ------------------------------------------------------------------------------ svn:eol-style = native Propchange: branches/GSoC_2011/KMTestSuite/kmtests/kmtest_drv/ ------------------------------------------------------------------------------ --- bugtraq:logregex (added) +++ bugtraq:logregex Fri Jun 10 05:34:00 2011 @@ -1,0 +1,2 @@ +([Ii]ssue|[Bb]ug)s? #?(\d+)(,? ?#?(\d+))*(,? ?(and |or )?#?(\d+))? +(\d+) Propchange: branches/GSoC_2011/KMTestSuite/kmtests/kmtest_drv/ ------------------------------------------------------------------------------ bugtraq:message = See issue #%BUGID% for more details. Propchange: branches/GSoC_2011/KMTestSuite/kmtests/kmtest_drv/ ------------------------------------------------------------------------------ bugtraq:url =
http://www.reactos.org/bugzilla/show_bug.cgi?id=%BUGID%
Propchange: branches/GSoC_2011/KMTestSuite/kmtests/kmtest_drv/ ------------------------------------------------------------------------------ tsvn:logminsize = 10 Added: branches/GSoC_2011/KMTestSuite/kmtests/kmtest_drv.rbuild URL:
http://svn.reactos.org/svn/reactos/branches/GSoC_2011/KMTestSuite/kmtests/k…
============================================================================== --- branches/GSoC_2011/KMTestSuite/kmtests/kmtest_drv.rbuild (added) +++ branches/GSoC_2011/KMTestSuite/kmtests/kmtest_drv.rbuild [iso-8859-1] Fri Jun 10 05:34:00 2011 @@ -1,0 +1,12 @@ +<module name="kmtest_drv" type="kernelmodedriver" installbase="system32/drivers" installname="kmtest_drv.sys"> + <include base="kmtest_drv">include</include> + <library>ntoskrnl</library> + <library>ntdll</library> + <library>hal</library> + <library>pseh</library> + <directory name="kmtest_drv"> + <file>kmtest_drv.c</file> + <file>log.c</file> + <file>testlist.c</file> + </directory> +</module> Propchange: branches/GSoC_2011/KMTestSuite/kmtests/kmtest_drv.rbuild ------------------------------------------------------------------------------ svn:eol-style = native Added: branches/GSoC_2011/KMTestSuite/kmtests/kmtest_drv/kmtest_drv.c URL:
http://svn.reactos.org/svn/reactos/branches/GSoC_2011/KMTestSuite/kmtests/k…
============================================================================== --- branches/GSoC_2011/KMTestSuite/kmtests/kmtest_drv/kmtest_drv.c (added) +++ branches/GSoC_2011/KMTestSuite/kmtests/kmtest_drv/kmtest_drv.c [iso-8859-1] Fri Jun 10 05:34:00 2011 @@ -1,0 +1,282 @@ +/* + * PROJECT: ReactOS kernel-mode tests + * LICENSE: GPLv2+ - See COPYING in the top level directory + * PURPOSE: Kernel-Mode Test Suite Driver + * PROGRAMMER: Thomas Faber <thfabba(a)gmx.de> + */ + +#include <ntddk.h> +#include <ntstrsafe.h> +#include <limits.h> + +//#define NDEBUG +#include <debug.h> + +#include <kmt_public.h> +#include <kmt_log.h> +#include <kmt_test.h> + +/* Prototypes */ +DRIVER_INITIALIZE DriverEntry; +static DRIVER_UNLOAD DriverUnload; +static DRIVER_DISPATCH DriverCreateClose; +static DRIVER_DISPATCH DriverIoControl; +static DRIVER_DISPATCH DriverRead; + +/* Globals */ +static PDEVICE_OBJECT MainDeviceObject; + +/* Entry */ +/** + * @name DriverEntry + * + * Driver Entry point. + * + * @param DriverObject + * Driver Object + * @param RegistryPath + * Driver Registry Path + * + * @return Status + */ +NTSTATUS NTAPI DriverEntry(IN PDRIVER_OBJECT DriverObject, IN PUNICODE_STRING RegistryPath) +{ + NTSTATUS Status = STATUS_SUCCESS; + UNICODE_STRING DeviceName; + PAGED_CODE(); + + UNREFERENCED_PARAMETER(RegistryPath); + + DPRINT("DriverEntry\n"); + + Status = LogInit(); + + if (!NT_SUCCESS(Status)) + goto cleanup; + + RtlInitUnicodeString(&DeviceName, L"\\Device\\Kmtest"); + Status = IoCreateDevice(DriverObject, 0, &DeviceName, FILE_DEVICE_UNKNOWN, + FILE_DEVICE_SECURE_OPEN | FILE_READ_ONLY_DEVICE, + TRUE, &MainDeviceObject); + + if (!NT_SUCCESS(Status)) + goto cleanup; + + DPRINT("DriverEntry. Created DeviceObject %p\n", + MainDeviceObject); + MainDeviceObject->Flags |= DO_DIRECT_IO; + + DriverObject->DriverUnload = DriverUnload; + DriverObject->MajorFunction[IRP_MJ_CREATE] = DriverCreateClose; + DriverObject->MajorFunction[IRP_MJ_CLOSE] = DriverCreateClose; + DriverObject->MajorFunction[IRP_MJ_DEVICE_CONTROL] = DriverIoControl; + DriverObject->MajorFunction[IRP_MJ_READ] = DriverRead; + +cleanup: + if (MainDeviceObject && !NT_SUCCESS(Status)) + { + IoDeleteDevice(MainDeviceObject); + MainDeviceObject = NULL; + } + + return Status; +} + +/* Dispatch functions */ +/** + * @name DriverUnload + * + * Driver cleanup funtion. + * + * @param DriverObject + * Driver Object + */ +static VOID NTAPI DriverUnload(IN PDRIVER_OBJECT DriverObject) +{ + PAGED_CODE(); + + UNREFERENCED_PARAMETER(DriverObject); + + DPRINT("DriverUnload\n"); + + if (MainDeviceObject) + IoDeleteDevice(MainDeviceObject); + + LogFree(); +} + +/** + * @name DriverCreateClose + * + * Driver Dispatch function for CreateFile/CloseHandle. + * + * @param DeviceObject + * Device Object + * @param Irp + * I/O request packet + * + * @return Status + */ +static NTSTATUS NTAPI DriverCreateClose(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp) +{ + NTSTATUS Status = STATUS_SUCCESS; + PIO_STACK_LOCATION IoStackLocation; + + PAGED_CODE(); + + IoStackLocation = IoGetCurrentIrpStackLocation(Irp); + + DPRINT("DriverCreateClose. Function=%s, DeviceObject=%p\n", + IoStackLocation->MajorFunction == IRP_MJ_CREATE ? "Create" : "Close", + DeviceObject); + + Irp->IoStatus.Status = Status; + Irp->IoStatus.Information = 0; + + IoCompleteRequest(Irp, IO_NO_INCREMENT); + + return Status; +} + +/** + * @name DriverIoControl + * + * Driver Dispatch function for DeviceIoControl. + * + * @param DeviceObject + * Device Object + * @param Irp + * I/O request packet + * + * @return Status + */ +static NTSTATUS NTAPI DriverIoControl(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp) +{ + NTSTATUS Status = STATUS_SUCCESS; + PIO_STACK_LOCATION IoStackLocation; + ULONG Length = 0; + + PAGED_CODE(); + + IoStackLocation = IoGetCurrentIrpStackLocation(Irp); + + DPRINT("DriverIoControl. Code=0x%08X, DeviceObject=%p\n", + IoStackLocation->Parameters.DeviceIoControl.IoControlCode, + DeviceObject); + + switch (IoStackLocation->Parameters.DeviceIoControl.IoControlCode) + { + case IOCTL_KMTEST_GET_TESTS: + { + PCKMT_TEST TestEntry; + LPSTR OutputBuffer = Irp->AssociatedIrp.SystemBuffer; + size_t Remaining = IoStackLocation->Parameters.DeviceIoControl.OutputBufferLength; + + DPRINT("DriverIoControl. IOCTL_KMTEST_GET_TESTS, outlen=%lu\n", + IoStackLocation->Parameters.DeviceIoControl.OutputBufferLength); + + for (TestEntry = TestList; TestEntry->TestName; ++TestEntry) + { + RtlStringCbCopyExA(OutputBuffer, Remaining, TestEntry->TestName, &OutputBuffer, &Remaining, 0); + if (Remaining) + { + *OutputBuffer++ = '\0'; + --Remaining; + } + } + if (Remaining) + { + *OutputBuffer++ = '\0'; + --Remaining; + } + Length = IoStackLocation->Parameters.DeviceIoControl.OutputBufferLength - Remaining; + break; + } + case IOCTL_KMTEST_RUN_TEST: + { + ANSI_STRING TestName; + PCKMT_TEST TestEntry; + + DPRINT("DriverIoControl. IOCTL_KMTEST_RUN_TEST, inlen=%lu, outlen=%lu\n", + IoStackLocation->Parameters.DeviceIoControl.InputBufferLength, + IoStackLocation->Parameters.DeviceIoControl.OutputBufferLength); + TestName.Length = TestName.MaximumLength = (USHORT)min(IoStackLocation->Parameters.DeviceIoControl.InputBufferLength, USHRT_MAX); + TestName.Buffer = Irp->AssociatedIrp.SystemBuffer; + DPRINT("DriverIoControl. Run test: %Z\n", &TestName); + + for (TestEntry = TestList; TestEntry->TestName; ++TestEntry) + { + ANSI_STRING EntryName; + RtlInitAnsiString(&EntryName, TestEntry->TestName); + + if (!RtlCompareString(&TestName, &EntryName, FALSE)) + { + DPRINT1("DriverIoControl. Starting test %Z\n", &EntryName); + TestEntry->TestFunction(); + DPRINT1("DriverIoControl. Finished test %Z\n", &EntryName); + break; + } + } + + if (!TestEntry->TestName) + Status = STATUS_OBJECT_NAME_INVALID; + + break; + } + default: + DPRINT1("DriverIoControl. Invalid IoCtl code 0x%08X\n", + IoStackLocation->Parameters.DeviceIoControl.IoControlCode); + Status = STATUS_INVALID_DEVICE_REQUEST; + break; + } + + Irp->IoStatus.Status = Status; + Irp->IoStatus.Information = Length; + + IoCompleteRequest(Irp, IO_NO_INCREMENT); + + return Status; +} + +/** + * @name DriverRead + * + * Driver Dispatch function for ReadFile. + * + * @param DeviceObject + * Device Object + * @param Irp + * I/O request packet + * + * @return Status + */ +static NTSTATUS NTAPI DriverRead(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp) +{ + NTSTATUS Status = STATUS_SUCCESS; + PIO_STACK_LOCATION IoStackLocation; + PVOID ReadBuffer; + SIZE_T Length; + + PAGED_CODE(); + + IoStackLocation = IoGetCurrentIrpStackLocation(Irp); + + DPRINT("DriverRead. Offset=%I64u, Length=%lu, DeviceObject=%p\n", + IoStackLocation->Parameters.Read.ByteOffset.QuadPart, + IoStackLocation->Parameters.Read.Length, + DeviceObject); + + ReadBuffer = MmGetSystemAddressForMdlSafe(Irp->MdlAddress, NormalPagePriority); + + Length = LogRead(ReadBuffer, IoStackLocation->Parameters.Read.Length); + + DPRINT("DriverRead. Length of data read: %lu\n", + Length); + + Irp->IoStatus.Status = Status; + Irp->IoStatus.Information = Length; + + IoCompleteRequest(Irp, IO_NO_INCREMENT); + + return Status; +} Propchange: branches/GSoC_2011/KMTestSuite/kmtests/kmtest_drv/kmtest_drv.c ------------------------------------------------------------------------------ svn:eol-style = native Added: branches/GSoC_2011/KMTestSuite/kmtests/kmtest_drv/kmtest_drv.rc URL:
http://svn.reactos.org/svn/reactos/branches/GSoC_2011/KMTestSuite/kmtests/k…
============================================================================== --- branches/GSoC_2011/KMTestSuite/kmtests/kmtest_drv/kmtest_drv.rc (added) +++ branches/GSoC_2011/KMTestSuite/kmtests/kmtest_drv/kmtest_drv.rc [iso-8859-1] Fri Jun 10 05:34:00 2011 @@ -1,0 +1,15 @@ +/* + * PROJECT: ReactOS kernel-mode tests + * LICENSE: GPLv2+ - See COPYING in the top level directory + * PURPOSE: Kernel-Mode Test Suite Driver Resource File + * PROGRAMMER: Thomas Faber <thfabba(a)gmx.de> + */ + +#include <windows.h> + +#define REACTOS_FILETYPE VFT_DRV +#define REACTOS_FILESUBTYPE VFT2_DRV_SYSTEM +#define REACTOS_STR_FILE_DESCRIPTION "ReactOS Kernel-Mode Test Suite Driver\0" +#define REACTOS_STR_INTERNAL_NAME "kmtest.sys\0" +#define REACTOS_STR_ORIGINAL_FILENAME "kmtest.sys\0" +#include <reactos/version.rc> Propchange: branches/GSoC_2011/KMTestSuite/kmtests/kmtest_drv/kmtest_drv.rc ------------------------------------------------------------------------------ svn:eol-style = native Added: branches/GSoC_2011/KMTestSuite/kmtests/kmtest_drv/log.c URL:
http://svn.reactos.org/svn/reactos/branches/GSoC_2011/KMTestSuite/kmtests/k…
============================================================================== --- branches/GSoC_2011/KMTestSuite/kmtests/kmtest_drv/log.c (added) +++ branches/GSoC_2011/KMTestSuite/kmtests/kmtest_drv/log.c [iso-8859-1] Fri Jun 10 05:34:00 2011 @@ -1,0 +1,151 @@ +/* + * PROJECT: ReactOS kernel-mode tests + * LICENSE: GPLv2+ - See COPYING in the top level directory + * PURPOSE: Kernel-Mode Test Suite Driver logging functions + * PROGRAMMER: Thomas Faber <thfabba(a)gmx.de> + */ + +#include <ntddk.h> +#include <ntstrsafe.h> + +#include <kmt_log.h> + +#define LOGBUFFER_MAX (1024UL * 1024) +static PCHAR LogBuffer; +static SIZE_T LogOffset; + +#define LOG_TAG 'LtmK' + +/* TODO: allow concurrent log buffer access */ + +/** + * @name LogInit + * + * Initialize logging mechanism. Call from DriverEntry. + * + * @return Status + */ +NTSTATUS LogInit(VOID) +{ + NTSTATUS Status = STATUS_SUCCESS; + PAGED_CODE(); + + LogBuffer = ExAllocatePoolWithTag(NonPagedPool, LOGBUFFER_MAX, LOG_TAG); + + if (!LogBuffer) + Status = STATUS_INSUFFICIENT_RESOURCES; + + return Status; +} + +/** + * @name LogFree + * + * Clean up logging mechanism. Call from Unload. + * + * @return None + */ +VOID LogFree(VOID) +{ + PAGED_CODE(); + + ExFreePoolWithTag(LogBuffer, LOG_TAG); +} + +/** + * @name LogPrint + * + * Print a log message. + * + * @param Message + * Ansi string to be logged + * + * @return None + */ +VOID LogPrint(IN PCSTR Message) +{ + SIZE_T MessageLength = strlen(Message); + ASSERT(LogOffset + MessageLength + 1 < LOGBUFFER_MAX); + RtlCopyMemory(&LogBuffer[LogOffset], Message, MessageLength + 1); + LogOffset += MessageLength; +} + +/** + * @name LogPrintF + * + * Print a formatted log message. + * + * @param Format + * printf-like format string + * @param ... + * Arguments corresponding to the format + * + * @return None + */ +VOID LogPrintF(IN PCSTR Format, ...) +{ + va_list Arguments; + PAGED_CODE(); + va_start(Arguments, Format); + LogVPrintF(Format, Arguments); + va_end(Arguments); +} + +/** + * @name LogVPrintF + * + * Print a formatted log message. + * + * @param Format + * printf-like format string + * @param Arguments + * Arguments corresponding to the format + * + * @return None + */ +VOID LogVPrintF(IN PCSTR Format, va_list Arguments) +{ + CHAR Buffer[1024]; + SIZE_T BufferLength; + /* TODO: make this work from any IRQL */ + PAGED_CODE(); + + RtlStringCbVPrintfA(Buffer, sizeof Buffer, Format, Arguments); + + BufferLength = strlen(Buffer); + ASSERT(LogOffset + BufferLength + 1 < LOGBUFFER_MAX); + RtlCopyMemory(&LogBuffer[LogOffset], Buffer, BufferLength + 1); + LogOffset += BufferLength; +} + +/** + * @name LogRead + * + * Retrieve data from the log buffer. + * + * @param Buffer + * Buffer to copy log data to + * @param BufferSize + * Maximum number of bytes to copy + * + * @return Number of bytes copied + */ +SIZE_T LogRead(OUT PVOID Buffer, IN SIZE_T BufferSize) +{ + SIZE_T Size; + PAGED_CODE(); + + Size = min(BufferSize, LogOffset); + RtlCopyMemory(Buffer, LogBuffer, Size); + + if (BufferSize < LogOffset) + { + SIZE_T SizeLeft = LogOffset - BufferSize; + RtlMoveMemory(LogBuffer, &LogBuffer[LogOffset], SizeLeft); + LogOffset = SizeLeft; + } + else + LogOffset = 0; + + return Size; +} Propchange: branches/GSoC_2011/KMTestSuite/kmtests/kmtest_drv/log.c ------------------------------------------------------------------------------ svn:eol-style = native Added: branches/GSoC_2011/KMTestSuite/kmtests/kmtest_drv/testlist.c URL:
http://svn.reactos.org/svn/reactos/branches/GSoC_2011/KMTestSuite/kmtests/k…
============================================================================== --- branches/GSoC_2011/KMTestSuite/kmtests/kmtest_drv/testlist.c (added) +++ branches/GSoC_2011/KMTestSuite/kmtests/kmtest_drv/testlist.c [iso-8859-1] Fri Jun 10 05:34:00 2011 @@ -1,0 +1,14 @@ +/* + * PROJECT: ReactOS kernel-mode tests + * LICENSE: GPLv2+ - See COPYING in the top level directory + * PURPOSE: Kernel-Mode Test Suite Driver test list + * PROGRAMMER: Thomas Faber <thfabba(a)gmx.de> + */ + +#include <stddef.h> +#include <kmt_test.h> + +const KMT_TEST TestList[] = +{ + { NULL, NULL } +}; Propchange: branches/GSoC_2011/KMTestSuite/kmtests/kmtest_drv/testlist.c ------------------------------------------------------------------------------ svn:eol-style = native
13 years, 6 months
1
0
0
0
[nyadav] 52167: [AUDSRV] mixer routine for signed 16 bit data
by nyadav@svn.reactos.org
Author: nyadav Date: Thu Jun 9 23:06:06 2011 New Revision: 52167 URL:
http://svn.reactos.org/svn/reactos?rev=52167&view=rev
Log: [AUDSRV] mixer routine for signed 16 bit data Modified: branches/nyadav-audio-branch/base/services/audsrv/audsrv.c branches/nyadav-audio-branch/base/services/audsrv/audsrv.h branches/nyadav-audio-branch/base/services/audsrv/mixer.c branches/nyadav-audio-branch/base/services/audsrv/stream.c branches/nyadav-audio-branch/drivers/wdm/audio/backpln/audclient/audclient.c branches/nyadav-audio-branch/include/reactos/libs/audsrv/audsrvapi.h Modified: branches/nyadav-audio-branch/base/services/audsrv/audsrv.c URL:
http://svn.reactos.org/svn/reactos/branches/nyadav-audio-branch/base/servic…
============================================================================== --- branches/nyadav-audio-branch/base/services/audsrv/audsrv.c [iso-8859-1] (original) +++ branches/nyadav-audio-branch/base/services/audsrv/audsrv.c [iso-8859-1] Thu Jun 9 23:06:06 2011 @@ -159,7 +159,7 @@ MixAndFill(MixerEngine * mixer, int buffer) { - while(WaitForSingleObject(mixer->streampresent, + while(WaitForSingleObject(mixer->newStreamEvent, 100) != 0) { if(mixer->dead) @@ -583,7 +583,7 @@ FALSE, NULL); - pengine->streampresent=CreateEvent(NULL, + pengine->newStreamEvent=CreateEvent(NULL, TRUE, FALSE, NULL); @@ -625,7 +625,7 @@ pengine->masterbuf[1] = NULL; pengine->played=CreateEvent(NULL,FALSE,FALSE,NULL); pengine->filled=CreateEvent(NULL,FALSE,FALSE,NULL); - pengine->streampresent=CreateEvent(NULL,TRUE,FALSE,NULL); + pengine->newStreamEvent=CreateEvent(NULL,TRUE,FALSE,NULL); SetConsoleCtrlHandler(Close,TRUE); SpawnMixerThread(pengine); SpawnPlayerThread(pengine); Modified: branches/nyadav-audio-branch/base/services/audsrv/audsrv.h URL:
http://svn.reactos.org/svn/reactos/branches/nyadav-audio-branch/base/servic…
============================================================================== --- branches/nyadav-audio-branch/base/services/audsrv/audsrv.h [iso-8859-1] (original) +++ branches/nyadav-audio-branch/base/services/audsrv/audsrv.h [iso-8859-1] Thu Jun 9 23:06:06 2011 @@ -69,7 +69,7 @@ long streamidpool; HANDLE played; HANDLE filled; - HANDLE streampresent; + HANDLE newStreamEvent; HANDLE mixerthread; HANDLE playerthread; HANDLE rpcthread; Modified: branches/nyadav-audio-branch/base/services/audsrv/mixer.c URL:
http://svn.reactos.org/svn/reactos/branches/nyadav-audio-branch/base/servic…
============================================================================== --- branches/nyadav-audio-branch/base/services/audsrv/mixer.c [iso-8859-1] (original) +++ branches/nyadav-audio-branch/base/services/audsrv/mixer.c [iso-8859-1] Thu Jun 9 23:06:06 2011 @@ -14,9 +14,58 @@ } void * MixS16(MixerEngine * mixer,int buffer) { - mixer->masterbuf[buffer] = HeapAlloc(GetProcessHeap(), 0, mixer->serverstreamlist->length_filtered); + int length=0; + short minsamplevalue,maxsamplevalue; + float coefficient = 1.0; + int streamcount = 0,i; + PSHORT localsinkbuf,localsrcbuf; + ServerStream * stream = mixer->serverstreamlist; + + /*TODOAssert(mixer->serverstreamlist == NULL)*/ + + /*Find the Longest Buffer within all ServerStreams*/ + length = stream->length_filtered; + while(stream->next != NULL) + { + if(stream->length_filtered > length && stream->ready == TRUE ) + length = stream->length_filtered; + stream = stream->next; + } + + /*Allocate MasterBuffer*/ + mixer->masterbuf[buffer] = HeapAlloc(GetProcessHeap(), 0, length); + localsinkbuf = mixer->masterbuf[buffer]; + mixer->bytes_to_play = length; + + /*Perform Actual Mixing*/ + stream = mixer->serverstreamlist; + minsamplevalue = *(short *) stream->minsamplevalue; + maxsamplevalue = *(short *) stream->maxsamplevalue; + while(stream->next != NULL) + { + localsrcbuf = stream->filteredbuf; + if(stream->ready == TRUE ) + { + if( *(short *)stream->maxsamplevalue != maxsamplevalue || + *(short *)stream->minsamplevalue != minsamplevalue ) + { + if( (float) maxsamplevalue / (float)*(short *)stream->maxsamplevalue < + (float) minsamplevalue / (float)*(short *)stream->minsamplevalue ) + coefficient = (float) maxsamplevalue / (float)*(short *)stream->maxsamplevalue; + else + coefficient = (float) minsamplevalue / (float)*(short *)stream->minsamplevalue; + + for(i=0;i<stream->length_filtered;i++) + { + localsinkbuf[i] = (short) (( (localsinkbuf[i] * streamcount) + ((short)((float) localsrcbuf[i] ) * coefficient) ) / (streamcount +1)); + } + } + } + stream->ready = 0; + streamcount++; + stream = stream->next; + } CopyMemory(mixer->masterbuf[buffer],mixer->serverstreamlist->filteredbuf,mixer->serverstreamlist->length_filtered); - mixer->bytes_to_play = mixer->serverstreamlist->length_filtered; return NULL; } Modified: branches/nyadav-audio-branch/base/services/audsrv/stream.c URL:
http://svn.reactos.org/svn/reactos/branches/nyadav-audio-branch/base/servic…
============================================================================== --- branches/nyadav-audio-branch/base/services/audsrv/stream.c [iso-8859-1] (original) +++ branches/nyadav-audio-branch/base/services/audsrv/stream.c [iso-8859-1] Thu Jun 9 23:06:06 2011 @@ -192,7 +192,7 @@ localstream = localstream->next; localstream->next = newstream; } - SetEvent(pengine->streampresent); + SetEvent(pengine->newStreamEvent); return newstream->streamid; error: Modified: branches/nyadav-audio-branch/drivers/wdm/audio/backpln/audclient/audclient.c URL:
http://svn.reactos.org/svn/reactos/branches/nyadav-audio-branch/drivers/wdm…
============================================================================== --- branches/nyadav-audio-branch/drivers/wdm/audio/backpln/audclient/audclient.c [iso-8859-1] (original) +++ branches/nyadav-audio-branch/drivers/wdm/audio/backpln/audclient/audclient.c [iso-8859-1] Thu Jun 9 23:06:06 2011 @@ -12,6 +12,9 @@ #include <audsrvapi.h> #include <stdio.h> +#include <debug.h> +#include <windows.h> +#include <winbase.h> void OpenComplete (int error ); void BufferCopied (int error ); @@ -28,7 +31,7 @@ DWORD WINAPI RunAudioThread(LPVOID param) { ClientStream * localstream = (ClientStream *) param; - playaudio(localstream); + PlayAudio(localstream); return 0; } @@ -45,7 +48,6 @@ } void PlayComplete (int error ) { - OutputDebugStringA("Playback Completed\n"); } int __cdecl @@ -55,11 +57,11 @@ DWORD dwID; HANDLE audiothread = NULL; char input='\0'; - OutputDebugStringA("ReactOS Audio Mixer Sample Client.Enter 'a' to Stop.\n"); + printf("ReactOS Audio Mixer Sample Client.Enter 'a' to Stop.\n"); //if (clientstream->callbacks.OpenComplete == NULL || clientstream->callbacks.BufferCopied == NULL || clientstream->callbacks.PlayComplete == NULL) printf(""); /*[out]HANDLE * streamhandle,[in] long frequency,[in] int number of channels,[in] int bitspersample,[in]ULONG channelmask,[in] int volume,[in] int mute,[in] float balance*/ - error = initstream ( &clientstream , + error = InitStream ( &clientstream , 44100 , 2 , 16 , @@ -71,20 +73,17 @@ if ( error ) { - OutputDebugStringA("Failed to Initialize Stream.Error \n"); goto error; } else { - OutputDebugStringA("StreamID : %ld\n",clientstream.stream); audiothread = CreateThread(NULL,0,RunAudioThread,&clientstream,0,&dwID); } while ( input != 'a' ) scanf("%c",&input); - OutputDebugStringA("Stoping Audio Stream.\n"); - stopaudio(&clientstream); + StopAudio(&clientstream); WaitForSingleObject(audiothread,INFINITE); return 0; Modified: branches/nyadav-audio-branch/include/reactos/libs/audsrv/audsrvapi.h URL:
http://svn.reactos.org/svn/reactos/branches/nyadav-audio-branch/include/rea…
============================================================================== --- branches/nyadav-audio-branch/include/reactos/libs/audsrv/audsrvapi.h [iso-8859-1] (original) +++ branches/nyadav-audio-branch/include/reactos/libs/audsrv/audsrvapi.h [iso-8859-1] Thu Jun 9 23:06:06 2011 @@ -24,7 +24,7 @@ } ClientStream; /********************API Functions******************/ -WINAPI int initstream (ClientStream * clientstream, +WINAPI int InitStream (ClientStream * clientstream, LONG frequency, int channels, int bitspersample, @@ -34,8 +34,8 @@ int mute, float balance); -WINAPI int playaudio ( ClientStream * clientstream); -WINAPI int stopaudio (ClientStream * clientstream ); +WINAPI int PlayAudio ( ClientStream * clientstream); +WINAPI int StopAudio (ClientStream * clientstream ); WINAPI int Volume(ClientStream * clientstream, int * volume );
13 years, 6 months
1
0
0
0
[cgutman] 52166: [AFD] - Cleanup the pending connection list before closing the FCB - Fixes yet another socket closure bug
by cgutman@svn.reactos.org
Author: cgutman Date: Thu Jun 9 22:38:38 2011 New Revision: 52166 URL:
http://svn.reactos.org/svn/reactos?rev=52166&view=rev
Log: [AFD] - Cleanup the pending connection list before closing the FCB - Fixes yet another socket closure bug Modified: trunk/reactos/drivers/network/afd/afd/listen.c trunk/reactos/drivers/network/afd/afd/main.c Modified: trunk/reactos/drivers/network/afd/afd/listen.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/afd/afd/li…
============================================================================== --- trunk/reactos/drivers/network/afd/afd/listen.c [iso-8859-1] (original) +++ trunk/reactos/drivers/network/afd/afd/listen.c [iso-8859-1] Thu Jun 9 22:38:38 2011 @@ -95,7 +95,7 @@ NTSTATUS Status = STATUS_SUCCESS; PAFD_FCB FCB = (PAFD_FCB)Context; PAFD_TDI_OBJECT_QELT Qelt; - PLIST_ENTRY NextIrpEntry, QeltEntry; + PLIST_ENTRY NextIrpEntry; PIRP NextIrp; if( !SocketAcquireStateLock( FCB ) ) @@ -113,13 +113,6 @@ if( NextIrp->MdlAddress ) UnlockRequest( NextIrp, IoGetCurrentIrpStackLocation( NextIrp ) ); (void)IoSetCancelRoutine(NextIrp, NULL); IoCompleteRequest( NextIrp, IO_NETWORK_INCREMENT ); - } - - /* Free all pending connections */ - while( !IsListEmpty( &FCB->PendingConnections ) ) { - QeltEntry = RemoveHeadList(&FCB->PendingConnections); - Qelt = CONTAINING_RECORD(QeltEntry, AFD_TDI_OBJECT_QELT, ListEntry); - ExFreePool(Qelt); } /* Free ConnectionReturnInfo and ConnectionCallInfo */ Modified: trunk/reactos/drivers/network/afd/afd/main.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/afd/afd/ma…
============================================================================== --- trunk/reactos/drivers/network/afd/afd/main.c [iso-8859-1] (original) +++ trunk/reactos/drivers/network/afd/afd/main.c [iso-8859-1] Thu Jun 9 22:38:38 2011 @@ -394,6 +394,9 @@ PAFD_FCB FCB = FileObject->FsContext; UINT i; PAFD_IN_FLIGHT_REQUEST InFlightRequest[IN_FLIGHT_REQUESTS]; + PAFD_TDI_OBJECT_QELT Qelt; + PLIST_ENTRY QeltEntry; + AFD_DbgPrint(MID_TRACE, ("AfdClose(DeviceObject %p Irp %p)\n", DeviceObject, Irp)); @@ -420,6 +423,24 @@ } KillSelectsForFCB( FCB->DeviceExt, FileObject, FALSE ); + + ASSERT(IsListEmpty(&FCB->PendingIrpList[FUNCTION_CONNECT])); + ASSERT(IsListEmpty(&FCB->PendingIrpList[FUNCTION_SEND])); + ASSERT(IsListEmpty(&FCB->PendingIrpList[FUNCTION_RECV])); + ASSERT(IsListEmpty(&FCB->PendingIrpList[FUNCTION_PREACCEPT])); + + while (!IsListEmpty(&FCB->PendingConnections)) + { + QeltEntry = RemoveHeadList(&FCB->PendingConnections); + Qelt = CONTAINING_RECORD(QeltEntry, AFD_TDI_OBJECT_QELT, ListEntry); + + /* We have to close all pending connections or the listen won't get closed */ + TdiDisassociateAddressFile(Qelt->Object.Object); + ObDereferenceObject(Qelt->Object.Object); + ZwClose(Qelt->Object.Handle); + + ExFreePool(Qelt); + } SocketStateUnlock( FCB );
13 years, 6 months
1
0
0
0
[tkreuzer] 52165: [FAT32] - Fix a bug in the new fat32 bootsector code. The old code was using a 32bit push, the new code uses 2 16 bit pushes - enable new fat32 and isobtrt bootsectors
by tkreuzer@svn.reactos.org
Author: tkreuzer Date: Thu Jun 9 22:04:45 2011 New Revision: 52165 URL:
http://svn.reactos.org/svn/reactos?rev=52165&view=rev
Log: [FAT32] - Fix a bug in the new fat32 bootsector code. The old code was using a 32bit push, the new code uses 2 16 bit pushes - enable new fat32 and isobtrt bootsectors Modified: trunk/reactos/boot/freeldr/bootsect/CMakeLists.txt trunk/reactos/boot/freeldr/bootsect/fat32.S Modified: trunk/reactos/boot/freeldr/bootsect/CMakeLists.txt URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/bootsect/CMak…
============================================================================== --- trunk/reactos/boot/freeldr/bootsect/CMakeLists.txt [iso-8859-1] (original) +++ trunk/reactos/boot/freeldr/bootsect/CMakeLists.txt [iso-8859-1] Thu Jun 9 22:04:45 2011 @@ -3,17 +3,15 @@ #CreateBootSectorTarget2(dosmbr ${CMAKE_CURRENT_SOURCE_DIR}/dosmbr.S ${CMAKE_CURRENT_BINARY_DIR}/dosmbr.bin 0) #CreateBootSectorTarget2(ext2 ${CMAKE_CURRENT_SOURCE_DIR}/ext2.S ${CMAKE_CURRENT_BINARY_DIR}/ext2.bin 0) -#CreateBootSectorTarget2(fat32 ${CMAKE_CURRENT_SOURCE_DIR}/fat32.S ${CMAKE_CURRENT_BINARY_DIR}/fat32.bin 7c00) +CreateBootSectorTarget2(fat32 ${CMAKE_CURRENT_SOURCE_DIR}/fat32.S ${CMAKE_CURRENT_BINARY_DIR}/fat32.bin 7c00) #CreateBootSectorTarget2(fat ${CMAKE_CURRENT_SOURCE_DIR}/fat.S ${CMAKE_CURRENT_BINARY_DIR}/fat.bin 0) CreateBootSectorTarget2(isoboot ${CMAKE_CURRENT_SOURCE_DIR}/isoboot.S ${CMAKE_CURRENT_BINARY_DIR}/isoboot.bin 7000) -#CreateBootSectorTarget2(isobtrt ${CMAKE_CURRENT_SOURCE_DIR}/isobtrt.S ${CMAKE_CURRENT_BINARY_DIR}/isobtrt.bin 0) +CreateBootSectorTarget2(isobtrt ${CMAKE_CURRENT_SOURCE_DIR}/isobtrt.S ${CMAKE_CURRENT_BINARY_DIR}/isobtrt.bin 0) if(NOT MSVC) CreateBootSectorTarget(dosmbr ${CMAKE_CURRENT_SOURCE_DIR}/dosmbr.asm ${CMAKE_CURRENT_BINARY_DIR}/dosmbr.bin 0) CreateBootSectorTarget(ext2 ${CMAKE_CURRENT_SOURCE_DIR}/ext2.asm ${CMAKE_CURRENT_BINARY_DIR}/ext2.bin 0) -CreateBootSectorTarget(fat32 ${CMAKE_CURRENT_SOURCE_DIR}/fat32.asm ${CMAKE_CURRENT_BINARY_DIR}/fat32.bin 7c00) CreateBootSectorTarget(fat ${CMAKE_CURRENT_SOURCE_DIR}/fat.asm ${CMAKE_CURRENT_BINARY_DIR}/fat.bin 0) -CreateBootSectorTarget(isobtrt ${CMAKE_CURRENT_SOURCE_DIR}/isobtrt.asm ${CMAKE_CURRENT_BINARY_DIR}/isobtrt.bin 0) endif() add_cd_file(TARGET dosmbr DESTINATION loader NO_CAB FILE ${CMAKE_CURRENT_BINARY_DIR}/dosmbr.bin FOR all) Modified: trunk/reactos/boot/freeldr/bootsect/fat32.S URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/bootsect/fat3…
============================================================================== --- trunk/reactos/boot/freeldr/bootsect/fat32.S [iso-8859-1] (original) +++ trunk/reactos/boot/freeldr/bootsect/fat32.S [iso-8859-1] Thu Jun 9 22:04:45 2011 @@ -181,7 +181,8 @@ ReadSectorsSetupDiskAddressPacket: mov word ptr ds:[LBASectorsRead],cx - push 0 // push large 0 ? + push 0 + push 0 push eax // Put 64-bit logical block address on stack push es // Put transfer segment on stack push bx // Put transfer offset on stack
13 years, 6 months
1
0
0
0
[akhaldi] 52164: [CMAKE] * Add uniata debug option.
by akhaldi@svn.reactos.org
Author: akhaldi Date: Thu Jun 9 20:56:05 2011 New Revision: 52164 URL:
http://svn.reactos.org/svn/reactos?rev=52164&view=rev
Log: [CMAKE] * Add uniata debug option. Modified: trunk/reactos/drivers/storage/ide/uniata/CMakeLists.txt Modified: trunk/reactos/drivers/storage/ide/uniata/CMakeLists.txt URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/storage/ide/uniata…
============================================================================== --- trunk/reactos/drivers/storage/ide/uniata/CMakeLists.txt [iso-8859-1] (original) +++ trunk/reactos/drivers/storage/ide/uniata/CMakeLists.txt [iso-8859-1] Thu Jun 9 20:56:05 2011 @@ -1,5 +1,7 @@ include_directories(inc) + +#add_definitions(-D_DEBUG) set_cpp() set_rc_compiler()
13 years, 6 months
1
0
0
0
[jimtabor] 52163: [Win32k] - Fix hot tracking but does not clear it properly. See bug 6257. - Ported NC_HandleNCHitTest from wine, will sync User32 later.
by jimtabor@svn.reactos.org
Author: jimtabor Date: Thu Jun 9 20:00:43 2011 New Revision: 52163 URL:
http://svn.reactos.org/svn/reactos?rev=52163&view=rev
Log: [Win32k] - Fix hot tracking but does not clear it properly. See bug 6257. - Ported NC_HandleNCHitTest from wine, will sync User32 later. Modified: trunk/reactos/subsystems/win32/win32k/include/window.h trunk/reactos/subsystems/win32/win32k/ntuser/defwnd.c trunk/reactos/subsystems/win32/win32k/ntuser/msgqueue.c Modified: trunk/reactos/subsystems/win32/win32k/include/window.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/in…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/include/window.h [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/include/window.h [iso-8859-1] Thu Jun 9 20:00:43 2011 @@ -27,6 +27,21 @@ #define HAS_THINFRAME(Style, ExStyle) \ (((Style) & WS_BORDER) || (!((Style) & (WS_CHILD | WS_POPUP)))) + +#define HAS_BIGFRAME(style,exStyle) \ + (((style) & (WS_THICKFRAME | WS_DLGFRAME)) || \ + ((exStyle) & WS_EX_DLGMODALFRAME)) + +#define HAS_STATICOUTERFRAME(style,exStyle) \ + (((exStyle) & (WS_EX_STATICEDGE|WS_EX_DLGMODALFRAME)) == \ + WS_EX_STATICEDGE) + +#define HAS_ANYFRAME(style,exStyle) \ + (((style) & (WS_THICKFRAME | WS_DLGFRAME | WS_BORDER)) || \ + ((exStyle) & WS_EX_DLGMODALFRAME) || \ + !((style) & (WS_CHILD | WS_POPUP))) + +#define HAS_MENU(pWnd,style) ((((style) & (WS_CHILD | WS_POPUP)) != WS_CHILD) && pWnd->IDMenu) #define IntIsDesktopWindow(WndObj) \ (WndObj->spwndParent == NULL) @@ -112,5 +127,6 @@ WNDPROC FASTCALL IntGetWindowProc(PWND,BOOL); BOOL FASTCALL IntEnableWindow(HWND,BOOL); +DWORD FASTCALL GetNCHitEx(PWND pWnd, POINT pt); /* EOF */ Modified: trunk/reactos/subsystems/win32/win32k/ntuser/defwnd.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntuser/defwnd.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/defwnd.c [iso-8859-1] Thu Jun 9 20:00:43 2011 @@ -215,5 +215,207 @@ return lResult; } +static HICON NC_IconForWindow( PWND pWnd ) +{ + HICON hIcon = 0; + + if (!pWnd->pcls || pWnd->fnid == FNID_DESKTOP) return hIcon; + if (!hIcon) hIcon = pWnd->pcls->hIconSm; + if (!hIcon) hIcon = pWnd->pcls->hIcon; + + if (!hIcon && pWnd->style & DS_MODALFRAME) + { // Fake it out for now, we use it as a test. + hIcon = (HICON)1; + /* FIXME: Need to setup Registry System Cursor & Icons via Callbacks at init time! */ + if (!hIcon) hIcon = gpsi->hIconSmWindows; // Both are IDI_WINLOGO Small + if (!hIcon) hIcon = gpsi->hIcoWindows; // Reg size. + } + return hIcon; +} + +DWORD FASTCALL +GetNCHitEx(PWND pWnd, POINT pt) +{ + RECT rcWindow, rcClient; + DWORD Style, ExStyle; + + if (!pWnd) return HTNOWHERE; + + rcClient.left = rcClient.top = rcWindow.left = rcWindow.top = 0; + rcWindow.right = pWnd->rcWindow.right; + rcWindow.bottom = pWnd->rcWindow.bottom; + rcClient.right = pWnd->rcClient.right; + rcClient.bottom = pWnd->rcClient.bottom; + + if (!IntPtInRect(&rcWindow, pt)) return HTNOWHERE; + + Style = pWnd->style; + ExStyle = pWnd->ExStyle; + + if (Style & WS_MINIMIZE) return HTCAPTION; + + if (IntPtInRect( &rcClient, pt )) return HTCLIENT; + + /* Check borders */ + if (HAS_THICKFRAME( Style, ExStyle )) + { + RECTL_vInflateRect(&rcWindow, -UserGetSystemMetrics(SM_CXFRAME), -UserGetSystemMetrics(SM_CYFRAME) ); + if (!IntPtInRect(&rcWindow, pt)) + { + /* Check top sizing border */ + if (pt.y < rcWindow.top) + { + if (pt.x < rcWindow.left+UserGetSystemMetrics(SM_CXSIZE)) return HTTOPLEFT; + if (pt.x >= rcWindow.right-UserGetSystemMetrics(SM_CXSIZE)) return HTTOPRIGHT; + return HTTOP; + } + /* Check bottom sizing border */ + if (pt.y >= rcWindow.bottom) + { + if (pt.x < rcWindow.left+UserGetSystemMetrics(SM_CXSIZE)) return HTBOTTOMLEFT; + if (pt.x >= rcWindow.right-UserGetSystemMetrics(SM_CXSIZE)) return HTBOTTOMRIGHT; + return HTBOTTOM; + } + /* Check left sizing border */ + if (pt.x < rcWindow.left) + { + if (pt.y < rcWindow.top+UserGetSystemMetrics(SM_CYSIZE)) return HTTOPLEFT; + if (pt.y >= rcWindow.bottom-UserGetSystemMetrics(SM_CYSIZE)) return HTBOTTOMLEFT; + return HTLEFT; + } + /* Check right sizing border */ + if (pt.x >= rcWindow.right) + { + if (pt.y < rcWindow.top+UserGetSystemMetrics(SM_CYSIZE)) return HTTOPRIGHT; + if (pt.y >= rcWindow.bottom-UserGetSystemMetrics(SM_CYSIZE)) return HTBOTTOMRIGHT; + return HTRIGHT; + } + } + } + else /* No thick frame */ + { + if (HAS_DLGFRAME( Style, ExStyle )) + RECTL_vInflateRect(&rcWindow, -UserGetSystemMetrics(SM_CXDLGFRAME), -UserGetSystemMetrics(SM_CYDLGFRAME)); + else if (HAS_THINFRAME( Style, ExStyle )) + RECTL_vInflateRect(&rcWindow, -UserGetSystemMetrics(SM_CXBORDER), -UserGetSystemMetrics(SM_CYBORDER)); + if (!IntPtInRect( &rcWindow, pt )) return HTBORDER; + } + + /* Check caption */ + + if ((Style & WS_CAPTION) == WS_CAPTION) + { + if (ExStyle & WS_EX_TOOLWINDOW) + rcWindow.top += UserGetSystemMetrics(SM_CYSMCAPTION) - 1; + else + rcWindow.top += UserGetSystemMetrics(SM_CYCAPTION) - 1; + if (!IntPtInRect( &rcWindow, pt )) + { + BOOL min_or_max_box = (Style & WS_MAXIMIZEBOX) || + (Style & WS_MINIMIZEBOX); + if (ExStyle & WS_EX_LAYOUTRTL) + { + /* Check system menu */ + if ((Style & WS_SYSMENU) && !(ExStyle & WS_EX_TOOLWINDOW) && NC_IconForWindow(pWnd)) + { + rcWindow.right -= UserGetSystemMetrics(SM_CYCAPTION) - 1; + if (pt.x > rcWindow.right) return HTSYSMENU; + } + + /* Check close button */ + if (Style & WS_SYSMENU) + { + rcWindow.left += UserGetSystemMetrics(SM_CYCAPTION); + if (pt.x < rcWindow.left) return HTCLOSE; + } + + /* Check maximize box */ + /* In win95 there is automatically a Maximize button when there is a minimize one*/ + if (min_or_max_box && !(ExStyle & WS_EX_TOOLWINDOW)) + { + rcWindow.left += UserGetSystemMetrics(SM_CXSIZE); + if (pt.x < rcWindow.left) return HTMAXBUTTON; + } + + /* Check minimize box */ + if (min_or_max_box && !(ExStyle & WS_EX_TOOLWINDOW)) + { + rcWindow.left += UserGetSystemMetrics(SM_CXSIZE); + if (pt.x < rcWindow.left) return HTMINBUTTON; + } + } + else + { + /* Check system menu */ + if ((Style & WS_SYSMENU) && !(ExStyle & WS_EX_TOOLWINDOW) && NC_IconForWindow(pWnd)) + { + rcWindow.left += UserGetSystemMetrics(SM_CYCAPTION) - 1; + if (pt.x < rcWindow.left) return HTSYSMENU; + } + + /* Check close button */ + if (Style & WS_SYSMENU) + { + rcWindow.right -= UserGetSystemMetrics(SM_CYCAPTION); + if (pt.x > rcWindow.right) return HTCLOSE; + } + + /* Check maximize box */ + /* In win95 there is automatically a Maximize button when there is a minimize one*/ + if (min_or_max_box && !(ExStyle & WS_EX_TOOLWINDOW)) + { + rcWindow.right -= UserGetSystemMetrics(SM_CXSIZE); + if (pt.x > rcWindow.right) return HTMAXBUTTON; + } + + /* Check minimize box */ + if (min_or_max_box && !(ExStyle & WS_EX_TOOLWINDOW)) + { + rcWindow.right -= UserGetSystemMetrics(SM_CXSIZE); + if (pt.x > rcWindow.right) return HTMINBUTTON; + } + } + return HTCAPTION; + } + } + + /* Check menu bar */ + + if (HAS_MENU( pWnd, Style ) && (pt.y < rcClient.top) && + (pt.x >= rcClient.left) && (pt.x < rcClient.right)) + return HTMENU; + + /* Check vertical scroll bar */ + + if (ExStyle & WS_EX_LAYOUTRTL) ExStyle ^= WS_EX_LEFTSCROLLBAR; + if (Style & WS_VSCROLL) + { + if((ExStyle & WS_EX_LEFTSCROLLBAR) != 0) + rcClient.left -= UserGetSystemMetrics(SM_CXVSCROLL); + else + rcClient.right += UserGetSystemMetrics(SM_CXVSCROLL); + if (IntPtInRect( &rcClient, pt )) return HTVSCROLL; + } + + /* Check horizontal scroll bar */ + + if (Style & WS_HSCROLL) + { + rcClient.bottom += UserGetSystemMetrics(SM_CYHSCROLL); + if (IntPtInRect( &rcClient, pt )) + { + /* Check size box */ + if ((Style & WS_VSCROLL) && + ((((ExStyle & WS_EX_LEFTSCROLLBAR) != 0) && (pt.x <= rcClient.left + UserGetSystemMetrics(SM_CXVSCROLL))) || + (((ExStyle & WS_EX_LEFTSCROLLBAR) == 0) && (pt.x >= rcClient.right - UserGetSystemMetrics(SM_CXVSCROLL))))) + return HTSIZE; + return HTHSCROLL; + } + } + + /* Has to return HTNOWHERE if nothing was found + Could happen when a window has a customized non client area */ + return HTNOWHERE; +} /* EOF */ Modified: trunk/reactos/subsystems/win32/win32k/ntuser/msgqueue.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntuser/msgqueue.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/msgqueue.c [iso-8859-1] Thu Jun 9 20:00:43 2011 @@ -41,6 +41,39 @@ 256); return(STATUS_SUCCESS); +} + +PWND FASTCALL +IntChildrenWindowFromPoint(PWND pWndTop, INT x, INT y) +{ + PWND pWnd, pWndChild; + + if (!(pWndTop->style & WS_VISIBLE)) return NULL; + if ((pWndTop->style & WS_DISABLED)) return NULL; + if (!IntPtInWindow(pWndTop, x, y)) return NULL; + + if (x - pWndTop->rcClient.left < pWndTop->rcClient.right && + y - pWndTop->rcClient.top < pWndTop->rcClient.bottom ) + { + for (pWnd = pWndTop->spwndChild; + pWnd != NULL; + pWnd = pWnd->spwndNext) + { + if (pWnd->state2 & WNDS2_INDESTROY || pWnd->state & WNDS_DESTROYED ) + { + DPRINT("The Window is in DESTROY!\n"); + continue; + } + + pWndChild = IntChildrenWindowFromPoint(pWnd, x, y); + + if (pWndChild) + { + return pWndChild; + } + } + } + return pWndTop; } PWND FASTCALL @@ -503,22 +536,17 @@ if (Msg->hwnd != NULL) { pwnd = UserGetWindowObject(Msg->hwnd); - if ((pwnd->style & WS_VISIBLE) && - IntPtInWindow(pwnd, Msg->pt.x, Msg->pt.y)) - { - pDesk->htEx = HTCLIENT; - pDesk->spwndTrack = pwnd; - } } else { pwnd = IntTopLevelWindowFromPoint(Msg->pt.x, Msg->pt.y); - if (pwnd) - { - Msg->hwnd = pwnd->head.h; - pDesk->htEx = HTCLIENT; - pDesk->spwndTrack = pwnd; - } + if (pwnd) Msg->hwnd = pwnd->head.h; + } + + if (pwnd) + { + pDesk->spwndTrack = IntChildrenWindowFromPoint(pwnd, Msg->pt.x, Msg->pt.y); + pDesk->htEx = GetNCHitEx(pDesk->spwndTrack, Msg->pt); } hdcScreen = IntGetScreenDC();
13 years, 6 months
1
0
0
0
← Newer
1
...
30
31
32
33
34
35
36
...
46
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
Results per page:
10
25
50
100
200