|
Thats it! Thanks. I thought I had to specify function call argument passing (__cdecl, __fastcall, etc) just as Dr John Maddock's Regex++ library.
|
|
|
|
|
It's often a good idea to be specific about the calling convention when exporting from a DLL; if the client program is compiled with a different default convention (using the /Gd, /Gr or /Gz switches) from your DLL it either won't link correctly or will potentially crash at runtime, due to erroneous stack manipulations.
__stdcall is marginally smaller (typically one ADD instruction) at the call site than __cdecl, but __cdecl can handle variable argument lists and is marginally smaller in the function implementation. The ADD instruction is used to reset the stack pointer after the call back to where it was before the compiler started PUSHing arguments. More info in John Robbins' excellent Debugging Applications books (I just bought the most recent one, Debugging Applications for Microsoft .NET and Microsoft Windows - there's a mouthful).
This only applies to desktop Win32 running on IA32 processors; Windows CE on IA32 always uses __cdecl, while other processors only have a single calling convention. Most RISC processors use a calling convention sort of like __cdecl but with the first n arguments passed in registers. This is also true of AMD64 (first 4 arguments passed in RCX, RDX, R8, R9 or XMM0-3 if floating point) and IA64 (first 8 arguments passed in the rotating portion of the register file).
[Yes, I know the processor names look a little unfamiliar; specifying 'x86' isn't very helpful any more because 64-bit 'x86-64' code works differently. AMD now wish Opteron/Athlon64-compatible code to be known as AMD64.]
--
Mike Dimmick
|
|
|
|
|
Thanks for the clarification mike.
|
|
|
|
|
Hi. I am in desperate need of help when it comes to MDI child windows. I need to add controls to them, but I don't know how. I've been using CDialogBar as a replacement, but it is VERY limited compared to an MDI child window. A code snippet would be appreciated, but at least telling me which CWnd is supposed to be the parent of the controls would be helpful.
-- Steve
|
|
|
|
|
SteveBob wrote:
but at least telling me which CWnd is supposed to be the parent of the controls would be helpful.
Typically CChildFrame which is derived from CMDIChildWnd. If you have a Doc.View application then you work with CView derived classes, which are children of CMDIChildWnd.
Hope that helps.
Neville Franks, Author of ED for Windows. www.getsoft.com
Make money with our new Affilate program
|
|
|
|
|
Look up CFormView in MSDN. There are many samples in MSDN and here.
Best wishes,
Hans
|
|
|
|
|
Hello, everyone.
I have a library with a class A (has two static functions f1 and f2) and B (calls functions of A), I can compile it, with no problems. Then I am using this library in my program and during the linking I have an error (see below for the log) that static A::f1 can not be found for B.obj.
Maybe someone knows why one function could be found, while the other not? I simplified my problem, because I have a library with a lot of classes and it worked before. I had this problem some time ago but I played with the order of the inclusion of the header files and I got rid of the problem, now I can not help it.
This is the whole message:
Linking...
SJManagers_D.lib(SJGmeMan.obj) : error LNK2001: unresolved external symbol "public: static void __cdecl CSJSndMan::PlaySoundA(unsigned int,bool)" (?PlaySoundA@CSJSndMan@@SAXI_N@Z)
Thanks.
Alexander
|
|
|
|
|
Is your function actually called PlaySoundA() or PlaySound(). The reason I ask is that in one of the standard windows header files, a lot of the standard API methods are #defined to function beginning with A (for ANSI) or W (for Wide). I think that PlaySound is one of them. If this is what is happening, then it is possible that the rename is not taking place inside your library, but does take place when the library is used (i.e. the .lib file has PlaySound() because the rename didn't occur, but the app is looking for PlaySoundA() because a rename has occurred).
You can check this quickly by renaming PlaySound() to something like PlayMySound() and recompiling.
Dave
http://www.cloudsofheaven.org
|
|
|
|
|
Thanks a lot Dave! It did help.
Alexander http://sjcomp.virtualave.net/
|
|
|
|
|
Has anyone implemented "zoom to extent" feature for a 3D perspective view? I need the algorithm tonight.
Regards,
BB
|
|
|
|
|
Is it possible to make a trojan with code progject??? Im just asking cause im planning to bulid one with VC++ i think I ll be the first one making a trojna with VC++ lol..
|
|
|
|
|
Is it possible to make a trojan with code progject???
I mean is it possible to make a trojan with VC++
|
|
|
|
|
|
yea its very well possible, i made one of my own, its crappy though and uses MFC. The beauty about ur own trojan is that virusscanners don't detect it as one (as long as it doesn't get widespread)
Kuniva
--------------------------------------------
|
|
|
|
|
OH ok, Thats pretty cool that you could make a RAT, I heard is better making RAT in delphi??? but i like MS vC++ better I want to make a nice one is there any tuts on making a trojan on C++?? if there are please post the link
Thankz in advance
th3kill3r
|
|
|
|
|
i don't know any tuts on making one, i think most people just make them up, and there isn't like a base model for a RAT because the functions differ from file transmissions to showing/hiding the startbutton lol (which is really stupid according to me btw)
I would suggest u pick up on winsock programming first, u need to know how to program asynchronous sockets as well as blocking sockets, u can find all the info u need at the winsock programmers faq, just type that in in altavista and u'll get there, they have some samples, this is without mfc though, but its the best way to learn.
The problem these days though are firewalls and shared connections and getting the ip since messengers use a central server u cant get the ip as easily. So what i did with mine was when the RAT ran it logs in to a public chat server (like irc for example, but mine doesnt use IRC allthough it should be possible i guess). Then when the RAT is running, u'll know cause u see the nick is logged into the chat, and u can also get the ip through the chat, so u can try and direct connect, however if there's a firewall u wont be able to and u would need a direct connection to transmit files. But i also thought of that too, and its fairly simple, u just make it so that the RAT listens on the chat for commands, so u can give it commands through the chat, u could even make it so that it would only take commands from a certain chat user so other people wont take advantage. My RAT for instance has a function to download files from the web, so if i want a file on the target computer but i cant direct conect, i just upload the file to my webspace, and give the command through the chat to download that file. The other way around is possible as well, u give a command to upload a file to webspace, of course this involves ur password and login being in ur trojan, so i suggest encrypting ur code or use free webspace so that when ur trojan gets into wise hands they dont run away with ur webspace lol.
Anyways, i hope that helped, maybe i'll write a tut about making a RAT one day
Kuniva
--------------------------------------------
|
|
|
|
|
I found this short description about SSL:
You enter a URL such as https://www.mysite.com in your browser window. The https indicates that you want your browser to initiate a secure session with the server
The server responds by sending the site's certificate
The browser checks the certificate information for validity
The browser then creates a session key, which is encrypted with the server's public key, and sends it to the server
The server then decrypts this information using it's private key
Both the browser and server are now using the same secret session key, and the little lock icon will appear on your browser window. All further information sent between the browser and the server will be automatically encrypted, as long as you continue using the https:// protocol.
-----------------------------
whats the private key?? i mean, ur browser generates a session key, its encrypted with a servers public key, but for ur browser to get a public key, it would have to be sent over the network too right? so if that is intercepted, and u encrypt ur session key and send it, and someone intercepts that too, they can decrypt ur session key right? because they already intercepted the public key or they are able to get it (if its static). So i'm guessing the mystery is in the private key, allthough i don't see how it can be different from the public key, i don't seem to understand. Because if the private key is different from the public key, the server will not decrypt it into the same session key as ur browser generated right?
Could anyone clarify this?
Thank you
Kuniva
--------------------------------------------
|
|
|
|
|
A public-private key pair works as follows.
What you encrypt using the public key can only be decrypted using the private key.
And what you encrypt using the private key can only be decrypted using the public key.
Thus you sign using your private key, because people can verify that this is actually you, by decryping the signature using the publicly available public key.
And when you want to send confidential info to the server you encrypt the data using the public key. Now the data can only be decrypted at the server because only they have the private key.
It is nearly impossible to figure out the private key given a public key. Perhaps if you run a brute forcer on a super computer for a few 1000 years you might crack it.
Regards,
Nish
"I'm a bit bored at the moment so I'm thinking about writing a new programming language" - Colin Davies
My book :- Summer Love and Some more Cricket [New Win]
Review by Shog9 Click here for review[NW]
|
|
|
|
|
Ahh thanks a lot! i get it now
pretty nifty
Kuniva
--------------------------------------------
|
|
|
|
|
Kuniva wrote:
whats the private key?? i mean, ur browser generates a session key, its encrypted with a servers public key, but for ur browser to get a public key, it would have to be sent over the network too right?
SSL doesn't need private client keys. Session encryption uses symmetric cryptography - 3DES/AES/RC4. It works this way (simplified):
Clients asks server public key
Client generates symmetric session key, encrypts it with server public key and sends it
Now, the clients know the key because it made and server decrypted it.
For more, read my seminar on SSL at http://www.cs.tau.ac.il/~gartsma/websec.ppt[^]
|
|
|
|
|
I am trying to convert an image, which is bmp into a jpeg. With the use of the Image class from GDI+ i can convert this into jpeg with out any real problem, but at the moment i am passing a filepath to the image class, what i would really like to do is Pass the IStream into the constructor.
The reason for this is because i am using a method on directX to get back a bitmap, and at the mo i am having to save it to file before i can passit to the image class, if i could pass the IStream I would be able to do the covertion much faster with out creating an unecessary file.
Any help would be great..
|
|
|
|
|
this is a code I used to load a PNG image stored in the resources using Bitmap class and IStream, hope it could help you
HGLOBAL hGlb = NULL;
HRSRC hRs =
FindResource(AfxGetInstanceHandle(), MAKEINTRESOURCE(nID), "RT_PNG");
if(hRs)
{
ULONG size = SizeofResource(AfxGetInstanceHandle(), hRs);
hGlb = LoadResource(AfxGetInstanceHandle(), hRs);
HGLOBAL hStream;
void * pData, *pData2;
pData = LockResource(hGlb);
hStream = GlobalAlloc(GMEM_NODISCARD | GMEM_MOVEABLE, size);
IStream *ptrStream;
hr = CreateStreamOnHGlobal(hStream, true, &ptrStream);
ULONG dummy;
ptrStream->Write(pData, size, &dumm);
UnlockResource(hGlb);
m_ptrBm = Bitmap::FromStream(ptrStream);
ptrStream->Release();
}
else
{
int i = GetLastError();
return;
}
the PNG image resource is a full PNG image file just stored in the memory.
|
|
|
|
|
Hi,
I am trying to manipulate a List Control at the cell level, trying to have let's say different cell width and heights in the same row.
Can this be done, or does anyone know how to do it?
THanks in advance.
|
|
|
|
|
I encountered same prob a year ago. I don't think there's a way. I also needed to use different fonts for each cell. Best bet is to use third party windows, i.e. grid controls etc.
You can easily modify the width of each cell independently of each other though.
|
|
|
|
|
Yes, you can control all aspects of the painting of each "cell" in a list view (reportmode). You need to use the LVS_OWNERDRAWFIXED style when creating it. Then, in your DrawItem handler, either call the default method for cells you are not interested in custom drawing, and paint the cell yourself for those that you want to control. See LVS_OWNERDRAWFIXED in the doc.
|
|
|
|
|