-
Notifications
You must be signed in to change notification settings - Fork 28
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
Implement running as service as well as standalone exe #33
base: master
Are you sure you want to change the base?
Conversation
ahmubashshir
commented
Jan 11, 2023
- Organize source files
- Separate syscall wrappers and code
- Prepare for implementing service
- Add placeholder service management functions
- Implement service (un)install
- Implement Service Runner
- Add compiled resource support
- Implement Service Error reporter
- Strip output by default
- Update Status messages and formatting
Signed-off-by: Mubashshir <[email protected]>
Signed-off-by: Mubashshir <[email protected]>
Signed-off-by: Mubashshir <[email protected]>
Signed-off-by: Mubashshir <[email protected]>
Signed-off-by: Mubashshir <[email protected]>
Signed-off-by: Mubashshir <[email protected]>
Signed-off-by: Mubashshir <[email protected]>
Signed-off-by: Mubashshir <[email protected]>
Signed-off-by: Mubashshir <[email protected]>
Signed-off-by: Mubashshir <[email protected]>
Thanks for the PR! Most of this looks ok, although there's an issue I've found. After a game closes but before the service is stopped, the process uses a lot of CPU (~50-70%). I'm pretty sure this is caused by the lack of cleanup in the original code, so the original pipe handle is never closed and the Basically, |
On Thu, Jan 12 2023 at 09:19:47 PM -08:00:00, 0e4ef622 ***@***.***> wrote:
Basically, iServerLoop needs cleanup code.
On it.
Mubashshir
|
Signed-off-by: Mubashshir <[email protected]>
What does running this as a service mean and how can I do that? I've compiled it but it appears to just do the same thing as the regular exe. |
If you run |
Even though the .exe closes when the first connection closes, if the part where it's supposed to take another connection is supposedly broken then unfortunately as far as what I am looking for, we're back to square one. |
is this part supposed to be sarcasm?
You can test whether it works by using examples/send-presence.exe from this. Remember, you need to run edit: Did you apply this patch before building it? |
@0e4ef622 btw, I don't know much about how M$ pipes work, and how can I make it behave like unix sockets (multiple streams). If we can implement multi-stream support in |
You can set the |
I think I may know why I got confused earlier. The repo for this PR does not include the Edit: Yes, it absolutely did. Me discussing both here and on my issue caused me to miss a major important step so I'll just discuss this on my issue to reduce the possibility of confusion. |
Signed-off-by: Mubashshir <[email protected]>
this unfortunately no longer compiles with GCC 14:
the following patch should fix the error and also several warnings: diff --git a/src/ipc.c b/src/ipc.c
index 17533d0..dca3b2b 100644
--- a/src/ipc.c
+++ b/src/ipc.c
@@ -43,7 +43,7 @@ int iServerMain(BOOL bStandaloneArg)
if (hPipe == INVALID_HANDLE_VALUE)
{
- INFO("CreateNamedPipe failed, GLE=%d.\n", GetLastError());
+ INFO("CreateNamedPipe failed, GLE=%lu.\n", GetLastError());
return -1;
}
@@ -122,7 +122,7 @@ PRIVATE int iListenPipe()
if (hThread == NULL)
{
- INFO("CreateThread failed, GLE=%d.\n", GetLastError());
+ INFO("CreateThread failed, GLE=%lu.\n", GetLastError());
return 1;
}
@@ -149,7 +149,7 @@ PRIVATE int iListenPipe()
return 1;
}
- INFO("%d bytes w->l\n", bytes_read);
+ INFO("%lu bytes w->l\n", bytes_read);
/* pass -D__WDBRIDGE_DUMP_PIPE to gcc
* to dump the actual data being passed
* from the pipe to the socket */
diff --git a/src/main.c b/src/main.c
index b5fe2e8..68dee71 100644
--- a/src/main.c
+++ b/src/main.c
@@ -1,6 +1,7 @@
#include <windows.h>
#include <tchar.h>
#include <shlwapi.h>
+#include <stdio.h>
#include "server.h"
#include "service-manager.h"
#define ARGV1(X) (argc > 1 && lstrcmpi( argv[1], TEXT(X)) == 0) |