﻿id	summary	reporter	owner	description	type	status	milestone	component	version	severity	resolution	keywords	cc
3850	_WinAPI_GetDriveNumber never returns -1 as partition number	AspirinJunkie	Jpm	"The documentation for _WinAPI_GetDriveNumber says: 
   [2] - The partition number, or (-1) if device cannot be partitioned.''

This is consistent with the description of the [https://docs.microsoft.com/en-us/windows/win32/api/winioctl/ns-winioctl-storage_device_number STORAGE_DEVICE_NUMBER structure].

However, the problem here is that the PartitionNumber part is of data type `DWORD` - i.e. an unsigned integer. A value of `-1` is therefore simply not possible.
In C this is not a big problem, because DWORDs can also be tested for `-1`:
{{{
#!c
(DWORD)4294967295 == -1 // true
}}}

In AutoIt, however, `4294967295` is always returned in the case of -1 due to the conversion to Int64:
{{{
#!autoit
#include <WinAPIFiles.au3>

Local $aData = _WinAPI_GetDriveNumber('d:') ; a non partionable drive like a cd-drive
ConsoleWrite('Partition number: ' & $aData[2] & @CRLF)
}}}


Therefore, as a pragmatic solution, I suggest to change the structure definition as follows, deviating from the Win API documentation:
{{{
#!autoit
Local $tSDN = DllStructCreate('dword;dword;LONG')
}}}"	Bug	closed	3.3.15.5	Standard UDFs	3.3.15.4	None	Fixed		
