summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2015-04-06 22:01:25 +0200
committerMattes D <github@xoft.cz>2015-04-06 22:01:25 +0200
commit4836d07bfa326281fd2c3e848413deb926de0cc0 (patch)
tree33da5eda3afc157771da8227b4d3ff9018f24423 /src
parentAdded cFile:ChangeFileExt() function. (diff)
downloadcuberite-4836d07bfa326281fd2c3e848413deb926de0cc0.tar
cuberite-4836d07bfa326281fd2c3e848413deb926de0cc0.tar.gz
cuberite-4836d07bfa326281fd2c3e848413deb926de0cc0.tar.bz2
cuberite-4836d07bfa326281fd2c3e848413deb926de0cc0.tar.lz
cuberite-4836d07bfa326281fd2c3e848413deb926de0cc0.tar.xz
cuberite-4836d07bfa326281fd2c3e848413deb926de0cc0.tar.zst
cuberite-4836d07bfa326281fd2c3e848413deb926de0cc0.zip
Diffstat (limited to 'src')
-rw-r--r--src/main.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/main.cpp b/src/main.cpp
index 80e457b54..2e7e107f7 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -316,10 +316,10 @@ void WINAPI serviceMain(DWORD argc, TCHAR *argv[])
char applicationFilename[MAX_PATH];
char applicationDirectory[MAX_PATH];
- GetModuleFileName(NULL, applicationFilename, MAX_PATH); // This binaries fill path.
+ GetModuleFileName(NULL, applicationFilename, sizeof(applicationFilename)); // This binary's file path.
- // GetModuleFileName() returns the path and filename. Strip off the filename.
- strncpy(applicationDirectory, applicationFilename, (strrchr(applicationFilename, '\\') - applicationFilename));
+ // Strip off the filename, keep only the path:
+ strncpy_s(applicationDirectory, sizeof(applicationDirectory), applicationFilename, (strrchr(applicationFilename, '\\') - applicationFilename));
applicationDirectory[strlen(applicationDirectory)] = '\0'; // Make sure new path is null terminated
// Services are run by the SCM, and inherit its working directory - usually System32.
@@ -330,7 +330,7 @@ void WINAPI serviceMain(DWORD argc, TCHAR *argv[])
if (g_StatusHandle == NULL)
{
- OutputDebugString("RegisterServiceCtrlHandler() failed\n");
+ OutputDebugStringA("RegisterServiceCtrlHandler() failed\n");
serviceSetState(0, SERVICE_STOPPED, GetLastError());
return;
}
@@ -340,7 +340,7 @@ void WINAPI serviceMain(DWORD argc, TCHAR *argv[])
g_ServiceThread = CreateThread(NULL, 0, serviceWorkerThread, NULL, 0, NULL);
if (g_ServiceThread == NULL)
{
- OutputDebugString("CreateThread() failed\n");
+ OutputDebugStringA("CreateThread() failed\n");
serviceSetState(0, SERVICE_STOPPED, GetLastError());
return;
}