wined3d: Don't call glCompressedTexImage2DARB without allocatedMemory.
[wine] / dlls / ntdll / nt.c
index 47ca85e..6b6cccf 100644 (file)
 #include <stdlib.h>
 #include <string.h>
 #include <time.h>
-#include "wine/debug.h"
 
+#include "ntstatus.h"
+#define WIN32_NO_STATUS
+#include "wine/debug.h"
+#include "wine/unicode.h"
 #include "windef.h"
-#include "winbase.h"
-#include "winreg.h"
 #include "winternl.h"
 #include "ntdll_misc.h"
 #include "wine/server.h"
 
 WINE_DEFAULT_DEBUG_CHANNEL(ntdll);
 
-/* Structures used by NtConnectPort */
-
-typedef struct LpcSectionInfo
-{
-  DWORD Length;
-  HANDLE SectionHandle;
-  DWORD Param1;
-  DWORD SectionSize;
-  DWORD ClientBaseAddress;
-  DWORD ServerBaseAddress;
-} LPCSECTIONINFO, *PLPCSECTIONINFO;
-
-typedef struct LpcSectionMapInfo
-{
-  DWORD Length;
-  DWORD SectionSize;
-  DWORD ServerBaseAddress;
-} LPCSECTIONMAPINFO, *PLPCSECTIONMAPINFO;
-
-/* Structure used by NtAcceptConnectPort, NtReplyWaitReceivePort */
-
-#define MAX_MESSAGE_DATA 328
-
-typedef struct LpcMessage
-{
-  WORD ActualMessageLength;
-  WORD TotalMessageLength;
-  DWORD MessageType;
-  DWORD ClientProcessId;
-  DWORD ClientThreadId;
-  DWORD MessageId;
-  DWORD SharedSectionSize;
-  BYTE MessageData[MAX_MESSAGE_DATA];
-} LPCMESSAGE, *PLPCMESSAGE;
-
 /*
  *     Token
  */
@@ -88,11 +54,26 @@ NTSTATUS WINAPI NtDuplicateToken(
         IN TOKEN_TYPE TokenType,
         OUT PHANDLE NewToken)
 {
-       FIXME("(%p,0x%08lx,%p,0x%08x,0x%08x,%p),stub!\n",
-       ExistingToken, DesiredAccess, ObjectAttributes,
-       ImpersonationLevel, TokenType, NewToken);
-       dump_ObjectAttributes(ObjectAttributes);
-       return 0;
+    NTSTATUS status;
+
+    TRACE("(%p,0x%08lx,%p,0x%08x,0x%08x,%p)\n",
+        ExistingToken, DesiredAccess, ObjectAttributes,
+        ImpersonationLevel, TokenType, NewToken);
+        dump_ObjectAttributes(ObjectAttributes);
+
+    SERVER_START_REQ( duplicate_token )
+    {
+        req->handle              = ExistingToken;
+        req->access              = DesiredAccess;
+        req->attributes          = ObjectAttributes ? ObjectAttributes->Attributes : 0;
+        req->primary             = (TokenType == TokenPrimary);
+        req->impersonation_level = ImpersonationLevel;
+        status = wine_server_call( req );
+        if (!status) *NewToken = reply->new_handle;
+    }
+    SERVER_END_REQ;
+
+    return status;
 }
 
 /******************************************************************************
@@ -110,8 +91,10 @@ NTSTATUS WINAPI NtOpenProcessToken(
 
     SERVER_START_REQ( open_token )
     {
-        req->handle = ProcessHandle;
-        req->flags  = 0;
+        req->handle     = ProcessHandle;
+        req->access     = DesiredAccess;
+        req->attributes = 0;
+        req->flags      = 0;
         ret = wine_server_call( req );
         if (!ret) *TokenHandle = reply->token;
     }
@@ -137,8 +120,10 @@ NTSTATUS WINAPI NtOpenThreadToken(
 
     SERVER_START_REQ( open_token )
     {
-        req->handle = ThreadHandle;
-        req->flags  = OPEN_TOKEN_THREAD;
+        req->handle     = ThreadHandle;
+        req->access     = DesiredAccess;
+        req->attributes = 0;
+        req->flags      = OPEN_TOKEN_THREAD;
         if (OpenAsSelf) req->flags |= OPEN_TOKEN_AS_SELF;
         ret = wine_server_call( req );
         if (!ret) *TokenHandle = reply->token;
@@ -150,7 +135,7 @@ NTSTATUS WINAPI NtOpenThreadToken(
 
 /******************************************************************************
  *  NtAdjustPrivilegesToken            [NTDLL.@]
- *  ZwAdjustGroupsToken                [NTDLL.@]
+ *  ZwAdjustPrivilegesToken            [NTDLL.@]
  *
  * FIXME: parameters unsafe
  */
@@ -162,9 +147,34 @@ NTSTATUS WINAPI NtAdjustPrivilegesToken(
        OUT PTOKEN_PRIVILEGES PreviousState,
        OUT PDWORD ReturnLength)
 {
-       FIXME("(%p,0x%08x,%p,0x%08lx,%p,%p),stub!\n",
-       TokenHandle, DisableAllPrivileges, NewState, BufferLength, PreviousState, ReturnLength);
-       return 0;
+    NTSTATUS ret;
+
+    TRACE("(%p,0x%08x,%p,0x%08lx,%p,%p)\n",
+        TokenHandle, DisableAllPrivileges, NewState, BufferLength, PreviousState, ReturnLength);
+
+    SERVER_START_REQ( adjust_token_privileges )
+    {
+        req->handle = TokenHandle;
+        req->disable_all = DisableAllPrivileges;
+        req->get_modified_state = (PreviousState != NULL);
+        if (!DisableAllPrivileges)
+        {
+            wine_server_add_data( req, &NewState->Privileges,
+                                  NewState->PrivilegeCount * sizeof(NewState->Privileges[0]) );
+        }
+        if (PreviousState && BufferLength >= FIELD_OFFSET( TOKEN_PRIVILEGES, Privileges ))
+            wine_server_set_reply( req, &PreviousState->Privileges,
+                                   BufferLength - FIELD_OFFSET( TOKEN_PRIVILEGES, Privileges ) );
+        ret = wine_server_call( req );
+        if (PreviousState)
+        {
+            *ReturnLength = reply->len + FIELD_OFFSET( TOKEN_PRIVILEGES, Privileges );
+            PreviousState->PrivilegeCount = reply->len / sizeof(LUID_AND_ATTRIBUTES);
+        }
+    }
+    SERVER_END_REQ;
+
+    return ret;
 }
 
 /******************************************************************************
@@ -179,27 +189,22 @@ NTSTATUS WINAPI NtAdjustPrivilegesToken(
 */
 NTSTATUS WINAPI NtQueryInformationToken(
        HANDLE token,
-       DWORD tokeninfoclass,
-       LPVOID tokeninfo,
-       DWORD tokeninfolength,
-       LPDWORD retlen )
+       TOKEN_INFORMATION_CLASS tokeninfoclass,
+       PVOID tokeninfo,
+       ULONG tokeninfolength,
+       PULONG retlen )
 {
-    unsigned int len = 0;
+    ULONG len;
+    NTSTATUS status = STATUS_SUCCESS;
 
-    TRACE("(%p,%ld,%p,%ld,%p)\n",
+    TRACE("(%p,%d,%p,%ld,%p)\n",
           token,tokeninfoclass,tokeninfo,tokeninfolength,retlen);
 
     switch (tokeninfoclass)
     {
-    case TokenUser:
-        len = sizeof(TOKEN_USER) + sizeof(SID);
-        break;
     case TokenGroups:
         len = sizeof(TOKEN_GROUPS);
         break;
-    case TokenPrivileges:
-        len = sizeof(TOKEN_PRIVILEGES);
-        break;
     case TokenOwner:
         len = sizeof(TOKEN_OWNER) + sizeof(SID);
         break;
@@ -219,10 +224,11 @@ NTSTATUS WINAPI NtQueryInformationToken(
     case TokenImpersonationLevel:
     case TokenStatistics:
 #endif /* 0 */
+    default:
+        len = 0;
     }
 
-    /* FIXME: what if retlen == NULL ? */
-    *retlen = len;
+    if (retlen) *retlen = len;
 
     if (tokeninfolength < len)
         return STATUS_BUFFER_TOO_SMALL;
@@ -230,15 +236,23 @@ NTSTATUS WINAPI NtQueryInformationToken(
     switch (tokeninfoclass)
     {
     case TokenUser:
-        if( tokeninfo )
+        SERVER_START_REQ( get_token_user )
         {
             TOKEN_USER * tuser = tokeninfo;
             PSID sid = (PSID) (tuser + 1);
-            SID_IDENTIFIER_AUTHORITY localSidAuthority = {SECURITY_NT_AUTHORITY};
-            RtlInitializeSid(sid, &localSidAuthority, 1);
-            *(RtlSubAuthoritySid(sid, 0)) = SECURITY_INTERACTIVE_RID;
-            tuser->User.Sid = sid;
+            DWORD sid_len = tokeninfolength < sizeof(TOKEN_USER) ? 0 : tokeninfolength - sizeof(TOKEN_USER);
+
+            req->handle = token;
+            wine_server_set_reply( req, sid, sid_len );
+            status = wine_server_call( req );
+            if (retlen) *retlen = reply->user_len + sizeof(TOKEN_USER);
+            if (status == STATUS_SUCCESS)
+            {
+                tuser->User.Sid = sid;
+                tuser->User.Attributes = 0;
+            }
         }
+        SERVER_END_REQ;
         break;
     case TokenGroups:
         if (tokeninfo)
@@ -257,12 +271,31 @@ NTSTATUS WINAPI NtQueryInformationToken(
                                          &(tgroups->Groups->Sid));
         }
         break;
-    case TokenPrivileges:
+    case TokenPrimaryGroup:
         if (tokeninfo)
+        {
+            TOKEN_PRIMARY_GROUP *tgroup = tokeninfo;
+            SID_IDENTIFIER_AUTHORITY sid = {SECURITY_NT_AUTHORITY};
+            RtlAllocateAndInitializeSid( &sid,
+                                         2,
+                                         SECURITY_BUILTIN_DOMAIN_RID,
+                                         DOMAIN_ALIAS_RID_ADMINS,
+                                         0, 0, 0, 0, 0, 0,
+                                         &(tgroup->PrimaryGroup));
+        }
+        break;
+    case TokenPrivileges:
+        SERVER_START_REQ( get_token_privileges )
         {
             TOKEN_PRIVILEGES *tpriv = tokeninfo;
-            tpriv->PrivilegeCount = 1;
+            req->handle = token;
+            if (tpriv && tokeninfolength > FIELD_OFFSET( TOKEN_PRIVILEGES, Privileges ))
+                wine_server_set_reply( req, &tpriv->Privileges, tokeninfolength - FIELD_OFFSET( TOKEN_PRIVILEGES, Privileges ) );
+            status = wine_server_call( req );
+            if (retlen) *retlen = FIELD_OFFSET( TOKEN_PRIVILEGES, Privileges ) + reply->len;
+            if (tpriv) tpriv->PrivilegeCount = reply->len / sizeof(LUID_AND_ATTRIBUTES);
         }
+        SERVER_END_REQ;
         break;
     case TokenOwner:
         if (tokeninfo)
@@ -277,11 +310,71 @@ NTSTATUS WINAPI NtQueryInformationToken(
         break;
     default:
         {
-            ERR("Unhandled Token Information class!\n");
+            ERR("Unhandled Token Information class %d!\n", tokeninfoclass);
             return STATUS_NOT_IMPLEMENTED;
         }
     }
-    return 0;
+    return status;
+}
+
+/******************************************************************************
+*  NtSetInformationToken               [NTDLL.@]
+*  ZwSetInformationToken               [NTDLL.@]
+*/
+NTSTATUS WINAPI NtSetInformationToken(
+        HANDLE TokenHandle,
+        TOKEN_INFORMATION_CLASS TokenInformationClass,
+        PVOID TokenInformation,
+        ULONG TokenInformationLength)
+{
+    FIXME("%p %d %p %lu\n", TokenHandle, TokenInformationClass,
+          TokenInformation, TokenInformationLength);
+    return STATUS_NOT_IMPLEMENTED;
+}
+
+/******************************************************************************
+*  NtAdjustGroupsToken         [NTDLL.@]
+*  ZwAdjustGroupsToken         [NTDLL.@]
+*/
+NTSTATUS WINAPI NtAdjustGroupsToken(
+        HANDLE TokenHandle,
+        BOOLEAN ResetToDefault,
+        PTOKEN_GROUPS NewState,
+        ULONG BufferLength,
+        PTOKEN_GROUPS PreviousState,
+        PULONG ReturnLength)
+{
+    FIXME("%p %d %p %lu %p %p\n", TokenHandle, ResetToDefault,
+          NewState, BufferLength, PreviousState, ReturnLength);
+    return STATUS_NOT_IMPLEMENTED;
+}
+
+/******************************************************************************
+*  NtPrivilegeCheck            [NTDLL.@]
+*  ZwPrivilegeCheck            [NTDLL.@]
+*/
+NTSTATUS WINAPI NtPrivilegeCheck(
+    HANDLE ClientToken,
+    PPRIVILEGE_SET RequiredPrivileges,
+    PBOOLEAN Result)
+{
+    NTSTATUS status;
+    SERVER_START_REQ( check_token_privileges )
+    {
+        req->handle = ClientToken;
+        req->all_required = ((RequiredPrivileges->Control & PRIVILEGE_SET_ALL_NECESSARY) ? TRUE : FALSE);
+        wine_server_add_data( req, &RequiredPrivileges->Privilege,
+            RequiredPrivileges->PrivilegeCount * sizeof(RequiredPrivileges->Privilege[0]) );
+        wine_server_set_reply( req, &RequiredPrivileges->Privilege,
+            RequiredPrivileges->PrivilegeCount * sizeof(RequiredPrivileges->Privilege[0]) );
+
+        status = wine_server_call( req );
+
+        if (status == STATUS_SUCCESS)
+            *Result = (reply->has_privileges ? TRUE : FALSE);
+    }
+    SERVER_END_REQ;
+    return status;
 }
 
 /*
@@ -293,12 +386,12 @@ NTSTATUS WINAPI NtQueryInformationToken(
  */
 NTSTATUS WINAPI NtQuerySection(
        IN HANDLE SectionHandle,
-       IN PVOID SectionInformationClass,
+       IN SECTION_INFORMATION_CLASS SectionInformationClass,
        OUT PVOID SectionInformation,
        IN ULONG Length,
        OUT PULONG ResultLength)
 {
-       FIXME("(%p,%p,%p,0x%08lx,%p) stub!\n",
+       FIXME("(%p,%d,%p,0x%08lx,%p) stub!\n",
        SectionHandle,SectionInformationClass,SectionInformation,Length,ResultLength);
        return 0;
 }
@@ -312,10 +405,10 @@ NTSTATUS WINAPI NtQuerySection(
  *  ZwCreatePort               [NTDLL.@]
  */
 NTSTATUS WINAPI NtCreatePort(PHANDLE PortHandle,POBJECT_ATTRIBUTES ObjectAttributes,
-                             DWORD MaxConnectInfoLength,DWORD MaxDataLength,DWORD unknown)
+                             ULONG MaxConnectInfoLength,ULONG MaxDataLength,PULONG reserved)
 {
-  FIXME("(%p,%p,0x%08lx,0x%08lx,0x%08lx),stub!\n",PortHandle,ObjectAttributes,
-        MaxConnectInfoLength,MaxDataLength,unknown);
+  FIXME("(%p,%p,%lu,%lu,%p),stub!\n",PortHandle,ObjectAttributes,
+        MaxConnectInfoLength,MaxDataLength,reserved);
   return 0;
 }
 
@@ -323,22 +416,30 @@ NTSTATUS WINAPI NtCreatePort(PHANDLE PortHandle,POBJECT_ATTRIBUTES ObjectAttribu
  *  NtConnectPort              [NTDLL.@]
  *  ZwConnectPort              [NTDLL.@]
  */
-NTSTATUS WINAPI NtConnectPort(PHANDLE PortHandle,PUNICODE_STRING PortName,PVOID Unknown1,
-                              PLPCSECTIONINFO sectionInfo,PLPCSECTIONMAPINFO mapInfo,PVOID Unknown2,
-                              PVOID ConnectInfo,PDWORD pConnectInfoLength)
+NTSTATUS WINAPI NtConnectPort(
+        PHANDLE PortHandle,
+        PUNICODE_STRING PortName,
+        PSECURITY_QUALITY_OF_SERVICE SecurityQos,
+        PLPC_SECTION_WRITE WriteSection,
+        PLPC_SECTION_READ ReadSection,
+        PULONG MaximumMessageLength,
+        PVOID ConnectInfo,
+        PULONG pConnectInfoLength)
 {
-  FIXME("(%p,%s,%p,%p,%p,%p,%p,%p (%ld)),stub!\n",PortHandle,debugstr_w(PortName->Buffer),Unknown1,
-        sectionInfo,mapInfo,Unknown2,ConnectInfo,pConnectInfoLength,pConnectInfoLength?*pConnectInfoLength:-1);
-  if(ConnectInfo && pConnectInfoLength)
-    TRACE("\tMessage = %s\n",debugstr_an(ConnectInfo,*pConnectInfoLength));
-  return 0;
+    FIXME("(%p,%s,%p,%p,%p,%p,%p,%p),stub!\n",
+          PortHandle,debugstr_w(PortName->Buffer),SecurityQos,
+          WriteSection,ReadSection,MaximumMessageLength,ConnectInfo,
+          pConnectInfoLength);
+    if (ConnectInfo && pConnectInfoLength)
+        TRACE("\tMessage = %s\n",debugstr_an(ConnectInfo,*pConnectInfoLength));
+    return 0;
 }
 
 /******************************************************************************
  *  NtListenPort               [NTDLL.@]
  *  ZwListenPort               [NTDLL.@]
  */
-NTSTATUS WINAPI NtListenPort(HANDLE PortHandle,PLPCMESSAGE pLpcMessage)
+NTSTATUS WINAPI NtListenPort(HANDLE PortHandle,PLPC_MESSAGE pLpcMessage)
 {
   FIXME("(%p,%p),stub!\n",PortHandle,pLpcMessage);
   return 0;
@@ -348,10 +449,16 @@ NTSTATUS WINAPI NtListenPort(HANDLE PortHandle,PLPCMESSAGE pLpcMessage)
  *  NtAcceptConnectPort        [NTDLL.@]
  *  ZwAcceptConnectPort        [NTDLL.@]
  */
-NTSTATUS WINAPI NtAcceptConnectPort(PHANDLE PortHandle,DWORD Unknown,PLPCMESSAGE pLpcMessage,
-                                    DWORD acceptIt,DWORD Unknown2,PLPCSECTIONMAPINFO mapInfo)
+NTSTATUS WINAPI NtAcceptConnectPort(
+        PHANDLE PortHandle,
+        ULONG PortIdentifier,
+        PLPC_MESSAGE pLpcMessage,
+        BOOLEAN Accept,
+        PLPC_SECTION_WRITE WriteSection,
+        PLPC_SECTION_READ ReadSection)
 {
-  FIXME("(%p,0x%08lx,%p,0x%08lx,0x%08lx,%p),stub!\n",PortHandle,Unknown,pLpcMessage,acceptIt,Unknown2,mapInfo);
+  FIXME("(%p,%lu,%p,%d,%p,%p),stub!\n",
+        PortHandle,PortIdentifier,pLpcMessage,Accept,WriteSection,ReadSection);
   return 0;
 }
 
@@ -379,20 +486,25 @@ NTSTATUS WINAPI NtRegisterThreadTerminatePort(HANDLE PortHandle)
  *  NtRequestWaitReplyPort             [NTDLL.@]
  *  ZwRequestWaitReplyPort             [NTDLL.@]
  */
-NTSTATUS WINAPI NtRequestWaitReplyPort(HANDLE PortHandle,PLPCMESSAGE pLpcMessageIn,PLPCMESSAGE pLpcMessageOut)
+NTSTATUS WINAPI NtRequestWaitReplyPort(
+        HANDLE PortHandle,
+        PLPC_MESSAGE pLpcMessageIn,
+        PLPC_MESSAGE pLpcMessageOut)
 {
   FIXME("(%p,%p,%p),stub!\n",PortHandle,pLpcMessageIn,pLpcMessageOut);
   if(pLpcMessageIn)
   {
     TRACE("Message to send:\n");
-    TRACE("\tActualMessageLength = %d\n",pLpcMessageIn->ActualMessageLength);
-    TRACE("\tTotalMessageLength  = %d\n",pLpcMessageIn->TotalMessageLength);
-    TRACE("\tMessageType         = %ld\n",pLpcMessageIn->MessageType);
-    TRACE("\tClientProcessId     = %ld\n",pLpcMessageIn->ClientProcessId);
-    TRACE("\tClientThreadId      = %ld\n",pLpcMessageIn->ClientThreadId);
-    TRACE("\tMessageId           = %ld\n",pLpcMessageIn->MessageId);
-    TRACE("\tSharedSectionSize   = %ld\n",pLpcMessageIn->SharedSectionSize);
-    TRACE("\tMessageData         = %s\n",debugstr_an(pLpcMessageIn->MessageData,pLpcMessageIn->ActualMessageLength));
+    TRACE("\tDataSize            = %u\n",pLpcMessageIn->DataSize);
+    TRACE("\tMessageSize         = %u\n",pLpcMessageIn->MessageSize);
+    TRACE("\tMessageType         = %u\n",pLpcMessageIn->MessageType);
+    TRACE("\tVirtualRangesOffset = %u\n",pLpcMessageIn->VirtualRangesOffset);
+    TRACE("\tClientId.UniqueProcess = %p\n",pLpcMessageIn->ClientId.UniqueProcess);
+    TRACE("\tClientId.UniqueThread  = %p\n",pLpcMessageIn->ClientId.UniqueThread);
+    TRACE("\tMessageId           = %lu\n",pLpcMessageIn->MessageId);
+    TRACE("\tSectionSize         = %lu\n",pLpcMessageIn->SectionSize);
+    TRACE("\tData                = %s\n",
+      debugstr_an((const char*)pLpcMessageIn->Data,pLpcMessageIn->DataSize));
   }
   return 0;
 }
@@ -401,9 +513,13 @@ NTSTATUS WINAPI NtRequestWaitReplyPort(HANDLE PortHandle,PLPCMESSAGE pLpcMessage
  *  NtReplyWaitReceivePort     [NTDLL.@]
  *  ZwReplyWaitReceivePort     [NTDLL.@]
  */
-NTSTATUS WINAPI NtReplyWaitReceivePort(HANDLE PortHandle,PDWORD Unknown,PLPCMESSAGE pLpcMessageOut,PLPCMESSAGE pLpcMessageIn)
+NTSTATUS WINAPI NtReplyWaitReceivePort(
+        HANDLE PortHandle,
+        PULONG PortIdentifier,
+        PLPC_MESSAGE ReplyMessage,
+        PLPC_MESSAGE Message)
 {
-  FIXME("(%p,%p,%p,%p),stub!\n",PortHandle,Unknown,pLpcMessageOut,pLpcMessageIn);
+  FIXME("(%p,%p,%p,%p),stub!\n",PortHandle,PortIdentifier,ReplyMessage,Message);
   return 0;
 }
 
@@ -415,31 +531,12 @@ NTSTATUS WINAPI NtReplyWaitReceivePort(HANDLE PortHandle,PDWORD Unknown,PLPCMESS
  *  NtSetIntervalProfile       [NTDLL.@]
  *  ZwSetIntervalProfile       [NTDLL.@]
  */
-NTSTATUS WINAPI NtSetIntervalProfile(DWORD x1,DWORD x2) {
-       FIXME("(0x%08lx,0x%08lx),stub!\n",x1,x2);
-       return 0;
-}
-
-/******************************************************************************
- *  NtQueryPerformanceCounter  [NTDLL.@]
- */
-NTSTATUS WINAPI NtQueryPerformanceCounter(
-       IN PLARGE_INTEGER Counter,
-       IN PLARGE_INTEGER Frequency)
+NTSTATUS WINAPI NtSetIntervalProfile(
+        ULONG Interval,
+        KPROFILE_SOURCE Source)
 {
-       FIXME("(%p, 0%p) stub\n",
-       Counter, Frequency);
-       return 0;
-}
-
-/******************************************************************************
- *  NtCreateMailslotFile       [NTDLL.@]
- *  ZwCreateMailslotFile       [NTDLL.@]
- */
-NTSTATUS WINAPI NtCreateMailslotFile(DWORD x1,DWORD x2,DWORD x3,DWORD x4,DWORD x5,DWORD x6,DWORD x7,DWORD x8)
-{
-       FIXME("(0x%08lx,0x%08lx,0x%08lx,0x%08lx,0x%08lx,0x%08lx,0x%08lx,0x%08lx),stub!\n",x1,x2,x3,x4,x5,x6,x7,x8);
-       return 0;
+    FIXME("%lu,%d\n", Interval, Source);
+    return STATUS_SUCCESS;
 }
 
 /******************************************************************************
@@ -477,47 +574,78 @@ NTSTATUS WINAPI NtQuerySystemInformation(
     {
     case SystemBasicInformation:
         {
-            SYSTEM_BASIC_INFORMATION* sbi = (SYSTEM_BASIC_INFORMATION*)SystemInformation;
-            if (Length >= sizeof(*sbi))
+            SYSTEM_BASIC_INFORMATION sbi;
+
+            sbi.dwUnknown1 = 0;
+            sbi.uKeMaximumIncrement = 0;
+            sbi.uPageSize = 1024; /* FIXME */
+            sbi.uMmNumberOfPhysicalPages = 12345; /* FIXME */
+            sbi.uMmLowestPhysicalPage = 0; /* FIXME */
+            sbi.uMmHighestPhysicalPage = 12345; /* FIXME */
+            sbi.uAllocationGranularity = 65536; /* FIXME */
+            sbi.pLowestUserAddress = 0; /* FIXME */
+            sbi.pMmHighestUserAddress = (void*)~0; /* FIXME */
+            sbi.uKeActiveProcessors = 1; /* FIXME */
+            sbi.bKeNumberProcessors = 1; /* FIXME */
+            len = sizeof(sbi);
+
+            if ( Length == len)
+            {
+                if (!SystemInformation) ret = STATUS_ACCESS_VIOLATION;
+                else memcpy( SystemInformation, &sbi, len);
+            }
+            else ret = STATUS_INFO_LENGTH_MISMATCH;
+        }
+        break;
+    case SystemCpuInformation:
+        {
+            SYSTEM_CPU_INFORMATION sci;
+
+            /* FIXME: move some code from kernel/cpu.c to process this */
+            sci.Architecture = PROCESSOR_ARCHITECTURE_INTEL;
+            sci.Level = 6; /* 686, aka Pentium II+ */
+            sci.Revision = 0;
+            sci.Reserved = 0;
+            sci.FeatureSet = 0x1fff;
+            len = sizeof(sci);
+
+            if ( Length >= len)
             {
-                sbi->dwUnknown1 = 0;
-                sbi->uKeMaximumIncrement = 0;
-                sbi->uPageSize = 1024; /* FIXME */
-                sbi->uMmNumberOfPhysicalPages = 12345; /* FIXME */
-                sbi->uMmLowestPhysicalPage = 0; /* FIXME */
-                sbi->uMmHighestPhysicalPage = 12345; /* FIXME */
-                sbi->uAllocationGranularity = 65536; /* FIXME */
-                sbi->pLowestUserAddress = 0; /* FIXME */
-                sbi->pMmHighestUserAddress = (void*)~0; /* FIXME */
-                sbi->uKeActiveProcessors = 1; /* FIXME */
-                sbi->bKeNumberProcessors = 1; /* FIXME */
-                len = sizeof(*sbi);
+                if (!SystemInformation) ret = STATUS_ACCESS_VIOLATION;
+                else memcpy( SystemInformation, &sci, len);
             }
             else ret = STATUS_INFO_LENGTH_MISMATCH;
         }
         break;
     case SystemPerformanceInformation:
         {
-            SYSTEM_PERFORMANCE_INFORMATION* spi = (SYSTEM_PERFORMANCE_INFORMATION*)SystemInformation;
-            if (Length >= sizeof(*spi))
+            SYSTEM_PERFORMANCE_INFORMATION spi;
+
+            memset(&spi, 0 , sizeof(spi));
+            len = sizeof(spi);
+
+            if (Length >= len)
             {
-                memset(spi, 0, sizeof(*spi)); /* FIXME */
-                len = sizeof(*spi);
+                if (!SystemInformation) ret = STATUS_ACCESS_VIOLATION;
+                else memcpy( SystemInformation, &spi, len);
             }
             else ret = STATUS_INFO_LENGTH_MISMATCH;
         }
         break;
     case SystemTimeOfDayInformation:
         {
-            SYSTEM_TIMEOFDAY_INFORMATION* sti = (SYSTEM_TIMEOFDAY_INFORMATION*)SystemInformation;
-            if (Length >= sizeof(*sti))
+            SYSTEM_TIMEOFDAY_INFORMATION sti;
+
+            memset(&sti, 0 , sizeof(sti));
+
+            /* liKeSystemTime, liExpTimeZoneBias, uCurrentTimeZoneId */
+            RtlSecondsSince1970ToTime( server_start_time, &sti.liKeBootTime );
+
+            if (Length <= sizeof(sti))
             {
-                sti->liKeBootTime.QuadPart = 0; /* FIXME */
-                sti->liKeSystemTime.QuadPart = 0; /* FIXME */
-                sti->liExpTimeZoneBias.QuadPart  = 0; /* FIXME */
-                sti->uCurrentTimeZoneId = 0; /* FIXME */
-                sti->dwReserved = 0;
-                len = sizeof(*sti);
+                len = Length;
+                if (!SystemInformation) ret = STATUS_ACCESS_VIOLATION;
+                else memcpy( SystemInformation, &sti, Length);
             }
             else ret = STATUS_INFO_LENGTH_MISMATCH;
         }
@@ -528,13 +656,15 @@ NTSTATUS WINAPI NtQuerySystemInformation(
             SYSTEM_PROCESS_INFORMATION* last = NULL;
             HANDLE hSnap = 0;
             WCHAR procname[1024];
+            WCHAR* exename;
             DWORD wlen = 0;
+            DWORD procstructlen = 0;
 
             SERVER_START_REQ( create_snapshot )
             {
-                req->flags   = SNAP_PROCESS | SNAP_THREAD;
-                req->inherit = FALSE;
-                req->pid     = 0;
+                req->flags      = SNAP_PROCESS | SNAP_THREAD;
+                req->attributes = 0;
+                req->pid        = 0;
                 if (!(ret = wine_server_call( req ))) hSnap = reply->handle;
             }
             SERVER_END_REQ;
@@ -545,52 +675,57 @@ NTSTATUS WINAPI NtQuerySystemInformation(
                 {
                     req->handle = hSnap;
                     req->reset = (len == 0);
-                    wine_server_set_reply( req, procname, sizeof(procname) );
+                    wine_server_set_reply( req, procname, sizeof(procname)-sizeof(WCHAR) );
                     if (!(ret = wine_server_call( req )))
                     {
-                        wlen = wine_server_reply_size(reply) + sizeof(WCHAR);
-                        if (Length >= len + sizeof(*spi))
+                        /* Make sure procname is 0 terminated */
+                        procname[wine_server_reply_size(reply) / sizeof(WCHAR)] = 0;
+
+                        /* Get only the executable name, not the path */
+                        if ((exename = strrchrW(procname, '\\')) != NULL) exename++;
+                        else exename = procname;
+
+                        wlen = (strlenW(exename) + 1) * sizeof(WCHAR);
+
+                        procstructlen = sizeof(*spi) + wlen + ((reply->threads - 1) * sizeof(SYSTEM_THREAD_INFORMATION));
+
+                        if (Length >= len + procstructlen)
                         {
+                            /* ftCreationTime, ftUserTime, ftKernelTime;
+                             * vmCounters, ioCounters
+                             */
                             memset(spi, 0, sizeof(*spi));
-                            spi->dwOffset = sizeof(*spi);
+
+                            spi->dwOffset = procstructlen - wlen;
                             spi->dwThreadCount = reply->threads;
-                            memset(&spi->ftCreationTime, 0, sizeof(spi->ftCreationTime));
+
                             /* spi->pszProcessName will be set later on */
+
                             spi->dwBasePriority = reply->priority;
                             spi->dwProcessID = (DWORD)reply->pid;
                             spi->dwParentProcessID = (DWORD)reply->ppid;
                             spi->dwHandleCount = reply->handles;
-                            spi->dwVirtualBytesPeak = 0; /* FIXME */
-                            spi->dwVirtualBytes = 0; /* FIXME */
-                            spi->dwPageFaults = 0; /* FIXME */
-                            spi->dwWorkingSetPeak = 0; /* FIXME */
-                            spi->dwWorkingSet = 0; /* FIXME */
-                            spi->dwUnknown5 = 0; /* FIXME */
-                            spi->dwPagedPool = 0; /* FIXME */
-                            spi->dwUnknown6 = 0; /* FIXME */
-                            spi->dwNonPagedPool = 0; /* FIXME */
-                            spi->dwPageFileBytesPeak = 0; /* FIXME */
-                            spi->dwPrivateBytes = 0; /* FIXME */
-                            spi->dwPageFileBytes = 0; /* FIXME */
+
                             /* spi->ti will be set later on */
-                            len += sizeof(*spi) - sizeof(spi->ti);
+
+                            len += procstructlen;
                         }
                         else ret = STATUS_INFO_LENGTH_MISMATCH;
                     }
                 }
                 SERVER_END_REQ;
                 if (ret != STATUS_SUCCESS)
                 {
                     if (ret == STATUS_NO_MORE_FILES) ret = STATUS_SUCCESS;
                     break;
                 }
-                if (Length >= len + wlen + spi->dwThreadCount * sizeof(THREAD_INFO))
+                else /* Length is already checked for */
                 {
                     int     i, j;
 
                     /* set thread info */
-                    spi->dwOffset += spi->dwThreadCount * sizeof(THREAD_INFO);
-                    len += spi->dwThreadCount * sizeof(THREAD_INFO);
                     i = j = 0;
                     while (ret == STATUS_SUCCESS)
                     {
@@ -606,6 +741,9 @@ NTSTATUS WINAPI NtQuerySystemInformation(
                                     /* ftKernelTime, ftUserTime, ftCreateTime;
                                      * dwTickCount, dwStartAddress
                                      */
+
+                                    memset(&spi->ti[i], 0, sizeof(spi->ti));
+
                                     spi->ti[i].dwOwningPID = reply->pid;
                                     spi->ti[i].dwThreadID  = reply->tid;
                                     spi->ti[i].dwCurrentPriority = reply->base_pri + reply->delta_pri;
@@ -619,16 +757,15 @@ NTSTATUS WINAPI NtQuerySystemInformation(
                     if (ret == STATUS_NO_MORE_FILES) ret = STATUS_SUCCESS;
 
                     /* now append process name */
-                    spi->pszProcessName = (WCHAR*)((char*)spi + spi->dwOffset);
-                    memcpy( spi->pszProcessName, procname, wlen - sizeof(WCHAR) );
-                    spi->pszProcessName[wlen / sizeof(WCHAR)] = 0;
-                    len += wlen;
+                    spi->ProcessName.Buffer = (WCHAR*)((char*)spi + spi->dwOffset);
+                    spi->ProcessName.Length = wlen - sizeof(WCHAR);
+                    spi->ProcessName.MaximumLength = wlen;
+                    memcpy( spi->ProcessName.Buffer, exename, wlen );
                     spi->dwOffset += wlen;
 
                     last = spi;
                     spi = (SYSTEM_PROCESS_INFORMATION*)((char*)spi + spi->dwOffset);
                 }
-                else ret = STATUS_INFO_LENGTH_MISMATCH;
             }
             if (ret == STATUS_SUCCESS && last) last->dwOffset = 0;
             if (hSnap) NtClose(hSnap);
@@ -636,73 +773,159 @@ NTSTATUS WINAPI NtQuerySystemInformation(
         break;
     case SystemProcessorPerformanceInformation:
         {
-            SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION* sppi = (SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION*)SystemInformation;
-            if (Length >= sizeof(*sppi))
+            SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION sppi;
+
+            memset(&sppi, 0 , sizeof(sppi)); /* FIXME */
+            len = sizeof(sppi);
+
+            if (Length >= len)
+            {
+                if (!SystemInformation) ret = STATUS_ACCESS_VIOLATION;
+                else memcpy( SystemInformation, &sppi, len);
+            }
+            else ret = STATUS_INFO_LENGTH_MISMATCH;
+        }
+        break;
+    case SystemModuleInformation:
+        {
+            SYSTEM_MODULE_INFORMATION smi;
+
+            memset(&smi, 0, sizeof(smi));
+            len = sizeof(smi);
+
+            if ( Length >= len)
             {
-                memset(sppi, 0, sizeof(*sppi)); /* FIXME */
-                len = sizeof(*sppi);
+                if (!SystemInformation) ret = STATUS_ACCESS_VIOLATION;
+                else memcpy( SystemInformation, &smi, len);
             }
             else ret = STATUS_INFO_LENGTH_MISMATCH;
         }
         break;
+    case SystemHandleInformation:
+        {
+            SYSTEM_HANDLE_INFORMATION shi;
+
+            memset(&shi, 0, sizeof(shi));
+            len = sizeof(shi);
 
+            if ( Length >= len)
+            {
+                if (!SystemInformation) ret = STATUS_ACCESS_VIOLATION;
+                else memcpy( SystemInformation, &shi, len);
+            }
+            else ret = STATUS_INFO_LENGTH_MISMATCH;
+        }
+        break;
     case SystemCacheInformation:
         {
-            SYSTEM_CACHE_INFORMATION* sci = (SYSTEM_CACHE_INFORMATION*)SystemInformation;
-            if (Length >= sizeof(*sci))
+            SYSTEM_CACHE_INFORMATION sci;
+
+            memset(&sci, 0, sizeof(sci)); /* FIXME */
+            len = sizeof(sci);
+
+            if ( Length >= len)
             {
-                memset(sci, 0, sizeof(*sci)); /* FIXME */
-                len = sizeof(*sci);
+                if (!SystemInformation) ret = STATUS_ACCESS_VIOLATION;
+                else memcpy( SystemInformation, &sci, len);
+            }
+            else ret = STATUS_INFO_LENGTH_MISMATCH;
+        }
+        break;
+    case SystemInterruptInformation:
+        {
+            SYSTEM_INTERRUPT_INFORMATION sii;
+
+            memset(&sii, 0, sizeof(sii));
+            len = sizeof(sii);
+
+            if ( Length >= len)
+            {
+                if (!SystemInformation) ret = STATUS_ACCESS_VIOLATION;
+                else memcpy( SystemInformation, &sii, len);
+            }
+            else ret = STATUS_INFO_LENGTH_MISMATCH;
+        }
+        break;
+    case SystemKernelDebuggerInformation:
+        {
+            SYSTEM_KERNEL_DEBUGGER_INFORMATION skdi;
+
+            skdi.DebuggerEnabled = FALSE;
+            skdi.DebuggerNotPresent = TRUE;
+            len = sizeof(skdi);
+
+            if ( Length >= len)
+            {
+                if (!SystemInformation) ret = STATUS_ACCESS_VIOLATION;
+                else memcpy( SystemInformation, &skdi, len);
             }
             else ret = STATUS_INFO_LENGTH_MISMATCH;
         }
         break;
     case SystemRegistryQuotaInformation:
-       /* Something to do with the size of the registry             *
-        * Since we don't have a size limitation, fake it            *
-        * This is almost certainly wrong.                           *
-        * This sets each of the three words in the struct to 32 MB, *
-        * which is enough to make the IE 5 installer happy.         */
         {
-            SYSTEM_REGISTRY_QUOTA_INFORMATION* srqi = (SYSTEM_REGISTRY_QUOTA_INFORMATION*)SystemInformation;
-            if (Length >= sizeof(*srqi))
+           /* Something to do with the size of the registry             *
+            * Since we don't have a size limitation, fake it            *
+            * This is almost certainly wrong.                           *
+            * This sets each of the three words in the struct to 32 MB, *
+            * which is enough to make the IE 5 installer happy.         */
+            SYSTEM_REGISTRY_QUOTA_INFORMATION srqi;
+
+            srqi.RegistryQuotaAllowed = 0x2000000;
+            srqi.RegistryQuotaUsed = 0x200000;
+            srqi.Reserved1 = (void*)0x200000;
+            len = sizeof(srqi);
+
+            if ( Length >= len)
             {
-                FIXME("(0x%08x,%p,0x%08lx,%p) faking max registry size of 32 MB\n",
-                      SystemInformationClass,SystemInformation,Length,ResultLength);
-                srqi->RegistryQuotaAllowed = 0x2000000;
-                srqi->RegistryQuotaUsed = 0x200000;
-                srqi->Reserved1 = (void*)0x200000;
-                if (ResultLength) *ResultLength = sizeof(*srqi);
+                if (!SystemInformation) ret = STATUS_ACCESS_VIOLATION;
+                else
+                {
+                    FIXME("SystemRegistryQuotaInformation: faking max registry size of 32 MB\n");
+                    memcpy( SystemInformation, &srqi, len);
+                }
             }
             else ret = STATUS_INFO_LENGTH_MISMATCH;
         }
        break;
-
     default:
        FIXME("(0x%08x,%p,0x%08lx,%p) stub\n",
              SystemInformationClass,SystemInformation,Length,ResultLength);
-       memset(SystemInformation, 0, Length);
-        ret = STATUS_NOT_IMPLEMENTED;
+
+        /* Several Information Classes are not implemented on Windows and return 2 different values 
+         * STATUS_NOT_IMPLEMENTED or STATUS_INVALID_INFO_CLASS
+         * in 95% of the cases it's STATUS_INVALID_INFO_CLASS, so use this as the default
+        */
+        ret = STATUS_INVALID_INFO_CLASS;
     }
+
     if (ResultLength) *ResultLength = len;
 
     return ret;
 }
 
+/******************************************************************************
+ * NtSetSystemInformation [NTDLL.@]
+ * ZwSetSystemInformation [NTDLL.@]
+ */
+NTSTATUS WINAPI NtSetSystemInformation(SYSTEM_INFORMATION_CLASS SystemInformationClass, PVOID SystemInformation, ULONG Length)
+{
+    FIXME("(0x%08x,%p,0x%08lx) stub\n",SystemInformationClass,SystemInformation,Length);
+    return STATUS_SUCCESS;
+}
 
 /******************************************************************************
  *  NtCreatePagingFile         [NTDLL.@]
  *  ZwCreatePagingFile         [NTDLL.@]
  */
 NTSTATUS WINAPI NtCreatePagingFile(
-       IN PUNICODE_STRING PageFileName,
-       IN ULONG MiniumSize,
-       IN ULONG MaxiumSize,
-       OUT PULONG ActualSize)
+       PUNICODE_STRING PageFileName,
+       PLARGE_INTEGER MinimumSize,
+       PLARGE_INTEGER MaximumSize,
+       PLARGE_INTEGER ActualSize)
 {
-       FIXME("(%p(%s),0x%08lx,0x%08lx,%p),stub!\n",
-       PageFileName->Buffer, debugstr_w(PageFileName->Buffer),MiniumSize,MaxiumSize,ActualSize);
-       return 0;
+    FIXME("(%p %p %p %p) stub\n", PageFileName, MinimumSize, MaximumSize, ActualSize);
+    return STATUS_SUCCESS;
 }
 
 /******************************************************************************
@@ -723,14 +946,89 @@ NTSTATUS WINAPI NtDisplayString ( PUNICODE_STRING string )
     return ret;
 }
 
+/******************************************************************************
+ *  NtInitiatePowerAction                       [NTDLL.@]
+ *
+ */
+NTSTATUS WINAPI NtInitiatePowerAction(
+       IN POWER_ACTION SystemAction,
+       IN SYSTEM_POWER_STATE MinSystemState,
+       IN ULONG Flags,
+       IN BOOLEAN Asynchronous)
+{
+        FIXME("(%d,%d,0x%08lx,%d),stub\n",
+               SystemAction,MinSystemState,Flags,Asynchronous);
+        return STATUS_NOT_IMPLEMENTED;
+}
+       
+
 /******************************************************************************
  *  NtPowerInformation                         [NTDLL.@]
  *
  */
-NTSTATUS WINAPI NtPowerInformation(DWORD x1,DWORD x2,DWORD x3,DWORD x4,DWORD x5)
+NTSTATUS WINAPI NtPowerInformation(
+       IN POWER_INFORMATION_LEVEL InformationLevel,
+       IN PVOID lpInputBuffer,
+       IN ULONG nInputBufferSize,
+       IN PVOID lpOutputBuffer,
+       IN ULONG nOutputBufferSize)
 {
-       FIXME("(0x%08lx,0x%08lx,0x%08lx,0x%08lx,0x%08lx),stub\n",x1,x2,x3,x4,x5);
-       return 0;
+       TRACE("(%d,%p,%ld,%p,%ld)\n",
+               InformationLevel,lpInputBuffer,nInputBufferSize,lpOutputBuffer,nOutputBufferSize);
+       switch(InformationLevel) {
+               case SystemPowerCapabilities: {
+                       PSYSTEM_POWER_CAPABILITIES PowerCaps = (PSYSTEM_POWER_CAPABILITIES)lpOutputBuffer;
+                       FIXME("semi-stub: SystemPowerCapabilities\n");
+                       if (nOutputBufferSize < sizeof(SYSTEM_POWER_CAPABILITIES))
+                               return STATUS_BUFFER_TOO_SMALL;
+                       /* FIXME: These values are based off a native XP desktop, should probably use APM/ACPI to get the 'real' values */
+                       PowerCaps->PowerButtonPresent = TRUE;
+                       PowerCaps->SleepButtonPresent = FALSE;
+                       PowerCaps->LidPresent = FALSE;
+                       PowerCaps->SystemS1 = TRUE;
+                       PowerCaps->SystemS2 = FALSE;
+                       PowerCaps->SystemS3 = FALSE;
+                       PowerCaps->SystemS4 = TRUE;
+                       PowerCaps->SystemS5 = TRUE;
+                       PowerCaps->HiberFilePresent = TRUE;
+                       PowerCaps->FullWake = TRUE;
+                       PowerCaps->VideoDimPresent = FALSE;
+                       PowerCaps->ApmPresent = FALSE;
+                       PowerCaps->UpsPresent = FALSE;
+                       PowerCaps->ThermalControl = FALSE;
+                       PowerCaps->ProcessorThrottle = FALSE;
+                       PowerCaps->ProcessorMinThrottle = 100;
+                       PowerCaps->ProcessorMaxThrottle = 100;
+                       PowerCaps->DiskSpinDown = TRUE;
+                       PowerCaps->SystemBatteriesPresent = FALSE;
+                       PowerCaps->BatteriesAreShortTerm = FALSE;
+                       PowerCaps->BatteryScale[0].Granularity = 0;
+                       PowerCaps->BatteryScale[0].Capacity = 0;
+                       PowerCaps->BatteryScale[1].Granularity = 0;
+                       PowerCaps->BatteryScale[1].Capacity = 0;
+                       PowerCaps->BatteryScale[2].Granularity = 0;
+                       PowerCaps->BatteryScale[2].Capacity = 0;
+                       PowerCaps->AcOnLineWake = PowerSystemUnspecified;
+                       PowerCaps->SoftLidWake = PowerSystemUnspecified;
+                       PowerCaps->RtcWake = PowerSystemSleeping1;
+                       PowerCaps->MinDeviceWakeState = PowerSystemUnspecified;
+                       PowerCaps->DefaultLowLatencyWake = PowerSystemUnspecified;
+                       return STATUS_SUCCESS;
+               }
+               default:
+                       FIXME("Unimplemented NtPowerInformation action: %d\n", InformationLevel);
+                       return STATUS_NOT_IMPLEMENTED;
+       }
+}
+
+/******************************************************************************
+ *  NtShutdownSystem                           [NTDLL.@]
+ *
+ */
+NTSTATUS WINAPI NtShutdownSystem(SHUTDOWN_ACTION Action)
+{
+    FIXME("%d\n",Action);
+    return STATUS_SUCCESS;
 }
 
 /******************************************************************************
@@ -740,9 +1038,12 @@ NTSTATUS WINAPI NtPowerInformation(DWORD x1,DWORD x2,DWORD x3,DWORD x4,DWORD x5)
  */
 NTSTATUS WINAPI NtAllocateLocallyUniqueId(PLUID Luid)
 {
-    static LUID luid;
+    static LUID luid = { SE_MAX_WELL_KNOWN_PRIVILEGE, 0 };
+
+    FIXME("%p\n", Luid);
 
-    FIXME("%p (0x%08lx%08lx)\n", Luid, luid.HighPart, luid.LowPart);
+    if (!Luid)
+        return STATUS_ACCESS_VIOLATION;
 
     luid.LowPart++;
     if (luid.LowPart==0)
@@ -783,3 +1084,19 @@ ULONGLONG WINAPI VerSetConditionMask( ULONGLONG dwlConditionMask, DWORD dwTypeBi
        dwlConditionMask |= dwConditionMask << 0*3;
     return dwlConditionMask;
 }
+
+/******************************************************************************
+ *  NtAccessCheckAndAuditAlarm   (NTDLL.@)
+ *  ZwAccessCheckAndAuditAlarm   (NTDLL.@)
+ */
+NTSTATUS WINAPI NtAccessCheckAndAuditAlarm(PUNICODE_STRING SubsystemName, HANDLE HandleId, PUNICODE_STRING ObjectTypeName,
+                                           PUNICODE_STRING ObjectName, PSECURITY_DESCRIPTOR SecurityDescriptor,
+                                           ACCESS_MASK DesiredAccess, PGENERIC_MAPPING GenericMapping, BOOLEAN ObjectCreation,
+                                           PACCESS_MASK GrantedAccess, PBOOLEAN AccessStatus, PBOOLEAN GenerateOnClose)
+{
+    FIXME("(%s, %p, %s, %p, 0x%08lx, %p, %d, %p, %p, %p), stub\n", debugstr_us(SubsystemName), HandleId,
+          debugstr_us(ObjectTypeName), SecurityDescriptor, DesiredAccess, GenericMapping, ObjectCreation,
+          GrantedAccess, AccessStatus, GenerateOnClose);
+
+    return STATUS_NOT_IMPLEMENTED;
+}