|
In the CyptroAPI documentation, the call to CryptEncrypt suggests that one can make two calls in order to first determine how large a buffer is needed in order to hold the encrypted data. To accomplish this, one sets the value of the 'pbData' parameter to NULL. What I don't understand, is if the buffer pointer is set to NULL, how does CryptEncrypt know what is to be encrypted and thus possibly compute the size of a buffer that is required. What am I missing?
Chris Meech
"what makes CP different is the people and sense of community, things people will only discover if they join up and join in." Christian Graus Nov 14, 2002.
"Microsoft hasn't ever enforced its patents. Apparently they keep them for defensive reasons only. Or, they could be waiting 'til they have a critical mass of patents, enforce them all at once and win the game of Risk that they're playing with the world." Chris Sells Feb 18, 2003.
|
|
|
|
|
1st time you call CryptEncrypt with all the params except pbData = NULL,
pdwDataLen = lenght of data to encrypt.
BOOL WINAPI CryptEncrypt(
HCRYPTKEY hKey,
HCRYPTHASH hHash,
BOOL Final,
DWORD dwFlags,
BYTE *pbData,
DWORD *pdwDataLen,
DWORD dwBufLen
);
2nd time pass real pbData
==================================
>how does CryptEncrypt know what is to be encrypted and thus possibly compute the size of a buffer that is required. What am I missing?
Because of pdwDataLen it tells exactly how many bytes to encrypt.
Brian
|
|
|
|
|
Thanks Brian. It was the first call that I was wasn't understanding how to set the value properly. That makes some sense to me now.
Chris Meech
"what makes CP different is the people and sense of community, things people will only discover if they join up and join in." Christian Graus Nov 14, 2002.
"Microsoft hasn't ever enforced its patents. Apparently they keep them for defensive reasons only. Or, they could be waiting 'til they have a critical mass of patents, enforce them all at once and win the game of Risk that they're playing with the world." Chris Sells Feb 18, 2003.
|
|
|
|
|
Hi guys I need a 3x15 matrix where each cell can change depending if I click with the left (ascending values) or right (descending values) button.
The content of each cell has to be alphanumeric (Ex: 0,1,2,3...16 or A,B,C...,Z)
What do you suggest me?
I was thinking to use a kind of CStatic derivated class.
PLease tell me what do you think.
Best Regards
Dr.Pi
|
|
|
|
|
Hey all,
I'm no encryption guru, and was hoping somebody could point me in the right direction.
We have a client/server (Windows based, written in Win32) application which we sell internationally and is used by many of the large data-centers in the world. In recent months, with security being a big issue we have customers who are inquring about the data that is sent between the client/server, whether the data is sent/recieved in the clear, is it encrypted etc.
Currently, our data is sent in the clear with the exception of the user's passwords which are transferred and stored in a MD5 hash.
In talking with the Security department at one of the customers we're working with, this is easy fudged and has suggested we implement SSL-3 with 128 bit encryption and 1024 bit keys. Has anybody taken on such a challenge?
I've had a chance to download various libaries but for the most part, its hard to find a GOOD working example.
The data our product documents isn't important apparently, its the fact that users could use the SAME passwords for our application than they do for another application which could be more sensitive.
Thoughts?
Mike.
doner@obtain.com
|
|
|
|
|
I have created an MFC application that hosts the microsoft WebBrowser
Active-X Control. I need to open an html page that contains an applet
that was created with Java Sdk 1.4.1. It will not work with any
previous versions.
When I open the applet using the normal IE it works. (The Java 1.4.1 Plugin is Used)
When I attempt to open the applet with the application I have created
it does not work, it gives me the same type of error as if I did not
have the newest java plugin.
Does anyone know if it is possible to have the WebBrowser Control
always use the newest Java Plugin?
Best Regards,
Brian
|
|
|
|
|
Hi all,
I'm doing a client/server project. The client-end needs to know if the server-end application is running. If no, the client-end needs to start the server-end application remotely.
Any body know how to do this?
thanks in advance,
David
|
|
|
|
|
One solution is to have the server run as a service, but is not enabled. As the client makes a connection, it can ask the server to enable.
Kuphryn
|
|
|
|
|
Hi.
I've attached a CString member to a text-field.
Sometimes, the text may be so large that the text doesn't fit into the available text-field.
Is there any way to auto-resize the textfield so i'm sure the text will be always shown completely and not a part of it?
Greetings
jens
|
|
|
|
|
One solution is GetTextExtent().
Kuphryn
|
|
|
|
|
hi All,
I have a class with functions and I'm calling into a dll with a function that specifies a callback function Here's the function I'm calling:
extern "C" __declspec(dllexport) void stuffFunction(void (*UpdateCallback)(int iLoad))
And here's the class function I'm trying to pass in as a call back:
void CSomeClass::UpdateCallback(int iLoad);
I get the error:
error C2664: 'someapp.c' : cannot convert parameter 1 from 'void (int)' to 'void (__cdecl *)(int)'
If I declare the UpdateCallback to be a static function, it builds with no errors. I need to have access to the class members so I can't declare it as a static function.
Any ideas? Thanks in advance!
|
|
|
|
|
What you are doing is illegal. You can't use a method as you do. You'll need to make it static. Non-static methods can only be accesed by an instance of the class.
So, you need to make it static.
Rickard Andersson8
Here is my card, contact me later!
UIN: 50302279
E-Mail: nikado@pc.nu
Interests: C++, ADO, SQL, Winsock, 0s and 1s
|
|
|
|
|
That's what I thought
I just wanted to be sure there were no other tricks out there I didn't know about. Thanks.. ....
Just gotta do it another way =)
|
|
|
|
|
will1383 wrote:
I just wanted to be sure there were no other tricks out there I didn't know about.
Yeah!
It's better being on the safe side!
Rickard Andersson8
Here is my card, contact me later!
UIN: 50302279
E-Mail: nikado@pc.nu
Interests: C++, ADO, SQL, Winsock, 0s and 1s
|
|
|
|
|
Hy People!
I'm having some problems with memory leaks, maybe somebody can help me
I have an CArray, full of objects with CStrings and when I finish my program lots of memory leaks of type strcore appears on the my debug.
I try to put myvariableString.Empty(); on the destructor of that object, but doesn't solved
The same happens to my CRichEdit control, I do a 'new' and create; on the destructor I do richedit->DestroyWindow() and delete richedit;
But anyway, the following text appear:
my.cpp: {701} client block at 0x002FA608, subtype 0, 64 bytes long.
a CRichEditCtrl object at $002FA608, 64 bytes long
Thanks everybody for the attention,
cheers!
Ricky
|
|
|
|
|
Empty() only makes the string the empty string (""). You have to call "delete" on anything you allocate with "new".
|
|
|
|
|
If you go to line 701 of MY.CPP, you'll see a new statement. Whenever the owner of the CArray object goes away, you'll need a corresponding delete statement.
|
|
|
|
|
I inserted in the registry (HKCR/myappdata/shell/open) the command line to open a file ("c:/programs dir/my app dir/myapp.exe" "%1") from the shell.
Ok, it works, but the working dir is always "c:". I would like to tell Windows that when opening a file from the shell the working dir is "c:/programs dir/my app dir".
A solution could be to write in the code
SetCurrentDir(GetExeDirectory()), but doing so it would be impossible to use another working dir...
Any suggestion?
thanks
|
|
|
|
|
In your app, in the initial Update, get the command line, parse for the .exe (or use the command line parser from CP, make a search about it), get the next string after the exe, here you have the path to your file.
put a SetCurrentDir(str_commandline_file);
You'ra done.
~RaGE();
|
|
|
|
|
I don't need the file path, I want that the working path is the same of the exe.
But I can't encode that in the source code, I must say that to she shell...
|
|
|
|
|
You caught me wrong.
Assume the user, when installing your tool, put it in F:\Apps\Mytool\Tool.exe, and registers your associated files with extension .paolo.
Then, he opens an explorer, doubleclicks on myfile.paolo which is in C:\CurrentFiles.
So your command line, sent from the shell to the code, is :
F:\Apps\Mytool\Tool.exe C:\CurrentFiles\myfile.paolo
So now you can retrieve the exe path, and use SetDirectory()
~RaGE();
|
|
|
|
|
That could be a good solution, but I can't get the full command line...
The variable m_lpCmdLine only contains
"C:\CurrentFiles\myfile.paolo"
without "F:\Apps\Mytool\Tool.exe"
|
|
|
|
|
In InitInstance() :
CString str=GetCommandLine();
In fact, m_lpCmdLine contains only the parameters. Check this in the MSDN for more info, i give you just the remark here :
Remarks:
ANSI console processes written in C can use the argc and argv arguments of the main function to access the command-line arguments. ANSI GUI applications can use the lpCmdLine parameter of the WinMain function to access the command-line string, excluding the program name. The reason that main and WinMain cannot return Unicode strings is that argc, argv, and lpCmdLine use the LPSTR data type for parameters, not the LPTSTR data type. The GetCommandLine function can be used to access Unicode strings, because it uses the LPTSTR data type.
~RaGE();
|
|
|
|
|
Thank you!!!
It was so obvious, that I couldn't find it
|
|
|
|
|
What you want cannot be done. When you associate a file-type with a program, you provide an absolute path to the EXE responsible for it. How else do you think Windows is going to know how to find it? You could, however, get away with just putting the name of the EXE in the registry, and then making sure the EXE can be found via the PATH environment variable. Sloppy, but do-able.
|
|
|
|
|