<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://nsis.sourceforge.io/mediawiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Message</id>
	<title>NSIS Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://nsis.sourceforge.io/mediawiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Message"/>
	<link rel="alternate" type="text/html" href="https://nsis.sourceforge.io/Special:Contributions/Message"/>
	<updated>2026-04-21T22:40:14Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.39.17</generator>
	<entry>
		<id>https://nsis.sourceforge.io/mediawiki/index.php?title=DVD_functions&amp;diff=15884</id>
		<title>DVD functions</title>
		<link rel="alternate" type="text/html" href="https://nsis.sourceforge.io/mediawiki/index.php?title=DVD_functions&amp;diff=15884"/>
		<updated>2008-07-26T15:45:11Z</updated>

		<summary type="html">&lt;p&gt;Message: /* The Functions */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{PageAuthor|Message}}&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
Because the [[CDRom plug-in]] is unable to read any data from DVDs, these functions are meant as a replacement with two primary functions: Finding CD/DVD-ROM drives in the user&#039;s system and reading CD/DVD-ROM disc labels.&lt;br /&gt;
== How To Use ==&lt;br /&gt;
&amp;lt;highlight-nsis&amp;gt;/* --------------------------------&lt;br /&gt;
&lt;br /&gt;
  DVD functions - a replacement for the CD-ROM plugin for NSIS&lt;br /&gt;
    Created by Message, 2007&lt;br /&gt;
&lt;br /&gt;
  Usage example:&lt;br /&gt;
    push &amp;quot;&amp;quot;                       ;push input to stack&lt;br /&gt;
    call DVD_GetNextDrive         ;call function&lt;br /&gt;
    pop $0                        ;pop output from stack&lt;br /&gt;
&lt;br /&gt;
    push $0                       ;push input to stack&lt;br /&gt;
    call DVD_GetLabel             ;call function&lt;br /&gt;
    pop $1                        ;pop output from stack&lt;br /&gt;
&lt;br /&gt;
    call DVD_Unload               ;unload from memory&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  DVD_GetNextDrive : Finds the first/next CD/DVD-ROM drive and returns its full path on the stack.&lt;br /&gt;
&lt;br /&gt;
             input : The function will search for the first CD/DVD drive AFTER this specified&lt;br /&gt;
                     drive letter. So with input &amp;quot;C:\&amp;quot; the function will start searching at D:\.&lt;br /&gt;
                     Only the first character of the input is used, so it should be a Capital&lt;br /&gt;
                     letter from A to Z.&lt;br /&gt;
                     If the input does not start with A-Z, the function returns an empty string&lt;br /&gt;
                     (&amp;quot;&amp;quot;) on the stack.&lt;br /&gt;
                     If the input is empty, the function starts scanning at A:\.&lt;br /&gt;
                     If the function reaches Z:\, it will continue searching at A:\.&lt;br /&gt;
            output : The full path of the first CD/DVD-ROM drive the function found, for example&lt;br /&gt;
                     &amp;quot;E:\&amp;quot;.&lt;br /&gt;
                     If the function could not find any CD/DVD-ROM drive after (and before) the&lt;br /&gt;
                     specified input drive, it will return an empty string (&amp;quot;&amp;quot;) on the stack.&lt;br /&gt;
                     If Windows could not find any drives at all (either CD-ROM or otherwise),&lt;br /&gt;
                     the function returns &amp;quot;ERROR&amp;quot;. This should never happen.&lt;br /&gt;
&lt;br /&gt;
  DVD_GetLabel     : Returns the label of the CD/DVD currently in the specified drive on the stack.&lt;br /&gt;
&lt;br /&gt;
             input : The full path to the root of the CD/DVD-ROM drive, so for example &amp;quot;E:\&amp;quot;.&lt;br /&gt;
            output : The full volume label of the disc in the drive. If there is no disc in the&lt;br /&gt;
                     drive, or there is some other error, the function will return&lt;br /&gt;
                     &amp;quot;DVDGetLabel_error&amp;quot; on the stack.&lt;br /&gt;
&lt;br /&gt;
  DVD_CheckDrive   : Checks if the specified drive  is a CD/DVD-ROM drive.&lt;br /&gt;
&lt;br /&gt;
             input : The full path to the root of the CD/DVD-ROM drive, so for example &amp;quot;E:\&amp;quot;.&lt;br /&gt;
            output : If the drive is a CD/DVD-ROM drive, the function will return &amp;quot;CDROM&amp;quot; on the&lt;br /&gt;
                     stack. (For other possible outputs, see the function code.)&lt;br /&gt;
&lt;br /&gt;
  DVD_Unload       : Unloads dlls used in other DVD functions. Call this function from .onGUIEnd&lt;br /&gt;
                     to prevent .dll files from remaining in the user&#039;s temp folder. No input or&lt;br /&gt;
                     output.&lt;br /&gt;
*/&lt;br /&gt;
&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
== The Functions ==&lt;br /&gt;
&amp;lt;highlight-nsis&amp;gt;&lt;br /&gt;
Function DVD_GetNextDrive&lt;br /&gt;
  Exch $R1&lt;br /&gt;
  Push $R0&lt;br /&gt;
  Push $R2&lt;br /&gt;
  Push $R3&lt;br /&gt;
  Push $R4&lt;br /&gt;
&lt;br /&gt;
  ;get all drives (return to $R0, bitwise)&lt;br /&gt;
  System::Call /NOUNLOAD &#039;kernel32::GetLogicalDrives() i .r10&#039;&lt;br /&gt;
  StrCmp $R0 &amp;quot;0&amp;quot; 0 +3        ;if no drives found, error&lt;br /&gt;
    StrCpy $R1 &amp;quot;ERROR&amp;quot;&lt;br /&gt;
    goto break&lt;br /&gt;
&lt;br /&gt;
  ;If no parameter was supplied at all, assume we&#039;re starting at A:\ and set the &amp;quot;no parameters&amp;quot; flag.&lt;br /&gt;
  StrCmp $R1 &amp;quot;&amp;quot; 0 +4&lt;br /&gt;
    StrCpy $R1 &amp;quot;0&amp;quot;&lt;br /&gt;
    StrCpy $R4 &amp;quot;-1&amp;quot;  ;no parameters flag. If $R4 is -1, it will never equal the current drive letter, thus the alphabet cycle check will never kick in&lt;br /&gt;
    goto loop&lt;br /&gt;
  &lt;br /&gt;
  ;get ascii-number of first char in function parameter&lt;br /&gt;
  System::Call /NOUNLOAD &amp;quot;*(&amp;amp;t1 r11)i.r12&amp;quot;&lt;br /&gt;
  System::Call /NOUNLOAD &amp;quot;*$R2(&amp;amp;i1 .r11)&amp;quot;&lt;br /&gt;
  System::Free /NOUNLOAD $R2&lt;br /&gt;
  IntOp $R1 $R1 - 65&lt;br /&gt;
&lt;br /&gt;
  ;check if parameter driveletter is between A and Z&lt;br /&gt;
  IntCmp $R1 0 0 +2&lt;br /&gt;
  IntCmp $R1 25 +3 +3&lt;br /&gt;
    StrCpy $R1 &amp;quot;&amp;quot;&lt;br /&gt;
    goto break&lt;br /&gt;
  &lt;br /&gt;
  ;backup the (asciiconverted) starting driveletter, for detecting when we&#039;ve cycled the entire alphabet.&lt;br /&gt;
  StrCpy $R4 $R1&lt;br /&gt;
&lt;br /&gt;
  ;If a valid parameter was supplied (ie we had a parameter and we survived so far), start at the driveletter directly after the supplied starting driveletter&lt;br /&gt;
  IntOp $R1 $R1 + 1&lt;br /&gt;
  StrCmp $R1 26 0 +2         ;if &amp;gt;Z&lt;br /&gt;
    StrCpy $R1 0             ;  return to A&lt;br /&gt;
&lt;br /&gt;
  loop:&lt;br /&gt;
    IntOp $R2 0x01 &amp;lt;&amp;lt; $R1&lt;br /&gt;
    IntOp $R3 $R2 &amp;amp; $R0&lt;br /&gt;
    ;if (0x01&amp;lt;&amp;lt;driveletter &amp;amp; drivesfound) == 0x01&amp;lt;&amp;lt;driveletter  (in other words, if there is a drive mounted at this driveletter)&lt;br /&gt;
    StrCmp $R3 $R2 0 NoDriveHere&lt;br /&gt;
      ;convert asciinumber of driveletter to character&lt;br /&gt;
      IntOp $R2 $R1 + 65&lt;br /&gt;
      IntFmt $R2 %c $R2&lt;br /&gt;
      ;get type of drive&lt;br /&gt;
      System::Call /NOUNLOAD &#039;kernel32::GetDriveType(t &amp;quot;$R2:\&amp;quot;) i .r13&#039;&lt;br /&gt;
      StrCmp $R3 5 0 NoDriveHere&lt;br /&gt;
        ;type is CDROM&lt;br /&gt;
        StrCmp $R1 $R4 0 +3      ;if we&#039;ve cycled the entire alphabet (we ended up at the drive specified in the starting paramater)&lt;br /&gt;
          StrCpy $R1 &amp;quot;&amp;quot;          ;  no more CDROM drives found&lt;br /&gt;
          goto break&lt;br /&gt;
        StrCpy $R1 &amp;quot;$R2:\&amp;quot;       ;else: next CDROM drive found&lt;br /&gt;
        goto break&lt;br /&gt;
    NoDriveHere:&lt;br /&gt;
    StrCmp $R1 $R4 0 +3      ;if we&#039;ve cycled the entire alphabet&lt;br /&gt;
      StrCpy $R1 &amp;quot;&amp;quot;          ;  no CDROM drive found&lt;br /&gt;
      goto break&lt;br /&gt;
    IntOp $R1 $R1 + 1        ;increment driveletter&lt;br /&gt;
    StrCmp $R1 26 0 loop     ;if &amp;gt;Z&lt;br /&gt;
      StrCmp $R4 &amp;quot;-1&amp;quot; 0 +3   ;  if there were no parameters&lt;br /&gt;
        StrCpy $R1 &amp;quot;&amp;quot;        ;    no CDROM drive found&lt;br /&gt;
        goto break&lt;br /&gt;
      StrCpy $R1 0           ;  else return to A&lt;br /&gt;
      goto loop&lt;br /&gt;
  break:&lt;br /&gt;
&lt;br /&gt;
  Pop $R4&lt;br /&gt;
  Pop $R3&lt;br /&gt;
  Pop $R2&lt;br /&gt;
  Pop $R0&lt;br /&gt;
  Exch $R1&lt;br /&gt;
FunctionEnd&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Function DVD_GetLabel&lt;br /&gt;
  Exch $R0&lt;br /&gt;
  Push $R1&lt;br /&gt;
  Push $R2&lt;br /&gt;
&lt;br /&gt;
  ;leave function if no parameter was supplied&lt;br /&gt;
  StrCmp $R0 &amp;quot;&amp;quot; break&lt;br /&gt;
&lt;br /&gt;
  ;get the label of the drive (return to $R1)&lt;br /&gt;
  System::Call /NOUNLOAD &#039;Kernel32::GetVolumeInformation(t r10,t.r11,i ${NSIS_MAX_STRLEN},*i,*i,*i,t.r12,i ${NSIS_MAX_STRLEN})i.r10&#039;&lt;br /&gt;
  StrCmp $R0 0 0 +3&lt;br /&gt;
    StrCpy $R0 &amp;quot;DVDGetLabel_error&amp;quot;&lt;br /&gt;
    goto +2&lt;br /&gt;
  StrCpy $R0 $R1&lt;br /&gt;
  break:&lt;br /&gt;
&lt;br /&gt;
  Pop $R2&lt;br /&gt;
  Pop $R1&lt;br /&gt;
  Exch $R0&lt;br /&gt;
FunctionEnd&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Function DVD_CheckDrive&lt;br /&gt;
  Exch $R0&lt;br /&gt;
  Push $R1&lt;br /&gt;
  System::Call /NOUNLOAD &#039;kernel32::GetDriveType(t &amp;quot;$R0&amp;quot;) i .r11&#039;&lt;br /&gt;
  StrCmp $R1 0 0 +2&lt;br /&gt;
  StrCpy $R0 &amp;quot;UNKNOWN&amp;quot;&lt;br /&gt;
  StrCmp $R1 1 0 +2&lt;br /&gt;
  StrCpy $R0 &amp;quot;INVALID&amp;quot;&lt;br /&gt;
  StrCmp $R1 2 0 +2&lt;br /&gt;
  StrCpy $R0 &amp;quot;REMOVABLE&amp;quot;&lt;br /&gt;
  StrCmp $R1 3 0 +2&lt;br /&gt;
  StrCpy $R0 &amp;quot;FIXED&amp;quot;&lt;br /&gt;
  StrCmp $R1 4 0 +2&lt;br /&gt;
  StrCpy $R0 &amp;quot;REMOTE&amp;quot;&lt;br /&gt;
  StrCmp $R1 5 0 +2&lt;br /&gt;
  StrCpy $R0 &amp;quot;CDROM&amp;quot;&lt;br /&gt;
  StrCmp $R1 6 0 +2&lt;br /&gt;
  StrCpy $R0 &amp;quot;RAMDISK&amp;quot;&lt;br /&gt;
  Pop $R1&lt;br /&gt;
  Exch $R0&lt;br /&gt;
FunctionEnd&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Function DVD_Unload&lt;br /&gt;
  Push $R0&lt;br /&gt;
  System::Call &#039;kernel32::GetLogicalDrives() i .r10 ? u&#039;&lt;br /&gt;
  Pop $R0&lt;br /&gt;
FunctionEnd&lt;br /&gt;
&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:System Related Functions]]&lt;/div&gt;</summary>
		<author><name>Message</name></author>
	</entry>
	<entry>
		<id>https://nsis.sourceforge.io/mediawiki/index.php?title=DVD_functions&amp;diff=15882</id>
		<title>DVD functions</title>
		<link rel="alternate" type="text/html" href="https://nsis.sourceforge.io/mediawiki/index.php?title=DVD_functions&amp;diff=15882"/>
		<updated>2008-07-26T00:40:13Z</updated>

		<summary type="html">&lt;p&gt;Message: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{PageAuthor|Message}}&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
Because the [[CDRom plug-in]] is unable to read any data from DVDs, these functions are meant as a replacement with two primary functions: Finding CD/DVD-ROM drives in the user&#039;s system and reading CD/DVD-ROM disc labels.&lt;br /&gt;
== How To Use ==&lt;br /&gt;
&amp;lt;highlight-nsis&amp;gt;/* --------------------------------&lt;br /&gt;
&lt;br /&gt;
  DVD functions - a replacement for the CD-ROM plugin for NSIS&lt;br /&gt;
    Created by Message, 2007&lt;br /&gt;
&lt;br /&gt;
  Usage example:&lt;br /&gt;
    push &amp;quot;&amp;quot;                       ;push input to stack&lt;br /&gt;
    call DVD_GetNextDrive         ;call function&lt;br /&gt;
    pop $0                        ;pop output from stack&lt;br /&gt;
&lt;br /&gt;
    push $0                       ;push input to stack&lt;br /&gt;
    call DVD_GetLabel             ;call function&lt;br /&gt;
    pop $1                        ;pop output from stack&lt;br /&gt;
&lt;br /&gt;
    call DVD_Unload               ;unload from memory&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  DVD_GetNextDrive : Finds the first/next CD/DVD-ROM drive and returns its full path on the stack.&lt;br /&gt;
&lt;br /&gt;
             input : The function will search for the first CD/DVD drive AFTER this specified&lt;br /&gt;
                     drive letter. So with input &amp;quot;C:\&amp;quot; the function will start searching at D:\.&lt;br /&gt;
                     Only the first character of the input is used, so it should be a Capital&lt;br /&gt;
                     letter from A to Z.&lt;br /&gt;
                     If the input does not start with A-Z, the function returns an empty string&lt;br /&gt;
                     (&amp;quot;&amp;quot;) on the stack.&lt;br /&gt;
                     If the input is empty, the function starts scanning at A:\.&lt;br /&gt;
                     If the function reaches Z:\, it will continue searching at A:\.&lt;br /&gt;
            output : The full path of the first CD/DVD-ROM drive the function found, for example&lt;br /&gt;
                     &amp;quot;E:\&amp;quot;.&lt;br /&gt;
                     If the function could not find any CD/DVD-ROM drive after (and before) the&lt;br /&gt;
                     specified input drive, it will return an empty string (&amp;quot;&amp;quot;) on the stack.&lt;br /&gt;
                     If Windows could not find any drives at all (either CD-ROM or otherwise),&lt;br /&gt;
                     the function returns &amp;quot;ERROR&amp;quot;. This should never happen.&lt;br /&gt;
&lt;br /&gt;
  DVD_GetLabel     : Returns the label of the CD/DVD currently in the specified drive on the stack.&lt;br /&gt;
&lt;br /&gt;
             input : The full path to the root of the CD/DVD-ROM drive, so for example &amp;quot;E:\&amp;quot;.&lt;br /&gt;
            output : The full volume label of the disc in the drive. If there is no disc in the&lt;br /&gt;
                     drive, or there is some other error, the function will return&lt;br /&gt;
                     &amp;quot;DVDGetLabel_error&amp;quot; on the stack.&lt;br /&gt;
&lt;br /&gt;
  DVD_CheckDrive   : Checks if the specified drive  is a CD/DVD-ROM drive.&lt;br /&gt;
&lt;br /&gt;
             input : The full path to the root of the CD/DVD-ROM drive, so for example &amp;quot;E:\&amp;quot;.&lt;br /&gt;
            output : If the drive is a CD/DVD-ROM drive, the function will return &amp;quot;CDROM&amp;quot; on the&lt;br /&gt;
                     stack. (For other possible outputs, see the function code.)&lt;br /&gt;
&lt;br /&gt;
  DVD_Unload       : Unloads dlls used in other DVD functions. Call this function from .onGUIEnd&lt;br /&gt;
                     to prevent .dll files from remaining in the user&#039;s temp folder. No input or&lt;br /&gt;
                     output.&lt;br /&gt;
*/&lt;br /&gt;
&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
== The Functions ==&lt;br /&gt;
&amp;lt;highlight-nsis&amp;gt;&lt;br /&gt;
Function DVD_GetNextDrive&lt;br /&gt;
  Exch $R1&lt;br /&gt;
  Push $R0&lt;br /&gt;
  Push $R2&lt;br /&gt;
  Push $R3&lt;br /&gt;
  Push $R4&lt;br /&gt;
&lt;br /&gt;
  ;get all drives (return to $R0, bitwise)&lt;br /&gt;
  System::Call /NOUNLOAD &#039;kernel32::GetLogicalDrives() i .r10&#039;&lt;br /&gt;
  StrCmp $R0 &amp;quot;0&amp;quot; 0 +3        ;if no drives found, error&lt;br /&gt;
    StrCpy $R1 &amp;quot;ERROR&amp;quot;&lt;br /&gt;
    goto break&lt;br /&gt;
&lt;br /&gt;
  ;If no parameter was supplied at all, assume we&#039;re starting at A:\.&lt;br /&gt;
  StrCmp $R1 &amp;quot;&amp;quot; 0 +4&lt;br /&gt;
    StrCpy $R1 &amp;quot;0&amp;quot;&lt;br /&gt;
    StrCpy $R4 &amp;quot;0&amp;quot;&lt;br /&gt;
    goto loop&lt;br /&gt;
  &lt;br /&gt;
  ;get ascii-number of first char in function parameter&lt;br /&gt;
  System::Call /NOUNLOAD &amp;quot;*(&amp;amp;t1 r11)i.r12&amp;quot;&lt;br /&gt;
  System::Call /NOUNLOAD &amp;quot;*$R2(&amp;amp;i1 .r11)&amp;quot;&lt;br /&gt;
  System::Free /NOUNLOAD $R2&lt;br /&gt;
  IntOp $R1 $R1 - 65&lt;br /&gt;
&lt;br /&gt;
  ;check if parameter driveletter is between A and Z&lt;br /&gt;
  IntCmp $R1 0 0 +2&lt;br /&gt;
  IntCmp $R1 25 +3 +3&lt;br /&gt;
    StrCpy $R1 &amp;quot;&amp;quot;&lt;br /&gt;
    goto break&lt;br /&gt;
  &lt;br /&gt;
  ;backup the (asciiconverted) starting driveletter, for detecting when we&#039;ve cycled the entire alphabet.&lt;br /&gt;
  StrCpy $R4 $R1&lt;br /&gt;
&lt;br /&gt;
  ;If a valid parameter was supplied (ie we had a parameter and we survived so far), start at the driveletter directly after the supplied starting driveletter&lt;br /&gt;
  IntOp $R1 $R1 + 1&lt;br /&gt;
  StrCmp $R1 26 0 +2         ;if &amp;gt;Z&lt;br /&gt;
    StrCpy $R1 0             ;  return to A&lt;br /&gt;
&lt;br /&gt;
  loop:&lt;br /&gt;
    IntOp $R2 0x01 &amp;lt;&amp;lt; $R1&lt;br /&gt;
    IntOp $R3 $R2 &amp;amp; $R0&lt;br /&gt;
    ;if (0x01&amp;lt;&amp;lt;driveletter &amp;amp; drivesfound) == 0x01&amp;lt;&amp;lt;driveletter  (in other words, if there is a drive mounted at this driveletter)&lt;br /&gt;
    StrCmp $R3 $R2 0 NoDriveHere&lt;br /&gt;
      ;convert asciinumber of driveletter to character&lt;br /&gt;
      IntOp $R2 $R1 + 65&lt;br /&gt;
      IntFmt $R2 %c $R2&lt;br /&gt;
      ;get type of drive&lt;br /&gt;
      System::Call /NOUNLOAD &#039;kernel32::GetDriveType(t &amp;quot;$R2:\&amp;quot;) i .r13&#039;&lt;br /&gt;
      StrCmp $R3 5 0 NoDriveHere&lt;br /&gt;
        ;type is CDROM&lt;br /&gt;
        StrCmp $R1 $R4 0 +3      ;if we&#039;ve cycled the entire alphabet (we ended up at the drive specified in the starting paramater)&lt;br /&gt;
          StrCpy $R1 &amp;quot;&amp;quot;          ;  no more CDROM drives found&lt;br /&gt;
          goto break&lt;br /&gt;
        StrCpy $R1 &amp;quot;$R2:\&amp;quot;       ;else: next CDROM drive found&lt;br /&gt;
        goto break&lt;br /&gt;
    NoDriveHere:&lt;br /&gt;
    StrCmp $R1 $R4 0 +3      ;if we&#039;ve cycled the entire alphabet&lt;br /&gt;
      StrCpy $R1 &amp;quot;&amp;quot;          ;  no CDROM drive found&lt;br /&gt;
      goto break&lt;br /&gt;
    IntOp $R1 $R1 + 1        ;increment driveletter&lt;br /&gt;
    StrCmp $R1 26 0 +2       ;if &amp;gt;Z&lt;br /&gt;
      StrCpy $R1 0           ;  return to A&lt;br /&gt;
    goto loop&lt;br /&gt;
  break:&lt;br /&gt;
&lt;br /&gt;
  Pop $R4&lt;br /&gt;
  Pop $R3&lt;br /&gt;
  Pop $R2&lt;br /&gt;
  Pop $R0&lt;br /&gt;
  Exch $R1&lt;br /&gt;
FunctionEnd&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Function DVD_GetLabel&lt;br /&gt;
  Exch $R0&lt;br /&gt;
  Push $R1&lt;br /&gt;
  Push $R2&lt;br /&gt;
&lt;br /&gt;
  ;leave function if no parameter was supplied&lt;br /&gt;
  StrCmp $R0 &amp;quot;&amp;quot; break&lt;br /&gt;
&lt;br /&gt;
  ;get the label of the drive (return to $R1)&lt;br /&gt;
  System::Call /NOUNLOAD &#039;Kernel32::GetVolumeInformation(t r10,t.r11,i ${NSIS_MAX_STRLEN},*i,*i,*i,t.r12,i ${NSIS_MAX_STRLEN})i.r10&#039;&lt;br /&gt;
  StrCmp $R0 0 0 +3&lt;br /&gt;
    StrCpy $R0 &amp;quot;DVDGetLabel_error&amp;quot;&lt;br /&gt;
    goto +2&lt;br /&gt;
  StrCpy $R0 $R1&lt;br /&gt;
  break:&lt;br /&gt;
&lt;br /&gt;
  Pop $R2&lt;br /&gt;
  Pop $R1&lt;br /&gt;
  Exch $R0&lt;br /&gt;
FunctionEnd&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Function DVD_CheckDrive&lt;br /&gt;
  Exch $R0&lt;br /&gt;
  Push $R1&lt;br /&gt;
  System::Call /NOUNLOAD &#039;kernel32::GetDriveType(t &amp;quot;$R0&amp;quot;) i .r11&#039;&lt;br /&gt;
  StrCmp $R1 0 0 +2&lt;br /&gt;
  StrCpy $R0 &amp;quot;UNKNOWN&amp;quot;&lt;br /&gt;
  StrCmp $R1 1 0 +2&lt;br /&gt;
  StrCpy $R0 &amp;quot;INVALID&amp;quot;&lt;br /&gt;
  StrCmp $R1 2 0 +2&lt;br /&gt;
  StrCpy $R0 &amp;quot;REMOVABLE&amp;quot;&lt;br /&gt;
  StrCmp $R1 3 0 +2&lt;br /&gt;
  StrCpy $R0 &amp;quot;FIXED&amp;quot;&lt;br /&gt;
  StrCmp $R1 4 0 +2&lt;br /&gt;
  StrCpy $R0 &amp;quot;REMOTE&amp;quot;&lt;br /&gt;
  StrCmp $R1 5 0 +2&lt;br /&gt;
  StrCpy $R0 &amp;quot;CDROM&amp;quot;&lt;br /&gt;
  StrCmp $R1 6 0 +2&lt;br /&gt;
  StrCpy $R0 &amp;quot;RAMDISK&amp;quot;&lt;br /&gt;
  Pop $R1&lt;br /&gt;
  Exch $R0&lt;br /&gt;
FunctionEnd&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Function DVD_Unload&lt;br /&gt;
  Push $R0&lt;br /&gt;
  System::Call &#039;kernel32::GetLogicalDrives() i .r10 ? u&#039;&lt;br /&gt;
  Pop $R0&lt;br /&gt;
FunctionEnd&lt;br /&gt;
&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:System Related Functions]]&lt;/div&gt;</summary>
		<author><name>Message</name></author>
	</entry>
	<entry>
		<id>https://nsis.sourceforge.io/mediawiki/index.php?title=CDRom_plug-in&amp;diff=15881</id>
		<title>CDRom plug-in</title>
		<link rel="alternate" type="text/html" href="https://nsis.sourceforge.io/mediawiki/index.php?title=CDRom_plug-in&amp;diff=15881"/>
		<updated>2008-07-26T00:40:03Z</updated>

		<summary type="html">&lt;p&gt;Message: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{PageAuthor|Instructor}}&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
&lt;br /&gt;
The CD-Rom plugin provides basic functions for finding and interacting with CD-ROM drives. Note: This plugin is not able to read data from DVDs (see [[DVD functions]]).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Features:&#039;&#039;&#039;&lt;br /&gt;
*Open/Close CD-ROM door&lt;br /&gt;
*Get CD-ROM status (ready, not ready)&lt;br /&gt;
*Get CD-ROM information (volume name, volume serial number)&lt;br /&gt;
*Find all CD-ROMs in the system (based on [[Enumerate_CD-ROM_Drives]] plugin)&lt;br /&gt;
&lt;br /&gt;
== Links ==&lt;br /&gt;
&lt;br /&gt;
Download v1.0:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;attach&amp;gt;Cdrom.zip&amp;lt;/attach&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Plugins]]&lt;/div&gt;</summary>
		<author><name>Message</name></author>
	</entry>
	<entry>
		<id>https://nsis.sourceforge.io/mediawiki/index.php?title=DVD_functions&amp;diff=15880</id>
		<title>DVD functions</title>
		<link rel="alternate" type="text/html" href="https://nsis.sourceforge.io/mediawiki/index.php?title=DVD_functions&amp;diff=15880"/>
		<updated>2008-07-26T00:35:16Z</updated>

		<summary type="html">&lt;p&gt;Message: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{PageAuthor|Message}}&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
Because the [[CD-Rom plugin]] is unable to read any data from DVDs, these functions are meant as a replacement with two primary functions: Finding CD/DVD-ROM drives in the user&#039;s system and reading CD/DVD-ROM disc labels.&lt;br /&gt;
== How To Use ==&lt;br /&gt;
&amp;lt;highlight-nsis&amp;gt;/* --------------------------------&lt;br /&gt;
&lt;br /&gt;
  DVD functions - a replacement for the CD-ROM plugin for NSIS&lt;br /&gt;
    Created by Message, 2007&lt;br /&gt;
&lt;br /&gt;
  Usage example:&lt;br /&gt;
    push &amp;quot;&amp;quot;                       ;push input to stack&lt;br /&gt;
    call DVD_GetNextDrive         ;call function&lt;br /&gt;
    pop $0                        ;pop output from stack&lt;br /&gt;
&lt;br /&gt;
    push $0                       ;push input to stack&lt;br /&gt;
    call DVD_GetLabel             ;call function&lt;br /&gt;
    pop $1                        ;pop output from stack&lt;br /&gt;
&lt;br /&gt;
    call DVD_Unload               ;unload from memory&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  DVD_GetNextDrive : Finds the first/next CD/DVD-ROM drive and returns its full path on the stack.&lt;br /&gt;
&lt;br /&gt;
             input : The function will search for the first CD/DVD drive AFTER this specified&lt;br /&gt;
                     drive letter. So with input &amp;quot;C:\&amp;quot; the function will start searching at D:\.&lt;br /&gt;
                     Only the first character of the input is used, so it should be a Capital&lt;br /&gt;
                     letter from A to Z.&lt;br /&gt;
                     If the input does not start with A-Z, the function returns an empty string&lt;br /&gt;
                     (&amp;quot;&amp;quot;) on the stack.&lt;br /&gt;
                     If the input is empty, the function starts scanning at A:\.&lt;br /&gt;
                     If the function reaches Z:\, it will continue searching at A:\.&lt;br /&gt;
            output : The full path of the first CD/DVD-ROM drive the function found, for example&lt;br /&gt;
                     &amp;quot;E:\&amp;quot;.&lt;br /&gt;
                     If the function could not find any CD/DVD-ROM drive after (and before) the&lt;br /&gt;
                     specified input drive, it will return an empty string (&amp;quot;&amp;quot;) on the stack.&lt;br /&gt;
                     If Windows could not find any drives at all (either CD-ROM or otherwise),&lt;br /&gt;
                     the function returns &amp;quot;ERROR&amp;quot;. This should never happen.&lt;br /&gt;
&lt;br /&gt;
  DVD_GetLabel     : Returns the label of the CD/DVD currently in the specified drive on the stack.&lt;br /&gt;
&lt;br /&gt;
             input : The full path to the root of the CD/DVD-ROM drive, so for example &amp;quot;E:\&amp;quot;.&lt;br /&gt;
            output : The full volume label of the disc in the drive. If there is no disc in the&lt;br /&gt;
                     drive, or there is some other error, the function will return&lt;br /&gt;
                     &amp;quot;DVDGetLabel_error&amp;quot; on the stack.&lt;br /&gt;
&lt;br /&gt;
  DVD_CheckDrive   : Checks if the specified drive  is a CD/DVD-ROM drive.&lt;br /&gt;
&lt;br /&gt;
             input : The full path to the root of the CD/DVD-ROM drive, so for example &amp;quot;E:\&amp;quot;.&lt;br /&gt;
            output : If the drive is a CD/DVD-ROM drive, the function will return &amp;quot;CDROM&amp;quot; on the&lt;br /&gt;
                     stack. (For other possible outputs, see the function code.)&lt;br /&gt;
&lt;br /&gt;
  DVD_Unload       : Unloads dlls used in other DVD functions. Call this function from .onGUIEnd&lt;br /&gt;
                     to prevent .dll files from remaining in the user&#039;s temp folder. No input or&lt;br /&gt;
                     output.&lt;br /&gt;
*/&lt;br /&gt;
&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
== The Functions ==&lt;br /&gt;
&amp;lt;highlight-nsis&amp;gt;&lt;br /&gt;
Function DVD_GetNextDrive&lt;br /&gt;
  Exch $R1&lt;br /&gt;
  Push $R0&lt;br /&gt;
  Push $R2&lt;br /&gt;
  Push $R3&lt;br /&gt;
  Push $R4&lt;br /&gt;
&lt;br /&gt;
  ;get all drives (return to $R0, bitwise)&lt;br /&gt;
  System::Call /NOUNLOAD &#039;kernel32::GetLogicalDrives() i .r10&#039;&lt;br /&gt;
  StrCmp $R0 &amp;quot;0&amp;quot; 0 +3        ;if no drives found, error&lt;br /&gt;
    StrCpy $R1 &amp;quot;ERROR&amp;quot;&lt;br /&gt;
    goto break&lt;br /&gt;
&lt;br /&gt;
  ;If no parameter was supplied at all, assume we&#039;re starting at A:\.&lt;br /&gt;
  StrCmp $R1 &amp;quot;&amp;quot; 0 +4&lt;br /&gt;
    StrCpy $R1 &amp;quot;0&amp;quot;&lt;br /&gt;
    StrCpy $R4 &amp;quot;0&amp;quot;&lt;br /&gt;
    goto loop&lt;br /&gt;
  &lt;br /&gt;
  ;get ascii-number of first char in function parameter&lt;br /&gt;
  System::Call /NOUNLOAD &amp;quot;*(&amp;amp;t1 r11)i.r12&amp;quot;&lt;br /&gt;
  System::Call /NOUNLOAD &amp;quot;*$R2(&amp;amp;i1 .r11)&amp;quot;&lt;br /&gt;
  System::Free /NOUNLOAD $R2&lt;br /&gt;
  IntOp $R1 $R1 - 65&lt;br /&gt;
&lt;br /&gt;
  ;check if parameter driveletter is between A and Z&lt;br /&gt;
  IntCmp $R1 0 0 +2&lt;br /&gt;
  IntCmp $R1 25 +3 +3&lt;br /&gt;
    StrCpy $R1 &amp;quot;&amp;quot;&lt;br /&gt;
    goto break&lt;br /&gt;
  &lt;br /&gt;
  ;backup the (asciiconverted) starting driveletter, for detecting when we&#039;ve cycled the entire alphabet.&lt;br /&gt;
  StrCpy $R4 $R1&lt;br /&gt;
&lt;br /&gt;
  ;If a valid parameter was supplied (ie we had a parameter and we survived so far), start at the driveletter directly after the supplied starting driveletter&lt;br /&gt;
  IntOp $R1 $R1 + 1&lt;br /&gt;
  StrCmp $R1 26 0 +2         ;if &amp;gt;Z&lt;br /&gt;
    StrCpy $R1 0             ;  return to A&lt;br /&gt;
&lt;br /&gt;
  loop:&lt;br /&gt;
    IntOp $R2 0x01 &amp;lt;&amp;lt; $R1&lt;br /&gt;
    IntOp $R3 $R2 &amp;amp; $R0&lt;br /&gt;
    ;if (0x01&amp;lt;&amp;lt;driveletter &amp;amp; drivesfound) == 0x01&amp;lt;&amp;lt;driveletter  (in other words, if there is a drive mounted at this driveletter)&lt;br /&gt;
    StrCmp $R3 $R2 0 NoDriveHere&lt;br /&gt;
      ;convert asciinumber of driveletter to character&lt;br /&gt;
      IntOp $R2 $R1 + 65&lt;br /&gt;
      IntFmt $R2 %c $R2&lt;br /&gt;
      ;get type of drive&lt;br /&gt;
      System::Call /NOUNLOAD &#039;kernel32::GetDriveType(t &amp;quot;$R2:\&amp;quot;) i .r13&#039;&lt;br /&gt;
      StrCmp $R3 5 0 NoDriveHere&lt;br /&gt;
        ;type is CDROM&lt;br /&gt;
        StrCmp $R1 $R4 0 +3      ;if we&#039;ve cycled the entire alphabet (we ended up at the drive specified in the starting paramater)&lt;br /&gt;
          StrCpy $R1 &amp;quot;&amp;quot;          ;  no more CDROM drives found&lt;br /&gt;
          goto break&lt;br /&gt;
        StrCpy $R1 &amp;quot;$R2:\&amp;quot;       ;else: next CDROM drive found&lt;br /&gt;
        goto break&lt;br /&gt;
    NoDriveHere:&lt;br /&gt;
    StrCmp $R1 $R4 0 +3      ;if we&#039;ve cycled the entire alphabet&lt;br /&gt;
      StrCpy $R1 &amp;quot;&amp;quot;          ;  no CDROM drive found&lt;br /&gt;
      goto break&lt;br /&gt;
    IntOp $R1 $R1 + 1        ;increment driveletter&lt;br /&gt;
    StrCmp $R1 26 0 +2       ;if &amp;gt;Z&lt;br /&gt;
      StrCpy $R1 0           ;  return to A&lt;br /&gt;
    goto loop&lt;br /&gt;
  break:&lt;br /&gt;
&lt;br /&gt;
  Pop $R4&lt;br /&gt;
  Pop $R3&lt;br /&gt;
  Pop $R2&lt;br /&gt;
  Pop $R0&lt;br /&gt;
  Exch $R1&lt;br /&gt;
FunctionEnd&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Function DVD_GetLabel&lt;br /&gt;
  Exch $R0&lt;br /&gt;
  Push $R1&lt;br /&gt;
  Push $R2&lt;br /&gt;
&lt;br /&gt;
  ;leave function if no parameter was supplied&lt;br /&gt;
  StrCmp $R0 &amp;quot;&amp;quot; break&lt;br /&gt;
&lt;br /&gt;
  ;get the label of the drive (return to $R1)&lt;br /&gt;
  System::Call /NOUNLOAD &#039;Kernel32::GetVolumeInformation(t r10,t.r11,i ${NSIS_MAX_STRLEN},*i,*i,*i,t.r12,i ${NSIS_MAX_STRLEN})i.r10&#039;&lt;br /&gt;
  StrCmp $R0 0 0 +3&lt;br /&gt;
    StrCpy $R0 &amp;quot;DVDGetLabel_error&amp;quot;&lt;br /&gt;
    goto +2&lt;br /&gt;
  StrCpy $R0 $R1&lt;br /&gt;
  break:&lt;br /&gt;
&lt;br /&gt;
  Pop $R2&lt;br /&gt;
  Pop $R1&lt;br /&gt;
  Exch $R0&lt;br /&gt;
FunctionEnd&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Function DVD_CheckDrive&lt;br /&gt;
  Exch $R0&lt;br /&gt;
  Push $R1&lt;br /&gt;
  System::Call /NOUNLOAD &#039;kernel32::GetDriveType(t &amp;quot;$R0&amp;quot;) i .r11&#039;&lt;br /&gt;
  StrCmp $R1 0 0 +2&lt;br /&gt;
  StrCpy $R0 &amp;quot;UNKNOWN&amp;quot;&lt;br /&gt;
  StrCmp $R1 1 0 +2&lt;br /&gt;
  StrCpy $R0 &amp;quot;INVALID&amp;quot;&lt;br /&gt;
  StrCmp $R1 2 0 +2&lt;br /&gt;
  StrCpy $R0 &amp;quot;REMOVABLE&amp;quot;&lt;br /&gt;
  StrCmp $R1 3 0 +2&lt;br /&gt;
  StrCpy $R0 &amp;quot;FIXED&amp;quot;&lt;br /&gt;
  StrCmp $R1 4 0 +2&lt;br /&gt;
  StrCpy $R0 &amp;quot;REMOTE&amp;quot;&lt;br /&gt;
  StrCmp $R1 5 0 +2&lt;br /&gt;
  StrCpy $R0 &amp;quot;CDROM&amp;quot;&lt;br /&gt;
  StrCmp $R1 6 0 +2&lt;br /&gt;
  StrCpy $R0 &amp;quot;RAMDISK&amp;quot;&lt;br /&gt;
  Pop $R1&lt;br /&gt;
  Exch $R0&lt;br /&gt;
FunctionEnd&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Function DVD_Unload&lt;br /&gt;
  Push $R0&lt;br /&gt;
  System::Call &#039;kernel32::GetLogicalDrives() i .r10 ? u&#039;&lt;br /&gt;
  Pop $R0&lt;br /&gt;
FunctionEnd&lt;br /&gt;
&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:System Related Functions]]&lt;/div&gt;</summary>
		<author><name>Message</name></author>
	</entry>
	<entry>
		<id>https://nsis.sourceforge.io/mediawiki/index.php?title=DVD_functions&amp;diff=15877</id>
		<title>DVD functions</title>
		<link rel="alternate" type="text/html" href="https://nsis.sourceforge.io/mediawiki/index.php?title=DVD_functions&amp;diff=15877"/>
		<updated>2008-07-26T00:26:37Z</updated>

		<summary type="html">&lt;p&gt;Message: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{PageAuthor|Message}}&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
Because the [[CD-Rom plugin]] is unable to read any data from DVDs, these functions are meant as a replacement with two primary functions: Finding CD/DVD-ROM drives in the user&#039;s system and reading CD/DVD-ROM disc labels.&lt;br /&gt;
== How To Use ==&lt;br /&gt;
&amp;lt;highlight-nsis&amp;gt;/* --------------------------------&lt;br /&gt;
&lt;br /&gt;
  DVD functions - a replacement for the CD-ROM plugin for NSIS&lt;br /&gt;
    Created by Message, 2007&lt;br /&gt;
&lt;br /&gt;
  Usage example:&lt;br /&gt;
    push &amp;quot;&amp;quot;                       ;push input to stack&lt;br /&gt;
    call DVD_GetNextDrive         ;call function&lt;br /&gt;
    pop $0                        ;pop output from stack&lt;br /&gt;
&lt;br /&gt;
    push $0                       ;push input to stack&lt;br /&gt;
    call DVD_GetLabel             ;call function&lt;br /&gt;
    pop $1                        ;pop output from stack&lt;br /&gt;
&lt;br /&gt;
    call DVD_Unload               ;unload from memory&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  DVD_GetNextDrive : Finds the first/next CD/DVD-ROM drive and returns its full path on the stack.&lt;br /&gt;
&lt;br /&gt;
             input : The function will search for the first CD/DVD drive AFTER this specified&lt;br /&gt;
                     drive letter. So with input &amp;quot;C:\&amp;quot; the function will start searching at D:\.&lt;br /&gt;
                     Only the first character of the input is used, so it should be a Capital&lt;br /&gt;
                     letter from A to Z.&lt;br /&gt;
                     If the input does not start with A-Z, the function returns an empty string&lt;br /&gt;
                     (&amp;quot;&amp;quot;) on the stack.&lt;br /&gt;
                     If the input is empty, the function starts scanning at A:\.&lt;br /&gt;
                     If the function reaches Z:\, it will continue searching at A:\.&lt;br /&gt;
            output : The full path of the first CD/DVD-ROM drive the function found, for example&lt;br /&gt;
                     &amp;quot;E:\&amp;quot;.&lt;br /&gt;
                     If the function could not find any CD/DVD-ROM drive after (and before) the&lt;br /&gt;
                     specified input drive, it will return an empty string (&amp;quot;&amp;quot;) on the stack.&lt;br /&gt;
                     If Windows could not find any drives at all (either CD-ROM or otherwise),&lt;br /&gt;
                     the function returns &amp;quot;ERROR&amp;quot;. This should never happen.&lt;br /&gt;
&lt;br /&gt;
  DVD_GetLabel     : Returns the label of the CD/DVD currently in the specified drive on the stack.&lt;br /&gt;
&lt;br /&gt;
             input : The full path to the root of the CD/DVD-ROM drive, so for example &amp;quot;E:\&amp;quot;.&lt;br /&gt;
            output : The full volume label of the disc in the drive. If there is no disc in the&lt;br /&gt;
                     drive, or there is some other error, the function will return&lt;br /&gt;
                     &amp;quot;DVDGetLabel_error&amp;quot; on the stack.&lt;br /&gt;
&lt;br /&gt;
  DVD_CheckDrive   : Checks if the specified drive  is a CD/DVD-ROM drive.&lt;br /&gt;
&lt;br /&gt;
             input : The full path to the root of the CD/DVD-ROM drive, so for example &amp;quot;E:\&amp;quot;.&lt;br /&gt;
            output : If the drive is a CD/DVD-ROM drive, the function will return &amp;quot;CDROM&amp;quot; on the&lt;br /&gt;
                     stack. (For other possible outputs, see the function code.)&lt;br /&gt;
&lt;br /&gt;
  DVD_Unload       : Unloads dlls used in other DVD functions. Call this function from .onGUIEnd&lt;br /&gt;
                     to prevent .dll files from remaining in the user&#039;s temp folder. No input or&lt;br /&gt;
                     output.&lt;br /&gt;
*/&lt;br /&gt;
&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
== The Functions ==&lt;br /&gt;
&amp;lt;highlight-nsis&amp;gt;&lt;br /&gt;
Function DVD_CheckDrive&lt;br /&gt;
  Exch $R0&lt;br /&gt;
  Push $R1&lt;br /&gt;
  System::Call /NOUNLOAD &#039;kernel32::GetDriveType(t &amp;quot;$R0&amp;quot;) i .r11&#039;&lt;br /&gt;
  StrCmp $R1 0 0 +2&lt;br /&gt;
  StrCpy $R0 &amp;quot;UNKNOWN&amp;quot;&lt;br /&gt;
  StrCmp $R1 1 0 +2&lt;br /&gt;
  StrCpy $R0 &amp;quot;INVALID&amp;quot;&lt;br /&gt;
  StrCmp $R1 2 0 +2&lt;br /&gt;
  StrCpy $R0 &amp;quot;REMOVABLE&amp;quot;&lt;br /&gt;
  StrCmp $R1 3 0 +2&lt;br /&gt;
  StrCpy $R0 &amp;quot;FIXED&amp;quot;&lt;br /&gt;
  StrCmp $R1 4 0 +2&lt;br /&gt;
  StrCpy $R0 &amp;quot;REMOTE&amp;quot;&lt;br /&gt;
  StrCmp $R1 5 0 +2&lt;br /&gt;
  StrCpy $R0 &amp;quot;CDROM&amp;quot;&lt;br /&gt;
  StrCmp $R1 6 0 +2&lt;br /&gt;
  StrCpy $R0 &amp;quot;RAMDISK&amp;quot;&lt;br /&gt;
  Pop $R1&lt;br /&gt;
  Exch $R0&lt;br /&gt;
FunctionEnd&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Function DVD_Unload&lt;br /&gt;
  Push $R0&lt;br /&gt;
  System::Call &#039;kernel32::GetLogicalDrives() i .r10 ? u&#039;&lt;br /&gt;
  Pop $R0&lt;br /&gt;
FunctionEnd&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Function DVD_GetLabel&lt;br /&gt;
  Exch $R0&lt;br /&gt;
  Push $R1&lt;br /&gt;
  Push $R2&lt;br /&gt;
&lt;br /&gt;
  ;leave function if no parameter was supplied&lt;br /&gt;
  StrCmp $R0 &amp;quot;&amp;quot; break&lt;br /&gt;
&lt;br /&gt;
  ;get the label of the drive (return to $R1)&lt;br /&gt;
  System::Call /NOUNLOAD &#039;Kernel32::GetVolumeInformation(t r10,t.r11,i ${NSIS_MAX_STRLEN},*i,*i,*i,t.r12,i ${NSIS_MAX_STRLEN})i.r10&#039;&lt;br /&gt;
  StrCmp $R0 0 0 +3&lt;br /&gt;
    StrCpy $R0 &amp;quot;DVDGetLabel_error&amp;quot;&lt;br /&gt;
    goto +2&lt;br /&gt;
  StrCpy $R0 $R1&lt;br /&gt;
  break:&lt;br /&gt;
&lt;br /&gt;
  Pop $R2&lt;br /&gt;
  Pop $R1&lt;br /&gt;
  Exch $R0&lt;br /&gt;
FunctionEnd&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Function DVD_GetNextDrive&lt;br /&gt;
  Exch $R1&lt;br /&gt;
  Push $R0&lt;br /&gt;
  Push $R2&lt;br /&gt;
  Push $R3&lt;br /&gt;
  Push $R4&lt;br /&gt;
&lt;br /&gt;
  ;get all drives (return to $R0, bitwise)&lt;br /&gt;
  System::Call /NOUNLOAD &#039;kernel32::GetLogicalDrives() i .r10&#039;&lt;br /&gt;
  StrCmp $R0 &amp;quot;0&amp;quot; 0 +3        ;if no drives found, error&lt;br /&gt;
    StrCpy $R1 &amp;quot;ERROR&amp;quot;&lt;br /&gt;
    goto break&lt;br /&gt;
&lt;br /&gt;
  ;If no parameter was supplied at all, assume we&#039;re starting at A:\.&lt;br /&gt;
  StrCmp $R1 &amp;quot;&amp;quot; 0 +4&lt;br /&gt;
    StrCpy $R1 &amp;quot;0&amp;quot;&lt;br /&gt;
    StrCpy $R4 &amp;quot;0&amp;quot;&lt;br /&gt;
    goto loop&lt;br /&gt;
  &lt;br /&gt;
  ;get ascii-number of first char in function parameter&lt;br /&gt;
  System::Call /NOUNLOAD &amp;quot;*(&amp;amp;t1 r11)i.r12&amp;quot;&lt;br /&gt;
  System::Call /NOUNLOAD &amp;quot;*$R2(&amp;amp;i1 .r11)&amp;quot;&lt;br /&gt;
  System::Free /NOUNLOAD $R2&lt;br /&gt;
  IntOp $R1 $R1 - 65&lt;br /&gt;
&lt;br /&gt;
  ;check if parameter driveletter is between A and Z&lt;br /&gt;
  IntCmp $R1 0 0 +2&lt;br /&gt;
  IntCmp $R1 25 +3 +3&lt;br /&gt;
    StrCpy $R1 &amp;quot;&amp;quot;&lt;br /&gt;
    goto break&lt;br /&gt;
  &lt;br /&gt;
  ;backup the (asciiconverted) starting driveletter, for detecting when we&#039;ve cycled the entire alphabet.&lt;br /&gt;
  StrCpy $R4 $R1&lt;br /&gt;
&lt;br /&gt;
  ;If a valid parameter was supplied (ie we had a parameter and we survived so far), start at the driveletter directly after the supplied starting driveletter&lt;br /&gt;
  IntOp $R1 $R1 + 1&lt;br /&gt;
  StrCmp $R1 26 0 +2         ;if &amp;gt;Z&lt;br /&gt;
    StrCpy $R1 0             ;  return to A&lt;br /&gt;
&lt;br /&gt;
  loop:&lt;br /&gt;
    IntOp $R2 0x01 &amp;lt;&amp;lt; $R1&lt;br /&gt;
    IntOp $R3 $R2 &amp;amp; $R0&lt;br /&gt;
    ;if (0x01&amp;lt;&amp;lt;driveletter &amp;amp; drivesfound) == 0x01&amp;lt;&amp;lt;driveletter  (in other words, if there is a drive mounted at this driveletter)&lt;br /&gt;
    StrCmp $R3 $R2 0 NoDriveHere&lt;br /&gt;
      ;convert asciinumber of driveletter to character&lt;br /&gt;
      IntOp $R2 $R1 + 65&lt;br /&gt;
      IntFmt $R2 %c $R2&lt;br /&gt;
      ;get type of drive&lt;br /&gt;
      System::Call /NOUNLOAD &#039;kernel32::GetDriveType(t &amp;quot;$R2:\&amp;quot;) i .r13&#039;&lt;br /&gt;
      StrCmp $R3 5 0 NoDriveHere&lt;br /&gt;
        ;type is CDROM&lt;br /&gt;
        StrCmp $R1 $R4 0 +3      ;if we&#039;ve cycled the entire alphabet (we ended up at the drive specified in the starting paramater)&lt;br /&gt;
          StrCpy $R1 &amp;quot;&amp;quot;          ;  no more CDROM drives found&lt;br /&gt;
          goto break&lt;br /&gt;
        StrCpy $R1 &amp;quot;$R2:\&amp;quot;       ;else: next CDROM drive found&lt;br /&gt;
        goto break&lt;br /&gt;
    NoDriveHere:&lt;br /&gt;
    StrCmp $R1 $R4 0 +3      ;if we&#039;ve cycled the entire alphabet&lt;br /&gt;
      StrCpy $R1 &amp;quot;&amp;quot;          ;  no CDROM drive found&lt;br /&gt;
      goto break&lt;br /&gt;
    IntOp $R1 $R1 + 1        ;increment driveletter&lt;br /&gt;
    StrCmp $R1 26 0 +2       ;if &amp;gt;Z&lt;br /&gt;
      StrCpy $R1 0           ;  return to A&lt;br /&gt;
    goto loop&lt;br /&gt;
  break:&lt;br /&gt;
&lt;br /&gt;
  Pop $R4&lt;br /&gt;
  Pop $R3&lt;br /&gt;
  Pop $R2&lt;br /&gt;
  Pop $R0&lt;br /&gt;
  Exch $R1&lt;br /&gt;
FunctionEnd&lt;br /&gt;
&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:System Related Functions]]&lt;/div&gt;</summary>
		<author><name>Message</name></author>
	</entry>
</feed>