Delphi Pages Forums

Delphi Pages Forums (http://www.delphipages.com/forum/index.php)
-   General (http://www.delphipages.com/forum/forumdisplay.php?f=2)
-   -   Delphi 5: Access violation at address 767E139D in module 'kernel32.dll' (http://www.delphipages.com/forum/showthread.php?t=217809)

rmt 11-14-2018 04:34 AM

Delphi 5: Access violation at address 767E139D in module 'kernel32.dll'
 
Dear Expert,

I have a Delphi Application where I generate Report that uses Report Builder.
I am getting an error "Access violation at address 767E139D in module 'kernel32.dll'" in machine with windows server 2012 R2. However, there is no problem in other machine.

Kindly suggest what might be the issue. The code is as below:

HTML Code:

Procedure TfrmEODStatusRep.OpenDataSet;
VAR vBr,vFileName,FilePath:string;
RecordsAffected,i:Integer;
txt:TextFile;
begin
try
try
        screen.Cursor := crHourGlass;
        ADOCon:=TmbAdoConnection.create(nil);
        ConnectTo(ADOCon);
        vBr:='NULL';

        with ADODataSet1 do
        begin
        Connection:=ADOCon;

        ADOStoredProc1.Connection:=Adocon;
        ADOStoredProc1.ProcedureName := 'EODStatusRep ';
        ADOStoredProc1.Parameters.Refresh;
        ADOStoredProc1.Parameters.ParamByName('@BR').Value  := vBr;

        ADODataSet2.Connection:=Adocon;
        ADODataSet3.Connection:=Adocon;
        ADODataSet4.Connection:=Adocon;
        ADODataSet5.Connection:=Adocon;
        ADODataSet6.Connection:=Adocon;
        ADODataSet7.Connection:=Adocon;
        ADODataSet8.Connection:=Adocon;
        ADODataSet9.Connection:=Adocon;
        ADODataSet10.Connection:=Adocon;
        ADODataSet11.Connection:=Adocon;
        ADODataSet12.Connection:=Adocon;
        ADODataSet13.Connection:=Adocon;
        ADODataSet14.Connection:=Adocon;
        ADODataSet15.Connection:=Adocon;
        ADODataSet16.Connection:=Adocon;

        ADOStoredProc1.ObjectView := True;
        ADOStoredProc1.Open;
        ADODataSet1.Recordset := ADOStoredProc1.Recordset;


        ADODataSet2.RecordSet := ADOStoredProc1.NextRecordset(RecordsAffected);
        ADODataSet3.RecordSet := ADOStoredProc1.NextRecordset(RecordsAffected);
        ADODataSet4.RecordSet := ADOStoredProc1.NextRecordset(RecordsAffected);
        ADODataSet5.RecordSet := ADOStoredProc1.NextRecordset(RecordsAffected);
        ADODataSet6.RecordSet := ADOStoredProc1.NextRecordset(RecordsAffected);
        ADODataSet7.RecordSet := ADOStoredProc1.NextRecordset(RecordsAffected);
        ADODataSet8.RecordSet := ADOStoredProc1.NextRecordset(RecordsAffected);
        ADODataSet9.RecordSet := ADOStoredProc1.NextRecordset(RecordsAffected);
        ADODataSet10.RecordSet := ADOStoredProc1.NextRecordset(RecordsAffected);
        ADODataSet11.RecordSet := ADOStoredProc1.NextRecordset(RecordsAffected);
        ADODataSet12.RecordSet := ADOStoredProc1.NextRecordset(RecordsAffected);
        ADODataSet13.RecordSet := ADOStoredProc1.NextRecordset(RecordsAffected);
        ADODataSet14.RecordSet := ADOStoredProc1.NextRecordset(RecordsAffected);
        ADODataSet15.RecordSet := ADOStoredProc1.NextRecordset(RecordsAffected);
        ADODataSet17.RecordSet := ADOStoredProc1.NextRecordset(RecordsAffected);
        ADODataSet18.RecordSet := ADOStoredProc1.NextRecordset(RecordsAffected);
        ADODataSet19.RecordSet := ADOStoredProc1.NextRecordset(RecordsAffected);
        ADODataSet20.RecordSet := ADOStoredProc1.NextRecordset(RecordsAffected);
        ADODataSet21.RecordSet := ADOStoredProc1.NextRecordset(RecordsAffected);
        ADODataSet22.RecordSet := ADOStoredProc1.NextRecordset(RecordsAffected);

        ADODataSet1Detail.RecordSet := ADOStoredProc1.NextRecordset(RecordsAffected);


        i:=1;
        WITH ADODataSet16 DO
        BEGIN
                ACTIVE:=FALSE;
                CommandText:=  'IF OBJECT_ID(''[DBO].[FileVersionTemp]'') IS NOT NULL '+
                                ' EXEC(''DROP TABLE FileVersionTemp'')'+
                                ' SELECT CAST(null AS INT) AS GroupDummy ,CAST(NULL AS NVARCHAR(75))AS SCNAME,'+
                                        'CAST(NULL AS NVARCHAR(11))AS SCFILEVERSION,CAST(NULL AS NVARCHAR(75))AS SCNAME2,'+
                                        'CAST(NULL AS NVARCHAR(11))AS SCFILEVERSION2 INTO FileVersionTemp'+

                                ' EXEC(''SELECT * FROM FileVersionTemp WHERE SCNAME IS NOT NULL'')'+
                                ' IF OBJECT_ID(''[DBO].[FileVersionTemp]'') IS NOT NULL'+
                                ' EXEC(''TRUNCATE TABLE FileVersionTemp'')';

                ACTIVE:=TRUE;
                while i<10 do
                begin
                        if i=1 then
                                vFileName:='MBIBService.exe'
                        else if i=2 then
                                vFileName:='RoutinePO.exe'
                        else if i=3 then
                                vFileName:='MBAppServer.Exe'
                        else if i=4 then
                                vFileName:='PeriodicOp.exe'
                        else if i=5 then
                                vFileName:='MBWin.Exe'
                        else if i=6 then
                                vFileName:='IB.DLL'
                        else if i=7 then
                                vFileName:='BATCHUPDATE.DLL'
                        else if i=8 then
                                vFileName:='MBBATCHSERVICES.EXE'
                        else if i=9 then
                                vFileName:='REPORTS.DLL';

                        if (i mod 2=1) then
                                append
                        else
                                Edit;
                        if (i mod 2=1) then
                                FieldByName('SCNAME').asstring:=vFileName
                        else
                            FieldByName('SCNAME2').asstring:=vFileName;

                        if (UPPERCASE(vFileName)=UPPERCASE('MBIBService.exe'))OR(UPPERCASE(vFileName)=UPPERCASE('MBBATCHSERVICES.Exe')) then
                                FilePath:='C:\MBSOURCE\OP\MBInternetBanking_XE'
                        else
                                FilePath:=GetSharedDir;

                        if FileExists(FilePath+'\'+vFileName) then
                        begin
                                if (i mod 2=1) then
                                        FieldByName('SCFILEVERSION').asstring:=GetVersionMBN(FilePath+'\'+vFileName)
                                else
                                        FieldByName('SCFILEVERSION2').asstring:=GetVersionMBN(FilePath+'\'+vFileName);
                        end;

                        FieldByName('GroupDummy').AsInteger:=1;

                        i:=i+1;
                end;
                adodataset16.post;
                ADODataSet16.UpdateBatch(arall);
        END;

        ppReport1.AllowPrintToFile := True;
        ppReport1.ShowPrintDialog := False;

        if NOT DirectoryExists(vFilePath) then
                BEGIN
                        if CreateDir(vFilePath) then
                                vFilePath:=vFilePath;
                END;

        ppReport1.TextFileName := vFilePath+'\'+FormatDateTime('YYYY_MM_DD',PrevRunDate)+'_EODStatusReport.PDF';
        ppReport1.DeviceType := 'PDFFile';


                if not IsFileInUse(ppReport1.TextFileName) then
                        ppReport1.print
                else
                        WriteToErrorLog('EOD Status Report File Opened ');

        ppReport1.DeviceType := 'Screen';
        if (FromMenuTF='T')then
                ppReport1.print
        else if (FromMenuTF='F')and (not vHideRepPreviewTF)  then
                ppReport1.print  ;

        ADOStoredProc1.Close;
        end;
except on E: Exception do
        begin
                Screen.Cursor:= crDefault;
                WriteToErrorLog('EOD Status Report '+E.Message);
        end;
end;
finally
freeandnil(adoCon);
Screen.Cursor:= crDefault;
end;
end;


Norrit 11-14-2018 09:23 AM

Most likely some permission issue somewhere.
Try to run your application as Administrator (explicitely right click the .exe -> run as administrator) and see if it works then.
Not sure if that ppReport1 thing does some crappy stuff in the background. I've used a component in the past that wrote some temporary stuff in c: root, which resulted in similar AV's.
Or perhaps it's already fixed by excluding your application from the DEP...

If it's not permission/DEP based you should consider some extra logging (MadExcept or so, you want to see the callstack when it goes wrong). Now you don't know which call is throwing this error, or at least you didn't specify it.


All times are GMT. The time now is 09:02 PM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2019, vBulletin Solutions, Inc.