|
Yes ok I will try it. I have a Worker Thread running (Thanks to Papa) so that may not be the issue.
Best Wishes,
ez_way
|
|
|
|
|
Hi All,
I need to decrypt a file encrypted by a php script..it can be any algorithm which is good enough and cannot be cracked easily..if it cannot be cracked at all will be the best solution..but for now i am just looking for any of the MCrypt encryption algorithm that can encrypt the data good enough not to be cracked..easily...and that can be decrypted easily using VC++...can someone help me out in doing the same..I need it very urgently...any of the algorithm..Rijndael..or Blowfish or anyone..but it can also be decrypted easily..Any help or pointers are highly appreciated...
Thanks a lot..
Regards
Himanshu
|
|
|
|
|
Have you tried md5() ?
I know of at least 2 VC 6.0 classes that can work with the hash. But that is not the same as true encryption.
I wrote one called blackhorse a few years back. If you want to use please email direct.
Best Wishes,
ez_way
|
|
|
|
|
Just for clarifying, not to be offensive - if you 'encrypt it' with md5 you'll not able to get the plaintext back from the 'ciphertext'. That's why md5 is called one-way. There's no way back.
|
|
|
|
|
you have plenty of algorithms - you named few of them Blowfish, RC4, 3DES... choice is up to you - most of these algos are proven and verified by time. If you have enough CPU time you can consider using asymetric cryptography.
None of the mentioned algos was cracked if it was used with reasonable key size.
Only problem you'll probably have is the key management
|
|
|
|
|
I'm working with MFC. I defined OnSysChar, and tested it via SendMessage(WM_SYSCHAR,...) and it is working. However, it never receives control after I press any key with ALT; in fact it NEVER receives control (except for the self-generated message), no matter what I press anyway.
What can the problem be? I don't have PreTranslateMessage, OnKeyDown, OnKeyUp.
Testwise I defined OnChar; the same is (not) happening: it never receives control.
|
|
|
|
|
hi all, sorry this is a re-post but i can't believe the lack of info on USB
communications! surely the new USB technology is taking over COM ports.
my new you-beaut program is ready to roll except for one thing, the program on the USB drive must autorun once it is connected..
I've been doing a bit of research on making my USB drive to autorun. Based on what i've gathered, "the device must not be marked as a removable media device" - microsoft
would anybody know how to achieve this??
(i've considered writing a hook application to handle the autorun side of things. but i would consider this as the very very last option)
cheers,
mike
|
|
|
|
|
Hi, Mike,
I know that it has been over three years since you posted this request for help in getting an application to autorun from a USB drive, but did you ever find a solution to the problem. I am trying to do the same thing. You mentioned writing a hook application to do this. Did you do that? What did you hook? Some kind of volume mounted event? I haven't written a hook application, so if you could share any information that you have, I would appreciate an email to rfickling@iac-onlime.com.
Thanks,
Royce
|
|
|
|
|
I want to access database which is in MY SQL on Linux machine from my "C" prgram without creating DSN. For that i have used function SQLDriverConnect as follows.
#define MAXBUFLEN 255
SQLHENV hEnv = SQL_NULL_HENV;
SQLHDBC hDBC = SQL_NULL_HDBC;
SQLHSTMT hStmt = SQL_NULL_HSTMT;
SQLCHAR ConnStrIn[MAXBUFLEN] =
"DRIVER={MYSQL ODBC 3.51 driver};SERVER=192.168.1.60;"
"UID=m;PWD=m;DATABASE=ftp;";
SQLCHAR ConnStrOut[MAXBUFLEN];
SQLSMALLINT cbConnStrOut = 0;
RETCODE retcode; // Return code
retcode = SQLDriverConnect(hDBC,// Connection handle
NULL, // Window handle
ConnStrIn, // Input connect string
SQL_NTS, // Null-terminated string
ConnStrOut, // Address of output buffer
MAXBUFLEN, // Size of output buffer
&cbConnStrOut,// Address of output length
SQL_DRIVER_NOPROMPT);
It returns SQL_ERROR.
Can you please suggest me where i am going wrong. I think it is in the "ConnStrIn".
|
|
|
|
|
Hi there,
I am trying to cache an CF_HDROP of filename handles, (to be dropping into the xp cd burning wizard). This used to work, but lately it stopped working (perhaps because of a Platform Sdk upgrade exposed something I was doing wrong). It works fine dropping to other apps like Nero, or even normal explorer windows.
Has anyone every implemented a Ole Drop Target that can be successfully dropped onto the winxp cd writing wizard window?
Is there anything I'm doing wrong in the following code? I can't seem to see it. I tried replacing "CacheData" with "CacheGlobalData", but still have problems. CacheGlobalData fails in a call to ::GlobalSize(). If CacheData is used, CCmdTarget::~CCmdTarget() fails an assertion, ASSERT(m_dwRef <= 1), and the files don't get copied in.
<br />
void <br />
cPkpCollectFinishWizardPage::OnBeginDragDragList(NMHDR* Header, LRESULT* <br />
pResult) <br />
{<br />
const cPkpCollection* Collection = GrabCollection();<br />
<br />
if(Collection)<br />
{<br />
cFilenameChain FilenameChain;<br />
Collection->GetDropFiles(FilenameChain);<br />
<br />
if(!FilenameChain.IsVoid())<br />
{<br />
NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)Header;<br />
<br />
int item = pNMListView->iItem;<br />
<br />
cSimpleListControl* List = &m_DragList;<br />
CString Label = List->GetItemText(item, 0);<br />
int labelLength = Label.GetLength() + 1;
<br />
DWORD bitmapId = BMP_PHOTO_IMAGE;<br />
<br />
HDROP dropHandle = FilenameChain.ConstructDropped();<br />
<br />
if(dropHandle)<br />
{<br />
COleDataSource* DataSource = new COleDataSource;<br />
<br />
STGMEDIUM StgMedium;<br />
StgMedium.tymed = TYMED_HGLOBAL;<br />
StgMedium.hGlobal = (HGLOBAL)dropHandle;<br />
StgMedium.pUnkForRelease = NULL;<br />
<br />
DataSource->CacheData(CF_HDROP, &StgMedium);<br />
<br />
PostMessage(UM_PKP_HANDLE_BEGIN_DRAG, (UINT)DataSource, <br />
item);<br />
}<br />
}<br />
}<br />
<br />
*pResult = 0;<br />
}<br />
<br />
LRESULT<br />
cPkpCollectFinishWizardPage::OnHandleBeginDrag(WPARAM wParam, LPARAM lParam) <br />
{<br />
COleDataSource* DataSource = (COleDataSource*)wParam;<br />
<br />
int item = lParam;<br />
<br />
if(!DataSource)<br />
{<br />
ASSERT(false);<br />
}<br />
else<br />
{<br />
cPoint Point;<br />
cPoint ClientPoint;<br />
GetCursorPos(&Point);<br />
<br />
ClientPoint = Point;<br />
<br />
cSimpleListControl* List = &m_DragList;<br />
ScreenToClient(&ClientPoint);<br />
<br />
DROPEFFECT result = DataSource->DoDragDrop(DROPEFFECT_MOVE|DROPEFFECT_COPY, <br />
NULL, m_DropSource);<br />
}<br />
<br />
delete DataSource;<br />
DataSource = NULL;<br />
}<br />
<br />
return NOTHING;<br />
}<br />
<br />
ConstructDropped() does a <br />
<br />
DWORD globalDataLength = sizeof(DROPFILES) + filesLength;<br />
globalHandle = ::GlobalAlloc(GPTR, globalDataLength); <br />
char* FilesData = (char*)::GlobalLock(globalHandle);<br />
<br />
DROPFILES* DropFiles = (DROPFILES*)FilesData;<br />
DropFiles->fNC = false;<br />
DropFiles->fWide = false;<br />
DropFiles->pFiles = sizeof(DROPFILES);<br />
DropFiles->pt.x = 0;<br />
DropFiles->pt.y = 0;<br />
<br />
... and puts the strings in...<br />
code><br />
<br />
?<br />
<br />
Thanks in advance! <br />
<br />
[b]yte your digital photos with [ae]phid [p]hotokeeper - <a href="http:\\www.aephid.com\photokeeper-default-frame-codeproject.shtml">www.aephid.com</a>.
|
|
|
|
|
I have created a wh_getmessage hook and filtered all the keyboard messages going to the system wide application.
NOw i have the msg structure with me
i have to change the wm_char obtained from the msg structure to extended ascii character
how to do this??????
Is there no experts in the world who like to give a try???
please
|
|
|
|
|
LRESULT CALLBACK MyGetMsgProc(int code, WPARAM wParam, LPARAM lParam)
{
if ( code < 0 ) {
return ::CallNextHookEx( hHook, code, wParam, lParam );
}
MSG* pMsg = reinterpret_cast<MSG*>( lParam );
if ( WM_CHAR == pMsg->message ) {
TCHAR ch = static_cast<TCHAR>( pMsg->wParam );
// Do something with it
}
return ::CallNextHookEx( hHook, code, wParam, lParam );
}
Dave
http://www.cloudsofheaven.org
|
|
|
|
|
Thank you Mr. Dave for trying my question and i am confident that you may provide me the answer what i am looking for.
I am just a begginer in Vc++ and so could you give some comments on the line of codings you have put for me.
For i couldnt get the idea
Like in pmsg i will get the character say Wm_char = A.Then what i need is to replace this A with € .
Please give me some comments and illustrations.
Still Thank you very much.
|
|
|
|
|
The first three lines of the function, handle the case where the code is less than zero. According to MSDN for the get message hook, in that case we must immediately call CallNextHookEx() without doing anything else.
Then we retrieve the MSG structure (which defines a windows message). It is stored in the lParam passed to our callback function (again details from MSDN - look up SetWindowsHookEx() and follow the link for the get message hook).
Next we check that it is the WM_CHAR message - everything else we are ignoring. Once we have the WM_CHAR message, we know that the character is stored in the wParam of the message (check MSDN for WM_CHAR), and so can retrieve it from there.
If we wanted to modify the character, then we just set the value of pMsg->wParam at this point.
e.g.
...
if ( 'A' == ch ) {
// Modify the character
pMsg->wParam = 0x1234; // Some random unicode character
}
...
Dave
http://www.cloudsofheaven.org
|
|
|
|
|
Thank you Mr.Dave.
f ( 'A' == ch ) {
// Modify the character
pMsg->wParam = 0x1234; // Some random unicode character
}
Here you have given a unicode character but i am not using a unicode based application and the font i am going to use is true type which wont support unicode and so could you give me how to send an extended ascii character.
in place of unicode.
Thank you very much
|
|
|
|
|
The ASCII character set, both standard and extended, can be found from the MSDN Reference. Just surf to http://www.microsoft.com/msdn and use it's search function with keyword 'ASCII characters, table of codes'. This keyword will retrieve the ASCII character code table, at least on my latest MSDN Library release (April 2003).
To replace the 'random Unicode character', you need to replace the hex value. For example, based on the ASCII code table, a hex value of 0x9B would result in the Euro sign, if my eyes didn't fail me
The difference between standard ASCII and extended ASCII is that standard ASCII ranges from decimal values 0 to 127, and extended chart goes beyong 128, up until 255. The roots of this are in the original ASCII set. It was a 7-bit structure. Seven bits can represent 128 different states, hence the 'standard ASCII'. After the introduction of the new standard, a new ASCII structure was taken to use, consisting of 8-bits, hence, 256 different choices.
As for the Unicode, it is just another expansion: it boasts more bits. I think the first 256 states of a Unicode system still offer the same characters as the extended ASCII does, but beyond that, they are completely set-dependant.
-Antti Keskinen
----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
|
|
|
|
|
IsWindow(m_hwnd) returns 0.
Hi, guys:
I've met a problem that a new thread tests the window handle m_hwnd through IsWindow() but reurns 0.
below is related code:
/////////////////////////////////////////////
class MyClass
{
public:
HWND m_hwnd;
......
int run();
void * run_undetached();
};
void mainfunc()
{
......
MyClass a;
a.run();
}
int MyClass::run()
{
......
m_hwnd = CreateWindow(......);
//start the run_undetached() in a new thread here.
......
}
void * MyClass::run_undetached()
{
......
if ( !IsWindow(m_hwnd))
outputmsg("m_hwnd is not a window!");
}
/////////////////////////////////////////////
any comments?
TIA
|
|
|
|
|
The remarks in MSDN for IsWindow() actually say that a thread should not call IsWindow() for a window that it did not create because the window could be destroyed after the function is called - so that's not a promising start...
Anyway, here's a couple of likely reasons for your problem:
1) Does the call to CreateWindow() succeed? If not, then obviously IsWindow() will not succeed either.
2) When does the window get destroyed? If it is destroyed in the MyClass destructor, then this will be called at the end of the scope of the MyClass object (since it is created on the stack). From the code snippet above, that means that it will be called when mainfunc() terminates, which, unless you have some sort of syncrhonisation, will be before your thread function terminates. Consequently, the window will be destroyed before the thread gets around to using it.
Dave
http://www.cloudsofheaven.org
|
|
|
|
|
thanks for your reply !
1) CreateWindow succeeds clearly!
2) the window will be available till mainfunc() terminates.
more help ?
|
|
|
|
|
Well that's your problem then. When mainfunc() terminates, your class will be destroyed, and so will the window. Then your other thread will be calling IsWindow() on a random piece of memory (the HWND has been destroyed, and so now is just a random number), so it will not work. You need to ensure that your class is not destroyed for the lifetime of the other thread.
Dave
http://www.cloudsofheaven.org
|
|
|
|
|
Greets,
Yes, a comment I have is that there is not enough context; you can't see what run_undetached returns and it's not clear as to whether or not CreateWindow() returned null. What are you trying to do that I may have missed from your code?
Regards,
Joe
|
|
|
|
|
MFC does not support access of CWnd's from threads other than the ui thread, which I think is what you are doing.
There are two approaches you can take:
1. Pass the HWND only to the other thread, and have it use the Windows api directly.
2. Use ::PostMessage() from the other thread on that window handle and trap the message in you main ui thread, and process it there. (I would strongly recommend this approach, as you really shouldn't be accessing windows from threads other than the main ui thread (except to post window messages)).
Cheers,
Swine
[b]yte your digital photos with [ae]phid [p]hotokeeper - www.aephid.com.
|
|
|
|
|
Hi all,
Anyone could please suggest me were to find some info on how to change the background of a Dialog Bar?
I've been desperately trying to accomplish this, but I think now I am lost.
I tried to derive a class from CDialogBar to override the OnCtlColor function, but now I think this is the hard way, and there might be an easier way.
Any suggestions will be greatly appreciated!
Alfredo
|
|
|
|
|
I may have programmed myself into a corner, anyways here is my situation.
I have a full screen dialog based application that serves as a menu.
Note: The main application and the plugins are all drawn using GDI+ so
I am not forced to use a dialog base application, but it happens
to be the direction I choose.
The menu has buttons which can:
a) start a dialog based dll b) Run an executable c) Execute a command
My intension was that this application would:
1) Act as a menu.
2) Watch for keyboard presses and send a message to plugins stating which key was pressed.
3) Watch for UIR (remote control) commands and send a message to the plugins stating commands
received.
4) It was not my intention to have each dll do #2 nor #3
Problem:
1) When I start a plugin from the menu application it no longer does anything. I placed a timer which fired every 4 seconds calling the MessageBeep(..) function and it was not called while the plugins dialog was active. So, it seems that there is no persistance when using dialogs the way I am using them.
Question:
How do I get around this problem? I want the main application to work as I have described above.
I am open to complete redesign or whatever options or opinions anyone might have.
Thanks,
Steve
|
|
|
|
|
I'll try to approach this problem from a perspective more closer to mine.
So, let's formulate that you have a standard Windows application, with a dialog as a main window. Okay, your application now loads two DLLs into it's address space. After these DLLs are loaded, you need to use GetProcAddress to get an address of an exported function, which you can then call from your application.. Correct ? No ?
Are your plugins supposed to act as little programs of their own ? Then you need to create a new thread and post the function to execute on that thread for the thread creator. For example, the Kernel creates a thread and specifies your 'WinMain' function to execute there. You can do the same: get the exported (worker) function from the DLL, and use it's address to start a new thread. Your function, then, can do anything it wants from just returning 'SUCCESS' to starting a message pump and creating a window. This is called multi-threading application, and is something I don't know much of. I've never needed it so far
You said that the plugins are represented as dialogs. So, let's assume you define a class for this dialog, a derived CDialog, for example. Then, you declare a global object in the 'DllMain', and use 'GetProcAddress' to get the address of an exported function, which does nothing more than return the address of this global object.
Here's the general flow chart:
Application XYZ starts -> App maps a DLL using LoadLibrary -> The DLLs DllMain routine creates a dynamic/static CMyDialog object -> The app uses GetProcAddress to get an exported function from the DLL and calls it -> This function returns the address of this object
App can now, in combination with the header file of the object, call dialog's member functions (Create / DoModal) and start it. Make it modal, specify your application window as parent, and vot, you got yourself an ordinary dialog
I believe using MFC classes this way requires a bit more thought, though, but this is the general idea. I am unsure how it works, look up MSDN for more help.
On the alternative, you can use the multi-threaded solution to create seperate threads for your plugin dialogs (Like, small applications with dialog as main window), then use SendMessage to send messages to these windows.
If this is not the idea you're after, then could you clarify more of your ideas. What is it that your plugins need to do ? Why are they placed in external DLL plugins ? Why just not objects inside your main application class ?
-Antti Keskinen
----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
|
|
|
|
|