 |
Cheat Engine The Official Site of Cheat Engine
|
| View previous topic :: View next topic |
| Author |
Message |
oib111 I post too much
Reputation: 0
Joined: 02 Apr 2007 Posts: 2947 Location: you wanna know why?
|
Posted: Mon May 12, 2008 4:59 pm Post subject: |
|
|
Now I'm getting runtime errors whenever I try to kill a process.
| Quote: |
'Process Killer.exe': Loaded 'C:\Documents and Settings\OIB\My Documents\Visual Studio 2008\Projects\Process Killer\Debug\Process Killer.exe', Symbols loaded.
'Process Killer.exe': Loaded 'C:\WINDOWS\system32\ntdll.dll'
'Process Killer.exe': Loaded 'C:\WINDOWS\system32\kernel32.dll'
'Process Killer.exe': Loaded 'C:\WINDOWS\system32\user32.dll'
'Process Killer.exe': Loaded 'C:\WINDOWS\system32\gdi32.dll'
'Process Killer.exe': Loaded 'C:\WINDOWS\WinSxS\x86_Microsoft.Windows.Common-Controls_6595b64144ccf1df_6.0.2600.2982_x-ww_ac3f9c03\comctl32.dll'
'Process Killer.exe': Loaded 'C:\WINDOWS\system32\msvcrt.dll'
'Process Killer.exe': Loaded 'C:\WINDOWS\system32\advapi32.dll'
'Process Killer.exe': Loaded 'C:\WINDOWS\system32\rpcrt4.dll'
'Process Killer.exe': Loaded 'C:\WINDOWS\system32\secur32.dll'
'Process Killer.exe': Loaded 'C:\WINDOWS\system32\shlwapi.dll'
'Process Killer.exe': Loaded 'C:\WINDOWS\WinSxS\x86_Microsoft.VC90.DebugCRT_1fc8b3b9a1e18e3b_9.0.21022.8_x-ww_597c3456\msvcr90d.dll'
'Process Killer.exe': Loaded 'C:\WINDOWS\system32\shimeng.dll'
'Process Killer.exe': Loaded 'C:\WINDOWS\system32\imm32.dll'
'Process Killer.exe': Unloaded 'C:\WINDOWS\system32\shimeng.dll'
'Process Killer.exe': Loaded 'C:\WINDOWS\system32\uxtheme.dll'
'Process Killer.exe': Loaded 'D:\WINDOWS\BricoPacks\Vista Inspirat 2\RocketDock\RocketDock.dll', Binary was not built with debug information.
'Process Killer.exe': Loaded 'C:\WINDOWS\system32\psapi.dll'
'Process Killer.exe': Loaded 'C:\WINDOWS\system32\msctf.dll'
'Process Killer.exe': Loaded 'C:\Program Files\Seekmo\bin\10.0.406.0\HostOE.dll'
'Process Killer.exe': Loaded 'C:\WINDOWS\system32\ole32.dll'
'Process Killer.exe': Loaded 'C:\WINDOWS\system32\oleaut32.dll'
'Process Killer.exe': Loaded 'C:\WINDOWS\system32\version.dll'
'Process Killer.exe': Unloaded 'C:\WINDOWS\system32\version.dll'
'Process Killer.exe': Loaded 'C:\WINDOWS\system32\apphelp.dll'
'Process Killer.exe': Loaded 'C:\WINDOWS\system32\msctfime.ime'
Run-Time Check Failure #3 - The variable 'szExe' is being used without being initialized.
Run-Time Check Failure #3 - The variable 'szExe' is being used without being initialized.
First-chance exception at 0x1026f7e2 in Process Killer.exe: 0xC0000005: Access violation reading location 0xcccccccc.
Unhandled exception at 0x1026f7e2 in Process Killer.exe: 0xC0000005: Access violation reading location 0xcccccccc.
The program '[508] Process Killer.exe: Native' has exited with code 0 (0x0).
|
| Code: |
void ListProcess() {
PROCESSENTRY32 pe32;
pe32.dwSize = sizeof(PROCESSENTRY32);
HANDLE hSnapshot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, NULL);
Process32First(hSnapshot, &pe32);
do {
SendMessage(hList, LB_ADDSTRING, NULL, (LPARAM)pe32.szExeFile);
} while (Process32Next(hSnapshot, &pe32));
CloseHandle(hSnapshot);
}
BOOL PK(char *szExe) {
HANDLE hProcess;
PROCESSENTRY32 PKpe32;
PKpe32.dwSize = sizeof(PROCESSENTRY32);
HANDLE PKhSnapshot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, NULL);
Process32First(PKhSnapshot, &PKpe32);
do {
if(strcmp(PKpe32.szExeFile, szExe) == 0) {
hProcess = OpenProcess(PROCESS_TERMINATE, FALSE, PKpe32.th32ProcessID);
TerminateProcess(hProcess, 0);
CloseHandle(hProcess);
CloseHandle(PKhSnapshot);
return TRUE;
}
} while(Process32Next(PKhSnapshot, &PKpe32));
CloseHandle(PKhSnapshot);
return FALSE;
}
void GetIndexName() {
char *szExe;
int index = SendMessage(hList, LB_GETCURSEL, NULL, NULL);
if(index != LB_ERR) {
SendMessage(hList, LB_GETTEXT, (WPARAM)index, (LPARAM)szExe);
PK(szExe);
}
}
|
| Code: |
case WM_COMMAND:
switch(LOWORD(wParam)) {
case IDC_PK_BUTTON:
GetIndexName();
break;
|
_________________
| 8D wrote: |
cigs dont make people high, which weed does, which causes them to do bad stuff. like killing |
|
|
| Back to top |
|
 |
lurc Grandmaster Cheater Supreme
Reputation: 2
Joined: 13 Nov 2006 Posts: 1900
|
Posted: Mon May 12, 2008 5:38 pm Post subject: |
|
|
try
char szExe[260];
or
do what Wiccaan said to do, (initialize the charecter using the LB_GETTEXTLEN before)
_________________
|
|
| Back to top |
|
 |
HomerSexual Grandmaster Cheater Supreme
Reputation: 5
Joined: 03 Feb 2007 Posts: 1657
|
Posted: Mon May 12, 2008 7:01 pm Post subject: |
|
|
Don't you need the correct permissions to kill a process?
_________________
|
|
| Back to top |
|
 |
oib111 I post too much
Reputation: 0
Joined: 02 Apr 2007 Posts: 2947 Location: you wanna know why?
|
Posted: Mon May 12, 2008 7:40 pm Post subject: |
|
|
| blankrider wrote: | | Don't you need the correct permissions to kill a process? |
PROCESS_TERMIANTE is all you need.
Got it working. But I'm a little confused. I made my PK function to take a char*, and not a char. But I declared szExe as a char and not a char* and it worked. Shouldn't I have got an error trying to convert a char to char*?
_________________
| 8D wrote: |
cigs dont make people high, which weed does, which causes them to do bad stuff. like killing |
|
|
| Back to top |
|
 |
HomerSexual Grandmaster Cheater Supreme
Reputation: 5
Joined: 03 Feb 2007 Posts: 1657
|
Posted: Mon May 12, 2008 8:30 pm Post subject: |
|
|
an array of char is treated like a char pointer
char * buf;
char buf2[33];
type function(char* buf){
do stuff
}
You could pass buf and buf2 in this because array char is a char pointer
_________________
|
|
| Back to top |
|
 |
oib111 I post too much
Reputation: 0
Joined: 02 Apr 2007 Posts: 2947 Location: you wanna know why?
|
Posted: Mon May 12, 2008 8:46 pm Post subject: |
|
|
Oh really? Never knew that (weird no tutorials mention that). Got a question. If I wanted to make a new (child) window when the user hits the about button. Would I do something like this?
| Code: |
... //skipping WM_COMMAND and case IDC_PK_BUTTON:
case IDC_ABOUT_BUTTON:
HWND Ahwnd = CreateWindowEx(0, szClassName, "About", WS_CHILD | WS_VISIBLE, CW_USEDEFAULT, CW_USEDEFAULT, 100, 100, hwnd, (HMENU)IDC_ABOUT_FORM, GetModuleHandle(NULL), NULL);
|
I'm not really sure because I've never made a child window before.
_________________
| 8D wrote: |
cigs dont make people high, which weed does, which causes them to do bad stuff. like killing |
|
|
| Back to top |
|
 |
HomerSexual Grandmaster Cheater Supreme
Reputation: 5
Joined: 03 Feb 2007 Posts: 1657
|
Posted: Tue May 13, 2008 5:22 am Post subject: |
|
|
nonononono
I, at least, use resource dialogs. So for my cPAD app the part of the dialog was like this
| Code: | IDD_ABOUT DIALOG DISCARDABLE 0, 0, 220, 60
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "My About Box"
FONT 8, "MS Sans Serif"
BEGIN
DEFPUSHBUTTON "&OK",IDOK,174,30,50,14
GROUPBOX "About this program...",IDC_STATIC,7,7,225,52
CTEXT "CPad written by Steve B.\n\n\nWritten in C++",
IDC_STATIC,16,18,144,33
END |
Then you make a button or some WM_COMMAND do this
| Code: | case IDM_WHAT_ABOUT:{
int ret;
ret = DialogBox(GetModuleHandle(NULL),
MAKEINTRESOURCE(IDD_ABOUT), hwnd, AboutDlgProc);
if(ret == IDOK){}
else if(ret == -1){
MessageBox(hwnd, "Dialog failed!", "Error",
MB_OK | MB_ICONINFORMATION);
}
}
break; |
Of course IDM_WHAT_ABOUT is my own resource...
Notice the last param of MAKEINTRESOURCE (AboutDlgProc). You have to make ANOTHER, yes another, wndproc. I'll paste mine.
| Code: | BOOL CALLBACK AboutDlgProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
{
switch (Message)
{
case WM_INITDIALOG:
return TRUE;
case WM_COMMAND:
switch(LOWORD(wParam))
{
case IDOK:
EndDialog(hwnd, IDOK);
break;
}
break;
default:
return FALSE;
}
return TRUE;
}
|
Notice that you return TRUE and FALSE. I forget the reasons but it deals with how windows processes child messages. If you return numbers it will never continue and hang, as far as i know.
When in Doubt:
http://www.winprog.org/tutorial/dialogs.html
Appalsap also mentioned creating a dialog template in memory and not resource, just throwing it out there.
_________________
|
|
| Back to top |
|
 |
Anden100 Grandmaster Cheater
Reputation: 0
Joined: 20 Apr 2007 Posts: 668
|
Posted: Tue May 13, 2008 6:10 am Post subject: |
|
|
If you succed at this, could i please have the source then? i would love to look through it
|
|
| Back to top |
|
 |
oib111 I post too much
Reputation: 0
Joined: 02 Apr 2007 Posts: 2947 Location: you wanna know why?
|
Posted: Tue May 13, 2008 7:42 am Post subject: |
|
|
Definitely. I plan on releasing it with the source.
@blankrider
Is there anyway to do it without using resources. Like at runtime (I really don't like resources). Oh and btw I get an unexpected end of file with resource.h. And is there a link to a tutorial on how to make child windows, like real windows, and not dialog boxes (for new projects I will work on).
_________________
| 8D wrote: |
cigs dont make people high, which weed does, which causes them to do bad stuff. like killing |
|
|
| Back to top |
|
 |
atom0s Moderator
Reputation: 205
Joined: 25 Jan 2006 Posts: 8587 Location: 127.0.0.1
|
Posted: Tue May 13, 2008 8:34 am Post subject: |
|
|
Proc terminator example attached. Uses resource file to create the about dialog. Sorry if the codes sloppy I just tossed this together fairly quickly and I haven't slept in 2 days which is what I'm going to go do now... sleep time >.>
_________________
- Retired. |
|
| Back to top |
|
 |
oib111 I post too much
Reputation: 0
Joined: 02 Apr 2007 Posts: 2947 Location: you wanna know why?
|
Posted: Tue May 13, 2008 8:40 am Post subject: |
|
|
| Wiccaan wrote: | | Proc terminator example attached. Uses resource file to create the about dialog. Sorry if the codes sloppy I just tossed this together fairly quickly and I haven't slept in 2 days which is what I'm going to go do now... sleep time >.> |
Ok...this didn't really help. So I'm just going to post my code...(btw I don't use resources a lot, so yeah...and I did it all manually)
resource.h (get an error on this, unexpected eof found)
| Code: |
#define IDD_ABOUT_POPUP 104
|
resource.rc
| Code: |
#include <resource.h>
IDD_ABOUT_POPUP DIALOG DISCARDABLE 0, 0, 220, 60
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "About Process Killer"
FONT 8, "MS Sans Serif"
BEGIN
DEFPUSHBUTTON "&OK",IDOK,174,30,50,14
GROUPBOX "Creator",IDC_STATIC,7,7,225,52
CTEXT "Process Killer written by oib111\n\n\nWritten in C++",
IDC_STATIC,16,18,144,33
END
|
_________________
| 8D wrote: |
cigs dont make people high, which weed does, which causes them to do bad stuff. like killing |
|
|
| Back to top |
|
 |
HomerSexual Grandmaster Cheater Supreme
Reputation: 5
Joined: 03 Feb 2007 Posts: 1657
|
Posted: Tue May 13, 2008 2:51 pm Post subject: |
|
|
Just put a new line, blank of course, at the end of both the files
The resource and header compiler is picky. So just put a newline and you'll be fine
_________________
|
|
| Back to top |
|
 |
oib111 I post too much
Reputation: 0
Joined: 02 Apr 2007 Posts: 2947 Location: you wanna know why?
|
Posted: Tue May 13, 2008 3:03 pm Post subject: |
|
|
| blankrider wrote: | Just put a new line, blank of course, at the end of both the files
The resource and header compiler is picky. So just put a newline and you'll be fine |
Thanks.
_________________
| 8D wrote: |
cigs dont make people high, which weed does, which causes them to do bad stuff. like killing |
Last edited by oib111 on Tue May 13, 2008 3:08 pm; edited 1 time in total |
|
| Back to top |
|
 |
HomerSexual Grandmaster Cheater Supreme
Reputation: 5
Joined: 03 Feb 2007 Posts: 1657
|
Posted: Tue May 13, 2008 3:04 pm Post subject: |
|
|
post code
_________________
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum
|
|