Changeset 30


Ignore:
Timestamp:
Jun 1, 1999, 11:52:15 PM (26 years ago)
Author:
phaller
Message:

Port: NTDLL from Wine-990508 (almost) completely ported. 64-bit integer arithmtic missing.

Location:
trunk/src/NTDLL
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified trunk/src/NTDLL/makefile

    r4 r30  
    1 # $Id: makefile,v 1.1 1999-05-24 20:19:31 ktk Exp $
     1# $Id: makefile,v 1.2 1999-06-01 21:52:15 phaller Exp $
    22
    33#
    4 # PD-Win32 API 
     4# PD-Win32 API
    55#
    6 #       NTDLL.dll makefile
    7 # 
     6#       NTDLL.dll makefile
     7#
    88
    99PDWIN32_INCLUDE = ..\..\include
     
    1919
    2020
    21 OBJS = NTDLL.obj
     21OBJS = NTDLL.obj   \
     22       file.obj    \
     23       nt.obj      \
     24       om.obj      \
     25       reg.obj     \
     26       rtl.obj     \
     27       rtlstr.obj  \
     28       sec.obj     \
     29       sync.obj    \
     30       time.obj
     31
    2232
    2333TARGET = NTDLL
     
    2939        $(LD) $(LDFLAGS) -Fm -Fe$@ $(OBJS) $(TARGET).def $(PDWIN32_LIB)\kernel32.lib
    3040# PMWINX.LIB LIBULS.LIB LIBCONV.LIB
    31         $(CP) $@ $(PDWIN32_BIN)
     41        $(CP) $@ $(PDWIN32_BIN)
    3242
    3343$(TARGET).lib: $(TARGET).dll
    3444        $(IMPLIB) $(IMPLIBFLAGS) $@ $(TARGET).dll
    35         $(CP) $@ $(PDWIN32_LIB)
     45        $(CP) $@ $(PDWIN32_LIB)
    3646
    3747
    3848
    39 ntdll.obj: \
    40     .\ntdll.c \
    41     .\ntdll.h \
    42     $(PDWIN32_INCLUDE)\unicode.h
     49ntdll.obj:  .\ntdll.c  .\ntdll.h
     50
     51file.obj:   .\file.c   .\ntdll.h
     52
     53nt.obj:     .\nt.c     .\ntdll.h
     54
     55om.obj:     .\om.c     .\ntdll.h
     56
     57reg.obj:    .\reg.c    .\ntdll.h
     58
     59rtl.obj:    .\rtl.c    .\ntdll.h
     60
     61rtlstr.obj: .\rtlstr.c .\ntdll.h
     62
     63sec.obj:    .\sec.c    .\ntdll.h
     64
     65sync.obj:   .\sync.c   .\ntdll.h
     66
     67time.obj:   .\time.c   .\ntdll.h
     68
    4369
    4470
    4571clean:
    46         $(RM) *.obj *.lib *.dll *~ *.map *.pch
    47         $(RM) $(PDWIN32_LIB)\$(TARGET).lib
    48         $(RM) $(PDWIN32_BIN)\$(TARGET).dll
     72        $(RM) *.obj *.lib *.dll *~ *.map *.pch
     73        $(RM) $(PDWIN32_LIB)\$(TARGET).lib
     74        $(RM) $(PDWIN32_BIN)\$(TARGET).dll
    4975
    50 
  • TabularUnified trunk/src/NTDLL/ntdll.c

    r4 r30  
    1 /* $Id: ntdll.c,v 1.1 1999-05-24 20:19:31 ktk Exp $ */
     1/* $Id: ntdll.c,v 1.2 1999-06-01 21:52:15 phaller Exp $ */
    22
    33/*
    44 *
    55 * Project Odin Software License can be found in LICENSE.TXT
     6 * Win32 NT Runtime / NTDLL for OS/2
    67 *
    7  */
    8 /*
    9  * Win32 NT Runtime for OS/2
     8 * Copyright 1998, 1999 Patrick Haller (phaller@gmx.net)
    109 *
    11  * 1998/05/20 Patrick Haller (haller@zebra.fh-weingarten.de)
    12  *
    13  * @(#) ntdll.cpp  1.0.1   1999/05/08 SvL: Changes for compilation with Wine headers     
     10 * @(#) ntdll.cpp  1.0.1   1999/05/08 SvL: Changes for compilation with Wine headers
    1411 *                 1.0.0   1998/05/20 PH Start from WINE/NTDLL.C
    1512 *
     
    3734#include <winnt.h>
    3835#include <ntdef.h>
    39 
    4036#include <builtin.h>
    4137#include <stdlib.h>
     
    4541#include "unicode.h"
    4642
     43#include "ntdll.h"
     44
    4745
    4846/*****************************************************************************
    4947 * Types & Defines                                                           *
    5048 *****************************************************************************/
     49
     50#define NTSTATUS DWORD
    5151
    5252
     
    8181  return dst;
    8282}
     83
     84
     85/***********************************************************************
     86 *           lstrncmp32W   (Not a Windows API)
     87 */
     88INT WIN32API lstrncmpW( LPCWSTR str1, LPCWSTR str2, INT n )
     89{
     90  if (!n)
     91    return 0;
     92
     93  while ((--n > 0) && *str1 && (*str1 == *str2))
     94  {
     95    str1++;
     96    str2++;
     97  }
     98
     99  return (INT)(*str1 - *str2);
     100}
     101
    83102
    84103
     
    161180}
    162181
    163 
    164 /**************************************************************************
    165  *                 RtlLengthRequiredSid          [NTDLL]
    166  */
    167 DWORD WIN32API RtlLengthRequiredSid(DWORD nrofsubauths)
    168 {
    169   dprintf(("NTDLL: RtlLengthRequireSid(%08x)\n",
    170            nrofsubauths));
    171 
    172   return sizeof(DWORD)*nrofsubauths+sizeof(SID);
    173 }
    174 
    175 /**************************************************************************
    176  *                 RtlLengthSid              [NTDLL]
    177  */
    178 DWORD WIN32API RtlLengthSid(PSID sid)
    179 {
    180   dprintf(("NTDLL: RtlLengthSid(%08x)\n",
    181            sid));
    182 
    183   return sizeof(DWORD)*sid->SubAuthorityCount+sizeof(SID);
    184 }
    185 
    186 /**************************************************************************
    187  *                 RtlCreateAcl              [NTDLL]
    188  *
    189  * NOTES
    190  *    This should return NTSTATUS
    191  */
    192 DWORD WIN32API RtlCreateAcl(PACL acl,
    193                             DWORD size,
    194                             DWORD rev)
    195 {
    196   dprintf(("NTDLL: RtlCreateAcl(%08x,%08x,%08x)\n",
    197            acl,
    198            size,
    199            rev));
    200 
    201    if (rev!=ACL_REVISION)
    202      return STATUS_INVALID_PARAMETER;
    203 
    204    if (size<sizeof(ACL))
    205      return STATUS_BUFFER_TOO_SMALL;
    206 
    207    if (size>0xFFFF)
    208      return STATUS_INVALID_PARAMETER;
    209 
    210 
    211   memset(acl,
    212          '\0',
    213          sizeof(ACL));
    214 
    215   acl->AclRevision  = rev;
    216   acl->AclSize      = size;
    217   acl->AceCount     = 0;
    218   return 0;
    219 }
    220 
    221 /**************************************************************************
    222  *                 RtlFirstFreeAce           [NTDLL]
    223  * looks for the AceCount+1 ACE, and if it is still within the alloced
    224  * ACL, return a pointer to it
    225  */
    226 BOOL WIN32API RtlFirstFreeAce(PACL acl,
    227                               PACE_HEADER *x)
    228 {
    229   PACE_HEADER ace;
    230   int          i;
    231 
    232   dprintf(("NTDLL: RtlFirstFreeAce(%08x,%08x)\n",
    233            acl,
    234            x));
    235 
    236    *x = 0;
    237    ace = (PACE_HEADER)(acl+1);
    238    for (i=0;i<acl->AceCount;i++) {
    239            if ((DWORD)ace>=(((DWORD)acl)+acl->AclSize))
    240                    return 0;
    241            ace = (PACE_HEADER)(((BYTE*)ace)+ace->AceSize);
    242    }
    243    if ((DWORD)ace>=(((DWORD)acl)+acl->AclSize))
    244            return 0;
    245    *x = ace;
    246    return 1;
    247 }
    248 
    249 /**************************************************************************
    250  *                 RtlAddAce             [NTDLL]
    251  */
    252 DWORD  WIN32API RtlAddAce(PACL        acl,
    253                              DWORD        rev,
    254                              DWORD        xnrofaces,
    255                              PACE_HEADER acestart,
    256                              DWORD        acelen)
    257 {
    258   PACE_HEADER  ace,targetace;
    259   int       nrofaces;
    260 
    261   dprintf(("NTDLL: RtlAddAce(%08x,%08x,%08x,%08x,%08x)\n",
    262            acl,
    263            rev,
    264            xnrofaces,
    265            acestart,
    266            acelen));
    267 
    268   if (acl->AclRevision != ACL_REVISION)
    269           return STATUS_INVALID_PARAMETER;
    270   if (!RtlFirstFreeAce(acl,&targetace))
    271           return STATUS_INVALID_PARAMETER;
    272   nrofaces=0;ace=acestart;
    273   while (((DWORD)ace-(DWORD)acestart)<acelen) {
    274           nrofaces++;
    275           ace = (PACE_HEADER)(((BYTE*)ace)+ace->AceSize);
    276   }
    277   if ((DWORD)targetace+acelen>(DWORD)acl+acl->AclSize) /* too much aces */
    278           return STATUS_INVALID_PARAMETER;
    279   memcpy((LPBYTE)targetace,acestart,acelen);
    280   acl->AceCount+=nrofaces;
    281   return 0;
    282 }
    283 
    284 /**************************************************************************
    285  *                 RtlCreateSecurityDescriptor       [NTDLL]
    286  */
    287 DWORD WIN32API RtlCreateSecurityDescriptor(PSECURITY_DESCRIPTOR lpsd,
    288                                            DWORD rev)
    289 {
    290   dprintf(("NTDLL: RtlCreateSecurityDescriptor(%08x,%08x)\n",
    291            lpsd,
    292            rev));
    293 
    294   if (rev!=SECURITY_DESCRIPTOR_REVISION)
    295     return STATUS_UNKNOWN_REVISION;
    296 
    297   memset(lpsd,
    298          '\0',
    299          sizeof(*lpsd));
    300   lpsd->Revision = SECURITY_DESCRIPTOR_REVISION;
    301   return 0;
    302 }
    303 
    304 /**************************************************************************
    305  *                 RtlSetDaclSecurityDescriptor      [NTDLL]
    306  */
    307 DWORD WIN32API RtlSetDaclSecurityDescriptor (PSECURITY_DESCRIPTOR lpsd,
    308                                                 BOOL daclpresent,
    309                                                 PACL dacl,
    310                                                 BOOL dacldefaulted )
    311 {
    312   dprintf(("NTDLL: RtlSetDaclSecurityDescriptor(%08x,%08x,%08x,%08x)\n",
    313            lpsd,
    314            daclpresent,
    315            dacl,
    316            dacldefaulted));
    317 
    318   if (lpsd->Revision!=SECURITY_DESCRIPTOR_REVISION)
    319     return STATUS_UNKNOWN_REVISION;
    320 
    321   if (lpsd->Control & SE_SELF_RELATIVE)
    322     return STATUS_INVALID_SECURITY_DESCR;
    323 
    324   if (!daclpresent)
    325   {
    326     lpsd->Control &= ~SE_DACL_PRESENT;
    327     return 0;
    328   }
    329 
    330   lpsd->Control |= SE_DACL_PRESENT;
    331   lpsd->Dacl = dacl;
    332 
    333   if (dacldefaulted)
    334     lpsd->Control |= SE_DACL_DEFAULTED;
    335   else
    336     lpsd->Control &= ~SE_DACL_DEFAULTED;
    337 
    338   return 0;
    339 }
    340 
    341 /**************************************************************************
    342  *                 RtlSetSaclSecurityDescriptor      [NTDLL]
    343  */
    344 DWORD WIN32API RtlSetSaclSecurityDescriptor (PSECURITY_DESCRIPTOR lpsd,
    345                                                 BOOL saclpresent,
    346                                                 PACL sacl,
    347                                                 BOOL sacldefaulted)
    348 {
    349   dprintf(("NTDLL: RtlSetSaclSecurityDescriptor(%08x,%08x,%08x,%08x)\n",
    350            lpsd,
    351            saclpresent,
    352            sacl,
    353            sacldefaulted));
    354 
    355   if (lpsd->Revision!=SECURITY_DESCRIPTOR_REVISION)
    356     return STATUS_UNKNOWN_REVISION;
    357 
    358   if (lpsd->Control & SE_SELF_RELATIVE)
    359     return STATUS_INVALID_SECURITY_DESCR;
    360 
    361   if (!saclpresent)
    362   {
    363     lpsd->Control &= ~SE_SACL_PRESENT;
    364     return 0;
    365   }
    366 
    367   lpsd->Control |= SE_SACL_PRESENT;
    368   lpsd->Sacl = sacl;
    369 
    370   if (sacldefaulted)
    371     lpsd->Control |= SE_SACL_DEFAULTED;
    372   else
    373     lpsd->Control &= ~SE_SACL_DEFAULTED;
    374 
    375   return 0;
    376 }
    377 
    378 /**************************************************************************
    379  *                 RtlSetOwnerSecurityDescriptor     [NTDLL]
    380  */
    381 DWORD WIN32API RtlSetOwnerSecurityDescriptor (PSECURITY_DESCRIPTOR lpsd,
    382                                                  PSID owner,
    383                                                  BOOL ownerdefaulted)
    384 {
    385   dprintf(("NTDLL: RtlSetOwnerSecurityDescriptor(%08x,%08x,%08x)\n",
    386            lpsd,
    387            owner,
    388            ownerdefaulted));
    389 
    390   if (lpsd->Revision!=SECURITY_DESCRIPTOR_REVISION)
    391     return STATUS_UNKNOWN_REVISION;
    392 
    393   if (lpsd->Control & SE_SELF_RELATIVE)
    394     return STATUS_INVALID_SECURITY_DESCR;
    395 
    396   lpsd->Owner = owner;
    397 
    398   if (ownerdefaulted)
    399     lpsd->Control |= SE_OWNER_DEFAULTED;
    400   else
    401     lpsd->Control &= ~SE_OWNER_DEFAULTED;
    402 
    403   return 0;
    404 }
    405 
    406 /**************************************************************************
    407  *                 RtlSetOwnerSecurityDescriptor     [NTDLL]
    408  */
    409 DWORD WIN32API RtlSetGroupSecurityDescriptor (PSECURITY_DESCRIPTOR lpsd,
    410                                                  PSID group,
    411                                                  BOOL groupdefaulted)
    412 {
    413   dprintf(("NTDLL: SetGroupSecurityDescriptor(%08x,%08x,%08x)\n",
    414            lpsd,
    415            group,
    416            groupdefaulted));
    417 
    418   if (lpsd->Revision!=SECURITY_DESCRIPTOR_REVISION)
    419     return STATUS_UNKNOWN_REVISION;
    420 
    421   if (lpsd->Control & SE_SELF_RELATIVE)
    422     return STATUS_INVALID_SECURITY_DESCR;
    423 
    424   lpsd->Group = group;
    425 
    426   if (groupdefaulted)
    427     lpsd->Control |= SE_GROUP_DEFAULTED;
    428   else
    429     lpsd->Control &= ~SE_GROUP_DEFAULTED;
    430 
    431   return 0;
    432 }
    433 
    434 
    435 /**************************************************************************
    436  *                 RtlNormalizeProcessParams     [NTDLL]
    437  */
    438 LPVOID WIN32API RtlNormalizeProcessParams(LPVOID x)
    439 {
    440   dprintf(("NTDLL: RtlNormalizeProcessParams(%08xh)\n",
    441            x));
    442 
    443   return x;
    444 }
    445 
    446 /**************************************************************************
    447  *                 RtlInitializeSid          [NTDLL]
    448  */
    449 DWORD WIN32API RtlInitializeSid(PSID PSID,
    450                                    PSID_IDENTIFIER_AUTHORITY PSIDauth,
    451                                    DWORD c)
    452 {
    453   BYTE  a = c&0xff;
    454 
    455   dprintf(("NTDLL: RtlInitializeSid(%08x,%08x,%08x)\n",
    456            PSID,
    457            PSIDauth,
    458            c));
    459 
    460   if (a>=SID_MAX_SUB_AUTHORITIES)
    461     return a;
    462 
    463   PSID->SubAuthorityCount = a;
    464   PSID->Revision      = SID_REVISION;
    465 
    466   memcpy(&(PSID->IdentifierAuthority),
    467          PSIDauth,
    468          sizeof(SID_IDENTIFIER_AUTHORITY));
    469 
    470   return 0;
    471 }
    472 
    473 /**************************************************************************
    474  *                 RtlSubAuthoritySid            [NTDLL]
    475  */
    476 LPDWORD WIN32API RtlSubAuthoritySid(PSID PSID,
    477                                        DWORD nr)
    478 {
    479   dprintf(("NTDLL: RtlSubAuthoritySid(%08x,%08d)\n",
    480            PSID,
    481            nr));
    482 
    483   return &(PSID->SubAuthority[nr]);
    484 }
    485 
    486 /**************************************************************************
    487  *                 RtlSubAuthorityCountSid       [NTDLL]
    488  */
    489 LPBYTE WIN32API RtlSubAuthorityCountSid(PSID PSID)
    490 {
    491   dprintf(("NTDLL: RtlSubAuthorityCountSid(%08x)\n",
    492            PSID));
    493 
    494   return ((LPBYTE)PSID)+1;
    495 }
    496 
    497 /**************************************************************************
    498  *                 RtlCopySid                [NTDLL]
    499  */
    500 DWORD WIN32API RtlCopySid(DWORD len,
    501                              PSID to,
    502                              PSID from)
    503 {
    504   dprintf(("NTDLL: RtlCopySid(%08x,%08x,%08x)\n",
    505            len,
    506            to,
    507            from));
    508 
    509   if (len<(from->SubAuthorityCount*4+8))
    510     return STATUS_BUFFER_TOO_SMALL;
    511 
    512   memmove(to,
    513           from,
    514           from->SubAuthorityCount*4+8);
    515 
    516   return STATUS_SUCCESS;
    517 }
    518 
    519 /**************************************************************************
    520  *                 RtlAnsiStringToUnicodeString      [NTDLL]
    521  */
    522 DWORD WIN32API RtlAnsiStringToUnicodeString(PUNICODE_STRING uni,
    523                                             PANSI_STRING    ansi,
    524                                             BOOL            doalloc)
    525 {
    526   DWORD unilen = (ansi->Length+1)*sizeof(WCHAR);
    527 
    528   dprintf(("NTDLL: RtlAnsiStringToUnicodeString(%08x,%s,%08x)\n",
    529            uni,
    530            ansi,
    531            doalloc));
    532 
    533   if (unilen>0xFFFF)
    534     return STATUS_INVALID_PARAMETER_2;
    535 
    536   uni->Length = unilen;
    537 
    538   if (doalloc)
    539   {
    540     uni->MaximumLength = unilen;
    541     uni->Buffer = HeapAlloc(GetProcessHeap(),
    542                                HEAP_ZERO_MEMORY,
    543                                unilen);
    544     if (!uni->Buffer)
    545       return STATUS_NO_MEMORY;
    546   }
    547 
    548   if (unilen>uni->MaximumLength)
    549     return STATUS_BUFFER_OVERFLOW;
    550 
    551   lstrcpynAtoW(uni->Buffer,
    552                ansi->Buffer,
    553                unilen/2);
    554 
    555   return STATUS_SUCCESS;
    556 }
    557 
    558 /**************************************************************************
    559  *                 RtlOemStringToUnicodeString       [NTDLL]
    560  */
    561 DWORD WIN32API RtlOemStringToUnicodeString(PUNICODE_STRING uni,
    562                                            PSTRING ansi,
    563                                            BOOL doalloc)
    564 {
    565   DWORD unilen = (ansi->Length+1)*sizeof(WCHAR);
    566 
    567   dprintf(("NTDLL: RtlOemStringToUnicodeString (%08x,%s,%08x)\n",
    568            uni,
    569            ansi,
    570            doalloc));
    571 
    572   if (unilen>0xFFFF)
    573     return STATUS_INVALID_PARAMETER_2;
    574 
    575   uni->Length = unilen;
    576 
    577   if (doalloc)
    578   {
    579     uni->MaximumLength = unilen;
    580     uni->Buffer = HeapAlloc(GetProcessHeap(),
    581                                HEAP_ZERO_MEMORY,
    582                                unilen);
    583 
    584     if (!uni->Buffer)
    585       return STATUS_NO_MEMORY;
    586   }
    587 
    588   if (unilen>uni->MaximumLength)
    589     return STATUS_BUFFER_OVERFLOW;
    590 
    591   lstrcpynAtoW(uni->Buffer,
    592                ansi->Buffer,
    593                unilen/2);
    594 
    595   return STATUS_SUCCESS;
    596 }
    597 
    598 
    599 /**************************************************************************
    600  *                 RtlMultiByteToUnicodeN        [NTDLL]
    601  * FIXME: multibyte support
    602  */
    603 DWORD WIN32API RtlMultiByteToUnicodeN(LPWSTR  unistr,
    604                                          DWORD   unilen,
    605                                          LPDWORD reslen,
    606                                          LPSTR   oemstr,
    607                                          DWORD   oemlen)
    608 {
    609   DWORD  len;
    610   LPWSTR x;
    611 
    612   dprintf(("NTDLL: RtlMultiByteToUnicodeN(%08x,%08x,%08x,%s,%08x)\n",
    613            unistr,
    614            unilen,
    615            reslen,
    616            oemstr,
    617            oemlen));
    618 
    619   len = oemlen;
    620   if (unilen/2 < len)
    621     len = unilen/2;
    622 
    623   x=(LPWSTR)HeapAlloc(GetProcessHeap(),
    624                          HEAP_ZERO_MEMORY,
    625                          (len+1)*sizeof(WCHAR));
    626   lstrcpynAtoW(x,
    627                oemstr,
    628                len+1);
    629   memcpy(unistr,
    630          x,
    631          len*2);
    632 
    633   if (reslen)
    634     *reslen = len*2;
    635 
    636   return 0;
    637 }
    638 
    639 /**************************************************************************
    640  *                 RtlOemToUnicodeN          [NTDLL]
    641  */
    642 DWORD WIN32API RtlOemToUnicodeN(LPWSTR unistr,
    643                                    DWORD unilen,
    644                                    LPDWORD reslen,
    645                                    LPSTR oemstr,
    646                                    DWORD oemlen)
    647 {
    648   DWORD  len;
    649   LPWSTR x;
    650 
    651   dprintf(("NTDLL: RtlOemToUnicodeN(%08x,%08x,%08x,%s,%08x)\n",
    652            unistr,
    653            unilen,
    654            reslen,
    655            oemstr,
    656            oemlen));
    657 
    658   len = oemlen;
    659   if (unilen/2 < len)
    660     len = unilen/2;
    661 
    662   x=(LPWSTR)HeapAlloc(GetProcessHeap(),
    663                          HEAP_ZERO_MEMORY,
    664                          (len+1)*sizeof(WCHAR));
    665 
    666   lstrcpynAtoW(x,
    667                oemstr,
    668                len+1);
    669 
    670   memcpy(unistr,
    671          x,
    672          len*2);
    673 
    674   if (reslen)
    675     *reslen = len*2;
    676 
    677   return 0;
    678 }
    679 
    680 /**************************************************************************
    681  *                 RtlInitString         [NTDLL]
    682  */
    683 VOID WIN32API RtlInitAnsiString(PANSI_STRING target,
    684                                    LPCSTR source)
    685 {
    686   dprintf(("NTDLL: RtlInitAnsiString(%08x,%08x)\n",
    687            target,
    688            source));
    689 
    690   target->Length = target->MaximumLength = 0;
    691   target->Buffer = (LPSTR)source;
    692   if (!source)
    693     return;
    694 
    695   target->Length = lstrlenA(target->Buffer);
    696   target->MaximumLength = target->Length+1;
    697 }
    698 
    699 /**************************************************************************
    700  *                 RtlInitString         [NTDLL]
    701  */
    702 VOID WIN32API RtlInitString(PSTRING target,
    703                                LPCSTR source)
    704 {
    705   dprintf(("NTDLL: RtlInitString(%08x,%08x)\n",
    706            target,
    707            source));
    708 
    709   target->Length = target->MaximumLength = 0;
    710   target->Buffer = (LPSTR)source;
    711   if (!source)
    712     return;
    713 
    714   target->Length = lstrlenA(target->Buffer);
    715   target->MaximumLength = target->Length+1;
    716 }
    717 
    718 /**************************************************************************
    719  *                 RtlInitUnicodeString          [NTDLL]
    720  */
    721 VOID WIN32API RtlInitUnicodeString(PUNICODE_STRING target,
    722                                       LPCWSTR source)
    723 {
    724   dprintf(("NTDLL: RtlInitUnicodeString(%08x,%08x)\n",
    725            target,
    726            source));
    727 
    728   target->Length = target->MaximumLength = 0;
    729   target->Buffer = (LPWSTR)source;
    730   if (!source)
    731     return;
    732 
    733   target->Length = lstrlenW(target->Buffer)*2;
    734   target->MaximumLength = target->Length+2;
    735 }
    736 
    737 /**************************************************************************
    738  *                 RtlFreeUnicodeString          [NTDLL]
    739  */
    740 VOID WIN32API RtlFreeUnicodeString(PUNICODE_STRING str)
    741 {
    742   dprintf(("NTDLL: RtlFreeUnicodeString(%08x)\n",
    743            str));
    744 
    745   if (str->Buffer)
    746     HeapFree(GetProcessHeap(),
    747                 0,
    748                 str->Buffer);
    749 }
    750 
    751 /**************************************************************************
    752  *                 RtlUnicodeToOemN          [NTDLL]
    753  */
    754 DWORD WIN32API RtlUnicodeToOemN(LPSTR   oemstr,
    755                                    DWORD   oemlen,
    756                                    LPDWORD reslen,
    757                                    LPWSTR  unistr,
    758                                    DWORD   unilen)
    759 {
    760   DWORD len;
    761   LPSTR x;
    762 
    763   dprintf(("NTDLL: RtlUnicodeToOemN (%08x,%08x,%08x,%08x,%08x)\n",
    764            oemstr,
    765            oemlen,
    766            reslen,
    767            unistr,
    768            unilen));
    769 
    770   len = oemlen;
    771   if (unilen/2 < len)
    772     len = unilen/2;
    773 
    774   x=(LPSTR)HeapAlloc(GetProcessHeap(),
    775                         HEAP_ZERO_MEMORY,
    776                         len+1);
    777 
    778   lstrcpynWtoA(x,
    779                unistr,
    780                len+1);
    781 
    782   memcpy(oemstr,
    783          x,
    784          len);
    785 
    786   if (reslen)
    787     *reslen = len;
    788 
    789   return 0;
    790 }
    791 
    792 /**************************************************************************
    793  *                 RtlUnicodeStringToOemString       [NTDLL]
    794  */
    795 DWORD WIN32API RtlUnicodeStringToOemString(PANSI_STRING oem,
    796                                               PUNICODE_STRING uni,
    797                                               BOOL alloc)
    798 {
    799   dprintf(("NTDLL: RtlUnicodeStringToOemString (%08x,%08x,%08x)\n",
    800            oem,
    801            uni,
    802            alloc));
    803 
    804   if (alloc)
    805   {
    806     oem->Buffer = (LPSTR)HeapAlloc(GetProcessHeap(),
    807                                       HEAP_ZERO_MEMORY,
    808                                       uni->Length/2)+1;
    809     oem->MaximumLength = uni->Length/2+1;
    810   }
    811 
    812   oem->Length = uni->Length/2;
    813   lstrcpynWtoA(oem->Buffer,
    814                uni->Buffer,
    815                uni->Length/2+1);
    816 
    817   return 0;
    818 }
    819 
    820 /**************************************************************************
    821  *                 RtlUnicodeStringToAnsiString      [NTDLL]
    822  */
    823 DWORD WIN32API RtlUnicodeStringToAnsiString(PUNICODE_STRING uni,
    824                                                PANSI_STRING oem,
    825                                                BOOL alloc)
    826 {
    827   dprintf(("NTDLL: RtlUnicodeStringToAnsiString(%08x,%08x,%08x)\n",
    828            uni,
    829            oem,
    830            alloc));
    831 
    832   if (alloc)
    833   {
    834     oem->Buffer = (LPSTR)HeapAlloc(GetProcessHeap(),
    835                                       HEAP_ZERO_MEMORY,
    836                                       uni->Length/2)+1;
    837     oem->MaximumLength = uni->Length/2+1;
    838   }
    839 
    840   oem->Length = uni->Length/2;
    841   lstrcpynWtoA(oem->Buffer,
    842                uni->Buffer,
    843                uni->Length/2+1);
    844 
    845   return 0;
    846 }
    847 
    848 /**************************************************************************
    849  *                 RtlNtStatusToDosErro          [NTDLL]
    850  */
    851 DWORD WIN32API RtlNtStatusToDosError(DWORD error)
    852 {
    853   dprintf(("NTDLL: RtlNtStatusToDosErro(%08x) not implemented properly.\n",
    854            error));
    855 
    856   /* @@@PH: map STATUS_ to ERROR_ */
    857   return error;
    858 }
    859 
    860 /**************************************************************************
    861  *                 RtlGetNtProductType           [NTDLL]
    862  */
    863 DWORD WIN32API RtlGetNtProductType(LPVOID x)
    864 {
    865   dprintf(("NTDLL: RtlGetNtProductType(%08x) not implemented.\n",
    866            x));
    867 
    868   /* @@@PH : find documentation for this one */
    869   return 0;
    870 }
    871 
    872 /**************************************************************************
    873  *                 RtlUpcaseUnicodeString        [NTDLL]
    874  */
    875 DWORD WIN32API RtlUpcaseUnicodeString(PUNICODE_STRING dest,
    876                                          PUNICODE_STRING src,
    877                                          BOOL           doalloc)
    878 {
    879   LPWSTR s;
    880   LPWSTR t;
    881   DWORD  i,len;
    882 
    883   dprintf(("NTDLL: RtlUpcaseUnicodeString(%08x,%08x,%08x)\n",
    884            dest,
    885            src,
    886            doalloc));
    887 
    888   len = src->Length;
    889   if (doalloc)
    890   {
    891     dest->MaximumLength = len;
    892     dest->Buffer = (LPWSTR)HeapAlloc(GetProcessHeap(),
    893                                         HEAP_ZERO_MEMORY,
    894                                         len);
    895     if (!dest->Buffer)
    896       return STATUS_NO_MEMORY;
    897   }
    898 
    899   if (dest->MaximumLength < len)
    900     return STATUS_BUFFER_OVERFLOW;
    901 
    902   s=dest->Buffer;
    903   t=src->Buffer;
    904 
    905   /* len is in bytes */
    906   for (i=0;
    907        i<len/2;
    908        i++)
    909     s[i]=toupper(t[i]);
    910 
    911   return STATUS_SUCCESS;
    912 }
    913 
    914 /**************************************************************************
    915  *                 RtlxOemStringToUnicodeSize        [NTDLL]
    916  */
    917 UINT WIN32API RtlxOemStringToUnicodeSize(PSTRING str)
    918 {
    919   dprintf(("NTDLL: RtlxOemStringToUnicodeSize(%08x)\n",
    920            str));
    921 
    922   return str->Length*2+2;
    923 }
    924 
    925 /**************************************************************************
    926  *                 RtlxAnsiStringToUnicodeSize       [NTDLL]
    927  */
    928 UINT WIN32API RtlxAnsiStringToUnicodeSize(PANSI_STRING str)
    929 {
    930   dprintf(("NTDLL: RtlxAnsiStringToUnicodeSize(%08x)\n",
    931            str));
    932 
    933   return str->Length*2+2;
    934 }
    935 
    936 /**************************************************************************
    937  *                 RtlDosPathNameToNtPathName_U      [NTDLL]
    938  *
    939  * FIXME: convert to UNC or whatever is expected here
    940  */
    941 BOOL  WIN32API RtlDosPathNameToNtPathName_U(
    942     LPWSTR from,PUNICODE_STRING us,DWORD x2,DWORD x3)
    943 {
    944   LPSTR fromA = HEAP_strdupWtoA(GetProcessHeap(),
    945                                 0,
    946                                 from);
    947 
    948   dprintf(("NTDLL: RtlDosPathNameToNtPathName_U(%s,%p,%08lx,%08lx)\n",
    949            fromA,
    950            us,
    951            x2,
    952            x3));
    953 
    954   if (us)
    955     RtlInitUnicodeString(us,
    956                          HEAP_strdupW(GetProcessHeap(),
    957                                       0,
    958                                       from));
    959 
    960   return TRUE;
    961 }
    962 
    963 /**************************************************************************
    964  *                 NtOpenFile               [NTDLL]
    965  */
    966 DWORD WIN32API NtOpenFile(DWORD x1,
    967                              DWORD flags,
    968                              DWORD x3,
    969                              DWORD x4,
    970                              DWORD alignment,
    971                              DWORD x6)
    972 {
    973   dprintf(("NTDLL: NtOpenFile (%08lx,%08lx,%08lx,%08lx,%08lx,%08lx) not implemented\n",
    974            x1,
    975            flags,
    976            x3,
    977            x4,
    978            alignment,
    979            x6));
    980 
    981   /* returns file io completion status */
    982   return 0;
    983 }
    984 
    985 
    986 //******************************************************************************
    987 //NtClose has to call CloseHandle since the Handlemanager has to be
    988 //called.
    989 //******************************************************************************
    990 DWORD WIN32API NtClose(HANDLE hHandle)
    991 {
    992   dprintf(("KERNEL32: NtClose(%08x) not properly implemented.\n",
    993            hHandle));
    994 
    995   /* @@@PH 98/05/05 function from NTDLL */
    996   return (CloseHandle(hHandle));
    997 }
    998 
    999 
    1000 //******************************************************************************
    1001 //TODO: What's this? (not found in SDK)
    1002 //******************************************************************************
    1003 HANDLE WIN32API RtlOpenCurrentUser(ULONG ulDummy1,
    1004                                       ULONG ulDummy2)
    1005 {
    1006   dprintf(("KERNEL32: RtlOpenCurrentUser(%08x, %08x) not implemented.\n",
    1007            ulDummy1,
    1008            ulDummy2));
    1009 
    1010   /* @@@PH required by NT's MSACM32 */
    1011   return (HANDLE)(NULL);
    1012 }
  • TabularUnified trunk/src/NTDLL/ntdll.def

    r4 r30  
    3030
    3131; real functions
    32     NtClose                       = _NtClose@4                        @1300
    33     RtlOpenCurrentUser            = _RtlOpenCurrentUser@8             @1301
    34     RtlLengthRequiredSid          = _RtlLengthRequiredSid@4           @1302
    35     RtlLengthSid                  = _RtlLengthSid@4                   @1303
    36     RtlCreateAcl                  = _RtlCreateAcl@12                  @1304
    37     RtlFirstFreeAce               = _RtlFirstFreeAce@8                @1305
    38     RtlAddAce                     = _RtlAddAce@20                     @1306
    39     RtlCreateSecurityDescriptor   = _RtlCreateSecurityDescriptor@8    @1307
    40     RtlSetDaclSecurityDescriptor  = _RtlSetDaclSecurityDescriptor@16  @1308
    41     RtlSetSaclSecurityDescriptor  = _RtlSetSaclSecurityDescriptor@16  @1309
    42     RtlSetOwnerSecurityDescriptor = _RtlSetOwnerSecurityDescriptor@12 @1310
    43     RtlSetGroupSecurityDescriptor = _RtlSetGroupSecurityDescriptor@12 @1311
    44     RtlNormalizeProcessParams     = _RtlNormalizeProcessParams@4      @1312
    45     RtlInitializeSid              = _RtlInitializeSid@12              @1313
    46     RtlSubAuthoritySid            = _RtlSubAuthoritySid@8             @1314
    47     RtlSubAuthorityCountSid       = _RtlSubAuthorityCountSid@4        @1315
    48     RtlCopySid                    = _RtlCopySid@12                    @1316
    49     RtlAnsiStringToUnicodeString  = _RtlAnsiStringToUnicodeString@12  @1317
    50     RtlOemStringToUnicodeString   = _RtlOemStringToUnicodeString@12   @1318
    51     RtlMultiByteToUnicodeN        = _RtlMultiByteToUnicodeN@20        @1319
    52     RtlOemToUnicodeN              = _RtlOemToUnicodeN@20              @1320
    53     RtlInitAnsiString             = _RtlInitAnsiString@8              @1321
    54     RtlInitString                 = _RtlInitString@8                  @1322
    55     RtlInitUnicodeString          = _RtlInitUnicodeString@8           @1323
    56     RtlFreeUnicodeString          = _RtlFreeUnicodeString@4           @1324
    57     RtlUnicodeToOemN              = _RtlUnicodeToOemN@20              @1325
    58     RtlUnicodeStringToOemString   = _RtlUnicodeStringToOemString@12   @1326
    59     RtlUnicodeStringToAnsiString  = _RtlUnicodeStringToAnsiString@12  @1327
    60     RtlNtStatusToDosError         = _RtlNtStatusToDosError@4          @1328
    61     RtlGetNtProductType           = _RtlGetNtProductType@4            @1329
    62     RtlUpcaseUnicodeString        = _RtlUpcaseUnicodeString@12        @1330
    63     RtlxOemStringToUnicodeSize    = _RtlxOemStringToUnicodeSize@4     @1331
    64     RtlxAnsiStringToUnicodeSize   = _RtlxAnsiStringToUnicodeSize@4    @1332
    65     RtlDosPathNameToNtPathName_U  = _RtlDosPathNameToNtPathName_U@16  @1333
    66     NtOpenFile                    = _NtOpenFile@24                    @1334
    67 
    68 
     32    NtOpenFile                    = _NtOpenFile@24                    @127
     33    ZwOpenFile                    = _NtOpenFile@24
     34    NtCreateFile                  = _NtCreateFile@44                  @73
     35    ZwCreateFile                  = _NtCreateFile@44
     36    NtReadFile                    = _NtReadFile@36
     37    ZwReadFile                    = _NtReadFile@36
     38    NtDeviceIoControlFile         = _NtDeviceIoControlFile@40         @94
     39    ZwDeviceIoControlFile         = _NtDeviceIoControlFile@40
     40    NtFsControlFile               = _NtFsControlFile@40               @108
     41    ZwFsControlFile               = _NtFsControlFile@40
     42    NtSetVolumeInformationFile    = _NtSetVolumeInformationFile@16
     43    ZwSetVolumeInformationFile    = _NtSetVolumeInformationFile@16
     44    NtQueryInformationFile        = _NtQueryInformationFile@20
     45    ZwQueryInformationFile        = _NtQueryInformationFile@20
     46    NtSetInformationFile          = _NtSetInformationFile@20
     47    ZwSetInformationFile          = _NtSetInformationFile@20
     48    NtQueryDirectoryFile          = _NtQueryDirectoryFile@44
     49    ZwQueryDirectoryFile          = _NtQueryDirectoryFile@44
     50    NtClose                       = _NtClose@4                        @65
     51    ZwClose                       = _NtClose@4
     52    NtCreateTimer                 = _NtCreateTimer@16                 @87
     53    ZwCreateTimer                 = _NtCreateTimer@16
     54    NtSetTimer                    = _NtSetTimer@28                    @221
     55    ZwSetTimer                    = _NtSetTimer@28
     56    NtQueryTimerResolution        = _NtQueryTimerResolution@12       
     57    ZwQueryTimerResolution        = _NtQueryTimerResolution@12
     58    NtTerminateProcess            = _NtTerminateProcess@8
     59    ZwTerminateProcess            = _NtTerminateProcess@8
     60    NtQueryInformationProcess     = _NtQueryInformationProcess@20
     61    ZwQueryInformationProcess     = _NtQueryInformationProcess@20
     62    NtSetInformationProcess       = _NtSetInformationProcess@16       @207
     63    ZwSetInformationProcess       = _NtSetInformationProcess@16
     64    NtResumeThread                = _NtResumeThread@8
     65    ZwResumeThread                = _NtResumeThread@8
     66    NtTerminateThread             = _NtTerminateThread@8
     67    ZwTerminateThread             = _NtTerminateThread@8
     68    NtQueryInformationThread      = _NtQueryInformationThread@20
     69    ZwQueryInformationThread      = _NtQueryInformationThread@20
     70    NtSetInformationThread        = _NtSetInformationThread@16
     71    ZwSetInformationThread        = _NtSetInformationThread@16
     72    NtDuplicateToken              = _NtDuplicateToken@24
     73    ZwDuplicateToken              = _NtDuplicateToken@24
     74    NtOpenProcessToken            = _NtOpenProcessToken@12
     75    ZwOpenProcessToken            = _NtOpenProcessToken@12
     76    NtOpenThreadToken             = _NtOpenThreadToken@16
     77    ZwOpenThreadToken             = _NtOpenThreadToken@16
     78    NtAdjustPrivilegesToken       = _NtAdjustPrivilegesToken@24
     79    ZwAdjustPrivilegesToken       = _NtAdjustPrivilegesToken@24
     80    NtQueryInformationToken       = _NtQueryInformationToken@20       @156
     81    ZwQueryInformationToken       = _NtQueryInformationToken@20
     82    NtCreateSection               = _NtCreateSection@28
     83    ZwCreateSection               = _NtCreateSection@28
     84    NtOpenSection                 = _NtOpenSection@12
     85    ZwOpenSection                 = _NtOpenSection@12
     86    NtQuerySection                = _NtQuerySection@20
     87    ZwQuerySection                = _NtQuerySection@20
     88    NtMapViewOfSection            = _NtMapViewOfSection@40
     89    ZwMapViewOfSection            = _NtMapViewOfSection@40
     90    NtCreatePort                  = _NtCreatePort@20
     91    ZwCreatePort                  = _NtCreatePort@20
     92    NtConnectPort                 = _NtConnectPort@32
     93    ZwConnectPort                 = _NtConnectPort@32
     94    NtListenPort                  = _NtListenPort@8
     95    ZwListenPort                  = _NtListenPort@8
     96    NtAcceptConnectPort           = _NtAcceptConnectPort@24
     97    ZwAcceptConnectPort           = _NtAcceptConnectPort@24
     98    NtCompleteConnectPort         = _NtCompleteConnectPort@4
     99    ZwCompleteConnectPort         = _NtCompleteConnectPort@4
     100    NtRegisterThreadTerminatePort = _NtRegisterThreadTerminatePort@4
     101    ZwRegisterThreadTerminatePort = _NtRegisterThreadTerminatePort@4
     102    NtRequestWaitReplyPort        = _NtRequestWaitReplyPort@12
     103    ZwRequestWaitReplyPort        = _NtRequestWaitReplyPort@12
     104    NtReplyWaitReceivePort        = _NtReplyWaitReceivePort@16
     105    ZwReplyWaitReceivePort        = _NtReplyWaitReceivePort@16
     106    NtSetIntervalProfile          = _NtSetIntervalProfile@8
     107    ZwSetIntervalProfile          = _NtSetIntervalProfile@8
     108    NtQueryPerformanceCounter     = _NtQueryPerformanceCounter@8
     109    ZwQueryPerformanceCounter     = _NtQueryPerformanceCounter@8
     110    NtCreateMailslotFile          = _NtCreateMailslotFile@32
     111    ZwCreateMailslotFile          = _NtCreateMailslotFile@32
     112    NtQuerySystemInformation      = _NtQuerySystemInformation@16      @95
     113    ZwQuerySystemInformation      = _NtQuerySystemInformation@16
     114    NtCreatePagingFile            = _NtCreatePagingFile@16
     115    ZwCreatePagingFile            = _NtCreatePagingFile@16
     116    NtDisplayString               = _NtDisplayString@4
     117    ZwDisplayString               = _NtDisplayString@4
     118
     119    NtCreateSemaphore             = _NtCreateSemaphore@20
     120    ZwCreateSemaphore             = _NtCreateSemaphore@20
     121    NtOpenSemaphore               = _NtOpenSemaphore@12
     122    ZwOpenSemaphore               = _NtOpenSemaphore@12
     123    NtQuerySemaphore              = _NtQuerySemaphore@20
     124    ZwQuerySemaphore              = _NtQuerySemaphore@20
     125    NtReleaseSemaphore            = _NtReleaseSemaphore@12
     126    ZwReleaseSemaphore            = _NtReleaseSemaphore@12
     127    NtCreateEvent                 = _NtCreateEvent@20
     128    ZwCreateEvent                 = _NtCreateEvent@20
     129    NtOpenEvent                   = _NtOpenEvent@12
     130    ZwOpenEvent                   = _NtOpenEvent@12
     131    NtSetEvent                    = _NtSetEvent@8
     132    ZwSetEvent                    = _NtSetEvent@8
     133
     134    NtQueryObject                 = _NtQueryObject@20                 @161
     135    ZwQueryObject                 = _NtQueryObject@20
     136    NtQuerySecurityObject         = _NtQuerySecurityObject@20
     137    ZwQuerySecurityObject         = _NtQuerySecurityObject@20
     138    NtDuplicateObject             = _NtDuplicateObject@28
     139    ZwDuplicateObject             = _NtDuplicateObject@28
     140    NtWaitForSingleObject         = _NtWaitForSingleObject@12
     141    ZwWaitForSingleObject         = _NtWaitForSingleObject@12
     142    NtOpenDirectoryObject         = _NtOpenDirectoryObject@12         @124
     143    ZwOpenDirectoryObject         = _NtOpenDirectoryObject@12
     144    NtCreateDirectoryObject       = _NtCreateDirectoryObject@12
     145    ZwCreateDirectoryObject       = _NtCreateDirectoryObject@12
     146    NtQueryDirectoryObject        = _NtQueryDirectoryObject@28        @149
     147    ZwQueryDirectoryObject        = _NtQueryDirectoryObject@28
     148    NtOpenSymbolicLinkObject      = _NtQuerySymbolicLinkObject@12
     149    ZwOpenSymbolicLinkObject      = _NtQuerySymbolicLinkObject@12
     150    NtCreateSymbolicLinkObject    = _NtCreateSymbolicLinkObject@16
     151    ZwCreateSymbolicLinkObject    = _NtCreateSymbolicLinkObject@16
     152    NtQuerySymbolicLinkObject     = _NtQuerySymbolicLinkObject@12
     153    ZwQuerySymbolicLinkObject     = _NtQuerySymbolicLinkObject@12
     154
     155    NtCreateKey                   = _NtCreateKey@28
     156    ZwCreateKey                   = _NtCreateKey@28
     157    NtDeleteKey                   = _NtDeleteKey@4
     158    ZwDeleteKey                   = _NtDeleteKey@4
     159    NtDeleteValueKey              = _NtDeleteValueKey@8
     160    ZwDeleteValueKey              = _NtDeleteValueKey@8
     161    NtEnumerateKey                = _NtEnumerateKey@24
     162    ZwEnumerateKey                = _NtEnumerateKey@24
     163    NtEnumerateValueKey           = _NtEnumerateValueKey@24
     164    ZwEnumerateValueKey           = _NtEnumerateValueKey@24
     165    NtFlushKey                    = _NtFlushKey@4
     166    ZwFlushKey                    = _NtFlushKey@4
     167    NtLoadKey                     = _NtLoadKey@8
     168    ZwLoadKey                     = _NtLoadKey@8
     169    NtNotifyChangeKey             = _NtNotifyChangeKey@40
     170    ZwNotifyChangeKey             = _NtNotifyChangeKey@40
     171    NtOpenKey                     = _NtOpenKey@12                     @129
     172    ZwOpenKey                     = _NtOpenKey@12
     173    NtQueryKey                    = _NtQueryKey@20
     174    ZwQueryKey                    = _NtQueryKey@20
     175    NtQueryMultipleValueKey       = _NtQueryMultipleValueKey@24
     176    ZwQueryMultipleValueKey       = _NtQueryMultipleValueKey@24
     177    NtReplaceKey                  = _NtReplaceKey@12
     178    ZwReplaceKey                  = _NtReplaceKey@12
     179    NtRestoreKey                  = _NtRestoreKey@12
     180    ZwRestoreKey                  = _NtRestoreKey@12
     181    NtSaveKey                     = _NtSaveKey@8
     182    ZwSaveKey                     = _NtSaveKey@8
     183    NtSetInformationKey           = _NtSetInformationKey@16
     184    ZwSetInformationKey           = _NtSetInformationKey@16
     185    NtSetValueKey                 = _NtSetValueKey@24
     186    ZwSetValueKey                 = _NtSetValueKey@24
     187    NtUnloadKey                   = _NtUnloadKey@4
     188    ZwUnloadKey                   = _NtUnloadKey@4
     189
     190    RtlAllocateAndInitializeSid   = _RtlAllocateAndInitializeSid@44   @265
     191    RtlEqualSid                   = _RtlEqualSid@8                    @352
     192    RtlFreeSid                    = _RtlFreeSid@4                     @376
     193    RtlLengthRequiredSid          = _RtlLengthRequiredSid@4           @427
     194    RtlLengthSid                  = _RtlLengthSid@4                   @429
     195    RtlInitializeSid              = _RtlInitializeSid@12              @410
     196    RtlSubAuthoritySid            = _RtlSubAuthoritySid@8             @497
     197    RtlSubAuthorityCountSid       = _RtlSubAuthorityCountSid@4        @496
     198    RtlCopySid                    = _RtlCopySid@12                    @302
     199    RtlCreateSecurityDescriptor   = _RtlCreateSecurityDescriptor@8    @313
     200    RtlValidSecurityDescriptor    = _RtlValidSecurityDescriptor@4
     201    RtlLengthSecurityDescriptor   = _RtlLengthSecurityDescriptor@4
     202    RtlGetDaclSecurityDescriptor  = _RtlGetDaclSecurityDescriptor@16
     203    RtlSetDaclSecurityDescriptor  = _RtlSetDaclSecurityDescriptor@16  @483
     204    RtlGetSaclSecurityDescriptor  = _RtlGetSaclSecurityDescriptor@16
     205    RtlSetSaclSecurityDescriptor  = _RtlSetSaclSecurityDescriptor@16
     206    RtlGetOwnerSecurityDescriptor = _RtlGetOwnerSecurityDescriptor@12 @488
     207    RtlSetOwnerSecurityDescriptor = _RtlSetOwnerSecurityDescriptor@12 @487
     208    RtlSetGroupSecurityDescriptor = _RtlSetGroupSecurityDescriptor@12 @485
     209    RtlGetGroupSecurityDescriptor = _RtlGetGroupSecurityDescriptor@12
     210    RtlCreateAcl                  = _RtlCreateAcl@12                  @306
     211    RtlFirstFreeAce               = _RtlFirstFreeAce@8                @370
     212    RtlAddAce                     = _RtlAddAce@20                     @260
     213    RtlAddAccessAllowedAce        = _RtlAddAccessAllowedAce@16
     214    RtlGetAce                     = _RtlGetAce@12
     215    RtlAdjustPrivilege            = _RtlAdjustPrivilege@16
     216
     217    RtlAnsiStringToUnicodeString  = _RtlAnsiStringToUnicodeString@12  @269
     218    RtlOemStringToUnicodeString   = _RtlOemStringToUnicodeString@12   @447
     219    RtlMultiByteToUnicodeN        = _RtlMultiByteToUnicodeN@20        @446
     220    RtlOemToUnicodeN              = _RtlOemToUnicodeN@20              @448
     221    RtlInitAnsiString             = _RtlInitAnsiString@8              @399
     222    RtlInitString                 = _RtlInitString@8                  @402
     223    RtlInitUnicodeString          = _RtlInitUnicodeString@8           @403
     224    RtlFreeUnicodeString          = _RtlFreeUnicodeString@4           @377
     225    RtlFreeAnsiString             = _RtlFreeAnsiString@4              @373
     226    RtlUnicodeToOemN              = _RtlUnicodeToOemN@20              @515
     227    RtlUnicodeStringToOemString   = _RtlUnicodeStringToOemString@12   @511
     228    RtlUnicodeStringToAnsiString  = _RtlUnicodeStringToAnsiString@12  @507
     229    RtlEqualUnicodeString         = _RtlEqualUnicodeString@12
     230    RtlUpcaseUnicodeString        = _RtlUpcaseUnicodeString@12        @520
     231    RtlxOemStringToUnicodeSize    = _RtlxOemStringToUnicodeSize@4     @549
     232    RtlxAnsiStringToUnicodeSize   = _RtlxAnsiStringToUnicodeSize@4    @548
     233    RtlIsTextUnicode              = _RtlIsTextUnicode@12              @417
     234    RtlCompareUnicodeString       = _RtlCompareUnicodeString@12
     235
     236    RtlInitializeResource         = _RtlInitializeResource@4          @409
     237    RtlDeleteResource             = _RtlDeleteResource@4              @330
     238    RtlAcquireResourceExclusive   = _RtlAcquireResourceExclusive@8    @256
     239    RtlAcquireResourceShared      = _RtlAcquireResourceShared@8       @257
     240    RtlReleaseResource            = _RtlReleaseResource@4             @471
     241    RtlDumpResource               = _RtlDumpResource@4                @340
     242    RtlCreateHeap                 = _RtlCreateHeap@24
     243    RtlAllocateHeap               = _RtlAllocateHeap@12
     244    RtlFreeHeap                   = _RtlFreeHeap@12
     245    RtlDestroyHeap                = _RtlDestroyHeap@4
     246;   DbgPrint                      = _DbgPrint@8
     247
     248;   NtRaiseException              = _NtRaiseException@16
     249;   ZwRaiseException              = _NtRaiseException@16
     250;   RtlRaiseException             = _RtlRaiseException@4
     251    RtlAcquirePebLock             = _RtlAcquirePebLock@0
     252    RtlReleasePebLock             = _RtlReleasePebLock@0
     253    RtlIntegerToChar              = _RtlIntegerToChar@16
     254    RtlSetEnvironmentVariable     = _RtlSetEnvironmentVariable@12
     255    RtlNewSecurityObject          = _RtlNewSecurityObject@24
     256    RtlDeleteSecurityObject       = _RtlDeleteSecurityObject@4
     257    RtlNormalizeProcessParams     = _RtlNormalizeProcessParams@4      @441
     258    RtlNtStatusToDosError         = _RtlNtStatusToDosError@4          @442
     259    RtlGetNtProductType           = _RtlGetNtProductType@4            @390
     260    RtlExtendedLargeIntegerDivide = _RtlExtendedLargeIntegerDivide@16 @359
     261;   RtlExtendedLargeIntegerMultiply
     262    RtlFormatCurrentUserKeyPath   = _RtlFormatCurrentUserKeyPath@4    @371
     263    RtlOpenCurrentUser            = _RtlOpenCurrentUser@8
     264    RtlDosPathNameToNtPathName_U  = _RtlDosPathNameToNtPathName_U@16  @338
     265    RtlCreateEnvironment          = _RtlCreateEnvironment@8
     266    RtlDestroyEnvironment         = _RtlDestroyEnvironment@4
     267    RtlQueryEnvironmentVariable_U = _RtlQueryEnvironmentVariable_U@12
     268
     269    RtlSystemTimeToLocalTime      = _RtlSystemTimeToLocalTime@8
     270    RtlTimeToSecondsSince1980     = _RtlTimeToSecondsSince1980@8
     271    RtlTimeToSecondsSince1970     = _RtlTimeToSecondsSince1970@8
     272    RtlTimeToElapsedTimeFields    = _RtlTimeToElapsedTimeFields@8
     273
  • TabularUnified trunk/src/NTDLL/ntdll.h

    r4 r30  
    1 /* $Id: ntdll.h,v 1.1 1999-05-24 20:19:32 ktk Exp $ */
    2 
    3 /*
    4  *
    5  * Project Odin Software License can be found in LICENSE.TXT
    6  *
    7  */
    8 /*
    9  * Win32 NT Runtime for OS/2
    10  *
    11  * 1998/05/20 Patrick Haller (haller@zebra.fh-weingarten.de)
    12  *
    13  * @(#) ntdll.cpp       1.0.0   1998/05/20 PH Start from WINE/NTDLL.C
    14  *
    15  * NT basis DLL
    16  *
    17  * Copyright 1996 Marcus Meissner
    18  * Copyright 1988 Patrick Haller (adapted for win32os2)
    19  */
    20 
    21  /* Changes to the original NTDLL.C from the WINE project
    22  
    23   - includes replaced by the win32os2 standard includes
    24   - replaced WINAPI by WIN32API
    25   - moved in some string functions
    26   - replaced HANDLE32 by HANDLE
    27   - lstrlen32A -> OS2lstrlenA
    28   - lstrlen32W -> OS2lstrlenW
     1/*
     2   this file defines interfaces mainly exposed to device drivers and
     3   native nt dll's
     4
    295*/
    30 
    31 #ifndef _WINNT_
    32 #define _WINNT_
     6#ifndef __WINE_NTDDK_H
     7#define __WINE_NTDDK_H
     8
     9#include <os2win.h>
     10#include <misc.h>
     11
     12#include <ntdef.h>
     13#include <winnt.h>
     14#include "winbase.h"                     /* fixme: should be taken out sometimes */
    3315
    3416#ifdef __cplusplus
    3517extern "C" {
    3618#endif
    37  
    38  
    39 #include "win32type.h"
    40  
    41 typedef unsigned short int UINT16;
    42 typedef unsigned long  int UINT32;
    43 typedef          short int INT16;
    44 typedef          long  int INT32;
    45  
    46  
    47 /* Security Ids of NT */
    48 typedef struct {
    49         BYTE    Value[6];
    50 } SID_IDENTIFIER_AUTHORITY,*PSID_IDENTIFIER_AUTHORITY,*LPSID_IDENTIFIER_AUTHORITY;
    51 
    52 typedef struct _SID {
    53         BYTE    Revision;
    54         BYTE    SubAuthorityCount;
    55         SID_IDENTIFIER_AUTHORITY        IdentifierAuthority;
    56         DWORD   SubAuthority[1];
    57 } SID,*PSID,*LPSID;
    58 
    59 #define SID_REVISION                    (1)     /* Current revision */
    60 #define SID_MAX_SUB_AUTHORITIES         (15)    /* current max subauths */
    61 #define SID_RECOMMENDED_SUB_AUTHORITIES (1)     /* recommended subauths */
    62 
    63 /* ACLs of NT */
    64 
    65 #define ACL_REVISION    2
    66 
    67 #define ACL_REVISION1   1
    68 #define ACL_REVISION2   2
    69 
    70 typedef struct _ACL {
    71         BYTE    AclRevision;
    72         BYTE    Sbz1;
    73         WORD    AclSize;
    74         WORD    AceCount;
    75         WORD    Sbz2;
    76 } ACL,*LPACL;
    77 
    78 /* ACEs, directly starting after an ACL */
    79 typedef struct _ACE_HEADER {
    80         BYTE    AceType;
    81         BYTE    AceFlags;
    82         WORD    AceSize;
    83 } ACE_HEADER,*LPACE_HEADER;
    84 
    85 /* AceType */
    86 #define ACCESS_ALLOWED_ACE_TYPE         0
    87 #define ACCESS_DENIED_ACE_TYPE          1
    88 #define SYSTEM_AUDIT_ACE_TYPE           2
    89 #define SYSTEM_ALARM_ACE_TYPE           3
    90 
    91 /* inherit AceFlags */
    92 #define OBJECT_INHERIT_ACE              0x01
    93 #define CONTAINER_INHERIT_ACE           0x02
    94 #define NO_PROPAGATE_INHERIT_ACE        0x04
    95 #define INHERIT_ONLY_ACE                0x08
    96 #define VALID_INHERIT_FLAGS             0x0F
    97 
    98 /* AceFlags mask for what events we (should) audit */
    99 #define SUCCESSFUL_ACCESS_ACE_FLAG      0x40
    100 #define FAILED_ACCESS_ACE_FLAG          0x80
    101 
    102 /* different ACEs depending on AceType
    103  * SidStart marks the begin of a SID
    104  * so the thing finally looks like this:
    105  * 0: ACE_HEADER
    106  * 4: ACCESS_MASK
    107  * 8... : SID
    108  */
    109 typedef struct _ACCESS_ALLOWED_ACE {
    110         ACE_HEADER      Header;
    111         DWORD           Mask;
    112         DWORD           SidStart;
    113 } ACCESS_ALLOWED_ACE,*LPACCESS_ALLOWED_ACE;
    114 
    115 typedef struct _ACCESS_DENIED_ACE {
    116         ACE_HEADER      Header;
    117         DWORD           Mask;
    118         DWORD           SidStart;
    119 } ACCESS_DENIED_ACE,*LPACCESS_DENIED_ACE;
    120 
    121 typedef struct _SYSTEM_AUDIT_ACE {
    122         ACE_HEADER      Header;
    123         DWORD           Mask;
    124         DWORD           SidStart;
    125 } SYSTEM_AUDIT_ACE,*LPSYSTEM_AUDIT_ACE;
    126 
    127 typedef struct _SYSTEM_ALARM_ACE {
    128         ACE_HEADER      Header;
    129         DWORD           Mask;
    130         DWORD           SidStart;
    131 } SYSTEM_ALARM_ACE,*LPSYSTEM_ALARM_ACE;
    132 
    133 #define SECURITY_DESCRIPTOR_REVISION    1
    134 #define SECURITY_DESCRIPTOR_REVISION1   1
    135 
    136 typedef WORD SECURITY_DESCRIPTOR_CONTROL;
    137 
    138 #define SE_OWNER_DEFAULTED      0x0001
    139 #define SE_GROUP_DEFAULTED      0x0002
    140 #define SE_DACL_PRESENT         0x0004
    141 #define SE_DACL_DEFAULTED       0x0008
    142 #define SE_SACL_PRESENT         0x0010
    143 #define SE_SACL_DEFAULTED       0x0020
    144 #define SE_SELF_RELATIVE        0x8000
    145 
    146 typedef struct {
    147         BYTE    Revision;
    148         BYTE    Sbz1;
    149         SECURITY_DESCRIPTOR_CONTROL Control;
    150         LPSID   Owner;
    151         LPSID   Group;
    152         LPACL   Sacl;
    153         LPACL   Dacl;
    154 } SECURITY_DESCRIPTOR,*PSECURITY_DESCRIPTOR,*LPSECURITY_DESCRIPTOR;
    155 
    156 
    157 typedef enum tagSID_NAME_USE {
    158         SidTypeUser = 1,
    159         SidTypeGroup,
    160         SidTypeDomain,
    161         SidTypeAlias,
    162         SidTypeWellKnownGroup,
    163         SidTypeDeletedAccount,
    164         SidTypeInvalid,
    165         SidTypeUnknown
    166 } SID_NAME_USE,*PSID_NAME_USE,*LPSID_NAME_USE;
    167 
    168 /* NT lowlevel Strings (handled by Rtl* functions in NTDLL)
    169  * If they are zero terminated, Length does not include the terminating 0.
    170  */
    171 
    172 typedef struct _STRING {
    173         UINT16  Length;
    174         UINT16  MaximumLength;
    175         LPSTR   Buffer;
    176 } STRING,*LPSTRING,ANSI_STRING,*LPANSI_STRING;
    177 
    178 typedef struct _CSTRING {
    179         UINT16  Length;
    180         UINT16  MaximumLength;
    181         LPCSTR  Buffer;
    182 } CSTRING,*LPCSTRING;
    183 
    184 typedef struct _UNICODE_STRING {
    185         UINT16  Length;         /* bytes */
    186         UINT16  MaximumLength;  /* bytes */
    187         LPWSTR  Buffer;
    188 } UNICODE_STRING,*LPUNICODE_STRING;
    189 
    190 
    191 BOOL32 WIN32API IsValidSid(LPSID);
    192 BOOL32 WIN32API EqualSid(LPSID,LPSID);
    193 BOOL32 WIN32API EqualPrefixSid(LPSID,LPSID);
    194 DWORD  WIN32API GetSidLengthRequired(BYTE);
    195 BOOL32 WIN32API AllocateAndInitializeSid(LPSID_IDENTIFIER_AUTHORITY,BYTE,DWORD,
     19
     20/******************
     21 * asynchronous I/O
     22 */
     23#undef Status  /* conflict with X11-includes*/
     24
     25
     26/****************************************************************************
     27 * adjust WINE header to ODIN                                               *
     28 ****************************************************************************/
     29
     30#ifdef NTAPI
     31#  undef NTAPI
     32#endif
     33#define NTAPI WIN32API
     34
     35#ifdef WINAPI
     36#  undef WINAPI
     37#endif
     38#define WINAPI WIN32API
     39
     40#ifndef BOOLEAN
     41#  define BOOLEAN BOOL
     42#endif
     43
     44/* prototypes */
     45LPWSTR HEAP_strdupW(HANDLE    heap, DWORD   flags, LPCWSTR str);
     46LPSTR  HEAP_strdupWtoA(HANDLE heap, DWORD   flags, LPCWSTR str);
     47
     48
     49
     50typedef struct _IO_STATUS_BLOCK
     51{  union
     52   { NTSTATUS Status;
     53     PVOID Pointer;
     54   } u;
     55   ULONG_PTR Information;
     56} IO_STATUS_BLOCK, *PIO_STATUS_BLOCK;
     57
     58// @@@PH - this seems to be wrong in WINE
     59// typedef VOID (NTAPI* PIO_APC_ROUTINE) ( PVOID ApcContext, PIO_STATUS_BLOCK IoStatusBlock, ULONG Reserved );
     60typedef PVOID PIO_APC_ROUTINE;
     61
     62typedef enum _KEY_INFORMATION_CLASS {
     63   KeyBasicInformation,
     64   KeyNodeInformation,
     65   KeyFullInformation
     66} KEY_INFORMATION_CLASS;
     67
     68typedef enum _KEY_VALUE_INFORMATION_CLASS {
     69   KeyValueBasicInformation,
     70   KeyValueFullInformation,
     71   KeyValuePartialInformation,
     72   KeyValueFullInformationAlign64,
     73   KeyValuePartialInformationAlign64
     74} KEY_VALUE_INFORMATION_CLASS;
     75
     76typedef enum _THREADINFOCLASS
     77{  ThreadBasicInformation,
     78   ThreadTimes,
     79   ThreadPriority,
     80   ThreadBasePriority,
     81   ThreadAffinityMask,
     82   ThreadImpersonationToken,
     83   ThreadDescriptorTableEntry,
     84   ThreadEnableAlignmentFaultFixup,
     85   ThreadEventPair_Reusable,
     86   ThreadQuerySetWin32StartAddress,
     87   ThreadZeroTlsCell,
     88   ThreadPerformanceCount,
     89   ThreadAmILastThread,
     90   ThreadIdealProcessor,
     91   ThreadPriorityBoost,
     92   ThreadSetTlsArrayAddress,
     93   ThreadIsIoPending,
     94   MaxThreadInfoClass
     95} THREADINFOCLASS;
     96
     97typedef enum _FILE_INFORMATION_CLASS {
     98   FileDirectoryInformation = 1,
     99   FileFullDirectoryInformation,
     100   FileBothDirectoryInformation,
     101   FileBasicInformation,
     102   FileStandardInformation,
     103   FileInternalInformation,
     104   FileEaInformation,
     105   FileAccessInformation,
     106   FileNameInformation,
     107   FileRenameInformation,
     108   FileLinkInformation,
     109   FileNamesInformation,
     110   FileDispositionInformation,
     111   FilePositionInformation,
     112   FileFullEaInformation,
     113   FileModeInformation,
     114   FileAlignmentInformation,
     115   FileAllInformation,
     116   FileAllocationInformation,
     117   FileEndOfFileInformation,
     118   FileAlternateNameInformation,
     119   FileStreamInformation,
     120   FilePipeInformation,
     121   FilePipeLocalInformation,
     122   FilePipeRemoteInformation,
     123   FileMailslotQueryInformation,
     124   FileMailslotSetInformation,
     125   FileCompressionInformation,
     126   FileObjectIdInformation,
     127   FileCompletionInformation,
     128   FileMoveClusterInformation,
     129   FileQuotaInformation,
     130   FileReparsePointInformation,
     131   FileNetworkOpenInformation,
     132   FileAttributeTagInformation,
     133   FileTrackingInformation,
     134   FileMaximumInformation
     135} FILE_INFORMATION_CLASS, *PFILE_INFORMATION_CLASS;
     136
     137typedef enum _SECTION_INHERIT
     138{
     139   ViewShare = 1,
     140   ViewUnmap = 2
     141
     142} SECTION_INHERIT;
     143
     144/*
     145   placeholder
     146*/
     147typedef enum _OBJECT_INFORMATION_CLASS
     148{
     149   DunnoTheConstants1
     150
     151} OBJECT_INFORMATION_CLASS, *POBJECT_INFORMATION_CLASS;
     152
     153
     154/*
     155 * NtQuerySystemInformation
     156 */
     157
     158typedef enum SYSTEM_INFORMATION_CLASS
     159{  Unknown1 = 1,
     160   Unknown2,
     161   Unknown3,
     162   Unknown4,
     163   SystemPerformanceInformation
     164} SYSTEM_INFORMATION_CLASS, *PSYSTEM_INFORMATION_CLASS;
     165
     166/* reading coffee grounds... */
     167typedef struct _THREAD_INFO
     168{  DWORD Unknown1[6];
     169   DWORD ThreadID;
     170   DWORD Unknown2[3];
     171   DWORD Status;
     172   DWORD WaitReason;
     173   DWORD Unknown3[4];
     174} THREAD_INFO, PTHREAD_INFO;
     175
     176typedef struct _VM_COUNTERS_
     177{  ULONG PeakVirtualSize;
     178   ULONG VirtualSize;
     179   ULONG PageFaultCount;
     180   ULONG PeakWorkingSetSize;
     181   ULONG WorkingSetSize;
     182   ULONG QuotaPeakPagedPoolUsage;
     183   ULONG QuotaPagedPoolUsage;
     184   ULONG QuotaPeakNonPagedPoolUsage;
     185   ULONG QuotaNonPagedPoolUsage;
     186   ULONG PagefileUsage;
     187   ULONG PeakPagefileUsage;
     188} VM_COUNTERS, *PVM_COUNTERS;
     189
     190typedef struct _PROCESS_INFO
     191{  DWORD    Offset;                         /* 00 offset to next PROCESS_INFO ok*/
     192   DWORD    ThreadCount;                 /* 04 number of ThreadInfo member ok */
     193   DWORD    Unknown1[6];
     194   FILETIME CreationTime;                /* 20 */
     195   DWORD    Unknown2[5];
     196   PWCHAR      ProcessName;              /* 3c ok */
     197   DWORD    BasePriority;
     198   DWORD    ProcessID;                   /* 44 ok*/
     199   DWORD    ParentProcessID;
     200   DWORD    HandleCount;
     201   DWORD    Unknown3[2];                 /* 50 */
     202   ULONG    PeakVirtualSize;
     203   ULONG    VirtualSize;
     204   ULONG    PageFaultCount;
     205   ULONG    PeakWorkingSetSize;
     206   ULONG    WorkingSetSize;
     207   ULONG    QuotaPeakPagedPoolUsage;
     208   ULONG    QuotaPagedPoolUsage;
     209   ULONG    QuotaPeakNonPagedPoolUsage;
     210   ULONG    QuotaNonPagedPoolUsage;
     211   ULONG    PagefileUsage;
     212   ULONG    PeakPagefileUsage;
     213   DWORD    PrivateBytes;
     214   DWORD    Unknown6[4];
     215   THREAD_INFO    ati[ANYSIZE_ARRAY];    /* 94 size=0x40*/
     216} PROCESS_INFO, PPROCESS_INFO;
     217
     218NTSTATUS WINAPI NtQuerySystemInformation(
     219   IN SYSTEM_INFORMATION_CLASS SystemInformationClass,
     220   OUT PVOID SystemInformation,
     221   IN ULONG Length,
     222   OUT PULONG ResultLength);
     223
     224/*
     225 * system configuration
     226 */
     227
     228
     229typedef struct _SYSTEM_TIME_ADJUSTMENT
     230{
     231   ULONG TimeAdjustment;
     232   BOOLEAN  TimeAdjustmentDisabled;
     233
     234} SYSTEM_TIME_ADJUSTMENT, *PSYSTEM_TIME_ADJUSTMENT;
     235
     236typedef struct _SYSTEM_CONFIGURATION_INFO
     237{
     238   union
     239   { ULONG  OemId;
     240     struct
     241     { WORD ProcessorArchitecture;
     242       WORD Reserved;
     243     } tag1;
     244   } tag2;
     245   ULONG PageSize;
     246   PVOID MinimumApplicationAddress;
     247   PVOID MaximumApplicationAddress;
     248   ULONG ActiveProcessorMask;
     249   ULONG NumberOfProcessors;
     250   ULONG ProcessorType;
     251   ULONG AllocationGranularity;
     252   WORD  ProcessorLevel;
     253   WORD  ProcessorRevision;
     254
     255} SYSTEM_CONFIGURATION_INFO, *PSYSTEM_CONFIGURATION_INFO;
     256
     257
     258typedef struct _SYSTEM_CACHE_INFORMATION
     259{
     260   ULONG CurrentSize;
     261   ULONG PeakSize;
     262   ULONG PageFaultCount;
     263   ULONG MinimumWorkingSet;
     264   ULONG MaximumWorkingSet;
     265   ULONG Unused[4];
     266
     267} SYSTEM_CACHE_INFORMATION;
     268
     269/*
     270 * NtQueryProcessInformation
     271 */
     272
     273/* parameter ProcessInformationClass */
     274
     275typedef enum _PROCESSINFOCLASS
     276{  ProcessBasicInformation,
     277   ProcessQuotaLimits,
     278   ProcessIoCounters,
     279   ProcessVmCounters,
     280   ProcessTimes,
     281   ProcessBasePriority,
     282   ProcessRaisePriority,
     283   ProcessDebugPort,
     284   ProcessExceptionPort,
     285   ProcessAccessToken,
     286   ProcessLdtInformation,
     287   ProcessLdtSize,
     288   ProcessDefaultHardErrorMode,
     289   ProcessIoPortHandlers,
     290   ProcessPooledUsageAndLimits,
     291   ProcessWorkingSetWatch,
     292   ProcessUserModeIOPL,
     293   ProcessEnableAlignmentFaultFixup,
     294   ProcessPriorityClass,
     295   ProcessWx86Information,
     296   ProcessHandleCount,
     297   ProcessAffinityMask,
     298   ProcessPriorityBoost,
     299   ProcessDeviceMap,
     300   ProcessSessionInformation,
     301   ProcessForegroundInformation,
     302   ProcessWow64Information,
     303   MaxProcessInfoClass
     304} PROCESSINFOCLASS;
     305
     306/* parameter ProcessInformation (depending on ProcessInformationClass) */
     307
     308typedef struct _PROCESS_BASIC_INFORMATION
     309{  DWORD ExitStatus;
     310   DWORD PebBaseAddress;
     311   DWORD AffinityMask;
     312   DWORD BasePriority;
     313   ULONG UniqueProcessId;
     314   ULONG InheritedFromUniqueProcessId;
     315} PROCESS_BASIC_INFORMATION;
     316
     317NTSTATUS WINAPI NtQueryInformationProcess(
     318   IN HANDLE ProcessHandle,
     319   IN PROCESSINFOCLASS ProcessInformationClass,
     320   OUT PVOID ProcessInformation,
     321   IN ULONG ProcessInformationLength,
     322   OUT PULONG ReturnLength);
     323
     324#define NtCurrentProcess() ( (HANDLE) -1 )
     325
     326/*
     327 * timer
     328 */
     329
     330typedef enum _TIMER_TYPE
     331{
     332   NotificationTimer,
     333   SynchronizationTimer
     334
     335} TIMER_TYPE;
     336
     337/*
     338 * token functions
     339 */
     340
     341NTSTATUS WINAPI NtOpenProcessToken(
     342   HANDLE ProcessHandle,
     343   DWORD DesiredAccess,
     344   HANDLE *TokenHandle);
     345
     346NTSTATUS WINAPI NtOpenThreadToken(
     347   HANDLE ThreadHandle,
     348   DWORD DesiredAccess,
     349   BOOLEAN OpenAsSelf,
     350   HANDLE *TokenHandle);
     351
     352NTSTATUS WINAPI NtAdjustPrivilegesToken(
     353   IN HANDLE TokenHandle,
     354   IN BOOLEAN DisableAllPrivileges,
     355   IN PTOKEN_PRIVILEGES NewState,
     356   IN DWORD BufferLength,
     357   OUT PTOKEN_PRIVILEGES PreviousState,
     358   OUT PDWORD ReturnLength);
     359
     360NTSTATUS WINAPI NtQueryInformationToken(
     361   HANDLE token,
     362   DWORD tokeninfoclass,
     363   LPVOID tokeninfo,
     364   DWORD tokeninfolength,
     365   LPDWORD retlen );
     366
     367/*
     368 * sid functions
     369 */
     370
     371BOOLEAN WINAPI RtlAllocateAndInitializeSid (
     372   PSID_IDENTIFIER_AUTHORITY pIdentifierAuthority,
     373   DWORD nSubAuthorityCount,
     374   DWORD x3,
     375   DWORD x4,
     376   DWORD x5,
     377   DWORD x6,
     378   DWORD x7,
     379   DWORD x8,
     380   DWORD x9,
     381   DWORD x10,
     382   PSID pSid);
     383
     384DWORD WINAPI RtlEqualSid(DWORD x1,DWORD x2);
     385DWORD WINAPI RtlFreeSid(DWORD x1);
     386DWORD WINAPI RtlLengthRequiredSid(DWORD nrofsubauths);
     387DWORD WINAPI RtlLengthSid(PSID sid);
     388DWORD WINAPI RtlInitializeSid(PSID PSID,PSID_IDENTIFIER_AUTHORITY PSIDauth, DWORD c);
     389LPDWORD WINAPI RtlSubAuthoritySid(PSID PSID,DWORD nr);
     390LPBYTE WINAPI RtlSubAuthorityCountSid(PSID PSID);
     391DWORD WINAPI RtlCopySid(DWORD len,PSID to,PSID from);
     392
     393/*
     394 * security descriptor functions
     395 */
     396
     397NTSTATUS WINAPI RtlCreateSecurityDescriptor(
     398   PSECURITY_DESCRIPTOR lpsd,
     399   DWORD rev);
     400
     401NTSTATUS WINAPI RtlValidSecurityDescriptor(
     402   PSECURITY_DESCRIPTOR SecurityDescriptor);
     403
     404ULONG WINAPI RtlLengthSecurityDescriptor(
     405   PSECURITY_DESCRIPTOR SecurityDescriptor);
     406
     407NTSTATUS WINAPI RtlGetDaclSecurityDescriptor(
     408   IN PSECURITY_DESCRIPTOR pSecurityDescriptor,
     409   OUT PBOOLEAN lpbDaclPresent,
     410   OUT PACL *pDacl,
     411   OUT PBOOLEAN lpbDaclDefaulted);
     412
     413NTSTATUS WINAPI RtlSetDaclSecurityDescriptor (
     414   PSECURITY_DESCRIPTOR lpsd,
     415   BOOLEAN daclpresent,
     416   PACL dacl,
     417   BOOLEAN dacldefaulted );
     418
     419NTSTATUS WINAPI RtlGetSaclSecurityDescriptor(
     420   IN PSECURITY_DESCRIPTOR pSecurityDescriptor,
     421   OUT PBOOLEAN lpbSaclPresent,
     422   OUT PACL *pSacl,
     423   OUT PBOOLEAN lpbSaclDefaulted);
     424
     425NTSTATUS WINAPI RtlSetSaclSecurityDescriptor (
     426   PSECURITY_DESCRIPTOR lpsd,
     427   BOOLEAN saclpresent,
     428   PACL sacl,
     429   BOOLEAN sacldefaulted);
     430
     431NTSTATUS WINAPI RtlGetOwnerSecurityDescriptor(
     432   PSECURITY_DESCRIPTOR SecurityDescriptor,
     433   PSID *Owner,
     434   PBOOLEAN OwnerDefaulted);
     435
     436NTSTATUS WINAPI RtlSetOwnerSecurityDescriptor(
     437   PSECURITY_DESCRIPTOR lpsd,
     438   PSID owner,
     439   BOOLEAN ownerdefaulted);
     440
     441NTSTATUS WINAPI RtlSetGroupSecurityDescriptor (
     442   PSECURITY_DESCRIPTOR lpsd,
     443   PSID group,
     444   BOOLEAN groupdefaulted);
     445
     446NTSTATUS WINAPI RtlGetGroupSecurityDescriptor(
     447   PSECURITY_DESCRIPTOR SecurityDescriptor,
     448   PSID *Group,
     449   PBOOLEAN GroupDefaulted);
     450
     451/* ##############################
     452   ######   ACL FUNCTIONS                ######
     453   ##############################
     454*/
     455
     456DWORD WINAPI RtlCreateAcl(PACL acl,DWORD size,DWORD rev);
     457
     458BOOLEAN WINAPI RtlFirstFreeAce(
     459   PACL acl,
     460   PACE_HEADER *x);
     461
     462NTSTATUS WINAPI RtlAddAce(
     463   PACL acl,
     464   DWORD rev,
     465   DWORD xnrofaces,
     466   PACE_HEADER acestart,
     467   DWORD acelen);
     468
     469DWORD WINAPI RtlAddAccessAllowedAce(DWORD x1,DWORD x2,DWORD x3,DWORD x4);
     470DWORD WINAPI RtlGetAce(PACL pAcl,DWORD dwAceIndex,LPVOID *pAce );
     471
     472/*
     473 * string functions
     474 */
     475
     476DWORD WINAPI RtlAnsiStringToUnicodeString(PUNICODE_STRING uni,PANSI_STRING ansi,BOOLEAN doalloc);
     477DWORD WINAPI RtlOemStringToUnicodeString(PUNICODE_STRING uni,PSTRING ansi,BOOLEAN doalloc);
     478DWORD WINAPI RtlMultiByteToUnicodeN(LPWSTR unistr,DWORD unilen,LPDWORD reslen,LPSTR oemstr,DWORD oemlen);
     479DWORD WINAPI RtlOemToUnicodeN(LPWSTR unistr,DWORD unilen,LPDWORD reslen,LPSTR oemstr,DWORD oemlen);
     480VOID WINAPI RtlInitAnsiString(PANSI_STRING target,LPCSTR source);
     481VOID WINAPI RtlInitString(PSTRING target,LPCSTR source);
     482VOID WINAPI RtlInitUnicodeString(PUNICODE_STRING target,LPCWSTR source);
     483VOID WINAPI RtlFreeUnicodeString(PUNICODE_STRING str);
     484VOID WINAPI RtlFreeAnsiString(PANSI_STRING AnsiString);
     485DWORD WINAPI RtlUnicodeToOemN(LPSTR oemstr,DWORD oemlen,LPDWORD reslen,LPWSTR unistr,DWORD unilen);
     486DWORD WINAPI RtlUnicodeStringToOemString(PANSI_STRING oem,PUNICODE_STRING uni,BOOLEAN alloc);
     487DWORD WINAPI RtlUnicodeStringToAnsiString(PANSI_STRING oem,PUNICODE_STRING uni,BOOLEAN alloc);
     488DWORD WINAPI RtlEqualUnicodeString(PUNICODE_STRING s1,PUNICODE_STRING s2,DWORD x);
     489DWORD WINAPI RtlUpcaseUnicodeString(PUNICODE_STRING dest,PUNICODE_STRING src,BOOLEAN doalloc);
     490UINT WINAPI RtlxOemStringToUnicodeSize(PSTRING str);
     491UINT WINAPI RtlxAnsiStringToUnicodeSize(PANSI_STRING str);
     492DWORD WINAPI RtlIsTextUnicode(LPVOID buf, DWORD len, DWORD *pf);
     493DWORD WINAPI RtlCompareUnicodeString(PUNICODE_STRING String1, PUNICODE_STRING String2, BOOLEAN CaseInSensitive);
     494
     495/*
     496 * resource functions
     497 */
     498
     499typedef struct _RTL_RWLOCK {
     500   CRITICAL_SECTION                      rtlCS;
     501   HANDLE      hSharedReleaseSemaphore;
     502   UINT        uSharedWaiters;
     503   HANDLE      hExclusiveReleaseSemaphore;
     504   UINT        uExclusiveWaiters;
     505   INT         iNumberActive;
     506   HANDLE      hOwningThreadId;
     507   DWORD       dwTimeoutBoost;
     508   PVOID       pDebugInfo;
     509} RTL_RWLOCK, *LPRTL_RWLOCK;
     510
     511VOID   WINAPI RtlInitializeResource(
     512   LPRTL_RWLOCK);
     513
     514VOID   WINAPI RtlDeleteResource(
     515   LPRTL_RWLOCK);
     516
     517BYTE   WINAPI RtlAcquireResourceExclusive(
     518   LPRTL_RWLOCK, BYTE fWait);
     519
     520BYTE   WINAPI RtlAcquireResourceShared(
     521   LPRTL_RWLOCK, BYTE fWait);
     522
     523VOID   WINAPI RtlReleaseResource(
     524   LPRTL_RWLOCK);
     525
     526VOID   WINAPI RtlDumpResource(
     527   LPRTL_RWLOCK);
     528
     529/*
     530   time functions
     531 */
     532
     533typedef struct _TIME_FIELDS
     534{   CSHORT Year;
     535    CSHORT Month;
     536    CSHORT Day;
     537    CSHORT Hour;
     538    CSHORT Minute;
     539    CSHORT Second;
     540    CSHORT Milliseconds;
     541    CSHORT Weekday;
     542} TIME_FIELDS;
     543
     544typedef TIME_FIELDS *PTIME_FIELDS;
     545
     546VOID WINAPI RtlSystemTimeToLocalTime(
     547   IN  PLARGE_INTEGER SystemTime,
     548   OUT PLARGE_INTEGER LocalTime);
     549
     550VOID WINAPI RtlTimeToTimeFields(
     551   PLARGE_INTEGER liTime,
     552   PTIME_FIELDS TimeFields);
     553
     554BOOLEAN WINAPI RtlTimeFieldsToTime(
     555   PTIME_FIELDS tfTimeFields,
     556   PLARGE_INTEGER Time);
     557
     558VOID WINAPI RtlTimeToElapsedTimeFields(
     559   PLARGE_INTEGER liTime,
     560   PTIME_FIELDS TimeFields);
     561
     562BOOLEAN WINAPI RtlTimeToSecondsSince1980(
     563   LPFILETIME ft,
     564   LPDWORD timeret);
     565
     566BOOLEAN WINAPI RtlTimeToSecondsSince1970(
     567   LPFILETIME ft,
     568   LPDWORD timeret);
     569
     570/*
     571   heap functions
     572*/
     573
     574/* Data structure for heap definition. This includes various
     575   sizing parameters and callback routines, which, if left NULL,
     576   result in default behavior */
     577
     578typedef struct
     579{  ULONG Length;                         /* = sizeof(RTL_HEAP_DEFINITION) */
     580   ULONG Unknown[11];
     581} RTL_HEAP_DEFINITION, *PRTL_HEAP_DEFINITION;
     582
     583HANDLE WINAPI RtlCreateHeap(
     584   ULONG Flags,
     585   PVOID BaseAddress,
     586   ULONG SizeToReserve,
     587   ULONG SizeToCommit,
     588   PVOID Unknown,
     589   PRTL_HEAP_DEFINITION Definition);
     590
     591PVOID WINAPI RtlAllocateHeap(
     592   HANDLE Heap,
     593   ULONG Flags,
     594   ULONG Size);
     595
     596
     597BOOLEAN WINAPI RtlFreeHeap(
     598   HANDLE Heap,
     599   ULONG Flags,
     600   PVOID Address);
     601
     602/*
     603 * misc
     604 */
     605void __cdecl DbgPrint(LPCSTR fmt,LPVOID args);
     606DWORD NtRaiseException ( DWORD dwExceptionCode, DWORD dwExceptionFlags, DWORD nNumberOfArguments,CONST ULONG_PTR *lpArguments);
     607DWORD RtlRaiseException ( DWORD x);
     608VOID WINAPI RtlAcquirePebLock(void);
     609VOID WINAPI RtlReleasePebLock(void);
     610DWORD WINAPI RtlAdjustPrivilege(DWORD x1,DWORD x2,DWORD x3,DWORD x4);
     611DWORD WINAPI RtlIntegerToChar(DWORD x1,DWORD x2,DWORD x3,DWORD x4);
     612DWORD WINAPI RtlSetEnvironmentVariable(DWORD x1,PUNICODE_STRING key,PUNICODE_STRING val);
     613DWORD WINAPI RtlNewSecurityObject(DWORD x1,DWORD x2,DWORD x3,DWORD x4,DWORD x5,DWORD x6);
     614DWORD WINAPI RtlDeleteSecurityObject(DWORD x1);
     615LPVOID WINAPI RtlNormalizeProcessParams(LPVOID x);
     616DWORD WINAPI RtlNtStatusToDosError(DWORD error);
     617BOOLEAN WINAPI RtlGetNtProductType(LPDWORD type);
     618INT WINAPI RtlExtendedLargeIntegerDivide(LARGE_INTEGER dividend, DWORD divisor, LPDWORD rest);
     619LARGE_INTEGER WINAPI RtlExtendedIntegerMultiply(LARGE_INTEGER factor1,INT factor2);
     620DWORD WINAPI RtlFormatCurrentUserKeyPath(DWORD x);
     621DWORD WINAPI RtlOpenCurrentUser(DWORD x1, DWORD *x2);
     622BOOLEAN WINAPI RtlDosPathNameToNtPathName_U( LPWSTR from,PUNICODE_STRING us,DWORD x2,DWORD x3);
     623DWORD WINAPI RtlCreateEnvironment(DWORD x1,DWORD x2);
     624DWORD WINAPI RtlDestroyEnvironment(DWORD x);
     625DWORD WINAPI RtlQueryEnvironmentVariable_U(DWORD x1,PUNICODE_STRING key,PUNICODE_STRING val) ;
     626
     627BOOL WINAPI IsValidSid(PSID);
     628BOOL WINAPI EqualSid(PSID,PSID);
     629BOOL WINAPI EqualPrefixSid(PSID,PSID);
     630DWORD  WINAPI GetSidLengthRequired(BYTE);
     631BOOL WINAPI AllocateAndInitializeSid(PSID_IDENTIFIER_AUTHORITY,BYTE,DWORD,
    196632                                       DWORD,DWORD,DWORD,DWORD,DWORD,DWORD,
    197                                        DWORD,LPSID*);
    198 VOID*  WIN32API FreeSid(LPSID);
    199 BOOL32 WIN32API InitializeSecurityDescriptor(SECURITY_DESCRIPTOR*,DWORD);
    200 BOOL32 WIN32API InitializeSid(LPSID,LPSID_IDENTIFIER_AUTHORITY,BYTE);
    201 DWORD* WIN32API GetSidSubAuthority(LPSID,DWORD);
    202 BYTE * WIN32API GetSidSubAuthorityCount(LPSID);
    203 DWORD  WIN32API GetLengthSid(LPSID);
    204 BOOL32 WIN32API CopySid(DWORD,LPSID,LPSID);
    205 BOOL32 WIN32API LookupAccountSid32A(LPCSTR,PSID,LPCSTR,LPDWORD,LPCSTR,LPDWORD,
     633                                       DWORD,PSID*);
     634VOID*  WINAPI FreeSid(PSID);
     635BOOL WINAPI InitializeSecurityDescriptor(SECURITY_DESCRIPTOR*,DWORD);
     636BOOL WINAPI InitializeSid(PSID,PSID_IDENTIFIER_AUTHORITY,BYTE);
     637DWORD* WINAPI GetSidSubAuthority(PSID,DWORD);
     638BYTE * WINAPI GetSidSubAuthorityCount(PSID);
     639DWORD  WINAPI GetLengthSid(PSID);
     640BOOL WINAPI CopySid(DWORD,PSID,PSID);
     641BOOL WINAPI LookupAccountSidA(LPCSTR,PSID,LPCSTR,LPDWORD,LPCSTR,LPDWORD,
    206642                                  PSID_NAME_USE);
    207 BOOL32 WIN32API LookupAccountSid32W(LPCWSTR,PSID,LPCWSTR,LPDWORD,LPCWSTR,LPDWORD,
     643BOOL WINAPI LookupAccountSidW(LPCWSTR,PSID,LPCWSTR,LPDWORD,LPCWSTR,LPDWORD,
    208644                                  PSID_NAME_USE);
    209 LPSID_IDENTIFIER_AUTHORITY WIN32API GetSidIdentifierAuthority(LPSID);
    210  
    211  
     645PSID_IDENTIFIER_AUTHORITY WINAPI GetSidIdentifierAuthority(PSID);
    212646
    213647#ifdef __cplusplus
     
    215649#endif
    216650
    217 #endif /* _WINNT_ */
     651#endif
Note: See TracChangeset for help on using the changeset viewer.