Click here to Skip to main content
15,895,656 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: How to Delete a used file in C++? Pin
«_Superman_»19-Mar-09 20:43
professional«_Superman_»19-Mar-09 20:43 
GeneralRe: How to Delete a used file in C++?_unlink is also not working. Pin
002comp19-Mar-09 21:03
002comp19-Mar-09 21:03 
GeneralPlease reply someone else to this problem Pin
002comp19-Mar-09 23:52
002comp19-Mar-09 23:52 
QuestionRe: How to Delete a used file in C++? Pin
David Crow20-Mar-09 2:58
David Crow20-Mar-09 2:58 
GeneralRe: How to Delete a used file in C++? Pin
Jerry.Wang20-Mar-09 4:08
Jerry.Wang20-Mar-09 4:08 
QuestionRe: How to Delete a used file in C++? Pin
David Crow20-Mar-09 2:59
David Crow20-Mar-09 2:59 
AnswerRe: How to Delete a used file in C++? Pin
Maximilien20-Mar-09 3:09
Maximilien20-Mar-09 3:09 
QuestionObtaining process name from process handle [modified] Pin
hxhl9519-Mar-09 19:42
hxhl9519-Mar-09 19:42 
Hello everyone,

It's a really straightforward question this time: I have a process handle and I wish to detect if that handle is one to my app. I have a function where I receive a handle to a process, and if the handle is a handle to any other app but mine, I send a message to it.

I've tried using GetProcessImageFileName, but unfortunately it returns garbage data...
char processName[255];
GetProcessImageFileName(ProcessHandle,processName,256);
MessageBox(NULL,processName,"hehehaha",MB_ICONINFORMATION);

Which leads to another non-related question. You see, I'm trying to hook NtTerminateProcess and deny all requests to terminate my own process. The hook works fine, but when I call the real NtTerminateProcess from inside the hookproc the process it's called on crashes. I am completely at a loss of why this is happening and would appreciate it if someone explained it to me.

When it crashes the error is The instruction at "0x10002383" referenced memory at "0x0000000c". The memory could not be "read". It's always the same two addresses for any process.

Thanks a lot. Smile | :)

P.S. Please, please, PLEASE do not reply with a message asking "Why would you want to do such a thing". This is for educational purposes only, and I mean that. Laugh | :laugh:

modified on Friday, March 20, 2009 1:51 AM

AnswerRe: Obtaining process name from process handle Pin
«_Superman_»19-Mar-09 19:53
professional«_Superman_»19-Mar-09 19:53 
GeneralRe: Obtaining process name from process handle Pin
hxhl9519-Mar-09 19:59
hxhl9519-Mar-09 19:59 
GeneralRe: Obtaining process name from process handle Pin
«_Superman_»19-Mar-09 20:03
professional«_Superman_»19-Mar-09 20:03 
GeneralRe: Obtaining process name from process handle [modified] Pin
hxhl9520-Mar-09 5:56
hxhl9520-Mar-09 5:56 
GeneralRe: Obtaining process name from process handle Pin
«_Superman_»21-Mar-09 3:31
professional«_Superman_»21-Mar-09 3:31 
QuestionRe: Obtaining process name from process handle [modified] Pin
hxhl9521-Mar-09 8:12
hxhl9521-Mar-09 8:12 
AnswerRe: Obtaining process name from process handle Pin
David Crow20-Mar-09 3:02
David Crow20-Mar-09 3:02 
QuestionRe: Obtaining process name from process handle Pin
hxhl9520-Mar-09 5:54
hxhl9520-Mar-09 5:54 
AnswerRe: Obtaining process name from process handle Pin
David Crow20-Mar-09 6:00
David Crow20-Mar-09 6:00 
QuestionRe: Obtaining process name from process handle Pin
hxhl9520-Mar-09 6:08
hxhl9520-Mar-09 6:08 
AnswerRe: Obtaining process name from process handle Pin
David Crow20-Mar-09 7:16
David Crow20-Mar-09 7:16 
GeneralRe: Obtaining process name from process handle Pin
hxhl9520-Mar-09 7:23
hxhl9520-Mar-09 7:23 
QuestionRe: Obtaining process name from process handle Pin
David Crow20-Mar-09 7:31
David Crow20-Mar-09 7:31 
QuestionRe: Obtaining process name from process handle Pin
hxhl9520-Mar-09 8:04
hxhl9520-Mar-09 8:04 
AnswerRe: Obtaining process name from process handle Pin
David Crow20-Mar-09 8:16
David Crow20-Mar-09 8:16 
GeneralRe: Obtaining process name from process handle Pin
hxhl9520-Mar-09 10:08
hxhl9520-Mar-09 10:08 
QuestionMFC + Threading = C2665 Pin
Killiconn19-Mar-09 14:43
Killiconn19-Mar-09 14:43 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.