mirror of https://github.com/Wind4/vlmcsd
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
1.1 KiB
C
36 lines
1.1 KiB
C
9 years ago
|
#include <stdio.h>
|
||
|
#include <stdlib.h>
|
||
|
#include <string.h>
|
||
|
|
||
|
#include "libkms.h"
|
||
|
#include "kms.h"
|
||
|
#include "endian.h"
|
||
|
|
||
|
static const char ePID[] = { 'T', 0, 'E', 0, 'S', 0, 'T', 0, 0, 0 };
|
||
|
|
||
|
__stdcall BOOL KmsCallBack(const REQUEST *const baseRequest, RESPONSE *const baseResponse, BYTE *const hwId, const char* const ipstr)
|
||
|
{
|
||
|
printf("libvlmcs-test.c: Entered KmsCallBack for client %s\n", ipstr);
|
||
|
|
||
|
memcpy(&baseResponse->CMID, &baseRequest->CMID, sizeof(GUID));
|
||
|
memcpy(&baseResponse->ClientTime, &baseRequest->ClientTime, sizeof(FILETIME));
|
||
|
memcpy(&baseResponse->KmsPID, ePID, sizeof(ePID));
|
||
|
|
||
|
baseResponse->Version = baseRequest->Version;
|
||
|
baseResponse->Count = LE32(LE32(baseRequest->N_Policy) << 1);
|
||
|
baseResponse->PIDSize = sizeof(ePID);
|
||
|
baseResponse->VLActivationInterval = LE32(120);
|
||
|
baseResponse->VLRenewalInterval = LE32(10080);
|
||
|
|
||
|
if (hwId && baseResponse->MajorVer > 5) memcpy(hwId, "\x01\x02\x03\x04\x05\x06\x07\x08", 8);
|
||
|
|
||
|
return TRUE;
|
||
|
}
|
||
|
|
||
|
int main(int argc, char** argv)
|
||
|
{
|
||
|
printf("libvlmcs-test.c: Program start\n");
|
||
|
StartKmsServer(1688, KmsCallBack);
|
||
|
return 0;
|
||
|
}
|