11 years ago[bus] Handle PnP ID queries
Shao Miller [Mon, 13 Dec 2010 01:38:58 +0000 (20:38 -0500)]
[bus] Handle PnP ID queries

11 years ago[disk,device] Move disk__type::DiskNumber to device__type::dev_num
Shao Miller [Sun, 12 Dec 2010 03:18:06 +0000 (22:18 -0500)]
[disk,device] Move disk__type::DiskNumber to device__type::dev_num

We can number all devices on a bus, rather than just disks.

11 years ago[bus/dev_ctl] Minor cosmetic changes
Shao Miller [Sun, 12 Dec 2010 02:43:37 +0000 (21:43 -0500)]
[bus/dev_ctl] Minor cosmetic changes

11 years ago[aoe] Even more cosmetic changes
Shao Miller [Sun, 12 Dec 2010 02:23:15 +0000 (21:23 -0500)]
[aoe] Even more cosmetic changes

And that won't be the end of it.

11 years ago[bus] Rename bus__type::first_child_ptr to first_child
Shao Miller [Sun, 12 Dec 2010 01:48:54 +0000 (20:48 -0500)]
[bus] Rename bus__type::first_child_ptr to first_child

11 years ago[aoe] More cosmetic changes
Shao Miller [Sun, 12 Dec 2010 01:40:57 +0000 (20:40 -0500)]
[aoe] More cosmetic changes

11 years ago[disk,device] Move PnP ID query handling into device module
Shao Miller [Sat, 11 Dec 2010 21:55:34 +0000 (16:55 -0500)]
[disk,device] Move PnP ID query handling into device module

We should really allow for PnP ID query handling beyond just
for disks, so we now handle such queries as a device operation.

11 years ago[device] Rename make_dev_pdo to device__make_pdo_
Shao Miller [Sat, 11 Dec 2010 20:20:50 +0000 (15:20 -0500)]
[device] Rename make_dev_pdo to device__make_pdo_

11 years ago[device] Rename free_dev to device__free_dev_
Shao Miller [Sat, 11 Dec 2010 20:19:29 +0000 (15:19 -0500)]
[device] Rename free_dev to device__free_dev_

11 years ago[device] Remove device__init module startup function
Shao Miller [Sat, 11 Dec 2010 20:17:49 +0000 (15:17 -0500)]
[device] Remove device__init module startup function

There's not really a need to track all devices in a linked
list.  So now the module is purely library.

11 years ago[device] Minor cosmetic changes.
Shao Miller [Sat, 11 Dec 2010 20:05:07 +0000 (15:05 -0500)]
[device] Minor cosmetic changes.

11 years ago[device] Don't use device__close_decl macro
Shao Miller [Sat, 11 Dec 2010 19:43:43 +0000 (14:43 -0500)]
[device] Don't use device__close_decl macro

Use a typedef, instead.

11 years ago[device] Don't use winvblock__def_struct for device__type
Shao Miller [Sat, 11 Dec 2010 19:32:42 +0000 (14:32 -0500)]
[device] Don't use winvblock__def_struct for device__type

11 years ago[device,driver,protocol] Remove portable.h #include from header
Shao Miller [Sat, 11 Dec 2010 19:10:53 +0000 (14:10 -0500)]
[device,driver,protocol] Remove portable.h #include from header

For consistency with many other headers.

11 years ago[device] Don't use winvblock__def_enum for device__state
Shao Miller [Sat, 11 Dec 2010 19:08:12 +0000 (14:08 -0500)]
[device] Don't use winvblock__def_enum for device__state

And rename its values.

11 years ago[bus,driver] Move attach_fdo into driver module
Shao Miller [Sat, 11 Dec 2010 17:50:34 +0000 (12:50 -0500)]
[bus,driver] Move attach_fdo into driver module

attach_fdo is really a _driver_ thing, rather than a
_bus_ thing, so we move it into the driver module as

This allows us to remove bus module initialization,
meaning the bus module should be purely library now.

Our driver's AddDevice routine (driver__attach_fdo_) is
hard-coded to only attach a maximum of one FDO, which
will be the main WinVBlock bus.  This could change later.

11 years ago[bus] Rename sys_ctl to bus__sys_ctl_
Shao Miller [Sat, 11 Dec 2010 02:56:22 +0000 (21:56 -0500)]
[bus] Rename sys_ctl to bus__sys_ctl_

11 years ago[bus] Make callers of bus__add_child responsible...
Shao Miller [Thu, 9 Dec 2010 21:58:40 +0000 (16:58 -0500)]
[bus] Make callers of bus__add_child responsible...

...for freeing their device if bus__add_child() fails.
This is better than bus__add_child() freeing it, for the sake
of consistency in the code.  I accidentally re-freed not
once, but twice, while trying some things out.

11 years ago[wv_stdlib] Use appropriate pool tags
Shao Miller [Thu, 9 Dec 2010 21:26:39 +0000 (16:26 -0500)]
[wv_stdlib] Use appropriate pool tags

For AoE:
"WinAoE" with tag 'EoAW'.

For WinVBlock:
"WinVBlock" with tag 'klBV'.

11 years ago[bus,bus/pnp,disk/pnp] Don't use LowerDeviceObject if NULL
Shao Miller [Thu, 9 Dec 2010 20:56:47 +0000 (15:56 -0500)]
[bus,bus/pnp,disk/pnp] Don't use LowerDeviceObject if NULL

A bus might not be an FDO on top of some other PDO, so we should
only call a bus' "LowerDeviceObject" if it exists.

11 years ago[bus] Add do-nothing bus__init_ function
Shao Miller [Thu, 9 Dec 2010 16:58:09 +0000 (11:58 -0500)]
[bus] Add do-nothing bus__init_ function

In order to have a sub-bus as a node on a bus, we need to
implement a device__type::init function, since bus__add_child()
will call it on a child device.

11 years ago[device] Remove device__init_decl macro
Shao Miller [Thu, 9 Dec 2010 16:43:11 +0000 (11:43 -0500)]
[device] Remove device__init_decl macro

Use device__init_func typedef, instead.

11 years ago[driver,bus] Move the "boot bus" into the driver module
Shao Miller [Thu, 9 Dec 2010 06:53:44 +0000 (01:53 -0500)]
[driver,bus] Move the "boot bus" into the driver module

It's now called driver__bus_fdo_ and is accessible via
driver__bus().  This involved some code shuffling.

Additionally, bus__create_pdo_() has been modified to
actually produce a vanilla bus PDO without hard-coding
the "boot bus" logic into it.

We also adjust bus__module_init() to move the "boot bus"
code out.

This effort is towards modules/drivers creating their
own bus.

11 years ago[device] Use typedef for device__create_pdo_func
Shao Miller [Thu, 9 Dec 2010 04:48:23 +0000 (23:48 -0500)]
[device] Use typedef for device__create_pdo_func

Instead of the device__create_pdo_decl() macro and
device__create_pdo_routine function pointer typedef.

11 years ago[driver] Rename driver_dispatch to driver__dispatch_
Shao Miller [Wed, 8 Dec 2010 21:42:06 +0000 (16:42 -0500)]
[driver] Rename driver_dispatch to driver__dispatch_

11 years ago[driver] Rename driver_dispatch_not_supported to driver__dispatch_not_supported_
Shao Miller [Wed, 8 Dec 2010 21:41:06 +0000 (16:41 -0500)]
[driver] Rename driver_dispatch_not_supported to driver__dispatch_not_supported_

11 years ago[driver] Rename os_load_opts to driver__os_load_opts_
Shao Miller [Wed, 8 Dec 2010 21:17:44 +0000 (16:17 -0500)]
[driver] Rename os_load_opts to driver__os_load_opts_

11 years ago[driver] Rename Driver_Globals_Started to driver__started_
Shao Miller [Wed, 8 Dec 2010 21:13:15 +0000 (16:13 -0500)]
[driver] Rename Driver_Globals_Started to driver__started_

11 years ago[driver] Rename Driver_Globals_StateHandle to driver__state_handle_
Shao Miller [Wed, 8 Dec 2010 21:12:16 +0000 (16:12 -0500)]
[driver] Rename Driver_Globals_StateHandle to driver__state_handle_

11 years ago[driver] Rename Driver_Unload to driver__unload_
Shao Miller [Wed, 8 Dec 2010 21:11:01 +0000 (16:11 -0500)]
[driver] Rename Driver_Unload to driver__unload_

11 years ago[device] Correct the return type for device__set
Shao Miller [Wed, 8 Dec 2010 21:06:44 +0000 (16:06 -0500)]
[device] Correct the return type for device__set

11 years ago[driver] Minor style/cosmetic changes
Shao Miller [Wed, 8 Dec 2010 21:04:23 +0000 (16:04 -0500)]
[driver] Minor style/cosmetic changes

Undoing all of the hard work that did. *sigh*

11 years ago[bus] Track boot__module_up_ as TRUE a bit earlier
Shao Miller [Wed, 8 Dec 2010 19:44:50 +0000 (14:44 -0500)]
[bus] Track boot__module_up_ as TRUE a bit earlier

We obviously have to track 'bus__module_up_' as 'TRUE'
_before_ the call to bus__create().  Oops.

11 years ago[bus] Require module initialization for bus__create
Shao Miller [Wed, 8 Dec 2010 18:44:26 +0000 (13:44 -0500)]
[bus] Require module initialization for bus__create

Just like the previous commit regarding bus__add_child().

11 years ago[bus] Track if the bus module has been initialized
Shao Miller [Wed, 8 Dec 2010 18:23:06 +0000 (13:23 -0500)]
[bus] Track if the bus module has been initialized

Since bus__add_child() is a library function, we don't really
want a caller using it unless the WinVBlock driver is
actually running.  We now track module initialization status.

11 years ago[bus] Rename bus__finalize to bus__module_shutdown
Shao Miller [Wed, 8 Dec 2010 18:10:12 +0000 (13:10 -0500)]
[bus] Rename bus__finalize to bus__module_shutdown

11 years ago[bus] Rename bus__init to bus__module_init
Shao Miller [Wed, 8 Dec 2010 17:52:43 +0000 (12:52 -0500)]
[bus] Rename bus__init to bus__module_init

Because 'bus__init' seems more like something you'd
do to a particular bus instance.

11 years ago[bus] Rename Bus_GetDeviceCapabilities to bus__get_dev_capabilities
Shao Miller [Wed, 8 Dec 2010 17:43:44 +0000 (12:43 -0500)]
[bus] Rename Bus_GetDeviceCapabilities to bus__get_dev_capabilities

11 years ago[bus] Don't use winvblock__def_struct for bus__type
Shao Miller [Wed, 8 Dec 2010 17:38:46 +0000 (12:38 -0500)]
[bus] Don't use winvblock__def_struct for bus__type

11 years ago[bus] Rename create_pdo to bus__create_pdo_
Shao Miller [Wed, 8 Dec 2010 17:17:59 +0000 (12:17 -0500)]
[bus] Rename create_pdo to bus__create_pdo_

11 years ago[bus] Rename free_bus to bus__free_
Shao Miller [Wed, 8 Dec 2010 17:15:56 +0000 (12:15 -0500)]
[bus] Rename free_bus to bus__free_

11 years ago[bus] Rename bus_list to bus__list_
Shao Miller [Wed, 8 Dec 2010 17:15:07 +0000 (12:15 -0500)]
[bus] Rename bus_list to bus__list_

11 years ago[bus] Rename bus_list_lock to bus__list_lock_
Shao Miller [Wed, 8 Dec 2010 17:14:23 +0000 (12:14 -0500)]
[bus] Rename bus_list_lock to bus__list_lock_

11 years ago[bus] Rename boot_bus_fdo to bus__boot_fdo_
Shao Miller [Wed, 8 Dec 2010 17:13:22 +0000 (12:13 -0500)]
[bus] Rename boot_bus_fdo to bus__boot_fdo_

11 years ago[bus] Minor style/cosmetic changes
Shao Miller [Wed, 8 Dec 2010 16:02:23 +0000 (11:02 -0500)]
[bus] Minor style/cosmetic changes

Undoing all of the hard work that did. *sigh*

11 years ago[device] Introduce device__set function
Shao Miller [Wed, 8 Dec 2010 14:52:33 +0000 (09:52 -0500)]
[device] Introduce device__set function

Use this new device__set() to set a 'device' pointer for

11 years ago[bus] Rename bus__get_ptr to bus__get
Shao Miller [Wed, 8 Dec 2010 14:29:46 +0000 (09:29 -0500)]
[bus] Rename bus__get_ptr to bus__get

And use a function instead of a macro.

11 years ago[device] Introduce device__get function
Shao Miller [Wed, 8 Dec 2010 07:06:43 +0000 (02:06 -0500)]
[device] Introduce device__get function

Use this new device__get() to get a 'device' pointer from
a 'PDEVICE_OBJECT' instead of the old casting.  We still
need to change the casting used when _setting_ it, though.

11 years ago[aoe] Rename get_aoe_disk_ptr to aoe__get_
Shao Miller [Wed, 8 Dec 2010 06:15:36 +0000 (01:15 -0500)]
[aoe] Rename get_aoe_disk_ptr to aoe__get_

11 years ago[aoe] Rename aoe_disk_list to aoe__disk_list_
Shao Miller [Wed, 8 Dec 2010 05:46:38 +0000 (00:46 -0500)]
[aoe] Rename aoe_disk_list to aoe__disk_list_

11 years ago[aoe] Rename aoe_disk_list_lock to aoe__disk_list_lock_
Shao Miller [Wed, 8 Dec 2010 05:45:55 +0000 (00:45 -0500)]
[aoe] Rename aoe_disk_list_lock to aoe__disk_list_lock_

11 years ago[aoe] Rename AoE_Globals_Started to aoe__started_
Shao Miller [Wed, 8 Dec 2010 05:44:44 +0000 (00:44 -0500)]
[aoe] Rename AoE_Globals_Started to aoe__started_

11 years ago[aoe] Rename AoE_Globals_ThreadHandle to aoe__thread_handle_
Shao Miller [Wed, 8 Dec 2010 05:43:41 +0000 (00:43 -0500)]
[aoe] Rename AoE_Globals_ThreadHandle to aoe__thread_handle_

11 years ago[aoe] Rename AoE_Globals_OutstandingTags to aoe__outstanding_tags_
Shao Miller [Wed, 8 Dec 2010 05:42:47 +0000 (00:42 -0500)]
[aoe] Rename AoE_Globals_OutstandingTags to aoe__outstanding_tags_

11 years ago[aoe] Rename AoE_Globals_DiskSearchList to aoe__disk_search_list_
Shao Miller [Wed, 8 Dec 2010 05:41:56 +0000 (00:41 -0500)]
[aoe] Rename AoE_Globals_DiskSearchList to aoe__disk_search_list_

11 years ago[aoe] Rename AoE_Globals_ProbeTag to aoe__probe_tag_
Shao Miller [Wed, 8 Dec 2010 05:40:56 +0000 (00:40 -0500)]
[aoe] Rename AoE_Globals_ProbeTag to aoe__probe_tag_

11 years ago[aoe] Rename AoE_Globals_TagList to aoe__tag_list_
Shao Miller [Wed, 8 Dec 2010 05:40:01 +0000 (00:40 -0500)]
[aoe] Rename AoE_Globals_TagList to aoe__tag_list_

11 years ago[aoe] Rename AoE_Globals_TagListLast to aoe__tag_list_last_
Shao Miller [Wed, 8 Dec 2010 05:39:00 +0000 (00:39 -0500)]
[aoe] Rename AoE_Globals_TagListLast to aoe__tag_list_last_

11 years ago[aoe] Rename AoE_Globals_ThreadSignalEvent to aoe__thread_sig_evt_
Shao Miller [Wed, 8 Dec 2010 02:49:08 +0000 (21:49 -0500)]
[aoe] Rename AoE_Globals_ThreadSignalEvent to aoe__thread_sig_evt_

11 years ago[aoe] Rename AoE_Globals_SpinLock to aoe__spinlock_
Shao Miller [Wed, 8 Dec 2010 02:47:31 +0000 (21:47 -0500)]
[aoe] Rename AoE_Globals_SpinLock to aoe__spinlock_

11 years ago[aoe] Rename AoE_Globals_Stop to aoe__stop_
Shao Miller [Wed, 8 Dec 2010 02:46:23 +0000 (21:46 -0500)]
[aoe] Rename AoE_Globals_Stop to aoe__stop_

11 years ago[aoe] Rename AoE_Globals_TargetList to aoe__target_list_
Shao Miller [Wed, 8 Dec 2010 02:45:10 +0000 (21:45 -0500)]
[aoe] Rename AoE_Globals_TargetList to aoe__target_list_

11 years ago[aoe] Rename AoE_Globals_TargetListSpinLock to aoe__target_list_spinlock_
Shao Miller [Wed, 8 Dec 2010 02:43:12 +0000 (21:43 -0500)]
[aoe] Rename AoE_Globals_TargetListSpinLock to aoe__target_list_spinlock_

11 years ago[aoe] Rename target_list to aoe__target_list_
Shao Miller [Wed, 8 Dec 2010 02:38:41 +0000 (21:38 -0500)]
[aoe] Rename target_list to aoe__target_list_

11 years ago[aoe] Rename search_state to aoe__search_state_
Shao Miller [Wed, 8 Dec 2010 02:36:30 +0000 (21:36 -0500)]
[aoe] Rename search_state to aoe__search_state_

11 years ago[aoe] Rename disk_search to aoe__disk_search_
Shao Miller [Wed, 8 Dec 2010 02:28:45 +0000 (21:28 -0500)]
[aoe] Rename disk_search to aoe__disk_search_

11 years ago[aoe] Rename work_tag to aoe__work_tag_
Shao Miller [Wed, 8 Dec 2010 02:26:05 +0000 (21:26 -0500)]
[aoe] Rename work_tag to aoe__work_tag_

11 years ago[aoe] Rename io_req to aoe__io_req_
Shao Miller [Wed, 8 Dec 2010 02:23:05 +0000 (21:23 -0500)]
[aoe] Rename io_req to aoe__io_req_

11 years ago[aoe] Rename packet to aoe__packet_
Shao Miller [Wed, 8 Dec 2010 02:21:12 +0000 (21:21 -0500)]
[aoe] Rename packet to aoe__packet_

11 years ago[aoe] Rename create_aoe_disk to aoe__create_disk_
Shao Miller [Wed, 8 Dec 2010 01:35:39 +0000 (20:35 -0500)]
[aoe] Rename create_aoe_disk to aoe__create_disk_

11 years ago[aoe] Rename free_aoe_disk to aoe__free_disk_
Shao Miller [Wed, 8 Dec 2010 01:31:35 +0000 (20:31 -0500)]
[aoe] Rename free_aoe_disk to aoe__free_disk_

11 years ago[aoe] Rename unload to aoe__unload_
Shao Miller [Wed, 8 Dec 2010 01:29:08 +0000 (20:29 -0500)]
[aoe] Rename unload to aoe__unload_

11 years ago[aoe] Rename process_abft to aoe__process_abft_
Shao Miller [Wed, 8 Dec 2010 01:27:17 +0000 (20:27 -0500)]
[aoe] Rename process_abft to aoe__process_abft_

11 years ago[debug] Undo a build macro toggle that slipped in
Shao Miller [Wed, 8 Dec 2010 01:12:25 +0000 (20:12 -0500)]
[debug] Undo a build macro toggle that slipped in

We were building with debugging enabled.  Oops.

11 years ago[aoe] Rename thread routine to aoe__thread_
Shao Miller [Wed, 8 Dec 2010 01:10:48 +0000 (20:10 -0500)]
[aoe] Rename thread routine to aoe__thread_

11 years ago[aoe] Rename aoe_disk_type to aoe__disk_type_
Shao Miller [Wed, 8 Dec 2010 01:06:52 +0000 (20:06 -0500)]
[aoe] Rename aoe_disk_type to aoe__disk_type_

Trying out a new style: All file-scope items prefixed by
"file__" and non-exported items suffixed with an underscore.

11 years ago[aoe] Don't use winvblock__def_enum for tag type
Shao Miller [Wed, 8 Dec 2010 01:00:25 +0000 (20:00 -0500)]
[aoe] Don't use winvblock__def_enum for tag type

11 years ago[device] Remove device__free_decl macro
Shao Miller [Tue, 7 Dec 2010 22:42:29 +0000 (17:42 -0500)]
[device] Remove device__free_decl macro

Use a typedef, instead.

11 years ago[irp] Remove irp__handler_decl macro
Shao Miller [Tue, 7 Dec 2010 22:00:27 +0000 (17:00 -0500)]
[irp] Remove irp__handler_decl macro

Use a typedef for similar (but lesser) convenience.
Again, for the sake of editors that parse source files.

11 years ago[aoe] Don't use winvblock__def_struct for aoe_disk_type
Shao Miller [Tue, 7 Dec 2010 21:18:00 +0000 (16:18 -0500)]
[aoe] Don't use winvblock__def_struct for aoe_disk_type

It might have been less typing, but some editors with code
completion obviously don't work with it.

11 years ago[aoe] Major cosmetic changes
Shao Miller [Tue, 7 Dec 2010 21:11:42 +0000 (16:11 -0500)]
[aoe] Major cosmetic changes

The driver.c file is quite large, so this effort isn't
even complete yet.

11 years ago[aoe] Minor cosmetic changes
Shao Miller [Tue, 7 Dec 2010 16:55:50 +0000 (11:55 -0500)]
[aoe] Minor cosmetic changes

12 years ago[disk] Move away from mini IRP handling table registration
Shao Miller [Fri, 3 Dec 2010 21:23:54 +0000 (16:23 -0500)]
[disk] Move away from mini IRP handling table registration

There was no current usage for hooking a disk's mini IRP
handling table chain, so we simply walk the one table from
a disk_dispatch() function.

12 years ago[bus] Start moving away from mini IRP handling registration
Shao Miller [Fri, 3 Dec 2010 21:08:37 +0000 (16:08 -0500)]
[bus] Start moving away from mini IRP handling registration

We begin to move away from a chain of registered mini IRP handling
tables, since right now AoE is the only module to make use of it,
registering with the boot bus.  For now, we leave a portion intact.

12 years ago[driver,device,irp] Don't use mini IRP handling registration
Shao Miller [Fri, 3 Dec 2010 06:36:14 +0000 (01:36 -0500)]
[driver,device,irp] Don't use mini IRP handling registration

We're moving away from registering/deregistering mini IRP
handling tables for devices, and towards each device class
implementing its own dispatch routine.

12 years ago[irp] Move code into irp__process_with_table
Shao Miller [Fri, 3 Dec 2010 05:40:59 +0000 (00:40 -0500)]
[irp] Move code into irp__process_with_table

We only have 4 mini IRP handling tables, so the
register/unregister functionality hardly seems worth it.  One
of the original reasons why it was added was so that AoE could
register with the bus device to receive IOCTLs.  We could do
it differently:

1. AoE could implement its own bus device as a sub-bus of the
   WinVBlock bus.

2. AoE could hook the WinVBlock bus' mini IRP handling table.
   This might be dangerous if AoE didn't unload properly.

3. AoE could still register with the WinVBlock bus to receive
   IRPs, but as a bus registration function versus an abstract
   IRP registration.

This commit paves the way for 'driver', 'bus', 'disk', 'aoe' to
each have their own IRP handling strategy, but to provide the
convenience of still using the mini IRP handling table strategy.
It removes emphasis from the mini IRP handling table
registration functions.

12 years ago[driver,device] Use place-holder driver__default_dispatch
Shao Miller [Thu, 2 Dec 2010 20:16:50 +0000 (15:16 -0500)]
[driver,device] Use place-holder driver__default_dispatch

Working towards the same prototype for IRP handling routines,
we need this place-holder while the mini IRP handling
infrastructure is unchanged.  This is simply to ensure build
and functionality during development, and to keep commit size

12 years ago[driver] Establish driver__dispatch_func type
Shao Miller [Thu, 2 Dec 2010 18:14:20 +0000 (13:14 -0500)]
[driver] Establish driver__dispatch_func type

This type is the prototype for the DriverDispatch function.
Interestingly, this site[1] details a DRIVER_DISPATCH type
for the same reason, but maybe we'll do that later.

12 years ago[irp] Introduce IRP thread routine
Shao Miller [Thu, 2 Dec 2010 16:46:17 +0000 (11:46 -0500)]
[irp] Introduce IRP thread routine

A thread routine which processes IRPs.

12 years ago[device] Make room for threaded devices
Shao Miller [Thu, 2 Dec 2010 15:06:07 +0000 (10:06 -0500)]
[device] Make room for threaded devices

After thinking about a "handler" scheme for devices which
implement various "interfaces," it looked like it'd be
better to implement threading for devices first and to find
out if that would do.

We make space for queuing IRPs and for a thread wakeup signal.

We also replace a lonely ExFreePool() that was missed in a
previous commit with wv_free().

12 years ago[project] Replace RtlZeroMemory with wv_?allocz where reasonable
Shao Miller [Mon, 22 Nov 2010 15:25:13 +0000 (10:25 -0500)]
[project] Replace RtlZeroMemory with wv_?allocz where reasonable

We now have wv_mallocz() and wv_pallocz(), which zero-fill an
allocated memory region.  We lose both speed (boo) and size (yay).

12 years ago[project] Change RtlCompareMemory to wv_memcmpeq
Shao Miller [Sun, 21 Nov 2010 10:25:29 +0000 (05:25 -0500)]
[project] Change RtlCompareMemory to wv_memcmpeq

We previously had patterns like:

  if (!(RtlCompareMemory(foo, bar, sizeof foo) == sizeof foo))

but now we have:

  if (!wv_memcmpeq(foo, bar, sizeof foo))

We've introduced a few new headers, which have the spirit of
mimicry of the C Standard Library....

'memcmpeq()' is completely bogus, however.

The MS compiler doesn't have '_Bool', so we use unsigned short
for the 'bool' type.  I hope that's good enough.

12 years ago[winvblock/disk/pnp.c] Fix ULONG_PTR warnings
Shao Miller [Sun, 21 Nov 2010 07:51:57 +0000 (02:51 -0500)]
[winvblock/disk/pnp.c] Fix ULONG_PTR warnings

The 'Information' member of an IO_STATUS_BLOCK has type
'ULONG_PTR', so if we are assigning a pointer, we should
cast to keep the MS compiler happy.

12 years ago[project] Replace ExFreePool with wv_free
Shao Miller [Sun, 21 Nov 2010 07:45:53 +0000 (02:45 -0500)]
[project] Replace ExFreePool with wv_free

All instances of ExFreePool() have been replaced with wv_free()

12 years ago[project] Change ExAllocatePool to wv_?alloc
Shao Miller [Sun, 21 Nov 2010 06:10:18 +0000 (01:10 -0500)]
[project] Change ExAllocatePool to wv_?alloc

Every instance of ExAllocatePool() has been replaced with one
of wv_malloc() or wv_palloc(), for non-paged memory pool
allocation and paged memory pool allocation, respectively.

Some coding style changes on changed lines, too, as I've
changed my mind yet again.

12 years ago[filedisk] Support hot-swapping to another file
Shao Miller [Sat, 12 Jun 2010 23:39:51 +0000 (19:39 -0400)]
[filedisk] Support hot-swapping to another file

We can currently boot from a GRUB4DOS sector-mapped disk.
GRUB4DOS has the requirement that the sector range be
contiguous (a contiguous file will do).  In a filesystem,
things like defragmentation or other physical movement of
the image file is possible, which would likely spell
disaster if we continued to simply use the range of
sectors on the backing disk.

It is therefore a good idea to use the image file as soon
as possible, rather than the disk.  This commit introduces
the ability to hot-swap to the file pretty early on.  A
file lock is then had, and the backing filesystem and the
image file are protected from being pulled out from
underneath us.

Since GRUB4DOS doesn't pass the filename used (there might
not even be one; it could honestly just be a sector range),
we improvise a means by which filenames can be associated:

  title Boot disk image file
    # Establish a buffer for passing filenames
    map --rd-size=2048
    map --mem (rd)+4 (0x55)
    # Establish the sector-mapped disk
    root (hd0,0)
    map /WinXP.HDD (hd0)
    # Seal the INT 0x13 hook
    map --hook
    # Pass info via the buffer
    write (0x55) #!GRUB4DOS\x00v=1\x00WinXP.HDD\x00\x80\x00
    # Mount the FS in the disk image file and boot NTLDR
    root (hd0,0)
    chainloader /ntldr

In the above, (rd) is a built-in "disk" with a base and a
size.  By default, the base is at memory address 0.  We
adjust the size to be 2048 bytes.  We then use map --mem
to establish a RAM disk (which we are simply abusing as
a buffer) by copying 4 sectors, 512 bytes each, from (rd).
map --mem RAM disks are marked-up in the INT 0x15, AX=0xE820
memory map, so should be protected against accidental
corruption.  After establishing the sector-mapped disk,
we use the write command to put our parameters in the
buffer.  We put

a signature:


a version:


a filename:


the associated drive number (hd0 == 0x80, etc.):


the next filename is an ASCII NUL, meaning no more files:


The signature was chosen while keeping a particular future
possibility in mind: Passing menu.lst itself as the phony
RAM disk.  All of the path and disk information is in this
file, which makes it fairly convenient.  It would mean
needing to be able to distinguish the menu choice as well
as a extensive parsing system, but it's not impossible.

12 years ago[util] Change the usage
Shao Miller [Mon, 7 Jun 2010 06:50:57 +0000 (02:50 -0400)]
[util] Change the usage

See winvblk.exe -? for new usage.  We process arguments into
options now.

12 years ago[util] Tons of cosmetic changes
Shao Miller [Fri, 4 Jun 2010 04:27:25 +0000 (00:27 -0400)]
[util] Tons of cosmetic changes

Nothing really effectively different.
Error codes changed a bit.

12 years ago[filedisk] Support .ISO-on-HDD scenario
Shao Miller [Thu, 3 Jun 2010 23:41:56 +0000 (19:41 -0400)]
[filedisk] Support .ISO-on-HDD scenario

Had to add a bit to the threaded filedisk in order to
allow a run-once read/write hook which attempts to find
the correct file-backed disk.  This hook used to hook
the enqueuer, but is now queued by it.

So now one can boot an .ISO file that's found on an HDD,
as long as there is a 2048-byte (OD sector) footer whose
last 512 bytes are the Microsoft .VHD footer details.

We should probably provide the convenience for adding
.VHD footers to HDD images and .ISOs in the user-land

12 years ago[filedisk] Fix GRUB4DOS logic up a bit
Shao Miller [Thu, 3 Jun 2010 21:17:22 +0000 (17:17 -0400)]
[filedisk] Fix GRUB4DOS logic up a bit

Had a check backwards.
Had a dumb boolean where status is fine.