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

win32: Forte as a Windows service #106

Open
wants to merge 6 commits into
base: develop
Choose a base branch
from

Conversation

kumajaya
Copy link

@kumajaya kumajaya commented May 3, 2024

Hijack main entry point and replaced by wmain for Windows service entry. Keep all files header description including the license statement. Not sure about the license compatibility to Eclise's EPL.

Based on: https://github.com/microsoftarchive/msdn-code-gallery-microsoft/tree/master/OneCodeTeam/A%20basic%20Windows%20service%20in%20C%2B%2B%20(CppWindowsService)%202

FORTE as a Windows service current status:

  • Run as a Windows service or as a usual console application
  • Self service install and remove via terminal console
  • As a service, accept command line arguments via registry key
  • As a service, stdout and stderr redirected to forte.log file and can be disable
  • We can build with MSVC or MINGW, default unicode system call per as Microsoft recomendation https://learn.microsoft.com/en-us/windows/win32/learnwin32/working-with-strings

@kumajaya
Copy link
Author

kumajaya commented May 4, 2024

@azoitl With this changes, main.cpp looks messy now. How if I keep SampleService.cpp as a separate file and then create some dummies function call (endForte and _main) in test/arch/win32/* to make forte test build happy? Or how to tell forte test build to exclude some files?

@kumajaya kumajaya force-pushed the win-service branch 3 times, most recently from 9918c81 to 333bc6a Compare May 5, 2024 03:07
@kumajaya
Copy link
Author

kumajaya commented May 5, 2024

Ready for review, no more crashes listed in Windows Logs. Need an opinion on the dummies function in forte_boost_tester.cpp, is there a better solution?

@kumajaya kumajaya marked this pull request as ready for review May 5, 2024 03:31
@kumajaya
Copy link
Author

kumajaya commented May 5, 2024

Ready for review, no more crashes listed in Windows Logs. Need an opinion on the dummies function in forte_boost_tester.cpp, is there a better solution?

Just found the solution. I will push update later today.

@kumajaya
Copy link
Author

kumajaya commented May 5, 2024

Finish. Change trackable per commit.

@kumajaya kumajaya force-pushed the win-service branch 4 times, most recently from e7547d0 to c12d573 Compare May 7, 2024 07:01
@kumajaya
Copy link
Author

kumajaya commented May 7, 2024

Run service on LocalSystem account to make it have a permission to write log file, for compatibility to Windows 7. Use unicode version of freopen to reduce string conversion.

@kumajaya
Copy link
Author

kumajaya commented May 8, 2024

Change the logging redirection using a more portable and simple way by manipulating rdbuf.

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

Successfully merging this pull request may close these issues.

1 participant