Hi there . I can't call MD5Init() function. in fact i can't initialize MD5 message digest context . here is my code : #include // Declare pattern of function implementation int __stdcall WinMain(HINSTANCE, HINSTANCE, LPSTR, int); int __stdcall WndProc(HWND, UINT, WPARAM, LPARAM); CCoding clsCoding; // // MD5 structure information // typedef struct { ULONG i[2]; ULONG buf[4]; unsigned char in[64]; unsigned char digest[16]; } MD5_CTX; // // The MD5Init function initializes an MD5 message digest context. // typedef void (*MD5Init)(MD5_CTX*); // // The MD5Update function updates the MD5 context by using the supplied buffer for the message whose MD5 digest is being generated // typedef void (*MD5Update)(MD5_CTX*, unsigned char* input, unsigned int inlen); // // The MD5Final function ends an MD5 message digest previously started by a call to the MD5Init function // typedef void (*MD5Final)(MD5_CTX); // ============================== int __stdcall WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd) { // // Handle to the dll file // HINSTANCE hinstLib; // =============================== // Declare variable of type def // MD5Init InitializeMD5; MD5Update UpdateMD5; MD5Final FinalizeMD5; MD5_CTX md5Ctx; // ============================== hinstLib = LoadLibrary(L"Cryptdll.Dll"); // If the handle is valid try to get function address if (hinstLib != NULL) { InitializeMD5 = (MD5Init) GetProcAddress(hinstLib, ("MD5Init")); UpdateMD5 = (MD5Update) GetProcAddress(hinstLib, ("MD5Update")); FinalizeMD5 = (MD5Final) GetProcAddress(hinstLib, ("MD5Final")); // If the function address is valid try call function if (InitializeMD5 != NULL) { (InitializeMD5)(&md5Ctx); (UpdateMD5)(&md5Ctx,(unsigned char*) md5Ctx.in, 10); (FinalizeMD5)(md5Ctx); } } DialogBox(hInstance, MAKEINTRESOURCE(IDD_FORMMAIN), NULL, WndProc); return 0; }
Error : Run-Time Check Failure #0 - The value of ESP was not properly saved across a function call. This is usually a result of calling a function declared with one calling convention with a function pointer declared with a different calling convention. Where is the problem ?
DMASTER