test: exports.c Source File

Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

# exports.c

Go to the documentation of this file.

    00001 /**************************** Module Header ********************************\
    00002 * Module Name: exports.c
    00003 *
    00004 * Copyright (c) 1985 - 1999, Microsoft Corporation
    00005 *
    00006 * Routines exported from winsrv.dll
    00007 *
    00008 * History:
    00009 * 03-04-95 JimA                Created.
    00010 \***************************************************************************/
    00011
    00012 #include "precomp.h"
    00013 #pragma hdrstop
    00014
    00015 /***************************************************************************\
    00016 * _UserSoundSentry
    00017 *
    00018 * Private API for BASE to use for SoundSentry support.
    00019 *
    00020 * History:
    00021 * 08-02-93 GregoryW         Created.
    00022 \***************************************************************************/
    00023 BOOL
    00024 _UserSoundSentry(
    00025     UINT uVideoMode)
    00026 {
    00027     UNREFERENCED_PARAMETER(uVideoMode);
    00028
    00029     return NT_SUCCESS(NtUserSoundSentry());
    00030 }
    00031
    00032 /***************************************************************************\
    00033 * _UserTestTokenForInteractive
    00034 *
    00035 * Returns TRUE if the token passed represents an interactive user logged
    00036 * on by winlogon, otherwise FALSE
    00037 *
    00038 * The token handle passed must have TOKEN_QUERY access.
    00039 *
    00040 * History:
    00041 * 05-06-92 Davidc       Created
    00042 \***************************************************************************/
    00043
    00044 NTSTATUS
    00045 _UserTestTokenForInteractive(
    00046     HANDLE Token,
    00047     PLUID pluidCaller
    00048     )
    00049 {
    00050     PTOKEN_STATISTICS pStats;
    00051     ULONG BytesRequired;
    00052     NTSTATUS Status;
    00053
    00054     /*
    00055      * Get the session id of the caller.
    00056      */
    00057     Status = NtQueryInformationToken(
    00058                  Token,                     // Handle
    00059                  TokenStatistics,           // TokenInformationClass
    00060                  NULL,                      // TokenInformation
    00061                  0,                         // TokenInformationLength
    00062                  &BytesRequired             // ReturnLength
    00063                  );
    00064
    00065     if (Status != STATUS_BUFFER_TOO_SMALL) {
    00066         return Status;
    00067         }
    00068
    00069     //
    00070     // Allocate space for the user info
    00071     //
    00072
    00073     pStats = (PTOKEN_STATISTICS)LocalAlloc(LPTR, BytesRequired);
    00074     if (pStats == NULL) {
    00075         return Status;
    00076         }
    00077
    00078     //
    00079     // Read in the user info
    00080     //
    00081
    00082     Status = NtQueryInformationToken(
    00083                  Token,             // Handle
    00084                  TokenStatistics,       // TokenInformationClass
    00085                  pStats,                // TokenInformation
    00086                  BytesRequired,         // TokenInformationLength
    00087                  &BytesRequired         // ReturnLength
    00088                  );
    00089
    00090     if (NT_SUCCESS(Status)) {
    00091         if (pluidCaller != NULL)
    00092              *pluidCaller = pStats->AuthenticationId;
    00093
    00094         /*
    00095          * A valid session id has been returned.  Compare it
    00096          * with the id of the logged on user.
    00097          */
    00098         Status = NtUserTestForInteractiveUser(&pStats->AuthenticationId);
    00099 #ifdef LATER
    00100         if (pStats->AuthenticationId.QuadPart == pwinsta->luidUser.QuadPart)
    00101             Status = STATUS_SUCCESS;
    00102         else
    00103             Status = STATUS_ACCESS_DENIED;
    00104 #endif
    00105     }
    00106
    00107     LocalFree(pStats);
    00108
    00109     return Status;
    00110 }
    00111