sspicli.h (4634B)
1/** 2 * WinPR: Windows Portable Runtime 3 * Security Support Provider Interface 4 * 5 * Copyright 2012 Marc-Andre Moreau <marcandre.moreau@gmail.com> 6 * 7 * Licensed under the Apache License, Version 2.0 (the "License"); 8 * you may not use this file except in compliance with the License. 9 * You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, software 14 * distributed under the License is distributed on an "AS IS" BASIS, 15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 * See the License for the specific language governing permissions and 17 * limitations under the License. 18 */ 19 20#ifndef WINPR_SSPICLI_H 21#define WINPR_SSPICLI_H 22 23#include <stdio.h> 24#include <stdlib.h> 25#include <string.h> 26#include <winpr/winpr.h> 27#include <winpr/wtypes.h> 28 29#ifndef _WIN32 30 31#define LOGON32_LOGON_INTERACTIVE 2 32#define LOGON32_LOGON_NETWORK 3 33#define LOGON32_LOGON_BATCH 4 34#define LOGON32_LOGON_SERVICE 5 35#define LOGON32_LOGON_UNLOCK 7 36#define LOGON32_LOGON_NETWORK_CLEARTEXT 8 37#define LOGON32_LOGON_NEW_CREDENTIALS 9 38 39#define LOGON32_PROVIDER_DEFAULT 0 40#define LOGON32_PROVIDER_WINNT35 1 41#define LOGON32_PROVIDER_WINNT40 2 42#define LOGON32_PROVIDER_WINNT50 3 43#define LOGON32_PROVIDER_VIRTUAL 4 44 45typedef struct _QUOTA_LIMITS 46{ 47 SIZE_T PagedPoolLimit; 48 SIZE_T NonPagedPoolLimit; 49 SIZE_T MinimumWorkingSetSize; 50 SIZE_T MaximumWorkingSetSize; 51 SIZE_T PagefileLimit; 52 LARGE_INTEGER TimeLimit; 53} QUOTA_LIMITS, *PQUOTA_LIMITS; 54 55typedef enum 56{ 57 /* An unknown name type */ 58 NameUnknown = 0, 59 60 /* The fully qualified distinguished name (for example, CN=Jeff 61 Smith,OU=Users,DC=Engineering,DC=Microsoft,DC=Com) */ 62 NameFullyQualifiedDN = 1, 63 64 /* 65 * A legacy account name (for example, Engineering\JSmith). 66 * The domain-only version includes trailing backslashes (\\) 67 */ 68 NameSamCompatible = 2, 69 70 /* 71 * A "friendly" display name (for example, Jeff Smith). 72 * The display name is not necessarily the defining relative distinguished name (RDN) 73 */ 74 NameDisplay = 3, 75 76 /* A GUID string that the IIDFromString function returns (for example, 77 {4fa050f0-f561-11cf-bdd9-00aa003a77b6}) */ 78 NameUniqueId = 6, 79 80 /* 81 * The complete canonical name (for example, engineering.microsoft.com/software/someone). 82 * The domain-only version includes a trailing forward slash (/) 83 */ 84 NameCanonical = 7, 85 86 /* The user principal name (for example, someone@example.com) */ 87 NameUserPrincipal = 8, 88 89 /* 90 * The same as NameCanonical except that the rightmost forward slash (/) 91 * is replaced with a new line character (\n), even in a domain-only case 92 * (for example, engineering.microsoft.com/software\nJSmith) 93 */ 94 NameCanonicalEx = 9, 95 96 /* The generalized service principal name (for example, www/www.microsoft.com@microsoft.com) */ 97 NameServicePrincipal = 10, 98 99 /* The DNS domain name followed by a backward-slash and the SAM user name */ 100 NameDnsDomain = 12 101 102} EXTENDED_NAME_FORMAT, 103 *PEXTENDED_NAME_FORMAT; 104 105#ifdef __cplusplus 106extern "C" 107{ 108#endif 109 110 WINPR_API BOOL LogonUserA(LPCSTR lpszUsername, LPCSTR lpszDomain, LPCSTR lpszPassword, 111 DWORD dwLogonType, DWORD dwLogonProvider, PHANDLE phToken); 112 113 WINPR_API BOOL LogonUserW(LPCWSTR lpszUsername, LPCWSTR lpszDomain, LPCWSTR lpszPassword, 114 DWORD dwLogonType, DWORD dwLogonProvider, PHANDLE phToken); 115 116 WINPR_API BOOL LogonUserExA(LPCSTR lpszUsername, LPCSTR lpszDomain, LPCSTR lpszPassword, 117 DWORD dwLogonType, DWORD dwLogonProvider, PHANDLE phToken, 118 PSID* ppLogonSid, PVOID* ppProfileBuffer, LPDWORD pdwProfileLength, 119 PQUOTA_LIMITS pQuotaLimits); 120 121 WINPR_API BOOL LogonUserExW(LPCWSTR lpszUsername, LPCWSTR lpszDomain, LPCWSTR lpszPassword, 122 DWORD dwLogonType, DWORD dwLogonProvider, PHANDLE phToken, 123 PSID* ppLogonSid, PVOID* ppProfileBuffer, LPDWORD pdwProfileLength, 124 PQUOTA_LIMITS pQuotaLimits); 125 126 WINPR_API BOOL GetUserNameExA(EXTENDED_NAME_FORMAT NameFormat, LPSTR lpNameBuffer, 127 PULONG nSize); 128 WINPR_API BOOL GetUserNameExW(EXTENDED_NAME_FORMAT NameFormat, LPWSTR lpNameBuffer, 129 PULONG nSize); 130 131#ifdef __cplusplus 132} 133#endif 134 135#ifdef UNICODE 136#define LogonUser LogonUserW 137#define LogonUserEx LogonUserExW 138#define GetUserNameEx GetUserNameExW 139#else 140#define LogonUser LogonUserA 141#define LogonUserEx LogonUserExA 142#define GetUserNameEx GetUserNameExA 143#endif 144 145#endif 146 147#endif /* WINPR_SSPICLI_H */