Problem with unload sqlncli.dll
Posted: Sat 01 Aug 2009 16:59
Hello.
I want to unload unused sqlncli.dll.
Code like this:
I know that sqlncli.dll has global reference count. It is checked in DllCanUnloadNow function. I know address of this global variable and can watch it's value in "Watch list".
I have version of sqlncli.dll = 2005.90.4035.0. Address of global var is $33999480. You can see it in first instuction of DllCanUnloadNow in CPU window like this:
After call MSConnection1.Open RefCount = 4. But after call MSConnection1.Close = 1.
I found that ref count increment on call Uninitialize method of IDBInitialize in this code:
Need urgent help. My developer license number is CRSDA-02437.
Thanks.
I want to unload unused sqlncli.dll.
Code like this:
Code: Select all
procedure TForm1.Button1Click(Sender: TObject);
begin
MSConnection1.Open;
MSConnection1.Close;
CoFreeUnusedLibrariesEx(200, 0);
Sleep(300);
CoFreeUnusedLibrariesEx(200, 0);
end;
I have version of sqlncli.dll = 2005.90.4035.0. Address of global var is $33999480. You can see it in first instuction of DllCanUnloadNow in CPU window like this:
Code: Select all
sqlncli.DllCanUnloadNow:
338C10F2 833D8094993300 cmp dword ptr [$33999480],$00
....
I found that ref count increment on call Uninitialize method of IDBInitialize in this code:
Code: Select all
procedure TOLEDBConnection.Disconnect;
begin
if FConnected then begin
if FNativeConnection then begin
if FIDBInitialize nil then
FIDBInitialize.Uninitialize;// check not need
ReleaseInterfaces;
end;
FConnected := False;
FreeAndNil(FColumnsMetaInfo);
FreeAndNil(FColumnsRowsetFieldDescs);
end;
end;
Thanks.