How it works : Daemon Tools

vbimport

#1

Here’s a shorter version of the original explanation, reposted with agreement from DT staff.
Lots of people reacted violently to the original version without knowing the background of this
story or my motivations, and I don’t feel like explaining anything to them. In the end DT users
are more knowledgeable about the tool they use and the next DT version will be more robust than
it would have been without this post, and it’s all that matters.

Here’s a graphical overview of the main components of Daemon Tools (DT) :


daemon.exe -------------> daemon.dll ----------------> Lang\1033.dll 
            funcs(1-15)       |\---------------------> Plugins\Images\*.DLL 
                              |\---------------------> pfctoc.dll 
			      |
			      | DeciceIOControl
			      |
			      V
			  d344bus.sys  <---->  d344prt.sys

daemon.exe:

This program is located in the installation directory and is started automatically by
an entry in HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run. It handles the
graphical interface of DT (tray icon) and takes care of the support functionalities
(helpfile, homepage, email) as well as the command line switches (lock, noicon, …),
which it saves in its own startup command line in the registry. However, the main role of
daemon.exe is to translate the options selected by the user into commands to daemon.dll.

daemon.dll:

This DLL is always stored in windows system directory and is loaded by daemon.exe.
It is responsible for opening and parsing the image files (using Plugins\Images*.DLL),
and providing language support (using Lang\1033.dll). On top of the officialy supported
image formats, DT also seem to be able to mount Simdisc2 (.sd2) and CDRwin (.cdr)
images, for which it uses pfctoc.dll. Furthermore, this DLL translates the requests received
by daemon.exe (through one of its 15 exported functions) into commands to the bus driver
(d344bus.sys).

d344prt.sys

This is the SCSI miniport driver, which is located in the driver subdirectory of
windows system directory, and which is started as a service by windows. As
a miniport driver, its only task is to initialize the SCSI port and to intercept
all the SCSI events to notify the bus driver. Only the minimum required
functions of a SCSI miniport driver are implemented, i.e. HwScsiInitialize,
HwScsiStartIo, HwScsiFindAdapter and HwScsiResetBus, which are forwarded
to the bus driver.

d344bus.sys

This is the bus driver, which is located in the same location as the port driver,
and which is also started as a service. This driver is the core of the emulation
tool. First it handles the new drive letter for both DOS and windows (via the mount
manager), then it receives commands from the DLL, events from the port driver
and reads data from the image. In version 3.44 this driver can emulate 50 SCSI
commands and handles them according to its configuration.

For instance, whenever a READ_CD command is sent to the virtual drive, first the
port driver receives a HwScsiStartIo->SRB_FUNCTION_EXECUTE_SCSI command, which it
forwards to the bus driver. There, the command is handled by the READ_CD (BEh)
code, based on the data contained in the image file and the Safedisc, Securom,
Laserlock and RMPS settings. Then the bus driver fills the buffer of the SRB
(SCSI Request Block) with these data, which go back to the port driver, then
to the OS and finally to the calling application.


#2

Nice description Spath :slight_smile:

Also noticed that those authors have no informative readme/help files for their tools. They just have how to install and that’s it.


#3

Thank you for the explanation. The article was written very well.


#4

Very well written explanation, have used the app for years without a problem.
Now I know what’s going on and how it all hangs together.
Many thanks for an excellent article.


#5

@spath:

please contact me immediately,

email:

locutus@daemon-tools.cc

we have to discuss something, thank you


#6

Hmmm… good too hear you sorted things out with DT. I hope they will pick up the tips you gave them!

But, I was really looking forward to your work on EAC. Does this mean it will not happen anymore?

[off-topic]
Any news on the C2 tests you and Gamefreak worked on?
[/off-topic]


#7

> But, I was really looking forward to your work on EAC. Does this mean
> it will not happen anymore?

Nothing is decided yet.

> Any news on the C2 tests you and Gamefreak worked on?

Same answer as before : ask GF, he’s the one who should
be waken up :slight_smile:


#8

Please let that article go through! :bow: :bow:

I would really appriciate it (not that it matters).