-
Notifications
You must be signed in to change notification settings - Fork 37
Expand file tree
/
Copy pathlibkms-test.c
More file actions
35 lines (27 loc) · 1.06 KB
/
libkms-test.c
File metadata and controls
35 lines (27 loc) · 1.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#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;
}