Skip to content
This repository has been archived by the owner on Aug 14, 2024. It is now read-only.

Commit

Permalink
vlmcsd-svn998-2016-08-11-Hotbird64
Browse files Browse the repository at this point in the history
  • Loading branch information
Wind4 committed Aug 15, 2016
1 parent 8d3bfb8 commit 9099d5a
Show file tree
Hide file tree
Showing 51 changed files with 987 additions and 4,068 deletions.
19 changes: 17 additions & 2 deletions GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -313,8 +313,8 @@ VLMCS_OBJS = $(VLMCS_SRCS:.c=.o)
MULTI_SRCS = vlmcsd.c vlmcs.c vlmcsdmulti.c $(SRCS)
MULTI_OBJS = $(SRCS:.c=.o) vlmcsd-m.o vlmcs-m.o vlmcsdmulti-m.o

DLL_SRCS = libkms.c $(SRCS)
DLL_OBJS = $(DLL_SRCS:.c=.o)
DLL_SRCS = libkms.c vlmcs.c $(SRCS)
DLL_OBJS = $(DLL_SRCS:.c=-l.o)

PDFDOCS = vlmcs.1.pdf vlmcsd.7.pdf vlmcsd.8.pdf vlmcsdmulti.1.pdf vlmcsd.ini.5.pdf vlmcsd-floppy.7.pdf
HTMLDOCS = $(PDFDOCS:.pdf=.html)
Expand Down Expand Up @@ -456,6 +456,21 @@ endif
endif
endif

%-l.o: %.c
ifeq ($(VERBOSE),1)
$(CC) -x$(COMPILER_LANGUAGE) $(PLATFORMFLAGS) $(BASECFLAGS) $(CFLAGS) $(PLATFORMFLAGS) -fvisibility=hidden -c -DIS_LIBRARY=1 $(LIBRARY_CFLAGS) -UNO_SOCKETS -UUSE_MSRPC -o $@ -c $<
ifeq ($(DEPENDENCIES),1)
$(CC) -x$(COMPILER_LANGUAGE) $(PLATFORMFLAGS) $(BASECFLAGS) $(CFLAGS) $(PLATFORMFLAGS) $(SERVERLDFLAGS) -fvisibility=hidden -c -DIS_LIBRARY=1 $(LIBRARY_CFLAGS) -UNO_SOCKETS -UUSE_MSRPC -MM -MF $*.d $<
endif
else
@echo "$(COMPILER) CC $@ <- $<"
@$(CC) -x$(COMPILER_LANGUAGE) $(PLATFORMFLAGS) $(BASECFLAGS) $(CFLAGS) $(PLATFORMFLAGS) $(SERVERLDFLAGS) -fvisibility=hidden -c -DIS_LIBRARY=1 $(LIBRARY_CFLAGS) -UNO_SOCKETS -UUSE_MSRPC -o $@ -c $<
ifeq ($(DEPENDENCIES),1)
@echo "$(COMPILER) DEP $*.d <- $<"
@$(CC) -x$(COMPILER_LANGUAGE) $(PLATFORMFLAGS) $(BASECFLAGS) $(CFLAGS) $(PLATFORMFLAGS) $(SERVERLDFLAGS) -fvisibility=hidden -c -DIS_LIBRARY=1 $(LIBRARY_CFLAGS) -UNO_SOCKETS -UUSE_MSRPC -MM -MF $*.d $<
endif
endif


ifdef CAT
BUILDCOMMAND = cat $^ | $(CC) -x$(COMPILER_LANGUAGE) -o $@ -
Expand Down
Binary file modified floppy144.vfd
Binary file not shown.
387 changes: 208 additions & 179 deletions kms.c

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions kms.h
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,7 @@ typedef struct
#define KMS_ID_OFFICE2016 18
#define KMS_ID_WIN10_VL 19
#define KMS_ID_WIN10_RETAIL 20
#define KMS_ID_WIN2016 21

#define PWINGUID &AppList[APP_ID_WINDOWS].guid
#define POFFICE2010GUID &AppList[APP_ID_OFFICE2010].guid
Expand Down
102 changes: 69 additions & 33 deletions libkms.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

#define EXTERNAL dllexport

#define DLLVERSION 0x30001
#define DLLVERSION 0x30002

#include "libkms.h"
#include "shared_globals.h"
Expand All @@ -28,23 +28,74 @@
#include <netinet/in.h>
#endif // WIN32

#ifdef IS_LIBRARY
char ErrorMessage[MESSAGE_BUFFER_SIZE];
#endif // IS_LIBRARY

static int_fast8_t IsServerStarted = FALSE;

#ifdef _WIN32
#ifndef USE_MSRPC

static int_fast8_t SocketsInitialized = FALSE;
WSADATA wsadata;

static int initializeWinSockets()
{
if (SocketsInitialized) return 0;
SocketsInitialized = TRUE;
return WSAStartup(0x0202, &wsadata);
}

#endif // USE_MSRPC
#endif // _WIN32

EXTERNC __declspec(EXTERNAL) DWORD __cdecl SendActivationRequest
(
const char* const hostname,
const int port,
RESPONSE* baseResponse,
const REQUEST* const baseRequest,
RESPONSE_RESULT* result, BYTE *hwid
)
EXTERNC __declspec(EXTERNAL) char* __cdecl GetErrorMessage()
{
return !0; // not yet implemented
return ErrorMessage;
}

EXTERNC __declspec(EXTERNAL) SOCKET __cdecl ConnectToServer(const char* host, const char* port, const int addressFamily)
{
SOCKET sock;
*ErrorMessage = 0;

# if defined(_WIN32) && !defined(USE_MSRPC)
initializeWinSockets();
# endif // defined(_WIN32) && !defined(USE_MSRPC)

size_t adrlen = strlen(host) + 16;
char* RemoteAddr = (char*)alloca(adrlen);
snprintf(RemoteAddr, adrlen, "[%s]:%s", host, port);
sock = connectToAddress(RemoteAddr, addressFamily, FALSE);

if (sock == INVALID_RPCCTX)
{
printerrorf("Fatal: Could not connect to %s\n", RemoteAddr);
return sock;
}

return sock;
}

EXTERNC __declspec(EXTERNAL) RpcStatus __cdecl BindRpc(const SOCKET sock, const int_fast8_t useMultiplexedRpc)
{
*ErrorMessage = 0;
UseMultiplexedRpc = useMultiplexedRpc;
return rpcBindClient(sock, FALSE);
}

EXTERNC __declspec(EXTERNAL) void __cdecl CloseConnection(const SOCKET sock)
{
socketclose(sock);
}


EXTERNC __declspec(EXTERNAL) DWORD __cdecl SendKMSRequest(const SOCKET sock, RESPONSE* baseResponse, REQUEST* baseRequest, RESPONSE_RESULT* result, BYTE *hwid)
{
*ErrorMessage = 0;
return SendActivationRequest(sock, baseResponse, baseRequest, result, hwid);
}

EXTERNC __declspec(EXTERNAL) int_fast8_t __cdecl IsDisconnected(const SOCKET sock)
{
return isDisconnected(sock);
}


Expand All @@ -56,16 +107,8 @@ EXTERNC __declspec(EXTERNAL) DWORD __cdecl StartKmsServer(const int port, Reques
if (IsServerStarted) return !0;

# ifdef _WIN32
# ifndef USE_MSRPC
// Windows Sockets must be initialized
WSADATA wsadata;
int error;

if ((error = WSAStartup(0x0202, &wsadata)))
{
return error;
}
# endif // USE_MSRPC
int error = initializeWinSockets();
if (error) return error;
# endif // _WIN32

CreateResponseBase = requestCallback;
Expand Down Expand Up @@ -113,15 +156,8 @@ EXTERNC __declspec(EXTERNAL) DWORD __cdecl StartKmsServer(const int port, Reques
int error;

# ifdef _WIN32
# ifndef USE_MSRPC
// Windows Sockets must be initialized
WSADATA wsadata;

if ((error = WSAStartup(0x0202, &wsadata)))
{
return error;
}
# endif // USE_MSRPC
error = initializeWinSockets();
if (error) return error;
# endif // _WIN32

defaultport = vlmcsd_malloc(16);
Expand Down
8 changes: 7 additions & 1 deletion libkms.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include "types.h"
#include "kms.h"
#include "rpc.h"
#include "vlmcs.h"

#ifndef EXTERNC
#ifdef __cplusplus
Expand All @@ -17,11 +18,16 @@
#endif
#endif

EXTERNC __declspec(EXTERNAL) DWORD __cdecl SendActivationRequest(const char* const hostname, const int port, RESPONSE* baseResponse, const REQUEST* const baseRequest, RESPONSE_RESULT* result, BYTE *hwid);
EXTERNC __declspec(EXTERNAL) DWORD __cdecl SendKMSRequest(const SOCKET sock, RESPONSE* baseResponse, REQUEST* baseRequest, RESPONSE_RESULT* result, BYTE *hwid);
EXTERNC __declspec(EXTERNAL) DWORD __cdecl StartKmsServer(const int port, RequestCallback_t requestCallback);
EXTERNC __declspec(EXTERNAL) DWORD __cdecl StopKmsServer();
EXTERNC __declspec(EXTERNAL) int __cdecl GetLibKmsVersion();
EXTERNC __declspec(EXTERNAL) const char* const __cdecl GetEmulatorVersion();
EXTERNC __declspec(EXTERNAL) SOCKET __cdecl ConnectToServer(const char* host, const char* port, const int addressFamily);
EXTERNC __declspec(EXTERNAL) char* __cdecl GetErrorMessage();
EXTERNC __declspec(EXTERNAL) void __cdecl CloseConnection(const SOCKET sock);
EXTERNC __declspec(EXTERNAL) RpcStatus __cdecl BindRpc(const SOCKET sock, const int_fast8_t useMultiplexedRpc);
EXTERNC __declspec(EXTERNAL) int_fast8_t __cdecl IsDisconnected(const SOCKET sock);
//EXTERN_C __declspec(EXTERNAL) unsigned int __cdecl GetRandom32();


Expand Down
2 changes: 2 additions & 0 deletions make_dragonfly
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/usr/local/bin/bash

export VLMCSD_VERSION="svn`svnversion`"

export VERBOSE=3
export DNS_PARSER=OS

Expand Down
1 change: 1 addition & 0 deletions make_freebsd
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/usr/local/bin/bash

export VLMCSD_VERSION="svn`svnversion`"
export VERBOSE=3
export DNS_PARSER=OS

Expand Down
1 change: 1 addition & 0 deletions make_hurd
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/bin/bash

export VLMCSD_VERSION="svn`svnversion`"
export VERBOSE=3
export DNS_PARSER=OS

Expand Down
1 change: 1 addition & 0 deletions make_kfreebsd
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/bin/bash

export VLMCSD_VERSION="svn`svnversion`"
export VERBOSE=3
export DNS_PARSER=OS

Expand Down
30 changes: 15 additions & 15 deletions make_linux
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

#export VLMCSD_VERSION="svn`svnversion | sed -e 's/:.*//; s/[^0-9]*$//; s/^$/0/'`"
export VLMCSD_VERSION="svn`svnversion`"

export VERBOSE=3
export DNS_PARSER=internal
Expand Down Expand Up @@ -88,15 +88,15 @@ if [ $? != 0 ]; then
exit $?
fi

export CFLAGS="$CFLAGS -flto=jobserver -fvisibility=hidden"
export CFLAGS="$CFLAGS -flto=jobserver -fvisibility=hidden -DIS_LIBRARY"
export LDFLAGS="$LDFLAGS -static-libgcc"

make $MAKEFLAGS CRYPTO=windows FEATURES=minimum $DLL_NAME

if [ $? != 0 ]; then
echo Error creating $DLL_NAME
exit $?
fi
#make $MAKEFLAGS CRYPTO=windows FEATURES=minimum $DLL_NAME CAT=2
#
#if [ $? != 0 ]; then
# echo Error creating $DLL_NAME
# exit $?
#fi



Expand Down Expand Up @@ -148,15 +148,15 @@ if [ $? != 0 ]; then
exit $?
fi

export CFLAGS="$CFLAGS -flto=jobserver -fvisibility=hidden"
export CFLAGS="$CFLAGS -flto=jobserver -fvisibility=hidden -DIS_LIBRARY"
export LDFLAGS="$LDFLAGS -static-libgcc"

make $MAKEFLAGS CRYPTO=windows FEATURES=minimum $DLL_NAME

if [ $? != 0 ]; then
echo Error creating $DLL_NAME
exit $?
fi
#make $MAKEFLAGS CRYPTO=windows FEATURES=minimum $DLL_NAME CAT=2
#
#if [ $? != 0 ]; then
# echo Error creating $DLL_NAME
# exit $?
#fi



Expand Down
Loading

0 comments on commit 9099d5a

Please sign in to comment.