Quote.386
.model flat, stdcall
option casemap :none
include \MASM32\INCLUDE\windows.inc
include \MASM32\INCLUDE\user32.inc
include \MASM32\INCLUDE\kernel32.inc
includelib \MASM32\LIB\user32.lib
includelib \MASM32\LIB\kernel32.lib
_DISK_EXTENT struct
DiskNumber DWORD ?
StartingOffset INT64 ?
ExtentLength INT64 ?
_DISK_EXTENT ends
_VOLUME_DISK_EXTENTS struct
NumberOfDiskExtents DWORD ?
Extents _DISK_EXTENT <>
_VOLUME_DISK_EXTENTS ends
.data
PhysicalDrive0 db '\\.\\PhysicalDrive0',0
NumberD db 'partition %u',0
form db "error: %u", 0
perenos db 13,10,0
.data?
buffer db 512 dup(?)
string db 1536 dup(?)
cw dd ?
data1 _VOLUME_DISK_EXTENTS <>
db 1024 dup (?)
.code
start:
;invoke GetProcessHeap
;mov edi, eax
;invoke HeapAlloc, eax, HEAP_ZERO_MEMORY, 1024
;mov esi, eax
invoke CreateFile,addr PhysicalDrive0,GENERIC_READ or GENERIC_WRITE,FILE_SHARE_READ OR FILE_SHARE_WRITE,0, OPEN_EXISTING,0,0
mov ebx, eax
;invoke DeviceIoControl, ebx, 560000,0,0,esi,1024, addr cw, 0 ;IOCTL_VOLUME_GET_VOLUME_DISK_EXTENTS,\
invoke DeviceIoControl, ebx, 560000,0,0,addr data1,sizeof data1, addr cw, 0
.if eax!=0
invoke wsprintf,ADDR buffer,addr NumberD, data1.NumberOfDiskExtents
.else
invoke GetLastError
invoke wsprintf,ADDR buffer,addr form, eax
.endif
invoke MessageBox,0,ADDR buffer,0,MB_ICONASTERISK
invoke CloseHandle, ebx
;invoke HeapFree, edi,1,esi
invoke ExitProcess,0
end start
(http://s019.radikal.ru/i622/1204/ae/4e5122eeb1b3.png)ERROR_INVALID_FUNCTION 1 (0x1)
http://reboot.pro/10854/ (http://smiles.kolobok.us/light_skin/suicide2.gif)
How declare array? ~ Extents _DISK_EXTENT 26 dup <>
the correct string for a opening the volume is
'\\.\PhysicalDrive0',0
(one less backslash) - although, that is probably ok
the value i get for IOCTL_VOLUME_GET_VOLUME_DISK_EXTENTS is
IOCTL_VOLUME_GET_VOLUME_DISK_EXTENTS EQU 5636096
if you download Japheth's wininc package, he has a macro that calculates these equates from the control code sequences
the disk extents array has a header, and any number of disk extent structures
http://msdn.microsoft.com/en-us/library/aa365727%28v=vs.85%29.aspx
http://msdn.microsoft.com/en-us/library/aa363968%28v=vs.85%29.aspx
i think, if your buffer is too small, you can make successive calls to get it in pieces :P
error1 (http://smiles.kolobok.us/standart/no2.gif)
Quote.386
.model flat, stdcall
option casemap :none
include \MASM32\INCLUDE\windows.inc
include \MASM32\INCLUDE\user32.inc
include \MASM32\INCLUDE\kernel32.inc
includelib \MASM32\LIB\user32.lib
includelib \MASM32\LIB\kernel32.lib
_DISK_EXTENT struct
DiskNumber DWORD ?
StartingOffset INT64 ?
ExtentLength INT64 ?
_DISK_EXTENT ends
_VOLUME_DISK_EXTENTS struct
NumberOfDiskExtents DWORD ?
Extents _DISK_EXTENT <>
_VOLUME_DISK_EXTENTS ends
.data
PhysicalDrive0 db '\\.\PhysicalDrive0',0
NumberD db 'partition %u',0
form db "error: %u", 0
perenos db 13,10,0
.data?
buffer db 512 dup(?)
string db 1536 dup(?)
cw dd ?
data1 _VOLUME_DISK_EXTENTS <>
db 1024 dup (?)
.code
start:
invoke GetProcessHeap
mov edi, eax
invoke HeapAlloc, eax, HEAP_ZERO_MEMORY, 1024
mov esi, eax
invoke CreateFile,addr PhysicalDrive0,GENERIC_READ or GENERIC_WRITE,FILE_SHARE_READ OR FILE_SHARE_WRITE,0, OPEN_EXISTING,0,0
mov ebx, eax
invoke DeviceIoControl, ebx, 5636096,0,0,esi,1024, addr cw, 0 ;IOCTL_VOLUME_GET_VOLUME_DISK_EXTENTS,\
;invoke DeviceIoControl, ebx, 5636096,0,0,addr data1,sizeof data1, addr cw, 0
.if eax!=0
invoke wsprintf,ADDR buffer,addr NumberD, data1.NumberOfDiskExtents
.else
invoke GetLastError
invoke wsprintf,ADDR buffer,addr form, eax
.endif
invoke MessageBox,0,ADDR buffer,0,MB_ICONASTERISK
invoke CloseHandle, ebx
invoke HeapFree, edi,1,esi
invoke ExitProcess,0
end start
ok
i changed the string to
PhysicalDrive0 db '\\.\C:',0
it may be that opening it as a device is not the same as opening it as a volume :P
we are using one of the "volume" functions
also
invoke DeviceIoControl, ebx, 5636096,0,0,addr data1,sizeof data1+1024, addr cw, 0
notice that i added the size of the 1 kb buffer to the size of the structure :U
(http://s2.ipicture.ru/uploads/20120404/1FhVZt2y.png)
I am trying to set Letter to USB disk under Win PE (Windows XP SP2) . How it (better) do?
Quote from: dedndave on April 05, 2012, 07:13:40 AM
ok
i changed the string to
PhysicalDrive0 db '\\.\C:',0
it may be that opening it as a device is not the same as opening it as a volume :P
we are using one of the "volume" functions
also
invoke DeviceIoControl, ebx, 5636096,0,0,addr data1,sizeof data1+1024, addr cw, 0
notice that i added the size of the 1 kb buffer to the size of the structure :U
(http://s019.radikal.ru/i644/1204/b9/c0c82e9706b9.png) (http://smiles.kolobok.us/standart/yes3.gif)
but I trying get ALL partitions on the HARDDISK
i use the disk management snap-in under admin tools, computer management :bg
well - step through the drive letters
PhysicalDrive0 db '\\.\C:',0
change the letter and call the function again
It's OK for the case when partitons on HD HAVE letters. But if not?
I makes a very little WinPE for USB1.1 flash, and need very small tools
if it doesn't have a letter, then it isn't a mounted volume
the IOCTL_VOLUME_GET_VOLUME_DISK_EXTENTS function only works for mounted volumes
It was wrong path for usb (http://smiles.kolobok.us/light_skin/girl_cray3.gif)
you might try IOCTL_STORAGE_GET_MEDIA_TYPES or IOCTL_STORAGE_GET_MEDIA_TYPES_EX
i remember playing with this about a year ago :P
OK (http://smiles.kolobok.us/light_skin/thank_you2.gif)
here is some code we were playing with
you will want to add USB as a device type and step through the drive letters...
(http://s019.radikal.ru/i633/1204/5c/c8043a8ae47a.png)
Hi
Here is a old code from me to detect a Usb Drive
http://www.winasm.net/forum/index.php?act=Attach&type=post&id=17752
WINPE.TURBOUSB.X.EXE (http://rghost.ru/37381917) 41,3 МБ (43 373 750 байт)
Realize good idea - windows load like linux do. I divided windows to kernel and file system. after kernel loading (7.6 mb only) filesystem copy to system disk with Native Mode Utils. This is for cases when under BIOS USB 1.1 only, and PLoP bootmanager don't help because it's works good only with Intel USB controller chips. But through Windows USB driver USB 2.0 full speed posible.
*without sata drivers
QuoteIOCTL_VOLUME_GET_VOLUME_DISK_EXTENTS EQU <CTL_CODE ( IOCTL_VOLUME_BASE , 0 , METHOD_BUFFERED , FILE_ANY_ACCESS )>
http://www.japheth.de/WinInc.html#widownload
(http://smiles.kolobok.us/light_skin/vava.gif)
Private Const IoctlVolumeGetVolumeDiskExtents As Integer = &H560000
http://jo0ls-dotnet-stuff.blogspot.com/2008/12/howto-get-physical-drive-string.html
This is what I used to use
CTL_CODE macro DeviceType, Function, Method, Access
exitm <((DeviceType) shl 16) OR ((Access) shl 14) OR ((Function) shl 2) OR (Method))>
endm
QuoteCTL_CODE macro DeviceType,Function,Method,Access
exitm <( ( ( DeviceType ) shl 16 ) or ( ( Access ) shl 14 ) or ( ( Function ) shl 2 ) or ( Method ) ) >
endm
FSCTL_IS_VOLUME_MOUNTED EQU <CTL_CODE ( FILE_DEVICE_FILE_SYSTEM , 10 , METHOD_BUFFERED , FILE_ANY_ACCESS )>
FILE_DEVICE_FILE_SYSTEM EQU 00000009h
METHOD_BUFFERED EQU 0
FILE_ANY_ACCESS EQU 0
.386
.model flat, stdcall
option casemap :none
include \MASM32\INCLUDE\windows.inc
include \MASM32\INCLUDE\user32.inc
include \MASM32\INCLUDE\kernel32.inc
includelib \MASM32\LIB\user32.lib
includelib \MASM32\LIB\kernel32.lib
.data
form db "EAX: %u", 0
.data?
buffer db 512 dup(?)
.code
start:
mov eax, 9
shl eax, 16
mov ebx, eax
mov eax, 10
shl eax, 14
or ebx, eax
mov eax, 0
shl eax, 2
or ebx, eax
mov eax, 0
or ebx, eax
invoke wsprintf,ADDR buffer,ADDR form,ebx
invoke MessageBox,0,ADDR buffer,0,MB_ICONASTERISK
invoke ExitProcess,0
end start
(http://s019.radikal.ru/i643/1204/5c/08c89c2752a7.png)
.386
.model flat, stdcall
option casemap :none
include \MASM32\INCLUDE\windows.inc
include \MASM32\INCLUDE\user32.inc
include \MASM32\INCLUDE\kernel32.inc
includelib \MASM32\LIB\user32.lib
includelib \MASM32\LIB\kernel32.lib
.data
PhysicalDrive0 db '\\.\PhysicalDrive0',0
NumberD db 'mounted %u',0
form db "error: %u", 0
perenos db 13,10,0
.data?
buffer db 512 dup(?)
cw dd ?
.code
start:
invoke CreateFile,addr PhysicalDrive0,GENERIC_READ or GENERIC_WRITE,FILE_SHARE_READ OR FILE_SHARE_WRITE,0, OPEN_EXISTING,0,0
mov ebx, eax
invoke DeviceIoControl, ebx, 753664, 0, 0, 0, 0, addr cw, 0
.if eax!=0
invoke wsprintf,ADDR buffer,addr NumberD, eax
.else
invoke GetLastError
invoke wsprintf,ADDR buffer,addr form, eax
.endif
invoke MessageBox,0,ADDR buffer,0,MB_ICONASTERISK
invoke CloseHandle, ebx
invoke ExitProcess,0
end start
(http://s019.radikal.ru/i610/1204/a9/eaaeba36be80.png)
(http://smiles.kolobok.us/light_skin/unknw.gif)
What Access is 10?
FSCTL_IS_VOLUME_MOUNTED EQU <CTL_CODE ( FILE_DEVICE_FILE_SYSTEM , 10 , METHOD_BUFFERED , FILE_ANY_ACCESS )>
mov eax, 9 ;DeviceType
shl eax, 16
mov ebx, eax
mov eax, 0 ;Access <<<<
shl eax, 14
or ebx, eax
mov eax, 10 ;Function?
shl eax, 2
or ebx, eax
mov eax, 0 ;Method
or ebx, eax
Quote
CTL_CODE macro DeviceType(1),Function(2),Method(3),Access(4)
exitm <( ( (DeviceType(1)) shl 16 ) or ( ( Access(4) ) shl 14 ) or ( ( Function(2) ) shl 2 ) or ( Method(3) ) ) >
1,2,3,4
1,4,2,3
(http://s2.ipicture.ru/uploads/20120405/hptwxUrr.png)
(http://s2.ipicture.ru/uploads/20120405/HSS18st6.png)
ERROR_INVALID_PARAMETER
(http://s019.radikal.ru/i633/1204/5c/c8043a8ae47a.png)
How this table was made - here all disk which have assigned letters or not
One work - it's good for begining (http://smiles.kolobok.us/light_skin/heat.gif)
.386
.model flat, stdcall
option casemap :none
include \MASM32\INCLUDE\windows.inc
include \MASM32\INCLUDE\user32.inc
include \MASM32\INCLUDE\kernel32.inc
includelib \MASM32\LIB\user32.lib
includelib \MASM32\LIB\kernel32.lib
FPUProc PROTO :QWORD,:DWORD
_DISK_EXTENT struct
DiskNumber DWORD ?
StartingOffset INT64 ?
ExtentLength INT64 ?
_DISK_EXTENT ends
_VOLUME_DISK_EXTENTS struct
NumberOfDiskExtents DWORD ?
Extents _DISK_EXTENT <>
_VOLUME_DISK_EXTENTS ends
_DISK_GEOMETRY struct
Cylinders INT64 ?
MediaType DWORD ?
TracksPerCylinder DWORD ?
SectorsPerTrack DWORD ?
BytesPerSector DWORD ?
_DISK_GEOMETRY ends
.data
PhysicalDrive0 db '\\.\PhysicalDrive0',0
NumberD db 'MediaType %u',13,10,'TracksPerCylinder %u',13,10,'SectorsPerTrack %u',13,10,'BytesPerSector %u',13,10,'Cylinders ',0
form db "error: %u", 0
perenos db 13,10,0
IOCTL_DISK_GET_DRIVE_GEOMETRY = 70000h
Mtype db 'Format is unknown',0
db 'A5.25" floppy, with 1.2MB and 512 bytes/sector.',0
db 'A3.5" floppy, with 1.44MB and 512 bytes/sector.',0
db 'A3.5" floppy, with 2.88MB and 512 bytes/sector.',0
db 'A3.5" floppy, with 20.8MB and 512 bytes/sector.',0
db 'A3.5" floppy, with 720KB and 512 bytes/sector.',0
db 'A5.25" floppy, with 360KB and 512 bytes/sector.',0
db 'A5.25" floppy, with 320KB and 512 bytes/sector.',0
db 'A5.25" floppy, with 320KB and 1024 bytes/sector.',0
db 'A5.25" floppy, with 180KB and 512 bytes/sector.',0
db 'A5.25" floppy, with 160KB and 512 bytes/sector.',0
db 'Removable media other than floppy.',0
db 'Fixed hard disk media.',0
db 'A3.5" floppy, with 120MB and 512 bytes/sector.',0
db 'A3.5" floppy, with 640KB and 512 bytes/sector.',0
db 'A5.25" floppy, with 640KB and 512 bytes/sector.',0
db 'A5.25" floppy, with 720KB and 512 bytes/sector.',0
db 'A3.5" floppy, with 1.2MB and 512 bytes/sector.',0
db 'A3.5" floppy, with 1.23MB and 1024 bytes/sector.',0
db 'A5.25" floppy, with 1.23MB and 1024 bytes/sector.',0
db 'A3.5" floppy, with 128MB and 512 bytes/sector.',0
db 'A3.5" floppy, with 230MB and 512 bytes/sector.',0
db 'An 8" floppy, with 256KB and 128 bytes/sector.',0
db 'A3.5" floppy, with 200MB and 512 bytes/sector. (HiFD).',0
db 'A3.5" floppy, with 240MB and 512 bytes/sector. (HiFD).',0
db 'A3.5" floppy, with 32MB and 512 bytes/sector.',0
baza dw 0,18,66,114,162,210,257,305,353,402,450,498,533,556,603,650,698,746,793,842,892,939,986,1033,1088,1143,1189
.data?
cw dd ?
data1 _DISK_GEOMETRY <>
buffer db 512 dup (?)
.code
start:
invoke CreateFile,addr PhysicalDrive0,GENERIC_READ,FILE_SHARE_READ OR FILE_SHARE_WRITE,0, OPEN_EXISTING,0,0
mov ebx, eax
invoke DeviceIoControl, ebx, IOCTL_DISK_GET_DRIVE_GEOMETRY,0,0,addr data1,sizeof data1, addr cw, 0
.if eax!=0
invoke wsprintf,ADDR buffer,addr NumberD, data1.MediaType, data1.TracksPerCylinder, data1.SectorsPerTrack, data1.BytesPerSector
invoke FPUProc, data1.Cylinders, addr buffer
invoke lstrcat, addr buffer, addr perenos
lea esi, baza
add esi, data1.MediaType
add esi, data1.MediaType
lea edi, Mtype
movzx eax, word ptr[esi]
add edi, eax
invoke lstrcat, addr buffer, edi
.else
invoke GetLastError
invoke wsprintf,ADDR buffer,addr form, eax
.endif
invoke MessageBox,0,ADDR buffer,0,MB_ICONASTERISK
invoke CloseHandle, ebx
invoke ExitProcess,0
FPUProc proc uses ebx Value:QWORD, String:DWORD
LOCAL CReg:REAL10
LOCAL FString[20]:BYTE
finit
fild qword ptr [Value];[data1.Cylinders]
fbstp CReg
lea esi,FString
add esi, 18
mov byte ptr[esi],0
lea edi,CReg
xor edx, edx
xor ebx, ebx
mov ecx, 9
next:
dec esi
dec esi
mov bl, byte ptr [edi]
shl ebx,4
add bh, 48
mov dl, bh
xor bh, bh
shr ebx, 4
add bl, 48
mov dh, bl
mov word ptr [esi], dx
inc edi
loop next
Next:
inc esi
cmp byte ptr [esi], 48
je Next
cmp byte ptr [esi], 0
jne NotZero
dec esi
NotZero:
invoke lstrcat, String, esi;addr FString
ret
FPUProc endp
end start
http://msdn.microsoft.com/en-us/library/windows/desktop/aa365231%28v=vs.85%29.aspx
:U
i knew it was in there, someplace
(http://i069.radikal.ru/1204/b6/4df2854c2ebf.png)
I don't how it make correct. inside winioctl.inc
Quoteif (_WIN32_WINNT ge 500h)
IOCTL_DISK_GET_PARTITION_INFO_EX EQU <CTL_CODE ( IOCTL_DISK_BASE , 0012h , METHOD_BUFFERED , FILE_ANY_ACCESS )>
IOCTL_DISK_SET_PARTITION_INFO_EX EQU <CTL_CODE ( IOCTL_DISK_BASE , 0013h , METHOD_BUFFERED , FILE_READ_ACCESS or FILE_WRITE_ACCESS )>
IOCTL_DISK_GET_DRIVE_LAYOUT_EX EQU <CTL_CODE ( IOCTL_DISK_BASE , 0014h , METHOD_BUFFERED , FILE_ANY_ACCESS )>
IOCTL_DISK_SET_DRIVE_LAYOUT_EX EQU <CTL_CODE ( IOCTL_DISK_BASE , 0015h , METHOD_BUFFERED , FILE_READ_ACCESS or FILE_WRITE_ACCESS )>
IOCTL_DISK_CREATE_DISK EQU <CTL_CODE ( IOCTL_DISK_BASE , 0016h , METHOD_BUFFERED , FILE_READ_ACCESS or FILE_WRITE_ACCESS )>
IOCTL_DISK_GET_LENGTH_INFO EQU <CTL_CODE ( IOCTL_DISK_BASE , 0017h , METHOD_BUFFERED , FILE_READ_ACCESS )>
If change it to 0400h it possible to get IOCTL_DISK_GET_LENGTH_INFO value. I download files from here http://www.japheth.de/WinInc.html stable version. and only comment few strings inside winioctl.inc
Quotedata2 INT64 ?
IOCTL_DISK_GET_LENGTH_INFO = 7405ch
invoke DeviceIoControl, ebx, IOCTL_DISK_GET_LENGTH_INFO,0,0,addr data2,sizeof data2, addr cw, 0
invoke FPUProc, data2, addr buffer
How get GUID path to unmounted or invisible volume? FindFirstVolume - FindNextVolume see only mounted volumes. Even if I read partiton table - but how get GUID?
Hi Bomz
For decode IOCTL codes give a usefull tool IoctlDecoder v1.6
http://www.freewebs.com/four-f/
Greets,
Thanks for Kernel Mode Driver Tut for MASM32 I just read http://wasm.ru/series.php?sid=9 (http://smiles.kolobok.us/light_skin/girl_wink.gif)
Cool
(http://s018.radikal.ru/i512/1204/8d/a5c52bbe0770.gif)
Sorry for the Off-Topic
What is this for a tool to create this animate gif for your screen capture?
http://forum.ru-board.com/topic.cgi?forum=62&bm=1&topic=21681#1 - often ask how do how do - and I make topic
http://www.uvsoftium.ru/UVScreenCamera.php
http://www.gamani.com/
http://s016.radikal.ru/i337/1010/18/4b7eaccaf1ca.gif
http://s013.radikal.ru/i325/1010/d4/3f89b8a8a686.gif
http://s009.radikal.ru/i307/1010/bb/b23f06062a18.gif
http://bomz-co.narod.ru/GIF.zip
http://s014.radikal.ru/i328/1010/b3/f255f5575b03.gif
http://s012.radikal.ru/i321/1010/96/bccf26b63c61.gif
http://bomz-co.narod.ru/WebSeeding.rar
http://bomz-co.narod.ru/WebSeeding.MKV
http://www.erightsoft.com/SUPER.html
http://s016.radikal.ru/i334/1010/c6/e9fa5da0a055.gif
http://s015.radikal.ru/i333/1010/80/aeddbc693657.gif
http://s016.radikal.ru/i334/1010/b5/6c7a7808170e.gif
http://www.masm32.com/board/index.php?topic=16617.msg138386#msg138386
(http://s60.radikal.ru/i167/1105/e7/746ca23b1c9e.gif)
http://www.masm32.com/board/index.php?topic=5451.msg141059#msg141059
QuoteAll process you may see on screens. The main idea how make high qulity screen GIF\VIDEO:
1 The condition's how get max quality you may find only manualy/visualy compare results
2 The most important moment the intermedia video codec (I use Microsoft Video 1, for result video Windows Media Codec 9, 1 pass, 100%, 5 sec key frame, complex)*
3 UvcrScreenCamera (crack) have it's own gif converter but it don't get max qulity/size
4 As you may see in internet there is very many video helps, but the main mistake - it's makes with max screen video mode (1280X1024 for ex) and when resized to 600X800. make it in 600X800 video mode.
5 find your own condition/programs
6 think about scenario of your video before make it
7 if you want cut\add (subtitles) video recompress it in uncompressed video
below in topic you may find hide screens with how make HQ video, add subtitles, add sound.......
http://translate.google.ru/
http://www.gamani.com/
http://www.uvsoftium.ru/UVScreenCamera.php
http://www.erightsoft.com/SUPER.html
http://www.virtualdub.org/
http://www.virtualdub.org/virtualdub_filters.html
http://bomz-co.narod.ru/GIF.zip
http://s016.radikal.ru/i337/1010/18/4b7eaccaf1ca.gif
http://bomz-co.narod.ru/WebSeeding.MKV
http://bomz-co.narod.ru/WS.MKV
http://bomz-co.narod.ru/WebSeeding.rar
http://s013.radikal.ru/i325/1010/d4/3f89b8a8a686.gif
http://s009.radikal.ru/i307/1010/bb/b23f06062a18.gif
http://s014.radikal.ru/i328/1010/b3/f255f5575b03.gif
http://s012.radikal.ru/i321/1010/96/bccf26b63c61.gif
http://s016.radikal.ru/i334/1010/c6/e9fa5da0a055.gif
http://s015.radikal.ru/i333/1010/80/aeddbc693657.gif
http://s016.radikal.ru/i334/1010/b5/6c7a7808170e.gif
*XVid 2-pass also gets good results for result video
http://s60.radikal.ru/i167/1105/e7/746ca23b1c9e.gif
http://www.bunkus.org/videotools/mkvtoolnix/ - it can't put WMV video to mkv container
*The most video codecs work good with even size 320*240 not 321*240. some of them with only standart resolution for ex 320*240 640*480 etc
handy little tool, Bomz :U
(I/O control decoder)
thanks for ragdog and his very interesting site (http://smiles.kolobok.us/light_skin/thank_you2.gif)
I find all includes and libs for driver kid https://www.blurredlogic.net/ebooks/Kernel_Driver_tut/KmdKit/include/w2k/
Now I trying get volume guid through devices info
ahhhh
5636096 = 560000h
:P
(http://smiles.kolobok.us/standart/yes4.gif)
Quote.386
.model flat, stdcall
option casemap :none
include \MASM32\INCLUDE\windows.inc
include \MASM32\INCLUDE\user32.inc
include \MASM32\INCLUDE\kernel32.inc
includelib \MASM32\LIB\user32.lib
includelib \MASM32\LIB\kernel32.lib
include \MASM32\INCLUDE\setupapi.inc
includelib \masm32\LIB\setupapi.lib
_GUIDX STRUCT
Data1 DWORD ?
Data2 WORD ?
Data3 WORD ?
Data4 byte 8 dup(?)
_GUIDX ends
_SP_DEVINFO_DATA struct
cbSize DWORD ?
ClassGuid _GUID <>
DevInst DWORD ?
Reserved DWORD ?
_SP_DEVINFO_DATA ends
;{0xA5DCBF10, 0x6530, 0x11D2, 0x90, 0x1F, 0x00, 0xC0, 0x4F, 0xB9, 0x51, 0xED}; //ddk GUID_DEVINTERFACE_USB_DEVICE
;GUID_DEVINTERFACE_DISK , 53f56307h , 0b6bfh , 11d0h , 94h , 0f2h , 00h , 0a0h , 0c9h , 1eh , 0fbh , 8bh)
.data
form db "ERROR: %u", 0
perenos db 13,10,0
;USBGUID _GUIDX <0A5DCBF10h, 06530h, 011D2h, <090h, 01Fh, 000h, 0C0h, 04Fh, 0B9h, 051h, 0EDh>>
DISKGUID _GUIDX <053f56307h, 0b6bfh, 011d0h, <94h , 0f2h, 000h, 0a0h, 0c9h, 01eh, 0fbh, 08bh>>
DIGCF_PRESENT equ 00000002h
DIGCF_ALLCLASSES equ 00000004h
DIGCF_PROFILE equ 00000008h
DIGCF_DEVICEINTERFACE equ 00000010h
SPDRP_HARDWAREID equ 00000001h
.data?
buffer db 512 dup(?)
string db 1024 dup(?)
Devinfo _SP_DEVINFO_DATA <>
cw dd ?
.code
start:
;invoke SetupDiGetClassDevs,addr USBGUID,0,0,DIGCF_PRESENT OR DIGCF_DEVICEINTERFACE
invoke SetupDiGetClassDevs,addr DISKGUID,0,0,DIGCF_PRESENT OR DIGCF_DEVICEINTERFACE
.if eax !=INVALID_HANDLE_VALUE
mov ebx, eax
xor esi, esi
mov Devinfo.cbSize, sizeof _SP_DEVINFO_DATA
@@:
invoke SetupDiEnumDeviceInfo, ebx, esi, addr Devinfo
.if eax==TRUE
invoke SetupDiGetDeviceRegistryProperty, ebx, addr Devinfo, SPDRP_HARDWAREID, NULL, addr buffer, sizeof buffer, addr cw
;invoke MessageBox,0,ADDR buffer,0,MB_ICONASTERISK
invoke lstrcat, addr string, addr buffer
invoke lstrcat, addr string, addr perenos
add esi, 1
jmp @B
.endif
invoke MessageBox,0,ADDR string,0,MB_ICONASTERISK
.else
invoke GetLastError
invoke wsprintf,ADDR buffer,ADDR form,eax
invoke MessageBox,0,ADDR buffer,0,MB_ICONASTERISK
.endif
invoke ExitProcess,0
end start
:U
(http://www.masm32.com/board/index.php?action=dlattach;topic=18635.0;id=10529)
ok - the optical drive is not showing
hp sata blu-ray
(http://s019.radikal.ru/i610/1204/7c/5d968bbbe14a.png)
(http://smiles.kolobok.us/light_skin/download.gif)
EnumUSBDevice shows my wireless keyboard/mouse and the USB controller
(http://www.masm32.com/board/index.php?action=dlattach;topic=18635.0;id=10533)
EnumVolumeDevice
(http://www.masm32.com/board/index.php?action=dlattach;topic=18635.0;id=10531)
EnumDiskDevice
(http://www.masm32.com/board/index.php?action=dlattach;topic=18635.0;id=10529)
(http://www.masm32.com/board/index.php?action=dlattach;topic=18635.0;id=10532)
my drives are labeled so that partitions of the same disk start with the same letters
K7NL_WD - partitions on the western digital
K7NL_MX - partitions on the maxtor
K7NL_HH - partitions on the hitachi
i have another hitachi (K7NL_HI), but it's not connected at the moment :P
May be your system vista or windows 7?
http://www.vistax64.com/vista-hardware-devices/33127-how-could-i-get-usb-flash-disks-drive-letter.html
nope
XP media center edition 2005, SP3
(http://s2.ipicture.ru/uploads/20120406/3vJR4DZT.png)
(http://s2.ipicture.ru/uploads/20120406/Q52SwemG.png)
(http://smiles.kolobok.us/light_skin/heat.gif)
_SP_DEVICE_INTERFACE_DETAIL_DATA STRUCT
cbSize DWORD ?
DevicePath db 1 dup(?) ;[ANYSIZE_ARRAY]
_SP_DEVICE_INTERFACE_DETAIL_DATA ends
mov InterfaceDetailed.cbSize, sizeof _SP_DEVICE_INTERFACE_DETAIL_DATA
Quotetypedef struct _SP_DEVICE_INTERFACE_DETAIL_DATA {
DWORD cbSize;
TCHAR DevicePath[ANYSIZE_ARRAY];
} SP_DEVICE_INTERFACE_DETAIL_DATA, *PSP_DEVICE_INTERFACE_DETAIL_DATA;
DevicePath
A NULL-terminated string that contains the device interface path. This path can be passed to Win32 functions such as CreateFile.
http://msdn.microsoft.com/en-us/library/windows/hardware/ff552343%28v=vs.85%29.aspx
The size of this structure
must be 5 or nothing don't work
cbSize = The size, in bytes, of the SP_DEVICE_INTERFACE_DETAIL_DATA structure. For more information, see the following Remarks section.
DevicePath = A NULL-terminated string that contains the device interface path. This path can be passed to Win32 functions such as CreateFile.
5 is the minimum length. So the structure can be any size over 5.
Regards, P1 :8)
This is my code. Try to change 1 dup (?) to 2. I 4 hour can't understand why don't work. Than I randomly google this code change to 1 and ...
https://www.blurredlogic.net/ebooks/Kernel_Driver_tut/KmdKit/examples/setup/EnumDisk/EnumDisk.bat
Quote_SP_DEVICE_INTERFACE_DETAIL_DATA STRUCT
cbSize DWORD ?
DevicePath db 1 dup(?) ;[ANYSIZE_ARRAY]
_SP_DEVICE_INTERFACE_DETAIL_DATA ends
And on this forum I find wrong example of guid structure
Quote_GUIDX STRUCT
Data1 DWORD ?
Data2 WORD ?
Data3 WORD ?
Data4 byte 8 dup(?)
_GUIDX ends
I get symboliclink may open it with createfile, but any step to how assign drive letter (http://smiles.kolobok.us/light_skin/vava.gif)
NtQueryVolumeInformationFile FltGetVolumeGuidName(?!!) IOCTL_MOUNTMGR_QUERY_POINTS ---????
sory it wasn't Symbolic Link, real Symbolic Link here. Device symbolic links.
(http://s019.radikal.ru/i620/1204/e9/8bdd0d8d4193.gif)
HELP! invoke lstrlenW, addr [MountDevName.Name1]
shl eax, 1 ;sizeof WCHAR
mov MountmgrMountPoint.DeviceNameLength, ax ;WORD
;lea ecx, MountDevName.Name1
mov MountmgrMountPoint.DeviceNameOffset, sizeof MountmgrMountPoint
add eax, sizeof MountmgrMountPoint
invoke DeviceIoControl, esi, IOCTL_MOUNTMGR_QUERY_POINTS, \
addr MountmgrMountPoint, eax,\;sizeof MountmgrMountPoint
addr MountmgrMountPoints,sizeof MountmgrMountPoints, 0, 0
Can't understand how fill structure. error 1 - ERROR_INVALID_FUNCTION (http://smiles.kolobok.us/light_skin/mega_shok.gif)
http://msdn.microsoft.com/en-us/library/windows/hardware/ff562286%28v=vs.85%29.aspx
http://source.winehq.org/source/dlls/kernel32/volume.c
http://stackoverflow.com/questions/3012828/using-ioctl-mountmgr-query-points
QuoteSymbolicLinkNameOffset
Contains an offset, in bytes, into the output buffer where the symbolic link is located.
can't understand this
Try to get from Device Symbolic link - Volume Symbolic Link
IOCTL_MOUNTMGR_NEXT_DRIVE_LETTER
http://msdn.microsoft.com/en-us/library/windows/hardware/ff560473(v=vs.85).aspx
google don't find any example
Make NtQueryObject