|
eggie5 wrote: What, am I still confused?
I think I am at this point.
I assumed you DIDN'T have access to header and/or def files since you wanted to look right
in the DLL for that information. Having those files makes it way easier since DLLs aren't self-
describing like managed asemblies.
Based on my assumption, i figured you were being sarcastic saying thanks for pointing me in the
right direction. Therefore, I laughed
Mark
|
|
|
|
|
|
APPLIES TO
• The Microsoft Library Manager (LIB.EXE), when used with:
Microsoft Visual C++ 2.0 Professional Edition
Microsoft Visual C++ 2.1
Microsoft Visual C++ 4.0 Standard Edition
Microsoft Visual C++ 5.0 Standard Edition
|
|
|
|
|
Still applies DLLs have been around a while.
So have those tools.
Mark
|
|
|
|
|
eggie5 wrote: How can I peek into the unmanaged dll to see a signature of the methods?
With undname.exe.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
I just tried this: undname C:\vws\usb.dll and it stated to output a bunch of jibbersh to the console and sounding my computer's internal speaker... Any idea on how to use this with C:\vws\usb.dll?
/\ |_ E X E GG
|
|
|
|
|
eggie5 wrote: Any idea on how to use this with C:\vws\usb.dll?
Well, first you need to get the mangled names from usb.dll (use either depends or dumpbin). Then you can unmangle those using undname.exe.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Well, I wish they were mangled! All I have is a method name, no underscores or jibberish...
/\ |_ E X E GG
|
|
|
|
|
eggie5 wrote: dependency walker and pe explorer and those enable me to see what methods are inside the dll but neither of them provide information regarding the parameters or return types.
Are you seeing the C++ decorated names ?@@LikeThis@Z or plain names _LikeThis ? If the former, Depends has a button labeled "C++" that unmangles the names so you can see the entire prototype. If it's the latter, there's no way to reconstruct the prototype, you'll need to get documentation for the DLL that says how to call the exported functions.
|
|
|
|
|
Neither! I don't even get an underscore. Anybody every heard of a library USB.dll with these methods?
USBCheck
USBClearDeviceBuffer
USBClose
USBGetError
USBGetStatus
USBOpen
USBRead
USBSetSerial
USBStopSerial
USBWrite
/\ |_ E X E GG
|
|
|
|
|
I was looking thought this library in the dissembler(pe explorer) and noticed that USBOpen is just a wrapper for doing standard USB HID stuff. But I really dont know what I'm looking at, all I can make sense of is the calls to windows API functions like CreateFile...
If anybody wants to take a look and give me info, the .dll is here:
http://www.wpmc2006.org/uploads/usb.dll[^]
I really need to know what USBRead is doing. Also, USBSetSerial is really strange, I have no idea what that could be....
PS. this is all for a weather station (Oregon scientific wmr100a). I'm trying to talk to it via C#.
Right now I can read data from the device, but it's strange 'cause the HID class says that the report length is only 9 wide, now why would a weather station with 100s of readings only return 9 numbers per read? I know this is weird because it comes with weather station software (it's using usb.dll) and it is getting all kinds of readings, so i'm thinking it's not sticking to the HID standard and just using that so it doesn't nag for drivers when you plug it into windows.... but i really don't know.
/\ |_ E X E GG
|
|
|
|
|
Million thanks for your mail. I need an advice on how to write C++ codes for Runge-Kutta algorithm to colve four first-order ODE. I am able to write Runge-Kutta code to solve just only one Differential equation but i'm haing problem with 4 at a time.
The equations are
dQ1/dt = w1
dw1/dt = (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);
}
dQ2/dt = w2
dw2/dt = (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)
The following are constants
#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
#define h (double) 0.01;
Thanks for your help.
Regards,
SKG!
skg
|
|
|
|
|
sahoong wrote: ...but i'm haing problem with 4 at a time.
Are you wanting to solve them simultaneously (i.e., multiple threads)?
BTW, there is no need to create multiple posts for the same question.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
If someone emailed you, you should email them back.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Dear Chris,
Sorry, I thought I have emailed you back.
Unfortunately, the equation that I typed with MS Word editor is still not showing despite the fact that I checked the ignore the html text editor box.
Could you please, answer this question for me
Is it necessary to create a constructor when you are dealing with things like mathematical formulae that involves using classes?
Thanks for your prompt response.
Regards,
SKG!
skg
|
|
|
|
|
Check "ignore HTML tags" to preserve angle brackets, please.
A cynic is a man who, when he smells flowers, looks around for a coffin. -H.L. Mencken
|
|
|
|
|
I'm developing a MFC application using ADO to connect to a local SQL Server database.
And I have troubles catching the exceptions.
Here is my connection code:
const LPCSTR STRING_CONNECTION = "Provider=SQLOLEDB;User ID=sa;Initial Catalog=Northwind;Data Source= (local); Integrated Security=SSPI;";
<br />
BOOL Connect(_ConnectionPtr& pCone)<br />
{<br />
_bstr_t bstrCone(STRING_CONNECTION); <br />
<br />
try<br />
{<br />
<br />
pCone.CreateInstance (__uuidof(Connection));<br />
<br />
pCone->Open (bstrCone ,_bstr_t (""), _bstr_t (""), adModeUnknown );<br />
<br />
return TRUE;<br />
}<br />
catch (_com_error* ce)
{<br />
watch_com_error(ce); <br />
return FALSE;<br />
}<br />
<br />
<br />
}<br />
<br />
<br />
void watch_com_error(_com_error *e)<br />
{<br />
CString msgErr; <br />
_bstr_t bstrSource= e->Source(); <br />
_bstr_t bstrDescri=e->Description(); <br />
<br />
msgErr.Format (_T("ADO - COM Error\n\tCode = %08lx\n\tSource = %s\n\tDescription = %s\n"),<br />
e->Error(),(LPCSTR)bstrSource, (LPCSTR)bstrDescri);<br />
<br />
msgErr.Format (_T("ADO - COM Error\n\tCode = %08lx\n\tSource = %s\n\tDescription = %s\n"),<br />
e->Error(),(LPCSTR)bstrSource, (LPCSTR)bstrDescri);<br />
<br />
AfxMessageBox( msgErr, MB_OK | MB_ICONERROR );<br />
<br />
}<br />
<br />
<br />
The connection works. The problem is handling exceptions.
If I change the string connection to force a COM ERROR, it throw an unhandled exception instead of reach the _com_error handle.
And if I change the _com_error catch by a CException object to intercept generics exceptions, it still throwing an unhandled exception.
What is wrong here?
Demian.
"I have always wished that my computer would be as easy to use as my
telephone. My wish has come true. I no longer know how to use my telephone."
-Bjarne Stroustrup, computer science professor, designer of C++
programming language (1950- )
|
|
|
|
|
Add another catch block with ... parameters (unless you can find out exactly what type of exception is being thrown):
try
{
pCone.CreateInstance (__uuidof(Connection));
pCone->Open (bstrCone ,_bstr_t (""), _bstr_t (""), adModeUnknown );
return TRUE;
}
catch (_com_error* ce)
{
watch_com_error(ce);
return FALSE;
}
catch (...)
{
return FALSE;
}
Also, check to make sure that ADO is throwing a pointer and not a _com_error& reference (I can't remember which it does off hand).
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
Yes Zac, you are right!.
Wrong type, it's a reference instead a pointer.
Thank you very much.
Kind regards.
Demian.
"I have always wished that my computer would be as easy to use as my
telephone. My wish has come true. I no longer know how to use my telephone."
-Bjarne Stroustrup, computer science professor, designer of C++
programming language (1950- )
|
|
|
|
|
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
//#include
//#include
//#include
//#include
//#include
// Precompiler Directives
#include
#include
// 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
skg
|
|
|
|
|
Damn...and I WAS feeling all smart and stuff this morning.
I knew I should have taken a computer science class in college.
Mark
|
|
|
|
|
sahoong wrote: For further explanation or clarification, please, mail me to olaskg@yahoo.ie.
Are you nuts? This is a forum for you to ask/answer questions. We don't go looking for you! Post your question. Be as exact as possible. Include only relevant code snippets.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
|
We have too feeble minds to comprehend him. I bet he's laughing at us right now.
--
Verletzen zerfetzen zersetzen zerstören
Doch es darf nicht mir gehören
Ich muss zerstören
|
|
|
|
|
For a client application, after sending a string to the server,
I want to receive 2 strings from the server separately.
But the second recv() call quite often receive NULL.
How can I solve this problem?
(give a delay for it is sometimes better, but NOT always work)
Thanks!
|
|
|
|