WAOAOAOJIIIIPPPPPPIIIIIIII

  • Thread starter Thread starter Dietmar
  • Start date Start date
D

Dietmar

Hi all,
I succeeded with booting minlogon from XPE to ram without any SDI.
There are 2 things, that makes the break through:
I noticed, that perhaps minlogon needs more than 16 MB as its working
memory. So I enlarged the memory from base to 32 MB, which is now only
allowed to be used from minlogon. Therefore I have only to change the
hexvalue in ntbootdd.cpp scsi-sourcefile to a larger value, I chose
0x2000000 (is exakt 32 MB). In boot.ini I set \maxmem=32 and the ramdisk
is above it.
This ramdisk was filled by MS-DOS (from CD) with the files from minlogon
(28,5MB) now with Floppydriver and CDROM. But only the number of BSOD 7B
changes. Than I have an idea: The driver ntbootdd.sys has to start=0. But
what was with all the others, that originally have start=0 entries in
registry? So I changed atapi.sys, ftdisk.sys, isapnp.sys, KSECC.sys,
mountmgr.sys, partmgr.sys and pci.sys between 0 and 1. Oh my,
but at last it works. I think, that now there is no more SDI limit of
500MB, you can copy the files AS THEY ARE from (for example)CD direct to
ram. There is xmsdsk.exe Ramdisk (DOS) with 2 GByte or Memdisk from
Syslinux with 2 Gigabyte, witch you can use.

That was the hardest thing (with my so little knowledge whats going on) in
the last three weeks, that I ever had done, but now I am happy.

Dietmar

PS: Here is the log from windbg (hihi)
I noticed, that there is NO size of the "SCSI" disk in ram, because the
scsi routines have no need to...

Microsoft (R) Windows Debugger Version 6.5.0003.7
Copyright (c) Microsoft Corporation. All rights reserved.

Opened \\.\com1
Waiting to reconnect...
Connected to Windows XP 2600 x86 compatible target, ptr64 FALSE
Kernel Debugger connection established.
Symbol search path is: C:\WINDOWS\Symbols
Executable search path is:
Windows XP Kernel Version 2600 UP Free x86 compatible
Built by: 2600.xpsp1.020828-1920
Kernel base = 0x804d4000 PsLoadedModuleList = 0x8054be30
System Uptime: not available
LDR: LdrpWalkImportDescriptor() failed to probe
C:\windows\System32\StorProp.Dll for its manifest, ntstatus 0xc0150002
Break instruction exception - code 80000003 (first chance)
*******************************************************************************
*
*
* You are seeing this message because you pressed either
*
* CTRL+C (if you run kd.exe) or,
*
* CTRL+BREAK (if you run WinDBG),
*
* on your debugger machine's keyboard.
*
*
*
* THIS IS NOT A BUG OR A SYSTEM CRASH
*
*
*
* If you did not intend to break into the debugger, press the "g" key,
then *
* press the "Enter" key now. This message might immediately reappear. If
it *
* does, press "g" and "Enter" again.
*
*
*
*******************************************************************************
nt!RtlpBreakWithStatusInstruction:
805103fa cc int 3
kd> lm
start end module name
77f50000 77ff7000 ntdll M (pdb symbols)
C:\WINDOWS\Symbols\dll\ntdll.pdb
804d4000 806c6980 nt (pdb symbols)
C:\WINDOWS\Symbols\exe\ntoskrnl.pdb
806c7000 806dfc00 hal (deferred)
bf800000 bf9bac80 win32k (deferred)
bff50000 bff52280 framebuf (deferred)
bff80000 bff90d80 dxg (deferred)
fcab1000 fcac2500 VIDEOPRT (deferred)
fcac3000 fcae4780 update (deferred)
fcae5000 fcb05280 ks (deferred)
fea26000 fea39780 KSecDD (deferred)
fea3a000 fea5d700 Fastfat (deferred)
fea5e000 fea74080 SCSIPORT (deferred)
fea75000 fea8a380 atapi (deferred)
fea8b000 feaa9880 ftdisk (deferred)
feacb000 feada600 pci (deferred)
feadb000 feae3c00 isapnp (deferred)
feaeb000 feaf4280 MountMgr (deferred)
feafb000 feb03400 disk (deferred)
feb0b000 feb16500 CLASSPNP (deferred)
feb3b000 feb46980 cdrom (deferred)
feb4b000 feb58d00 redbook (deferred)
feb5b000 feb64b80 imapi (deferred)
feb6b000 feb77780 i8042prt (deferred)
feb7b000 feb8a400 serial (deferred)
fed4b000 fed4f900 PartMgr (deferred)
fedbb000 fedbfd00 vga (deferred)
feddb000 feddf680 Msfs (deferred)
fedeb000 fedf2380 Npfs (deferred)
fee8b000 fee90b80 kbdclass (deferred)
feeab000 feeb1680 fdc (deferred)
feebb000 feec0600 mouclass (deferred)
feecb000 feecfd00 flpydisk (deferred)
feedb000 feede000 BOOTVID (deferred)
fef4f000 fef52a80 serenum (deferred)
fefa7000 fefab000 watchdog (deferred)
fefaf000 fefb1900 Dxapi (deferred)
fefcb000 fefccb80 kdcom (deferred)
fefcd000 fefce100 WMILIB (deferred)
fefd7000 fefd8f00 Fs_Rec (deferred)
ff093000 ff093d80 ntbootdd (deferred)
ff0dd000 ff0ddf00 swenum (deferred)
ff0f6000 ff0f6b80 Null (deferred)
ff143000 ff143d00 dxgthk (deferred)

Unloaded modules:
fedfb000 fee03000 processr.sys
kd> !devnode 0 1
Dumping IopRootDeviceNode (= 0x80df8008)
DevNode 0x80df8008 for PDO 0x80df9430
InstancePath is "HTREE\ROOT\0"
State = DeviceNodeStarted (0x308)
Previous State = DeviceNodeEnumerateCompletion (0x30d)
DevNode 0x80df8c90 for PDO 0x80df8dd8
InstancePath is "Root\atapi\0000"
ServiceName is "atapi"
State = DeviceNodeStarted (0x308)
Previous State = DeviceNodeEnumerateCompletion (0x30d)
DevNode 0x80e15c28 for PDO 0x80df1030
InstancePath is
"IDE\CdRomTOSHIBA_DVD-ROM_SD-M1612________________1004____\1&eaf0cd7&0&0.0.0"
ServiceName is "cdrom"
TargetDeviceNotify List - f 0xe10e6740 b 0xe117f5b8
State = DeviceNodeStarted (0x308)
Previous State = DeviceNodeStarted (0x308)
DevNode 0x80df1570 for PDO 0x80df16b8
InstancePath is
"IDE\CdRomPLEXTOR_CD-R___PX-W4012A________________1.05____\1&eaf0cd7&0&0.1.0"
ServiceName is "cdrom"
TargetDeviceNotify List - f 0xe10fb2e8 b 0xe117b760
State = DeviceNodeStarted (0x308)
Previous State = DeviceNodeStarted (0x308)
DevNode 0x80df89b0 for PDO 0x80df8af8
InstancePath is "Root\atapi\0001"
ServiceName is "atapi"
State = DeviceNodeStarted (0x308)
Previous State = DeviceNodeEnumerateCompletion (0x30d)
DevNode 0x80df8770 for PDO 0x80df88b8
InstancePath is "Root\Ftdisk\0000"
ServiceName is "ftdisk"
State = DeviceNodeStarted (0x308)
Previous State = DeviceNodeEnumerateCompletion (0x30d)
DevNode 0x80e11b50 for PDO 0x80e11c98
InstancePath is
"STORAGE\Volume\1&30a96598&0&_??_SCSI#Disk&Ven_NEBBETT&Prod_&Rev_#1&30c669b6&0&000#{53f56307-b6bf-11d0-94f2-00a0c91efb8b}"
TargetDeviceNotify List - f 0xe10e6878 b 0xe10e6878
State = DeviceNodeStarted (0x308)
Previous State = DeviceNodeEnumerateCompletion (0x30d)
DevNode 0x80df8530 for PDO 0x80df8678
InstancePath is "Root\LEGACY_KSECDD\0000"
ServiceName is "KSecDD"
State = DeviceNodeStarted (0x308)
Previous State = DeviceNodeEnumerateCompletion (0x30d)
DevNode 0x80df82f0 for PDO 0x80df8438
InstancePath is "Root\LEGACY_MOUNTMGR\0000"
ServiceName is "MountMgr"
State = DeviceNodeStarted (0x308)
Previous State = DeviceNodeEnumerateCompletion (0x30d)
DevNode 0x80e1e008 for PDO 0x80df81f8
InstancePath is "Root\LEGACY_NULL\0000"
ServiceName is "Null"
State = DeviceNodeStarted (0x308)
Previous State = DeviceNodeEnumerateCompletion (0x30d)
DevNode 0x80e1edc8 for PDO 0x80e1ef10
InstancePath is "Root\LEGACY_PARTMGR\0000"
ServiceName is "PartMgr"
State = DeviceNodeStarted (0x308)
Previous State = DeviceNodeEnumerateCompletion (0x30d)
DevNode 0x80e1eb88 for PDO 0x80e1ecd0
InstancePath is "Root\LEGACY_VGASAVE\0000"
ServiceName is "VgaSave"
State = DeviceNodeStarted (0x308)
Previous State = DeviceNodeEnumerateCompletion (0x30d)
DevNode 0x80e1e948 for PDO 0x80e1ea90
InstancePath is "Root\PCI_HAL\0000"
State = DeviceNodeStarted (0x308)
Previous State = DeviceNodeEnumerateCompletion (0x30d)
DevNode 0x80e1dd10 for PDO 0x80df7030
InstancePath is "PCI_HAL\PNP0A03\0"
ServiceName is "pci"
State = DeviceNodeStarted (0x308)
Previous State = DeviceNodeEnumerateCompletion (0x30d)
DevNode 0x80e199b0 for PDO 0x80df6348
InstancePath is
"PCI\VEN_8086&DEV_2578&SUBSYS_00000000&REV_02\2&ebb567f&0&00"
State = DeviceNodeStarted (0x308)
Previous State = DeviceNodeEnumerateCompletion (0x30d)
DevNode 0x80e18ee8 for PDO 0x80df6158
InstancePath is
"PCI\VEN_8086&DEV_2579&SUBSYS_00000000&REV_02\2&ebb567f&0&08"
ServiceName is "pci"
State = DeviceNodeStarted (0x308)
Previous State = DeviceNodeEnumerateCompletion (0x30d)
DevNode 0x80e17720 for PDO 0x80e179c0
InstancePath is
"PCI\VEN_10DE&DEV_0041&SUBSYS_310F1458&REV_A1\3&242d906&0&0008"
State = DeviceNodeInitialized (0x302)
Previous State = DeviceNodeUninitialized (0x301)
Problem = CM_PROB_FAILED_INSTALL
DevNode 0x80e18dc8 for PDO 0x80df5e40
InstancePath is
"PCI\VEN_8086&DEV_257B&SUBSYS_00000000&REV_02\2&ebb567f&0&18"
ServiceName is "pci"
State = DeviceNodeStarted (0x308)
Previous State = DeviceNodeEnumerateCompletion (0x30d)
DevNode 0x80e172b8 for PDO 0x80e17558
InstancePath is
"PCI\VEN_8086&DEV_1019&SUBSYS_80F71043&REV_00\3&38a2cc62&0&0818"
State = DeviceNodeInitialized (0x302)
Previous State = DeviceNodeUninitialized (0x301)
Problem = CM_PROB_FAILED_INSTALL
DevNode 0x80e18ca8 for PDO 0x80df5af8
InstancePath is
"PCI\VEN_8086&DEV_24D2&SUBSYS_80A61043&REV_02\2&ebb567f&0&E8"
State = DeviceNodeInitialized (0x302)
Previous State = DeviceNodeUninitialized (0x301)
Problem = CM_PROB_FAILED_INSTALL
DevNode 0x80e18b88 for PDO 0x80df57b0
InstancePath is
"PCI\VEN_8086&DEV_24D4&SUBSYS_80A61043&REV_02\2&ebb567f&0&E9"
State = DeviceNodeInitialized (0x302)
Previous State = DeviceNodeUninitialized (0x301)
Problem = CM_PROB_FAILED_INSTALL
DevNode 0x80e18a68 for PDO 0x80df5468
InstancePath is
"PCI\VEN_8086&DEV_24D7&SUBSYS_80A61043&REV_02\2&ebb567f&0&EA"
State = DeviceNodeInitialized (0x302)
Previous State = DeviceNodeUninitialized (0x301)
Problem = CM_PROB_FAILED_INSTALL
DevNode 0x80e18948 for PDO 0x80e19030
InstancePath is
"PCI\VEN_8086&DEV_24DE&SUBSYS_80A61043&REV_02\2&ebb567f&0&EB"
State = DeviceNodeInitialized (0x302)
Previous State = DeviceNodeUninitialized (0x301)
Problem = CM_PROB_FAILED_INSTALL
DevNode 0x80e18828 for PDO 0x80e19e40
InstancePath is
"PCI\VEN_8086&DEV_24DD&SUBSYS_80A61043&REV_02\2&ebb567f&0&EF"
State = DeviceNodeInitialized (0x302)
Previous State = DeviceNodeUninitialized (0x301)
Problem = CM_PROB_FAILED_INSTALL
DevNode 0x80e18708 for PDO 0x80e19af8
InstancePath is
"PCI\VEN_8086&DEV_244E&SUBSYS_00000000&REV_C2\2&ebb567f&0&F0"
ServiceName is "pci"
State = DeviceNodeStarted (0x308)
Previous State = DeviceNodeEnumerateCompletion (0x30d)
DevNode 0x80e17ee8 for PDO 0x80df4c58
InstancePath is
"PCI\VEN_1106&DEV_3044&SUBSYS_808A1043&REV_80\3&1beca885&0&18F0"
State = DeviceNodeInitialized (0x302)
Previous State = DeviceNodeUninitialized (0x301)
Problem = CM_PROB_FAILED_INSTALL
DevNode 0x80e17dc8 for PDO 0x80df4910
InstancePath is
"PCI\VEN_1102&DEV_0007&SUBSYS_10021102&REV_00\3&1beca885&0&60F0"
State = DeviceNodeInitialized (0x302)
Previous State = DeviceNodeUninitialized (0x301)
Problem = CM_PROB_FAILED_INSTALL
DevNode 0x80e17ca8 for PDO 0x80df45c8
InstancePath is
"PCI\VEN_1102&DEV_7005&SUBSYS_10021102&REV_00\3&1beca885&0&61F0"
State = DeviceNodeInitialized (0x302)
Previous State = DeviceNodeUninitialized (0x301)
Problem = CM_PROB_FAILED_INSTALL
DevNode 0x80e17b88 for PDO 0x80df4280
InstancePath is
"PCI\VEN_105A&DEV_4D68&SUBSYS_4D68105A&REV_02\3&1beca885&0&68F0"
State = DeviceNodeInitialized (0x302)
Previous State = DeviceNodeUninitialized (0x301)
Problem = CM_PROB_FAILED_INSTALL
DevNode 0x80e185e8 for PDO 0x80e19768
InstancePath is
"PCI\VEN_8086&DEV_24D0&SUBSYS_00000000&REV_02\2&ebb567f&0&F8"
ServiceName is "isapnp"
State = DeviceNodeStarted (0x308)
Previous State = DeviceNodeEnumerateCompletion (0x30d)
DevNode 0x80df3dc8 for PDO 0x80df3f10
InstancePath is "ISAPNP\ReadDataPort\0"
State = DeviceNodeStarted (0x308)
Previous State = DeviceNodeStarted (0x308)
DevNode 0x80e184c8 for PDO 0x80e19578
InstancePath is
"PCI\VEN_8086&DEV_24DB&SUBSYS_80A61043&REV_02\2&ebb567f&0&F9"
State = DeviceNodeInitialized (0x302)
Previous State = DeviceNodeUninitialized (0x301)
Problem = CM_PROB_FAILED_INSTALL
DevNode 0x80e183a8 for PDO 0x80e19230
InstancePath is
"PCI\VEN_8086&DEV_24D3&SUBSYS_80A61043&REV_02\2&ebb567f&0&FB"
State = DeviceNodeInitialized (0x302)
Previous State = DeviceNodeUninitialized (0x301)
Problem = CM_PROB_FAILED_INSTALL
DevNode 0x80e1e708 for PDO 0x80e1e850
InstancePath is "Root\SYSTEM\0000"
ServiceName is "swenum"
State = DeviceNodeStarted (0x308)
Previous State = DeviceNodeEnumerateCompletion (0x30d)
DevNode 0x80e1e4c8 for PDO 0x80e1e610
InstancePath is "Root\SYSTEM\0001"
ServiceName is "update"
State = DeviceNodeStarted (0x308)
Previous State = DeviceNodeStarted (0x308)
DevNode 0x80e1dad0 for PDO 0x80e1dc18
InstancePath is "Root\*PNP0000\PnPBIOS_1"
State = DeviceNodeInitialized (0x302)
Previous State = DeviceNodeUninitialized (0x301)
DevNode 0x80e1d890 for PDO 0x80e1d9d8
InstancePath is "Root\*PNP0100\PnPBIOS_3"
State = DeviceNodeInitialized (0x302)
Previous State = DeviceNodeUninitialized (0x301)
DevNode 0x80df7990 for PDO 0x80df7ad8
InstancePath is "Root\*PNP0200\PnPBIOS_2"
State = DeviceNodeInitialized (0x302)
Previous State = DeviceNodeUninitialized (0x301)
DevNode 0x80df7750 for PDO 0x80df7898
InstancePath is "Root\*PNP0301\1_0_22_0_32_0"
ServiceName is "i8042prt"
TargetDeviceNotify List - f 0xe117e0d0 b 0xe117e0d0
State = DeviceNodeStarted (0x308)
Previous State = DeviceNodeEnumerateCompletion (0x30d)
DevNode 0x80df7510 for PDO 0x80df7658
InstancePath is "Root\*PNP0501\PnPBIOS_10"
ServiceName is "Serial"
State = DeviceNodeDriversAdded (0x303)
Previous State = DeviceNodeInitialized (0x302)
Problem = CM_PROB_NORMAL_CONFLICT
DevNode 0x80df72d0 for PDO 0x80df7418
InstancePath is "Root\*PNP0501\PnPBIOS_11"
ServiceName is "Serial"
State = DeviceNodeStarted (0x308)
Previous State = DeviceNodeEnumerateCompletion (0x30d)
DevNode 0x80e1c008 for PDO 0x80df71d8
InstancePath is "Root\*PNP0700\PnPBIOS_12"
ServiceName is "fdc"
State = DeviceNodeStarted (0x308)
Previous State = DeviceNodeEnumerateCompletion (0x30d)
DevNode 0x80e04968 for PDO 0x80dd9d58
InstancePath is "FDC\GENERIC_FLOPPY_DRIVE\1&f6fd67c&0&0"
ServiceName is "flpydisk"
TargetDeviceNotify List - f 0xe10826c8 b 0xe10826c8
State = DeviceNodeStarted (0x308)
Previous State = DeviceNodeEnumerateCompletion (0x30d)
DevNode 0x80e1cdc8 for PDO 0x80e1cf10
InstancePath is "Root\*PNP0800\PnPBIOS_8"
State = DeviceNodeInitialized (0x302)
Previous State = DeviceNodeUninitialized (0x301)
DevNode 0x80e1cb88 for PDO 0x80e1ccd0
InstancePath is "Root\*PNP0B00\PnPBIOS_4"
State = DeviceNodeInitialized (0x302)
Previous State = DeviceNodeUninitialized (0x301)
DevNode 0x80e1c948 for PDO 0x80e1ca90
InstancePath is "Root\*PNP0C01\PnPBIOS_0"
State = DeviceNodeInitialized (0x302)
Previous State = DeviceNodeUninitialized (0x301)
DevNode 0x80e1c708 for PDO 0x80e1c850
InstancePath is "Root\*PNP0C02\PnPBIOS_13"
State = DeviceNodeInitialized (0x302)
Previous State = DeviceNodeUninitialized (0x301)
DevNode 0x80e1c4c8 for PDO 0x80e1c610
InstancePath is "Root\*PNP0C02\PnPBIOS_14"
State = DeviceNodeInitialized (0x302)
Previous State = DeviceNodeUninitialized (0x301)
DevNode 0x80e1c288 for PDO 0x80e1c3d0
InstancePath is "Root\*PNP0C02\PnPBIOS_15"
State = DeviceNodeInitialized (0x302)
Previous State = DeviceNodeUninitialized (0x301)
DevNode 0x80df6008 for PDO 0x80e1c190
InstancePath is "Root\*PNP0C04\PnPBIOS_9"
State = DeviceNodeInitialized (0x302)
Previous State = DeviceNodeUninitialized (0x301)
DevNode 0x80df6dc8 for PDO 0x80df6f10
InstancePath is "Root\*PNP0F03\1_0_21_0_31_0"
ServiceName is "i8042prt"
TargetDeviceNotify List - f 0xe11b5da8 b 0xe11b5da8
State = DeviceNodeStarted (0x308)
Previous State = DeviceNodeEnumerateCompletion (0x30d)
DevNode 0x80de5008 for PDO 0x80df09e8
InstancePath is "ROOT\ntbootdd\0000"
ServiceName is "ntbootdd"
State = DeviceNodeStarted (0x308)
Previous State = DeviceNodeEnumerateCompletion (0x30d)
DevNode 0x80e14868 for PDO 0x80e14030
InstancePath is "SCSI\Disk&Ven_NEBBETT&Prod_&Rev_\1&30c669b6&0&000"
ServiceName is "disk"
State = DeviceNodeStarted (0x308)
Previous State = DeviceNodeEnumerateCompletion (0x30d)
 
Hi all,
here is the cpp Source code ntbootdd.cpp with little modification (thanks
to Gary Nebbett 1997)for ntbootdd.sys . I compiled it for NT4 and for XP
and it works. If You change scsi.h against storport.h it doesnt work any
more. The compiled size is only 3kByte. It is not too difficult, to
understand, how this program works. I also give you my SOURCE file for
compiling, because these libraries are NOT includet by the compiler
himself. That is, what I call a nice program, not MEGA and MEGABYTE from
people, who dont know how to make it better...

extern "C" {
#include "miniport.h"
#include "scsi.h"
}
#include <memory.h>

#pragma pack(push, 1)

typedef struct PTABLE {
UCHAR Flag;
UCHAR Chs1[3];
UCHAR Type;
UCHAR Chs2[3];
ULONG Start;
ULONG Size;
} *PPTABLE;

typedef struct FAT {
UCHAR Jump[3];
UCHAR System[8];
USHORT BytesPerSector;
UCHAR SectorsPerCluster;
USHORT ReservedSectors;
UCHAR FatCopies;
USHORT RootEntries;
USHORT SmallSectors;
UCHAR MediaType;
USHORT SectorsPerFat;
USHORT SectorsPerTrack;
USHORT Heads;
ULONG HiddenSectors;
ULONG LargeSectors;
UCHAR Disk;
UCHAR Flags;
UCHAR Signature;
ULONG SerialNumber;
UCHAR Label[11];
UCHAR Format[8];
UCHAR Code[0x17A];
ULONG DiskSignature;
UCHAR Reserved;
UCHAR BootPartition;
PTABLE Table[4];
USHORT BootSignature;
} *PFAT;

#pragma pack(pop)


typedef PVOID *PPVOID;

const ULONG PageSize = 0x1000;
const ULONG DiskBase = 0x2000000;

ULONG BytesPerBlock, Blocks;
PCHAR MapBase;
BOOLEAN Boot;


ULONG ChunkSize(ULONG Offset, ULONG Length, ULONG Position)
{
ULONG X = PageSize - ((Offset + Position) & (PageSize - 1));
ULONG Y = Length - Position;

return X < Y ? X : Y;
}


PVOID MapPage(PVOID DeviceExtension, ULONG Address)
{
ULONG X = (Address - DiskBase) / PageSize;

if (PPVOID(DeviceExtension)[X] == 0)

*(PPVOID(DeviceExtension) + X) =

ScsiPortGetDeviceBase(DeviceExtension, Internal, 0,

ScsiPortConvertUlongToPhysicalAddress(Address & ~(PageSize - 1)),
PageSize, FALSE);

return PCHAR(PPVOID(DeviceExtension)[X]) + (Address & (PageSize -
1));
}


PVOID MapAddress(PVOID DeviceExtension, ULONG Address, ULONG Size)
{
return ScsiPortGetDeviceBase(DeviceExtension, Internal, 0,

ScsiPortConvertUlongToPhysicalAddress(Address), Size, FALSE);
}


BOOLEAN StartIo(PVOID DeviceExtension, PSCSI_REQUEST_BLOCK Srb)
{
Srb->SrbStatus = SRB_STATUS_INVALID_REQUEST;
Srb->ScsiStatus = SCSISTAT_GOOD;

if (Srb->Function == SRB_FUNCTION_EXECUTE_SCSI && Srb->Lun == 0) {

switch (Srb->Cdb[0]) {

case SCSIOP_INQUIRY:
{
memset(Srb->DataBuffer, 0, Srb->DataTransferLength);
PINQUIRYDATA Inq = PINQUIRYDATA(Srb->DataBuffer);
Inq->DeviceType = DIRECT_ACCESS_DEVICE;
Inq->DeviceTypeQualifier = DEVICE_CONNECTED;
memcpy(Inq->VendorId, "NEBBETT ", sizeof Inq->VendorId);
Srb->SrbStatus = SRB_STATUS_SUCCESS;
}
break;

case SCSIOP_MODE_SENSE:
{
memset(Srb->DataBuffer, 0, Srb->DataTransferLength);
PMODE_PARM_READ_WRITE_DATA Mode =
PMODE_PARM_READ_WRITE_DATA(Srb->DataBuffer);
Mode->ParameterListHeader.ModeDataLength = sizeof *Mode -
1;
Mode->ParameterListHeader.BlockDescriptorLength = sizeof
Mode->ParameterListBlock;
Srb->SrbStatus = SRB_STATUS_SUCCESS;
}
break;

case SCSIOP_TEST_UNIT_READY:
case SCSIOP_MEDIUM_REMOVAL:
{
Srb->SrbStatus = SRB_STATUS_SUCCESS;
}
break;

case SCSIOP_READ_CAPACITY:
{
ULONG X = BytesPerBlock;

REVERSE_BYTES(&PREAD_CAPACITY_DATA(Srb->DataBuffer)->BytesPerBlock, &X);
X = Blocks - 1;

REVERSE_BYTES(&PREAD_CAPACITY_DATA(Srb->DataBuffer)->LogicalBlockAddress,
&X);
Srb->SrbStatus = SRB_STATUS_SUCCESS;
}
break;

case SCSIOP_READ:
{
ULONG X;
REVERSE_BYTES(&X,
&PCDB(Srb->Cdb)->CDB10.LogicalBlockByte0);

if (Boot) {
X = X * BytesPerBlock + DiskBase;
for (ULONG Z, Y = 0; Y < Srb->DataTransferLength; Y +=
Z) {
Z = ChunkSize(X, Srb->DataTransferLength, Y);
memcpy(PCHAR(Srb->DataBuffer) + Y,
MapPage(DeviceExtension, X + Y), Z);
}
}
else
memcpy(Srb->DataBuffer, MapBase + X * BytesPerBlock,
Srb->DataTransferLength);
Srb->SrbStatus = SRB_STATUS_SUCCESS;
}
break;

case SCSIOP_WRITE:
{
ULONG X;
REVERSE_BYTES(&X,
&PCDB(Srb->Cdb)->CDB10.LogicalBlockByte0);

if (Boot) {
X = X * BytesPerBlock + DiskBase;
for (ULONG Z, Y = 0; Y < Srb->DataTransferLength; Y +=
Z) {
Z = ChunkSize(X, Srb->DataTransferLength, Y);
memcpy(MapPage(DeviceExtension, X + Y),
PCHAR(Srb->DataBuffer) + Y, Z);
}
}
else
memcpy(MapBase + X * BytesPerBlock, Srb->DataBuffer,
Srb->DataTransferLength);
Srb->SrbStatus = SRB_STATUS_SUCCESS;
}
break;

default:
{
ScsiDebugPrint(1, "StartIo Function Execute %x, Flags %lx,
Len %lx\n",
int(Srb->Cdb[0]), Srb->SrbFlags,
Srb->DataTransferLength);
// for (int i = 0; i < 2000; i++)
ScsiPortStallExecution(1000);
}
break;
}
}

ScsiPortNotification(RequestComplete, DeviceExtension, Srb);
ScsiPortNotification(NextRequest, DeviceExtension);

return TRUE;
}


ULONG FindAdapter(PVOID DeviceExtension, PVOID, PVOID, PCHAR,
PPORT_CONFIGURATION_INFORMATION ConfigInfo, PBOOLEAN
Again)
{
PFAT Fat = PFAT(MapAddress(DeviceExtension, DiskBase, sizeof (FAT)));

Boot = Fat->LargeSectors != 0;

BytesPerBlock = Fat->BytesPerSector;
Blocks = Fat->SmallSectors;

Fat->LargeSectors = 0;
Fat->BootSignature = 0xAA55;
Fat->Table[0].Type = 4;
Fat->Table[0].Start = 0;
Fat->Table[0].Size = Blocks;
Fat->Table[1].Type = Fat->Table[2].Type = Fat->Table[3].Type = 0;

ScsiPortFreeDeviceBase(DeviceExtension, Fat);

if (!Boot) MapBase = PCHAR(MapAddress(DeviceExtension, DiskBase,
Blocks * BytesPerBlock));

ConfigInfo->NumberOfBuses = 1;
ConfigInfo->MaximumNumberOfTargets = 1;

*Again = FALSE;

return SP_RETURN_FOUND;
}


BOOLEAN ResetBus(PVOID DeviceExtension, ULONG PathId)
{
ScsiPortCompleteRequest(DeviceExtension, UCHAR(PathId), SP_UNTAGGED,
SP_UNTAGGED,
SRB_STATUS_BUS_RESET);

return TRUE;
}


BOOLEAN Initialize(PVOID)
{
return TRUE;
}


extern "C"
ULONG DriverEntry(PVOID DriverObject, PVOID RegistryPath)
{
HW_INITIALIZATION_DATA Hid = {sizeof Hid};

Hid.AdapterInterfaceType = Isa;
Hid.DeviceExtensionSize = 0x2000 * sizeof (PVOID);
Hid.MapBuffers = TRUE;

Hid.HwFindAdapter = FindAdapter;
Hid.HwInitialize = Initialize;
Hid.HwResetBus = ResetBus;
Hid.HwStartIo = StartIo;

return ScsiPortInitialize(DriverObject, RegistryPath, &Hid, 0);
}



And here is the SOURCE for compiling for XP:


TARGETNAME=ntbootdd
TARGETPATH=obj
TARGETTYPE=DRIVER

TARGETLIBS=C:\WINDDK\2600.1106\lib\wxp\i386\scsiport.lib \
C:\WINDDK\2600.1106\lib\wxp\i386\scsiwmi.lib


SOURCES=ntbootdd.cpp


Nice to hear from You

Dietmar
 
Back
Top