|
> In the end I used the MS SSPI library, but this probably won't work on Win9x unfortunately
Well, to be honest, Win9x support is getting to be more of a "nice to have" feature at this point as there aren't too many 9x-based machines out there--we may be able to get away with telling our 9x customers that SSL will be for NT+ only.
I'll definitely look into MS's SSPI; in the meantime, if you could forward any relevant link or sample, that would be very much appreciated.
Thanks.
PS - anybody has experience with OpenSSL? Am I wasting my time even looking at that?
|
|
|
|
|
I'm not familiar with CSocket, but winsock works wells with OpenSSL API.
Kuphryn
|
|
|
|
|
> I'm not familiar with CSocket,
I'd rather not use it. My current code doesn't rely on MFC, and I don't want to introduce this dependency at this point in the program's life.
> but winsock works wells with OpenSSL API.
I "sorta" got this to run with the OpenSSL library. Compiling the library (with ms\do_ms.bat)generated two files, which got copied in the Windows directory: libeay32.dll (668KB), and ssleay32.dll (152KB). Do these figures sound correct to you? My compiled EXE is under 500KB, and I would hate to see it double in size "just" because of the SSL library it's using. I'm not allowed to require clients to have the DLLs pre-deployed (eg, preinstalled), so I'd have to embed the DLLs in the EXE itself and then extract/execute/delete them when done...
I'm beginning to see OpenSSL as a dead end. It's hard for me to believe an SSL library can't be compiled to under 50KB worth of binaries.
I'm starting to take a closer look at MS's SSPI as Robert suggested. If you can convince me otherwise, by all means, please tell me the library can be made smaller...
-- modified at 16:51 Monday 20th March, 2006
|
|
|
|
|
Is possible to transmit some parameters to a function in dll
am
|
|
|
|
|
|
Hello,
I want to overload only the IPropertyPage::Apply() part of the COlePropertyPage, and keep the call to other IPropertyPage method managed by COlePropertyPage
I have some thing similar to this:
class COleBaseParamPage : public COlePropertyPage
{
...
DECLARE_INTERFACE_MAP()
BEGIN_INTERFACE_PART(PropertyPage, IPropertyPage)
INIT_INTERFACE_PART(COleBaseParamPage, PropertyPage)
STDMETHOD(Apply)();
STDMETHOD(SetPageSite)(LPPROPERTYPAGESITE);
...
END_INTERFACE_PART(PropertyPage)
}
BEGIN_INTERFACE_MAP(COleBaseParamPage, COlePropertyPage)
INTERFACE_PART(COleBaseParamPage, IID_IPropertyPage, PropertyPage)
END_INTERFACE_MAP()
STDMETHODIMP COleBaseParamPage::XPropertyPage::SetPageSite(LPPROPERTYPAGESITE pPageSite)
{
METHOD_PROLOGUE_EX(COleBaseParamPage, PropertyPage)
// here I would call the original COlePropertyPage::XPropertyPage::SetPageSite()
}
I have made some test for calling the original COlePropertyPage::XPropertyPage::SetPageSite() by using the _GetBaseInterfaceMap() to get it's adress, but without success. I can't figure how to optain the original COlePropertyPage::XPropertyPage object adress
If someone have a suggestion, I will be very happy...
Thanck's
---
for information, I'm using some code issued from the CmdTarget code, like:
#define GetInterfacePtr(pTarget, pEntry) \
((LPUNKNOWN)((BYTE*)pTarget + pEntry->nOffset))
static LPUNKNOWN _getInterface(REFIID _iid, LPVOID me, const AFX_INTERFACEMAP* pMap)
{
const void* iid = &_iid;
DWORD lData1 = ((IID*)iid)->Data1;
do
{
const AFX_INTERFACEMAP_ENTRY* pEntry = pMap->pEntry;
ASSERT(pEntry != NULL);
while (pEntry->piid != NULL)
{
if (((DWORD*)pEntry->piid)[0] == lData1 &&
((DWORD*)pEntry->piid)[1] == ((DWORD*)iid)[1] &&
((DWORD*)pEntry->piid)[2] == ((DWORD*)iid)[2] &&
((DWORD*)pEntry->piid)[3] == ((DWORD*)iid)[3])
{
// check INTERFACE_ENTRY macro
LPUNKNOWN lpUnk = GetInterfacePtr(me, pEntry);
// check vtable pointer (can be NULL)
if (*(DWORD*)lpUnk != 0)
return lpUnk;
}
// entry did not match -- keep looking
++pEntry;
}
#ifdef _AFXDLL
} while ((pMap = (*pMap->pfnGetBaseMap)()) != NULL);
#else
} while ((pMap = pMap->pBaseMap) != NULL);
#endif
return NULL;
}
STDMETHODIMP COleBaseParamPage::XPropertyPage::SetPageSite(LPPROPERTYPAGESITE pPageSite)
{
METHOD_PROLOGUE_EX(COleBaseParamPage, PropertyPage)
IPropertyPagePtr p = _getInterface(IID_IPropertyPage, pThis, pThis->_GetBaseInterfaceMap());
p->SetPageSite(pPageSite);
return S_OK;
}
This code do recursive call, because the 'me' parameter is not the COlePropertySheet adress (I admit I'm a little lost with all these stuff)
|
|
|
|
|
Hello,
I want to overload only the IPropertyPage::Apply() part of the COlePropertyPage, and keep the call to other IPropertyPage method managed by COlePropertyPage
I have some thing similar to this:
class COleBaseParamPage : public COlePropertyPage
{
...
DECLARE_INTERFACE_MAP()
BEGIN_INTERFACE_PART(PropertyPage, IPropertyPage)
INIT_INTERFACE_PART(COleBaseParamPage, PropertyPage)
STDMETHOD(Apply)();
STDMETHOD(SetPageSite)(LPPROPERTYPAGESITE);
...
END_INTERFACE_PART(PropertyPage)
}
BEGIN_INTERFACE_MAP(COleBaseParamPage, COlePropertyPage)
INTERFACE_PART(COleBaseParamPage, IID_IPropertyPage, PropertyPage)
END_INTERFACE_MAP()
STDMETHODIMP COleBaseParamPage::XPropertyPage::SetPageSite(LPPROPERTYPAGESITE pPageSite)
{
METHOD_PROLOGUE_EX(COleBaseParamPage, PropertyPage)
// here I would call the original COlePropertyPage::XPropertyPage::SetPageSite()
}
I have made some test for calling the original COlePropertyPage::XPropertyPage::SetPageSite() by using the _GetBaseInterfaceMap() to get it's adress, but without success. I can't figure how to optain the original COlePropertyPage::XPropertyPage object adress
If someone have a suggestion, I will be very happy...
Thanck's
---
for information, I'm using some code issued from the CmdTarget code, like:
#define GetInterfacePtr(pTarget, pEntry) \
((LPUNKNOWN)((BYTE*)pTarget + pEntry->nOffset))
static LPUNKNOWN _getInterface(REFIID _iid, LPVOID me, const AFX_INTERFACEMAP* pMap)
{
const void* iid = &_iid;
DWORD lData1 = ((IID*)iid)->Data1;
do
{
const AFX_INTERFACEMAP_ENTRY* pEntry = pMap->pEntry;
ASSERT(pEntry != NULL);
while (pEntry->piid != NULL)
{
if (((DWORD*)pEntry->piid)[0] == lData1 &&
((DWORD*)pEntry->piid)[1] == ((DWORD*)iid)[1] &&
((DWORD*)pEntry->piid)[2] == ((DWORD*)iid)[2] &&
((DWORD*)pEntry->piid)[3] == ((DWORD*)iid)[3])
{
// check INTERFACE_ENTRY macro
LPUNKNOWN lpUnk = GetInterfacePtr(me, pEntry);
// check vtable pointer (can be NULL)
if (*(DWORD*)lpUnk != 0)
return lpUnk;
}
// entry did not match -- keep looking
++pEntry;
}
#ifdef _AFXDLL
} while ((pMap = (*pMap->pfnGetBaseMap)()) != NULL);
#else
} while ((pMap = pMap->pBaseMap) != NULL);
#endif
return NULL;
}
STDMETHODIMP COleBaseParamPage::XPropertyPage::SetPageSite(LPPROPERTYPAGESITE pPageSite)
{
METHOD_PROLOGUE_EX(COleBaseParamPage, PropertyPage)
IPropertyPagePtr p = _getInterface(IID_IPropertyPage, pThis, pThis->_GetBaseInterfaceMap());
p->SetPageSite(pPageSite);
return S_OK;
}
This code do recursive call, because the 'me' parameter is not the COlePropertySheet adress (I admit I'm a little lost with all these stuff)
|
|
|
|
|
Besides printf, can anyone think of another example of variable number of parameters using ellipsis?
<br />
void printf( const char *format, ... );<br />
This is the only declaration type I can't really think of when to use it, and HOW. Anyone?
|
|
|
|
|
what do you want to know ?
only some functions that use ellipsis?
or how they do that ?
|
|
|
|
|
v2.0 wrote: what do you want to know ?
only some functions that use ellipsis?
or how they do that ?
A situation where I want to use it, and how. Okay, for example,
<br />
int addition(int a, ...);<br />
This function returns the sum of variable number of integers, now in the function definition, how do I reference the other integer? b, c, d, etc?
What I want to know is an example of a function prototype with its definition. Can you think of any?
Thanks
|
|
|
|
|
int addition (int first, ... ) {
int iResult = 0;
int i = 0;
va_list int_list;
va_start(int_list, first);
while( i != -1 ) {
iResult += i;
i = va_arg(int_list, int);
}
va_end(int_list);
return iResult;
}
|
|
|
|
|
Hey thanks. Now I have another question, where did va_list come from? printf function has it too, I've seen va_list, va_start and va_arg. Are they built-in variables? macros?
|
|
|
|
|
don't mind how they are implemented. only keep in mind that they are part of the C (so C++) standard, and thanks to this, you can use them on whatever plateform knowing that they'll work...
you simply have to #include <stdio.h> and <stdarg.h>
for more informations, you could read this[^]
ps: if my answer was what you needed, score it right...
|
|
|
|
|
v2.0 wrote: ps: if my answer was what you needed, score it right...
Okay, done.
|
|
|
|
|
|
My advice on ellipsis - Don't use them, there're crap. My gripe is that it is impossible to create a type safe function that uses ellipsis.
Steve
|
|
|
|
|
I have a minor problem. I have a bit field (see below). I also have a few places where I deal
with the different parts of it. I've recently had to change the size of one of the fields, and
have to find all the places I've hardwired the old size.
If this was an array of BOOL / bools, I could use the sizeof operator. Is there any way of
deriving the size of the fields simply from the code?
I know there are various brute force approaches, use NUM_LAYERS_OVERLAYS (etc) everywhere,
change to struct containing a load of BOOLs, or BYTES, but the purist in me is intrigued
as to whether there is a more elegant solution....
Suggestions please?
Iain.
union _Layers_
{
DWORD dwAll;
struct _Parts_
{
DWORD dwImage : 1;
DWORD dwMesh : 1;
DWORD dwShapeMatch : 1;
DWORD dwComments : NUM_LAYERS_COMMENTS;
DWORD dwSelections : NUM_LAYERS_SELECTIONS;
DWORD dwOverlay : NUM_LAYERS_OVERLAYS;
} Parts;
_Layers_ ()
{
dwAll = -1;
}
};
|
|
|
|
|
Iain Clarke wrote: I've recently had to change the size of one of the fields, and
have to find all the places I've hardwired the old size.
What do you mean by this? I use bitfields all of the time and I change them all of the time. I can not think of a reason to 'hardwire' the old size except in the structure definition.
When you use parts, you reference by variable name. When you use the whole word you use dwAll. I guess you could make changes to dwAll by using bit operations, but that could have been avoided by using your structure.
|
|
|
|
|
Bob Flynn wrote: When you use parts, you reference by variable name
Don't worry, I do know that. This structure hold bits toggling whether some display features are turned on or off in my software.
I also have a dialog box, which shows a column of checkboxes on one side, and the "type" of bit on the other. When I changed the number of bits for each parts, I needed to change the dialog box. I was thinking of a way for the dialog box to automatically recongnise the changes if I made more in 2 years time.
I have since thought of a solution (in the bath, so I haven't tried it yet).
_Layer_ L.
int nBits;
L.dwAll = -1;
nBits = L.Parts.dwComments;
nBits++;
nBits = log (nBits, 2);
I'm sure I haven't got the syntax of the log command right, but the principal is there.
This was more of a puzzle than a real problem, as I did have alternative (but less pretty) ways of solving the problem.
Thanks,
Iain.
|
|
|
|
|
OK, I see what you are going for.
I think what you have will work just fine. Perhaps instead of a log2 function you may find that simply finding the non zero bit by counting will be a faster operation.
i = 0;<br />
while ((i < 32) && ((src & 0x80000000) == 0))<br />
{<br />
src = src << 1;<br />
++i;<br />
}
This will tell you how many leading zeros are in your word, therefore providing the location of the first non-zero value.
|
|
|
|
|
I am trying to push a variable of type bobject into a vector, i get an assertion error when i try to push it. Does anybody know what the problem could be?
|
|
|
|
|
Show your code, especially how you declared your vector (be sure to check the 'Ignore HTML tags in the message' checkbox located below the posting edit box on the CP posting page), the line where you call push_back (or push_front) and then it might help if you also posted the lines that generated the actual assertion (will contaion the text ASSERT or VERIFY or some variation there of) that your debugger will jump to when you tell it to debug your program after the assertion happens.
You may be right
I may be crazy
-- Billy Joel --
Within you lies the power for good - Use it!
|
|
|
|
|
The code which pushes the vector
bobject o=read_Obj(argv[i]);
o.active=1; //Active
o.picked=0;//Not picked
o.path=argv[i]; //save object path
---------------->store_normal(o);
glLoadIdentity ();
glGetFloatv(GL_MODELVIEW_MATRIX,o.m);
//initialize all variables
cout<<"in"<<endl;
----------------->ob.MyObjects.push_back(o);
the store_normal code is
void store_normal(bobject o)
{
for(int i =0;i<o.faces.size();i++)
{
//caculate the normal of the vertices
GLfloat x;
GLfloat y;
GLfloat z;
//vertex1 - vertex2
float a1= o.faces[i].second.x- o.faces[i].first.x;
float a2= o.faces[i].second.y- o.faces[i].first.y;
float a3= o.faces[i].second.z- o.faces[i].first.z;
//vertex2 - vertex3
float b1= o.faces[i].third.x-o.faces[i].first.x;
float b2= o.faces[i].third.y-o.faces[i].first.y;
float b3= o.faces[i].third.z-o.faces[i].first.z;
//calculate x y,and z cordinates for normal using cross product
x=(a3*b2)-(a2*b3);
y=(a1*b3)-(a3*b1);
z=(a2*b1)-(a1*b2);
//1st normal
o.vert[o.faces[i].v1].norm.x =o.vert[o.faces[i].v1].norm.x+x;
o.vert[o.faces[i].v1].norm.y =o.vert[o.faces[i].v1].norm.y+y;
o.vert[o.faces[i].v1].norm.z =o.vert[o.faces[i].v1].norm.z+z;
//2nd normal
o.vert[o.faces[i].v2].norm.x =o.vert[o.faces[i].v2].norm.x+x;
o.vert[o.faces[i].v2].norm.y =o.vert[o.faces[i].v2].norm.y+y;
o.vert[o.faces[i].v2].norm.z =o.vert[o.faces[i].v2].norm.z+z;
//3rd normal
o.vert[o.faces[i].v3].norm.x =o.vert[o.faces[i].v3].norm.x+x;
o.vert[o.faces[i].v3].norm.y =o.vert[o.faces[i].v3].norm.y+y;
o.vert[o.faces[i].v3].norm.z =o.vert[o.faces[i].v3].norm.z+z;
}
}
this assertion error occurs when i include store_normal(o);
|
|
|
|
|
You have still not supplied the crucial piece of information, what is the exact assertion? Just saying "an assertion happened" means nothing, it could be anything.
Learn to use the tools you have in front of you. Start the debugger, step through and into your code. Watch the values of all your variables, and when you hit an assertion look at the code and all the variables referenced in that code. At least one of the variables will have an invalid value. Figure out which one it is, and then use the call stack to backtrace to where that invalid value was set.
It can take a little bit of detective work, but you can do it. I can't do it with the information you have supplied so far.
Good Luck!
You may be right
I may be crazy
-- Billy Joel --
Within you lies the power for good - Use it!
|
|
|
|
|
in visual c++6 ,how can i write /in/ or read /from/ any port like LPT?
|
|
|
|
|