|
|
when i compiler my project,
ide always show like this:
--------------------Configuration: BlowFish_DEMO - Win32 Debug--------------------
Compiling...
BlowFish_DEMO.cpp
e:\openssl\demo\tellusencryption.h(30) : error C2146: syntax error : missing ';' before identifier 'CONST'
e:\openssl\demo\tellusencryption.h(30) : error C2146: syntax error : missing ';' before identifier 'DEFAULT_BLOWFISH_KEY'
e:\openssl\demo\tellusencryption.h(30) : error C2501: 'CONST' : missing storage-class or type specifiers
e:\openssl\demo\tellusencryption.h(30) : error C2501: 'DEFAULT_BLOWFISH_KEY' : missing storage-class or type specifiers
e:\openssl\demo\tellusencryption.h(33) : error C2146: syntax error : missing ';' before identifier 'BinToHex'
e:\openssl\demo\tellusencryption.h(33) : error C2061: syntax error : identifier 'LPBYTE'
e:\openssl\demo\tellusencryption.h(34) : error C2146: syntax error : missing ';' before identifier 'HexToBin'
e:\openssl\demo\tellusencryption.h(34) : error C2086: 'BOOL' : redefinition
e:\openssl\demo\tellusencryption.h(34) : error C2061: syntax error : identifier 'LPBYTE'
e:\openssl\demo\tellusencryption.h(36) : error C2146: syntax error : missing ';' before identifier 'GetEncryptLength'
e:\openssl\demo\tellusencryption.h(36) : error C2061: syntax error : identifier 'DWORD'
e:\openssl\demo\tellusencryption.h(42) : error C2146: syntax error : missing ';' before identifier 'BlowFishDecrypt'
e:\openssl\demo\tellusencryption.h(42) : error C2086: 'BOOL' : redefinition
e:\openssl\demo\tellusencryption.h(42) : error C2061: syntax error : identifier 'LPBYTE'
e:\openssl\demo\tellusencryption.h(43) : error C2146: syntax error : missing ';' before identifier 'BlowFishEncrypt'
e:\openssl\demo\tellusencryption.h(43) : error C2086: 'BOOL' : redefinition
e:\openssl\demo\tellusencryption.h(43) : error C2061: syntax error : identifier 'LPBYTE'
e:\openssl\demo\tellusencryption.h(44) : error C2146: syntax error : missing ';' before identifier 'HashMD5'
e:\openssl\demo\tellusencryption.h(44) : error C2086: 'BOOL' : redefinition
e:\openssl\demo\tellusencryption.h(44) : error C2061: syntax error : identifier 'LPBYTE'
e:\openssl\demo\tellusencryption.h(45) : error C2146: syntax error : missing ';' before identifier 'HashMD5'
e:\openssl\demo\tellusencryption.h(45) : error C2086: 'BOOL' : redefinition
e:\openssl\demo\tellusencryption.h(45) : error C2061: syntax error : identifier 'LPCTSTR'
e:\openssl\demo\tellusencryption.h(45) : error C2535: 'int __thiscall CTellusEncryption::HashMD5(void)' : member function already defined or declared
e:\openssl\demo\tellusencryption.h(44) : see declaration of 'HashMD5'
e:\openssl\demo\tellusencryption.h(46) : error C2146: syntax error : missing ';' before identifier 'HexHashMD5'
e:\openssl\demo\tellusencryption.h(46) : error C2086: 'BOOL' : redefinition
e:\openssl\demo\tellusencryption.h(46) : error C2061: syntax error : identifier 'LPCTSTR'
e:\openssl\demo\tellusencryption.h(48) : error C2146: syntax error : missing ';' before identifier 'Encode'
e:\openssl\demo\tellusencryption.h(48) : error C2086: 'BOOL' : redefinition
e:\openssl\demo\tellusencryption.h(48) : error C2061: syntax error : identifier 'LPBYTE'
e:\openssl\demo\tellusencryption.h(49) : error C2146: syntax error : missing ';' before identifier 'Decode'
e:\openssl\demo\tellusencryption.h(49) : error C2086: 'BOOL' : redefinition
e:\openssl\demo\tellusencryption.h(49) : error C2061: syntax error : identifier 'LPBYTE'
TellusEncryption.cpp
e:\openssl\demo\tellusencryption.cpp(390) : fatal error C1010: unexpected end of file while looking for precompiled header directive
Generating Code...
Error executing cl.exe.
BlowFish_DEMO.exe - 34 error(s), 0 warning(s)
-----------------------------------------
Please help me ,thanks a lot.
I Love my lover like you do!
|
|
|
|
|
|
I have found this problem ,
the solution is i added <afx.h> in "StdAfx.h",
but it showes the other error:
----------------------------------------------------
--------------------Configuration: BlowFish_DEMO - Win32 Debug--------------------
Compiling...
TellusEncryption.cpp
e:\openssl\demo\tellusencryption.cpp(389) : fatal error C1010: unexpected end of file while looking for precompiled header directive
Error executing cl.exe.
Creating browse info file...
BSCMAKE: error BK1506 : cannot open file '.\Debug\TellusEncryption.sbr': No such file or directory
Error executing bscmake.exe.
BlowFish_DEMO.exe - 2 error(s), 0 warning(s)
I Love my lover like you do!
|
|
|
|
|
Thanks a lot for everybody's favor or attection.
I found the solution in Google Search.
That is to add #include "stdafx.h" in *.cpp file .
I Love my lover like you do!
|
|
|
|
|
hi guys,
currently i am working on a server/client which uses blowfish to encrypt/decrypt the message protocal.
the problem i am facing is i was trying to implement the blowfish that George Anescu provided at (http://www.codeproject.com/cpp/blowfish.asp)
but the result doesn't looks right.
encrypted
0xEA,0xC4,0x60,0x77,
0x14,0x6A,0xBC,0x23,
0x3B,0x36,0xFC,0x34,
0xA0,0xDD,0x82,0xAF,
0xD6,0x9E,0xAB,0x38,
0x05,0xB1,0xE6,0x98,
0x0D,0x2D,0x41,0x44,
0x78,0x22,0x29,0xB6,
0x76,0x62,0x4A,0x79,
0xFE,0x01,0xED,0x06,
0x51,0xE7,0x19,0xE1,
0x35,0x1E,0xAA,0x19
should be decrypted to something like this
0x00,0x74,0x6f,0x72,
0x75,0x6e,0x65,0x00,
0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x63,
0x68,0x65,0x6e,0x77,
0x65,0x69,0x00,0x00,
0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x08,
0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,
0x78,0x16,0x64,0x6e,
0x00,0x00,0x00,0x00
with the encrypt key: [;'.]94-31==-%&@!^+]\0
I have no idea why its wrong.
my test code is following
Blowfish.h
Blowfish.cpp
you can get them at http://www.codeproject.com/cpp/blowfish.asp
<br />
#include <iostream><br />
#include <fstream><br />
#include "Blowfish.h"<br />
<br />
using namespace std;<br />
<br />
void main()<br />
{<br />
try<br />
{<br />
ofstream out("out.txt", ios::trunc);<br />
char ENCRYPTKEY[] = "[;'.]94-31==-%&@!^+]";<br />
unsigned char decrypted[] = {<br />
0x00,0x74,0x6f,0x72,0x75,0x6e,0x65,0x00,<br />
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x63,<br />
0x68,0x65,0x6e,0x77,0x65,0x69,0x00,0x00,<br />
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,<br />
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,<br />
0x78,0x16,0x64,0x6e,0x00,0x00,0x00,0x00<br />
};<br />
<br />
unsigned char encrypted[] = { <br />
0xEA,0xC4,0x60,0x77,0x14,0x6A,0xBC,0x23,<br />
0x3B,0x36,0xFC,0x34,0xA0,0xDD,0x82,0xAF,<br />
0xD6,0x9E,0xAB,0x38,0x05,0xB1,0xE6,0x98,<br />
0x0D,0x2D,0x41,0x44,0x78,0x22,0x29,0xB6,<br />
0x76,0x62,0x4A,0x79,0xFE,0x01,0xED,0x06,<br />
0x51,0xE7,0x19,0xE1,0x35,0x1E,0xAA,0x19<br />
};<br />
unsigned char szDataOut[48];<br />
CBlowFish oBlowFish((unsigned char*)ENCRYPTKEY, sizeof(ENCRYPTKEY));<br />
oBlowFish.Encrypt(decrypted, (unsigned char*)szDataOut, sizeof(decrypted), CBlowFish::ECB);<br />
out <<szDataOut<<endl;<br />
<br />
memset(szDataOut,0,sizeof(szDataOut));<br />
oBlowFish.Decrypt(encrypted, (unsigned char*)szDataOut, sizeof(encrypted), CBlowFish::ECB);<br />
out <<szDataOut<<endl;<br />
}<br />
catch(exception& roException)<br />
{<br />
cout << "Exception: " << roException.what() << endl;<br />
}<br />
}<br />
-- modified at 22:07 Friday 2nd September, 2005
|
|
|
|
|
I've been looking around in the articles on CStatics as well as in stuff on Bitmaps and the GDI, but I'm not quite finding what I need, so here goes....
What I would like to create is a CStatic-derived class that will make what looks like a partially transparent CStatic. Think of it as a piece of colored glass with text written on it, hovering over the background.
I can handle making a CStatic transparent (there are a couple of nifty articles on that). In essence, taking an image of the part of the parent control behind the CStatic and painting that as the background of the CStatic.
To be more explicit, here's a code snippet for doing basic transparent CStatic:
This is in OnPaint for the CStatic-derived class (so dc is the supplied DC):
CDC* pdcT;
pdcT = new CDC;
pdcT->CreateCompatibleDC(&dc);
CBitmap bitmap;
CBitmap* pOldBitmap;
pOldBitmap = pdcT->SelectObject(&bitmap);
dc.BitBlt(0, 0, rc.Width(), rc.Height(), pdcT, 0, 0, SRCCOPY);
pdcT->SelectObject(pOldBitmap);
delete pdcT;
So what I need to be able to do is modify that "parent" image to add a wash of color, then paint that to the background of the CStatic. It seems that I need to do the modifying of the bitmap after it has been selected into the pdcT, but I don't know where to go on that. Or perhaps I'm missing something that I can do in the BitBlt function to accomplish this.
Can it be done? And if so, how?
Thanks.
|
|
|
|
|
OK, it looks like I solved my own problem. Just in case anyone else is interested, here's what I found:
CPaintDC dc(this);
pDCMem = new CDC;
pDCMem->CreateCompatibleDC(&dc);
bmp.CreateCompatibleBitmap(&dc,rc.Width(),rc.Height());
pOldBitmap = pDCMem->SelectObject(&bmp);
CBrush brush;
brush.CreateSolidBrush(RGB(122,255,122));
pDCMem->FillRect(rc, &brush);
dc.BitBlt(0,0,rc.Width(),rc.Height(),pDCMem,0,0,SRCAND);
pDCMem->SelectObject ( pOldBitmap ) ;
delete pDCMem;
And it works. Now the CStatic is light green, with text on it (which I did not include in the code snippet) and the bitmap "behind" it can be seen greenishly colored through it.
|
|
|
|
|
Trying to debug a hung application.
Determined that the thread which owns the LdrpLoaderLock is no longer alive, but 4 of my 15 threads are waiting to gain this orphaned critical section.
Any suggestions how to catch this?
Possibly hijack EndThread and make sure thread does not own the critical sections? Possibly hijack TerminateThread as well?
|
|
|
|
|
In my experience, this kind of thing happens when a thread exits due to an uncaught exception. Try putting a try { ... } catch(...) { } block around the entire thread, and then place a breakpoint in the catch block.
Software Zen: delete this;
|
|
|
|
|
I was wondering if anyone in here could explain what it means when a job description specifies .Net experience? Does that imply a specific version of compiler, language? Specific SDK experience?
|
|
|
|
|
probably the .Net framework and its way of handling web page creation/interaction. if they don't specify a language, it's safe to assume either VB or C# (XOR or OR) - haven't seen many jobs for MC++ or J#.
Cleek | Image Toolkits | Thumbnail maker
|
|
|
|
|
I have a WIN32 application that creates and dispatches a number of threads that perform various tasks.
Now, one of the threads in particular creates and dispatches another two threads; one which reads records into a list <cstring> and one which writes the records from the list to an output.
The threads are created by a call to AfxBeginThread(), specifying the name of the function that serves as the worker thread (not a member function), and the argument to the call is the 'this' pointer of the parent object creating the thread (Both workers need access to the member functions of their parent).
When the number of lines to read and subsequentailly write, is small, ie) one or two. I get a really strange thread protection expception.
1. The parent dispatches the first thread; the reader. It starts right away.
2. The parent dispatches the second thread; the writer. It starts right away.
3. The parent thread then hits a WaitForMultipleObjects(), waiting for an event to be signalled by
both child threads indicating that they are complete.
4. The wait is broken, the parent object goes through destruction and completes.
5. Protection exception.
Thrdcore.cpp @ line 114 (in my listing).
nResult = (*pThread->m_pfnThreadProc)(pThread->m_pThreadParams);
I cannot for the life of me find out what the problem is. It is as if a thread is being dispatched
again after the parent is complete, or there is some kind of thread-clean-up that expects the function pointed to by pThread->m_pfnThreadProc and its argument pThread->m_pThreadParams (which is the address of the parent object) to be still accessible. Which of course it cannot be as the parent object has already been destroyed.
I have traced the process over and over and I cannot come up with a reason why this is happening.
If anyone has any suggestions or pointers I would would very much appreciate them.
James.
|
|
|
|
|
In step 3, you indicate that your parent thread waits for an object signalled by both threads that indicates that they are complete. The problem is, when each thread signals the event, they are still executing. Signaling the event causes the thread to pause its execution in favor of the thread waiting. If you delete the parent object at this point, and then the reader/writer threads continue, you will see the access violation.
You need to wait for both threads to finish executing before deleting the parent object. You can do this using ::WaitForMultipleObjects , passing it an array containing the handles to the reader and writer threads.
Software Zen: delete this;
|
|
|
|
|
Thanks for the update.
That is spot on...
The parent does wait with a WaitForMultipleObjects, but, I stupidly I coded the process to use CEvents instead of just using the HANDLE of each thread as the signal.
Again. Many thanks..
James.
|
|
|
|
|
Hi All,
Please tell me what :: operator means in C++. For example,
[code]
ShowList::ShowList( void )
{
.........
........
}
[\code]
Thanks
Preeti9
|
|
|
|
|
:: is the Scope Resolution Operator[^].
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" - mYkel - 21 Jun '04
"There's not enough blatant self-congratulatory backslapping in the world today..." - HumblePie - 21 Jun '05
Within you lies the power for good - Use it!
|
|
|
|
|
Well, I know that this is scope resolution operator but I am not able to understand what it does.
Anyways, Thanks
Preeti9
|
|
|
|
|
Preeti9 wrote:
I know that this is scope resolution operator but I am not able to understand what it does
It resolves the scope of objects . For example std::string tells the compiler to use the string class that is a member of the std namespace.
In your example ShowList::ShowList( void ) you are declaring the default c'tor of the class ShowList ( a c'tor is a function that has the same name as the class). In the same file you could have a function called MyShowList::ShowList( void ) which would be the ShowList function of the MyShowList class. Without the scope resolution operator the compiler would not be able to tell the two apart.
Read some of the links I gave you earlier, and experiment with some code. The concept is not all that difficult.
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" - mYkel - 21 Jun '04
"There's not enough blatant self-congratulatory backslapping in the world today..." - HumblePie - 21 Jun '05
Within you lies the power for good - Use it!
|
|
|
|
|
Thanks, I got it now. It is not difficult.
Thanks once again
Preeti9
|
|
|
|
|
I have Printpreview difficult.
I want from doc/view facilities, to preview all I need to print.
According to all theories I read, i must create my View class derived from CPreviewView, but in my Visual C++ Standard Edition 6.0, i don't have it. how to do now ?
Would you like to send me this library ? (lib file).
Urgent
I learn my self
|
|
|
|
|
CPreviewView is declared in AfxPriv.h and it's implementation is in ViewPrev.cpp. You should have both those files.
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" - mYkel - 21 Jun '04
"There's not enough blatant self-congratulatory backslapping in the world today..." - HumblePie - 21 Jun '05
Within you lies the power for good - Use it!
|
|
|
|
|
Where to find those files, I need them.
And to use it to create my View class from them.
Or send me only the lib of this class
I learn my self
|
|
|
|
|
Please Sir, T say that I am using Visual c++ 6.0 standard edition. I thing that's my problem, if perhaps i had professionnal edtion, I would resolve my problem, so i ask if it is possible to send me this class like a librairy to incorporate it to my project.
Thanks
I learn my self
|
|
|
|
|
The files are included in the edition you have. AfxPriv.h is in the VC98/MFC/Include/ folder and ViewPrev.cpp is in the VC98/MFC/SRC folder.
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" - mYkel - 21 Jun '04
"There's not enough blatant self-congratulatory backslapping in the world today..." - HumblePie - 21 Jun '05
Within you lies the power for good - Use it!
|
|
|
|
|