Click here to Skip to main content
15,915,513 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
Generalplease I need help Pin
waway5-Mar-05 14:05
waway5-Mar-05 14:05 
GeneralRe: please I need help Pin
Ravi Bhavnani6-Mar-05 12:32
professionalRavi Bhavnani6-Mar-05 12:32 
GeneralProtection error: debugger detected Pin
aritosteles5-Mar-05 14:05
aritosteles5-Mar-05 14:05 
GeneralRe: Protection error: debugger detected Pin
aritosteles14-Mar-05 17:14
aritosteles14-Mar-05 17:14 
GeneralRe: Protection error: debugger detected Pin
Dave Midgley25-Feb-11 23:40
Dave Midgley25-Feb-11 23:40 
GeneralUsing Visual Basic 6 dll in Visual C++ 6 Pin
Kumarunster5-Mar-05 10:45
Kumarunster5-Mar-05 10:45 
GeneralRe: Using Visual Basic 6 dll in Visual C++ 6 Pin
Mike Dimmick5-Mar-05 12:51
Mike Dimmick5-Mar-05 12:51 
Generalhard time with dll Pin
gamitech5-Mar-05 10:33
gamitech5-Mar-05 10:33 
hello
I have a little problem with a dll
I am tying to hook some processes with a variable in a dll.
The variable should hold the names of all the path for the hooked processes. I have shared the variable everything is OK but when I try to initialize it from a file (because I read the entryies from a file) the callback function for the hook runs wild and I do not get the correct modulefilenames. All I get is my program's module filename.
I was wondering what is wrong.
here is a piece of code:

//globals
struct pr<br />
{<br />
	char nume[1024];<br />
};<br />
<br />
#pragma data_seg("SHARED")<br />
HHOOK cbt=0;<br />
pr procs[100];<br />
int cnt=0;<br />
#pragma data_seg()<br />
#pragma comment(linker, "/section:SHARED,RWS")<br />
<br />
//callback function<br />
<br />
LRESULT CALLBACK CallWndProc(int nCode,WPARAM wParam,LPARAM lParam)<br />
{<br />
<br />
	if (nCode<0)<br />
		return CallNextHookEx(cbt,nCode,wParam,lParam);<br />
<br />
		CWPSTRUCT *wps = (CWPSTRUCT*)lParam;<br />
<br />
<br />
DWORD pid;<br />
GetWindowThreadProcessId((HWND)wps->hwnd,&pid);<br />
HANDLE hProc;<br />
hProc=OpenProcess(PROCESS_ALL_ACCESS,FALSE,pid);<br />
HMODULE mods[100];<br />
DWORD size;<br />
char nume[1024];<br />
<br />
<br />
if (EnumProcessModules(hProc,mods,sizeof(mods),&size))<br />
if (size>0)<br />
GetModuleFileNameEx(hProc,mods[0],nume,sizeof(nume));<br />
<br />
<br />
<br />
//here I create a mutex because this section of the code should only be done //once in initializing. how can I do this initializig so I won't get the error<br />
//because the variable "nume" is always the module filename of my program<br />
CreateMutex(0,0,"Pula");<br />
if (GetLastError()!=ERROR_ALREADY_EXISTS)<br />
{<br />
CreateMutex(0,0,"Pula");<br />
FILE *str;<br />
char temp[1024];<br />
GetTempPath(sizeof(temp),temp);<br />
strcat(temp,"\\IdleProcesses.sys");<br />
str=fopen(temp,"a+");<br />
int i;<br />
i=0;<br />
while(!feof(str))<br />
{<br />
i++;<br />
fgets(temp,sizeof(temp),str);<br />
temp[strlen(temp)-1]='\0';<br />
strcpy(procs[i].nume,temp);<br />
<br />
}<br />
fclose(str);<br />
cnt=i;<br />
}<br />
<br />
<br />
<br />
<br />
for (int i=1; i<=cnt; i++)<br />
<br />
<br />
if (StrStrI(nume,procs[i].nume)!=NULL)<br />
{<br />
	DWORD exit;<br />
	GetExitCodeProcess(hProc,&exit);<br />
	TerminateProcess(hProc,exit);<br />
}<br />
<br />
<br />
	return CallNextHookEx(cbt,nCode,wParam,lParam);<br />
<br />
}<code>


gabby
GeneralCTabCtrl Pin
lino_i5-Mar-05 10:17
lino_i5-Mar-05 10:17 
GeneralVisual Studio for Web Page Design Pin
Grahamfff5-Mar-05 8:27
Grahamfff5-Mar-05 8:27 
GeneralRe: Visual Studio for Web Page Design Pin
alex.barylski5-Mar-05 10:04
alex.barylski5-Mar-05 10:04 
GeneralMapping Mode Pin
LiYS5-Mar-05 4:10
LiYS5-Mar-05 4:10 
QuestionWhot is wrong with this .h file? Pin
Glich5-Mar-05 3:16
Glich5-Mar-05 3:16 
AnswerRe: Whot is wrong with this .h file? Pin
Maximilien5-Mar-05 3:30
Maximilien5-Mar-05 3:30 
GeneralRe: Whot is wrong with this .h file? Pin
Glich5-Mar-05 7:28
Glich5-Mar-05 7:28 
GeneralRe: Whot is wrong with this .h file? Pin
Maximilien5-Mar-05 7:46
Maximilien5-Mar-05 7:46 
Generalneed sub7 open source to learn about windows managment Pin
nadzzz5-Mar-05 3:06
nadzzz5-Mar-05 3:06 
Generalsource code from exe Pin
V.G5-Mar-05 1:38
V.G5-Mar-05 1:38 
GeneralRe: source code from exe Pin
Anonymous5-Mar-05 1:46
Anonymous5-Mar-05 1:46 
GeneralRe: source code from exe Pin
V.G5-Mar-05 1:48
V.G5-Mar-05 1:48 
GeneralRe: source code from exe Pin
Gary R. Wheeler5-Mar-05 2:23
Gary R. Wheeler5-Mar-05 2:23 
GeneralRe: source code from exe Pin
ThatsAlok6-Mar-05 18:17
ThatsAlok6-Mar-05 18:17 
GeneralRe: source code from exe Pin
Gary R. Wheeler5-Mar-05 2:19
Gary R. Wheeler5-Mar-05 2:19 
GeneralEnumerating ip addresses Pin
lastdays5-Mar-05 1:24
lastdays5-Mar-05 1:24 
GeneralRe: Enumerating ip addresses Pin
lastdays5-Mar-05 1:35
lastdays5-Mar-05 1:35 

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.