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

Commit

Permalink
vlmcsd-1113-2020-03-28-Hotbird64
Browse files Browse the repository at this point in the history
  • Loading branch information
rouben committed Mar 30, 2020
1 parent ce1dfa1 commit e599080
Show file tree
Hide file tree
Showing 25 changed files with 2,530 additions and 2,291 deletions.
2 changes: 1 addition & 1 deletion GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -225,9 +225,9 @@ help:
@echo " DNS_PARSER=internal Use $(BASE_CLIENT_NAME) internal DNS parsing routines. No effect on MingW (native Windows)."
@echo ""
@echo "Other useful CFLAGS"
@echo " -DNO_COMPILER_UAA Do not use compiler support for byte swapping and unaligned access"
@echo " -DFULL_INTERNAL_DATA Embed full internal KMS data in $(BASE_PROGRAM_NAME)."
@echo " -DSUPPORT_WINE Add code that the Windows version of $(BASE_PROGRAM_NAME) runs on Wine if MSRPC=1"
@echo " -D_PEDANTIC Report rare error/warning conditions instead of silently ignoring them."
@echo " -DINCLUDE_BETAS Include SKU / activation IDs for obsolete beta/preview products."
@echo " -DFD_SETSIZE=<x> Allow <x> -L statements in $(BASE_PROGRAM_NAME) (default: 64 on Windows, 1024 on most Unixes)."

Binary file modified etc/vlmcsd.kmd
Binary file not shown.
5 changes: 4 additions & 1 deletion man/vlmcsd-floppy.7
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.mso www.tmac
.TH "VLMCSD-FLOPPY" 7 "May 2017" "Hotbird64" "KMS Activation Manual"
.TH "VLMCSD-FLOPPY" 7 "February 2019" "Hotbird64" "KMS Activation Manual"
.LO 8

.SH NAME
Expand Down Expand Up @@ -107,6 +107,9 @@ Defines the ePID that is used for Office 2016 activations. If you ommit this par
.IP "\fBOFFICE2016=\fIepid\fR"
Defines the ePID that is used for Office 2016 activations. If you ommit this parameter, \fBvlmcsd\fR(8) generates a random ePID when it is started.

.IP "\fBOFFICE2019=\fIepid\fR"
Defines the ePID that is used for Office 2019 activations. If you ommit this parameter, \fBvlmcsd\fR(8) generates a random ePID when it is started.

.IP "\fBWINCHINAGOV=\fIepid\fR"
Defines the ePID that is used for Windows China Government Edition activations (Enterprise G/GN). If you ommit this parameter, \fBvlmcsd\fR(8) generates a random ePID when it is started.

Expand Down
6 changes: 3 additions & 3 deletions man/vlmcsd.8
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.mso www.tmac
.TH VLMCSD 8 "October 2018" "Hotbird64" "KMS Activation Manual"
.TH VLMCSD 8 "February 2019" "Hotbird64" "KMS Activation Manual"
.LO 8

.SH NAME
Expand Down Expand Up @@ -312,9 +312,9 @@ Signaling is not available in the native Windows version and in the Cygwin versi
\fBvlmcsd\fR compiles and runs on Linux, Windows (no Cygwin required but explicitly supported), Mac OS X, FreeBSD, NetBSD, OpenBSD, Dragonfly BSD, Minix, Solaris, OpenIndiana, Android and iOS. Other POSIX or unixoid OSses may work with unmodified sources or may require minor porting efforts.

.SH SUPPORTED PRODUCTS
\fBvlmcsd\fR can answer activation requests for the following products: Windows Vista, Windows 7, Windows 8, Windows 8.1, Windows 10 (up to 1703), Windows Server 2008, Windows Server 2008 R2, Windows Server 2012, Windows Server 2012 R2, Windows Server 2016, Office 2010, Project 2010, Visio 2010, Office 2013, Project 2013, Visio 2013, Office 2016, Project 2016, Visio 2016. Newer products may work as long as the KMS protocol does not change. A complete list of fully supported products can be obtained using the \fB-x\fR option of \fBvlmcs\fR(1).
\fBvlmcsd\fR can answer activation requests for the following products: Windows Vista, Windows 7, Windows 8, Windows 8.1, Windows 10 (up to 1809), Windows Server 2008, Windows Server 2008 R2, Windows Server 2012, Windows Server 2012 R2, Windows Server 2016, Office 2010, Project 2010, Visio 2010, Office 2013, Project 2013, Visio 2013, Office 2016, Project 2016, Visio 2016, Office 2019, Project 2019, Visio 2019. Newer products may work as long as the KMS protocol does not change. A complete list of fully supported products can be obtained using the \fB-x\fR option of \fBvlmcs\fR(1).
.PP
Office, Project and Visio must be volume license versions.
Windows Vista, Windows 7, Office, Project and Visio must be volume license versions.

.SH FILES
.IP "\fBvlmcsd.ini\fR(5)"
Expand Down
6 changes: 5 additions & 1 deletion src/endian.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include "endian.h"

#if defined(__BYTE_ORDER) && defined(__BIG_ENDIAN) && defined(__LITTLE_ENDIAN) \
&& defined(BS16) && defined(BS32) && defined(BS64)
&& defined(BS16) && defined(BS32) && defined(BS64) && !defined(NO_COMPILER_UAA)

#else // ! defined(__BYTE_ORDER)

Expand Down Expand Up @@ -136,8 +136,12 @@ unsigned short GET_UAA16LE(void *p, unsigned int i)
(unsigned short)_p[ 0 ] |
(unsigned short)_p[ 1 ] << 8;
}
#endif


#if defined(__BYTE_ORDER) && defined(__BIG_ENDIAN) && defined(__LITTLE_ENDIAN) \
&& defined(BS16) && defined(BS32) && defined(BS64)
#else
unsigned short BE16(unsigned short x)
{
return GET_UAA16BE(&x, 0);
Expand Down
88 changes: 52 additions & 36 deletions src/endian.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,17 @@
//
// Unaligned access
//

#if !defined(NO_COMPILER_UAA)
#define UAA16(p, i) (((PACKED16*)p)->val[i])
#define UAA32(p, i) (((PACKED32*)p)->val[i])
#define UAA64(p, i) (((PACKED64*)p)->val[i])

#define UA64(p) UAA64(p, 0)
#define UA32(p) UAA32(p, 0)
#define UA16(p) UAA16(p, 0)
#endif

//
//Byteswap: Use compiler support if available
//
#ifndef NO_COMPILER_UAA
#ifdef __has_builtin // Clang supports this

#if __has_builtin(__builtin_bswap16)
Expand Down Expand Up @@ -56,6 +56,7 @@
#endif // GNU C > 4.7
#endif // __GNUC__ > 4
#endif // __GNUC__
#endif // NO_COMPILER_UAA

//
// Byteorder
Expand Down Expand Up @@ -198,6 +199,10 @@
#define __BE64(x) BS64(x)
#define __LE64(x) (x)

#define PUT_UA16(p, v) PUT_UA16LE(p, v)
#define PUT_UA32(p, v) PUT_UA32LE(p, v)
#define PUT_UA64(p, v) PUT_UA64LE(p, v)

#else // __BYTE_ORDER == __BIG_ENDIAN

#define __BE16(x) (x)
Expand All @@ -207,8 +212,38 @@
#define __BE64(x) (x)
#define __LE64(x) BS64(x)

#define PUT_UA16(p, v) PUT_UA16BE(p, v)
#define PUT_UA32(p, v) PUT_UA32BE(p, v)
#define PUT_UA64(p, v) PUT_UA64BE(p, v)

#endif // __BYTE_ORDER

#define BE16(x) __BE16(x)
#define LE16(x) __LE16(x)
#define BE32(x) __BE32(x)
#define LE32(x) __LE32(x)
#define BE64(x) __BE64(x)
#define LE64(x) __LE64(x)

#else

extern unsigned short BE16(unsigned short x);

extern unsigned short LE16(unsigned short x);

extern unsigned int BE32(unsigned int x);

extern unsigned int LE32(unsigned int x);

extern unsigned long long BE64(unsigned long long x);

extern unsigned long long LE64(unsigned long long x);

#endif // defined(__BYTE_ORDER)

#if defined(__BYTE_ORDER) && defined(__BIG_ENDIAN) && defined(__LITTLE_ENDIAN) \
&& defined(BS16) && defined(BS32) && defined(BS64) &&!defined(NO_COMPILER_UAA)

#define PUT_UAA64BE(p, v, i) ( UAA64(p, i) = __BE64(v) )
#define PUT_UAA32BE(p, v, i) ( UAA32(p, i) = __BE32(v) )
#define PUT_UAA16BE(p, v, i) ( UAA16(p, i) = __BE16(v) )
Expand All @@ -225,56 +260,37 @@
#define GET_UAA32LE(p, i) __LE32(UAA32(p, i))
#define GET_UAA16LE(p, i) __LE16(UAA16(p, i))

#define BE16(x) __BE16(x)
#define LE16(x) __LE16(x)
#define BE32(x) __BE32(x)
#define LE32(x) __LE32(x)
#define BE64(x) __BE64(x)
#define LE64(x) __LE64(x)

#else // ! defined(__BYTE_ORDER)

extern void PUT_UAA64BE(void *p, unsigned long long v, unsigned int i);
extern void PUT_UAA64BE(void* p, unsigned long long v, unsigned int i);

extern void PUT_UAA32BE(void *p, unsigned int v, unsigned int i);
extern void PUT_UAA32BE(void* p, unsigned int v, unsigned int i);

extern void PUT_UAA16BE(void *p, unsigned short v, unsigned int i);
extern void PUT_UAA16BE(void* p, unsigned short v, unsigned int i);


extern void PUT_UAA64LE(void *p, unsigned long long v, unsigned int i);
extern void PUT_UAA64LE(void* p, unsigned long long v, unsigned int i);

extern void PUT_UAA32LE(void *p, unsigned int v, unsigned int i);
extern void PUT_UAA32LE(void* p, unsigned int v, unsigned int i);

extern void PUT_UAA16LE(void *p, unsigned short v, unsigned int i);
extern void PUT_UAA16LE(void* p, unsigned short v, unsigned int i);


extern unsigned long long GET_UAA64BE(void *p, unsigned int i);
extern unsigned long long GET_UAA64BE(void* p, unsigned int i);

extern unsigned int GET_UAA32BE(void *p, unsigned int i);
extern unsigned int GET_UAA32BE(void* p, unsigned int i);

extern unsigned short GET_UAA16BE(void *p, unsigned int i);
extern unsigned short GET_UAA16BE(void* p, unsigned int i);


extern unsigned long long GET_UAA64LE(void *p, unsigned int i);
extern unsigned long long GET_UAA64LE(void* p, unsigned int i);

extern unsigned int GET_UAA32LE(void *p, unsigned int i);
extern unsigned int GET_UAA32LE(void* p, unsigned int i);

extern unsigned short GET_UAA16LE(void *p, unsigned int i);


extern unsigned short BE16(unsigned short x);

extern unsigned short LE16(unsigned short x);

extern unsigned int BE32(unsigned int x);

extern unsigned int LE32(unsigned int x);

extern unsigned long long BE64(unsigned long long x);

extern unsigned long long LE64(unsigned long long x);
extern unsigned short GET_UAA16LE(void* p, unsigned int i);
#endif

#endif // defined(__BYTE_ORDER)


#define PUT_UA64BE(p, v) PUT_UAA64BE(p, v, 0)
Expand Down
27 changes: 21 additions & 6 deletions src/helpers.c
Original file line number Diff line number Diff line change
Expand Up @@ -434,14 +434,14 @@ __pure BOOL getArgumentBool(int_fast8_t *result, const char *const argument)
#ifndef NO_EXTERNAL_DATA
__noreturn static void dataFileReadError()
{
int error = errno;
const int error = errno;
errorout("Fatal: Could not read %s: %s\n", fn_data, strerror(error));
exit(error);
}

__noreturn static void dataFileFormatError()
{
errorout("Fatal: %s is not a KMS data file\n", fn_data);
errorout("Fatal: %s is not a KMS data file version 2.x\n", fn_data);
exit(VLMCSD_EINVAL);
}
#endif // NO_EXTERNAL_DATA
Expand Down Expand Up @@ -526,7 +526,7 @@ static void getDefaultDataFile()
getExeName();
strncpy(fileName, fn_exe, MAX_PATH);
PathRemoveFileSpec(fileName);
strncat(fileName, "\\vlmcsd.kmd", MAX_PATH);
strncat(fileName, "\\vlmcsd.kmd", MAX_PATH - 11);
fn_data = vlmcsd_strdup(fileName);
}
#else // !_WIN32
Expand Down Expand Up @@ -588,12 +588,12 @@ void loadKmsData()
KmsData = (PVlmcsdHeader_t)vlmcsd_malloc(size);
if (fseek(file, 0, SEEK_SET)) dataFileReadError();

size_t bytesRead = fread(KmsData, 1, size, file);
const size_t bytesRead = fread(KmsData, 1, size, file);
if ((long)bytesRead != size) dataFileReadError();
fclose(file);

# if !defined(NO_LOG) && !defined(NO_SOCKETS)
if (!InetdMode) logger("Read KMS data file version %u.%u %s\n", (unsigned int)KmsData->MajorVer, (unsigned int)KmsData->MinorVer, fn_data);
if (!InetdMode) logger("Read KMS data file version %u.%u %s\n", (unsigned int)LE16(KmsData->MajorVer), (unsigned int)LE16(KmsData->MinorVer), fn_data);
# endif // NO_LOG
}
}
Expand All @@ -610,6 +610,7 @@ void loadKmsData()
KmsData->AppItemCount = LE32(KmsData->AppItemCount);
KmsData->KmsItemCount = LE32(KmsData->KmsItemCount);
KmsData->SkuItemCount = LE32(KmsData->SkuItemCount);
KmsData->HostBuildCount = LE32(KmsData->HostBuildCount);

uint32_t i;

Expand All @@ -625,6 +626,7 @@ void loadKmsData()
{
PCsvlkData_t csvlkData = &KmsData->CsvlkData[i];
csvlkData->EPid = (char*)KmsData + LE64(csvlkData->EPidOffset);
csvlkData->ReleaseDate = LE64(csvlkData->ReleaseDate);
# ifndef UNSAFE_DATA_LOAD
if (csvlkData->EPid > (char*)KmsData + size) dataFileFormatError();
# endif // UNSAFE_DATA_LOAD
Expand All @@ -636,12 +638,25 @@ void loadKmsData()
# endif // NO_RANDOM_EPID
}

for (i = 0; i < (uint32_t)KmsData->HostBuildCount; i++)
{
PHostBuild_t hostBuild = &KmsData->HostBuildList[i];
hostBuild->BuildNumber = LE32(hostBuild->BuildNumber);
hostBuild->Flags = LE32(hostBuild->Flags);
hostBuild->PlatformId = LE32(hostBuild->PlatformId);
hostBuild->ReleaseDate = LE64(hostBuild->ReleaseDate);
hostBuild->DisplayName = (char*)KmsData + LE64(hostBuild->DisplayNameOffset);
# ifndef UNSAFE_DATA_LOAD
if (hostBuild->DisplayName > (char*)KmsData + size) dataFileFormatError();
# endif // UNSAFE_DATA_LOAD
}

const uint32_t totalItemCount = KmsData->AppItemCount + KmsData->KmsItemCount + KmsData->SkuItemCount;

# ifndef NO_EXTERNAL_DATA
if (
memcmp(KmsData->Magic, "KMD", sizeof(KmsData->Magic)) ||
KmsData->MajorVer != 1
KmsData->MajorVer != 2
# ifndef UNSAFE_DATA_LOAD
||
sizeof(VlmcsdHeader_t) + totalItemCount * sizeof(VlmcsdData_t) >= ((uint64_t)size)
Expand Down
Loading

0 comments on commit e599080

Please sign in to comment.