Hello , Please give me hint.
I'm tried to Use DI Api in VB6 Com+ Component.
When My Program attempt to Connect SBO
a GPF occurs .
The code is Simple ,
And crash at this point:
ret = c.Connect '<<<<<<<<< CRASH !!
What Wrong !
Same code Used In ordinary dll Not Registered in COM+ Package
Work Well
This is a crash
-
dllhost.exe - Errore di applicazione
-
L'istruzione a "0x00000000" ha fatto riferimento alla memoria a "0x00000000". La memoria non poteva essere "written".
Fare clic su OK per terminare l'applicazione
Fare clic su Annulla per eseguire il debug dell'applicazione
-
OK Annulla
-
In Debugger Call stack Is :
OBServerDLL.dll!0217824b()
OBServerDLL.dll!02288ff3()
OBServerDLL.dll!02176f52()
OBServerDLL.dll!02288d6b()
OBServerDLL.dll!021c5fea()
In SQL Server Profiler Show this activity was Performed
select 504,c.name,c.description,c.definition from master.dbo.syscharsets c where c.id = convert(tinyint, databasepropertyex ( db_name() , 'sqlcharset')) go SET TRANSACTION ISOLATION LEVEL READ COMMITTED go select TOP 1 collation from syscolumns where collation is not NULL go declare @P1 int set @P1=NULL exec sp_prepexec @P1 output, NULL, N'Select * from SINF FOR BROWSE ' select @P1 go SELECT TOP 1 T0.* FROM [dbo].[SINF] T0 go declare @P1 int set @P1=NULL exec sp_prepexec @P1 output, NULL, N'Select * from SCAB FOR BROWSE ' select @P1 go SELECT T0.DbCab FROM [dbo].[SCAB] T0 WHERE T0.Version = 670189 go exec sp_reset_connection go SET TRANSACTION ISOLATION LEVEL READ COMMITTED go
Full Code of sample is :
Private Sub ConnectCompany(ByVal c As Company) TRACE "SERVER NAME = " & ServerName c.Server = ServerName TRACE "LICENSE SERVER = " & LicenseServer c.LicenseServer = LicenseServer If DbUser = "(null)" Or DbUser = "" Then TRACE "USE TRUSTED CONN " c.UseTrusted = True Else TRACE "UID = " & DbUser TRACE "PWD = " & DbPassword c.DbUserName = DbUser c.DbPassword = DbPassword End If TRACE "Company DB = " & CompanyDB c.CompanyDB = CompanyDB TRACE "USER NAME = " & UserName c.UserName = UserName TRACE "USER PWD = " & Password c.Password = Password Dim ret& TRACE "ATTEMP TO CONNECT " ret = c.Connect '<<<<<<<<< CRASH !! TRACE "RETURN CODE = " & ret CheckSapResult ret, c 'Uuum :-( 'Cannot Compile SET Because In TypeLib as been defind as Let ??? ''Set c.DTCTransactionObject = GetObjectContext().ContextInfo.GetTransaction() 'Using Let ??? Dim o As ObjectContext Set o = GetObjectContext() If Not o Is Nothing Then c.DTCTransactionObject = o.ContextInfo.GetTransaction() 'Not Reached End If End Sub
Appendix Assembly
02178194 jne 021781AF 02178196 mov dword ptr [edi],2340B28h 0217819C mov ecx,dword ptr [esp+8] 021781A0 mov dword ptr fs:[0],ecx 021781A7 pop edi 021781A8 pop esi 021781A9 add esp,0Ch 021781AC ret 4 021781AF cmp byte ptr [esi],0 021781B2 jne 021781CD 021781B4 mov dword ptr [edi],2340B08h 021781BA mov ecx,dword ptr [esp+8] 021781BE mov dword ptr fs:[0],ecx 021781C5 pop edi 021781C6 pop esi 021781C7 add esp,0Ch 021781CA ret 4 021781CD push 1Ch 021781CF call 021790F0 021781D4 add esp,4 021781D7 mov dword ptr [esp+18h],eax 021781DB test eax,eax 021781DD mov dword ptr [esp+10h],0 021781E5 je 021781F1 021781E7 push esi 021781E8 mov ecx,eax 021781EA call 021C9440 021781EF jmp 021781F3 021781F1 xor eax,eax 021781F3 mov ecx,dword ptr [esp+8] 021781F7 mov dword ptr [edi],eax 021781F9 pop edi 021781FA mov dword ptr fs:[0],ecx 02178201 pop esi 02178202 add esp,0Ch 02178205 ret 4 02178208 nop 02178209 nop 0217820A nop 0217820B nop 0217820C nop 0217820D nop 0217820E nop 0217820F nop 02178210 push 1 02178212 call 02176DE0 02178217 ret 02178218 nop 02178219 nop 0217821A nop 0217821B nop 0217821C nop 0217821D nop 0217821E nop 0217821F nop 02178220 mov eax,dword ptr [ecx] 02178222 mov al,byte ptr [eax+10h] 02178225 not al 02178227 and eax,1 0217822A ret 0217822B nop 0217822C nop 0217822D nop 0217822E nop 0217822F nop 02178230 mov eax,dword ptr fs:[00000000h] 02178236 push 0FFFFFFFFh 02178238 push 2288FF3h 0217823D push eax 0217823E mov dword ptr fs:[0],esp 02178245 sub esp,0Ch 02178248 push esi 02178249 mov esi,ecx <b> 0217824B mov eax,dword ptr [esi] <<<< Exception </b> 0217824D cmp eax,2340B28h 02178252 je 02178308 02178258 cmp eax,2340B08h 0217825D je 02178308 02178263 add eax,14h 02178266 lea ecx,[esp+8] 0217826A push eax 0217826B call 02187960 02178270 mov ecx,dword ptr [esi] 02178272 mov dword ptr [esp+18h],0 0217827A call 021C9910 0217827F cmp eax,1 02178282 jne 021782A7 02178284 lea ecx,[esp+8] 02178288 mov dword ptr [esp+18h],0FFFFFFFFh 02178290 call 02187980 02178295 mov al,1 02178297 pop esi 02178298 mov ecx,dword ptr [esp+0Ch] 0217829C mov dword ptr fs:[0],ecx 021782A3 add esp,18h 021782A6 ret 021782A7 push edi 021782A8 push 1Ch 021782AA call 021790F0 021782AF mov edi,eax 021782B1 add esp,4 021782B4 mov dword ptr [esp+8],edi 021782B8 test edi,edi 021782BA mov byte ptr [esp+1Ch],1 021782BF je 021782D4 021782C1 mov ecx,dword ptr [esi] 021782C3 call 021C9B60 021782C8 push eax 021782C9 mov ecx,edi 021782CB call 021C9340 021782D0 mov edi,eax 021782D2 jmp 021782D6 021782D4 xor edi,edi 021782D6 mov ecx,esi 021782D8 mov byte ptr [esp+1Ch],0 021782DD call 02176D90 021782E2 lea ecx,[esp+0Ch] 021782E6 mov dword ptr [esi],edi 021782E8 mov dword ptr [esp+1Ch],0FFFFFFFFh 021782F0 call 02187