Hi,
with reference to the previously posted question on
OPENSSL_malloc(), I tried to use this function in
Delphi but encounter error "Access violation in
ntdll.dll ... "
Using the CRYPTO_set_locking_callback example given
in OpenSSL, I converted it to Delphi.
Code:
var
lock_CS : array of THandle;
lock_CS := OPENSSL_malloc(CRYPTO_num_locks() *
sizeof(THandle));
....
OPENSSL_free(lock_CS);
When I called CRYPTO_thread_cleanup(), Turbo Debugger
reported a jump to NTDLL.DbgPrint (or somewhere near
there...). It is only when I call
CRYPTO_thread_setup(), my Delphi progam / Windows
finally gave a error prompt : "Access violation in
ntdll.dll ... ".
>From the asm trace in Turbo Debugger I discovered that
the jump to NTDLL.DbgPrint occurs during a function:
OPENSSL_free or CloseHandle. (I can't backtrace, I
infer from the sequence of event). I decided not to
use OPENSSL_malloc and use Delphi's setLength to set
the mem alloc for my array and the problem
disappears...
So, it is either something wrong with my Delphi
construct, that I didn't take care of the difference
between Delphi and C or there is something wrong with
the OPENSSL_free and/or OPENSSL_malloc.
Thus, I am hoping that anyone experienced this before
or is familiar with Delphi, can tell me wat's going
on. Thanks!
__________________________________
Do you Yahoo!?
New Yahoo! Photos - easier uploading and sharing.
http://photos.yahoo.com/
______________________________________________________________________
OpenSSL Project http://www.openssl.org
User Support Mailing List [EMAIL PROTECTED]
Automated List Manager [EMAIL PROTECTED]