Changeset 2122 for trunk/src


Ignore:
Timestamp:
Dec 18, 1999, 9:01:14 PM (26 years ago)
Author:
sandervl
Message:

Partially implemented some Token & SID apis

Location:
trunk/src/NTDLL
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/NTDLL/initterm.cpp

    r951 r2122  
    1 /* $Id: initterm.cpp,v 1.7 1999-09-15 23:26:05 sandervl Exp $ */
     1/* $Id: initterm.cpp,v 1.8 1999-12-18 20:01:13 sandervl Exp $ */
    22
    33/*
     
    5050
    5151
     52BOOL WINAPI NTDLL_LibMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved);
     53
    5254/****************************************************************************/
    5355/* _DLL_InitTerm is the function that gets called by the operating system   */
     
    8183         /*******************************************************************/
    8284
    83          if(RegisterLxDll(hModule, 0, 0) == FALSE)
     85         if(RegisterLxDll(hModule, NTDLL_LibMain, 0) == FALSE)
    8486                return 0UL;
    8587
  • trunk/src/NTDLL/nt.cpp

    r97 r2122  
    1 /* $Id: nt.cpp,v 1.2 1999-06-10 17:06:45 phaller Exp $ */
     1/* $Id: nt.cpp,v 1.3 1999-12-18 20:01:13 sandervl Exp $ */
    22
    33
     
    331331  {
    332332    case TokenGroups:                    /* 2 */
    333       *ReturnLength = sizeof (TOKEN_GROUPS);
     333        *ReturnLength = sizeof (TOKEN_GROUPS);
     334        if(TokenInformationLength < sizeof (TOKEN_GROUPS)) {
     335                return STATUS_BUFFER_TOO_SMALL;
     336        }
     337        memset(TokenInformation, 0, sizeof(TOKEN_GROUPS));
     338        break;
     339    case TokenUser:                     /* 1 */
     340        *ReturnLength = sizeof (TOKEN_USER);
     341        if(TokenInformationLength < sizeof (TOKEN_USER)) {
     342                return STATUS_BUFFER_TOO_SMALL;
     343        }
     344        memset(TokenInformation, 0, sizeof(TOKEN_USER));
     345        break;
     346    case TokenPrivileges:
     347        *ReturnLength = sizeof (TOKEN_PRIVILEGES);
     348        if(TokenInformationLength < sizeof (TOKEN_PRIVILEGES)) {
     349                return STATUS_BUFFER_TOO_SMALL;
     350        }
     351        memset(TokenInformation, 0, sizeof(TOKEN_PRIVILEGES));
     352        break;
     353    case TokenOwner:
     354        *ReturnLength = sizeof (TOKEN_OWNER);
     355        if(TokenInformationLength < sizeof (TOKEN_OWNER)) {
     356                return STATUS_BUFFER_TOO_SMALL;
     357        }
     358        memset(TokenInformation, 0, sizeof(TOKEN_OWNER));
     359        break;
     360    case TokenPrimaryGroup:
     361        *ReturnLength = sizeof (TOKEN_PRIMARY_GROUP);
     362        if(TokenInformationLength < sizeof (TOKEN_PRIMARY_GROUP)) {
     363                return STATUS_BUFFER_TOO_SMALL;
     364        }
     365        memset(TokenInformation, 0, sizeof(TOKEN_PRIMARY_GROUP));
     366        break;
     367    case TokenDefaultDacl:
     368        *ReturnLength = sizeof (TOKEN_DEFAULT_DACL);
     369        if(TokenInformationLength < sizeof (TOKEN_DEFAULT_DACL)) {
     370                return STATUS_BUFFER_TOO_SMALL;
     371        }
     372        memset(TokenInformation, 0, sizeof(TOKEN_DEFAULT_DACL));
     373        break;
     374    case TokenSource:
     375        *ReturnLength = sizeof (TOKEN_SOURCE);
     376        if(TokenInformationLength < sizeof (TOKEN_SOURCE)) {
     377                return STATUS_BUFFER_TOO_SMALL;
     378        }
     379        memset(TokenInformation, 0, sizeof(TOKEN_SOURCE));
     380        break;
     381    case TokenType:
     382        *ReturnLength = sizeof (TOKEN_TYPE);
     383        if(TokenInformationLength < sizeof (TOKEN_TYPE)) {
     384                return STATUS_BUFFER_TOO_SMALL;
     385        }
     386        memset(TokenInformation, 0, sizeof(TOKEN_TYPE));
     387        break;
    334388#if 0
    335     case TokenUser:                     /* 1 */
    336     case TokenPrivileges:
    337     case TokenOwner:
    338     case TokenPrimaryGroup:
    339     case TokenDefaultDacl:
    340     case TokenSource:
    341     case TokenType:
    342389    case TokenImpersonationLevel:
    343390    case TokenStatistics:
     
    345392  }
    346393
    347   return 0;
     394  return STATUS_SUCCESS;
    348395}
    349396
  • trunk/src/NTDLL/ntdll.cpp

    r1653 r2122  
    1 /* $Id: ntdll.cpp,v 1.3 1999-11-09 09:30:20 phaller Exp $ */
     1/* $Id: ntdll.cpp,v 1.4 1999-12-18 20:01:14 sandervl Exp $ */
    22
    33/*
     
    5050#define NTSTATUS DWORD
    5151
     52//SvL: per process heap for NTDLL
     53HANDLE NTDLL_hHeap = 0;
    5254
    5355/*****************************************************************************
     
    7779  //@@@PH raise debug exception if running in debugger
    7880}
     81
     82
     83BOOL WINAPI NTDLL_LibMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
     84{
     85    dprintf(("NTDLL_LibMain: 0x%x 0x%lx %p\n", hinstDLL, fdwReason, lpvReserved));
     86
     87    switch (fdwReason) {
     88    case DLL_PROCESS_ATTACH:
     89        NTDLL_hHeap = HeapCreate(0, 0x10000, 0);
     90        break;
     91    case DLL_PROCESS_DETACH:
     92        HeapDestroy(NTDLL_hHeap);
     93        NTDLL_hHeap = 0;
     94        break;
     95    case DLL_THREAD_ATTACH:
     96        break;
     97    case DLL_THREAD_DETACH:
     98        break;
     99    default:
     100        break;
     101    }
     102    return TRUE;
     103}
     104
  • trunk/src/NTDLL/ntdll.h

    r638 r2122  
    1 /* $Id: ntdll.h,v 1.7 1999-08-22 22:45:52 sandervl Exp $ */
     1/* $Id: ntdll.h,v 1.8 1999-12-18 20:01:14 sandervl Exp $ */
    22
    33/*
     
    4545
    4646
     47//SvL: Internal heap allocation definitions for NTDLL
     48extern HANDLE NTDLL_hHeap;
     49#define Heap_Alloc(a)   HeapAlloc(NTDLL_hHeap, HEAP_ZERO_MEMORY, a)
     50#define Heap_Free(a)    HeapFree(NTDLL_hHeap, 0, (PVOID)a)
    4751
    4852typedef struct _IO_STATUS_BLOCK
     
    367371 */
    368372
    369 BOOLEAN WINAPI RtlAllocateAndInitializeSid (
    370    PSID_IDENTIFIER_AUTHORITY pIdentifierAuthority,
    371    DWORD nSubAuthorityCount,
    372    DWORD x3,
    373    DWORD x4,
    374    DWORD x5,
    375    DWORD x6,
    376    DWORD x7,
    377    DWORD x8,
    378    DWORD x9,
    379    DWORD x10,
    380    PSID pSid);
    381 
    382 DWORD WINAPI RtlEqualSid(DWORD x1,DWORD x2);
    383 DWORD WINAPI RtlFreeSid(DWORD x1);
     373BOOLEAN WINAPI RtlAllocateAndInitializeSid ( PSID_IDENTIFIER_AUTHORITY pIdentifierAuthority,
     374                                             BYTE nSubAuthorityCount,
     375                                             DWORD nSubAuthority0,
     376                                             DWORD nSubAuthority1,
     377                                             DWORD nSubAuthority2,
     378                                             DWORD nSubAuthority3,
     379                                             DWORD nSubAuthority4,
     380                                             DWORD nSubAuthority5,
     381                                             DWORD nSubAuthority6,
     382                                             DWORD nSubAuthority7,
     383                                             PSID *pSid);
     384       
     385BOOL WINAPI RtlEqualSid(PSID pSid1, PSID pSid2);
     386VOID* WINAPI RtlFreeSid(PSID pSid);
    384387DWORD WINAPI RtlLengthRequiredSid(DWORD nrofsubauths);
    385388DWORD WINAPI RtlLengthSid(PSID sid);
  • trunk/src/NTDLL/sec.cpp

    r278 r2122  
    1 /* $Id: sec.cpp,v 1.3 1999-07-06 15:48:45 phaller Exp $ */
     1/* $Id: sec.cpp,v 1.4 1999-12-18 20:01:14 sandervl Exp $ */
    22
    33/*
     
    4444 *
    4545 */
    46 BOOLEAN WINAPI RtlAllocateAndInitializeSid (PSID_IDENTIFIER_AUTHORITY pIdentifierAuthority,
    47                                             DWORD                    nSubAuthorityCount,
    48                                             DWORD                     x3,
    49                                             DWORD                     x4,
    50                                             DWORD                     x5,
    51                                             DWORD                     x6,
    52                                             DWORD                     x7,
    53                                             DWORD                     x8,
    54                                             DWORD                     x9,
    55                                             DWORD                     x10,
    56                                             PSID                      pSid)
     46BOOLEAN WINAPI RtlAllocateAndInitializeSid ( PSID_IDENTIFIER_AUTHORITY pIdentifierAuthority,
     47                                             BYTE nSubAuthorityCount,
     48                                             DWORD nSubAuthority0,
     49                                             DWORD nSubAuthority1,
     50                                             DWORD nSubAuthority2,
     51                                             DWORD nSubAuthority3,
     52                                             DWORD nSubAuthority4,
     53                                             DWORD nSubAuthority5,
     54                                             DWORD nSubAuthority6,
     55                                             DWORD nSubAuthority7,
     56                                             PSID *pSid)
    5757{
    5858  dprintf(("NTDLL: RtlAllocateAndInitializeSid(%08xh,%08xh,%08xh,"
     
    6060           pIdentifierAuthority,
    6161           nSubAuthorityCount,
    62            x3,
    63            x4,
    64            x5,
    65            x6,
    66            x7,
    67            x8,
    68            x9,
    69            x10,
     62           nSubAuthority0,
     63           nSubAuthority1,
     64           nSubAuthority2,
     65           nSubAuthority3,
     66           nSubAuthority4,
     67           nSubAuthority5,
     68           nSubAuthority6,
     69           nSubAuthority7,
    7070           pSid));
    7171
    72   return 0;
     72  *pSid = (PSID)Heap_Alloc(sizeof(SID)+nSubAuthorityCount*sizeof(DWORD));
     73  if(*pSid == NULL) {
     74        SetLastError(ERROR_NOT_ENOUGH_MEMORY);
     75        return FALSE;
     76  }
     77  (*pSid)->Revision          = SID_REVISION;
     78  (*pSid)->SubAuthorityCount = nSubAuthorityCount;
     79  (*pSid)->SubAuthority[0]   = nSubAuthority0;
     80  (*pSid)->SubAuthority[1]   = nSubAuthority1;
     81  (*pSid)->SubAuthority[2]   = nSubAuthority2;
     82  (*pSid)->SubAuthority[3]   = nSubAuthority3;
     83  (*pSid)->SubAuthority[4]   = nSubAuthority4;
     84  (*pSid)->SubAuthority[5]   = nSubAuthority5;
     85  (*pSid)->SubAuthority[6]   = nSubAuthority6;
     86  (*pSid)->SubAuthority[7]   = nSubAuthority7;
     87  memcpy((PVOID)&(*pSid)->IdentifierAuthority, (PVOID)pIdentifierAuthority, sizeof(SID_IDENTIFIER_AUTHORITY));
     88  return TRUE;
    7389}
    7490
     
    7894 *
    7995 */
    80 DWORD WINAPI RtlEqualSid(DWORD x1,
    81                          DWORD x2)
     96BOOL WINAPI RtlEqualSid(PSID pSid1, PSID pSid2)
    8297{
    8398  dprintf(("NTDLL: RtlEqualSid(%08x, %08x) not implemented.\n",
    84            x1,
    85            x2));
     99           pSid1,
     100           pSid2));
    86101
    87102  return TRUE;
     
    92107 *  RtlFreeSid    [NTDLL.376]
    93108 */
    94 DWORD WINAPI RtlFreeSid(DWORD x1)
     109VOID* WINAPI RtlFreeSid(PSID pSid)
    95110{
    96111  dprintf(("NTDLL: RtlFreeSid(%08xh) not implemented.\n",
    97            x1));
    98 
    99   return TRUE;
     112           pSid));
     113
     114  Heap_Free(pSid);
     115  return (VOID*)TRUE; //??????
    100116}
    101117
Note: See TracChangeset for help on using the changeset viewer.