|
earlgraham wrote: My question is, “Is he right?” Can my code be stolen and used since the .dll will need to be released with the main application?
Any dll can be used by your opposition. Just as you can p/invoke to call Win32 APIs in C#, or use LoadLibrary to use an API that you don't have the headers for, the only issue is discovery of the methods available from a dll, unless you have some sort of protection in place ( such as passing a token which acts as a password ).
.NET code can, by definition, be decompiled, which increases your exposure for sure. There are measures you can take, such as obsfucation, but you can't stop it. And, of course, decompilation means that any security measures you take can be circumvented.
Having said that, if they use your dll directly, you'd find out about it. If they stole your code, that would be harder, but if you write good, small methods, obsfucated code may be painful to use in that way.
The real question is, how far do you have to go to stop it being worth their while, how unique/difficult/valuable is the code in question ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Thanks. I was afraid if this. It would have helped a lot if I could have worked it out.
Thanks again
Glenn
Programmer
Glenn Earl Graham
Austin, TX
|
|
|
|
|
Sorry - it's the one big issue with .NET, obsfucation does help, but the really solid libraries in this regard also cost a bomb.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Hi all,
In VS2005, I'm trying to debug a C++ dll, called from a tiny VB test app - but when I 'Go' (F5), my breakpoints are disabled - the Output window tells me No symbols loaded for my Interop.fubar.dll (where fubar is my dll name) -
I've built the dll with Debug options - Is there something else I have to tell VS2005 to load its symbols??
thanx!
~ Mike
|
|
|
|
|
Hello,
Im not sure about Vb but in a c# project you need tick the "Enable unmanaged code debugging" option in the debug section of the project properties. Im sure its something similar
|
|
|
|
|
This did it - thanx muchly!
~ Mike
|
|
|
|
|
The codes that I have written so far is below:
// Simulation of the Dynamics of a 2-Link Pan-Tilt Robotic Manipulator
/* This programme calculates the Velocity, Acceleration and the angles of inclination
of the two links of the Spherical Pointing Motor, which is essentially a Two-Link Robotic
Manipulator*/
//#include <basis.h>
//#include <assert.h>
//#include <string.h>
//#include <iostream.h>
//#include <iomanip.h>
//#include <fstream.h>
// Precompiler Directives
#include <math.h>
#include <stdlib.h>
// Constants Declaration
#define n (int) 2
#define m1 (float) 0.05
#define m2 (float) 0.03
#define r1 (float) 0.04
#define r2 (float) 0.06
#define ra (float) 0.04
#define rb (float) 0.06
#define l (float) 0.05
#define d (float) 0.02
#define acc_due_gravity (float) 9.81
class AngVel1
{
public:
};
class AngAccln1
{
public:
};
class AngVel2
{
public:
};
class AngAccln2
{
public:
}
/*
n = Number of Links = 2
m1 = Mass of the First Link (The Annulus)
m2 = Mass of the Second Link
r1 = Inner Radius of Link 1 (The Annulus)
r2 = Outer Radius of Link 1 (The Annulus)
ra = Outer Radius of the Annulus
rb = Inner Radius of the Annulus
l = Half the Lenght of Link 1
d = Displacement from the Centre of Mass
g = Acceleration due to gravity = 9.81
t = time in seconds
*/
// Declaration of variables (Robot Parameters)
float t;
// Prototypes
float TorqueVal(float t);
double Runge_Kutta ();
double AngVel1 (double om1){
return om1;
}
double AngAccln1 (double t, double om1, double tetha1, double tetha2){
t = 0.1;
return (tau1 - 2*m2(r2*r2/4 -h2*h2/3 -d*d) * om1*om2*sintetha2*costetha2 - m2*g*d*costetha1*costetha2)/
om1*(m1(ra*ra + rb*rb)/4 + m1(h1*h1)/3 + m2((r2*r2)(1+sinsqtetha2)/4 + m2*h2*h2*cossqtetha2/3 + m2*d*d*cossqtetha2);
}
double AngVel2 (double om2){
return om2;
}
double AngAccln2 (double t, double om1, double om2, double tetha1, double tetha2){
t=0.4;
return (tau2 + (m2(r2*r2/4 -h2*h2/3 -d*d)*om1*om1*sintetha2*costetha2) - m2*g*d*sintetha1*sintetha2)/
om2*m2(r2*r2/4 + h2*h2/3 + d*d;
double RK(double y){
double k1,k2,k3,k4;
k1=h*fn(y);
k2=h*fn(y+(k1/2.0));
k3=h*fn(y+(k2/2.0));
k4=h*fn(y+k3);
return y+(k1/6.0)+(k2/3.0)+(k3/3.0)+(k4/6.0);
}
// The Main Routine
int main()
{
// Torque Function
float TorqueVal1(float t)
{
t = 0.1;
return t;
}
// Runge-Kutta Function
double RK(double y){
double k1,k2,k3,k4;
k1=h*fn(y);
k2=h*fn(y+(k1/2.0));
k3=h*fn(y+(k2/2.0));
k4=h*fn(y+k3);
return y+(k1/6.0)+(k2/3.0)+(k3/3.0)+(k4/6.0);
}
double RK(double l){
double v1,v2,v3,v4;
v1=h*fn(l);
v2=h*fn(l+(k1/2.0));
v3=h*fn(l+(k2/2.0));
v4=h*fn(l+k3);
return l+(v1/6.0)+(v2/3.0)+(v3/3.0)+(v4/6.0);
}
}
i am attempting to simulate the dynamics of a 2-link pan-tilt robot. Two second order ODE were generated. As a requirement of the Runge-Kutta, each of the two second-order ODE was converted to 2 first order ODE thereby making four equations in all.
I was not using a class before and I just started packing the four equation into classes.
For further explanation or clarification, please, mail me to olaskg@yahoo.ie.
Thank you.
skg
|
|
|
|
|
1 - check the Ignore HTML tags when you post code
2 - when posting C++ code, don't use the managed C++ forum, use the visual c++ one
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Hello,
I am trying to import a function from fortran and using it in a windows form.
I export the function like always:
MODULE FORTRANMOD<br />
PUBLIC DllFortranTest<br />
CONTAINS<br />
INTEGER FUNCTION DllFortranTest<br />
!DEC$ ATTRIBUTES DLLEXPORT::DllFortranTest<br />
...<br />
END FUNCTION DllFortranTest<br />
<br />
END MODULE FORTRANMOD
and I import the funcion in C like always also
__declspec (dllimport) int FORTRANMOD_mp_DLLFORTRANTEST();
But when I'm going to use it:
int i = FORTRANMOD_mp_DLLFORTRANTEST();
I get the following errors linking:
1>FortranForm1.obj : error LNK2031: unable to generate p/invoke for "extern "C" int __clrcall FORTRANMOD_mp_DLLFORTRANTEST(void)" (?FORTRANMOD_mp_DLLFORTRANTEST@@$$J0YMHXZ); calling convention missing in metadata
1>FortranForm1.obj : error LNK2028: unresolved token (0A000006) "extern "C" int __clrcall FORTRANMOD_mp_DLLFORTRANTEST(void)" (?FORTRANMOD_mp_DLLFORTRANTEST@@$$J0YMHXZ) referenced in function "private: void __clrcall ConFortran::Form1::ComunicacionFortran(void)" (?ComunicacionFortran@Form1@ConFortran@@$$FA$AAMXXZ)
1>FortranForm1.obj : error LNK2019: unresolved external symbol "extern "C" int __clrcall FORTRANMOD_mp_DLLFORTRANTEST(void)" (?FORTRANMOD_mp_DLLFORTRANTEST@@$$J0YMHXZ) referenced in function "private: void __clrcall ConFortran::Form1::ComunicacionFortran(void)" (?ComunicacionFortran@Form1@ConFortran@@$$FA$AAMXXZ)
I have also try to use:
using namespace System::Runtime::InteropServices;
and
[DllImport("dllfortranTest.dll")]<br />
static int DllFortranTest();
But I get the exception:
An unhandled exception of type 'System.EntryPointNotFoundException' occurred in ConFortran.exe<br />
<br />
Additional information: Unable to find an entry point named 'DllFortranTest' in DLL 'dllfortranTest.dll'.
Can somebody help me about the importation way of work???
Best regards
-- modified at 7:08 Wednesday 18th October, 2006
|
|
|
|
|
Hi guys
I have been working on a project for several months now and it is almost finished all i need is some kind of security so that only the people that buy my software will be able to run it although when they first run it, it will display a key(which is their hardware drive serials, encrypted though) and then they will need to send that code to me so that i decrypt the data and send them a key that will work(any kind of key, for ex. when they send their key to me then i will use another proggy that i make and use that proggy to maybe add something to their serial like a few digits or a code at the end of their serial then send it back to them) what i need to know though is how to encrypt their hardware drive serial then make an algorith that can recognize the modified serial(that i will send to them once they send their serial to me) and make the program start up. I also need some kind of limit maker so that someone can only use it for a limited amount of time(1 year lets say) then after the time has expired it will display a message box saying they have to renew their serial.
Soething of this kind would be really good.
So could someone please direct me to such a tut or maybe reply with some useful info?
Thanks in advance
Cyclone
|
|
|
|
|
Do you need these things in managed C++, or are you in the wrong forum ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Hi all,
Anyone familiar with ms RTC Client API?
Got the following issue:
- initialize the client with InitializeEx(RTCIF_DISABLE_MEDIA); (call it client A)
- login with other account to office communicator
- from office comm, send a message to client A
Office communicator complains about not being able to send the message.
I tried replying with IRTCSession2->AnswerWithSessionDescription() but didn't work either.
Discover beauty in whatever you're doing
|
|
|
|
|
Looks to me like you want the Visual C++, not the managed C++ forum ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Yes,
It's Visual C++.
Thanks
Discover beauty in whatever you're doing
|
|
|
|
|
I recommend asking in the right forum then
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Yeah,
I created a similar message in the "Visual C++/MFC" forum
Cristi
Discover beauty in whatever you're doing
|
|
|
|
|
Hi,
I am busy searching, but I'm not sure, what I need to "register" all methods of the main program class, build a console host for that app and:
1. make it posible for the console host to autocomplete the method name when the user types the beginning of the method name and presses [tab]?
2. have one invoking point for all methods, passing the method name as a string parameter - something like
RunMethod(System::String methodName) . Should I use attributes? Delegates?
Any hints appreciated.
Thanks,
nj
-- modified at 5:53 Tuesday 17th October, 2006
(added to title)
|
|
|
|
|
I want to convert "abcd" into ASCII code
but I met a strange problem. My code is below.
<br />
char *s="abcd";<br />
int br[100];<br />
for(int i=0;i<4;i++)<br />
{<br />
br[i]=__toascii(s[i]);<br />
cout << br[i] << "\n";<br />
}<br />
string kkb=""; <br />
kkb=kkb.insert(0,br[1].ToString());<br />
cout << kkb;<br />
and there is an error at kkb=kkb.insert(0,br[1].ToString());
error C2664: 'std::basic_string<_Elem,_Traits,_Ax> &std::basic_string<_Elem,_Traits,_Ax>::insert(__w64 unsigned int,const std::basic_string<_Elem,_Traits,_Ax> &)' : cant convert argument 2 from 'System::String ^' to 'const std::basic_string<_Elem,_Traits,_Ax> &'a
It's very strange that I change the code
kkb=kkb.insert(0,br[1].ToString());
into
kkb=kkb.insert(0,"a string");
then it works.
I dont understand that both them are string.
why as long as I put the string variable int the function, it has an error?
Can somebody help me?
Thanks a lot.
minihotto
|
|
|
|
|
I'd recommend using sprintf or ( better ) ostringstream to do this. That would also make all your code C++, instead of the one reference to the .NET libraries.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
hello everybody !!
my new problem is that i have a class that contain a some functions and some variables
i want to execute one of these functions in a separate thread using AfxBeginThread(...);
and FYI this function uses some member variables of the class to do it's work
any idea ???
thnx 4 ur time and concern
a.hemdan
|
|
|
|
|
This is a Visual C++ question, not a managed C++ question. Ask in the right forum, and you'll get lots of help./
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Hi,
I want to obtain the pixel value of any pixel on the form (dialog) during mouse move.
In MFC, i can get the pixel value using
CDC *pDC = this->GetDC();<br />
COLORREF clr = pDC->GetPixel(x,y);
ReleaseDC(pDC);
How do i do the same using managed C++.
I added an event OnMouseMove, and i can get the pixel coordinate using
e->X and e->Y;
How do i get the pixel value? I tried this
Graphics ^g = this->CreateGraphics();
then i do not know what else to do...
Usman
|
|
|
|
|
You can still use the old code in managed C++, it's still C++.
In GDI+, the graphics object doesn't offer a get pixel method, the Bitmap class does instead. I'm not sure how to get a bitmap that represents the current screen, without doing a screen capture ( by which time, you've had the screen in a DC and could have just called GetPixel )
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
I need to get the pixel value each time the mouse is moved. Taking a full screen capture will be slow. Thus, as you have suggested, i used the unmanaged C++ code. It works, but what i'm afraid of is that the transition to and from unmanaged code will cause performance degradation. That's why i needed a pure managed solution. Anyway, since there is no managed way of doing it, i'm using the unmanaged way;
Graphics ^g = this->CreateGraphics();<br />
System::IntPtr p = g->GetHdc();<br />
HDC hdc = (HDC) p.ToPointer();<br />
<br />
COLORREF clr = GetPixel(hdc,x,y);
|
|
|
|
|
Oh, thanks by the way
|
|
|
|
|