|
i never got to understand the way you can hook a window function like CopyFileA or RegSetValueW for exmple. can someone explain it to me or give me some good site where I can read more about this. I would be veru greatful. I want to know how to it without drivers for now.
Thank you
gabby
|
|
|
|
|
If there is away to hook a function, I have never heard of it. I can think of a few ways this might be accomplished, but it would take a lot of reaserch (and the system security should object to that level of interference).
Hooks are away of intercepting messages being sent from one place to anouther. You can redirect the messages, stop them from being proccessed or allow them to be pass on to there inteneded target.
What you probaly are looking for is articles on hooking in windows. There are several articles at CP and probably at CodeGuru.com. There is also a number of articles on drawing menues and etc... that use hooks to redirect messages to there own drawing code.
I hope that helps!
INTP
"The more help VB provides VB programmers, the more miserable your life as a C++ programmer becomes."
Andrew W. Troelsen
|
|
|
|
|
|
On Windows XP and others it is possible to sign on without a user name or password. Is the default user name always default or can it contain another value?
Thanks
"Naked we come and bruised we go."
- James Douglas Morrison
Best Wishes,
ez_way
|
|
|
|
|
BaldwinMartin wrote:
On Windows XP and others it is possible to sign on without a user name or password.
Not if the adiminstrator has set it up to disallow it.
BaldwinMartin wrote:
Is the default user name always default or can it contain another value?
No and Yes! It is up to the administrator.
INTP
"The more help VB provides VB programmers, the more miserable your life as a C++ programmer becomes."
Andrew W. Troelsen
|
|
|
|
|
I have this problem, im used to doing winsock program in vb, when i create multiple connection in vb, i just create an array of it, i tried doing this in c++/win32api the problem is, when a connection connected to certain
socket[index] closes i have no idea which socket it is. coz i have no idea how to retreive the index of the socket that got the disconnection. does anyone know a way to know which socket got the disconnection?
I have no idea
|
|
|
|
|
I don't but it might help if you gave two very short code examples. That is give one example of how you do it in VB and one example of how you are doing it in C++. That should provide enough information for someone to give a good answer (possibly even me).
INTP
"The more help VB provides VB programmers, the more miserable your life as a C++ programmer becomes."
Andrew W. Troelsen
|
|
|
|
|
///this is just a part of the code its kinda messy i just starting to learn c++/winapi.
SOCKET m_socket[chatter];
else if(msg==WM_SOCKET)
{
switch(WSAGETSELECTEVENT(lParam))
{
case FD_ACCEPT:
char socknum[30];
sprintf(socknum,"%d",sock);
strcat(socknum,"Connection Detected on socket ");
SendtoChat(socknum);
m_socket[sock]=accept(m_socket[0],NULL,NULL);
sock++;
break;
case FD_CLOSE:
SendtoChat("Closing Detected");
//closesocket(m_socket[1]);
break;
case FD_READ:
char str[1000];
memset(str,0,1000);int ctr=1;
while(ctr!=chatter)
{
recv(m_socket[ctr],str,sizeof(str),0);
ctr++;
}
ctr=1;
while(ctr!=chatter)
{
if(send(m_socket[ctr],str,sizeof(str),0)==SOCKET_ERROR)
{
}
ctr++;
}
SendtoChat(str);
//MessageBox(hwnd,str,"",MB_OK);
//free(str);
break;
}
--------
What i want to do is evrytime someone disconnects.. i wanna know which socket got the disconnection... so when soemone try to request connection i will know which index is available for connection and so i could give that index to the connection requesting.... i can just make a loop until it doesnt get an error to see if someone is connected to it or not but then i dont want it to be unorganized.... and another thing sometimes port scanners connects to a winsock program and fools the program for a legitimate connection so i want it to be more organize so i will know whch connection is legitimate or not
Maybe, is there a way to know if someone is connected to one socket?
I have no idea
|
|
|
|
|
What you try to do is implement yur own homemade connection pool, not an easy task if you are new to working with sockets.
The easiest way to make a program, like what it looks like you are doing, is using blocking sockets and use a new thread for each connection. When a client disconnect from the socket you just close it and ends the thread.
When a new client connect, you just spawn a new thread and talk to the client from that thread...
More advanced ways to do it (and faster and better) is to use async sockets...
Take a look at all the articles here on CP, there are plenty both simple samples and more advanced ones...
- Anders
My PhotosWDevs - The worlds first DSP, free blog space, email and more. Now also with forums
|
|
|
|
|
If you havn't yet, you might want to read the articles by Nishant (at CP) on Winsock including Multithreading.
INTP
"The more help VB provides VB programmers, the more miserable your life as a C++ programmer becomes."
Andrew W. Troelsen
|
|
|
|
|
Okay thnks to both ill try your suggestions
I have no idea
|
|
|
|
|
i need to run a big project including 3 little project .dll
and after to run an .exe file
|
|
|
|
|
dov you want to know how to run a exe from inside a dll
if yes use CreateProcess or ShellExecute or LoadModule . . . us eyour imagination
gabby
|
|
|
|
|
So, view may appear differently? I want to pass some parameter to view, these parameter is created at run time. So how can I pass them to view?
A way to work arround is save those parameter in Doc. But it looks not quite right. I hope I can create CView::CView( int A, int B ) there is CView::Cview() already. so when template create view, pass A and B to view, so CView::CView( int A, int B ) is called, instaed of CView::CView( ). I was stuck, Please help me out.
Thank you inadvance.
|
|
|
|
|
Storing it in the document does make since.
You can pass additional information to the veiw of a particular document via
OnUpdateAll(...,lHint,pHint). The lHint, argument can be long value (or a pointer value stored in a long). The pHint can be used if the addition information is stored in a CObject derive object.
Good Luck!
INTP
"The more help VB provides VB programmers, the more miserable your life as a C++ programmer becomes."
Andrew W. Troelsen
|
|
|
|
|
It would be easier to store it in document. In your view's OnDraw just call GetDocument() to get the document and then the parameter and simply write your drawing code depending on the parameter
|
|
|
|
|
wwwrabbit1 already knows how to do that but wanted another way (to pass information to CView object) to accomplish the same thing and that is what the hint parameters are for.
I personaly would contenue to store the information in the document, where it (probably) belongs.
What we do not know is what effect the information is supposed to have, other than they effect what is to be shown.
INTP
"The more help VB provides VB programmers, the more miserable your life as a C++ programmer becomes."
Andrew W. Troelsen
|
|
|
|
|
Hello!
I'm currently writing some application, that contains a class A. It loads a DLL and passes a pointer to A to the DLL. The DLL includes the header file of A.
Anyway, when I try to compile this, I get LNK2001: unresolved external symbol errors for all A class function calls...
When I include all *.obj files as library files in the DLL settings, it compiles. But it doesn't really execute the actual functions of the main application then, it just compiles the whole code again into the DLL. It shouldn't do this, it should just call the real functions of the main application.
What must I do that the DLL can execute the functions of A?
Thanks and best regards,
Dominik
_outp(0x64, 0xAD);
and
__asm mov al, 0xAD __asm out 0x64, al
do the same... but what do they do??
(doesn't work on NT)
|
|
|
|
|
write 0xAD to port 0x64
oh wait...
pass a pointer to the function to the DLL.
I know of no "reverse export" mechanism.
we are here to help each other get through this thing, whatever it is Vonnegut jr. boost your code || Fold With Us! || sighist | doxygen
|
|
|
|
|
So it's impossible? Isn't there some possibility of generating a .lib file of main app or something like that?
How can I write a plugin architecture then? The DLL must be somehow be able to execute class functions of the main app...
_outp(0x64, 0xAD);
and
__asm mov al, 0xAD __asm out 0x64, al
do the same... but what do they do??
(doesn't work on NT)
|
|
|
|
|
Wooo! It is more than possible! The person who has the information at the tip of his tong is just not online. If we have not done anything like that in a while, then we have to try to remember enough to figure it out (if we have the time to go through the trouble).
There are articles at CP on plugins, DLLs and COMM (also in the MSDN Library).
When I first read your post (ealier today) the first thing I thought about was callback functions, but that was not what you where asking about. If you can pass a callback function you can pass a class pointer. Heck we pass class pointers and references to DLLs all the time, otherwise we could not use MFC.
Your question is resonable and someone may yet answer it.
I am no expert on DLLs, so I did not try to figure out what the problem was.
INTP
"The more help VB provides VB programmers, the more miserable your life as a C++ programmer becomes."
Andrew W. Troelsen
|
|
|
|
|
The person who has the information at the tip of his tong is just not online.
Let's hope he'll get online soon
There are articles at CP on plugins, DLLs and COMM (also in the MSDN Library).
I've read most of them, but actually many of them are for C# only and the others for C++ never have the problem that the DLL wants to call something that is in the EXE. They'll just describe how to load and call a DLL, the DLL then does many things, like creating new windows, sending windows messages, etc. but never calls something of the EXE...
Thanks and best regards,
Dominik
_outp(0x64, 0xAD);
and
__asm mov al, 0xAD __asm out 0x64, al
do the same... but what do they do??
(doesn't work on NT)
|
|
|
|
|
I have looked into this quite some time back and I'm afraid I can't remember what the outcome was, but I vaguely recall it was possible. You need to create a lib for the .exe and use that in the DLL. Also declare the functions as exported.
One issue that comes to mind though is DLL's are (can be) shared by .EXE's so which EXE would the exported function be in. I guess this info lives in the export information.
Another way to do this is for the .EXE to expose an array of functions DLL's can call. You could do this with delegates and probably signals and slots. Have a look at the truly excellent FastDelegate here on CP.
In my programmers editor (see sig) I enabled interpreted C functions to call C/C++ functions in my .EXE. This is done by my C compiler resolving function addresses via. the .EXE's MAP file. This works very well and allows extensions to the editor to do most anything that the .exe can.
Neville Franks, Author of ED for Windows www.getsoft.com and Surfulater www.surfulater.com "Save what you Surf"
|
|
|
|
|
Also declare the functions as exported.
Doh I've searched the whole IDE, all subdialogs, etc. at least 2 hours for a setting to generate a .lib of the .exe file... Didn't find anything. I have almost given it up and then just prefixed some of the functions with __declspec(dllexport). Compiled it, and think what? It generated the .lib, .exp and exported the functions very nicely as one could see in the Dependency Viewer. Yay!!!
Added the .lib to the test plugin project (the DLL), compiled it, and everything works!!
Many many thanks!!!
Dominik
_outp(0x64, 0xAD);
and
__asm mov al, 0xAD __asm out 0x64, al
do the same... but what do they do??
(doesn't work on NT)
|
|
|
|
|
:-DNot bad at all! An expert did not show up but someone who could get you looking in the right direction did. It never occured to me that you were not using export.
:(Now if I can just understand how to do basicaly the same thing via COM thru the IUnknow interface. Thats what I've been working on.
INTP
"The more help VB provides VB programmers, the more miserable your life as a C++ programmer becomes."
Andrew W. Troelsen
|
|
|
|