Author: tkreuzer
Date: Sun Sep 14 16:05:00 2014
New Revision: 64152
URL:
http://svn.reactos.org/svn/reactos?rev=64152&view=rev
Log:
[NTOSKRNL]
Implement a fake NtLockProductActivationKeys
Modified:
branches/kernel-fun/reactos/ntoskrnl/config/ntapi.c
Modified: branches/kernel-fun/reactos/ntoskrnl/config/ntapi.c
URL:
http://svn.reactos.org/svn/reactos/branches/kernel-fun/reactos/ntoskrnl/con…
==============================================================================
--- branches/kernel-fun/reactos/ntoskrnl/config/ntapi.c [iso-8859-1] (original)
+++ branches/kernel-fun/reactos/ntoskrnl/config/ntapi.c [iso-8859-1] Sun Sep 14 16:05:00
2014
@@ -15,6 +15,7 @@
BOOLEAN CmBootAcceptFirstTime = TRUE;
BOOLEAN CmFirstTime = TRUE;
+extern ULONG InitSafeBootMode;
/* FUNCTIONS *****************************************************************/
@@ -893,7 +894,7 @@
/* Enough of the system has booted by now */
Ki386PerfEnd();
-
+
/* Validate flag */
if (Flag > CM_BOOT_FLAG_MAX) return STATUS_INVALID_PARAMETER;
@@ -962,13 +963,52 @@
return STATUS_NOT_IMPLEMENTED;
}
+// FIXME: different for different windows versions!
+#define PRODUCT_ACTIVATION_VERSION 7749
+
NTSTATUS
NTAPI
NtLockProductActivationKeys(IN PULONG pPrivateVer,
IN PULONG pSafeMode)
{
- UNIMPLEMENTED;
- return STATUS_NOT_IMPLEMENTED;
+ KPROCESSOR_MODE PreviousMode;
+
+ PreviousMode = ExGetPreviousMode();
+ _SEH2_TRY
+ {
+ /* Check if the caller asked for the version */
+ if (pPrivateVer != NULL)
+ {
+ /* For user mode, probe it */
+ if (PreviousMode != KernelMode)
+ {
+ ProbeForRead(pPrivateVer, sizeof(ULONG), sizeof(ULONG));
+ }
+
+ /* Return the expected version */
+ *pPrivateVer = PRODUCT_ACTIVATION_VERSION;
+ }
+
+ /* Check if the caller asked for safe mode mode state */
+ if (pSafeMode != NULL)
+ {
+ /* For user mode, probe it */
+ if (PreviousMode != KernelMode)
+ {
+ ProbeForRead(pSafeMode, sizeof(ULONG), sizeof(ULONG));
+ }
+
+ /* Return the safe boot mode state */
+ *pSafeMode = InitSafeBootMode;
+ }
+ }
+ _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
+ {
+ return _SEH2_GetExceptionCode();
+ }
+ _SEH2_END;
+
+ return STATUS_SUCCESS;
}
NTSTATUS