locked
Why I can't get my crashes in winqual account? RRS feed

  • Question

  • Hi!

     

    Continue working with WER Api in Delphi

    Part I "Some questions about WER "I

     

    I try to integrate WER support in delphi application and write own exception process based on WerReportCreate and WerReportSubmit functions.

    I'm raise exception, get right Bucket ID (50248784) and view status : Report Sent (see next screenshot)

     

     

    I can't get this^^^ report in winqual portal!

    (I think - problem in wrong version maping, but in Part II "What are the main parameters..."   I understood what main map parameters is FileName, FileVersion, and Linkdate)

     

    But if I'm re-raise exception in the Application.OnException event handler (this way to bypass Delphi exception handlers)

    the Windows Error Reporting dialog is shown and application is terminated and this event appear in winqual account since 11 days! So long, but appear!

     

    This ^^^report^^^ apperar in my account sonce 11 days!

    Sorry at screnshot with russian Vista, but I pass test cases on Vista Ultimate Russian and don't install English version.

     

    What difference between this two reports?

    I see difference only in not localized in my problem signature table on first screenshot.

     

    This my sample code:

     

    Delphi code

    program ProjectMyTestWERApi;

    {$APPTYPE CONSOLE}
    ...

    var
      P : TObject;
      hReportHandle : HREPORT;
      werReportInfo : WER_REPORT_INFORMATION;
      eventType : PWideChar;
      Res : hResult;
      PS1, PS2 : WideString;
      Ver : TVersionInfo;
      hMyModule : HMODULE;
      ModuleName : WideString;
      submitOptions : DWORD;
      HF : integer;
      Offset : integer;
    begin
      WriteLn('Program start');
     
    try
        P := nil;
        WriteLn(P.ClassName);
    //<--- Raise access violation here, P = nil!
      except
       on E : EAccessViolation do
        begin
          FillChar(werReportInfo, SizeOf(werReportInfo), 0);
          werReportInfo.dwSize := sizeof(werReportInfo);

          StringToWideChar(
    'Stopped working', werReportInfo.wzFriendlyEventName,

                            Length('Stopped working')+1);
          StringToWideChar(
    'ProjectMyTestWERApi.exe', werReportInfo.wzApplicationName,

                            Length('ProjectMyTestWERApi.exe')+1);
          StringToWideChar(E.
    Message, werReportInfo.wzDescription, Length(E.Message)+1);

          eventType := APPCRASH_EVENT;

          Res := WerReportCreate(eventType, WerReportApplicationCrash, 

                                 @werReportInfo, @hReportHandle);
         
    if Res = S_OK then
            begin

              PS1 := 'Application Name';
              PS2 := ExtractFileName(
    'ProjectMyTestWERApi.exe');
              WerReportSetParameter(hReportHandle,
    0, Addr(PS1[1]), Addr(PS2[1]));

              PS1 :=
    'Application Version';
              Ver := TVersionInfo.Create(
    'ProjectMyTestWERApi.exe');
              PS2 := Ver.FileVersion;
              WerReportSetParameter(hReportHandle,
    1, Addr(PS1[1]), Addr(PS2[1]));
              Ver.Free;

              hMyModule := GetModuleHandle(
    nil);

             
    // determinate file datetime
              HF := FileOpen('ProjectMyTestWERApi.exe', fmOpenRead or fmShareDenyNone);
              PS1 := FormatDateTime(
    'd.mm.yyyy, h:nn',

                                     FileDateToDateTime(FileGetDate(HF)));
              FileClose(HF);
              WerReportSetParameter(hReportHandle,
    2, 'Application Timestamp',

                                    Addr(PS1[1]));

           
    // determine module name from crash address
              PS1 := Format('%p', [ExceptAddr()]);
              GetModuleHandleExW(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS
    or

                                 GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT,

                                 Addr(PS1[1]), hMyModule);
              SetLength(ModuleName, MAX_PATH);
              GetModuleFileNameW(hMyModule, Pointer(moduleName), Max_Path);
              PS1 := ExtractFileName(Copy(ModuleName,
    1, Pos(#0,ModuleName)));
              WerReportSetParameter(hReportHandle,
    3, 'Fault Module Name', Addr(PS1[1]));

             
    // Fault module version
              PS1 := .... // skip this code
              WerReportSetParameter(hReportHandle,
    4, 'Fault Module Version',

                                    Addr(PS1[1]));


              //Fault Module Timestamp
              PS1 := .... // skip this code
              WerReportSetParameter(hReportHandle,
    5, 'Fault Module Timestamp',

                                    Addr(PS1[1]));

             
    //Exception Code
              if E.ExceptionRecord <> nil then
                PS1 := IntToHex(E.ExceptionRecord^.ExceptionCode, 8) else PS1 := 'Unknown';
              WerReportSetParameter(hReportHandle,
    6, 'Exception Code', Addr(PS1[1]));

             
    //Offset
              Offset := StrToInt('$'+Format('%p', [ExceptAddr])) -

                        Integer(GetModuleHandle(nil));
              PS1 := IntToHex(Offset,
    8);
              WerReportSetParameter(hReportHandle,
    7, 'Exception Offset', Addr(PS1[1]));

             
    // test own parameter "Additional Information 1"
              PS1 := 'Additional Information 1';
              PS2 :=
    '<<<Структура вызовов>>>';
              WerReportSetParameter(hReportHandle,
    8, Addr(PS1[1]), Addr(PS2[1]));

             submitOptions := WER_SUBMIT_OUTOFPROCESS
    or WER_SUBMIT_NO_CLOSE_UI;
             WerReportSubmit(hReportHandle, WerConsentNotAsked, submitOptions,

                             @submitResult);


                
    case submitResult of
                 WerDisabled:
                        WriteLn(
    'Error reporting was disabled.');
                 WerDisabledQueue:
                        WriteLn(
    'Queuing was disabled.');
                 WerReportAsync:
                        WriteLn(
    'Report was asynchronous.');
                 WerReportCancelled:
                        WriteLn(
    'Report was cancelled.');
                 WerReportDebug:
                        WriteLn(
    'Debug button clicked.');
                 WerReportFailed:
                        WriteLn(
    'Report submission failed.');
                 WerReportQueued:
                        WriteLn(
    'Report queued.');
                 WerReportUploaded:
                       WriteLn(
    'Report uploaded');
            
    end;
           WerReportCloseHandle(hReportHandle);
          
    end
        end;
    end.

     

    What problem in my report or report parameters?

    I can't understand - what is my problem?

    Help me please!

     

    Thank you!

     

    • Moved by Max Wang_1983 Tuesday, April 26, 2011 5:30 PM forum consolidation (From:Windows Error Reporting for ISVs)
    Tuesday, September 11, 2007 10:56 AM

Answers


  • Hi Nikolai,

    I would try both. You may also want to see what is recorded for application crashes that don't have top-level excepting handling for comparison. Trial and error is unfortunately necessary here as you're in uncharted waters. I suspect that the parameter index may be more important than the actual string used.

    Good luck,
    -Saar

    Thursday, September 13, 2007 6:57 AM

All replies


  • Hi Nikolai,

    I'm not sure if this is the cause, but I noticed in the first event the timestamp seems to have been formatted differently than in the secon. Normally this is the hex-encoded 32-bit integer representing seconds since December 31st, 1969 at the time the file was compiled. (More information about the file PE header here.)

    The second report looks correct. Perhaps that is why the first one failed?

    Regards,
    -Saar Picker
    Wednesday, September 12, 2007 6:01 AM
  •  

    Hi Saar Picker!

     

    Thank you for response, I'l try to correct my timestamp and check it...

     

    But I have last question:

     

    What is proper way to fill parameters in WerReportSetParameter() function?

    I'm afraid, this is the main problem!

     

    In second report I'm get localized names of this parameters,

    But in my first report I'm assign this names like 'Application Name', 'Fault Module Timestamp', 'Fault Module Version', 'Exception Code'...

     

    How to determinate Fault Module Timestamp parameter in Windows Vista Russian is 'Fault Module Timestamp' or 'Штамп времени модуля с ошибкой' (russian name of this parameter) or Windows Vista WER understand both names: localized and english?

     

    Thanks,

    Nikolai

    Wednesday, September 12, 2007 8:51 AM

  • Hi Nikolai,

    I would try both. You may also want to see what is recorded for application crashes that don't have top-level excepting handling for comparison. Trial and error is unfortunately necessary here as you're in uncharted waters. I suspect that the parameter index may be more important than the actual string used.

    Good luck,
    -Saar

    Thursday, September 13, 2007 6:57 AM