[NETAPI32] Implement NetRegisterDomainNameChangeNotification() and NetUnregisterDomai...
[reactos.git] / dll / win32 / netapi32 / misc.c
index 650068f..0d236e2 100644 (file)
@@ -18,6 +18,38 @@ WINE_DEFAULT_DEBUG_CHANNEL(netapi32);
 
 /* FUNCTIONS *****************************************************************/
 
+NET_API_STATUS
+WINAPI
+NetRegisterDomainNameChangeNotification(
+    _Out_ PHANDLE NotificationEventHandle)
+{
+    HANDLE EventHandle;
+    NTSTATUS Status;
+
+    TRACE("NetRegisterDomainNameChangeNotification(%p)\n",
+          NotificationEventHandle);
+
+    if (NotificationEventHandle == NULL)
+        return ERROR_INVALID_PARAMETER;
+
+    EventHandle = CreateEventW(NULL, FALSE, FALSE, NULL);
+    if (EventHandle == NULL)
+        return GetLastError();
+
+    Status = LsaRegisterPolicyChangeNotification(PolicyNotifyDnsDomainInformation,
+                                                 NotificationEventHandle);
+    if (!NT_SUCCESS(Status))
+    {
+        CloseHandle(EventHandle);
+        return NetpNtStatusToApiStatus(Status);
+    }
+
+    *NotificationEventHandle = EventHandle;
+
+    return NERR_Success;
+}
+
+
 NET_API_STATUS
 WINAPI
 NetStatisticsGet(
@@ -83,6 +115,26 @@ NetStatisticsGet(
 }
 
 
+NET_API_STATUS
+WINAPI
+NetUnregisterDomainNameChangeNotification(
+    _In_ HANDLE NotificationEventHandle)
+{
+    NTSTATUS Status;
+
+    TRACE("NetUnregisterDomainNameChangeNotification(%p)\n",
+          NotificationEventHandle);
+
+    if (NotificationEventHandle == NULL)
+        return ERROR_INVALID_PARAMETER;
+
+    Status = LsaUnregisterPolicyChangeNotification(PolicyNotifyDnsDomainInformation,
+                                                   NotificationEventHandle);
+
+    return NetpNtStatusToApiStatus(Status);
+}
+
+
 NET_API_STATUS
 WINAPI
 NetpNtStatusToApiStatus(