<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Серый форум &mdash; AHK: Получить порядковый номер жесткого диска или флешки]]></title>
	<link rel="self" href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=13121&amp;type=atom" />
	<updated>2017-10-24T19:51:19Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.script-coding.com/viewtopic.php?id=13121</id>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Получить порядковый номер жесткого диска или флешки]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=120394#p120394" />
			<content type="html"><![CDATA[<p>А это что б ниХто не догадался! <img src="//forum.script-coding.com/img/smilies/smile.png" width="15" height="15" /> Я на АНБ работаю ...</p>]]></content>
			<author>
				<name><![CDATA[freeZer0K]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=34228</uri>
			</author>
			<updated>2017-10-24T19:51:19Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=120394#p120394</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Получить порядковый номер жесткого диска или флешки]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=120393#p120393" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>freeZer0K пишет:</cite><blockquote><p>Нафига это нужно?</p></blockquote></div><p>А нафига нужно детектить hdd и флешки?</p>]]></content>
			<author>
				<name><![CDATA[Malcev]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26930</uri>
			</author>
			<updated>2017-10-24T19:41:46Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=120393#p120393</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Получить порядковый номер жесткого диска или флешки]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=120392#p120392" />
			<content type="html"><![CDATA[<p>А эти скрипты и не должны CD-rom детектить. Нафига это нужно? Они тока для hdd и флешек ...<br />Они даже разделы на одном диске не детектят, а только номера физических дисков показывают.</p>]]></content>
			<author>
				<name><![CDATA[freeZer0K]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=34228</uri>
			</author>
			<updated>2017-10-24T19:19:49Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=120392#p120392</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Получить порядковый номер жесткого диска или флешки]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=120389#p120389" />
			<content type="html"><![CDATA[<p><strong>teadrinker</strong>, твой скрипт у меня на 2 дисках выдает ошибку - DeviceIoControl failed. Error: 1.<br /><strong>freeZer0K</strong>, твой работет, но не определяет сидиром.<br />И у обоих скриптов есть недостаток - они определяют только один диск в зеркалке.</p>]]></content>
			<author>
				<name><![CDATA[Malcev]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26930</uri>
			</author>
			<updated>2017-10-24T18:18:51Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=120389#p120389</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Получить порядковый номер жесткого диска или флешки]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=120385#p120385" />
			<content type="html"><![CDATA[<p>... ну да, я и говорю ... просто выглядит короче <img src="//forum.script-coding.com/img/smilies/smile.png" width="15" height="15" /></p>]]></content>
			<author>
				<name><![CDATA[freeZer0K]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=34228</uri>
			</author>
			<updated>2017-10-24T16:38:43Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=120385#p120385</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Получить порядковый номер жесткого диска или флешки]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=120384#p120384" />
			<content type="html"><![CDATA[<p>Почему короче? Те же две функции, просто вместо понятных констант <a href="https://ru.wikipedia.org/wiki/%D0%9C%D0%B0%D0%B3%D0%B8%D1%87%D0%B5%D1%81%D0%BA%D0%BE%D0%B5_%D1%87%D0%B8%D1%81%D0%BB%D0%BE_(%D0%BF%D1%80%D0%BE%D0%B3%D1%80%D0%B0%D0%BC%D0%BC%D0%B8%D1%80%D0%BE%D0%B2%D0%B0%D0%BD%D0%B8%D0%B5)#.D0.9F.D0.BB.D0.BE.D1.85.D0.B0.D1.8F_.D0.BF.D1.80.D0.B0.D0.BA.D1.82.D0.B8.D0.BA.D0.B0_.D0.BF.D1.80.D0.BE.D0.B3.D1.80.D0.B0.D0.BC.D0.BC.D0.B8.D1.80.D0.BE.D0.B2.D0.B0.D0.BD.D0.B8.D1.8F">магические числа</a>. <img src="//forum.script-coding.com/img/smilies/smile.png" width="15" height="15" /></p>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2017-10-24T16:36:37Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=120384#p120384</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Получить порядковый номер жесткого диска или флешки]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=120383#p120383" />
			<content type="html"><![CDATA[<p><strong>teadrinker</strong>, круто, работает!</p><p>Почти такой-же вариант, тока покороче:</p><div class="codebox"><pre><code>USBdrvLtr := &quot;H:&quot;

Drv := &quot;\\.\&quot; USBdrvLtr

hVol := DllCall(&quot;CreateFile&quot;, Str, Drv, UInt,, UInt,, UInt,, UInt, 0x3)
VarSetCapacity(VDE, 1024)
If DllCall(&quot;DeviceIoControl&quot;, UInt, hVol, UInt, 0x560000, UInt,, UInt,, UInt, &amp;VDE, UInt, 1024, UIntP,, UInt, 0)

MsgBox % NumGet(VDE, 8)</code></pre></div>]]></content>
			<author>
				<name><![CDATA[freeZer0K]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=34228</uri>
			</author>
			<updated>2017-10-24T16:30:54Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=120383#p120383</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Получить порядковый номер жесткого диска или флешки]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=120380#p120380" />
			<content type="html"><![CDATA[<p>Так, вроде, работает:<br /></p><div class="codebox"><pre><code>MsgBox, % PhysicalDriveNumberFromLogicalDisk(&quot;C&quot;).driveNumber

PhysicalDriveNumberFromLogicalDisk(diskPath)  {
   static GENERIC_READ := 0x80000000, GENERIC_WRITE := 0x40000000
        , FILE_SHARE_READ := 1, FILE_SHARE_WRITE := 2, OPEN_EXISTING := 3
        , IOCTL_STORAGE_GET_DEVICE_NUMBER := 0x2D1080
        
   diskPath := &quot;\\.\&quot; . RegExReplace(diskPath, &quot;i).*([A-Z]).*&quot;, &quot;$1&quot;) . &quot;:&quot;
   hFile := DllCall(&quot;CreateFile&quot;, Str, diskPath, UInt, GENERIC_READ|GENERIC_WRITE
                                               , UInt, FILE_SHARE_READ|FILE_SHARE_WRITE
                                               , Ptr, 0, UInt, OPEN_EXISTING
                                               , UInt, 0, Ptr, 0, Ptr)
                                               
   VarSetCapacity(STORAGE_DEVICE_NUMBER, 12, 0)
   res := DllCall(&quot;DeviceIoControl&quot;, Ptr, hFile, UInt, IOCTL_STORAGE_GET_DEVICE_NUMBER
                                   , Ptr, 0, UInt, 0, Ptr, &amp;STORAGE_DEVICE_NUMBER
                                   , UInt, 12, UIntP, bites, Ptr, 0)
   if !res
      MsgBox, DeviceIoControl failed. Error: %A_LastError%
   DllCall(&quot;CloseHandle&quot;, Ptr, hFile)

   return res ? { driveNumber: NumGet(STORAGE_DEVICE_NUMBER, 4, &quot;UInt&quot;)
                , partitionNumber: NumGet(STORAGE_DEVICE_NUMBER, 8, &quot;UInt&quot;) } : &quot;&quot;
}</code></pre></div><p>Номер диска от 0.</p>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2017-10-24T16:10:26Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=120380#p120380</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Получить порядковый номер жесткого диска или флешки]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=120373#p120373" />
			<content type="html"><![CDATA[<p><strong>teadrinker</strong>, не, это не то ...</p><p>Счаз нарыл кое-что:</p><div class="codebox"><pre><code>for Drive in ComObjGet(&quot;winmgmts:&quot;).ExecQuery(&quot;SELECT Name, SerialNumber FROM Win32_DiskDrive&quot;)
out .=  Drive.Name . &quot;`n&quot;
MsgBox, % out</code></pre></div><p>Надо привязать к букве диска ....</p>]]></content>
			<author>
				<name><![CDATA[freeZer0K]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=34228</uri>
			</author>
			<updated>2017-10-24T13:18:21Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=120373#p120373</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Получить порядковый номер жесткого диска или флешки]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=120372#p120372" />
			<content type="html"><![CDATA[<div class="codebox"><pre><code>MyDisk := &quot;D&quot;
DriveGet, Disks, List
MsgBox, % Disks
MsgBox, % InStr(Disks, MyDisk)</code></pre></div>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2017-10-24T13:14:24Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=120372#p120372</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Получить порядковый номер жесткого диска или флешки]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=120371#p120371" />
			<content type="html"><![CDATA[<p><strong>teadrinker</strong>, не понял .... каким образом???</p>]]></content>
			<author>
				<name><![CDATA[freeZer0K]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=34228</uri>
			</author>
			<updated>2017-10-24T13:09:03Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=120371#p120371</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Получить порядковый номер жесткого диска или флешки]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=120370#p120370" />
			<content type="html"><![CDATA[<p>Разве нельзя получить через DriveGet все диски, и найти порядковый номер нужного?</p>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2017-10-24T12:57:38Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=120370#p120370</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[AHK: Получить порядковый номер жесткого диска или флешки]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=120369#p120369" />
			<content type="html"><![CDATA[<p>Добрый день всем!</p><p>Ничего внятного по теме найти не удалось. DriveGet не дает нужного результата.</p><p>Вопрос:<br />Как получить порядковый номер диска (НЕ серийный номер), если есть переменная с буквой диска?<br />Для понимания - в linux fstab это выглядит так: hd0,2</p><p>Нужна конструкция типа такой:</p><div class="codebox"><pre><code>DriveL := &quot;X:&quot;

If DriveL = &quot;X:&quot;
	{
	MsgBox % DriveN ; где DriveN - номер в виде цифры, напр. 0 или 1 ... и т.д.
	}
</code></pre></div><p>Буду благодарен за любую помощь!</p>]]></content>
			<author>
				<name><![CDATA[freeZer0K]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=34228</uri>
			</author>
			<updated>2017-10-24T12:35:47Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=120369#p120369</id>
		</entry>
</feed>
