Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

StartMainProcess: Error loading libcef.dll #506

Closed
hafedh-trimeche opened this issue Apr 6, 2024 · 5 comments
Closed

StartMainProcess: Error loading libcef.dll #506

hafedh-trimeche opened this issue Apr 6, 2024 · 5 comments

Comments

@hafedh-trimeche
Copy link

Hello,

CEF: 121.3.15
Chromium: 121.0.6167.184

Application raised this error:

StartMainProcess: Error loading libcef.dll

Error code : 0x00000057
The parameter is incorrect
@hafedh-trimeche
Copy link
Author

Solved!
dxil.dll not included inside the directory.

@hafedh-trimeche
Copy link
Author

Now these errors are reported:

[0406/214708.185:ERROR:network_change_notifier_win.cc(267)] WSALookupServiceBegin failed with: 0
[0406/214708.189:ERROR:core_audio_util_win.cc(316)] Failed to create Core Audio device enumerator on thread with ID 16580
[0406/214709.525:ERROR:network_change_notifier_win.cc(267)] WSALookupServiceBegin failed with: 0
[0406/214711.463:ERROR:network_change_notifier_win.cc(267)] WSALookupServiceBegin failed with: 0
[0406/214711.466:ERROR:core_audio_util_win.cc(316)] Failed to create Core Audio device enumerator on thread with ID 27864
[0406/214712.941:ERROR:network_change_notifier_win.cc(267)] WSALookupServiceBegin failed with: 0
[0406/214729.026:ERROR:network_change_notifier_win.cc(267)] WSALookupServiceBegin failed with: 0
[0406/214729.030:ERROR:core_audio_util_win.cc(316)] Failed to create Core Audio device enumerator on thread with ID 13344
[0406/214730.395:ERROR:network_change_notifier_win.cc(267)] WSALookupServiceBegin failed with: 0

@salvadordf
Copy link
Owner

It seems Chromium can't use the Core Audio API
https://source.chromium.org/chromium/chromium/src/+/main:media/audio/win/core_audio_util_win.cc;drc=f97f0d76be0b54403ef09d45f130c7aeec3798f9;l=352

And it doesn't know if the user is online
https://source.chromium.org/chromium/chromium/src/+/main:net/base/network_change_notifier_win.cc;l=267;bpv=0;bpt=1

Check that all the contents of the Release and Resources directories were copied to the application directory or in the directories indicated by GlobalCEFApp.FrameworkDirPath, GlobalCEFApp.ResourcesDirPath and GlobalCEFApp.LocalesDirPath.

@hafedh-trimeche
Copy link
Author

Hello,

Problem solved by setting DisableBackgroundNetworking to True and EnableMediaStream to False.

procedure CreateGlobalCEFApp;
begin
  GlobalCEFApp := TCefApplication.Create;
  with GlobalCEFApp do
  begin
    OnContextInitialized             := DoOnContextInitialized;

    AllowFileAccessFromFiles         := True;
    BlinkSettings                    := 'hideScrollbars=true,scrollAnimatorEnabled=false';
    DeleteCache                      := True;
    DeleteCookies                    := True;
    DisableBackForwardCache          := True;
    DisableBackgroundNetworking      := True;
    DisableComponentUpdate           := True;
    DisableImageLoading              := True;
    DisableJavascriptAccessClipboard := True;
    DisableJavascriptDomPaste        := True;
    DisableSpellChecking             := True;
    EnableGPU                        := False;
    EnableMediaStream                := False;
    EnableUsermediaScreenCapturing   := False;
    IgnoreCertificateErrors          := True;
    MultiThreadedMessageLoop         := False;
    MuteAudio                        := True;
    NoSandbox                        := True;
    PersistSessionCookies            := False;
    PersistUserPreferences           := False;
    SetCurrentDir                    := True;
    ShowMessageDlg                   := False;
    SmoothScrolling                  := STATE_DISABLED;
    TouchEvents                      := STATE_DISABLED;
    WindowlessRenderingEnabled       := True;

    if LogFile<>'' then
    begin
      ForceDirectories(ExtractFileDir(LogFile));
      LogFile     := LogFile;
      LogSeverity := LOGSEVERITY_ERROR;
    end;
  end;
end;

Would these parameters be tweaked to use this control only for converting HTML to PDF (Browser features not needed)?

Best regards.

@salvadordf
Copy link
Owner

The ConsoleBrowser2 demo uses a similar browser configuration to save the webpage as an image instead of a PDF but you can use similar GlobalCEFApp properties.

Setting GlobalCEFApp.MultiThreadedMessageLoop to False may require using a message pump (TCEFWorkScheduler or TFMXWorkScheduler) or using the "views" framework among other things. The default GlobalCEFApp.MultiThreadedMessageLoop value is the recommended setting for Windows applications.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants