[DISK_NEW] Import Microsoft Disk class driver from GitHub

The source code is licensed under MS-PL license, taken from Windows Driver Samples
repository (https://github.com/microsoft/Windows-driver-samples/tree/master/storage/class/disk/)
Synched with commit 3428c5feaac7c1a5e2a09db0ed93392f7568f9e6
The driver is written for Windows 8+, so we compile it with ntoskrnl_vista
statically linked and with NTDDI_WIN8 defined

CORE-17129
This commit is contained in:
Victor Perevertkin 2020-08-30 03:43:14 +03:00
parent fa8ce680d4
commit f144b8c10d
No known key found for this signature in database
GPG key ID: C750B7222E9C7830
11 changed files with 14079 additions and 0 deletions

View file

@ -0,0 +1,32 @@
remove_definitions(-D_WIN32_WINNT=0x502)
list(APPEND SOURCE
data.c
disk.c
diskwmi.c
geometry.c
pnp.c
disk.h)
add_library(disk MODULE ${SOURCE} disk.rc)
target_compile_definitions(disk PUBLIC
DEBUG_USE_KDPRINT
_WIN32_WINNT=0x602
NTDDI_VERSION=0x06020000) # NTDDI_WIN8
if(USE_CLANG_CL OR (NOT MSVC))
target_compile_options(disk PRIVATE -Wno-format -Wno-pointer-sign)
endif()
if(GCC)
target_compile_options(disk PRIVATE -Wno-unused-but-set-variable -Wno-pointer-to-int-cast -Wno-switch)
endif()
set_module_type(disk kernelmodedriver)
target_link_libraries(disk ntoskrnl_vista libcntpr wdmguid)
add_importlibs(disk classpnp ntoskrnl hal)
add_cd_file(TARGET disk DESTINATION reactos/system32/drivers NO_CAB FOR all)
add_registry_inf(disk_reg.inf)
add_driver_inf(disk disk.inf)

View file

@ -0,0 +1,88 @@
/*++
Copyright (C) Microsoft Corporation, 1991 - 1999
Module Name:
disk.c
Abstract:
SCSI disk class driver
Environment:
kernel mode only
Notes:
Revision History:
--*/
#include "disk.h"
#ifdef ALLOC_DATA_PRAGMA
#pragma data_seg("PAGE")
#endif
/*
#define HackDisableTaggedQueuing (0x01)
#define HackDisableSynchronousTransfers (0x02)
#define HackDisableSpinDown (0x04)
#define HackDisableWriteCache (0x08)
#define HackCauseNotReportableHack (0x10)
#define HackRequiresStartUnitCommand (0x20)
*/
CLASSPNP_SCAN_FOR_SPECIAL_INFO DiskBadControllers[] = {
{ "COMPAQ" , "PD-1" , NULL, 0x02 },
{ "CONNER" , "CP3500" , NULL, 0x02 },
{ "FUJITSU" , "M2652S-512" , NULL, 0x01 },
{ "HP ", "C1113F " , NULL, 0x20 },
// iomegas require START_UNIT commands so be sure to match all of them.
{ "iomega" , "jaz" , NULL, 0x30 },
{ "iomega" , NULL , NULL, 0x20 },
{ "IOMEGA" , "ZIP" , NULL, 0x27 },
{ "IOMEGA" , NULL , NULL, 0x20 },
{ "MAXTOR" , "MXT-540SL" , "I1.2", 0x01 },
{ "MICROP" , "1936-21MW1002002" , NULL, 0x03 },
{ "OLIVETTI", "CP3500" , NULL, 0x02 },
{ "SEAGATE" , "ST41601N" , "0102", 0x02 },
{ "SEAGATE" , "ST3655N" , NULL, 0x08 },
{ "SEAGATE" , "ST3390N" , NULL, 0x08 },
{ "SEAGATE" , "ST12550N" , NULL, 0x08 },
{ "SEAGATE" , "ST32430N" , NULL, 0x08 },
{ "SEAGATE" , "ST31230N" , NULL, 0x08 },
{ "SEAGATE" , "ST15230N" , NULL, 0x08 },
{ "SyQuest" , "SQ5110" , "CHC", 0x03 },
{ "TOSHIBA" , "MK538FB" , "60", 0x01 },
{ NULL , NULL , NULL, 0x0 }
};
// ======== ROS DIFF ========
// Added MediaTypes in their own brace nesting level
// ======== ROS DIFF ========
DISK_MEDIA_TYPES_LIST const DiskMediaTypesExclude[] = {
{ "HP" , "RDX" , NULL, 0, 0, {0 , 0 , 0 , 0 }},
{ NULL , NULL , NULL, 0, 0, {0 , 0 , 0 , 0 }}
};
DISK_MEDIA_TYPES_LIST const DiskMediaTypes[] = {
{ "COMPAQ" , "PD-1 LF-1094" , NULL, 1, 1, {PC_5_RW , 0 , 0 , 0 }},
{ "HP" , NULL , NULL, 2, 2, {MO_5_WO , MO_5_RW, 0 , 0 }},
{ "iomega" , "jaz" , NULL, 1, 1, {IOMEGA_JAZ , 0 , 0 , 0 }},
{ "IOMEGA" , "ZIP" , NULL, 1, 1, {IOMEGA_ZIP , 0 , 0 , 0 }},
{ "PINNACLE", "Apex 4.6GB" , NULL, 3, 2, {PINNACLE_APEX_5_RW, MO_5_RW, MO_5_WO, 0 }},
{ "SONY" , "SMO-F541" , NULL, 2, 2, {MO_5_WO , MO_5_RW, 0 , 0 }},
{ "SONY" , "SMO-F551" , NULL, 2, 2, {MO_5_WO , MO_5_RW, 0 , 0 }},
{ "SONY" , "SMO-F561" , NULL, 2, 2, {MO_5_WO , MO_5_RW, 0 , 0 }},
{ "Maxoptix", "T5-2600" , NULL, 2, 2, {MO_5_WO , MO_5_RW, 0 , 0 }},
{ "Maxoptix", "T6-5200" , NULL, 2, 2, {MO_5_WO , MO_5_RW, 0 , 0 }},
{ NULL , NULL , NULL, 0, 0, {0 , 0 , 0 , 0 }}
};
#ifdef ALLOC_DATA_PRAGMA
#pragma data_seg()
#endif

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,129 @@
; DISK.INF
; Installation of DISK DRIVESs
[Version]
Signature = "$Windows NT$"
;Signature = "$ReactOS$"
LayoutFile = layout.inf
Class = DiskDrive
ClassGUID = {4D36E967-E325-11CE-BFC1-08002BE10318}
Provider = %MSFT%
; Git commit 3428c5f @ https://github.com/microsoft/Windows-driver-samples
DriverVer = 08/29/2018, 1.0
[DestinationDirs]
disk_CopyFiles.NT = 12
storprop_CopyFiles.NT = 11
[ClassInstall32.NT]
AddReg = DiskClass.NT.AddReg
Copyfiles = storprop_CopyFiles.NT
[DiskClass.NT.AddReg]
HKR, , , 0, %DiskClassName%
HKR, , Installer32, 0, "storprop.dll,DiskClassInstaller"
HKR, , Icon, 0, "-53"
HKR, , NoInstallClass, 0, 1
HKR, , SilentInstall, 0, 1
[Manufacturer]
%GenericMfg% = GenericMfg
[GenericMfg]
%Disk.DeviceDesc% = disk_Inst,GenDisk
%OpticalDisk.DeviceDesc% = disk_Inst,GenOptical
;----------------------------- DISK DRIVER -----------------------------
[disk_Inst.NT]
CopyFiles = disk_CopyFiles.NT
[disk_Inst.NT.Services]
AddService = disk, 2, disk_Service_Inst
[disk_Service_Inst]
DisplayName = %Disk.ServiceDesc%
ServiceType = 1
StartType = 0
ErrorControl = 1
ServiceBinary = %12%\disk.sys
[disk_CopyFiles.NT]
disk.sys
;---------------------------- DISK INSTALLER ----------------------------
[storprop_CopyFiles.NT]
storprop.dll
;-------------------------------- STRINGS -------------------------------
[Strings]
ReactOS = "ReactOS Team"
GenericMfg = "(Generic Disk Drives)"
DiskClassName = "Disk Drives"
Disk.DeviceDesc = "Disk Drive"
OpticalDisk.DeviceDesc = "Optical Disk Drive"
Disk.ServiceDesc = "Disk Driver"
[Strings.0405]
GenericMfg = "(Obecné diskové jednotky)"
DiskClassName = "Diskové jednotky"
Disk.DeviceDesc = "Disková jednotka"
OpticalDisk.DeviceDesc = "Optická disková jednotka"
Disk.ServiceDesc = "Ovladač disku"
[Strings.0a]
ReactOS = "Equipo de ReactOS"
GenericMfg = "(Unidades de disco genéricas)"
DiskClassName = "Unidades de disco"
Disk.DeviceDesc = "Unidad de disco"
OpticalDisk.DeviceDesc = "Unidad de disco óptico"
Disk.ServiceDesc = "Controlador de disco"
[Strings.0415]
ReactOS = "Zespół ReactOS"
GenericMfg = "(Standardowy dysk twardy)"
DiskClassName = "Dyski twarde"
Disk.DeviceDesc = "Dysk twardy"
OpticalDisk.DeviceDesc = "Dysk optyczny"
Disk.ServiceDesc = "Sterownik dysku"
[Strings.0418]
ReactOS = "Echipa ReactOS"
GenericMfg = "(dispozitiv disc generic)"
DiskClassName = "Dispozitive disc"
Disk.DeviceDesc = "Dispozitiv disc"
OpticalDisk.DeviceDesc = "Dispozitiv disc optic"
Disk.ServiceDesc = "Modúl-pilot de disc"
[Strings.0419]
ReactOS = "Команда ReactOS"
GenericMfg = "(Стандартные дисковые накопители)"
DiskClassName = "Дисковые устройства"
Disk.DeviceDesc = "Дисковое устройство"
OpticalDisk.DeviceDesc = "Оптическое дисковое устройство"
Disk.ServiceDesc = "Драйвер диска"
[Strings.041f]
ReactOS = "ReactOS Takımı"
GenericMfg = "(Umûmî Disk Sürücüleri)"
DiskClassName = "Disk Sürücüleri"
Disk.DeviceDesc = "Disk Sürücüsü"
OpticalDisk.DeviceDesc = "Optik Disk Sürücüsü"
Disk.ServiceDesc = "Disk Sürücüsü"
[Strings.0422]
ReactOS = "Команда ReactOS"
GenericMfg = "(Стандартні приводи дисків)"
DiskClassName = "Дискові приводи"
Disk.DeviceDesc = "Дисковий привід"
OpticalDisk.DeviceDesc = "Оптичний привід дисків"
Disk.ServiceDesc = "Драйвер диску"
[Strings.0804]
GenericMfg = "(通用磁盘驱动器)"
Disk.DeviceDesc = "磁盘驱动器"
OpticalDisk.DeviceDesc = "光盘驱动器"
Disk.ServiceDesc = "磁盘驱动器"

View file

@ -0,0 +1,23 @@
/* ------------------------------------------------------------------------- *
* *
* Copyright (c) Microsoft Corporation *
* *
* Module Name : disk.rc *
* *
* Abstract : Resource script for disk.sys *
* *
* ------------------------------------------------------------------------- */
#include <verrsrc.h>
#include <ntverp.h>
#define VER_FILETYPE VFT_DRV
#define VER_FILESUBTYPE VFT2_DRV_SYSTEM
#define VER_FILEDESCRIPTION_STR "PnP Disk Driver"
#define VER_INTERNALNAME_STR "disk.sys"
#define VER_ORIGINALFILENAME_STR "disk.sys"
#define VER_LANGNEUTRAL
#include "common.ver"

View file

@ -0,0 +1,7 @@
; Disk class driver
[AddReg]
HKLM,"SYSTEM\CurrentControlSet\Services\Disk","ErrorControl",0x00010001,0x00000000
HKLM,"SYSTEM\CurrentControlSet\Services\Disk","Group",0x00000000,"SCSI Class"
HKLM,"SYSTEM\CurrentControlSet\Services\Disk","ImagePath",0x00020000,"system32\drivers\disk.sys"
HKLM,"SYSTEM\CurrentControlSet\Services\Disk","Start",0x00010001,0x00000000
HKLM,"SYSTEM\CurrentControlSet\Services\Disk","Type",0x00010001,0x00000001

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,23 @@
The Microsoft Public License (MS-PL)
Copyright (c) 2015 Microsoft
This license governs use of the accompanying software. If you use the software, you
accept this license. If you do not accept the license, do not use the software.
1. Definitions
The terms "reproduce," "reproduction," "derivative works," and "distribution" have the
same meaning here as under U.S. copyright law.
A "contribution" is the original software, or any additions or changes to the software.
A "contributor" is any person that distributes its contribution under this license.
"Licensed patents" are a contributor's patent claims that read directly on its contribution.
2. Grant of Rights
(A) Copyright Grant- Subject to the terms of this license, including the license conditions and limitations in section 3, each contributor grants you a non-exclusive, worldwide, royalty-free copyright license to reproduce its contribution, prepare derivative works of its contribution, and distribute its contribution or any derivative works that you create.
(B) Patent Grant- Subject to the terms of this license, including the license conditions and limitations in section 3, each contributor grants you a non-exclusive, worldwide, royalty-free license under its licensed patents to make, have made, use, sell, offer for sale, import, and/or otherwise dispose of its contribution in the software or derivative works of the contribution in the software.
3. Conditions and Limitations
(A) No Trademark License- This license does not grant you rights to use any contributors' name, logo, or trademarks.
(B) If you bring a patent claim against any contributor over patents that you claim are infringed by the software, your patent license from such contributor to the software ends automatically.
(C) If you distribute any portion of the software, you must retain all copyright, patent, trademark, and attribution notices that are present in the software.
(D) If you distribute any portion of the software in source code form, you may do so only under this license by including a complete copy of this license with your distribution. If you distribute any portion of the software in compiled or object code form, you may only do so under a license that complies with this license.
(E) The software is licensed "as-is." You bear the risk of using it. The contributors give no express warranties, guarantees or conditions. You may have additional consumer rights under your local laws which this license cannot change. To the extent permitted under your local laws, the contributors exclude the implied warranties of merchantability, fitness for a particular purpose and non-infringement.

File diff suppressed because it is too large Load diff