|
Ok Solved.
My mistake was a command in the
CAsyncFilter::Load(LPCOLESTR lpwszFileName, const AM_MEDIA_TYPE *pmt)
function that is changing the absolute offset inside the file !!! I added that, for debugging purposes and I forgot to delete it when I reloaded the project a few days later.
So it was a read error !
Thank you.
PS : I was looking for that error one month now ! Oh God !!!
sdancer75
|
|
|
|
|
I have a process that some how fail at Initialization
it is a MFC C++ app so I inserted a __debugbreak at the first possible instance
which would be CWinAPP constructer the code starts but never seems to reach that point
(probably something to do with the build)
When I run this app from task manager I see it start and then it disappears
The Program when Initialized display a Main Window
I originally started this program using CreateProcess I get a return code 1 inidicating sucesss
but like I said it dies at initialization
When I run this program using "Start Debugging" from the Visual Studio IDE it seems to performs
properly
I am thinking That I use CreatePrcess with the DEBUG_PROCESS flag to get a better handle on
The problem
I appreciate any help
Thank you
|
|
|
|
|
Try to log the startup sequence by some log mechanism, like OuputDebugString() or File write.
Is there any chance to have code which will run in Release mode?
Any code which is written by compiler directive like #ifndef.
#ifndef _DEBUG
..
#endif
The following link may help you to find out this issue.
http://forums.codeguru.com/showthread.php?269905-Visual-C-Debugging-Why-does-program-work-in-debug-mode-but-fail-in-release-mode
In the debug build, if you have incorrect message handler signatures this doesnt cause any problems.
But MFC does a couple of naughty type casts in the message map macros. So when you build the same code in release mode, you are guranteed to run into trouble.
|
|
|
|
|
Let me clarify I run the VC debugger from
The release mode code along with the .pdb I am able to see what's going on
|
|
|
|
|
Yes it is possible to debug in release mode.
Details are given in the following link.
If an application works in a debug build, but fails in a release build, one of the compiler optimizations may be exposing a defect in the source code. To isolate the problem, disable selected optimizations for each source code file until you locate the file and the optimization that is causing the problem. (To expedite the process, you can divide the files into two groups, disable optimization on one group, and when you find a problem in a group, continue dividing until you isolate the problem file.)
http://msdn.microsoft.com/en-us/library/fsk896zz.aspx
|
|
|
|
|
Somewhere between the initlization and the CWinApp constructer the code
dies
I think using DEBUG_PROCESS flags will send events at everypoint till
the process is created
|
|
|
|
|
I have a client system, to create a CMainFrame object, but I am afraid that there will be memory leak about CMainFrame object.After step in, I cannot find where the m_pMainWnd pointer is deleted. Will I delete this pointer in the function
ExitInstance()?
BOOL CApp::InitInstance()
{
CMainFrame* pMainFrame = new CMainFrame();
if (!pMainFrame) return FALSE;
pMainFrame->LoadFrame(IDR_MAINFRAME,
WS_OVERLAPPEDWINDOW | FWS_ADDTOTITLE, NULL,
NULL);
m_pMainWnd = pMainFrame;
m_pMainWnd->UpdateWindow();
return TRUE;
}
int CApp::ExitInstance()
{
return CWinApp::ExitInstance();
}
|
|
|
|
|
yu-jian wrote: After step in, I cannot find where the m_pMainWnd pointer is deleted. It's handled automatically by the framework.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
|
|
|
|
|
Oh, sorry, I do not use the .net.
This is the unmanaged C++. I cannot see where the system delete this pointer in file appcore.cpp.
|
|
|
|
|
yu-jian wrote: Oh, sorry, I do not use the .net. What does that have to do with anything?
yu-jian wrote: This is the unmanaged C++. If you mean this is the unmanaged C++ forum, of course it is. Did something indicate otherwise?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
|
|
|
|
|
It is is deleted inside CFrameWnd::PostNcDestroy() (see winfrm.cpp) which is called by CWnd::OnNcDestroy which is the last member function called when the Windows window is destroyed.
|
|
|
|
|
Hello everyone,
I am trying to implement zero copy mechanism i.e. a contrary function to the TransmitFile() API.
But I don't know how to register buffers in kernel.Below are the details what I want to do to implement zero copy:
1.we will receive a large data from the server in our client buffer, i have a doubt here also that weather data will come to socket buffer(client's) or first it will come into NIC buffer,please clear this doubt also.
2.now from socket buufer i want to copy the data directly to the kernel buffer and then to file in the disc without going for read and write system calls i.e without switching contexts.
3.Data has to be moved directly to kernel buffer within kernel space only.
Is there any API or some method???? any suggestions???
|
|
|
|
|
|
So you want to take data direct over a network and write it to disk without going through huser mode.
Why, are you that concerned about performance? If you do it in massive chunks you wont be that badly affected.
If you really want to write a minifilter driver that can intercept the data intended for your socket and and have it do a ZwWriteFile then you are going to have to learn an awful lot of kernel stuff.
Of course I could do it in a day or so, since I know an awful lot of kernel stuff, but I wont tell you because it will take you about a year to get working and will cost you a lot of time and money.
Of course if you want it doing properly and relatively cheaply hire someone who knows.
|
|
|
|
|
sorry buddy....thankx for the hint(ZwWritefile).as I am a beginner its a little tough task to understand and implement it.I hope I got the hint correct,I mean i need to study zwwritefile?isn't it?
|
|
|
|
|
No no no no no. DOnt go near zwwritefile or the kernel, it will be impossible. Just take the data into user space in large chunks and write it to file from userspace in large chunks.
The cost of a few user-kernel transitions will not impact your performance unless you have a really really fast network and are moving huge amounts of data. If you really have to do it in the kernel then call in an expert.
|
|
|
|
|
hi everyone.. I have written a program where I want to return three user defined data types to the another main() function (here i have not mentioned that main). I want to return {Pa,c1,c2} from this program. Please help me out.
#include <cstdlib>
#include <iostream>
#include <vector>
using std:: cout;
using std:: cin;
using std:: endl;
using namespace std;
#include <math.h>
#include "FiniteFieldElement.hpp"
namespace Cryptography
{
template<int P>
class EllipticCurve
{
public:
typedef FiniteFieldElement<P> ffe_t;
class Point
{
friend class EllipticCurve<P>;
typedef FiniteFieldElement<P> ffe_t;
ffe_t x_;
ffe_t y_;
EllipticCurve *ec_;
void addDouble(int m, Point& acc)
{
if ( m > 0 )
{
Point r = acc;
for ( int n=0; n < m; ++n )
{
r += r;
}
acc = r;
}
}
Point scalarMultiply(int k, const Point& a)
{
Point acc = a;
Point res = Point(0,0,*ec_);
int i = 0, j = 0;
int b = k;
while( b )
{
if ( b & 1 )
{
addDouble(i-j,acc);
res += acc;
j = i;
}
b >>= 1;
++i;
}
return res;
}
void add(ffe_t x1, ffe_t y1, ffe_t x2, ffe_t y2, ffe_t & xR, ffe_t & yR) const
{
if ( x1 == 0 && y1 == 0 )
{
xR = x2;
yR = y2;
return;
}
if ( x2 == 0 && y2 == 0 )
{
xR = x1;
yR = y1;
return;
}
if ( y1 == -y2 )
{
xR = yR = 0;
return;
}
ffe_t s;
if ( x1 == x2 && y1 == y2 )
{
s = (3*(x1.i()*x1.i()) + ec_->a()) / (2*y1);
xR = ((s*s) - 2*x1);
}
else
{
s = (y1 - y2) / (x1 - x2);
xR = ((s*s) - x1 - x2);
}
if ( s != 0 )
{
yR = (-y1 + s*(x1 - xR));
}
else
{
xR = yR = 0;
}
}
Point(int x, int y)
: x_(x),
y_(y),
ec_(0)
{}
Point(int x, int y, EllipticCurve<P> & EllipticCurve)
: x_(x),
y_(y),
ec_(&EllipticCurve)
{}
Point(const ffe_t& x, const ffe_t& y, EllipticCurve<P> & EllipticCurve)
: x_(x),
y_(y),
ec_(&EllipticCurve)
{}
public:
static Point ONE;
Point(const Point& rhs)
{
x_ = rhs.x_;
y_ = rhs.y_;
ec_ = rhs.ec_;
}
Point& operator=(const Point& rhs)
{
x_ = rhs.x_;
y_ = rhs.y_;
ec_ = rhs.ec_;
return *this;
}
ffe_t x() const { return x_; }
ffe_t y() const { return y_; }
unsigned int Order(unsigned int maxPeriod = ~0) const
{
Point r = *this;
unsigned int n = 0;
while( r.x_ != 0 && r.y_ != 0 )
{
++n;
r += *this;
if ( n > maxPeriod ) break;
}
return n;
}
Point operator-()
{
return Point(x_,-y_);
}
friend bool operator==(const Point& lhs, const Point& rhs)
{
return (lhs.ec_ == rhs.ec_) && (lhs.x_ == rhs.x_) && (lhs.y_ == rhs.y_);
}
friend bool operator!=(const Point& lhs, const Point& rhs)
{
return (lhs.ec_ != rhs.ec_) || (lhs.x_ != rhs.x_) || (lhs.y_ != rhs.y_);
}
friend Point operator+(const Point& lhs, const Point& rhs)
{
ffe_t xR, yR;
lhs.add(lhs.x_,lhs.y_,rhs.x_,rhs.y_,xR,yR);
return Point(xR,yR,*lhs.ec_);
}
friend Point operator*(int k, const Point& rhs)
{
return Point(rhs).operator*=(k);
}
Point& operator+=(const Point& rhs)
{
add(x_,y_,rhs.x_,rhs.y_,x_,y_);
return *this;
}
Point& operator*=(int k)
{
return (*this = scalarMultiply(k,*this));
}
friend ostream& operator <<(ostream& os, const Point& p)
{
return (os << "(" << p.x_ << ", " << p.y_ << ")");
}
};
typedef EllipticCurve<P> this_t;
typedef class EllipticCurve<P>::Point point_t;
EllipticCurve(int a, int b)
: a_(a),
b_(b),
m_table_(),
table_filled_(false)
{
}
void CalculatePoints()
{
int x_val[P];
int y_val[P];
for ( int n = 0; n < P; ++n )
{
int nsq = n*n;
x_val[n] = ((n*nsq) + a_.i() * n + b_.i()) % P;
y_val[n] = nsq % P;
}
for ( int n = 0; n < P; ++n )
{
for ( int m = 0; m < P; ++m )
{
if ( x_val[n] == y_val[m] )
{
m_table_.push_back(Point(n,m,*this));
}
}
}
table_filled_ = true;
}
Point operator[](int n)
{
if ( !table_filled_ )
{
CalculatePoints();
}
return m_table_[n];
}
size_t Size() const { return m_table_.size(); }
int Degree() const { return P; }
FiniteFieldElement<P> a() const { return a_; }
FiniteFieldElement<P> b() const { return b_; }
template<int T>
friend ostream& operator <<(ostream& os, const EllipticCurve<T>& EllipticCurve);
ostream& PrintTable(ostream &os, int columns=4);
private:
typedef std::vector<Point> m_table_t;
m_table_t m_table_;
FiniteFieldElement<P> a_;
FiniteFieldElement<P> b_;
bool table_filled_;
};
template<int T>
typename EllipticCurve<T>::Point EllipticCurve<T>::Point::ONE(0,0);
template<int T>
ostream& operator <<(ostream& os, const EllipticCurve<T>& EllipticCurve)
{
os << "y^2 mod " << T << " = (x^3" << showpos;
if ( EllipticCurve.a_ != 0 )
{
os << EllipticCurve.a_ << "x";
}
if ( EllipticCurve.b_.i() != 0 )
{
os << EllipticCurve.b_;
}
os << noshowpos << ") mod " << T;
return os;
}
template<int P>
ostream& EllipticCurve<P>::PrintTable(ostream &os, int columns)
{
if ( table_filled_ )
{
int col = 0;
typename EllipticCurve<P>::m_table_t::iterator iter = m_table_.begin();
for ( ; iter!=m_table_.end(); ++iter )
{
os << "(" << (*iter).x_.i() << ", " << (*iter).y_.i() << ") ";
if ( ++col > columns )
{
os << "\n";
col = 0;
}
}
}
else
{
os << "EllipticCurve, F_" << P;
}
return os;
}
}
namespace utils
{
float frand()
{
static float norm = 1.0f / (float)RAND_MAX;
return (float)rand()*norm;
}
int irand(int min, int max)
{
return min+(int)(frand()*(float)(max-min));
}
}
using namespace Cryptography;
using namespace utils;
int main(int argc, char *argv[])
{
typedef EllipticCurve<263> ec_t;
ec_t myEllipticCurve(1,1);
cout << "A little Elliptic Curve cryptography example\nby Jarl Ostensen, 2007\n\n";
cout << "The elliptic curve: " << myEllipticCurve << "\n";
myEllipticCurve.CalculatePoints();
cout << "\nPoints on the curve (i.e. the group elements):\n";
myEllipticCurve.PrintTable(cout,5);
cout << "\n\n";
ec_t::Point P = myEllipticCurve[2];
cout << "some point P = " << P << ", 2P = " << (P+P) << "\n";
ec_t::Point Q = myEllipticCurve[3];
cout << "some point Q = " << Q << ", P+Q = " << (P+Q) << "\n";
ec_t::Point R = P;
R += Q;
cout << "P += Q = " << R << "\n";
R = P;
R += R;
cout << "P += P = 2P = " << R << "\n";
cout << "\nEC message encryption example\n===============================================\n\n";
ec_t::Point G = myEllipticCurve[0];
while( (G.y() == 0 || G.x() == 0) || (G.Order()<2) )
{
int n = (int)(frand()*myEllipticCurve.Size());
G = myEllipticCurve[n];
}
cout << "G = " << G << ", order(G) is " << G.Order() << "\n";
int a = irand(1,myEllipticCurve.Degree()-1);
ec_t::Point Pa = a*G;
cout << "Alice' public key Pa = " << a << "*" << G << " = " << Pa << endl;
int b = irand(1,myEllipticCurve.Degree()-1);;
ec_t::Point Pb = b*G;
cout << "Bob's public key Pb = " << b << "*" << G << " = " << Pb << endl;
int j = irand(1,myEllipticCurve.Degree()-1);;
ec_t::Point Pj = j*G;
cout << "Jane's public key Pj = " << j << "*" << G << " = " << Pj << endl;
cout << "\n\n";
int m1,m2;
cout << "Enter two message\n"<< endl;
cin >> m1;
cin >> m2;
cout << "Plain text message from Alice to Bob: (" << m1 << ", " << m2 << ")\n";
ec_t::Point Pk = a*Pb;
ec_t::ffe_t c1( m1*Pk.x() );
ec_t::ffe_t c2( m2*Pk.y() );
cout << "Encrypted message from Alice to Bob = {Pa,c1,c2} = {" << Pa << ", " << c1 << ", " << c2 << "}\n\n";
Pk = b*Pa;
ec_t::ffe_t m1d = c1/Pk.x();
ec_t::ffe_t m2d = c2/Pk.y();
cout << "\tBob's decrypted message from Alice = (" << m1d << ", " << m2d << ")" << endl;
Pk = j*Pa;
m1d = c1/Pk.x();
m2d = c2/Pk.y();
cout << "\nJane's decrypted message from Alice = (" << m1d << ", " << m2d << ")" << endl;
cout << endl;
}
|
|
|
|
|
hi everyone.. I have written a program where I want to return three user defined data types to the another main() function (here i have not mentioned that main). I want to return {Pa,c1,c2} from this program. Please help me out.
#include <cstdlib>
#include <iostream>
#include <vector>
using std:: cout;
using std:: cin;
using std:: endl;
using namespace std;
#include <math.h>
#include "FiniteFieldElement.hpp"
namespace Cryptography
{
template<int P>
class EllipticCurve
{
public:
typedef FiniteFieldElement<P> ffe_t;
class Point
{
friend class EllipticCurve<P>;
typedef FiniteFieldElement<P> ffe_t;
ffe_t x_;
ffe_t y_;
EllipticCurve *ec_;
void addDouble(int m, Point& acc)
{
if ( m > 0 )
{
Point r = acc;
for ( int n=0; n < m; ++n )
{
r += r;
}
acc = r;
}
}
Point scalarMultiply(int k, const Point& a)
{
Point acc = a;
Point res = Point(0,0,*ec_);
int i = 0, j = 0;
int b = k;
while( b )
{
if ( b & 1 )
{
addDouble(i-j,acc);
res += acc;
j = i;
}
b >>= 1;
++i;
}
return res;
}
void add(ffe_t x1, ffe_t y1, ffe_t x2, ffe_t y2, ffe_t & xR, ffe_t & yR) const
{
if ( x1 == 0 && y1 == 0 )
{
xR = x2;
yR = y2;
return;
}
if ( x2 == 0 && y2 == 0 )
{
xR = x1;
yR = y1;
return;
}
if ( y1 == -y2 )
{
xR = yR = 0;
return;
}
ffe_t s;
if ( x1 == x2 && y1 == y2 )
{
s = (3*(x1.i()*x1.i()) + ec_->a()) / (2*y1);
xR = ((s*s) - 2*x1);
}
else
{
s = (y1 - y2) / (x1 - x2);
xR = ((s*s) - x1 - x2);
}
if ( s != 0 )
{
yR = (-y1 + s*(x1 - xR));
}
else
{
xR = yR = 0;
}
}
Point(int x, int y)
: x_(x),
y_(y),
ec_(0)
{}
Point(int x, int y, EllipticCurve<P> & EllipticCurve)
: x_(x),
y_(y),
ec_(&EllipticCurve)
{}
Point(const ffe_t& x, const ffe_t& y, EllipticCurve<P> & EllipticCurve)
: x_(x),
y_(y),
ec_(&EllipticCurve)
{}
public:
static Point ONE;
Point(const Point& rhs)
{
x_ = rhs.x_;
y_ = rhs.y_;
ec_ = rhs.ec_;
}
Point& operator=(const Point& rhs)
{
x_ = rhs.x_;
y_ = rhs.y_;
ec_ = rhs.ec_;
return *this;
}
ffe_t x() const { return x_; }
ffe_t y() const { return y_; }
unsigned int Order(unsigned int maxPeriod = ~0) const
{
Point r = *this;
unsigned int n = 0;
while( r.x_ != 0 && r.y_ != 0 )
{
++n;
r += *this;
if ( n > maxPeriod ) break;
}
return n;
}
Point operator-()
{
return Point(x_,-y_);
}
friend bool operator==(const Point& lhs, const Point& rhs)
{
return (lhs.ec_ == rhs.ec_) && (lhs.x_ == rhs.x_) && (lhs.y_ == rhs.y_);
}
friend bool operator!=(const Point& lhs, const Point& rhs)
{
return (lhs.ec_ != rhs.ec_) || (lhs.x_ != rhs.x_) || (lhs.y_ != rhs.y_);
}
friend Point operator+(const Point& lhs, const Point& rhs)
{
ffe_t xR, yR;
lhs.add(lhs.x_,lhs.y_,rhs.x_,rhs.y_,xR,yR);
return Point(xR,yR,*lhs.ec_);
}
friend Point operator*(int k, const Point& rhs)
{
return Point(rhs).operator*=(k);
}
Point& operator+=(const Point& rhs)
{
add(x_,y_,rhs.x_,rhs.y_,x_,y_);
return *this;
}
Point& operator*=(int k)
{
return (*this = scalarMultiply(k,*this));
}
friend ostream& operator <<(ostream& os, const Point& p)
{
return (os << "(" << p.x_ << ", " << p.y_ << ")");
}
};
typedef EllipticCurve<P> this_t;
typedef class EllipticCurve<P>::Point point_t;
EllipticCurve(int a, int b)
: a_(a),
b_(b),
m_table_(),
table_filled_(false)
{
}
void CalculatePoints()
{
int x_val[P];
int y_val[P];
for ( int n = 0; n < P; ++n )
{
int nsq = n*n;
x_val[n] = ((n*nsq) + a_.i() * n + b_.i()) % P;
y_val[n] = nsq % P;
}
for ( int n = 0; n < P; ++n )
{
for ( int m = 0; m < P; ++m )
{
if ( x_val[n] == y_val[m] )
{
m_table_.push_back(Point(n,m,*this));
}
}
}
table_filled_ = true;
}
Point operator[](int n)
{
if ( !table_filled_ )
{
CalculatePoints();
}
return m_table_[n];
}
size_t Size() const { return m_table_.size(); }
int Degree() const { return P; }
FiniteFieldElement<P> a() const { return a_; }
FiniteFieldElement<P> b() const { return b_; }
template<int T>
friend ostream& operator <<(ostream& os, const EllipticCurve<T>& EllipticCurve);
ostream& PrintTable(ostream &os, int columns=4);
private:
typedef std::vector<Point> m_table_t;
m_table_t m_table_;
FiniteFieldElement<P> a_;
FiniteFieldElement<P> b_;
bool table_filled_;
};
template<int T>
typename EllipticCurve<T>::Point EllipticCurve<T>::Point::ONE(0,0);
template<int T>
ostream& operator <<(ostream& os, const EllipticCurve<T>& EllipticCurve)
{
os << "y^2 mod " << T << " = (x^3" << showpos;
if ( EllipticCurve.a_ != 0 )
{
os << EllipticCurve.a_ << "x";
}
if ( EllipticCurve.b_.i() != 0 )
{
os << EllipticCurve.b_;
}
os << noshowpos << ") mod " << T;
return os;
}
template<int P>
ostream& EllipticCurve<P>::PrintTable(ostream &os, int columns)
{
if ( table_filled_ )
{
int col = 0;
typename EllipticCurve<P>::m_table_t::iterator iter = m_table_.begin();
for ( ; iter!=m_table_.end(); ++iter )
{
os << "(" << (*iter).x_.i() << ", " << (*iter).y_.i() << ") ";
if ( ++col > columns )
{
os << "\n";
col = 0;
}
}
}
else
{
os << "EllipticCurve, F_" << P;
}
return os;
}
}
namespace utils
{
float frand()
{
static float norm = 1.0f / (float)RAND_MAX;
return (float)rand()*norm;
}
int irand(int min, int max)
{
return min+(int)(frand()*(float)(max-min));
}
}
using namespace Cryptography;
using namespace utils;
int main(int argc, char *argv[])
{
typedef EllipticCurve<263> ec_t;
ec_t myEllipticCurve(1,1);
cout << "A little Elliptic Curve cryptography example\nby Jarl Ostensen, 2007\n\n";
cout << "The elliptic curve: " << myEllipticCurve << "\n";
myEllipticCurve.CalculatePoints();
cout << "\nPoints on the curve (i.e. the group elements):\n";
myEllipticCurve.PrintTable(cout,5);
cout << "\n\n";
ec_t::Point P = myEllipticCurve[2];
cout << "some point P = " << P << ", 2P = " << (P+P) << "\n";
ec_t::Point Q = myEllipticCurve[3];
cout << "some point Q = " << Q << ", P+Q = " << (P+Q) << "\n";
ec_t::Point R = P;
R += Q;
cout << "P += Q = " << R << "\n";
R = P;
R += R;
cout << "P += P = 2P = " << R << "\n";
cout << "\nEC message encryption example\n===============================================\n\n";
ec_t::Point G = myEllipticCurve[0];
while( (G.y() == 0 || G.x() == 0) || (G.Order()<2) )
{
int n = (int)(frand()*myEllipticCurve.Size());
G = myEllipticCurve[n];
}
cout << "G = " << G << ", order(G) is " << G.Order() << "\n";
int a = irand(1,myEllipticCurve.Degree()-1);
ec_t::Point Pa = a*G;
cout << "Alice' public key Pa = " << a << "*" << G << " = " << Pa << endl;
int b = irand(1,myEllipticCurve.Degree()-1);;
ec_t::Point Pb = b*G;
cout << "Bob's public key Pb = " << b << "*" << G << " = " << Pb << endl;
int j = irand(1,myEllipticCurve.Degree()-1);;
ec_t::Point Pj = j*G;
cout << "Jane's public key Pj = " << j << "*" << G << " = " << Pj << endl;
cout << "\n\n";
int m1,m2;
cout << "Enter two message\n"<< endl;
cin >> m1;
cin >> m2;
cout << "Plain text message from Alice to Bob: (" << m1 << ", " << m2 << ")\n";
ec_t::Point Pk = a*Pb;
ec_t::ffe_t c1( m1*Pk.x() );
ec_t::ffe_t c2( m2*Pk.y() );
cout << "Encrypted message from Alice to Bob = {Pa,c1,c2} = {" << Pa << ", " << c1 << ", " << c2 << "}\n\n";
Pk = b*Pa;
ec_t::ffe_t m1d = c1/Pk.x();
ec_t::ffe_t m2d = c2/Pk.y();
cout << "\tBob's decrypted message from Alice = (" << m1d << ", " << m2d << ")" << endl;
Pk = j*Pa;
m1d = c1/Pk.x();
m2d = c2/Pk.y();
cout << "\nJane's decrypted message from Alice = (" << m1d << ", " << m2d << ")" << endl;
cout << endl;
}
|
|
|
|
|
Return it to where, and where and what are these variables?
Please also delete your duplicate of this post.
Use the best guess
|
|
|
|
|
Both threads are copies from here
|
|
|
|
|
How to get the process's DLL module address?
And How to get process imagebase?
|
|
|
|
|
It's not clear exactly what your problem is but you may want to start with GetModuleHandleEx() [^].
Use the best guess
|
|
|
|
|
Enumerating all modules in a process can be done by EnumProcessModules().
Here is an example of enumerating all modules in a process and displaying its names.
http://msdn.microsoft.com/en-us/library/windows/desktop/ms682621(v=vs.85).aspx
Load address of each modules can be retrieved by calling GetModuleInformation() for each modules.
lpBaseOfDll of MODULEINFO holds the load address of the corresponding module.
BOOL WINAPI GetModuleInformation(
__in HANDLE hProcess,
__in HMODULE hModule,
__out LPMODULEINFO lpmodinfo,
__in DWORD cb
);
|
|
|
|
|
HMODULE hMod = LoadLibrary("mydll.dll");
if (hMod) {
void (*)() myfn = (void (*)())GetProcAddress(hMod, "myfn");
if (myfn) myfn();
FreeLibrary(hMod);
}
EDIT:
Wasn't exactly sure what you're asking...
|
|
|
|
|
I have a list view with ownerdata and custom draw. when i do listview_update it updates the list but what If I want to update a specific column instead of all cols?
-----------------------
| col1 | col2 | col3 |
-----------------------
just col1 i is that possible?
|
|
|
|
|