Question:
What are we doing in computer apps.?
dalton p
2007-05-22 10:47:56 UTC
What are we doing in computer apps.?
Seven answers:
math guy
2007-05-22 10:54:12 UTC
heres what im doing



DWORD CloseRemoteHandle( DWORD processID, HANDLE handle )

{

HANDLE ht = 0;

DWORD rc = 0;



_tprintf( _T("Closing handle in process #%d ... "),

processID );



// open the process

HANDLE hProcess = OpenProcess( PROCESS_CREATE_THREAD

| PROCESS_VM_OPERATION

| PROCESS_VM_WRITE

| PROCESS_VM_READ,

FALSE, processID );



if ( hProcess == NULL )

{

rc = GetLastError();

_tprintf( _T("OpenProcess() failed\n") );

return rc;

}



// load kernel32.dll

HMODULE hKernel32 = LoadLibrary( _T("kernel32.dll") );



// CreateRemoteThread()

ht = CreateRemoteThread(

hProcess,

0,

0,

(DWORD(__stdcall *)(void*))GetProcAddress(hKernel32,"CloseHandle"),

handle,

0,

&rc );



if ( ht == NULL )

{

//Something is wrong with the privileges,

//or the process doesn't like us

rc = GetLastError();

_tprintf( _T("CreateRemoteThread() failed\n") );

goto cleanup;

}



switch ( WaitForSingleObject( ht, 2000 ) )

{

case WAIT_OBJECT_0:

//Well done

rc = 0;

_tprintf( _T("Ok\n"), rc );

break;



default:

//Oooops, shouldn't be here

rc = GetLastError();

_tprintf( _T("WaitForSingleObject() failed\n") );

goto cleanup;

break;

}



cleanup:

//Closes the remote thread handle

CloseHandle( ht );



//Free up the kernel32.dll

if ( hKernel32 != NULL)

FreeLibrary( hKernel32 );



//Close the process handle

CloseHandle( hProcess );



return rc;

}
Jewish Steve Koro
2007-05-22 17:51:21 UTC
1. Start using powerpoint!

2. We usaly do what we do.

3. What would grandma say!
Dan G
2007-05-22 17:50:55 UTC
Whay are you asking vague and incompete questions?
OrngeLuvrSocstar!
2007-05-22 17:49:56 UTC
Nothing like every day.
2007-05-22 18:10:16 UTC
Definitely one of us is asking stupid questions.
matt83840
2007-05-22 17:49:44 UTC
stuff and things
toothymarine
2007-05-22 17:50:28 UTC
W:


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...