|
What's crashing? Your service control app or the service itself?
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
My Service is crashing.
Appu..
"My blood group is not B+.But I have it my blood"
|
|
|
|
|
Have you debugged it? Use "Debug/Processes..." in visual studio to attach to the running
service. Then toggle the service state and when it crashes you'll be able to trace the problem
in the debugger.
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
I have added a small Sleep in stop.
Now it is working fine.
Thanks.
Appu..
"My blood group is not B+.But I have it my blood"
|
|
|
|
|
I used CreateFile() API to open a hard drive in raw format. But it failed. What are the correct parameters for the API ? Please help me.
|
|
|
|
|
Srinivas Kaparthi wrote: to open a hard drive in raw format
What do you mean opening a hard-drive ? You mean opening a file, right ? And what is raw format ? Binary mode ?
Srinivas Kaparthi wrote: But it failed
What failed ? What happened exactly ? It crashed, it didn't compile, ... ? What messages did you get ? What did you expect and what happened ?
And also, post the code you use to open the file.
|
|
|
|
|
Hello,
Thank you for your reply.
Opening a hard drive does not mean opening a file.
raw format means the complete disk/partition is treated as a single file. By opening in raw format, we can read sectors directly. This method is called raw IO. This is also called as Direct Disk/Drive Access. Please refer to the Kakan's reply for my problem. It is working fine.
|
|
|
|
|
Nice, I learned something today
I didn't know that we could open the disk in raw format. Thanks for the tip
|
|
|
|
|
Yes, it's possible to open either a partition or a physical disk (including the partition table). And modify (with the correct access rights of course).
So we got all possibilities to mess things up!
Alcohol. The cause of, and the solution to, all of life's problems - Homer Simpson
|
|
|
|
|
I use this code.
Beware, it's C and not unicode compliant. Adjust it if you want to.
m_UseDrive is the drive letter to open, i.e: 'C'
sprintf(Drive,"\\\\.\\%c:", m_UseDrive);
hDrive = CreateFile(Drive, GENERIC_READ | GENERIC_WRITE,
FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL);
But when you read from it, you MUST use a multiple of the sector size. Else, the read will fail. The same goes for seeking.
You can find out the sector size by a DeviceIoControl-call, and get the disk geometry. (Search for documentation of the DISK_GEOMETRY struct).
Alcohol. The cause of, and the solution to, all of life's problems - Homer Simpson
|
|
|
|
|
I used a dialog based application. For OK Button click handler I wrote the following code as suggested by you. But I could not succeed. Is it that Administrator login is essential? What is meant by UNICODE complianr?
<br />
char Drive[20] , m_UseDrive = 'C' ;<br />
HANDLE hDrive ;<br />
<br />
<br />
sprintf(Drive,"\\\\.\\%c:", m_UseDrive);<br />
hDrive = CreateFile(Drive, GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL);<br />
if(hDrive == INVALID_HANDLE_VALUE)<br />
AfxMessageBox("Succeeded") ;<br />
else<br />
AfxMessageBox("Drive could not be opened") ;
|
|
|
|
|
Hello.
I always use the "disclaimer" about my source code not beeing Unicode compliant, and has C syntax.
In the past, I've been flamed a number of times, by people who were complaining about my source code. Nowadays, I always use that statement.
About your code example: You have switched your test/texts, so if you get "Drive could not be opened", all is fine, and the drive is open for use!
Just remember, all operations must be done on an even multiplier of the sector size (since a complete sector is the smallest amount that the drive can handle. It's ususally 512 bytes, but can differ).
Alcohol. The cause of, and the solution to, all of life's problems - Homer Simpson
|
|
|
|
|
Thanks a lot!
|
|
|
|
|
Under Windows 98, it fails. Is there any solution?
|
|
|
|
|
Hello.
I haven't used that code under "DOS"-Windows (95,98,Me), but as far as I know, it should work.
According to MS, there shouldn't be any limitations for 98/Me, see here[^]
Maybe you should try to change GENERIC_READ | GENERIC_WRITE to just GENERIC_READ.
Or changing FILE_SHARE_READ | FILE_SHARE_WRITE
Alcohol. The cause of, and the solution to, all of life's problems - Homer Simpson
|
|
|
|
|
|
Very useful, thanks (I've forwarded it on to someone who has been having Vista security issues)
Garth
|
|
|
|
|
Hi Garth,
Garth J Lancaster wrote: Very useful, thanks
No problem. It's nice to get a succint article out of Microsoft every now and again. I'm glad they made Dr. Russinovich a Research Fellow.
Jeff
|
|
|
|
|
Excellent! Thanks much for posting that link
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
Hi,
Could anybody tell me that how can i save 3D frames to harddisk while rendering , using DirectX
thanks
Regards.
|
|
|
|
|
The IPL priority order is stored in non volatile memory of system.
I want to read the non volatile memory to get a IPL priority order.
How to do this.
If you have any other idea to get IPL priority order ,please give me.
|
|
|
|
|
Hi prathuraj,
prathuraj wrote: The IPL priority order is stored
If you are referring to driver loading order, there are no guarantees of order (outside of partitioning into SYSTEM_BOOT, etc). See Services[^] in MSDN.
Jeff
|
|
|
|
|
#include<iostream.h>
in the above line , is it right to say that #include is a pre processor directive.
|
|
|
|
|
Nilish wrote: #include<iostream.h>
in the above line , is it right to say that #include is a pre processor directive. \
The #include directive tells the preprocessor to treat the contents of a specified file as if those contents had appeared in the source program at the point where the directive appears.
I hope that this answers your question.
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
Sir, can u please explain a little bit more?
|
|
|
|