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
2025
January
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
March 2010
----- 2025 -----
January 2025
----- 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
19 participants
896 discussions
Start a n
N
ew thread
[akhaldi] 46018: [NTIFS] - Group related definitions - Add several Rtl* function declarations - Add RTL_SYSTEM_VOLUME_INFORMATION_FOLDER, DEVICE_TYPE, FILE_DEVICE_*, METHOD_* and FILE_*_ACCESS definitions - Add CTL_CODE, DEVICE_TYPE_FROM_CTL_CODE and METHOD_FROM_CTL_CODE macros
by akhaldi@svn.reactos.org
Author: akhaldi Date: Mon Mar 8 23:30:14 2010 New Revision: 46018 URL:
http://svn.reactos.org/svn/reactos?rev=46018&view=rev
Log: [NTIFS] - Group related definitions - Add several Rtl* function declarations - Add RTL_SYSTEM_VOLUME_INFORMATION_FOLDER, DEVICE_TYPE, FILE_DEVICE_*, METHOD_* and FILE_*_ACCESS definitions - Add CTL_CODE, DEVICE_TYPE_FROM_CTL_CODE and METHOD_FROM_CTL_CODE macros Modified: branches/header-work/include/ddk/ntifs.h Modified: branches/header-work/include/ddk/ntifs.h URL:
http://svn.reactos.org/svn/reactos/branches/header-work/include/ddk/ntifs.h…
============================================================================== --- branches/header-work/include/ddk/ntifs.h [iso-8859-1] (original) +++ branches/header-work/include/ddk/ntifs.h [iso-8859-1] Mon Mar 8 23:30:14 2010 @@ -1484,6 +1484,94 @@ IN ACCESS_MASK AccessMask, IN PSID Sid); +NTSYSAPI +NTSTATUS +NTAPI +RtlAddAccessAllowedAceEx( + IN OUT PACL Acl, + IN ULONG AceRevision, + IN ULONG AceFlags, + IN ACCESS_MASK AccessMask, + IN PSID Sid); + +NTSYSAPI +NTSTATUS +NTAPI +RtlCreateSecurityDescriptorRelative( + OUT PISECURITY_DESCRIPTOR_RELATIVE SecurityDescriptor, + IN ULONG Revision); + +NTSYSAPI +NTSTATUS +NTAPI +RtlGetDaclSecurityDescriptor( + IN PSECURITY_DESCRIPTOR SecurityDescriptor, + OUT PBOOLEAN DaclPresent, + OUT PACL *Dacl, + OUT PBOOLEAN DaclDefaulted); + +NTSYSAPI +NTSTATUS +NTAPI +RtlSetOwnerSecurityDescriptor( + IN OUT PSECURITY_DESCRIPTOR SecurityDescriptor, + IN PSID Owner OPTIONAL, + IN BOOLEAN OwnerDefaulted); + +NTSYSAPI +NTSTATUS +NTAPI +RtlGetOwnerSecurityDescriptor( + IN PSECURITY_DESCRIPTOR SecurityDescriptor, + OUT PSID *Owner, + OUT PBOOLEAN OwnerDefaulted); + +NTSYSAPI +ULONG +NTAPI +RtlNtStatusToDosError( + IN NTSTATUS Status); + +NTSYSAPI +NTSTATUS +NTAPI +RtlCustomCPToUnicodeN( + IN PCPTABLEINFO CustomCP, + OUT PWCH UnicodeString, + IN ULONG MaxBytesInUnicodeString, + OUT PULONG BytesInUnicodeString OPTIONAL, + IN PCH CustomCPString, + IN ULONG BytesInCustomCPString); + +NTSYSAPI +NTSTATUS +NTAPI +RtlUnicodeToCustomCPN( + IN PCPTABLEINFO CustomCP, + OUT PCH CustomCPString, + IN ULONG MaxBytesInCustomCPString, + OUT PULONG BytesInCustomCPString OPTIONAL, + IN PWCH UnicodeString, + IN ULONG BytesInUnicodeString); + +NTSYSAPI +NTSTATUS +NTAPI +RtlUpcaseUnicodeToCustomCPN( + IN PCPTABLEINFO CustomCP, + OUT PCH CustomCPString, + IN ULONG MaxBytesInCustomCPString, + OUT PULONG BytesInCustomCPString OPTIONAL, + IN PWCH UnicodeString, + IN ULONG BytesInUnicodeString); + +NTSYSAPI +VOID +NTAPI +RtlInitCodePageTable( + IN PUSHORT TableBase, + IN OUT PCPTABLEINFO CodePageTable); + #endif #if (NTDDI_VERSION >= NTDDI_WINXP) @@ -1642,6 +1730,18 @@ NTAPI RtlSubAuthorityCountSid( IN PSID Sid); + +NTSYSAPI +ULONG +NTAPI +RtlNtStatusToDosErrorNoTeb( + IN NTSTATUS Status); + +NTSYSAPI +NTSTATUS +NTAPI +RtlCreateSystemVolumeInformationFolder( + IN PCUNICODE_STRING VolumeRootPath); #endif @@ -1718,6 +1818,46 @@ OUT PACL *Sacl, OUT PBOOLEAN SaclDefaulted); +NTSYSAPI +NTSTATUS +NTAPI +RtlSetGroupSecurityDescriptor( + IN OUT PSECURITY_DESCRIPTOR SecurityDescriptor, + IN PSID Group OPTIONAL, + IN BOOLEAN GroupDefaulted OPTIONAL); + +NTSYSAPI +NTSTATUS +NTAPI +RtlGetGroupSecurityDescriptor( + IN PSECURITY_DESCRIPTOR SecurityDescriptor, + OUT PSID *Group, + OUT PBOOLEAN GroupDefaulted); + +NTSYSAPI +NTSTATUS +NTAPI +RtlAbsoluteToSelfRelativeSD( + IN PSECURITY_DESCRIPTOR AbsoluteSecurityDescriptor, + OUT PSECURITY_DESCRIPTOR SelfRelativeSecurityDescriptor OPTIONAL, + IN OUT PULONG BufferLength); + +NTSYSAPI +NTSTATUS +NTAPI +RtlSelfRelativeToAbsoluteSD( + IN PSECURITY_DESCRIPTOR SelfRelativeSecurityDescriptor, + OUT PSECURITY_DESCRIPTOR AbsoluteSecurityDescriptor OPTIONAL, + IN OUT PULONG AbsoluteSecurityDescriptorSize, + OUT PACL Dacl OPTIONAL, + IN OUT PULONG DaclSize, + OUT PACL Sacl OPTIONAL, + IN OUT PULONG SaclSize, + OUT PSID Owner OPTIONAL, + IN OUT PULONG OwnerSize, + OUT PSID PrimaryGroup OPTIONAL, + IN OUT PULONG PrimaryGroupSize); + #endif #if (NTDDI_VERSION >= NTDDI_VISTA) @@ -1778,6 +1918,13 @@ IN PUNICODE_STRING ServiceName, OUT PSID ServiceSid, IN OUT PULONG ServiceSidLength); + +NTSYSAPI +LONG +NTAPI +RtlCompareAltitudes( + IN PCUNICODE_STRING Altitude1, + IN PCUNICODE_STRING Altitude2); #endif @@ -1985,6 +2132,96 @@ #define RtlPointerToOffset(B,P) ((ULONG)( ((PCHAR)(P)) - ((PCHAR)(B)) )) #define MAX_UNICODE_STACK_BUFFER_LENGTH 256 + +#define RTL_SYSTEM_VOLUME_INFORMATION_FOLDER L"System Volume Information" + +#define DEVICE_TYPE ULONG + +#define FILE_DEVICE_BEEP 0x00000001 +#define FILE_DEVICE_CD_ROM 0x00000002 +#define FILE_DEVICE_CD_ROM_FILE_SYSTEM 0x00000003 +#define FILE_DEVICE_CONTROLLER 0x00000004 +#define FILE_DEVICE_DATALINK 0x00000005 +#define FILE_DEVICE_DFS 0x00000006 +#define FILE_DEVICE_DISK 0x00000007 +#define FILE_DEVICE_DISK_FILE_SYSTEM 0x00000008 +#define FILE_DEVICE_FILE_SYSTEM 0x00000009 +#define FILE_DEVICE_INPORT_PORT 0x0000000a +#define FILE_DEVICE_KEYBOARD 0x0000000b +#define FILE_DEVICE_MAILSLOT 0x0000000c +#define FILE_DEVICE_MIDI_IN 0x0000000d +#define FILE_DEVICE_MIDI_OUT 0x0000000e +#define FILE_DEVICE_MOUSE 0x0000000f +#define FILE_DEVICE_MULTI_UNC_PROVIDER 0x00000010 +#define FILE_DEVICE_NAMED_PIPE 0x00000011 +#define FILE_DEVICE_NETWORK 0x00000012 +#define FILE_DEVICE_NETWORK_BROWSER 0x00000013 +#define FILE_DEVICE_NETWORK_FILE_SYSTEM 0x00000014 +#define FILE_DEVICE_NULL 0x00000015 +#define FILE_DEVICE_PARALLEL_PORT 0x00000016 +#define FILE_DEVICE_PHYSICAL_NETCARD 0x00000017 +#define FILE_DEVICE_PRINTER 0x00000018 +#define FILE_DEVICE_SCANNER 0x00000019 +#define FILE_DEVICE_SERIAL_MOUSE_PORT 0x0000001a +#define FILE_DEVICE_SERIAL_PORT 0x0000001b +#define FILE_DEVICE_SCREEN 0x0000001c +#define FILE_DEVICE_SOUND 0x0000001d +#define FILE_DEVICE_STREAMS 0x0000001e +#define FILE_DEVICE_TAPE 0x0000001f +#define FILE_DEVICE_TAPE_FILE_SYSTEM 0x00000020 +#define FILE_DEVICE_TRANSPORT 0x00000021 +#define FILE_DEVICE_UNKNOWN 0x00000022 +#define FILE_DEVICE_VIDEO 0x00000023 +#define FILE_DEVICE_VIRTUAL_DISK 0x00000024 +#define FILE_DEVICE_WAVE_IN 0x00000025 +#define FILE_DEVICE_WAVE_OUT 0x00000026 +#define FILE_DEVICE_8042_PORT 0x00000027 +#define FILE_DEVICE_NETWORK_REDIRECTOR 0x00000028 +#define FILE_DEVICE_BATTERY 0x00000029 +#define FILE_DEVICE_BUS_EXTENDER 0x0000002a +#define FILE_DEVICE_MODEM 0x0000002b +#define FILE_DEVICE_VDM 0x0000002c +#define FILE_DEVICE_MASS_STORAGE 0x0000002d +#define FILE_DEVICE_SMB 0x0000002e +#define FILE_DEVICE_KS 0x0000002f +#define FILE_DEVICE_CHANGER 0x00000030 +#define FILE_DEVICE_SMARTCARD 0x00000031 +#define FILE_DEVICE_ACPI 0x00000032 +#define FILE_DEVICE_DVD 0x00000033 +#define FILE_DEVICE_FULLSCREEN_VIDEO 0x00000034 +#define FILE_DEVICE_DFS_FILE_SYSTEM 0x00000035 +#define FILE_DEVICE_DFS_VOLUME 0x00000036 +#define FILE_DEVICE_SERENUM 0x00000037 +#define FILE_DEVICE_TERMSRV 0x00000038 +#define FILE_DEVICE_KSEC 0x00000039 +#define FILE_DEVICE_FIPS 0x0000003A +#define FILE_DEVICE_INFINIBAND 0x0000003B +#define FILE_DEVICE_VMBUS 0x0000003E +#define FILE_DEVICE_CRYPT_PROVIDER 0x0000003F +#define FILE_DEVICE_WPD 0x00000040 +#define FILE_DEVICE_BLUETOOTH 0x00000041 +#define FILE_DEVICE_MT_COMPOSITE 0x00000042 +#define FILE_DEVICE_MT_TRANSPORT 0x00000043 +#define FILE_DEVICE_BIOMETRIC 0x00000044 +#define FILE_DEVICE_PMI 0x00000045 + +#define CTL_CODE( DeviceType, Function, Method, Access ) ( \ + ((DeviceType) << 16) | ((Access) << 14) | ((Function) << 2) | (Method) \ +) +#define DEVICE_TYPE_FROM_CTL_CODE(ctrlCode) (((ULONG)(ctrlCode & 0xffff0000)) >> 16) +#define METHOD_FROM_CTL_CODE(ctrlCode) ((ULONG)(ctrlCode & 3)) + +#define METHOD_BUFFERED 0 +#define METHOD_IN_DIRECT 1 +#define METHOD_OUT_DIRECT 2 +#define METHOD_NEITHER 3 +#define METHOD_DIRECT_TO_HARDWARE METHOD_IN_DIRECT +#define METHOD_DIRECT_FROM_HARDWARE METHOD_OUT_DIRECT + +#define FILE_ANY_ACCESS 0 +#define FILE_SPECIAL_ACCESS (FILE_ANY_ACCESS) +#define FILE_READ_ACCESS ( 0x0001 ) +#define FILE_WRITE_ACCESS ( 0x0002 ) #pragma pack(push,4) @@ -6099,15 +6336,6 @@ ); NTSYSAPI -NTSTATUS -NTAPI -RtlAbsoluteToSelfRelativeSD ( - IN PSECURITY_DESCRIPTOR AbsoluteSecurityDescriptor, - IN OUT PSECURITY_DESCRIPTOR SelfRelativeSecurityDescriptor, - IN PULONG BufferLength -); - -NTSYSAPI VOID NTAPI RtlGenerate8dot3Name ( @@ -6118,64 +6346,11 @@ ); NTSYSAPI -NTSTATUS -NTAPI -RtlGetDaclSecurityDescriptor ( - IN PSECURITY_DESCRIPTOR SecurityDescriptor, - OUT PBOOLEAN DaclPresent, - OUT PACL *Dacl, - OUT PBOOLEAN DaclDefaulted -); - -NTSYSAPI -NTSTATUS -NTAPI -RtlGetGroupSecurityDescriptor ( - IN PSECURITY_DESCRIPTOR SecurityDescriptor, - OUT PSID *Group, - OUT PBOOLEAN GroupDefaulted -); - -NTSYSAPI -NTSTATUS -NTAPI -RtlGetOwnerSecurityDescriptor ( - IN PSECURITY_DESCRIPTOR SecurityDescriptor, - OUT PSID *Owner, - OUT PBOOLEAN OwnerDefaulted -); - -NTSYSAPI -ULONG -NTAPI -RtlNtStatusToDosError ( - IN NTSTATUS Status -); - -NTSYSAPI VOID NTAPI RtlSecondsSince1970ToTime ( IN ULONG SecondsSince1970, OUT PLARGE_INTEGER Time -); - -NTSYSAPI -NTSTATUS -NTAPI -RtlSetGroupSecurityDescriptor ( - IN OUT PSECURITY_DESCRIPTOR SecurityDescriptor, - IN PSID Group, - IN BOOLEAN GroupDefaulted -); - -NTSYSAPI -NTSTATUS -NTAPI -RtlSetOwnerSecurityDescriptor ( - IN OUT PSECURITY_DESCRIPTOR SecurityDescriptor, - IN PSID Owner, - IN BOOLEAN OwnerDefaulted ); NTSYSAPI
14 years, 10 months
1
0
0
0
[hpoussin] 46017: [freeldr] Load an additional SCSI driver if present (NTBOOTSYS.SYS on boot partition), to increase number of known storage devices. Works only with very simple miniport drivers.
by hpoussin@svn.reactos.org
Author: hpoussin Date: Mon Mar 8 23:04:38 2010 New Revision: 46017 URL:
http://svn.reactos.org/svn/reactos?rev=46017&view=rev
Log: [freeldr] Load an additional SCSI driver if present (NTBOOTSYS.SYS on boot partition), to increase number of known storage devices. Works only with very simple miniport drivers. Added: trunk/reactos/boot/freeldr/freeldr/disk/scsiport.c (with props) Modified: trunk/reactos/boot/freeldr/freeldr/bootmgr.c trunk/reactos/boot/freeldr/freeldr/freeldr.c trunk/reactos/boot/freeldr/freeldr/freeldr_base.rbuild trunk/reactos/boot/freeldr/freeldr/include/disk.h trunk/reactos/boot/freeldr/freeldr/include/reactos.h trunk/reactos/boot/freeldr/freeldr/reactos/arcname.c trunk/reactos/boot/freeldr/freeldr/windows/peloader.c Modified: trunk/reactos/boot/freeldr/freeldr/bootmgr.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/bootm…
============================================================================== --- trunk/reactos/boot/freeldr/freeldr/bootmgr.c [iso-8859-1] (original) +++ trunk/reactos/boot/freeldr/freeldr/bootmgr.c [iso-8859-1] Mon Mar 8 23:04:38 2010 @@ -119,6 +119,12 @@ return; } + // Load additional SCSI driver (if any) + if (LoadBootDeviceDriver() != ESUCCESS) + { + UiMessageBoxCritical("Unable to load additional boot device driver"); + } + if (!IniFileInitialize()) { UiMessageBoxCritical("Error initializing .ini file"); Added: 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 (added) +++ trunk/reactos/boot/freeldr/freeldr/disk/scsiport.c [iso-8859-1] Mon Mar 8 23:04:38 2010 @@ -1,0 +1,1701 @@ +#include <freeldr.h> + +#define _SCSIPORT_ + +#include <ntddk.h> +#include <srb.h> +#include <scsi.h> +#include <ntddscsi.h> +#include <ntddstor.h> +#include <ntdddisk.h> +#include <stdio.h> +#include <stdarg.h> + +#define NDEBUG +#include <debug.h> + +#define DPRINTM2(fmt, ...) DPRINTM(DPRINT_SCSIPORT, "(%s:%d) SCSIPORT: " fmt, __FILE__, __LINE__, __VA_ARGS__) + +#undef UNIMPLEMENTED +#define UNIMPLEMENTED DPRINTM2("%s UNIMPLEMENTED\n", __FUNCTION__) + +#define SCSI_PORT_NEXT_REQUEST_READY 0x0008 + +typedef struct +{ + PVOID NonCachedExtension; + + ULONG BusNum; + ULONG MaxTargedIds; + + ULONG InterruptFlags; + + /* SRB extension stuff */ + ULONG SrbExtensionSize; + PVOID SrbExtensionBuffer; + + IO_SCSI_CAPABILITIES PortCapabilities; + + PHW_INITIALIZE HwInitialize; + PHW_STARTIO HwStartIo; + PHW_INTERRUPT HwInterrupt; + PHW_RESET_BUS HwResetBus; + + /* DMA related stuff */ + PADAPTER_OBJECT AdapterObject; + + ULONG CommonBufferLength; + + PVOID MiniPortDeviceExtension; +} SCSI_PORT_DEVICE_EXTENSION, *PSCSI_PORT_DEVICE_EXTENSION; + +PSCSI_PORT_DEVICE_EXTENSION ScsiDeviceExtensions[SCSI_MAXIMUM_BUSES]; + +ULONG +ntohl( + IN ULONG Value) +{ + FOUR_BYTE Dest; + PFOUR_BYTE Source = (PFOUR_BYTE)&Value; + + Dest.Byte0 = Source->Byte3; + Dest.Byte1 = Source->Byte2; + Dest.Byte2 = Source->Byte1; + Dest.Byte3 = Source->Byte0; + + return Dest.AsULong; +} + +BOOLEAN +SpiSendSynchronousSrb( + IN PSCSI_PORT_DEVICE_EXTENSION DeviceExtension, + IN PSCSI_REQUEST_BLOCK Srb) +{ + BOOLEAN ret; + + ASSERT(!(Srb->SrbFlags & SRB_FLAGS_IS_ACTIVE)); + + /* HACK: handle lack of interrupts */ + while (!(DeviceExtension->InterruptFlags & SCSI_PORT_NEXT_REQUEST_READY)) + { + KeStallExecutionProcessor(100 * 1000); + DeviceExtension->HwInterrupt(DeviceExtension->MiniPortDeviceExtension); + } + + DeviceExtension->InterruptFlags &= ~SCSI_PORT_NEXT_REQUEST_READY; + Srb->SrbFlags |= SRB_FLAGS_IS_ACTIVE; + + if (!DeviceExtension->HwStartIo( + DeviceExtension->MiniPortDeviceExtension, + Srb)) + { + ExFreePool(Srb); + return FALSE; + } + + /* HACK: handle lack of interrupts */ + while (Srb->SrbFlags & SRB_FLAGS_IS_ACTIVE) + { + KeStallExecutionProcessor(100 * 1000); + DeviceExtension->HwInterrupt(DeviceExtension->MiniPortDeviceExtension); + } + + ret = SRB_STATUS(Srb->SrbStatus) == SRB_STATUS_SUCCESS; + ExFreePool(Srb); + + return ret; +} + +typedef struct tagDISKCONTEXT +{ + /* Device ID */ + PSCSI_PORT_DEVICE_EXTENSION DeviceExtension; + ULONG PathId; + ULONG TargetId; + ULONG Lun; + + /* Device characteristics */ + ULONG SectorSize; + ULONGLONG SectorOffset; + ULONGLONG SectorCount; + ULONGLONG SectorNumber; +} DISKCONTEXT; + +static LONG DiskClose(ULONG FileId) +{ + DISKCONTEXT* Context = FsGetDeviceSpecific(FileId); + + ExFreePool(Context); + return ESUCCESS; +} + +static LONG DiskGetFileInformation(ULONG FileId, FILEINFORMATION* Information) +{ + DISKCONTEXT* Context = FsGetDeviceSpecific(FileId); + + RtlZeroMemory(Information, sizeof(FILEINFORMATION)); + Information->EndingAddress.QuadPart = Context->SectorCount * Context->SectorSize; + Information->CurrentAddress.LowPart = Context->SectorNumber * Context->SectorSize; + + return ESUCCESS; +} + +static LONG DiskOpen(CHAR* Path, OPENMODE OpenMode, ULONG* FileId) +{ + PSCSI_REQUEST_BLOCK Srb; + PCDB Cdb; + READ_CAPACITY_DATA ReadCapacityBuffer; + + DISKCONTEXT* Context; + PSCSI_PORT_DEVICE_EXTENSION DeviceExtension; + ULONG ScsiBus, PathId, TargetId, Lun, Partition, PathSyntax; + ULONG SectorSize; + ULONGLONG SectorOffset = 0; + ULONGLONG SectorCount; + + /* Parse ARC path */ + if (!DissectArcPath2(Path, &ScsiBus, &TargetId, &Lun, &Partition, &PathSyntax)) + return EINVAL; + if (PathSyntax != 0) /* scsi() format */ + return EINVAL; + DeviceExtension = ScsiDeviceExtensions[ScsiBus]; + PathId = ScsiBus - DeviceExtension->BusNum; + + /* Get disk capacity and sector size */ + Srb = ExAllocatePool(PagedPool, sizeof(SCSI_REQUEST_BLOCK)); + if (!Srb) + return ENOMEM; + RtlZeroMemory(Srb, sizeof(SCSI_REQUEST_BLOCK)); + Srb->Length = sizeof(SCSI_REQUEST_BLOCK); + Srb->Function = SRB_FUNCTION_EXECUTE_SCSI; + Srb->PathId = PathId; + Srb->TargetId = TargetId; + Srb->Lun = Lun; + Srb->CdbLength = 10; + Srb->SrbFlags = SRB_FLAGS_DATA_IN; + Srb->DataTransferLength = sizeof(READ_CAPACITY_DATA); + Srb->TimeOutValue = 5; /* in seconds */ + Srb->DataBuffer = &ReadCapacityBuffer; + Cdb = (PCDB)Srb->Cdb; + Cdb->CDB10.OperationCode = SCSIOP_READ_CAPACITY; + if (!SpiSendSynchronousSrb(DeviceExtension, Srb)) + { + return EIO; + } + + /* Transform result to host endianness */ + SectorCount = ntohl(ReadCapacityBuffer.LogicalBlockAddress); + SectorSize = ntohl(ReadCapacityBuffer.BytesPerBlock); + + if (Partition != 0) + { + /* Need to offset start of disk and length */ + UNIMPLEMENTED; + return EIO; + } + + Context = ExAllocatePool(PagedPool, sizeof(DISKCONTEXT)); + if (!Context) + return ENOMEM; + Context->DeviceExtension = DeviceExtension; + Context->PathId = PathId; + Context->TargetId = TargetId; + Context->Lun = Lun; + Context->SectorSize = SectorSize; + Context->SectorOffset = SectorOffset; + Context->SectorCount = SectorCount; + Context->SectorNumber = 0; + FsSetDeviceSpecific(*FileId, Context); + + return ESUCCESS; +} + +static LONG DiskRead(ULONG FileId, VOID* Buffer, ULONG N, ULONG* Count) +{ + DISKCONTEXT* Context = FsGetDeviceSpecific(FileId); + PSCSI_REQUEST_BLOCK Srb; + PCDB Cdb; + ULONG FullSectors, NbSectors; + ULONG Lba; + + *Count = 0; + + if (N == 0) + return ESUCCESS; + + FullSectors = N / Context->SectorSize; + NbSectors = (N + Context->SectorSize - 1) / Context->SectorSize; + if (Context->SectorNumber + NbSectors >= Context->SectorCount) + return EINVAL; + if (FullSectors > 0xffff) + return EINVAL; + + /* Read full sectors */ + Lba = Context->SectorNumber; + if (FullSectors > 0) + { + Srb = ExAllocatePool(PagedPool, sizeof(SCSI_REQUEST_BLOCK)); + if (!Srb) + return ENOMEM; + + RtlZeroMemory(Srb, sizeof(SCSI_REQUEST_BLOCK)); + Srb->Length = sizeof(SCSI_REQUEST_BLOCK); + Srb->Function = SRB_FUNCTION_EXECUTE_SCSI; + Srb->PathId = Context->PathId; + Srb->TargetId = Context->TargetId; + Srb->Lun = Context->Lun; + Srb->CdbLength = 10; + Srb->SrbFlags = SRB_FLAGS_DATA_IN; + Srb->DataTransferLength = FullSectors * Context->SectorSize; + Srb->TimeOutValue = 5; /* in seconds */ + Srb->DataBuffer = Buffer; + Cdb = (PCDB)Srb->Cdb; + Cdb->CDB10.OperationCode = SCSIOP_READ; + Cdb->CDB10.LogicalUnitNumber = Srb->Lun; + Cdb->CDB10.LogicalBlockByte0 = (Lba >> 24) & 0xff; + Cdb->CDB10.LogicalBlockByte1 = (Lba >> 16) & 0xff; + Cdb->CDB10.LogicalBlockByte2 = (Lba >> 8) & 0xff; + Cdb->CDB10.LogicalBlockByte3 = Lba & 0xff; + Cdb->CDB10.TransferBlocksMsb = (FullSectors >> 8) & 0xff; + Cdb->CDB10.TransferBlocksLsb = FullSectors & 0xff; + if (!SpiSendSynchronousSrb(Context->DeviceExtension, Srb)) + { + return EIO; + } + Buffer = (PUCHAR)Buffer + FullSectors * Context->SectorSize; + N -= FullSectors * Context->SectorSize; + *Count += FullSectors * Context->SectorSize; + Lba += FullSectors; + } + + /* Read incomplete last sector */ + if (N > 0) + { + PUCHAR Sector; + + Sector = ExAllocatePool(PagedPool, Context->SectorSize); + if (!Sector) + return ENOMEM; + + Srb = ExAllocatePool(PagedPool, sizeof(SCSI_REQUEST_BLOCK)); + if (!Srb) + { + ExFreePool(Sector); + return ENOMEM; + } + + RtlZeroMemory(Srb, sizeof(SCSI_REQUEST_BLOCK)); + Srb->Length = sizeof(SCSI_REQUEST_BLOCK); + Srb->Function = SRB_FUNCTION_EXECUTE_SCSI; + Srb->PathId = Context->PathId; + Srb->TargetId = Context->TargetId; + Srb->Lun = Context->Lun; + Srb->CdbLength = 10; + Srb->SrbFlags = SRB_FLAGS_DATA_IN; + Srb->DataTransferLength = Context->SectorSize; + Srb->TimeOutValue = 5; /* in seconds */ + Srb->DataBuffer = Sector; + Cdb = (PCDB)Srb->Cdb; + Cdb->CDB10.OperationCode = SCSIOP_READ; + Cdb->CDB10.LogicalUnitNumber = Srb->Lun; + Cdb->CDB10.LogicalBlockByte0 = (Lba >> 24) & 0xff; + Cdb->CDB10.LogicalBlockByte1 = (Lba >> 16) & 0xff; + Cdb->CDB10.LogicalBlockByte2 = (Lba >> 8) & 0xff; + Cdb->CDB10.LogicalBlockByte3 = Lba & 0xff; + Cdb->CDB10.TransferBlocksMsb = 0; + Cdb->CDB10.TransferBlocksLsb = 1; + if (!SpiSendSynchronousSrb(Context->DeviceExtension, Srb)) + { + ExFreePool(Sector); + return EIO; + } + RtlCopyMemory(Buffer, Sector, N); + *Count += N; + ExFreePool(Sector); + } + + return ESUCCESS; +} + +static LONG DiskSeek(ULONG FileId, LARGE_INTEGER* Position, SEEKMODE SeekMode) +{ + DISKCONTEXT* Context = FsGetDeviceSpecific(FileId); + + if (SeekMode != SeekAbsolute) + return EINVAL; + if (Position->QuadPart & (Context->SectorSize - 1)) + return EINVAL; + + Context->SectorNumber = Position->QuadPart / Context->SectorSize; + return ESUCCESS; +} + +static const DEVVTBL DiskVtbl = { + DiskClose, + DiskGetFileInformation, + DiskOpen, + DiskRead, + DiskSeek, +}; + +NTSTATUS +SpiCreatePortConfig( + IN PSCSI_PORT_DEVICE_EXTENSION DeviceExtension, + IN PHW_INITIALIZATION_DATA HwInitData, + OUT PPORT_CONFIGURATION_INFORMATION ConfigInfo, + IN BOOLEAN ZeroStruct) +{ + ULONG Bus; + + /* Zero out the struct if told so */ + if (ZeroStruct) + { + /* First zero the portconfig */ + RtlZeroMemory(ConfigInfo, sizeof(PORT_CONFIGURATION_INFORMATION)); + + /* Initialize the struct */ + ConfigInfo->Length = sizeof(PORT_CONFIGURATION_INFORMATION); + ConfigInfo->AdapterInterfaceType = HwInitData->AdapterInterfaceType; + ConfigInfo->InterruptMode = Latched; + ConfigInfo->DmaChannel = SP_UNINITIALIZED_VALUE; + ConfigInfo->DmaPort = SP_UNINITIALIZED_VALUE; + ConfigInfo->MaximumTransferLength = SP_UNINITIALIZED_VALUE; + ConfigInfo->MaximumNumberOfTargets = SCSI_MAXIMUM_TARGETS_PER_BUS; + + /* Store parameters */ + ConfigInfo->NeedPhysicalAddresses = HwInitData->NeedPhysicalAddresses; + ConfigInfo->MapBuffers = HwInitData->MapBuffers; + ConfigInfo->AutoRequestSense = HwInitData->AutoRequestSense; + ConfigInfo->ReceiveEvent = HwInitData->ReceiveEvent; + ConfigInfo->TaggedQueuing = HwInitData->TaggedQueuing; + ConfigInfo->MultipleRequestPerLu = HwInitData->MultipleRequestPerLu; + + /* Get the disk usage */ + ConfigInfo->AtdiskPrimaryClaimed = FALSE; // FIXME + ConfigInfo->AtdiskSecondaryClaimed = FALSE; // FIXME + + /* Initiator bus id is not set */ + for (Bus = 0; Bus < 8; Bus++) + ConfigInfo->InitiatorBusId[Bus] = (CCHAR)SP_UNINITIALIZED_VALUE; + } + + ConfigInfo->NumberOfPhysicalBreaks = 17; + + return STATUS_SUCCESS; +} + +VOID +DDKCDECLAPI +ScsiDebugPrint( + IN ULONG DebugPrintLevel, + IN PCCHAR DebugMessage, + IN ...) +{ + va_list ap; + CHAR Buffer[512]; + ULONG Length; + + if (DebugPrintLevel > 10) + return; + + va_start(ap, DebugMessage); + + /* Construct a string */ + Length = _vsnprintf(Buffer, 512, DebugMessage, ap); + + /* Check if we went past the buffer */ + if (Length == MAXULONG) + { + /* Terminate it if we went over-board */ + Buffer[sizeof(Buffer) - 1] = '\0'; + + /* Put maximum */ + Length = sizeof(Buffer); + } + + /* Print the message */ + DPRINTM(DPRINT_SCSIPORT, "%s", Buffer); + + /* Cleanup */ + va_end(ap); +} + +VOID +DDKAPI +ScsiPortCompleteRequest( + IN PVOID HwDeviceExtension, + IN UCHAR PathId, + IN UCHAR TargetId, + IN UCHAR Lun, + IN UCHAR SrbStatus) +{ + // FIXME + UNIMPLEMENTED; +} + +#undef ScsiPortConvertPhysicalAddressToUlong +ULONG +DDKAPI +ScsiPortConvertPhysicalAddressToUlong( + IN SCSI_PHYSICAL_ADDRESS Address) +{ + return Address.LowPart; +} + +SCSI_PHYSICAL_ADDRESS +DDKAPI +ScsiPortConvertUlongToPhysicalAddress( + IN ULONG UlongAddress) +{ + return RtlConvertUlongToLargeInteger(UlongAddress); +} + +VOID +DDKAPI +ScsiPortFlushDma( + IN PVOID DeviceExtension) +{ + // FIXME + UNIMPLEMENTED; +} + +VOID +DDKAPI +ScsiPortFreeDeviceBase( + IN PVOID HwDeviceExtension, + IN PVOID MappedAddress) +{ + // Nothing to do +} + +ULONG +DDKAPI +ScsiPortGetBusData( + IN PVOID DeviceExtension, + IN ULONG BusDataType, + IN ULONG SystemIoBusNumber, + IN ULONG SlotNumber, + IN PVOID Buffer, + IN ULONG Length) +{ + return HalGetBusDataByOffset(BusDataType, SystemIoBusNumber, SlotNumber, Buffer, 0, Length); +} + +PVOID +DDKAPI +ScsiPortGetDeviceBase( + IN PVOID HwDeviceExtension, + IN INTERFACE_TYPE BusType, + IN ULONG SystemIoBusNumber, + IN SCSI_PHYSICAL_ADDRESS IoAddress, + IN ULONG NumberOfBytes, + IN BOOLEAN InIoSpace) +{ + PHYSICAL_ADDRESS TranslatedAddress; + ULONG AddressSpace; + + AddressSpace = (ULONG)InIoSpace; + if (HalTranslateBusAddress(BusType, + SystemIoBusNumber, + IoAddress, + &AddressSpace, + &TranslatedAddress) == FALSE) + { + return NULL; + } + + /* I/O space */ + if (AddressSpace != 0) + return (PVOID)TranslatedAddress.u.LowPart; + + // FIXME + UNIMPLEMENTED; + return (PVOID)IoAddress.LowPart; +} + +PVOID +DDKAPI +ScsiPortGetLogicalUnit( + IN PVOID HwDeviceExtension, + IN UCHAR PathId, + IN UCHAR TargetId, + IN UCHAR Lun) +{ + // FIXME + UNIMPLEMENTED; + return NULL; +} + +SCSI_PHYSICAL_ADDRESS +DDKAPI +ScsiPortGetPhysicalAddress( + IN PVOID HwDeviceExtension, + IN PSCSI_REQUEST_BLOCK Srb OPTIONAL, + IN PVOID VirtualAddress, + OUT ULONG *Length) +{ + PSCSI_PORT_DEVICE_EXTENSION DeviceExtension; + SCSI_PHYSICAL_ADDRESS PhysicalAddress; + ULONG BufferLength = 0; + ULONG Offset; + + DPRINTM2("ScsiPortGetPhysicalAddress(%p %p %p %p)\n", + HwDeviceExtension, Srb, VirtualAddress, Length); + + DeviceExtension = ((PSCSI_PORT_DEVICE_EXTENSION)HwDeviceExtension) - 1; + + if (Srb == NULL || Srb->SenseInfoBuffer == VirtualAddress) + { + /* Simply look it up in the allocated common buffer */ + Offset = (PUCHAR)VirtualAddress - (PUCHAR)DeviceExtension->SrbExtensionBuffer; + + BufferLength = DeviceExtension->CommonBufferLength - Offset; + PhysicalAddress.QuadPart = Offset; + } + else + { + /* Nothing */ + *Length = 0; + PhysicalAddress.QuadPart = (LONGLONG)(SP_UNINITIALIZED_VALUE); + } + + *Length = BufferLength; + return PhysicalAddress; +} + +PSCSI_REQUEST_BLOCK +DDKAPI +ScsiPortGetSrb( + IN PVOID DeviceExtension, + IN UCHAR PathId, + IN UCHAR TargetId, + IN UCHAR Lun, + IN LONG QueueTag) +{ + // FIXME + UNIMPLEMENTED; + return NULL; +} + +NTSTATUS +SpiAllocateCommonBuffer( + IN OUT PSCSI_PORT_DEVICE_EXTENSION DeviceExtension, + IN ULONG NonCachedSize) +{ + PVOID CommonBuffer; + ULONG CommonBufferLength, BufSize; + + /* If size is 0, set it to 16 */ + if (!DeviceExtension->SrbExtensionSize) + DeviceExtension->SrbExtensionSize = 16; + + /* Calculate size */ + BufSize = DeviceExtension->SrbExtensionSize; + + /* Round it */ + BufSize = (BufSize + sizeof(LONGLONG) - 1) & ~(sizeof(LONGLONG) - 1); + + /* Sum up into the total common buffer length, and round it to page size */ + CommonBufferLength = + ROUND_TO_PAGES(NonCachedSize); + + /* Allocate it */ + if (!DeviceExtension->AdapterObject) + { + /* From nonpaged pool if there is no DMA */ + CommonBuffer = ExAllocatePool(NonPagedPool, CommonBufferLength); + } + else + { + /* Perform a full request since we have a DMA adapter*/ + UNIMPLEMENTED; + CommonBuffer = NULL; + } + + /* Fail in case of error */ + if (!CommonBuffer) + return STATUS_INSUFFICIENT_RESOURCES; + + /* Zero it */ + RtlZeroMemory(CommonBuffer, CommonBufferLength); + + /* Store its size in Device Extension */ + DeviceExtension->CommonBufferLength = CommonBufferLength; + + /* SrbExtension buffer is located at the beginning of the buffer */ + DeviceExtension->SrbExtensionBuffer = CommonBuffer; + + /* Non-cached extension buffer is located at the end of + the common buffer */ + if (NonCachedSize) + { + CommonBufferLength -= NonCachedSize; + DeviceExtension->NonCachedExtension = (PUCHAR)CommonBuffer + CommonBufferLength; + } + else + { + DeviceExtension->NonCachedExtension = NULL; + } + + return STATUS_SUCCESS; +} + +PVOID +DDKAPI +ScsiPortGetUncachedExtension( + IN PVOID HwDeviceExtension, + IN PPORT_CONFIGURATION_INFORMATION ConfigInfo, + IN ULONG NumberOfBytes) +{ + PSCSI_PORT_DEVICE_EXTENSION DeviceExtension; + DEVICE_DESCRIPTION DeviceDescription; + ULONG MapRegistersCount; + NTSTATUS Status; + + DPRINTM2("ScsiPortGetUncachedExtension(%p %p %lu)\n", + HwDeviceExtension, ConfigInfo, NumberOfBytes); + + DeviceExtension = ((PSCSI_PORT_DEVICE_EXTENSION)HwDeviceExtension) - 1; + + /* Check for allocated common DMA buffer */ + if (DeviceExtension->SrbExtensionBuffer != NULL) + { + return NULL; + } + + /* Check for DMA adapter object */ + if (DeviceExtension->AdapterObject == NULL) + { + /* Initialize DMA adapter description */ + RtlZeroMemory(&DeviceDescription, sizeof(DEVICE_DESCRIPTION)); + + DeviceDescription.Version = DEVICE_DESCRIPTION_VERSION; + DeviceDescription.Master = ConfigInfo->Master; + DeviceDescription.ScatterGather = ConfigInfo->ScatterGather; + DeviceDescription.DemandMode = ConfigInfo->DemandMode; + DeviceDescription.Dma32BitAddresses = ConfigInfo->Dma32BitAddresses; + DeviceDescription.BusNumber = ConfigInfo->SystemIoBusNumber; + DeviceDescription.DmaChannel = ConfigInfo->DmaChannel; + DeviceDescription.InterfaceType = ConfigInfo->AdapterInterfaceType; + DeviceDescription.DmaWidth = ConfigInfo->DmaWidth; + DeviceDescription.DmaSpeed = ConfigInfo->DmaSpeed; + DeviceDescription.MaximumLength = ConfigInfo->MaximumTransferLength; + DeviceDescription.DmaPort = ConfigInfo->DmaPort; + + /* Get a DMA adapter object */ +#if 0 + DeviceExtension->AdapterObject = + HalGetAdapter(&DeviceDescription, &MapRegistersCount); + + /* Fail in case of error */ + if (DeviceExtension->AdapterObject == NULL) + { + return NULL; + } +#else + MapRegistersCount = 0; +#endif + + /* Set number of physical breaks */ + if (ConfigInfo->NumberOfPhysicalBreaks != 0 && + MapRegistersCount > ConfigInfo->NumberOfPhysicalBreaks) + { + DeviceExtension->PortCapabilities.MaximumPhysicalPages = + ConfigInfo->NumberOfPhysicalBreaks; + } + else + { + DeviceExtension->PortCapabilities.MaximumPhysicalPages = MapRegistersCount; + } + } + + /* Update Srb extension size */ + if (DeviceExtension->SrbExtensionSize != ConfigInfo->SrbExtensionSize) + DeviceExtension->SrbExtensionSize = ConfigInfo->SrbExtensionSize; + + /* Allocate a common DMA buffer */ + Status = SpiAllocateCommonBuffer(DeviceExtension, NumberOfBytes); + + if (!NT_SUCCESS(Status)) + { + DPRINTM2("SpiAllocateCommonBuffer() failed with Status = 0x%08X!\n", Status); + return NULL; + } + + return DeviceExtension->NonCachedExtension; +} + +PVOID +DDKAPI +ScsiPortGetVirtualAddress( + IN PVOID HwDeviceExtension, + IN SCSI_PHYSICAL_ADDRESS PhysicalAddress) +{ + // FIXME + UNIMPLEMENTED; + return NULL; +} + +VOID +SpiScanDevice( + IN PSCSI_PORT_DEVICE_EXTENSION DeviceExtension, + IN PCHAR ArcName, + IN ULONG ScsiBus, + IN ULONG TargetId, + IN ULONG Lun) +{ + ULONG FileId, i; + ULONG Status; + NTSTATUS ret; + struct _DRIVE_LAYOUT_INFORMATION *PartitionBuffer; + CHAR PartitionName[64]; + + /* Register device with partition(0) suffix */ + sprintf(PartitionName, "%spartition(0)", ArcName); + FsRegisterDevice(PartitionName, &DiskVtbl); + + /* Read device partition table */ + Status = ArcOpen(PartitionName, OpenReadOnly, &FileId); + if (Status == ESUCCESS) + { + ret = HALDISPATCH->HalIoReadPartitionTable((PDEVICE_OBJECT)FileId, 512, FALSE, &PartitionBuffer); + if (NT_SUCCESS(ret)) + { + for (i = 0; i < PartitionBuffer->PartitionCount; i++) + { + if (PartitionBuffer->PartitionEntry[i].PartitionType != PARTITION_ENTRY_UNUSED) + { + sprintf(PartitionName, "%spartition(%lu)", + ArcName, PartitionBuffer->PartitionEntry[i].PartitionNumber); + FsRegisterDevice(PartitionName, &DiskVtbl); + } + } + ExFreePool(PartitionBuffer); + } + ArcClose(FileId); + } +} + +VOID +SpiScanAdapter( + IN PSCSI_PORT_DEVICE_EXTENSION DeviceExtension, + IN ULONG ScsiBus, + IN ULONG PathId) +{ + CHAR ArcName[64]; + PSCSI_REQUEST_BLOCK Srb; + PCDB Cdb; + INQUIRYDATA InquiryBuffer; + ULONG TargetId; + ULONG Lun; + + if (!DeviceExtension->HwResetBus(DeviceExtension->MiniPortDeviceExtension, PathId)) + { + return; + } + + /* Remember the extension */ + ScsiDeviceExtensions[ScsiBus] = DeviceExtension; + + for (TargetId = 0; TargetId < DeviceExtension->MaxTargedIds; TargetId++) + { + Lun = 0; + do + { + DPRINTM2("Scanning SCSI device %d.%d.%d\n", + ScsiBus, TargetId, Lun); + + Srb = ExAllocatePool(PagedPool, sizeof(SCSI_REQUEST_BLOCK)); + if (!Srb) + break; + RtlZeroMemory(Srb, sizeof(SCSI_REQUEST_BLOCK)); + Srb->Length = sizeof(SCSI_REQUEST_BLOCK); + Srb->Function = SRB_FUNCTION_EXECUTE_SCSI; + Srb->PathId = PathId; + Srb->TargetId = TargetId; + Srb->Lun = Lun; + Srb->CdbLength = 6; + Srb->SrbFlags = SRB_FLAGS_DATA_IN; + Srb->DataTransferLength = INQUIRYDATABUFFERSIZE; + Srb->TimeOutValue = 5; /* in seconds */ + Srb->DataBuffer = &InquiryBuffer; + Cdb = (PCDB)Srb->Cdb; + Cdb->CDB6INQUIRY.OperationCode = SCSIOP_INQUIRY; + Cdb->CDB6INQUIRY.LogicalUnitNumber = Srb->Lun; + Cdb->CDB6INQUIRY.AllocationLength = Srb->DataTransferLength; + if (!SpiSendSynchronousSrb(DeviceExtension, Srb)) + { + /* Don't check next LUNs */ + break; + } + + /* Device exists, create its ARC name */ + if (InquiryBuffer.RemovableMedia) + { + sprintf(ArcName, "scsi(%ld)cdrom(%ld)fdisk(%ld)", + ScsiBus, TargetId, Lun); + FsRegisterDevice(ArcName, &DiskVtbl); + } + else + { + sprintf(ArcName, "scsi(%ld)disk(%ld)rdisk(%ld)", + ScsiBus, TargetId, Lun); + /* Now, check if it has partitions */ + SpiScanDevice(DeviceExtension, ArcName, PathId, TargetId, Lun); + } + + /* Check next LUN */ + Lun++; + } while (Lun < SCSI_MAXIMUM_LOGICAL_UNITS); + } +} + +VOID +SpiResourceToConfig( + IN PHW_INITIALIZATION_DATA HwInitializationData, + IN PCM_FULL_RESOURCE_DESCRIPTOR ResourceDescriptor, + IN OUT PPORT_CONFIGURATION_INFORMATION PortConfig) +{ + PACCESS_RANGE AccessRange; + PCM_PARTIAL_RESOURCE_DESCRIPTOR PartialData; + ULONG RangeNumber; + ULONG Index; + + RangeNumber = 0; + + /* Loop through all entries */ + for (Index = 0; Index < ResourceDescriptor->PartialResourceList.Count; Index++) + { + PartialData = &ResourceDescriptor->PartialResourceList.PartialDescriptors[Index]; + + switch (PartialData->Type) + { + case CmResourceTypePort: + /* Copy access ranges */ + if (RangeNumber < HwInitializationData->NumberOfAccessRanges) + { + DPRINTM2("Got port at 0x%I64x, len 0x%x\n", + PartialData->u.Port.Start.QuadPart, PartialData->u.Port.Length); + AccessRange = &((*(PortConfig->AccessRanges))[RangeNumber]); + + AccessRange->RangeStart = PartialData->u.Port.Start; + AccessRange->RangeLength = PartialData->u.Port.Length; + + AccessRange->RangeInMemory = FALSE; + RangeNumber++; + } + break; + + case CmResourceTypeMemory: + /* Copy access ranges */ + if (RangeNumber < HwInitializationData->NumberOfAccessRanges) + { + DPRINTM2("Got memory at 0x%I64x, len 0x%x\n", + PartialData->u.Memory.Start.QuadPart, PartialData->u.Memory.Length); + AccessRange = &((*(PortConfig->AccessRanges))[RangeNumber]); + + AccessRange->RangeStart = PartialData->u.Memory.Start; + AccessRange->RangeLength = PartialData->u.Memory.Length; + + AccessRange->RangeInMemory = TRUE; + RangeNumber++; + } + break; + + case CmResourceTypeInterrupt: + /* Copy interrupt data */ + DPRINTM2("Got interrupt level %d, vector %d\n", + PartialData->u.Interrupt.Level, PartialData->u.Interrupt.Vector); + PortConfig->BusInterruptLevel = PartialData->u.Interrupt.Level; + PortConfig->BusInterruptVector = PartialData->u.Interrupt.Vector; + + /* Set interrupt mode accordingly to the resource */ + if (PartialData->Flags == CM_RESOURCE_INTERRUPT_LATCHED) + { + PortConfig->InterruptMode = Latched; + } + else if (PartialData->Flags == CM_RESOURCE_INTERRUPT_LEVEL_SENSITIVE) + { + PortConfig->InterruptMode = LevelSensitive; + } + break; + + case CmResourceTypeDma: + DPRINTM2("Got DMA channel %d, port %d\n", + PartialData->u.Dma.Channel, PartialData->u.Dma.Port); + PortConfig->DmaChannel = PartialData->u.Dma.Channel; + PortConfig->DmaPort = PartialData->u.Dma.Port; + break; + } + } +} + +BOOLEAN +SpiGetPciConfigData( + IN struct _HW_INITIALIZATION_DATA *HwInitializationData, + IN OUT PPORT_CONFIGURATION_INFORMATION PortConfig, + IN ULONG BusNumber, + IN OUT PPCI_SLOT_NUMBER NextSlotNumber) +{ + PCI_COMMON_CONFIG PciConfig; + PCI_SLOT_NUMBER SlotNumber; + ULONG DataSize; + ULONG DeviceNumber; + ULONG FunctionNumber; + CHAR VendorIdString[8]; + CHAR DeviceIdString[8]; + PCM_RESOURCE_LIST ResourceList; + NTSTATUS Status; + + RtlZeroMemory(&ResourceList, sizeof(PCM_RESOURCE_LIST)); + SlotNumber.u.AsULONG = 0; + + /* Loop through all devices */ + for (DeviceNumber = NextSlotNumber->u.bits.DeviceNumber; DeviceNumber < PCI_MAX_DEVICES; DeviceNumber++) + { + SlotNumber.u.bits.DeviceNumber = DeviceNumber; + + /* Loop through all functions */ + for (FunctionNumber = NextSlotNumber->u.bits.FunctionNumber; FunctionNumber < PCI_MAX_FUNCTION; FunctionNumber++) + { + SlotNumber.u.bits.FunctionNumber = FunctionNumber; + + /* Get PCI config bytes */ + DataSize = HalGetBusDataByOffset( + PCIConfiguration, + BusNumber, + SlotNumber.u.AsULONG, + &PciConfig, + 0, + sizeof(ULONG)); + + /* If result of HalGetBusData is 0, then the bus is wrong */ + if (DataSize == 0) + return FALSE; + + /* If result is PCI_INVALID_VENDORID, then this device has no more + "Functions" */ + if (PciConfig.VendorID == PCI_INVALID_VENDORID) + break; + + sprintf(VendorIdString, "%04hx", PciConfig.VendorID); + sprintf(DeviceIdString, "%04hx", PciConfig.DeviceID); + + if (_strnicmp(VendorIdString, HwInitializationData->VendorId, HwInitializationData->VendorIdLength) || + _strnicmp(DeviceIdString, HwInitializationData->DeviceId, HwInitializationData->DeviceIdLength)) + { + /* It is not our device */ + continue; + } + + DPRINTM2( "Found device 0x%04hx 0x%04hx at %1lu %2lu %1lu\n", + PciConfig.VendorID, PciConfig.DeviceID, + BusNumber, + SlotNumber.u.bits.DeviceNumber, SlotNumber.u.bits.FunctionNumber); + + Status = HalAssignSlotResources(NULL, + NULL, + NULL, + NULL, + PCIBus, + BusNumber, + SlotNumber.u.AsULONG, + &ResourceList); + + if (!NT_SUCCESS(Status)) + break; + + /* Create configuration information */ + SpiResourceToConfig(HwInitializationData, + ResourceList->List, + PortConfig); + + /* Free the resource list */ + ExFreePool(ResourceList); + + /* Set dev & fn numbers */ + NextSlotNumber->u.bits.DeviceNumber = DeviceNumber; + NextSlotNumber->u.bits.FunctionNumber = FunctionNumber + 1; + + /* Save the slot number */ + PortConfig->SlotNumber = SlotNumber.u.AsULONG; + + return TRUE; + } + NextSlotNumber->u.bits.FunctionNumber = 0; + } + + NextSlotNumber->u.bits.DeviceNumber = 0; + + return FALSE; +} + +ULONG +DDKAPI +ScsiPortInitialize( + IN PVOID Argument1, + IN PVOID Argument2, + IN struct _HW_INITIALIZATION_DATA *HwInitializationData, + IN PVOID HwContext OPTIONAL) +{ + PSCSI_PORT_DEVICE_EXTENSION DeviceExtension; + ULONG DeviceExtensionSize; + PORT_CONFIGURATION_INFORMATION PortConfig; + BOOLEAN Again; + BOOLEAN FirstConfigCall = TRUE; + PCI_SLOT_NUMBER SlotNumber; + NTSTATUS Status; + + if (HwInitializationData->HwInitializationDataSize != sizeof(HW_INITIALIZATION_DATA)) + { + return STATUS_INVALID_PARAMETER; + } + + /* Check params for validity */ + if ((HwInitializationData->HwInitialize == NULL) || + (HwInitializationData->HwStartIo == NULL) || + (HwInitializationData->HwInterrupt == NULL) || + (HwInitializationData->HwFindAdapter == NULL) || + (HwInitializationData->HwResetBus == NULL)) + { + return STATUS_INVALID_PARAMETER; + } + + /* Zero starting slot number */ + SlotNumber.u.AsULONG = 0; + + while (TRUE) + { + Again = FALSE; + + DeviceExtensionSize = sizeof(SCSI_PORT_DEVICE_EXTENSION) + HwInitializationData->DeviceExtensionSize; + DeviceExtension = MmHeapAlloc(DeviceExtensionSize); + if (!DeviceExtension) + { + return STATUS_NO_MEMORY; + } + RtlZeroMemory(DeviceExtension, DeviceExtensionSize); + DeviceExtension->InterruptFlags = SCSI_PORT_NEXT_REQUEST_READY; + DeviceExtension->HwInitialize = HwInitializationData->HwInitialize; + DeviceExtension->HwStartIo = HwInitializationData->HwStartIo; + DeviceExtension->HwInterrupt = HwInitializationData->HwInterrupt; + DeviceExtension->HwResetBus = HwInitializationData->HwResetBus; + DeviceExtension->MiniPortDeviceExtension = (PVOID)(DeviceExtension + 1); + + Status = SpiCreatePortConfig(DeviceExtension, + HwInitializationData, + &PortConfig, + FirstConfigCall); + if (Status != STATUS_SUCCESS) + { + MmHeapFree(DeviceExtension); + return Status; + } + + PortConfig.NumberOfAccessRanges = HwInitializationData->NumberOfAccessRanges; + PortConfig.AccessRanges = MmHeapAlloc(sizeof(ACCESS_RANGE) * HwInitializationData->NumberOfAccessRanges); + if (!PortConfig.AccessRanges) + { + MmHeapFree(DeviceExtension); + return STATUS_NO_MEMORY; + } + RtlZeroMemory(PortConfig.AccessRanges, sizeof(ACCESS_RANGE) * HwInitializationData->NumberOfAccessRanges); + + /* Search for matching PCI device */ + if ((HwInitializationData->AdapterInterfaceType == PCIBus) && + (HwInitializationData->VendorIdLength > 0) && + (HwInitializationData->VendorId != NULL) && + (HwInitializationData->DeviceIdLength > 0) && + (HwInitializationData->DeviceId != NULL)) + { + PortConfig.BusInterruptLevel = 0; + + /* Get PCI device data */ + DPRINTM2("VendorId '%.*s' DeviceId '%.*s'\n", + HwInitializationData->VendorIdLength, + HwInitializationData->VendorId, + HwInitializationData->DeviceIdLength, + HwInitializationData->DeviceId); + + if (!SpiGetPciConfigData(HwInitializationData, + &PortConfig, + 0, /* FIXME */ + &SlotNumber)) + { + /* Continue to the next bus, nothing here */ + MmHeapFree(DeviceExtension); + return STATUS_INTERNAL_ERROR; + } + + if (!PortConfig.BusInterruptLevel) + { + /* Bypass this slot, because no interrupt was assigned */ + MmHeapFree(DeviceExtension); + return STATUS_INTERNAL_ERROR; + } + } + + if (HwInitializationData->HwFindAdapter( + DeviceExtension->MiniPortDeviceExtension, + HwContext, + NULL, + NULL, + &PortConfig, + &Again) != SP_RETURN_FOUND) + { + MmHeapFree(DeviceExtension); + return STATUS_INTERNAL_ERROR; + } + + /* Copy all stuff which we ever need from PortConfig to the DeviceExtension */ + if (PortConfig.MaximumNumberOfTargets > SCSI_MAXIMUM_TARGETS_PER_BUS) + DeviceExtension->MaxTargedIds = SCSI_MAXIMUM_TARGETS_PER_BUS; + else + DeviceExtension->MaxTargedIds = PortConfig.MaximumNumberOfTargets; + + DeviceExtension->BusNum = PortConfig.SystemIoBusNumber; + + DPRINTM2("Adapter found: buses = %d, targets = %d\n", + PortConfig.NumberOfBuses, DeviceExtension->MaxTargedIds); + + /* Initialize adapter */ + if (!DeviceExtension->HwInitialize(DeviceExtension->MiniPortDeviceExtension)) + { + MmHeapFree(DeviceExtension); + return STATUS_INTERNAL_ERROR; + } + + /* Scan bus */ + { + ULONG ScsiBus; + for (ScsiBus = 0; ScsiBus < PortConfig.NumberOfBuses; ScsiBus++) + { + SpiScanAdapter(DeviceExtension, PortConfig.SystemIoBusNumber, ScsiBus); + PortConfig.SystemIoBusNumber++; + } + } + + FirstConfigCall = FALSE; + if (!Again) + { + break; + } + } + + return STATUS_SUCCESS; +} + +VOID +DDKAPI +ScsiPortIoMapTransfer( + IN PVOID HwDeviceExtension, + IN PSCSI_REQUEST_BLOCK Srb, + IN PVOID LogicalAddress, + IN ULONG Length) +{ + // FIXME + UNIMPLEMENTED; +} + +VOID +DDKAPI +ScsiPortLogError( + IN PVOID HwDeviceExtension, + IN PSCSI_REQUEST_BLOCK Srb OPTIONAL, + IN UCHAR PathId, + IN UCHAR TargetId, + IN UCHAR Lun, + IN ULONG ErrorCode, + IN ULONG UniqueId) +{ + // FIXME + UNIMPLEMENTED; +} + +VOID +DDKAPI +ScsiPortMoveMemory( + IN PVOID WriteBuffer, + IN PVOID ReadBuffer, + IN ULONG Length) +{ + RtlMoveMemory(WriteBuffer, ReadBuffer, Length); +} + +VOID +DDKCDECLAPI +ScsiPortNotification( + IN SCSI_NOTIFICATION_TYPE NotificationType, + IN PVOID HwDeviceExtension, + IN ...) +{ + PSCSI_PORT_DEVICE_EXTENSION DeviceExtension; + PSCSI_REQUEST_BLOCK Srb; + va_list ap; + + DeviceExtension = ((PSCSI_PORT_DEVICE_EXTENSION)HwDeviceExtension) - 1; + + va_start(ap, HwDeviceExtension); + + switch (NotificationType) + { + case RequestComplete: + /* Mask the SRB as completed */ + Srb = va_arg(ap, PSCSI_REQUEST_BLOCK); + Srb->SrbFlags &= ~SRB_FLAGS_IS_ACTIVE; + break; + + case NextRequest: + /* Say that device is ready */ + DeviceExtension->InterruptFlags |= SCSI_PORT_NEXT_REQUEST_READY; + break; + + default: + // FIXME + UNIMPLEMENTED; + } + + va_end(ap); +} + +VOID +DDKAPI +ScsiPortReadPortBufferUchar( + IN PUCHAR Port, + OUT PUCHAR Buffer, + IN ULONG Count) +{ + __inbytestring(H2I(Port), Buffer, Count); +} + +VOID +DDKAPI +ScsiPortReadPortBufferUlong( + IN PULONG Port, + OUT PULONG Buffer, + IN ULONG Count) +{ + __indwordstring(H2I(Port), Buffer, Count); +} + +VOID +DDKAPI +ScsiPortReadPortBufferUshort( + IN PUSHORT Port, + OUT PUSHORT Buffer, + IN ULONG Count) +{ + __inwordstring(H2I(Port), Buffer, Count); +} + +UCHAR +DDKAPI +ScsiPortReadPortUchar( + IN PUCHAR Port) +{ + DPRINTM2("ScsiPortReadPortUchar(%p)\n", + Port); + + return READ_PORT_UCHAR(Port); +} + +ULONG +DDKAPI +ScsiPortReadPortUlong( + IN PULONG Port) +{ + return READ_PORT_ULONG(Port); +} + +USHORT +DDKAPI +ScsiPortReadPortUshort( + IN PUSHORT Port) +{ + return READ_PORT_USHORT(Port); +} + +VOID +DDKAPI +ScsiPortReadRegisterBufferUchar( + IN PUCHAR Register, + IN PUCHAR Buffer, + IN ULONG Count) +{ + // FIXME + UNIMPLEMENTED; +} + +VOID +DDKAPI +ScsiPortReadRegisterBufferUlong( + IN PULONG Register, + IN PULONG Buffer, + IN ULONG Count) +{ + // FIXME + UNIMPLEMENTED; +} + +VOID +DDKAPI +ScsiPortReadRegisterBufferUshort( + IN PUSHORT Register, + IN PUSHORT Buffer, + IN ULONG Count) +{ + // FIXME + UNIMPLEMENTED; +} + +UCHAR +DDKAPI +ScsiPortReadRegisterUchar( + IN PUCHAR Register) +{ + return READ_REGISTER_UCHAR(Register); +} + +ULONG +DDKAPI +ScsiPortReadRegisterUlong( + IN PULONG Register) +{ + return READ_REGISTER_ULONG(Register); +} + +USHORT +DDKAPI +ScsiPortReadRegisterUshort( + IN PUSHORT Register) +{ + return READ_REGISTER_USHORT(Register); +} + +ULONG +DDKAPI +ScsiPortSetBusDataByOffset( + IN PVOID DeviceExtension, + IN ULONG BusDataType, + IN ULONG SystemIoBusNumber, + IN ULONG SlotNumber, + IN PVOID Buffer, + IN ULONG Offset, + IN ULONG Length) +{ + // FIXME + UNIMPLEMENTED; + return 0; +} + +VOID +DDKAPI +ScsiPortStallExecution( + IN ULONG Delay) +{ + KeStallExecutionProcessor(Delay); +} + +BOOLEAN +DDKAPI +ScsiPortValidateRange( + IN PVOID HwDeviceExtension, + IN INTERFACE_TYPE BusType, + IN ULONG SystemIoBusNumber, + IN SCSI_PHYSICAL_ADDRESS IoAddress, + IN ULONG NumberOfBytes, + IN BOOLEAN InIoSpace) +{ + // FIXME + UNIMPLEMENTED; + return TRUE; +} + +#if 0 +// ScsiPortWmi* +#endif + + +VOID +DDKAPI +ScsiPortWritePortBufferUchar( + IN PUCHAR Port, + IN PUCHAR Buffer, + IN ULONG Count) +{ + __outbytestring(H2I(Port), Buffer, Count); +} + +VOID +DDKAPI +ScsiPortWritePortBufferUlong( + IN PULONG Port, + IN PULONG Buffer, + IN ULONG Count) +{ + __outdwordstring(H2I(Port), Buffer, Count); +} + +VOID +DDKAPI +ScsiPortWritePortBufferUshort( + IN PUSHORT Port, + IN PUSHORT Buffer, + IN ULONG Count) +{ + __outwordstring(H2I(Port), Buffer, Count); +} + +VOID +DDKAPI +ScsiPortWritePortUchar( + IN PUCHAR Port, + IN UCHAR Value) +{ + WRITE_PORT_UCHAR(Port, Value); +} + +VOID +DDKAPI +ScsiPortWritePortUlong( + IN PULONG Port, + IN ULONG Value) +{ + WRITE_PORT_ULONG(Port, Value); +} + +VOID +DDKAPI +ScsiPortWritePortUshort( + IN PUSHORT Port, + IN USHORT Value) +{ + WRITE_PORT_USHORT(Port, Value); +} + +VOID +DDKAPI +ScsiPortWriteRegisterBufferUchar( + IN PUCHAR Register, + IN PUCHAR Buffer, + IN ULONG Count) +{ + // FIXME + UNIMPLEMENTED; +} + +VOID +DDKAPI +ScsiPortWriteRegisterBufferUlong( + IN PULONG Register, + IN PULONG Buffer, + IN ULONG Count) +{ + // FIXME + UNIMPLEMENTED; +} + +VOID +DDKAPI +ScsiPortWriteRegisterBufferUshort( + IN PUSHORT Register, + IN PUSHORT Buffer, + IN ULONG Count) +{ + // FIXME + UNIMPLEMENTED; +} + +VOID +DDKAPI +ScsiPortWriteRegisterUchar( + IN PUCHAR Register, + IN ULONG Value) +{ + WRITE_REGISTER_UCHAR(Register, Value); +} + +VOID +DDKAPI +ScsiPortWriteRegisterUlong( + IN PULONG Register, + IN ULONG Value) +{ + WRITE_REGISTER_ULONG(Register, Value); +} + +VOID +DDKAPI +ScsiPortWriteRegisterUshort( + IN PUSHORT Register, + IN USHORT Value) +{ + WRITE_REGISTER_USHORT(Register, Value); +} + +ULONG +LoadBootDeviceDriver(VOID) +{ + struct + { + CHAR* Name; + PVOID Function; + } ExportTable[] = + { + { "ScsiDebugPrint", ScsiDebugPrint }, + { "ScsiPortCompleteRequest", ScsiPortCompleteRequest }, + { "ScsiPortConvertPhysicalAddressToUlong", ScsiPortConvertPhysicalAddressToUlong }, + { "ScsiPortConvertUlongToPhysicalAddress", ScsiPortConvertUlongToPhysicalAddress }, + { "ScsiPortFlushDma", ScsiPortFlushDma }, + { "ScsiPortFreeDeviceBase", ScsiPortFreeDeviceBase }, + { "ScsiPortGetBusData", ScsiPortGetBusData }, + { "ScsiPortGetDeviceBase", ScsiPortGetDeviceBase }, + { "ScsiPortGetLogicalUnit", ScsiPortGetLogicalUnit }, + { "ScsiPortGetPhysicalAddress", ScsiPortGetPhysicalAddress }, + { "ScsiPortGetSrb", ScsiPortGetSrb }, + { "ScsiPortGetUncachedExtension", ScsiPortGetUncachedExtension }, + { "ScsiPortGetVirtualAddress", ScsiPortGetVirtualAddress }, + { "ScsiPortInitialize", ScsiPortInitialize }, + { "ScsiPortIoMapTransfer", ScsiPortIoMapTransfer }, + { "ScsiPortLogError", ScsiPortLogError }, + { "ScsiPortMoveMemory", ScsiPortMoveMemory }, + { "ScsiPortNotification", ScsiPortNotification }, + { "ScsiPortReadPortBufferUchar", ScsiPortReadPortBufferUchar }, + { "ScsiPortReadPortBufferUlong", ScsiPortReadPortBufferUlong }, + { "ScsiPortReadPortBufferUshort", ScsiPortReadPortBufferUshort }, + { "ScsiPortReadPortUchar", ScsiPortReadPortUchar }, + { "ScsiPortReadPortUlong", ScsiPortReadPortUlong }, + { "ScsiPortReadPortUshort", ScsiPortReadPortUshort }, + { "ScsiPortReadRegisterBufferUchar", ScsiPortReadRegisterBufferUchar }, + { "ScsiPortReadRegisterBufferUlong", ScsiPortReadRegisterBufferUlong }, + { "ScsiPortReadRegisterBufferUshort", ScsiPortReadRegisterBufferUshort }, + { "ScsiPortReadRegisterUchar", ScsiPortReadRegisterUchar }, + { "ScsiPortReadRegisterUlong", ScsiPortReadRegisterUlong }, + { "ScsiPortReadRegisterUshort", ScsiPortReadRegisterUshort }, + { "ScsiPortSetBusDataByOffset", ScsiPortSetBusDataByOffset }, + { "ScsiPortStallExecution", ScsiPortStallExecution }, + { "ScsiPortValidateRange", ScsiPortValidateRange }, + { "ScsiPortWritePortBufferUchar", ScsiPortWritePortBufferUchar }, + { "ScsiPortWritePortBufferUlong", ScsiPortWritePortBufferUlong }, + { "ScsiPortWritePortBufferUshort", ScsiPortWritePortBufferUshort }, + { "ScsiPortWritePortUchar", ScsiPortWritePortUchar }, + { "ScsiPortWritePortUlong", ScsiPortWritePortUlong }, + { "ScsiPortWritePortUshort", ScsiPortWritePortUshort }, + { "ScsiPortWriteRegisterBufferUchar", ScsiPortWriteRegisterBufferUchar }, + { "ScsiPortWriteRegisterBufferUlong", ScsiPortWriteRegisterBufferUlong }, + { "ScsiPortWriteRegisterBufferUshort", ScsiPortWriteRegisterBufferUshort }, + { "ScsiPortWriteRegisterUchar", ScsiPortWriteRegisterUchar }, + { "ScsiPortWriteRegisterUlong", ScsiPortWriteRegisterUlong }, + { "ScsiPortWriteRegisterUshort", ScsiPortWriteRegisterUshort }, + }; + IMAGE_DOS_HEADER ImageDosHeader; + IMAGE_NT_HEADERS ImageNtHeaders; + IMAGE_EXPORT_DIRECTORY ImageExportDirectory; + CHAR* TableName[sizeof(ExportTable) / sizeof(ExportTable[0])]; + USHORT OrdinalTable[sizeof(ExportTable) / sizeof(ExportTable[0])]; + ULONG FunctionTable[sizeof(ExportTable) / sizeof(ExportTable[0])]; + + PIMAGE_NT_HEADERS NtHeaders; + LOADER_PARAMETER_BLOCK LoaderBlock; + PIMAGE_IMPORT_DESCRIPTOR ImportTable; + ULONG ImportTableSize; + PLDR_DATA_TABLE_ENTRY BootDdDTE, FreeldrDTE; + CHAR NtBootDdPath[MAX_PATH]; + PVOID ImageBase; + ULONG (NTAPI *EntryPoint)(IN PVOID DriverObject, IN PVOID RegistryPath); + ULONG i; + BOOLEAN Status; + + /* Some initialization of our temporary loader block */ + RtlZeroMemory(&LoaderBlock, sizeof(LOADER_PARAMETER_BLOCK)); + InitializeListHead(&LoaderBlock.LoadOrderListHead); + + /* Create our fake executable header for freeldr.sys */ + RtlZeroMemory(&ImageDosHeader, sizeof(IMAGE_DOS_HEADER)); + RtlZeroMemory(&ImageNtHeaders, sizeof(IMAGE_NT_HEADERS)); + RtlZeroMemory(&ImageExportDirectory, sizeof(IMAGE_EXPORT_DIRECTORY)); + ImageDosHeader.e_magic = SWAPW(IMAGE_DOS_SIGNATURE); + ImageDosHeader.e_lfanew = SWAPD((ULONG_PTR)&ImageNtHeaders - (ULONG_PTR)&ImageDosHeader); + ImageNtHeaders.Signature = IMAGE_NT_SIGNATURE; + ImageNtHeaders.OptionalHeader.NumberOfRvaAndSizes = SWAPD(IMAGE_DIRECTORY_ENTRY_EXPORT + 1); + ImageNtHeaders.OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_EXPORT].VirtualAddress = + SWAPW((ULONG_PTR)&ImageExportDirectory - (ULONG_PTR)&ImageDosHeader); + ImageNtHeaders.OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_EXPORT].Size = 1; + ImageExportDirectory.NumberOfNames = sizeof(ExportTable) / sizeof(ExportTable[0]); + ImageExportDirectory.AddressOfNames = (ULONG_PTR)TableName - (ULONG_PTR)&ImageDosHeader; + ImageExportDirectory.AddressOfNameOrdinals = (ULONG_PTR)OrdinalTable - (ULONG_PTR)&ImageDosHeader; + ImageExportDirectory.NumberOfFunctions = sizeof(ExportTable) / sizeof(ExportTable[0]); + ImageExportDirectory.AddressOfFunctions = (ULONG_PTR)FunctionTable - (ULONG_PTR)&ImageDosHeader; + + /* Fill freeldr.sys export table */ + for (i = 0; i < sizeof(ExportTable) / sizeof(ExportTable[0]); i++) + { + TableName[i] = PaToVa((PVOID)((ULONG_PTR)ExportTable[i].Name - (ULONG_PTR)&ImageDosHeader)); + OrdinalTable[i] = i; + FunctionTable[i] = (ULONG)((ULONG_PTR)ExportTable[i].Function - (ULONG_PTR)&ImageDosHeader); + } + + /* Add freeldr.sys to list of loaded executables */ + RtlZeroMemory(FreeldrDTE, sizeof(LDR_DATA_TABLE_ENTRY)); + Status = WinLdrAllocateDataTableEntry(&LoaderBlock, "scsiport.sys", + "FREELDR.SYS", &ImageDosHeader, &FreeldrDTE); + if (!Status) + return EIO; + + /* Create full ntbootdd.sys path */ + MachDiskGetBootPath(NtBootDdPath, sizeof(NtBootDdPath)); + strcat(NtBootDdPath, "\\NTBOOTDD.SYS"); + + /* Load file */ + Status = WinLdrLoadImage(NtBootDdPath, LoaderBootDriver, &ImageBase); + if (!Status) + { + /* That's OK. File simply doesn't exist */ + return ESUCCESS; + } + + /* Fix imports */ + Status = WinLdrAllocateDataTableEntry(&LoaderBlock, "ntbootdd.sys", + "NTBOOTDD.SYS", ImageBase, &BootDdDTE); + if (!Status) + return EIO; + Status = WinLdrScanImportDescriptorTable(&LoaderBlock, "", BootDdDTE); + if (!Status) + return EIO; + + /* Change imports to PA */ + ImportTable = (PIMAGE_IMPORT_DESCRIPTOR)RtlImageDirectoryEntryToData(VaToPa(BootDdDTE->DllBase), + TRUE, IMAGE_DIRECTORY_ENTRY_IMPORT, &ImportTableSize); + for (;(ImportTable->Name != 0) && (ImportTable->FirstThunk != 0);ImportTable++) + { + PIMAGE_THUNK_DATA ThunkData = (PIMAGE_THUNK_DATA)VaToPa(RVA(BootDdDTE->DllBase, ImportTable->FirstThunk)); + + while (((PIMAGE_THUNK_DATA)ThunkData)->u1.AddressOfData != 0) + { + ThunkData->u1.Function = (ULONG)VaToPa((PVOID)ThunkData->u1.Function); + ThunkData++; + } + } + + /* Relocate image to PA */ + NtHeaders = RtlImageNtHeader(VaToPa(BootDdDTE->DllBase)); + if (!NtHeaders) + return EIO; + Status = LdrRelocateImageWithBias( + VaToPa(BootDdDTE->DllBase), + NtHeaders->OptionalHeader.ImageBase - (ULONG_PTR)BootDdDTE->DllBase, + "FreeLdr", + TRUE, + TRUE, /* in case of conflict still return success */ + FALSE); + if (!Status) + return EIO; + + /* Call the entrypoint */ + EntryPoint = VaToPa(BootDdDTE->EntryPoint); + (*EntryPoint)(NULL, NULL); + + return ESUCCESS; +} + +/* EOF */ Propchange: trunk/reactos/boot/freeldr/freeldr/disk/scsiport.c ------------------------------------------------------------------------------ svn:eol-style = native 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] Mon Mar 8 23:04:38 2010 @@ -19,6 +19,9 @@ #include <freeldr.h> #include <debug.h> + +VOID NTAPI HalpInitializePciStubs(VOID); +VOID NTAPI HalpInitBusHandler(VOID); VOID BootMain(LPSTR CmdLine) { @@ -44,5 +47,7 @@ return; } + HalpInitializePciStubs(); + HalpInitBusHandler(); RunLoader(); } Modified: trunk/reactos/boot/freeldr/freeldr/freeldr_base.rbuild URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/freel…
============================================================================== --- trunk/reactos/boot/freeldr/freeldr/freeldr_base.rbuild [iso-8859-1] (original) +++ trunk/reactos/boot/freeldr/freeldr/freeldr_base.rbuild [iso-8859-1] Mon Mar 8 23:04:38 2010 @@ -22,6 +22,7 @@ <file>disk.c</file> <file>partition.c</file> <file>ramdisk.c</file> + <file>scsiport.c</file> </directory> <directory name="fs"> <file>ext2.c</file> 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] Mon Mar 8 23:04:38 2010 @@ -140,3 +140,5 @@ BOOLEAN DiskGetFirstPartitionEntry(PMASTER_BOOT_RECORD MasterBootRecord, PPARTITION_TABLE_ENTRY PartitionTableEntry); BOOLEAN DiskGetFirstExtendedPartitionEntry(PMASTER_BOOT_RECORD MasterBootRecord, PPARTITION_TABLE_ENTRY PartitionTableEntry); BOOLEAN DiskReadBootRecord(ULONG DriveNumber, ULONGLONG LogicalSectorNumber, PMASTER_BOOT_RECORD BootRecord); + +ULONG LoadBootDeviceDriver(VOID); Modified: trunk/reactos/boot/freeldr/freeldr/include/reactos.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/inclu…
============================================================================== --- trunk/reactos/boot/freeldr/freeldr/include/reactos.h [iso-8859-1] (original) +++ trunk/reactos/boot/freeldr/freeldr/include/reactos.h [iso-8859-1] Mon Mar 8 23:04:38 2010 @@ -73,6 +73,14 @@ // ARC Path Functions // /////////////////////////////////////////////////////////////////////////////////////// +BOOLEAN +DissectArcPath2( + IN CHAR* ArcPath, + OUT ULONG* x, + OUT ULONG* y, + OUT ULONG* z, + OUT ULONG* Partition, + OUT ULONG *PathSyntax); BOOLEAN DissectArcPath(CHAR *ArcPath, CHAR *BootPath, ULONG* BootDrive, ULONG* BootPartition); VOID ConstructArcPath(PCHAR ArcPath, PCHAR SystemFolder, ULONG Disk, ULONG Partition); ULONG ConvertArcNameToBiosDriveNumber(PCHAR ArcPath); Modified: trunk/reactos/boot/freeldr/freeldr/reactos/arcname.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/react…
============================================================================== --- trunk/reactos/boot/freeldr/freeldr/reactos/arcname.c [iso-8859-1] (original) +++ trunk/reactos/boot/freeldr/freeldr/reactos/arcname.c [iso-8859-1] Mon Mar 8 23:04:38 2010 @@ -104,6 +104,62 @@ return TRUE; } +/* PathSyntax: scsi() = 0, multi() = 1, ramdisk() = 2 */ +BOOLEAN +DissectArcPath2( + IN CHAR* ArcPath, + OUT ULONG* x, + OUT ULONG* y, + OUT ULONG* z, + OUT ULONG* Partition, + OUT ULONG *PathSyntax) +{ + /* Detect ramdisk() */ + if (_strnicmp(ArcPath, "ramdisk(0)", 10) == 0) + { + *x = *y = *z = 0; + *Partition = 1; + *PathSyntax = 2; + return TRUE; + } + /* Detect scsi()disk()rdisk()partition() */ + else if (sscanf(ArcPath, "scsi(%lu)disk(%lu)rdisk(%lu)partition(%lu)", x, y, z, Partition) == 4) + { + *PathSyntax = 0; + return TRUE; + } + /* Detect scsi()cdrom()fdisk() */ + else if (sscanf(ArcPath, "scsi(%lu)cdrom(%lu)fdisk(%lu)", x, y, z) == 3) + { + *Partition = 0; + *PathSyntax = 0; + return TRUE; + } + /* Detect multi()disk()rdisk()partition() */ + else if (sscanf(ArcPath, "multi(%lu)disk(%lu)rdisk(%lu)partition(%lu)", x, y, z, Partition) == 4) + { + *PathSyntax = 1; + return TRUE; + } + /* Detect multi()disk()cdrom() */ + else if (sscanf(ArcPath, "multi(%lu)disk(%lu)cdrom(%lu)", x, y, z) == 3) + { + *Partition = 1; + *PathSyntax = 1; + return TRUE; + } + /* Detect multi()disk()fdisk() */ + else if (sscanf(ArcPath, "multi(%lu)disk(%lu)fdisk(%lu)", x, y, z) == 3) + { + *Partition = 1; + *PathSyntax = 1; + return TRUE; + } + + /* Unknown syntax */ + return FALSE; +} + VOID ConstructArcPath(PCHAR ArcPath, PCHAR SystemFolder, ULONG Disk, ULONG Partition) { char tmp[50]; Modified: trunk/reactos/boot/freeldr/freeldr/windows/peloader.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/windo…
============================================================================== --- trunk/reactos/boot/freeldr/freeldr/windows/peloader.c [iso-8859-1] (original) +++ trunk/reactos/boot/freeldr/freeldr/windows/peloader.c [iso-8859-1] Mon Mar 8 23:04:38 2010 @@ -277,7 +277,7 @@ Status = ArcOpen(FileName, OpenReadOnly, &FileId); if (Status != ESUCCESS) { - UiMessageBox("Can not open the file"); + //UiMessageBox("Can not open the file"); return FALSE; }
14 years, 10 months
1
0
0
0
[hpoussin] 46016: [headers] Fix type of PRTL_HEAP_PARAMETERS in ifssupp.h. Will be required soon
by hpoussin@svn.reactos.org
Author: hpoussin Date: Mon Mar 8 22:42:18 2010 New Revision: 46016 URL:
http://svn.reactos.org/svn/reactos?rev=46016&view=rev
Log: [headers] Fix type of PRTL_HEAP_PARAMETERS in ifssupp.h. Will be required soon Modified: trunk/reactos/include/ndk/ifssupp.h Modified: trunk/reactos/include/ndk/ifssupp.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/ndk/ifssupp.h?rev=…
============================================================================== --- trunk/reactos/include/ndk/ifssupp.h [iso-8859-1] (original) +++ trunk/reactos/include/ndk/ifssupp.h [iso-8859-1] Mon Mar 8 22:42:18 2010 @@ -27,7 +27,28 @@ TokenImpersonation } TOKEN_TYPE, *PTOKEN_TYPE; -typedef PVOID PRTL_HEAP_PARAMETERS; +typedef NTSTATUS +(NTAPI * PRTL_HEAP_COMMIT_ROUTINE)( + IN PVOID Base, + IN OUT PVOID *CommitAddress, + IN OUT PSIZE_T CommitSize +); + +typedef struct _RTL_HEAP_PARAMETERS +{ + ULONG Length; + SIZE_T SegmentReserve; + SIZE_T SegmentCommit; + SIZE_T DeCommitFreeBlockThreshold; + SIZE_T DeCommitTotalFreeThreshold; + SIZE_T MaximumAllocationSize; + SIZE_T VirtualMemoryThreshold; + SIZE_T InitialCommit; + SIZE_T InitialReserve; + PRTL_HEAP_COMMIT_ROUTINE CommitRoutine; + SIZE_T Reserved[2]; +} RTL_HEAP_PARAMETERS, *PRTL_HEAP_PARAMETERS; + typedef PVOID PFS_FILTER_CALLBACKS; typedef USHORT SECURITY_DESCRIPTOR_CONTROL, *PSECURITY_DESCRIPTOR_CONTROL;
14 years, 10 months
1
0
0
0
[hpoussin] 46015: Fix include directories
by hpoussin@svn.reactos.org
Author: hpoussin Date: Mon Mar 8 22:40:29 2010 New Revision: 46015 URL:
http://svn.reactos.org/svn/reactos?rev=46015&view=rev
Log: Fix include directories Modified: trunk/reactos/lib/sdk/crt/libcntpr.rbuild Modified: trunk/reactos/lib/sdk/crt/libcntpr.rbuild URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/libcntpr.rbuil…
============================================================================== --- trunk/reactos/lib/sdk/crt/libcntpr.rbuild [iso-8859-1] (original) +++ trunk/reactos/lib/sdk/crt/libcntpr.rbuild [iso-8859-1] Mon Mar 8 22:40:29 2010 @@ -1,8 +1,8 @@ <?xml version="1.0"?> <!DOCTYPE module SYSTEM "../../../tools/rbuild/project.dtd"> <module name="libcntpr" type="staticlibrary"> - <include base="crt">.</include> - <include base="crt">include</include> + <include base="libcntpr">.</include> + <include base="libcntpr">include</include> <define name="NO_RTL_INLINES" /> <define name="_NTSYSTEM_" /> <define name="_NTDLLBUILD_" />
14 years, 10 months
1
0
0
0
[akhaldi] 46014: [NTIFS] - Group related definitions - Add several Rtl* function declarations (See diff for details) - Add MAX_UNICODE_STACK_BUFFER_LENGTH definition - RtlConvertSidToUnicodeString : DestinationString -> UnicodeString
by akhaldi@svn.reactos.org
Author: akhaldi Date: Mon Mar 8 22:38:43 2010 New Revision: 46014 URL:
http://svn.reactos.org/svn/reactos?rev=46014&view=rev
Log: [NTIFS] - Group related definitions - Add several Rtl* function declarations (See diff for details) - Add MAX_UNICODE_STACK_BUFFER_LENGTH definition - RtlConvertSidToUnicodeString : DestinationString -> UnicodeString Modified: branches/header-work/include/ddk/ntifs.h Modified: branches/header-work/include/ddk/ntifs.h URL:
http://svn.reactos.org/svn/reactos/branches/header-work/include/ddk/ntifs.h…
============================================================================== --- branches/header-work/include/ddk/ntifs.h [iso-8859-1] (original) +++ branches/header-work/include/ddk/ntifs.h [iso-8859-1] Mon Mar 8 22:38:43 2010 @@ -1406,6 +1406,84 @@ IN PSID_IDENTIFIER_AUTHORITY IdentifierAuthority, IN UCHAR SubAuthorityCount); +NTSYSAPI +PULONG +NTAPI +RtlSubAuthoritySid( + IN PSID Sid, + IN ULONG SubAuthority); + +NTSYSAPI +ULONG +NTAPI +RtlLengthSid( + IN PSID Sid); + +NTSYSAPI +NTSTATUS +NTAPI +RtlCopySid( + IN ULONG Length, + IN PSID Destination, + IN PSID Source); + +NTSYSAPI +NTSTATUS +NTAPI +RtlConvertSidToUnicodeString( + IN OUT PUNICODE_STRING UnicodeString, + IN PSID Sid, + IN BOOLEAN AllocateDestinationString); + +NTSYSAPI +VOID +NTAPI +RtlCopyLuid( + OUT PLUID DestinationLuid, + IN PLUID SourceLuid); + +NTSYSAPI +NTSTATUS +NTAPI +RtlCreateAcl( + OUT PACL Acl, + IN ULONG AclLength, + IN ULONG AclRevision); + +NTSYSAPI +NTSTATUS +NTAPI +RtlAddAce( + IN OUT PACL Acl, + IN ULONG AceRevision, + IN ULONG StartingAceIndex, + IN PVOID AceList, + IN ULONG AceListLength); + +NTSYSAPI +NTSTATUS +NTAPI +RtlDeleteAce( + IN OUT PACL Acl, + IN ULONG AceIndex); + +NTSYSAPI +NTSTATUS +NTAPI +RtlGetAce( + IN PACL Acl, + IN ULONG AceIndex, + OUT PVOID *Ace); + +NTSYSAPI +NTSTATUS +NTAPI +RtlAddAccessAllowedAce( + IN OUT PACL Acl, + IN ULONG AceRevision, + IN ACCESS_MASK AccessMask, + IN PSID Sid); + #endif #if (NTDDI_VERSION >= NTDDI_WINXP) @@ -1557,6 +1635,12 @@ PSID_IDENTIFIER_AUTHORITY NTAPI RtlIdentifierAuthoritySid( + IN PSID Sid); + +NTSYSAPI +PUCHAR +NTAPI +RtlSubAuthorityCountSid( IN PSID Sid); #endif @@ -1623,6 +1707,19 @@ #endif +#if (NTDDI_VERSION >= NTDDI_WS03SP1) + +NTSYSAPI +NTSTATUS +NTAPI +RtlGetSaclSecurityDescriptor( + IN PSECURITY_DESCRIPTOR SecurityDescriptor, + OUT PBOOLEAN SaclPresent, + OUT PACL *Sacl, + OUT PBOOLEAN SaclDefaulted); + +#endif + #if (NTDDI_VERSION >= NTDDI_VISTA) NTSYSAPI @@ -1674,6 +1771,14 @@ OUT PWSTR DestinationString, IN OUT PLONG DestinationStringLength); +NTSYSAPI +NTSTATUS +NTAPI +RtlCreateServiceSid( + IN PUNICODE_STRING ServiceName, + OUT PSID ServiceSid, + IN OUT PULONG ServiceSidLength); + #endif #if (NTDDI_VERSION >= NTDDI_WIN7) @@ -1697,6 +1802,24 @@ OUT PULONG UnicodeStringActualByteCount, IN PCCH UTF8StringSource, IN ULONG UTF8StringByteCount); + +NTSYSAPI +NTSTATUS +NTAPI +RtlReplaceSidInSd( + IN OUT PSECURITY_DESCRIPTOR SecurityDescriptor, + IN PSID OldSid, + IN PSID NewSid, + OUT ULONG *NumChanges); + +NTSYSAPI +NTSTATUS +NTAPI +RtlCreateVirtualAccountSid( + IN PCUNICODE_STRING Name, + IN ULONG BaseSubAuthority, + OUT PSID Sid, + IN OUT PULONG SidLength); #endif @@ -1860,6 +1983,8 @@ #define RtlOffsetToPointer(B,O) ((PCHAR)( ((PCHAR)(B)) + ((ULONG_PTR)(O)) )) #define RtlPointerToOffset(B,P) ((ULONG)( ((PCHAR)(P)) - ((PCHAR)(B)) )) + +#define MAX_UNICODE_STACK_BUFFER_LENGTH 256 #pragma pack(push,4) @@ -5983,24 +6108,6 @@ ); NTSYSAPI -NTSTATUS -NTAPI -RtlConvertSidToUnicodeString ( - OUT PUNICODE_STRING DestinationString, - IN PSID Sid, - IN BOOLEAN AllocateDestinationString -); - -NTSYSAPI -NTSTATUS -NTAPI -RtlCopySid ( - IN ULONG Length, - IN PSID Destination, - IN PSID Source -); - -NTSYSAPI VOID NTAPI RtlGenerate8dot3Name ( @@ -6041,13 +6148,6 @@ NTSYSAPI ULONG NTAPI -RtlLengthSid ( - IN PSID Sid -); - -NTSYSAPI -ULONG -NTAPI RtlNtStatusToDosError ( IN NTSTATUS Status ); @@ -6086,21 +6186,6 @@ IN BOOLEAN SaclPresent, IN PACL Sacl, IN BOOLEAN SaclDefaulted -); - -NTSYSAPI -PUCHAR -NTAPI -RtlSubAuthorityCountSid ( - IN PSID Sid -); - -NTSYSAPI -PULONG -NTAPI -RtlSubAuthoritySid ( - IN PSID Sid, - IN ULONG SubAuthority ); NTSYSAPI
14 years, 10 months
1
0
0
0
[jimtabor] 46013: [User32] - David Hedberg Fix return value for EDIT_EM_Scroll and case where EM_SCROLL with page down results in trying to scroll up past the beginning. Sync to wine 1.1.40.
by jimtabor@svn.reactos.org
Author: jimtabor Date: Mon Mar 8 22:24:47 2010 New Revision: 46013 URL:
http://svn.reactos.org/svn/reactos?rev=46013&view=rev
Log: [User32] - David Hedberg Fix return value for EDIT_EM_Scroll and case where EM_SCROLL with page down results in trying to scroll up past the beginning. Sync to wine 1.1.40. Modified: trunk/reactos/dll/win32/user32/controls/edit.c trunk/reactos/media/doc/README.WINE Modified: trunk/reactos/dll/win32/user32/controls/edit.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/controls/…
============================================================================== --- trunk/reactos/dll/win32/user32/controls/edit.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/user32/controls/edit.c [iso-8859-1] Mon Mar 8 22:24:47 2010 @@ -1648,13 +1648,16 @@ INT vlc = get_vertical_line_count(es); /* check if we are going to move too far */ if(es->y_offset + dy > es->line_count - vlc) - dy = es->line_count - vlc - es->y_offset; + dy = max(es->line_count - vlc, 0) - es->y_offset; /* Notification is done in EDIT_EM_LineScroll */ - if(dy) + if(dy) { EDIT_EM_LineScroll(es, 0, dy); - } - return MAKELONG((SHORT)dy, (BOOL)TRUE); + return MAKELONG((SHORT)dy, (BOOL)TRUE); + } + + } + return (LRESULT)FALSE; } Modified: trunk/reactos/media/doc/README.WINE URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/media/doc/README.WINE?rev=…
============================================================================== --- trunk/reactos/media/doc/README.WINE [iso-8859-1] (original) +++ trunk/reactos/media/doc/README.WINE [iso-8859-1] Mon Mar 8 22:24:47 2010 @@ -232,7 +232,7 @@ User32 - reactos/dll/win32/user32/controls/button.c # Synced to Wine-1_1_39 reactos/dll/win32/user32/controls/combo.c # Synced to Wine-1_1_39 - reactos/dll/win32/user32/controls/edit.c # Synced to Wine-1_1_39 + reactos/dll/win32/user32/controls/edit.c # Synced to Wine-1_1_40 reactos/dll/win32/user32/controls/icontitle.c # Synced to Wine-1_1_39 reactos/dll/win32/user32/controls/listbox.c # Synced to Wine-1_1_39 reactos/dll/win32/user32/controls/scrollbar.c # Forked
14 years, 10 months
1
0
0
0
[jimtabor] 46012: - [User32_winetest] - Msg : Remove more tests from service. test_timers crashed on a callback which passed months ago. The rest are related to TrackMouseEvent and capture.
by jimtabor@svn.reactos.org
Author: jimtabor Date: Mon Mar 8 22:20:18 2010 New Revision: 46012 URL:
http://svn.reactos.org/svn/reactos?rev=46012&view=rev
Log: - [User32_winetest] - Msg : Remove more tests from service. test_timers crashed on a callback which passed months ago. The rest are related to TrackMouseEvent and capture. Modified: trunk/rostests/winetests/user32/msg.c Modified: trunk/rostests/winetests/user32/msg.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/user32/msg.c?re…
============================================================================== --- trunk/rostests/winetests/user32/msg.c [iso-8859-1] (original) +++ trunk/rostests/winetests/user32/msg.c [iso-8859-1] Mon Mar 8 22:20:18 2010 @@ -12424,7 +12424,7 @@ test_interthread_messages(); test_message_conversion(); test_accelerators(); - test_timers(); +// test_timers(); test_timers_no_wnd(); if (hCBT_hook) test_set_hook(); test_DestroyWindow(); @@ -12434,17 +12434,17 @@ test_quit_message(); test_SetActiveWindow(); - if (!pTrackMouseEvent) +// if (!pTrackMouseEvent) win_skip("TrackMouseEvent is not available\n"); - else - test_TrackMouseEvent(); +// else +// test_TrackMouseEvent(); test_SetWindowRgn(); test_sys_menu(); test_dialog_messages(); test_nullCallback(); test_dbcs_wm_char(); - test_menu_messages(); +// test_menu_messages(); test_paintingloop(); test_defwinproc(); test_clipboard_viewers();
14 years, 10 months
1
0
0
0
[cgutman] 46011: [CMBATT] - Add initial cmbatt driver which mostly stubs - All it does right now is register a battery device with the battc driver [BATTC] - Add a nearly complete battc driver (the only stuff missing is WMI) - Tested with our stubbed cmbatt driver but testing on Windows would be nice too [BATTERY.INF] - Added battery.inf to install battery devices [MISC] - Add cmbatt.sys, battc.sys, and battery.inf to bootcd - We still need to implement compbatt.sys - PS: Janderwald, you stole m
by cgutman@svn.reactos.org
Author: cgutman Date: Mon Mar 8 22:09:25 2010 New Revision: 46011 URL:
http://svn.reactos.org/svn/reactos?rev=46011&view=rev
Log: [CMBATT] - Add initial cmbatt driver which mostly stubs - All it does right now is register a battery device with the battc driver [BATTC] - Add a nearly complete battc driver (the only stuff missing is WMI) - Tested with our stubbed cmbatt driver but testing on Windows would be nice too [BATTERY.INF] - Added battery.inf to install battery devices [MISC] - Add cmbatt.sys, battc.sys, and battery.inf to bootcd - We still need to implement compbatt.sys - PS: Janderwald, you stole my commit number ;) Added: trunk/reactos/drivers/battery/ trunk/reactos/drivers/battery/battc/ trunk/reactos/drivers/battery/battc/battc.c (with props) trunk/reactos/drivers/battery/battc/battc.h (with props) trunk/reactos/drivers/battery/battc/battc.rbuild (with props) trunk/reactos/drivers/battery/battc/battc.rc (with props) trunk/reactos/drivers/battery/battc/battc.spec (with props) trunk/reactos/drivers/battery/cmbatt/ trunk/reactos/drivers/battery/cmbatt/cmbatt.c (with props) trunk/reactos/drivers/battery/cmbatt/cmbatt.h (with props) trunk/reactos/drivers/battery/cmbatt/cmbatt.rbuild (with props) trunk/reactos/drivers/battery/cmbatt/cmbatt.rc (with props) trunk/reactos/drivers/battery/cmbatt/miniclass.c (with props) trunk/reactos/drivers/battery/directory.rbuild (with props) trunk/reactos/media/inf/battery.inf Modified: trunk/reactos/boot/bootdata/packages/reactos.dff trunk/reactos/drivers/drivers.rbuild Modified: trunk/reactos/boot/bootdata/packages/reactos.dff URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/bootdata/packages/rea…
============================================================================== --- trunk/reactos/boot/bootdata/packages/reactos.dff [iso-8859-1] (original) +++ trunk/reactos/boot/bootdata/packages/reactos.dff [iso-8859-1] Mon Mar 8 22:09:25 2010 @@ -482,6 +482,9 @@ drivers\base\null\null.sys 2 drivers\base\nmidebug\nmidebug.sys 2 +drivers\battery\cmbatt\cmbatt.sys 2 +drivers\battery\battc\battc.sys 2 + drivers\bus\isapnp\isapnp.sys 2 drivers\directx\dxapi\dxapi.sys 2 @@ -628,6 +631,7 @@ media\drivers\etc\services 5 media\inf\audio.inf 6 media\inf\acpi.inf 6 +media\inf\battery.inf 6 media\inf\cdrom.inf 6 media\inf\cpu.inf 6 media\inf\display.inf 6 Added: trunk/reactos/drivers/battery/battc/battc.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/battery/battc/batt…
============================================================================== --- trunk/reactos/drivers/battery/battc/battc.c (added) +++ trunk/reactos/drivers/battery/battc/battc.c [iso-8859-1] Mon Mar 8 22:09:25 2010 @@ -1,0 +1,373 @@ +/* + * PROJECT: ReactOS Kernel + * LICENSE: GPL - See COPYING in the top level directory + * FILE: drivers/battery/battc/battc.c + * PURPOSE: Battery Class Driver + * PROGRAMMERS: Cameron Gutman (cameron.gutman(a)reactos.org) + */ + +#include <battc.h> + +#define NDEBUG +#include <debug.h> + +NTSTATUS +NTAPI +DriverEntry(PDRIVER_OBJECT DriverObject, + PUNICODE_STRING RegistryPath) +{ + DPRINT("Battery class driver initialized\n"); + + return STATUS_SUCCESS; +} + +BCLASSAPI +NTSTATUS +DDKAPI +BatteryClassUnload(PVOID ClassData) +{ + PBATTERY_CLASS_DATA BattClass = ClassData; + + DPRINT("Battery 0x%x is being unloaded\n"); + + if (BattClass->InterfaceName.Length != 0) + { + IoSetDeviceInterfaceState(&BattClass->InterfaceName, FALSE); + RtlFreeUnicodeString(&BattClass->InterfaceName); + } + + ExFreePoolWithTag(BattClass, + BATTERY_CLASS_DATA_TAG); + + return STATUS_SUCCESS; +} + +BCLASSAPI +NTSTATUS +DDKAPI +BatteryClassSystemControl(PVOID ClassData, + PWMILIB_CONTEXT WmiLibContext, + PDEVICE_OBJECT DeviceObject, + PIRP Irp, + PSYSCTL_IRP_DISPOSITION Disposition) +{ + NTSTATUS Status; + + UNIMPLEMENTED + + /* FIXME: Uncomment when WmiCompleteRequest is implemented */ +#if 0 + Status = STATUS_WMI_GUID_NOT_FOUND; + WmiCompleteRequest(DeviceObject, + Irp, + Status, + 0, + IO_NO_INCREMENT); +#else + Irp->IoStatus.Status = Status = STATUS_WMI_GUID_NOT_FOUND; + Irp->IoStatus.Information = 0; + + IoCompleteRequest(Irp, IO_NO_INCREMENT); +#endif + + return Status; +} + +BCLASSAPI +NTSTATUS +DDKAPI +BatteryClassQueryWmiDataBlock(PVOID ClassData, + PDEVICE_OBJECT DeviceObject, + PIRP Irp, + ULONG GuidIndex, + PULONG InstanceLengthArray, + ULONG OutBufferSize, + PUCHAR Buffer) +{ + UNIMPLEMENTED + + return STATUS_WMI_GUID_NOT_FOUND; +} + +BCLASSAPI +NTSTATUS +DDKAPI +BatteryClassStatusNotify(PVOID ClassData) +{ + PBATTERY_CLASS_DATA BattClass = ClassData; + PBATTERY_WAIT_STATUS BattWait = BattClass->EventTriggerContext; + BATTERY_STATUS BattStatus; + NTSTATUS Status; + + DPRINT("Received battery status notification from 0x%x\n", ClassData); + + ExAcquireFastMutex(&BattClass->Mutex); + if (!BattClass->Waiting) + { + ExReleaseFastMutex(&BattClass->Mutex); + return STATUS_SUCCESS; + } + + switch (BattClass->EventTrigger) + { + case EVENT_BATTERY_TAG: + ExReleaseFastMutex(&BattClass->Mutex); + DPRINT1("Waiting for battery is UNIMPLEMENTED!\n"); + break; + + case EVENT_BATTERY_STATUS: + ExReleaseFastMutex(&BattClass->Mutex); + Status = BattClass->MiniportInfo.QueryStatus(BattClass->MiniportInfo.Context, + BattWait->BatteryTag, + &BattStatus); + if (!NT_SUCCESS(Status)) + return Status; + + ExAcquireFastMutex(&BattClass->Mutex); + + if (!(BattWait->PowerState & BattStatus.PowerState) || + (BattWait->HighCapacity > BattStatus.Capacity) || + (BattWait->LowCapacity < BattStatus.Capacity)) + { + KeSetEvent(&BattClass->WaitEvent, IO_NO_INCREMENT, FALSE); + } + + ExReleaseFastMutex(&BattClass->Mutex); + break; + + default: + ExReleaseFastMutex(&BattClass->Mutex); + ASSERT(FALSE); + break; + } + + return STATUS_SUCCESS; +} + +BCLASSAPI +NTSTATUS +DDKAPI +BatteryClassInitializeDevice(PBATTERY_MINIPORT_INFO MiniportInfo, + PVOID *ClassData) +{ + NTSTATUS Status; + PBATTERY_CLASS_DATA BattClass = ExAllocatePoolWithTag(NonPagedPool, + sizeof(BATTERY_CLASS_DATA), + BATTERY_CLASS_DATA_TAG); + + if (!BattClass) + return STATUS_INSUFFICIENT_RESOURCES; + + RtlZeroMemory(BattClass, sizeof(BATTERY_CLASS_DATA)); + + RtlCopyMemory(&BattClass->MiniportInfo, + MiniportInfo, + sizeof(BattClass->MiniportInfo)); + + KeInitializeEvent(&BattClass->WaitEvent, SynchronizationEvent, FALSE); + + ExInitializeFastMutex(&BattClass->Mutex); + + Status = IoRegisterDeviceInterface(MiniportInfo->Pdo, + &GUID_DEVICE_BATTERY, + NULL, + &BattClass->InterfaceName); + if (NT_SUCCESS(Status)) + { + DPRINT("Initialized battery interface: %wZ\n", &BattClass->InterfaceName); + IoSetDeviceInterfaceState(&BattClass->InterfaceName, TRUE); + } + else + { + DPRINT1("IoRegisterDeviceInterface failed (0x%x)\n", Status); + } + + *ClassData = BattClass; + + return STATUS_SUCCESS; +} + +BCLASSAPI +NTSTATUS +DDKAPI +BatteryClassIoctl(PVOID ClassData, + PIRP Irp) +{ + PBATTERY_CLASS_DATA BattClass = ClassData; + PIO_STACK_LOCATION IrpSp = IoGetCurrentIrpStackLocation(Irp); + NTSTATUS Status; + ULONG WaitTime; + PBATTERY_WAIT_STATUS BattWait; + PBATTERY_QUERY_INFORMATION BattQueryInfo; + PBATTERY_SET_INFORMATION BattSetInfo; + LARGE_INTEGER Timeout; + PBATTERY_STATUS BattStatus; + BATTERY_NOTIFY BattNotify; + + Irp->IoStatus.Information = 0; + + DPRINT("Received IOCTL %x for 0x%x\n", IrpSp->Parameters.DeviceIoControl.IoControlCode, + ClassData); + + switch (IrpSp->Parameters.DeviceIoControl.IoControlCode) + { + case IOCTL_BATTERY_QUERY_TAG: + if (IrpSp->Parameters.DeviceIoControl.InputBufferLength < sizeof(ULONG) || + IrpSp->Parameters.DeviceIoControl.OutputBufferLength < sizeof(ULONG)) + { + Status = STATUS_BUFFER_TOO_SMALL; + break; + } + + WaitTime = *(PULONG)Irp->AssociatedIrp.SystemBuffer; + + Timeout.QuadPart = Int32x32To64(WaitTime, -1000); + + Status = BattClass->MiniportInfo.QueryTag(BattClass->MiniportInfo.Context, + (PULONG)Irp->AssociatedIrp.SystemBuffer); + if (!NT_SUCCESS(Status)) + { + ExAcquireFastMutex(&BattClass->Mutex); + BattClass->EventTrigger = EVENT_BATTERY_TAG; + BattClass->Waiting = TRUE; + ExReleaseFastMutex(&BattClass->Mutex); + + Status = KeWaitForSingleObject(&BattClass->WaitEvent, + Executive, + KernelMode, + FALSE, + WaitTime != -1 ? &Timeout : NULL); + + ExAcquireFastMutex(&BattClass->Mutex); + BattClass->Waiting = FALSE; + ExReleaseFastMutex(&BattClass->Mutex); + + if (Status == STATUS_SUCCESS) + { + Status = BattClass->MiniportInfo.QueryTag(BattClass->MiniportInfo.Context, + (PULONG)Irp->AssociatedIrp.SystemBuffer); + if (NT_SUCCESS(Status)) + Irp->IoStatus.Information = sizeof(ULONG); + } + else + { + Status = STATUS_NO_SUCH_DEVICE; + } + } + else + Irp->IoStatus.Information = sizeof(ULONG); + break; + + case IOCTL_BATTERY_QUERY_STATUS: + if (IrpSp->Parameters.DeviceIoControl.InputBufferLength < sizeof(*BattWait) || + IrpSp->Parameters.DeviceIoControl.OutputBufferLength < sizeof(BATTERY_STATUS)) + { + Status = STATUS_BUFFER_TOO_SMALL; + break; + } + + BattWait = Irp->AssociatedIrp.SystemBuffer; + + Timeout.QuadPart = Int32x32To64(BattWait->Timeout, -1000); + + Status = BattClass->MiniportInfo.QueryStatus(BattClass->MiniportInfo.Context, + BattWait->BatteryTag, + (PBATTERY_STATUS)Irp->AssociatedIrp.SystemBuffer); + + BattStatus = Irp->AssociatedIrp.SystemBuffer; + + if (!NT_SUCCESS(Status) || + ((BattWait->PowerState & BattStatus->PowerState) && + (BattWait->HighCapacity <= BattStatus->Capacity) && + (BattWait->LowCapacity >= BattStatus->Capacity))) + { + BattNotify.PowerState = BattWait->PowerState; + BattNotify.HighCapacity = BattWait->HighCapacity; + BattNotify.LowCapacity = BattWait->LowCapacity; + + BattClass->MiniportInfo.SetStatusNotify(BattClass->MiniportInfo.Context, + BattWait->BatteryTag, + &BattNotify); + + ExAcquireFastMutex(&BattClass->Mutex); + BattClass->EventTrigger = EVENT_BATTERY_STATUS; + BattClass->EventTriggerContext = BattWait; + BattClass->Waiting = TRUE; + ExReleaseFastMutex(&BattClass->Mutex); + + Status = KeWaitForSingleObject(&BattClass->WaitEvent, + Executive, + KernelMode, + FALSE, + BattWait->Timeout != -1 ? &Timeout : NULL); + + ExAcquireFastMutex(&BattClass->Mutex); + BattClass->Waiting = FALSE; + ExReleaseFastMutex(&BattClass->Mutex); + + BattClass->MiniportInfo.DisableStatusNotify(BattClass->MiniportInfo.Context); + + if (Status == STATUS_SUCCESS) + { + Status = BattClass->MiniportInfo.QueryStatus(BattClass->MiniportInfo.Context, + BattWait->BatteryTag, + (PBATTERY_STATUS)Irp->AssociatedIrp.SystemBuffer); + if (NT_SUCCESS(Status)) + Irp->IoStatus.Information = sizeof(ULONG); + } + else + { + Status = STATUS_NO_SUCH_DEVICE; + } + } + else + Irp->IoStatus.Information = sizeof(BATTERY_STATUS); + break; + + case IOCTL_BATTERY_QUERY_INFORMATION: + if (IrpSp->Parameters.DeviceIoControl.InputBufferLength < sizeof(*BattQueryInfo)) + { + Status = STATUS_BUFFER_TOO_SMALL; + break; + } + + BattQueryInfo = Irp->AssociatedIrp.SystemBuffer; + + Status = BattClass->MiniportInfo.QueryInformation(BattClass->MiniportInfo.Context, + BattQueryInfo->BatteryTag, + BattQueryInfo->InformationLevel, + BattQueryInfo->AtRate, + Irp->AssociatedIrp.SystemBuffer, + IrpSp->Parameters.DeviceIoControl.OutputBufferLength, + &Irp->IoStatus.Information); + if (!NT_SUCCESS(Status)) + DPRINT1("QueryInformation failed (0x%x)\n", Status); + break; + case IOCTL_BATTERY_SET_INFORMATION: + if (IrpSp->Parameters.DeviceIoControl.InputBufferLength < sizeof(*BattSetInfo)) + { + Status = STATUS_BUFFER_TOO_SMALL; + break; + } + + BattSetInfo = Irp->AssociatedIrp.SystemBuffer; + + Status = BattClass->MiniportInfo.SetInformation(BattClass->MiniportInfo.Context, + BattSetInfo->BatteryTag, + BattSetInfo->InformationLevel, + BattSetInfo->Buffer); + if (!NT_SUCCESS(Status)) + DPRINT1("SetInformation failed (0x%x)\n", Status); + break; + + default: + DPRINT1("Received unsupported IRP %x\n", IrpSp->Parameters.DeviceIoControl.IoControlCode); + /* Do NOT complete the irp */ + return STATUS_NOT_SUPPORTED; + } + + Irp->IoStatus.Status = Status; + IoCompleteRequest(Irp, IO_NO_INCREMENT); + + return Status; +} Propchange: trunk/reactos/drivers/battery/battc/battc.c ------------------------------------------------------------------------------ svn:eol-style = native Added: trunk/reactos/drivers/battery/battc/battc.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/battery/battc/batt…
============================================================================== --- trunk/reactos/drivers/battery/battc/battc.h (added) +++ trunk/reactos/drivers/battery/battc/battc.h [iso-8859-1] Mon Mar 8 22:09:25 2010 @@ -1,0 +1,30 @@ +/* +* PROJECT: ReactOS Kernel +* LICENSE: GPL - See COPYING in the top level directory +* FILE: drivers/battery/battc/battc.h +* PURPOSE: Battery Class Driver +* PROGRAMMERS: Cameron Gutman (cameron.gutman(a)reactos.org) +*/ + +#pragma once + +#include <ntddk.h> +#include <initguid.h> +#include <batclass.h> + +typedef struct _BATTERY_CLASS_DATA { + BATTERY_MINIPORT_INFO MiniportInfo; + KEVENT WaitEvent; + BOOLEAN Waiting; + FAST_MUTEX Mutex; + UCHAR EventTrigger; + PVOID EventTriggerContext; + UNICODE_STRING InterfaceName; +} BATTERY_CLASS_DATA, *PBATTERY_CLASS_DATA; + +/* Memory tags */ +#define BATTERY_CLASS_DATA_TAG 'CtaB' + +/* Event triggers */ +#define EVENT_BATTERY_TAG 0x01 +#define EVENT_BATTERY_STATUS 0x02 Propchange: trunk/reactos/drivers/battery/battc/battc.h ------------------------------------------------------------------------------ svn:eol-style = native Added: trunk/reactos/drivers/battery/battc/battc.rbuild URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/battery/battc/batt…
============================================================================== --- trunk/reactos/drivers/battery/battc/battc.rbuild (added) +++ trunk/reactos/drivers/battery/battc/battc.rbuild [iso-8859-1] Mon Mar 8 22:09:25 2010 @@ -1,0 +1,10 @@ +<?xml version="1.0"?> +<!DOCTYPE module SYSTEM "../../../tools/rbuild/project.dtd"> +<module name="battc" type="kernelmodedriver" installbase="system32/drivers" installname="battc.sys"> + <library>ntoskrnl</library> + <library>hal</library> + <importlibrary definition="battc.spec"/> + <include base="battc">.</include> + <file>battc.c</file> + <file>battc.rc</file> +</module> Propchange: trunk/reactos/drivers/battery/battc/battc.rbuild ------------------------------------------------------------------------------ svn:eol-style = native Added: trunk/reactos/drivers/battery/battc/battc.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/battery/battc/batt…
============================================================================== --- trunk/reactos/drivers/battery/battc/battc.rc (added) +++ trunk/reactos/drivers/battery/battc/battc.rc [iso-8859-1] Mon Mar 8 22:09:25 2010 @@ -1,0 +1,5 @@ +#define REACTOS_VERSION_DLL +#define REACTOS_STR_FILE_DESCRIPTION "Battery Class Driver\0" +#define REACTOS_STR_INTERNAL_NAME "battc\0" +#define REACTOS_STR_ORIGINAL_FILENAME "battc.sys\0" +#include <reactos/version.rc> Propchange: trunk/reactos/drivers/battery/battc/battc.rc ------------------------------------------------------------------------------ svn:eol-style = native Added: trunk/reactos/drivers/battery/battc/battc.spec URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/battery/battc/batt…
============================================================================== --- trunk/reactos/drivers/battery/battc/battc.spec (added) +++ trunk/reactos/drivers/battery/battc/battc.spec [iso-8859-1] Mon Mar 8 22:09:25 2010 @@ -1,0 +1,6 @@ +@ stdcall BatteryClassInitializeDevice(ptr ptr) +@ stdcall BatteryClassIoctl(ptr ptr) +@ stdcall BatteryClassQueryWmiDataBlock(ptr ptr ptr long ptr long ptr) +@ stdcall BatteryClassStatusNotify(ptr) +@ stdcall BatteryClassSystemControl(ptr ptr ptr ptr ptr) +@ stdcall BatteryClassUnload(ptr) Propchange: trunk/reactos/drivers/battery/battc/battc.spec ------------------------------------------------------------------------------ svn:eol-style = native Added: trunk/reactos/drivers/battery/cmbatt/cmbatt.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/battery/cmbatt/cmb…
============================================================================== --- trunk/reactos/drivers/battery/cmbatt/cmbatt.c (added) +++ trunk/reactos/drivers/battery/cmbatt/cmbatt.c [iso-8859-1] Mon Mar 8 22:09:25 2010 @@ -1,0 +1,188 @@ +/* + * PROJECT: ReactOS Kernel + * LICENSE: GPL - See COPYING in the top level directory + * FILE: drivers/battery/cmbatt/cmbatt.c + * PURPOSE: Control Method Battery Miniclass Driver + * PROGRAMMERS: Cameron Gutman (cameron.gutman(a)reactos.org) + */ + +#include <cmbatt.h> + +#define NDEBUG +#include <debug.h> + +LIST_ENTRY BatteryList; +KSPIN_LOCK BatteryListLock; + +VOID +NTAPI +CmBattUnload(PDRIVER_OBJECT DriverObject) +{ + DPRINT("Control method battery miniclass driver unloaded\n"); +} + +NTSTATUS +NTAPI +CmBattDeviceControl(PDEVICE_OBJECT DeviceObject, + PIRP Irp) +{ + PCMBATT_DEVICE_EXTENSION DeviceExtension = DeviceObject->DeviceExtension; + NTSTATUS Status; + + Status = BatteryClassIoctl(DeviceExtension->BattClassHandle, + Irp); + + if (Status == STATUS_NOT_SUPPORTED) + { + Irp->IoStatus.Status = Status; + Irp->IoStatus.Information = 0; + + IoCompleteRequest(Irp, IO_NO_INCREMENT); + } + + return Status; +} + +NTSTATUS +NTAPI +CmBattPnP(PDEVICE_OBJECT DeviceObject, + PIRP Irp) +{ + PCMBATT_DEVICE_EXTENSION DeviceExtension = DeviceObject->DeviceExtension; + + UNIMPLEMENTED + + IoSkipCurrentIrpStackLocation(Irp); + + return IoCallDriver(DeviceExtension->Ldo, Irp); +} + +NTSTATUS +NTAPI +CmBattSystemControl(PDEVICE_OBJECT DeviceObject, + PIRP Irp) +{ + UNIMPLEMENTED + + Irp->IoStatus.Status = STATUS_WMI_GUID_NOT_FOUND; + Irp->IoStatus.Information = 0; + + IoCompleteRequest(Irp, IO_NO_INCREMENT); + + return STATUS_WMI_GUID_NOT_FOUND; +} + +NTSTATUS +NTAPI +CmBattPower(PDEVICE_OBJECT DeviceObject, + PIRP Irp) +{ + PCMBATT_DEVICE_EXTENSION DeviceExtension = DeviceObject->DeviceExtension; + + UNIMPLEMENTED + + IoSkipCurrentIrpStackLocation(Irp); + + PoStartNextPowerIrp(Irp); + + return PoCallDriver(DeviceExtension->Ldo, Irp); +} + +NTSTATUS +NTAPI +CmBattCreateClose(PDEVICE_OBJECT DeviceObject, + PIRP Irp) +{ + Irp->IoStatus.Status = STATUS_SUCCESS; + Irp->IoStatus.Information = 0; + + IoCompleteRequest(Irp, IO_NO_INCREMENT); + + return STATUS_SUCCESS; +} + +NTSTATUS +NTAPI +CmBattAddDevice(PDRIVER_OBJECT DriverObject, + PDEVICE_OBJECT PhysicalDeviceObject) +{ + NTSTATUS Status; + PDEVICE_OBJECT DeviceObject; + PCMBATT_DEVICE_EXTENSION DeviceExtension; + BATTERY_MINIPORT_INFO BattInfo; + + Status = IoCreateDevice(DriverObject, + sizeof(CMBATT_DEVICE_EXTENSION), + NULL, + FILE_DEVICE_BATTERY, + 0, + FALSE, + &DeviceObject); + if (!NT_SUCCESS(Status)) + return Status; + + DeviceExtension = DeviceObject->DeviceExtension; + + DeviceExtension->Pdo = PhysicalDeviceObject; + DeviceExtension->Fdo = DeviceObject; + DeviceExtension->Ldo = IoAttachDeviceToDeviceStack(DeviceObject, + PhysicalDeviceObject); + + DeviceObject->Flags |= DO_BUFFERED_IO | DO_POWER_PAGABLE; + + /* We require an extra stack entry */ + DeviceObject->StackSize = PhysicalDeviceObject->StackSize + 2; + + BattInfo.MajorVersion = BATTERY_CLASS_MAJOR_VERSION; + BattInfo.MinorVersion = BATTERY_CLASS_MINOR_VERSION; + BattInfo.Context = DeviceExtension; + BattInfo.QueryTag = CmBattQueryTag; + BattInfo.QueryInformation = CmBattQueryInformation; + BattInfo.SetInformation = CmBattSetInformation; + BattInfo.QueryStatus = CmBattQueryStatus; + BattInfo.SetStatusNotify = CmBattSetStatusNotify; + BattInfo.DisableStatusNotify = CmBattDisableStatusNotify; + BattInfo.Pdo = PhysicalDeviceObject; + BattInfo.DeviceName = NULL; + + Status = BatteryClassInitializeDevice(&BattInfo, + &DeviceExtension->BattClassHandle); + if (!NT_SUCCESS(Status)) + { + IoDetachDevice(DeviceExtension->Ldo); + IoDeleteDevice(DeviceObject); + return Status; + } + + ExInterlockedInsertTailList(&BatteryList, + &DeviceExtension->ListEntry, + &BatteryListLock); + + DeviceObject->Flags &= ~DO_DEVICE_INITIALIZING; + + DPRINT("Successfully registered battery with battc (0x%x)\n", DeviceExtension->BattClassHandle); + + return STATUS_SUCCESS; +} + +NTSTATUS +NTAPI +DriverEntry(PDRIVER_OBJECT DriverObject, + PUNICODE_STRING RegistryPath) +{ + DPRINT("Control method battery miniclass driver initialized\n"); + + DriverObject->DriverUnload = CmBattUnload; + DriverObject->DriverExtension->AddDevice = CmBattAddDevice; + DriverObject->MajorFunction[IRP_MJ_POWER] = CmBattPower; + DriverObject->MajorFunction[IRP_MJ_PNP] = CmBattPnP; + DriverObject->MajorFunction[IRP_MJ_CREATE] = CmBattCreateClose; + DriverObject->MajorFunction[IRP_MJ_CLOSE] = CmBattCreateClose; + DriverObject->MajorFunction[IRP_MJ_DEVICE_CONTROL] = CmBattDeviceControl; + DriverObject->MajorFunction[IRP_MJ_SYSTEM_CONTROL] = CmBattSystemControl; + + KeInitializeSpinLock(&BatteryListLock); + InitializeListHead(&BatteryList); + + return STATUS_SUCCESS; +} Propchange: trunk/reactos/drivers/battery/cmbatt/cmbatt.c ------------------------------------------------------------------------------ svn:eol-style = native Added: trunk/reactos/drivers/battery/cmbatt/cmbatt.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/battery/cmbatt/cmb…
============================================================================== --- trunk/reactos/drivers/battery/cmbatt/cmbatt.h (added) +++ trunk/reactos/drivers/battery/cmbatt/cmbatt.h [iso-8859-1] Mon Mar 8 22:09:25 2010 @@ -1,0 +1,58 @@ +/* +* PROJECT: ReactOS Kernel +* LICENSE: GPL - See COPYING in the top level directory +* FILE: drivers/battery/cmbatt/cmbatt.h +* PURPOSE: Control Method Battery Miniclass Driver +* PROGRAMMERS: Cameron Gutman (cameron.gutman(a)reactos.org) +*/ + +#pragma once + +#include <ntddk.h> +#include <batclass.h> + +typedef struct _CMBATT_DEVICE_EXTENSION { + PDEVICE_OBJECT Pdo; + PDEVICE_OBJECT Ldo; + PDEVICE_OBJECT Fdo; + PVOID BattClassHandle; + LIST_ENTRY ListEntry; +} CMBATT_DEVICE_EXTENSION, *PCMBATT_DEVICE_EXTENSION; + +NTSTATUS +NTAPI +CmBattQueryTag(PVOID Context, + PULONG BatteryTag); + +NTSTATUS +NTAPI +CmBattDisableStatusNotify(PVOID Context); + +NTSTATUS +NTAPI +CmBattSetStatusNotify(PVOID Context, + ULONG BatteryTag, + PBATTERY_NOTIFY BatteryNotify); + +NTSTATUS +NTAPI +CmBattQueryInformation(PVOID Context, + ULONG BatteryTag, + BATTERY_QUERY_INFORMATION_LEVEL Level, + OPTIONAL LONG AtRate, + PVOID Buffer, + ULONG BufferLength, + PULONG ReturnedLength); + +NTSTATUS +NTAPI +CmBattQueryStatus(PVOID Context, + ULONG BatteryTag, + PBATTERY_STATUS BatteryStatus); + +NTSTATUS +NTAPI +CmBattSetInformation(PVOID Context, + ULONG BatteryTag, + BATTERY_SET_INFORMATION_LEVEL Level, + OPTIONAL PVOID Buffer); Propchange: trunk/reactos/drivers/battery/cmbatt/cmbatt.h ------------------------------------------------------------------------------ svn:eol-style = native Added: trunk/reactos/drivers/battery/cmbatt/cmbatt.rbuild URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/battery/cmbatt/cmb…
============================================================================== --- trunk/reactos/drivers/battery/cmbatt/cmbatt.rbuild (added) +++ trunk/reactos/drivers/battery/cmbatt/cmbatt.rbuild [iso-8859-1] Mon Mar 8 22:09:25 2010 @@ -1,0 +1,11 @@ +<?xml version="1.0"?> +<!DOCTYPE module SYSTEM "../../../tools/rbuild/project.dtd"> +<module name="cmbatt" type="kernelmodedriver" installbase="system32/drivers" installname="cmbatt.sys"> + <library>ntoskrnl</library> + <library>hal</library> + <library>battc</library> + <include base="cmbatt">.</include> + <file>cmbatt.c</file> + <file>miniclass.c</file> + <file>cmbatt.rc</file> +</module> Propchange: trunk/reactos/drivers/battery/cmbatt/cmbatt.rbuild ------------------------------------------------------------------------------ svn:eol-style = native Added: trunk/reactos/drivers/battery/cmbatt/cmbatt.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/battery/cmbatt/cmb…
============================================================================== --- trunk/reactos/drivers/battery/cmbatt/cmbatt.rc (added) +++ trunk/reactos/drivers/battery/cmbatt/cmbatt.rc [iso-8859-1] Mon Mar 8 22:09:25 2010 @@ -1,0 +1,5 @@ +#define REACTOS_VERSION_DLL +#define REACTOS_STR_FILE_DESCRIPTION "Control Method Battery Miniclass Driver\0" +#define REACTOS_STR_INTERNAL_NAME "cmbatt\0" +#define REACTOS_STR_ORIGINAL_FILENAME "cmbatt.sys\0" +#include <reactos/version.rc> Propchange: trunk/reactos/drivers/battery/cmbatt/cmbatt.rc ------------------------------------------------------------------------------ svn:eol-style = native Added: trunk/reactos/drivers/battery/cmbatt/miniclass.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/battery/cmbatt/min…
============================================================================== --- trunk/reactos/drivers/battery/cmbatt/miniclass.c (added) +++ trunk/reactos/drivers/battery/cmbatt/miniclass.c [iso-8859-1] Mon Mar 8 22:09:25 2010 @@ -1,0 +1,82 @@ +/* + * PROJECT: ReactOS Kernel + * LICENSE: GPL - See COPYING in the top level directory + * FILE: drivers/battery/cmbatt/miniclass.c + * PURPOSE: Control Method Battery Miniclass Driver + * PROGRAMMERS: Cameron Gutman (cameron.gutman(a)reactos.org) + */ + +#include <cmbatt.h> + +#define NDEBUG +#include <debug.h> + +NTSTATUS +NTAPI +CmBattQueryTag(PVOID Context, + PULONG BatteryTag) +{ + UNIMPLEMENTED + + *BatteryTag = 0; + + return STATUS_SUCCESS; +} + +NTSTATUS +NTAPI +CmBattDisableStatusNotify(PVOID Context) +{ + UNIMPLEMENTED + + return STATUS_NOT_SUPPORTED; +} + +NTSTATUS +NTAPI +CmBattSetStatusNotify(PVOID Context, + ULONG BatteryTag, + PBATTERY_NOTIFY BatteryNotify) +{ + UNIMPLEMENTED + + return STATUS_NOT_SUPPORTED; +} + +NTSTATUS +NTAPI +CmBattQueryInformation(PVOID Context, + ULONG BatteryTag, + BATTERY_QUERY_INFORMATION_LEVEL Level, + OPTIONAL LONG AtRate, + PVOID Buffer, + ULONG BufferLength, + PULONG ReturnedLength) +{ + UNIMPLEMENTED + + return STATUS_NOT_SUPPORTED; +} + +NTSTATUS +NTAPI +CmBattQueryStatus(PVOID Context, + ULONG BatteryTag, + PBATTERY_STATUS BatteryStatus) +{ + UNIMPLEMENTED + + return STATUS_NOT_SUPPORTED; +} + +NTSTATUS +NTAPI +CmBattSetInformation(PVOID Context, + ULONG BatteryTag, + BATTERY_SET_INFORMATION_LEVEL Level, + OPTIONAL PVOID Buffer) +{ + UNIMPLEMENTED + + return STATUS_NOT_SUPPORTED; +} Propchange: trunk/reactos/drivers/battery/cmbatt/miniclass.c ------------------------------------------------------------------------------ svn:eol-style = native Added: trunk/reactos/drivers/battery/directory.rbuild URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/battery/directory.…
============================================================================== --- trunk/reactos/drivers/battery/directory.rbuild (added) +++ trunk/reactos/drivers/battery/directory.rbuild [iso-8859-1] Mon Mar 8 22:09:25 2010 @@ -1,0 +1,10 @@ +<?xml version="1.0"?> +<!DOCTYPE group SYSTEM "../../tools/rbuild/project.dtd"> +<group xmlns:xi="
http://www.w3.org/2001/XInclude
"> +<directory name="battc"> + <xi:include href="battc/battc.rbuild" /> +</directory> +<directory name="cmbatt"> + <xi:include href="cmbatt/cmbatt.rbuild" /> +</directory> +</group> Propchange: trunk/reactos/drivers/battery/directory.rbuild ------------------------------------------------------------------------------ svn:eol-style = native Modified: trunk/reactos/drivers/drivers.rbuild URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/drivers.rbuild?rev…
============================================================================== --- trunk/reactos/drivers/drivers.rbuild [iso-8859-1] (original) +++ trunk/reactos/drivers/drivers.rbuild [iso-8859-1] Mon Mar 8 22:09:25 2010 @@ -3,6 +3,9 @@ <group xmlns:xi="
http://www.w3.org/2001/XInclude
"> <directory name="base"> <xi:include href="base/directory.rbuild" /> +</directory> +<directory name="battery"> + <xi:include href="battery/directory.rbuild" /> </directory> <directory name="bus"> <xi:include href="bus/directory.rbuild" /> Added: trunk/reactos/media/inf/battery.inf URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/media/inf/battery.inf?rev=…
============================================================================== --- trunk/reactos/media/inf/battery.inf (added) +++ trunk/reactos/media/inf/battery.inf [iso-8859-1] Mon Mar 8 22:09:25 2010 @@ -1,0 +1,52 @@ +; BATTERY.INF + +[Version] +Signature = "$Windows NT$" +;Signature = "$ReactOS$" +LayoutFile = layout.inf +Class = Battery +ClassGUID = {72631E54-78A4-11D0-BCF7-00AA00B7B32A} +Provider = %ReactOS% +DriverVer = 02/28/2010,1.00 + +[DestinationDirs] +DefaultDestDir = 12 + +[ClassInstall32.NT] +AddReg = BatteryClass.NT.AddReg + +[BatteryClass.NT.AddReg] +HKR, , , 0, %BatteryClassName% +;FIXME: Add icon here + +[Manufacturer] +%GenericMfg% = GenericMfg + +[GenericMfg] +%ACPI\PNP0C0A.DeviceDesc% = CmBatt,ACPI\PNP0C0A +%ACPI\ACPI0003.DeviceDesc% = CmBatt,ACPI\ACPI0003 + +[CmBatt] +CopyFiles = CmBatt_CopyFiles + +[CmBatt_CopyFiles] +cmbatt.sys +battc.sys + +[CmBatt.Services] +AddService = cmbatt, 0x00000002, CmBatt_Service_Install + +[CmBatt_Service_Install] +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\cmbatt.sys + +[Strings] +ReactOS = "ReactOS Team" +BatteryClassName = "Batteries" + +GenericMfg = "(Generic batteries)" +ACPI\PNP0C0A.DeviceDesc = "ACPI-compliant control method battery" +ACPI\ACPI0003.DeviceDesc = "AC adapter" +
14 years, 10 months
1
0
0
0
[dreimer] 46010: Polish translation update by Maciej Bialas.
by dreimer@svn.reactos.org
Author: dreimer Date: Mon Mar 8 22:08:20 2010 New Revision: 46010 URL:
http://svn.reactos.org/svn/reactos?rev=46010&view=rev
Log: Polish translation update by Maciej Bialas. Modified: trunk/reactos/media/inf/keyboard.inf Modified: trunk/reactos/media/inf/keyboard.inf URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/media/inf/keyboard.inf?rev…
============================================================================== Binary files - no diff available.
14 years, 10 months
1
0
0
0
[jimtabor] 46009: - Fix a crash in user32 winetest msg.
by jimtabor@svn.reactos.org
Author: jimtabor Date: Mon Mar 8 22:04:00 2010 New Revision: 46009 URL:
http://svn.reactos.org/svn/reactos?rev=46009&view=rev
Log: - Fix a crash in user32 winetest msg. Modified: trunk/reactos/subsystems/win32/win32k/ntuser/painting.c Modified: trunk/reactos/subsystems/win32/win32k/ntuser/painting.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntuser/painting.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/painting.c [iso-8859-1] Mon Mar 8 22:04:00 2010 @@ -502,7 +502,10 @@ for (WndObject = Window; WndObject != NULL; WndObject = WndObject->spwndParent) { Wnd = WndObject->Wnd; - if (!(Wnd->style & WS_VISIBLE) || + if ( Window->state & WINDOWSTATUS_DESTROYING || // state2 + Window->state & WINDOWSTATUS_DESTROYED || + !Wnd || + !(Wnd->style & WS_VISIBLE) || ((Wnd->style & WS_MINIMIZE) && (WndObject != Window))) { return FALSE;
14 years, 10 months
1
0
0
0
← Newer
1
...
59
60
61
62
63
64
65
...
90
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
Results per page:
10
25
50
100
200