AKB Forums

Go Back   AKB Forums > Technical sections > Languages, Compilers and Interpreters > C/C++
Home Register Blogs FAQ Members List Calendar Downloads Arcade Mark Forums Read

Troubles when posting message? Click here! :: Проблемы с отправлением сообщения? Нажмите сюда!

Reply
 
LinkBack Thread Tools Display Modes
Old Feb 12, 2005, 17:57   #1
incomer
 
BlackCode's Avatar
 
Join Date: Feb 2005
Location: Yerevan
Posts: 16
Rep Power: 0
Reputation: 10
Send a message via ICQ to BlackCode
Question Listing available partitions, problem =(

Task:
List all available drive partitions with their volumes, parameteres
(most important partition size, to calculate partition sector count)


This must be a windows application.

PartitionSectorCount = PartitionSize / 512;

I used the DeviceIoControl(...) API function width
IOCTL_DISK_GET_DRIVE_LAYOUT parameter to list
all available partitions on specified disk.

It works but there is one problem.

It returns all partitions by their numbers, there is no
information about drive letter.

How can I idenitfy partition drive letter?

I need that because the drive letter of partition is
key to open it with CreateFile(...) API
function to have direct access to that portion of drive.

There is another solution.
is to
1. open direct access to all portions of drive
2. read MBR (master boot record) which contains main information
about partitions.

I don't like this solution because it's dangerous.
Error in my application may destroy file systems on entire disk drive.

That's why I preffer to have full access only to some portion of
drive, only to one partition to prevent any damage.
__________________
Regards, Aram
BlackCode is offline   Reply With Quote Quote selected
Old Mar 27, 2005, 13:25   #2
Младенец
 
Join Date: Jul 2004
Location: T
Posts: 2
Rep Power: 0
Reputation: 10
Isk kareli a hetaqrqrvel inchi hamara petq?
Mr.M is offline   Reply With Quote Quote selected
Old Apr 13, 2005, 06:57   #3
Дошкольник
 
Join Date: Mar 2003
Location: 2A
Posts: 102
Rep Power: 6
Reputation: 10
GetLogicalDrives()
http://support.microsoft.com/default...b;en-us;193623
armeng is offline   Reply With Quote Quote selected
Old Apr 14, 2005, 07:07   #4
incomer
 
BlackCode's Avatar
 
Join Date: Feb 2005
Location: Yerevan
Posts: 16
Rep Power: 0
Reputation: 10
Send a message via ICQ to BlackCode
Quote:
Originally Posted by Mr.M
Isk kareli a hetaqrqrvel inchi hamara petq?
Diplomayin ashxatanqsa, grum em im windows-i tak ashxatox fayleri,
tvyalneri, xekavarman hamakarg.
__________________
Regards, Aram
BlackCode is offline   Reply With Quote Quote selected
Old Apr 14, 2005, 07:12   #5
incomer
 
BlackCode's Avatar
 
Join Date: Feb 2005
Location: Yerevan
Posts: 16
Rep Power: 0
Reputation: 10
Send a message via ICQ to BlackCode
Quote:
Originally Posted by armeng
Ok, I have a the list of the available partitions drive letter,
how I can identify it's size ?

I this case GetFileSize(...) will not work.
__________________
Regards, Aram
BlackCode is offline   Reply With Quote Quote selected
Old Apr 14, 2005, 09:22   #6
Дошкольник
 
Join Date: Mar 2003
Location: 2A
Posts: 102
Rep Power: 6
Reputation: 10
Quote:
Originally Posted by BlackCode
Ok, I have a the list of the available partitions drive letter,
how I can identify it's size ?

I this case GetFileSize(...) will not work.
GetDiskFreeSpaceEx ?
armeng is offline   Reply With Quote Quote selected
Old Apr 14, 2005, 09:40   #7
Дошкольник
 
Join Date: Mar 2003
Location: 2A
Posts: 102
Rep Power: 6
Reputation: 10
А вообще эта информация должна быть в registry. Смотри в сторону PDH (Performance Data helper) interface.
armeng is offline   Reply With Quote Quote selected
Old Apr 14, 2005, 10:55   #8
incomer
 
BlackCode's Avatar
 
Join Date: Feb 2005
Location: Yerevan
Posts: 16
Rep Power: 0
Reputation: 10
Send a message via ICQ to BlackCode
Quote:
Originally Posted by armeng
GetDiskFreeSpaceEx ?
No no.

In this case it doesn't work.

I even can tell why.

Those APIs are depenending on partitions file system.
Those functions work when there is known file system on specified partition,
Those APIs will fail if there is no, or there is unknown file system on specified
partition.

I need file system independent APIs.

I found such APIs, but they present only on Windows 2003 Server and later versions of windows.

I tried them all before I made this topic.
__________________
Regards, Aram
BlackCode is offline   Reply With Quote Quote selected
Old Apr 14, 2005, 10:57   #9
incomer
 
BlackCode's Avatar
 
Join Date: Feb 2005
Location: Yerevan
Posts: 16
Rep Power: 0
Reputation: 10
Send a message via ICQ to BlackCode
Wink

Quote:
Originally Posted by armeng
А вообще эта информация должна быть в registry. Смотри в сторону PDH (Performance Data helper) interface.
Попробую.
__________________
Regards, Aram
BlackCode is offline   Reply With Quote Quote selected
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Weird problem in WinXP Boyov Software 4 May 4, 2005 17:11
Apache/php problem Obelix Web Development 5 Jul 31, 2004 14:48
IIS problem Hovo Web Development 6 Jun 21, 2004 11:17
Pancake flipping problem acid Algorithms 1 Jun 2, 2004 19:16
Priner -- Problem :( Mono Hardware 4 Aug 25, 2002 03:06


All times are GMT. The time now is 03:54.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
This board was founded on September 29, 2001
Powered by Viper Internet

Affordable Web Hosting | ParevNet

Buy text link