|
Yes, and thats exactly the question.
How easy is it to do that? Is it practically impossible or relatively fairly simple.
If it has been done before (ever) then I probably do not want to expose a core component of the system as a dll (or even an encrypted dll).
Also can I still compile a dll in VC 6 and then encrypt it later or do I have to use
.NET to encrypt it at each build?
Can anyone provide a link to dll Securing for .NET?
|
|
|
|
|
flip wrote:
How easy is it to do that? Is it practically impossible or relatively fairly simple.
Fairly impossible would be an understatement . It is extremely difficult.
I haven't ever tried to encrypt a DLL, and I haven't used .NET, so I can't help with the rest
Ryan
Being little and getting pushed around by big guys all my life I guess I compensate by pushing electrons and holes around. What a bully I am, but I do enjoy making subatomic particles hop at my bidding - Roger Wright (2nd April 2003, The Lounge)
Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late - John Nichol "Point Of Impact"
|
|
|
|
|
How easy is it to do that? Is it practically impossible or relatively fairly simple.
R - Fairly impossible would be an understatement . It is extremely difficult.
Ok good. Thats what I thought.
R - I haven't ever tried to encrypt a DLL, and I haven't used .NET, so I can't help with the rest
Same here.
I am trying to avoid .NET since nothing in the program needs it.
If I was using .NET technologies - then things would be different.
I just dont see the need to have to switch over to .NET just to ensure the dlls are
encrypted when I am happy with VC 6.
Ryan
|
|
|
|
|
There's an article here on CP somewhere about encrypting an EXE file. Perhaps you could modify that to work with a DLL...
Ryan
Being little and getting pushed around by big guys all my life I guess I compensate by pushing electrons and holes around. What a bully I am, but I do enjoy making subatomic particles hop at my bidding - Roger Wright (2nd April 2003, The Lounge)
Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late - John Nichol "Point Of Impact"
|
|
|
|
|
As Ryan said you have to disassemble the DLL code to find the number of parameters. There are certain patterns to determine the number of parameters, for instance before a function is called, its parameters are pushed into the stack
push eax<br />
push ecx<br />
call DllFunc
which in C++ translates to DllFunc( ecx, eax).
At the end of the function you could have something like this:
ret 000X - where X is a number (4, 8, C etc.), which will tell you the number of parameters, and 4 means one parameter, 8 means two and so on.
After the function has returned, if you see code like this:
add esp, 0X - where X again is a number that tells you the number of parameters. This is an adjustment done to the stack after a function returns.
There are more hints out there but you have to study some assembly to figure out most of them.
Finding the types of those arguments is very difficult and sometimes impossible. You need to know something about the function.
// Afterall, I realized that even my comment lines have bugs
When one cannot invent, one must at least improve (in bed).-My latest fortune cookie
|
|
|
|
|
Toni78 wrote:
push eax
push ecx
call DllFunc
which in C++ translates to DllFunc( ecx, eax).
Sometimes, but not always. I've looked at the output from some compilers, and sometimes they push the registers simply to save their value across the function call. I don't think this happens with the MS compiler, but other compilers do it. Also, the compiler may perform processing in between the pushes, and it may use the stack for doing that processing, so it can be very complex. But I agree, looking at the instructions before the call is the easiest way.
The problem is that in his situation he want to know if you can work out the parameters from the DLL - no calling code. That is substantially more difficult because you have to look at what each parameter is used for and what is done with them. And then, as you said, finding the types of the parameters is almost impossible
Ryan
Being little and getting pushed around by big guys all my life I guess I compensate by pushing electrons and holes around. What a bully I am, but I do enjoy making subatomic particles hop at my bidding - Roger Wright (2nd April 2003, The Lounge)
Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late - John Nichol "Point Of Impact"
|
|
|
|
|
Ryan Binns wrote:
Sometimes, but not always.
I couldn't agree more. However, I was just trying to give him some pointers and I thought this could help.
When it comes to the types of the parameters, simple data types such as int, char, char*, etc can be detected "easily" but structures and classes are such a pain (or undetectable).
// Afterall, I realized that even my comment lines have bugs
When one cannot invent, one must at least improve (in bed).-My latest fortune cookie
|
|
|
|
|
I was currently reading an article in my linux mag about the wonderful uses of the assert function. I personally use this function and variations of it a lot. My question arises when I caught a side bar of the article about some preprocessor macros.
The sidebar explains how assert is so great because of the __LINE__ and __FILE__ macros. However it also explains two useful macros that are available under the GNU C compiler. __FUNCTION__ and __PRETTY_FUNCTION__. The first being for C compilers it returns the functions name. Since C++ mangles function names do to overloading the second returns the full function name (i.e. "void CMyClass::myfunc(int, double)" ). However these do not seem to be available under Microsoft's or Borland's compiler, and a long search through MSDN doesn't reveal anything similar. Is there a way to produce similar output with the MS compiler?
|
|
|
|
|
A good place to start is current_function.hpp in the boost library. Boost tends to be a good place to start for information and patterns which work around differences in compilers.
#ifndef BOOST_CURRENT_FUNCTION_HPP_INCLUDED
#define BOOST_CURRENT_FUNCTION_HPP_INCLUDED
#if _MSC_VER >= 1020
#pragma once
#endif
namespace boost
{
namespace detail
{
inline void current_function_helper()
{
#if defined(__GNUC__) || (defined(__MWERKS__) && (__MWERKS__ >= 0x3000))
# define BOOST_CURRENT_FUNCTION __PRETTY_FUNCTION__
#elif defined(__FUNCSIG__)
# define BOOST_CURRENT_FUNCTION __FUNCSIG__
#elif defined(__BORLANDC__) && (__BORLANDC__ >= 0x550)
# define BOOST_CURRENT_FUNCTION __FUNC__
#elif defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901)
# define BOOST_CURRENT_FUNCTION __func__
#else
# define BOOST_CURRENT_FUNCTION "(unknown)"
#endif
}
}
}
#endif // #ifndef BOOST_CURRENT_FUNCTION_HPP_INCLUDED
If you can keep you head when all about you
Are losing theirs and blaming it on you;
If you can dream - and not make dreams your master;
If you can think - and not make thoughts you aim;
Yours is the Earth and everything that's in it.
Rudyard Kipling
|
|
|
|
|
__FUNCTION__ is available in VS.NET; it returns the undecorated name of the function.
|
|
|
|
|
Hey everyone, I just wanted to inform you of a great great website that really helped me out with reading and writing to the registry using C++. It took me many hours to find a website with simple explanations and examples like this.
http://www4.ncsu.edu:8030/~jgbishop/codetips/general/registry_access_advanced.html
Check it out...
|
|
|
|
|
I have a book on C++, but it does not explain structures and classes very well. Could someone please tell me what they are, what they're used for, and the differences between them?
Thanks a lot.
|
|
|
|
|
Take a look here for structures and here for classes. At the most basic level, structures are an old C-concept and just contain data, whilst a class is C++ and contains both data and functions relevant to that data. Classes also provide for the whole object-oriented design, so go with them where possible.
|
|
|
|
|
i want to show a dialog in regular dll which is dynamicaly linked to mfc.
the exported func is :
//dynamicly
extern "C" __declspec( dllexport ) void Trade1()
{
AFX_MANAGE_STATE(AfxGetStaticModuleState())
CDlgLogon dlg;
dlg.DoModal ();
}
which does not work.
if i set the dll staticly linked to mfc .it works well
//staticly
extern "C" __declspec( dllexport ) void Trade1()
{
CDlgLogon dlg;
dlg.DoModal ();
}
is that means i can't use mfc in static library?
gucy
|
|
|
|
|
Where is your dialog template? In the DLL or in the application. The second one (which you said works) would load it from the application, but the first one (which you said doesn't work) would try to load it from the DLL, and should work if the dialog template was in the DLL.
If you want the first one to work, the dialog template must be in the DLL, not in the application.
Ryan
Being little and getting pushed around by big guys all my life I guess I compensate by pushing electrons and holes around. What a bully I am, but I do enjoy making subatomic particles hop at my bidding - Roger Wright (2nd April 2003, The Lounge)
Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late - John Nichol "Point Of Impact"
|
|
|
|
|
hi,
The dialog template is in dll in both of the two funcion.
gucy
|
|
|
|
|
If you use AFX_MANAGE_STATE() in the bottom one, does it still work?
Ryan
Being little and getting pushed around by big guys all my life I guess I compensate by pushing electrons and holes around. What a bully I am, but I do enjoy making subatomic particles hop at my bidding - Roger Wright (2nd April 2003, The Lounge)
Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late - John Nichol "Point Of Impact"
|
|
|
|
|
yes,if i add the macro to the second one,it still work.it does not depent on the macro.
gucy
|
|
|
|
|
Hmmm. I can't help much more - I'm not an expert on DLLs. Have a look at MFC technical note TN058 which explains module state switching in detail.
As far as I can see, the first one should work .
Ryan
Being little and getting pushed around by big guys all my life I guess I compensate by pushing electrons and holes around. What a bully I am, but I do enjoy making subatomic particles hop at my bidding - Roger Wright (2nd April 2003, The Lounge)
Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late - John Nichol "Point Of Impact"
|
|
|
|
|
If I get an updated version on an ActiveX control...
What steps do I need to take in order to re-insert the control on a dialog, such that ClassWizard will generate updated wrapper classes of the SAME name as I'm currently using?
Thanks bunches!
There's no such thing as a bad beer... some are just better than others.
|
|
|
|
|
Create another project and add the ActiveX control to make wrapper class.
and overwrite old one.
that's all.
have a nice day~
|
|
|
|
|
If I already have a control added to the dialog and saved before updating hte version, after the update I got an error that the control could not be loaded in the same state when it was last saved. How to solve this issue?
|
|
|
|
|
I know with the following statement, I can open outlook with email address (abc@abc.com) already set up:
ShellExecute(
NULL,
"open",
"mailto:abc@abc.com",
NULL,
"",
SW_SHOWNORMAL
);
Is there any way to set up content just like email address prior to open outlook? Thank you.
|
|
|
|
|
"mailto:abc@abc.com?Subject=SomeSubject&Body=whatever..."
As far as I can remember
- Anders
Money talks, but all mine ever says is "Goodbye!"
|
|
|
|
|