|
If there are any Crypto++ V5.x dev's out there I sure could do with some help. I've used V4.x but am having trouble wrapping my head around using V5.x to encrypt and decrypt strings.
In essence I want:
bool Encrypt( string& sencryptedb64, const string& splaintext, const string&
skey );
and vice-versa.
I've read the Wiki/FAQ and so far have this:
byte key[AES::DEFAULT_KEYLENGTH], iv[AES::BLOCKSIZE];
memset( key, 0, AES::DEFAULT_KEYLENGTH );
memmove( key, (unsigned char*)skey.c_str(), min( skey.size(), AES::DEFAULT_KEYLENGTH ) );
AutoSeededRandomPool rng;
rng.GenerateBlock( iv, AES::BLOCKSIZE );
CFB_Mode<AES >::Encryption cfbEncryption( key, AES::DEFAULT_KEYLENGTH, iv );
string cipher;
StringSink* sink = new StringSink( cipher );
Base64Encoder* base64_enc = new Base64Encoder( sink );
StreamTransformationFilter* aes_enc = new StreamTransformationFilter( cfbEncryption, base64_enc );
StringSource source( splaintext.c_str(), true, aes_enc );
for Encryption, but the cipher result doesn't look right (it ends in a 0x0a) so I suspect I'm off track.
Not sure how to go about Decryption and my attempt so far certainly isn't right.
Neville Franks, Author of ED for Windows www.getsoft.com and Surfulater www.surfulater.com "Save what you Surf"
|
|
|
|
|
Hey all.
I had a DLL project (using MFC) that I recently decided to convert to a statically-linked library. Everything seemed to go smoothly, but when I try to use my library in a test application, all the resource-loading calls in the library fail.
That is to say, the library project has a resource file containing some resources used in the library; a string table, a couple of bitmaps, a dialog box or two, etc. Elsewhere in the library code, there's a routine that, say, wants to get a string from the string table. So I have something like this:
CString str;<br />
VERIFY(str.LoadString(IDS_STRINGID);
When I run an application that uses this part of the library, the LoadString() function fails (returns 0). The same seems to apply for dialog boxes, bitmaps, and all other resources. A quick debug trace revealed that it was passing the correct numeric value for the resource ID; it just seemingly could not load the resource.
I've never tried making a static library containing resources before, so I really have no idea what needs to be done. I'm assuming there is something in particular that I need to do so that the resources can be loaded correctly from the library. Does anyone know what I could do in this situation? Any help would be greatly appreciated.
|
|
|
|
|
I have the same problem - cannot load resources that are compiled into the static library. I know that a solution to the problem exists because there are resources in the static MFC library.
When I compile using VS 2002 I get warning on the .res file corresponding to the .rc file in the static library.
warning LNK4221: no public symbols found; archive member will be inaccessible
I think that may be a clue to the answer.
Did you ever find an answer?
Thanks
-Rodney
|
|
|
|
|
Actually, I did find a solution! I did a little hunting around on Google, and I found this page: http://www.differentpla.net/~roger/devel/tips/vc/resources_in_libs/[^]
It's not an incredibly elegant solution, but it's very simple, easy to use, and it works well. (On Visual Studio 6, at least; I assume it will work equally well on VS 2002, but I haven't tried it. ...Come to think of it, I've been using VS 6 ever since it came out. Oh well, if it ain't broke, don't fix it! )
[Insert witty and relevant signature here]
|
|
|
|
|
I am new to dealing with dlls and installers. I have a project where I am using Inno Setup over InstallShield and I need to create a dll that does application specific processing. I have been experimenting with Inno Setup and their sample files and I understand how it works. My problem lies in the dll that I have to create. How do I go about creating the dll? My experience with dlls has been limited to MFC dlls, which create classes. I am not sure Inno Setup can call a class from the MFC dll. The sample files that come with Inno Setup, one is a C dll, which is nothing that I have ever created. I am hoping someone has some experience with dlls and Inno Setup and can give me some direction. Thanks!
|
|
|
|
|
Inno Setup can only call 'C' style functions, not classes.
I created my DLL project using File, New Project, Visual C++ projects, MFC, MFC DLL, MFC using MFC shared DLL.
The following are some excerpts from an Inno Setup DLL I use.
This is a function in my DLL that is called by my Inno Setup script:
extern "C" __declspec(dllexport)
void __stdcall RegistryScrub(char *product,char *install_path)
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
}; and this is the declaration in the [Code] section of my Inno Setup script:
procedure RegistryScrub(product : String;
install_path : String);
external 'RegistryScrub@files:VersamarkSetup.dll stdcall'; You can pass strings to DLL functions as char * , int 's, etc.
My DLL is included in my setup via the following:
[Files]
Source: "VersamarkSetup.dll"; Flags: dontcopy
Software Zen: delete this;
|
|
|
|
|
Thanks - I implemented the dll in a similar fashion to what you are recommending and I have the Inno Setup Script implemented in a similar fashion. It will build in Inno Setup but when I go to run the install, I get the message that my dll cannot be imported. I have my dll located in the same directory as the other dlls that I am using the installer to copy so it should be in the correct place. Any ideas?
|
|
|
|
|
If the DLL can't be loaded when you run the compiled setup program, I would guess that your DLL has a dependency (a DLL it needs) that can't be found. Use the 'Dependency walker' program (DEPENDS.EXE) that comes with Visual Studio to find out.
One possibility: did you compile your DLL for debug? If you did, it will need the debug DLL's, which may not be on the target machine where you're testing your installation.
Software Zen: delete this;
|
|
|
|
|
Some Windows functions (like LoadImage) can take both certain constants and pointers as parameters. Is there a definite range of values that can be used which cannot be pointers? I'm guessing its the max a WORD can be, since MAKEINTRESOURCE casts to a WORD. And do all the different ways of allocating memeory return pointers that are not in that range (malloc, c++ new, LocalAlloc, CoTaskMemAlloc etc...), and is it the same on all versions of Windows (Win16, Win32, Win64)?
- thanks
|
|
|
|
|
I have built a serial com program, where I store incoming data by a thread to a CString array in a queue FIFO. The Worker thread then access this psudo CString queue, process the data and store it into a file. My problem is that the program memory grows in time none stop. I am not an avid VC++ programmer, I just need to find a way to control the memory leak. Variables are not re-created, they are all placed as global variables, in hopes to not great the same variable each time routines are run. How to I clear unused memory that the OS has put a side to do the calculations it needed?
stefane_filion@yahoo.com (please e-mail)
|
|
|
|
|
Is it possible to find out if a
type was declared const?
Thank You
Bo Hunter
|
|
|
|
|
const ness is a compile time hint.
const int tata = 5;
...
tata = 4;
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
If you mean "writing generic code which knows whether a given type is const or not" you can have something like that:
template <class T>
my_generic_class
{
};
template<class T>
my_generic_class<const T>
{
} Other than that, Boost.TypeTraits[^] features an utility called is_const which determines at compile time the const ness of a type. I'm not sure if tihs is what you're after.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
Want a Boost forum in Code Project? Vote here[^]!
|
|
|
|
|
How to idntification device manufacture of pocket pc?
|
|
|
|
|
Hi,
I'm using an http request from my VC++ 6.0 application(FYI, I'm using MSXML::IXMLHttpRequestPtr ). The idea is that I would like to send a cookie as well, but I don't know how to do this, and more than that, how to get this cookie. But I do know that the user is using IE 5.5+ and the cookie is stored on his computer. The idea is to authenticate with the server using the cookie(that is already on the computer), without having the user to type in some usernames and passwords.
Thanks,
Doru
|
|
|
|
|
Is this possible? If so how?
|
|
|
|
|
hian lukeV all installed program information are stored in registry key here
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall
now here just enumerate here each key for it's UninstallString and use them for unistalling partcular app.
"I Think this Will Help"
<h5
alok gupta="" <br=""> visit me at http://www.thisisalok.tk
my keyboard is not working, using screen keyboard these days
|
|
|
|
|
Could anyone give me the source code of the wma decoder?
I have tried to find it for a long time but failed.
Really really thanks a lot!!!~~
|
|
|
|
|
I am new with C++ and I would like to know if it is possible to write and later extract from an array of type char, variables of different types (UINT, USHORT, ULONG) in binary form?
An example of what I want is
char buffer[BUFFERSIZE];
UINT a, b;
USHORT c;
Now I want to put these variables in their respective binary format in the buffer, send it down a TCP/IP socket and read it back in some other variables in a different process.
Thanks for any help.
|
|
|
|
|
is this satisfy to you ?
<font color=#0000FF>long</font> myLong = 0x1254FA5C; <font color=#008000>
<font color=#0000FF>char</font> cTab[4] = {0};
<font color=#008000>
cTab[0] = (myLong & 0xFF000000) >> 24;
cTab[1] = (myLong & 0x00FF0000) >> 16;
cTab[2] = (myLong & 0x0000FF00) >> 8;
cTab[3] = (myLong & 0x000000FF);
<font color=#008000>
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
Hi,
Thanks for your reply, your answer satisfies completely my need and sorry for my late reply.
|
|
|
|
|
you're welcome...
i'm here to help the best i can, so i'm happy my answer is exactly what you expected of one of us...
see you on CP...
cheers,
(ps: when an article satisfy you, you can vote for it... )
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
First, I apologize for the remedial question. I am fairly new to Windows Programming (5+ yrs embedded C though).
I have an MFC dialog based ap which has a "RUN" button. The Run button starts a measurement function which interfaces with pieces of test equipment over COM1 and GPIB.
Currently, the measurement function takes ~4 minutes, during which time the dialog is frozen.
I want to make the program multithread so that controls in the dialog, Oven Temperature for example, update during the measurement function.
I am a bit confused how to use a UI thread with my current dialog box.
Can someone offer some tips on how to convert the current dialog based ap to make use a UI thread and several worker threads (I understand the worker thread part).
Thanks a bunch.
|
|
|
|
|
Try here[^].
Software Zen: delete this;
|
|
|
|
|
hi:thx all
please have a look at the following program:
const CStudent& operator =(const CStudent& s)
{...... }
BOOL operator ==(const CStudent& s) const {...... }
what is the diffence putting const between before the definition of function and at the end of definition of function?
|
|
|
|