Solved

absread( ) problem

Posted on 2002-05-17
6
444 Views
Last Modified: 2010-08-05
i am not able to access the hard disk sectors with the absread() function  of borland turboc C++.
errno states that the function number is not correct.i also tried to use int25h which absread uses but all in vain.please help.thanks
0
Comment
Question by:vinayak_j
6 Comments
 
LVL 49

Expert Comment

by:DanRollins
ID: 7016866
What is the operating system that you are using?  In protected-mode, multithreaded O/Ses like Windows, low-level disk access is disallowed in order to prevent disk corruption.

Sometimes you can lock a disk before attempting low-level access.

-- Dan
0
 

Author Comment

by:vinayak_j
ID: 7017780
thanks DanRollins.I am using win98SE can you throw more light on locking disks the way i should access them.
0
 
LVL 49

Accepted Solution

by:
DanRollins earned 50 total points
ID: 7018316
You can look into the DeviceIoControl Win32 API.  It provides access to low-level information about a hard disk.  To access this function, you need to use the CreateFile() API as decribed here (section about physical drives):

http://msdn.microsoft.com/library/en-us/fileio/filesio_7wmd.asp

And the FSCTL_LOCK_VOLUME Ioctl code that is described here:

http://search.microsoft.com/gomsuri.asp?n=8&c=rp_Results&siteid=us/dev&target=http://msdn.microsoft.com/library/en-us/fileio/fsys_02w5.asp

The most common use for sector-level disk writing is to cause damage to people's hard disk as part of a virus or trojan horse type program.  So don't expect me to hold your hand.  If you have a real and legitimate interest in low-level disk I/O these links will get you started.

-- Dan
0
Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

 
LVL 1

Expert Comment

by:Shivshankar
ID: 7019668
Your win98SE might have formatted the hard-disk in FAT32 file format.

absread are so old that they don't know anything beyond FAT16. This might be the reason.
0
 
LVL 11

Expert Comment

by:griessh
ID: 7178799
Dear vinayak_i

I think you forgot this question. I will ask Community Support to close it unless you finalize it within 7 days. You can always request to keep this question open. But remember, experts can only help you if you provide feedback to their questions.
Unless there is objection or further activity,  I will suggest to accept

     "DanRollins"

comment(s) as an answer.

If you think your question was not answered at all, you can post a request in Community support (please include this link) to refund your points. The link to the Community Support area is: http://www.experts-exchange.com/commspt/


PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
======
Werner
0
 
LVL 6

Expert Comment

by:Mindphaser
ID: 7199802
Force accepted

** Mindphaser - Community Support Moderator **
0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article will show you some of the more useful Standard Template Library (STL) algorithms through the use of working examples.  You will learn about how these algorithms fit into the STL architecture, how they work with STL containers, and why t…
This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. A brief on problem: Lets take example problem for simplicity: - I have a G…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question