Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Mar 29th, 2006, 12:47 PM   #11
nnxion
Programming Guru
 
nnxion's Avatar
 
Join Date: Jun 2005
Location: elemental plane
Posts: 1,429
Rep Power: 5 nnxion is on a distinguished road
Quote:
Originally Posted by badbasser98
First off, how can you tell me that I did not read anything. Are you here sitting next to me watching what I am or am not doing? As a matter of fact, I did read that. I may have not understood everything fully, but read it non the less. After trying serveral things to make it work, I could not so I figured I would ask here since the people here have been helpful in the past. Now I am not so sure how helpful this forum really is...
Well if you read it you can at least state that you don't understand what it says, so we don't have to go through all of it. When someone shows you how to do something right, and the very next time you do it wrong again, then we can only assume you did not read it.

If you still don't understand, you have to have it like this:
HANDLE hProcess = OpenProcess( PROCESS_QUERY_INFORMATION | PROCESS_VM_READ | PROCESS_TERMINATE, FALSE, processID );

@Cache: I gave that link in the post two before yours.
__________________
"Employ your time in improving yourself by other men's writings, so that you shall gain easily what others have labored hard for."
-- Socrates
nnxion is offline   Reply With Quote
Old Mar 29th, 2006, 3:12 PM   #12
badbasser98
Hobbyist Programmer
 
Join Date: Mar 2005
Location: United States
Posts: 124
Rep Power: 4 badbasser98 is on a distinguished road
Quote:
Originally Posted by Cache
It states quite clearly that:
Quote:
hProcess [in] Handle to the process to terminate.
The handle must have the PROCESS_TERMINATE access right. For more information, see Process Security and Access Rights.
Ah, I completely missed that part in the code... Its a bit hard to distinguish the bold from the rest in some instances with the italics. Thanks for the help Cache.

Quote:
Originally Posted by DaWei
Don't admit you read it, we'll think you can't comprehend .
Well, at times its hard to understand everything you read when also trying to juggle 3 other tasks at the same time... Guess I should have read it at home instead of at work.
__________________
Learning to use C++ and loving every minute of it.
badbasser98 is offline   Reply With Quote
Old Mar 29th, 2006, 9:49 PM   #13
Cache
Hobbyist
 
Join Date: Sep 2005
Posts: 261
Rep Power: 4 Cache is on a distinguished road
Bonus tip: get debug privs and you'll have a better chance of getting a handle to a process with the access rights you want. Use the function below in your app then check it's output. You should get less <unknowns>'s.

bool GetDebugPrivs( void )
{
	HANDLE hToken;
	LUID sedebugnameValue;
	TOKEN_PRIVILEGES tp;

	if ( OpenProcessToken(GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, &hToken) )
	{
		if ( !LookupPrivilegeValue(NULL, SE_DEBUG_NAME, &sedebugnameValue) )
		{
			CloseHandle( hToken );
			return false;
		}
		
		tp.PrivilegeCount = 1;
		tp.Privileges[0].Luid = sedebugnameValue;
		tp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;

		AdjustTokenPrivileges(hToken, FALSE, &tp, sizeof(tp), NULL, NULL);
		CloseHandle( hToken );
	}
	
	 return ( GetLastError() == ERROR_SUCCESS );
}
Cache is offline   Reply With Quote
Old Mar 30th, 2006, 2:37 AM   #14
nnxion
Programming Guru
 
nnxion's Avatar
 
Join Date: Jun 2005
Location: elemental plane
Posts: 1,429
Rep Power: 5 nnxion is on a distinguished road
Cache, just give him the source to fkill or a codeproject article.
__________________
"Employ your time in improving yourself by other men's writings, so that you shall gain easily what others have labored hard for."
-- Socrates
nnxion is offline   Reply With Quote
Old Mar 30th, 2006, 8:44 AM   #15
badbasser98
Hobbyist Programmer
 
Join Date: Mar 2005
Location: United States
Posts: 124
Rep Power: 4 badbasser98 is on a distinguished road
Thanks again for the help. I did try the debug privledges and that showed one process that used to be unknown. Not really useful for much now, but maybe in the future.

Thanks,
-BB98
__________________
Learning to use C++ and loving every minute of it.
badbasser98 is offline   Reply With Quote
Old Mar 30th, 2006, 11:25 AM   #16
Cache
Hobbyist
 
Join Date: Sep 2005
Posts: 261
Rep Power: 4 Cache is on a distinguished road
Quote:
Originally Posted by nnxion
Cache, just give him the source to fkill or a codeproject article.
I've never heard of 'fkill' before, but yeah, that would have been a better idea. Interesting site too.

@badbasser98: On my machine your program only showed about 5 out of 20(ish) processes without debug privs. Plus, even if you only see 1 extra process then thats a 10% increase in accuracy over 10 processes. I'd say it's worth it.
Cache is offline   Reply With Quote
Old Mar 31st, 2006, 9:29 AM   #17
badbasser98
Hobbyist Programmer
 
Join Date: Mar 2005
Location: United States
Posts: 124
Rep Power: 4 badbasser98 is on a distinguished road
on my work PC (where I do most of my programming) that program shows all but three of 46 processes without debug privs. Now that's down to two with the privs.
__________________
Learning to use C++ and loving every minute of it.
badbasser98 is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 12:03 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC