If i open a drive (C: or D in edit mode using CreateFile then WriteFile is failed. While there is no issue for Win XP.
Is there something else which should be taken care when write data for drive in windows7
Posting the applicable code will go a long way to getting help with your problem...
Jim
ATP BE400 CE500 (C550B-SPW) CE560XL MU300 CFI CFII
"The speed of non working code is irrelevant"... Of course that is just my opinion, I could be wrong.
"Nothing in the world can take the place of persistence. Talent will not; nothing is more common than unsuccessful men with talent. Genius will not; unrewarded genius is almost a proverb. Education will not; the world is full of educated derelicts. Persistence and determination are omnipotent. The slogan 'press on' has solved and always will solve the problems of the human race."...Calvin Coolidge 30th President of the USA.
I'll write the error code and source code.
But i think it's known problem for window7
I am login in windows with a user which has admin right. UAC is turn on.
I run my exe using Administrator but fail to write data on disk.
CreateFile open discs successfully but WriteFile fail.
Since this is the first post of this problem I have seen in this forum with Win7 a copy of the code or sample project that duplicates the problems would be helpful.
I have a commercial program that writes to Win7 and Server 2008 over 750,000 times a day with no errors...this is why I ask for the offending code to help you solve your problem.
Jim
ATP BE400 CE500 (C550B-SPW) CE560XL MU300 CFI CFII
"The speed of non working code is irrelevant"... Of course that is just my opinion, I could be wrong.
"Nothing in the world can take the place of persistence. Talent will not; nothing is more common than unsuccessful men with talent. Genius will not; unrewarded genius is almost a proverb. Education will not; the world is full of educated derelicts. Persistence and determination are omnipotent. The slogan 'press on' has solved and always will solve the problems of the human race."...Calvin Coolidge 30th President of the USA.
1. What is the return value of DWORD nRet
2. What is car buf[512];...is this is suppose to be a char buf[512] ?? if so, how did this compile
3. What is the sector size of Disk 0
Jim
ATP BE400 CE500 (C550B-SPW) CE560XL MU300 CFI CFII
"The speed of non working code is irrelevant"... Of course that is just my opinion, I could be wrong.
"Nothing in the world can take the place of persistence. Talent will not; nothing is more common than unsuccessful men with talent. Genius will not; unrewarded genius is almost a proverb. Education will not; the world is full of educated derelicts. Persistence and determination are omnipotent. The slogan 'press on' has solved and always will solve the problems of the human race."...Calvin Coolidge 30th President of the USA.
It's char buf[512]
Return value is 5 (nRet)
sector size is 512
I forgot to mention that i open pysicaldrive0 (not Cor d drive) sorry for that
But i think if i can write on disk whether i open c drive or PysicalDrive0
It's char buf[512]
Return value is 5 (nRet)
sector size is 512
I forgot to mention that i open pysicaldrive0 (not Cor d drive) sorry for that
But i think if i can write on disk whether i open c drive or PysicalDrive0
It's char buf[512]
Return value is 5 (nRet)
sector size is 512
I forgot to mention that i open pysicaldrive0 (not Cor d drive) sorry for that
But i think if i can write on disk whether i open c drive or PysicalDrive0
You might also want to check your SetFilePointer() value...
__int64 pos = 1000000;
When writing to PhysicalDrive0 you must be aligned on sector boundries...and your "pos" value of 1000000 won't get you to a sector boundry...should be a multiple of the sector size.
But this problem is more than likely a permission thing or some intermediate step to allow such a function is missing...
Jim
ATP BE400 CE500 (C550B-SPW) CE560XL MU300 CFI CFII
"The speed of non working code is irrelevant"... Of course that is just my opinion, I could be wrong.
"Nothing in the world can take the place of persistence. Talent will not; nothing is more common than unsuccessful men with talent. Genius will not; unrewarded genius is almost a proverb. Education will not; the world is full of educated derelicts. Persistence and determination are omnipotent. The slogan 'press on' has solved and always will solve the problems of the human race."...Calvin Coolidge 30th President of the USA.
I just gave an example using 10000.
To read/write from disk the offset sould be multiple of sector size
As suggested
After locking the drive you have to dismount it and get rid of the DOS device
I will use FSCTL_DISMOUNT_VOLUME and DDD_RAW_TARGET_PATH | DDD_REMOVE_DEFINITION | DDD_EXACT_MATCH_ON_REMOVE
As suggested i unlock the disk, dismound it and call remove dos device function. But still the same problem exist "Access is denied" when WriteFile is called.
I am attaching the code. Please have a liink and suggest where i am wrong.
Last edited by MFCQuery; September 20th, 2011 at 05:27 AM.
* The Best Reasons to Target Windows 8
Learn some of the best reasons why you should seriously consider bringing your Android mobile development expertise to bear on the Windows 8 platform.