Click here to Skip to main content
15,898,371 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi, I am writing an application that has to figure out whether a process is doing any kind of IO, and has to pause that process if it is. Now I know how to pause and resume the process but I don't know how to check if it is performing IO operations. How do I figure that out?
Posted
Comments
Sergey Alexandrovich Kryukov 4-Sep-15 15:25pm    
Why?
To me, the whole idea assumes a big misconception and abuse, but perhaps you can explain your way of thinking.
—SA
0xF4 5-Sep-15 2:25am    
I've lost hundreds of Gigabits of data to applications from untrusted developers. So now I'm writing an application that will prevent a specified process from doing any kind of IO without permission from the user. You just have to enter the path to the executable and my application will monitor the process.
Sergey Alexandrovich Kryukov 5-Sep-15 2:29am    
Sounds intriguing, but I think you have to explain more. You see, I don't think it's possible to detect what you want, so I suggest to work into different direction, to formulate the ultimate goals.
—SA
0xF4 5-Sep-15 2:36am    
I was thinking if I could figure out the addresses in memory of functions that perform IO, I can pause the process before it executes them. What do you think?
Sergey Alexandrovich Kryukov 5-Sep-15 5:29am    
Well, probably you could achieve it only by writing custom device drivers... I don't understand why? Do you think you can provide security against untrusted applications? Hardly. The way to do so is a sandbox...
—SA

1 solution

You can do it indirectly, by safe-guarding your IO-processes with a special flag so know, what is running.

Meta-code:
C++
bool ioGlobalFlag = false;//static var or Lock/Mutex

///later in your code
 ioGlobalFlag = true;
//here comes your io
....

//io now ready
 ioGlobalFlag = false;


Consider doing it all in a seperate thread, but than you need locking or a mutex.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900