|
hi, having trouble debugging my lil subroutine that encrypt and decrypt a buffer.
algorithm used is RC2 (8 BYTE PER BLOCK). HKEY derived from a passwd with MD5. API used:
(a) CryptEncrypt
(b) CryptDecrypt
The plaintext buffer going INTO CryptEncrypt was 28 BYTE (This means that u will have to call CryptEncrypt four times). The number of bytes in the returned encrypted buffer is 40 BYTE.
Now, i know that the encrypted buffer may be "up to a block size" larger than the plaintext buffer (according to MSDN). Since I called CryptEncrypt four times, the encrypted buffer can be as large as:
encrypted buffer size = 28 BYTE + 4 x 8 BYTE = 60 BYTE
QUESTION 1: Is this understanding correct?
QUESTION 2:
* RC2 used - 8 BYTE per Block.
* plain text buffer = 28 BYTEs
* return buffer = 40 BYTEs (Is this reasonable?)
Thanks.
norm
|
|
|
|
|
FACT 1: btw, just want to let you know that the error was:
(a) NTE_BAD_DATA
(b) seems like the length of the encrypted buffer is shorter than it should be and in the "final" pass - decryption - the buffer to be decrypted was NULL - thus leads to NTE_BAD_DATA.
FACT 2: however, NO error was reported from CryptEncrypt.
CryptEncrypt was called a few times to encrypt a buffer prior to calling CryptDecrypt. HOWEVER, the returned buffer does seems to be shorter than the indicated 32 BYTE (NOT 40). I can tell this by looking at the watch windows - but special characters in the encrypted buffer may cause to the situation in which not all byte/char in the encrypted buffer to be displayer. But i does look a lot shorter than 32 BYTEs
FACT 3: my decryption subroutine (which wraps around CryptDecrypt) successfully decrypted the first pass/block. Then from second block on, decryption was done, but I can see that it decrypted wrongly.
I cannot isolate the fault - the error may be on the encryption side, i may very well be on decryption side.
Thanks
norm
|
|
|
|
|
How can I multiple single instance application ?
Thank you for your kindness
|
|
|
|
|
Hi,
If I understood, you have some app, limited to be single instance and you want to run it simultaneously.
This is usually done by the creating some system-wide named resource, created by the first instance. Then other instances only check, if there such a resource exists. If yes, they exit immediatelly.
So in a generic way, you must avoid the second instance to find that resource, or remove the checking part of code.
But here I must mention, that this can have unpredictable results. At first, the designers of the app usually have some reason for implementing such a feature, second reason, forcing to close some handle, which application thinks is still open, may lead to crashes or some other odd results.
|
|
|
|
|
HI, when I open an oledb recordset class created with oledb wizard on VC++ .NET it runs fine but on the output window is printed the following message:
First-chance exception at 0x77e4d756 in HistoriasMedicas.exe: 0x000006BA: RPC Server not available
The last part of the message was translated by me from spanish, sorry if it's not clear, anyone with ideas about the exception please send comments...
Thanks in advance
W. Zayas
|
|
|
|
|
Hi. I am still looking for a good book on C++ Network Programming, specificly I want to get my programs to talk to a web server. I found the perfect book, but when I got home, I realized it was a C# book! Anyway, does anyone know a good "C++" book on that subject?
-- Steve
|
|
|
|
|
hi,
i am having a problem with the coding for changing the screen saver .... i have called a CFileDialog object...and passed the filename of the screen saver..but when i try to retreive the .SCR file..i get a different name in the registry....
for eg...if i am trying to open a .SCR file named "3D Pipes"....this name appears in the registry like "sspipes.scr"....can u find a solution to this problem?
|
|
|
|
|
sspipes.scr is the filename for the 3d pipes screensaver. '3d pipes' is the name of the saver, not the filename of the saver.
If i've missed the point and not helped at all, please give a better description of what you are trying to achieve and how you are going about it and i will try to provide u=you with some better help.
Jase
-------------------------------------------------------------------------------------------------------------------------------------------------------------------
View your digital photos and images with ease using the ultimate desktop image manager for Microsoft Windows
Download your free copy of SlideShow Desktop today from http://www.slideshowdesktop.com
|
|
|
|
|
When my application is minimized to the task bar, updating the window title
updates the tool tip text in real time from my OnTimer() handler. Thus, if the
mouse cursor hovers over the application icon in the task bar, I can display a
countdown timer. However, if the program is minimized to the system tray, the
tool tip is only updated when I move the mouse cursor away and back, forcing
the tip to be freshly drawn: It seems that Windows fetches the tool tip text
for the system tray icon once when the mouse hovers first over the icon, and
never again.
I've spent many hours following leads from doing searches on Google,
CodeProject and CodeGuru for "system tray tool tip real time" and all I find
are basic articles about how to add the icon to the system tray, or animate the
icon itself.
The m_IconData structure is properly set up in the InitDialog() method, and
displays the system tray icon correctly:
m_IconData.cbSize = sizeof(NOTIFYICONDATA);
m_IconData.hWnd = m_hWnd;
m_IconData.uID = 0;
m_IconData.uFlags = NIF_MESSAGE | NIF_ICON | NIF_TIP;
m_IconData.uCallbackMessage = WM_TRAY_NOTIFY;
m_IconData.hIcon = pApp->m_hIcon;
GetWindowText(csItem); // known to be <63 chars. here
strcpy(m_IconData.szTip,csItem);
Shell_NotifyIcon(NIM_ADD,&m_IconData);
This is the code I'm using in my OnTimer() routine, which does not update the
tool tip text in real time:
GetWindowText(m_IconData.szTip,63); // read updated title text
m_IconData.szTip[63] = '\0'; // insure C string terminated
Shell_NotifyIcon(NIM_MODIFY,&m_IconData); // update the tool tip text
The tool tip text _is_ being updated, just not on the screen.
How do I get the screen to update?
TIA.
________________________________________________________________
L5 Software Development - "out of this world" sites and software
ThmIndxr(tm), the *only* HTML thumbnail/indexer you need!
http://www.L5Software.com/go?ThmIndxr
wCapLock(tm), makes CapsLock work like it does on a typewriter
http://www.L5Software.com/go?wCapLock
BannerAds(tm), join multiple affiliate programs with one banner
http://www.L5Software.com/go?BannerAds
KeywordGo(tm), provides keyword access to your popular pages
http://www.L5Software.com/go?KeywordGo
Domain registration only $15.95/year, $29.95/2 years
http://FKEinternet.com/domains/
For private sector (commercial) space development, visit
http://www.L5Development.com
|
|
|
|
|
I'm having a problem with specifying command line arguments, as the second parameter, when calling CreateProcess. If the argument string has "-root" in it, the called program doesn't receive that. For example, if I specify "-root -server", the called program only gets "-server". Is that a bug, or an "undocumented feature"?
Thanks!
|
|
|
|
|
Pass NULL as the first param, and the entire command line (with the EXE name quoted if necessary) as the second.
bSuccess = CreateProcess ( NULL, _T("C:\\path\\to\\program.exe -root -server"), ... );
--Mike--
"Adventure. Excitement. A Jedi craves not these things."
-- Silent Bob
1ClickPicGrabber - Grab & organize pictures from your favorite web pages, with 1 click!
My really out-of-date homepage
Sonork-100.19012 Acid_Helm
|
|
|
|
|