1
0
mirror of https://github.com/Wind4/vlmcsd.git synced 2024-11-25 03:21:03 +08:00

vlmcsd-1107-2016-12-12-Hotbird64

This commit is contained in:
Wind4 2016-12-18 13:14:31 +08:00
parent af593fc11b
commit c5e1a0a591
21 changed files with 216 additions and 232 deletions

View File

@ -198,6 +198,7 @@ help:
@echo " -DNO_SOCKETS Don't support standalone operation. Requires an internet superserver to start $(BASE_PROGRAM_NAME)."
@echo " -DSIMPLE_SOCKETS Compile $(BASE_PROGRAM_NAME) with basic socket support only. Removes -L option."
@echo " -DSIMPLE_RPC Don't support RPC with NDR64 and BTFN in $(BASE_PROGRAM_NAME) (but do in $(BASE_CLIENT_NAME)). Makes emulator detection easy."
@echo " -DNO_TAP Compile $(BASE_PROGRAM_NAME) without VPN support (Windows and Cygwin only)."
@echo " -DNO_CL_PIDS Don't support specifying ePIDs and HwId from the command line in $(BASE_PROGRAM_NAME)."
@echo " -DNO_LIMIT Don't support limiting concurrent clients in $(BASE_PROGRAM_NAME)."
@echo " -DNO_SIGHUP Don't support SIGHUP handling in $(BASE_PROGRAM_NAME)."

Binary file not shown.

View File

@ -1,5 +1,5 @@
<!-- Creator : groff version 1.22.3 -->
<!-- CreationDate: Mon Dec 5 18:18:46 2016 -->
<!-- CreationDate: Sun Dec 11 22:03:19 2016 -->
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>

Binary file not shown.

View File

@ -1,5 +1,5 @@
<!-- Creator : groff version 1.22.3 -->
<!-- CreationDate: Mon Dec 5 18:18:46 2016 -->
<!-- CreationDate: Sun Dec 11 22:03:20 2016 -->
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>

Binary file not shown.

View File

@ -1,5 +1,5 @@
<!-- Creator : groff version 1.22.3 -->
<!-- CreationDate: Mon Dec 5 18:18:46 2016 -->
<!-- CreationDate: Sun Dec 11 22:03:19 2016 -->
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>

Binary file not shown.

View File

@ -1,5 +1,5 @@
<!-- Creator : groff version 1.22.3 -->
<!-- CreationDate: Mon Dec 5 18:18:46 2016 -->
<!-- CreationDate: Sun Dec 11 22:03:20 2016 -->
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>

Binary file not shown.

View File

@ -1,5 +1,5 @@
<!-- Creator : groff version 1.22.3 -->
<!-- CreationDate: Mon Dec 5 18:18:46 2016 -->
<!-- CreationDate: Sun Dec 11 22:03:20 2016 -->
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>

Binary file not shown.

View File

@ -1,5 +1,5 @@
<!-- Creator : groff version 1.22.3 -->
<!-- CreationDate: Mon Dec 5 18:18:46 2016 -->
<!-- CreationDate: Sun Dec 11 22:03:19 2016 -->
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>

Binary file not shown.

View File

@ -257,14 +257,14 @@ else
STRIPFLAGS += -s
endif
LIBRARY_CFLAGS = -DSIMPLE_SOCKETS -DNO_TIMEOUT -DNO_SIGHUP -DNO_CL_PIDS -DNO_LOG -DNO_RANDOM_EPID -DNO_INI_FILE -DNO_HELP -DNO_CUSTOM_INTERVALS -DNO_PID_FILE -DNO_USER_SWITCH -DNO_VERBOSE_LOG -DNO_LIMIT -DNO_VERSION_INFORMATION -DNO_PRIVATE_IP_DETECT -DNO_STRICT_MODES -DNO_CLIENT_LIST -UNO_SOCKETS -USIMPLE_RPC
LIBRARY_CFLAGS = -DSIMPLE_SOCKETS -DNO_TIMEOUT -DNO_SIGHUP -DNO_CL_PIDS -DNO_LOG -DNO_RANDOM_EPID -DNO_INI_FILE -DNO_HELP -DNO_CUSTOM_INTERVALS -DNO_PID_FILE -DNO_USER_SWITCH -DNO_VERBOSE_LOG -DNO_LIMIT -DNO_VERSION_INFORMATION -DNO_PRIVATE_IP_DETECT -DNO_STRICT_MODES -DNO_CLIENT_LIST -DNO_TAP -UNO_SOCKETS -USIMPLE_RPC
ifeq ($(FEATURES), embedded)
BASECFLAGS += -DNO_HELP -DNO_USER_SWITCH -DNO_CUSTOM_INTERVALS -DNO_PID_FILE -DNO_VERBOSE_LOG -DNO_VERSION_INFORMATION
else ifeq ($(FEATURES), autostart)
BASECFLAGS += -DNO_HELP -DNO_VERSION_INFORMATION
else ifeq ($(FEATURES), minimum)
BASECFLAGS += -DSIMPLE_RPC -DSIMPLE_SOCKETS -DNO_TIMEOUT -DNO_SIGHUP -DNO_CL_PIDS -DNO_LOG -DNO_RANDOM_EPID -DNO_INI_FILE -DNO_HELP -DNO_CUSTOM_INTERVALS -DNO_PID_FILE -DNO_USER_SWITCH -DNO_VERBOSE_LOG -DNO_LIMIT -DNO_VERSION_INFORMATION -DNO_PRIVATE_IP_DETECT -DSMALL_AES -DNO_STRICT_MODES -DNO_CLIENT_LIST -DUNSAFE_DATA_LOAD -DNO_EXTERNAL_DATA -UFULL_INTERNAL_DATA -U_PEDANTIC
BASECFLAGS += -DSIMPLE_RPC -DSIMPLE_SOCKETS -DNO_TIMEOUT -DNO_SIGHUP -DNO_CL_PIDS -DNO_LOG -DNO_RANDOM_EPID -DNO_INI_FILE -DNO_HELP -DNO_CUSTOM_INTERVALS -DNO_PID_FILE -DNO_USER_SWITCH -DNO_VERBOSE_LOG -DNO_LIMIT -DNO_VERSION_INFORMATION -DNO_PRIVATE_IP_DETECT -DSMALL_AES -DNO_STRICT_MODES -DNO_TAP -DNO_CLIENT_LIST -DUNSAFE_DATA_LOAD -DNO_EXTERNAL_DATA -UFULL_INTERNAL_DATA -U_PEDANTIC
else ifeq ($(FEATURES), most)
BASECFLAGS += -DNO_SIGHUP -DNO_PID_FILE -DNO_LIMIT
else ifeq ($(FEATURES), inetd)

View File

@ -31,26 +31,6 @@
/*
* Define default ePIDs and HWID here. Preferrably grab ePIDs and HWID
* from a real KMS server.
*/
//#ifndef EPID_WINDOWS
//#define EPID_WINDOWS "03612-00206-471-452343-03-1033-14393.0000-2932016"
//#endif
//
//#ifndef EPID_OFFICE2010
//#define EPID_OFFICE2010 "03612-00096-199-303490-03-1033-14393.0000-2932016"
//#endif
//
//#ifndef EPID_OFFICE2013
//#define EPID_OFFICE2013 "03612-00206-234-394838-03-1033-14393.0000-2932016"
//#endif
//
//#ifndef EPID_OFFICE2016
//#define EPID_OFFICE2016 "03612-00206-437-938923-03-1033-14393.0000-2932016"
//#endif
#ifndef HWID // HwId from the Ratiborus VM
#define HWID 0x3A, 0x1C, 0x04, 0x96, 0x00, 0xB6, 0x00, 0x76
@ -67,7 +47,7 @@
/*
/*
* -------------------------------
* Defaults
* -------------------------------
@ -76,12 +56,12 @@
#ifndef INI_FILE
/*
/*
* Uncomment and customize the following line if you want vlmcsd to look for an ini file
* at a default location.
*/
//#define INI_FILE "/etc/vlmcsd.ini"
//#define INI_FILE "/etc/vlmcsd.ini"
#endif // INI_FILE
@ -95,7 +75,7 @@
* at a custom default location.
*/
//#define DATA_FILE "/etc/vlmcsd.kmd"
//#define DATA_FILE "/etc/vlmcsd.kmd"
#endif // DATA_FILE
@ -353,7 +333,7 @@
* Includes the full database in vlmcsd.
*/
//#define FULL_INTERNAL_DATA
//#define FULL_INTERNAL_DATA
#endif // FULL_INTERNAL_DATA
@ -374,13 +354,25 @@
* your system.
*/
//#define NO_FREEBIND
//#define NO_FREEBIND
#endif // NO_FREEBIND
#ifndef NO_TAP
/*
* Do not compile support for using a VPN adapter under Windows. Disables -O command line option.
*/
//#define NO_TAP
#endif // NO_TAP
#ifndef NO_VERSION_INFORMATION
/*
* Removes the -V option from vlmcsd and vlmcs that displays the version information
@ -493,7 +485,7 @@
* and ini file parameter KmsData. Implies UNSAFE_DATA_LOAD.
*/
//#define NO_EXTERNAL_DATA
//#define NO_EXTERNAL_DATA
#endif // NO_EXTERNAL_DATA
@ -507,7 +499,7 @@
* the program exits with an error message.
*/
//#define NO_INTERNAL_DATA
//#define NO_INTERNAL_DATA
#endif // NO_INTERNAL_DATA
@ -658,7 +650,7 @@
* smaller binaries but makes emulator detection easier.
*/
//#define SIMPLE_RPC
//#define SIMPLE_RPC
#endif // !SIMPLE_RPC
@ -670,7 +662,7 @@
* It still supports IPv4 and IPv6.
*/
//#define SIMPLE_SOCKETS
//#define SIMPLE_SOCKETS
#endif // SIMPLE_SOCKETS

View File

@ -455,7 +455,7 @@ void getExeName()
fn_exe = (char*)getauxval(AT_EXECFN);
# elif __UCLIBC__ && __UCLIBC_MAJOR__ < 1 && !defined(NO_PROCFS) // Workaround for older uclibc
# elif (__ANDROID__ && __ANDROID_API__ < 16) || (__UCLIBC__ && __UCLIBC_MAJOR__ < 1 && !defined(NO_PROCFS)) // Workaround for older uclibc
char temp[PATH_MAX + 1];

View File

@ -301,7 +301,7 @@ static void generateRandomPid(int index, char *const szPid, int serverType, int1
time(&maxTime);
# ifndef BUILD_TIME
# define BUILD_TIME 1479938320
# define BUILD_TIME 1481079869
# endif
if (maxTime < (time_t)BUILD_TIME) // Just in case the system time is < 10/17/2013 1:00 pm

View File

@ -294,7 +294,6 @@ SOCKET connectToAddress(const char *const addr, const int AddressFamily, int_fas
#ifndef NO_SOCKETS
#ifdef SIMPLE_SOCKETS
static int_fast8_t allowSocketReuse(SOCKET s)
{
@ -322,6 +321,8 @@ static int_fast8_t allowSocketReuse(SOCKET s)
}
#ifdef SIMPLE_SOCKETS
int listenOnAllAddresses()
{
uint32_t port_listen;
@ -575,14 +576,7 @@ static int listenOnAddress(const struct addrinfo *const ai, SOCKET *s)
}
# endif
# if !_WIN32 && !__CYGWIN__
if (setsockopt(*s, SOL_SOCKET, SO_REUSEADDR, (sockopt_t)&socketOption, sizeof(socketOption)))
{
# ifdef _PEDANTIC
printerrorf("Warning: %s does not support socket option SO_REUSEADDR: %s\n", ipstr, vlmcsd_strerror(socket_errno));
# endif // _PEDANTIC
}
# endif // !_WIN32 && !__CYGWIN__
allowSocketReuse(*s);
# if HAVE_FREEBIND
# if (defined(IP_NONLOCALOK) || __FreeBSD_kernel__ || __FreeBSD__) && !defined(IPV6_BINDANY)

View File

@ -18,7 +18,7 @@ VOID WINAPI ServiceCtrlHandler(DWORD dwCtrl)
{
// Handle the requested control code.
switch(dwCtrl)
switch (dwCtrl)
{
case SERVICE_CONTROL_STOP:
case SERVICE_CONTROL_SHUTDOWN:
@ -28,10 +28,9 @@ VOID WINAPI ServiceCtrlHandler(DWORD dwCtrl)
// Remove PID file and free ressources
cleanup();
# ifdef USE_MSRPC
# if __CYGWIN__ || defined(USE_MSRPC)
ReportServiceStatus(SERVICE_STOPPED, NO_ERROR, 0);
# endif // !USE_MSRPC
return;
# endif // __CYGWIN__
default:
break;
@ -42,14 +41,8 @@ static VOID WINAPI ServiceMain(const int argc_unused, CARGV argv_unused)
{
// Register the handler function for the service
gSvcStatusHandle = RegisterServiceCtrlHandler(
NT_SERVICE_NAME,
ServiceCtrlHandler
);
if(!gSvcStatusHandle)
if (!((gSvcStatusHandle = RegisterServiceCtrlHandler(NT_SERVICE_NAME, ServiceCtrlHandler))))
{
//ServiceReportEvent(RegisterServiceCtrlHandler);
return;
}
@ -65,7 +58,7 @@ static VOID WINAPI ServiceMain(const int argc_unused, CARGV argv_unused)
SERVICE_TABLE_ENTRY NTServiceDispatchTable[] = {
{
(LPSTR)NT_SERVICE_NAME,
(LPSERVICE_MAIN_FUNCTION) ServiceMain
(LPSERVICE_MAIN_FUNCTION)ServiceMain
},
{
NULL,
@ -88,8 +81,8 @@ VOID ReportServiceStatus(const DWORD dwCurrentState, const DWORD dwWin32ExitCode
else
gSvcStatus.dwControlsAccepted = SERVICE_ACCEPT_STOP;
if ( (dwCurrentState == SERVICE_RUNNING) ||
(dwCurrentState == SERVICE_STOPPED) )
if ((dwCurrentState == SERVICE_RUNNING) ||
(dwCurrentState == SERVICE_STOPPED))
gSvcStatus.dwCheckPoint = 0;
else
gSvcStatus.dwCheckPoint = dwCheckPoint++;
@ -192,10 +185,10 @@ static VOID ServiceInstaller(const char *restrict ServiceUser, const char *const
return;
}
strcat(szPath,"\"");
strcat(szPath, "\"");
int i;
for (i = 1; i < global_argc; i ++)
for (i = 1; i < global_argc; i++)
{
// Strip unneccessary parameters, especially the password
if (!strcmp(global_argv[i], "-s")) continue;
@ -235,8 +228,8 @@ static VOID ServiceInstaller(const char *restrict ServiceUser, const char *const
if (ServiceUser)
{
// Shortcuts for some well known users
if (!strcasecmp(ServiceUser, "/l")) ServiceUser="NT AUTHORITY\\LocalService";
if (!strcasecmp(ServiceUser, "/n")) ServiceUser="NT AUTHORITY\\NetworkService";
if (!strcasecmp(ServiceUser, "/l")) ServiceUser = "NT AUTHORITY\\LocalService";
if (!strcasecmp(ServiceUser, "/n")) ServiceUser = "NT AUTHORITY\\NetworkService";
// Allow Local Users without .\ , e.g. "johndoe" instead of ".\johndoe"
if (!strchr(ServiceUser, '\\'))
@ -322,7 +315,7 @@ int NtServiceInstallation(const int_fast8_t installService, const char *restrict
if (installService == 2) // Remove
{
switch(OpenAndRemoveService(NULL, NULL))
switch (OpenAndRemoveService(NULL, NULL))
{
case 0:
errorout("Error removing service %s\n", NT_SERVICE_NAME);

View File

@ -17,6 +17,10 @@
#include "tap-windows.h"
#include <iphlpapi.h>
#if !_WIN32
#include <arpa/inet.h>
#endif // !_WIN32
static char* szIpAddress = "10.10.10.9";
static char* szMask = "30";
static char* szTapName;
@ -117,7 +121,7 @@ static void parseTapArgument(char* argument)
exit(VLMCSD_EINVAL);
}
Mask = (uint32_t)~(UINT_MAX >> Cidr);
Mask = (uint32_t)~(0xffffffff >> Cidr);
Network = IpAddress & Mask;
Broadcast = IpAddress | ~Mask;
DhcpServer = IpAddress + 1;