Announcement

Collapse
No announcement yet.

Bug in GetCount/Add/Remove CLI methods

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Bug in GetCount/Add/Remove CLI methods

    Hi there,

    I recently started playing around with the CLI of Daemon Tools. I'm writing a wrapper for it in C#.

    I found the return values of the -get_count, -add and -remove switches to be incorrect in the latest versions of both DTLite (v4.41.3.0173) and DTPro (v4.41.0315.0262). The return values are supposed to contain the total number of virtual drives. However only the number of "DT" type drives (basic emulation) is returned, i.e. "SCSI" type drives and in DTPro's case "IDE" type drives as well are not counted!
    From a programmer's point of view I think the problem is very simple and so should its solution be.

    I've tested this on both w7 x64 SP1 and on winXP SP3 x86 (the latter in a VM).

    If anybody else could test this as well, that'd be great, just make sure you're running the latest version.

    Thanks for looking into this!

  • #2
    It's not a bug. Such behavior is by design.

    Most likely beavior of -get_count will be changed in the nearest versions. So you will be able to get total number of devices.

    But how do you imagine behavior of -add and -remove switches without specifying device type? Please describe it in detail.

    Comment


    • #3
      I find that a bit silly.
      A new version is released which allows the number of DT drives to be counted and output, but not the other types?
      Of course I don't know your software architecture, but still, it seems odd to me...

      I should have been clearer I guess.
      Here's the behaviour I see (DTPro behaves similarly):
      1. -add switch:
        a. DTLite.exe -add scsi
        This command always returns 0 (unless the maximum number of drives is reached: -1).
        Instead, according to your online documentation, it should return the number of drives.

        b. DTLite.exe -add dt
        Same as 1.a.

      2. -remove switch:
        a. DTLite -remove scsi, 0/1
        This command always returns 0 (unless the specified drive doesn't exist: -1).
        Instead, according to your online documentation, it should return the number of drives.

        b. DTLite -remove dt, 0/1
        Same as 2.a.

      3. -get_count switch:
        DTLite.exe -get_count
        This command returns only the number of DT type drives (0, 1 or 2).
        It does not count the SCSI drives. Again, your online documentation says it should behave otherwise!

      Comment


      • #4
        Well, -add and -remove switches work well except returning the number of devices. BUT their main function is to add and remove virtual drives. And that's all. Returning the number of devices was a side effect, but it wasn't useful enough.
        If you really need this functionality, I can send your request to dev team.

        Please note that correct usage of -add/-remove switches presupposes specifying of device type.

        Comment


        • #5
          Well I myself don't use the values returned by the -add/-remove switches.
          I was just pointing it out because your documentation says one thing and the software itself does another .
          So in my opinion, the online documentation is incorrect at this point, regardless of what these switches are intended to do .
          I know they must be used with a drive type parameter.
          I should have made that clear in my initial post.


          Anyway, I found this workaround to do the trick for the time being:

          Instead of using the response data from Daemon Tools when using either of the 3 aforementioned switches,
          and if the exitcode is not -1 (i.e. nothing went wrong),
          I use the -get_letter switch to try to get the letter for each possible drive (in case of DTLite: DT 0, DT 1, SCSI 0 and SCSI 1).
          A drive exists for each letter that could be successfully retrieved => drive count is incremented.

          Needless to say this workaround is complete crap performance wise.
          This is because a -get_letter call to Daemon Tools must be made for every single possible drive, whether it exists or not. (32 calls instead of 1 for DTPro!!!)

          It does have the added benefit of being able to get the number of drives of only a certain type, since the -get_letter switch is drive type specific.
          So if you are willing to send a request to the dev team, I would suggest the following:
          1. Either make sure the -add/-remove switches return the correct drive count, or modify the documentation.
          2. Add a <type> parameter to the -get_count switch
            1. Its syntax would be "DTLite.exe/DTAgent.exe -get_count <type>".
            2. It returns the number of drives of the specified type.
            3. If no <type> parameter is specified, it returns the total number of drives of all types.
              This also ensures backward compatibility with older scripts people might have.

            But at the very least make sure the -get_count switch can return the total number of drives.


          Thanks for considering this!
          Do let me know what the decisions are on this matter.
          I ask because the development of my project depends on it .

          Comment


          • #6
            Needless to say this workaround is complete crap performance wise. This is because a -get_letter call to Daemon Tools must be made for every single possible drive, whether it exists or not. (32 calls instead of 1 for DTPro!!!)
            please..you talk about dt performance and then do 32 calls for the letter? never heard of querying drive type? (GetDriveType api for example).. people in glass houses....
            my views are 100% personal views..

            Comment


            • #7
              No need to be hostile I know about the .NET DriveInfo class.
              But do tell me how it can help solve the problem?
              So you loop through all the drives of the type "CDROM" and then what?
              How can I tell whether they are Daemon Tools drives or not and what type of Daemon Tools drive they are?
              If you were referring to another method, I apologize, please do enlighten me in that case.

              Moreover, I'm not bashing DT performance, I was solely referring to my own workaround,
              which is, in DTPro's case, literally 32 times slower than what could be accomplished by a single -get_count call.
              But as far as I know, right now it is the only way to correctly count the number of virtual drives within Daemon Tools.

              Regardless of all the above, it still doesn't change the fact that DT isn't doing what it's supposed to do according the documentation,
              and that the behaviour of the -get_count switch as it is now, is simply illogical.

              Let me be clear, I don't mean to bash DT, I love the product, I've been using it for years and will be for years to come
              but you have to admit, right now either the CLI methods are flawed, or the documentation is incorrect, or both

              Comment


              • #8
                apparently the documentation is lagging a little -get_count is not "parameterless" use -get_count dt for dt drives or -get_count scsi for scsi drives

                Comment


                • #9
                  Are you frickin' kidding me o_O?
                  I just tested this, it works indeed! (Should've thought of testing it myself I guess...)
                  Thanks a bunch flintstone!

                  @DT support:
                  I don't want to attack anyone here, but was it so difficult to find out about and tell me this when I started this thread? And is it too much to ask to keep your documentation updated?
                  I mean honestly, this would literally take 5 seconds to update...

                  I'd given up on this, I only just saw there'd been another reply.
                  Thanks again flintstone!

                  Comment


                  • #10
                    DAEMON Tools Lite documentation was updated some time ago.

                    Comment


                    • #11
                      Sorry about that, didn't notice.
                      Funny thing is, in the description of the -get_count switch it still says it's parameterless, which obviously it is not
                      (same for -add switch btw )

                      Anyway, my original remarks about the -add and -remove switches still stand.
                      Either DT does not return the correct number of drives, or your documentation is not correct

                      Knowing what I know now, I would rephrase my suggestion from a previous post to this:
                      1. Either make sure the -add/-remove switches return the correct drive count, or modify the documentation.
                      2. If no <type> parameter is specified for the -get_count switch, it could return the total number of drives of all types. (not just the total number of DT type drives, which is the case in the current version)
                        This would also ensure backward compatibility with older scripts people might have.

                      Comment

                      Working...
                      X