cscg24-guacamole

CSCG 2024 Challenge 'Guacamole Mashup'
git clone https://git.sinitax.com/sinitax/cscg24-guacamole
Log | Files | Refs | sfeed.txt

credui.h (6507B)


      1/**
      2 * WinPR: Windows Portable Runtime
      3 * Credentials Management UI
      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_CREDUI_H
     21#define WINPR_CREDUI_H
     22
     23#include <winpr/winpr.h>
     24#include <winpr/wtypes.h>
     25
     26#include <winpr/nt.h>
     27#include <winpr/sspi.h>
     28#include <winpr/error.h>
     29#include <winpr/credentials.h>
     30
     31#ifdef _WIN32
     32
     33#include <wincred.h>
     34
     35#else
     36
     37#define CREDUI_MAX_MESSAGE_LENGTH 32767
     38#define CREDUI_MAX_CAPTION_LENGTH 128
     39#define CREDUI_MAX_GENERIC_TARGET_LENGTH CRED_MAX_GENERIC_TARGET_NAME_LENGTH
     40#define CREDUI_MAX_DOMAIN_TARGET_LENGTH CRED_MAX_DOMAIN_TARGET_NAME_LENGTH
     41#define CREDUI_MAX_USERNAME_LENGTH CRED_MAX_USERNAME_LENGTH
     42#define CREDUI_MAX_PASSWORD_LENGTH (CRED_MAX_CREDENTIAL_BLOB_SIZE / 2)
     43
     44#define CREDUI_FLAGS_INCORRECT_PASSWORD 0x00000001
     45#define CREDUI_FLAGS_DO_NOT_PERSIST 0x00000002
     46#define CREDUI_FLAGS_REQUEST_ADMINISTRATOR 0x00000004
     47#define CREDUI_FLAGS_EXCLUDE_CERTIFICATES 0x00000008
     48#define CREDUI_FLAGS_REQUIRE_CERTIFICATE 0x00000010
     49#define CREDUI_FLAGS_SHOW_SAVE_CHECK_BOX 0x00000040
     50#define CREDUI_FLAGS_ALWAYS_SHOW_UI 0x00000080
     51#define CREDUI_FLAGS_REQUIRE_SMARTCARD 0x00000100
     52#define CREDUI_FLAGS_PASSWORD_ONLY_OK 0x00000200
     53#define CREDUI_FLAGS_VALIDATE_USERNAME 0x00000400
     54#define CREDUI_FLAGS_COMPLETE_USERNAME 0x00000800
     55#define CREDUI_FLAGS_PERSIST 0x00001000
     56#define CREDUI_FLAGS_SERVER_CREDENTIAL 0x00004000
     57#define CREDUI_FLAGS_EXPECT_CONFIRMATION 0x00020000
     58#define CREDUI_FLAGS_GENERIC_CREDENTIALS 0x00040000
     59#define CREDUI_FLAGS_USERNAME_TARGET_CREDENTIALS 0x00080000
     60#define CREDUI_FLAGS_KEEP_USERNAME 0x00100000
     61
     62#define CREDUIWIN_GENERIC 0x00000001
     63#define CREDUIWIN_CHECKBOX 0x00000002
     64#define CREDUIWIN_AUTHPACKAGE_ONLY 0x00000010
     65#define CREDUIWIN_IN_CRED_ONLY 0x00000020
     66#define CREDUIWIN_ENUMERATE_ADMINS 0x00000100
     67#define CREDUIWIN_ENUMERATE_CURRENT_USER 0x00000200
     68#define CREDUIWIN_SECURE_PROMPT 0x00001000
     69#define CREDUIWIN_PACK_32_WOW 0x10000000
     70
     71typedef struct _CREDUI_INFOA
     72{
     73	DWORD cbSize;
     74	HWND hwndParent;
     75	PCSTR pszMessageText;
     76	PCSTR pszCaptionText;
     77	HBITMAP hbmBanner;
     78} CREDUI_INFOA, *PCREDUI_INFOA;
     79
     80typedef struct _CREDUI_INFOW
     81{
     82	DWORD cbSize;
     83	HWND hwndParent;
     84	PCWSTR pszMessageText;
     85	PCWSTR pszCaptionText;
     86	HBITMAP hbmBanner;
     87} CREDUI_INFOW, *PCREDUI_INFOW;
     88
     89#ifdef UNICODE
     90#define CREDUI_INFO CREDUI_INFOW
     91#define PCREDUI_INFO PCREDUI_INFOW
     92#else
     93#define CREDUI_INFO CREDUI_INFOA
     94#define PCREDUI_INFO PCREDUI_INFOA
     95#endif
     96
     97#ifdef __cplusplus
     98extern "C"
     99{
    100#endif
    101
    102	WINPR_API DWORD CredUIPromptForCredentialsW(PCREDUI_INFOW pUiInfo, PCWSTR pszTargetName,
    103	                                            PCtxtHandle pContext, DWORD dwAuthError,
    104	                                            PWSTR pszUserName, ULONG ulUserNameBufferSize,
    105	                                            PWSTR pszPassword, ULONG ulPasswordBufferSize,
    106	                                            BOOL* save, DWORD dwFlags);
    107	WINPR_API DWORD CredUIPromptForCredentialsA(PCREDUI_INFOA pUiInfo, PCSTR pszTargetName,
    108	                                            PCtxtHandle pContext, DWORD dwAuthError,
    109	                                            PSTR pszUserName, ULONG ulUserNameBufferSize,
    110	                                            PSTR pszPassword, ULONG ulPasswordBufferSize,
    111	                                            BOOL* save, DWORD dwFlags);
    112
    113	WINPR_API DWORD CredUIParseUserNameW(CONST WCHAR* UserName, WCHAR* user, ULONG userBufferSize,
    114	                                     WCHAR* domain, ULONG domainBufferSize);
    115	WINPR_API DWORD CredUIParseUserNameA(CONST CHAR* userName, CHAR* user, ULONG userBufferSize,
    116	                                     CHAR* domain, ULONG domainBufferSize);
    117
    118	WINPR_API DWORD CredUICmdLinePromptForCredentialsW(PCWSTR pszTargetName, PCtxtHandle pContext,
    119	                                                   DWORD dwAuthError, PWSTR UserName,
    120	                                                   ULONG ulUserBufferSize, PWSTR pszPassword,
    121	                                                   ULONG ulPasswordBufferSize, PBOOL pfSave,
    122	                                                   DWORD dwFlags);
    123	WINPR_API DWORD CredUICmdLinePromptForCredentialsA(PCSTR pszTargetName, PCtxtHandle pContext,
    124	                                                   DWORD dwAuthError, PSTR UserName,
    125	                                                   ULONG ulUserBufferSize, PSTR pszPassword,
    126	                                                   ULONG ulPasswordBufferSize, PBOOL pfSave,
    127	                                                   DWORD dwFlags);
    128
    129	WINPR_API DWORD CredUIConfirmCredentialsW(PCWSTR pszTargetName, BOOL bConfirm);
    130	WINPR_API DWORD CredUIConfirmCredentialsA(PCSTR pszTargetName, BOOL bConfirm);
    131
    132	WINPR_API DWORD CredUIStoreSSOCredW(PCWSTR pszRealm, PCWSTR pszUsername, PCWSTR pszPassword,
    133	                                    BOOL bPersist);
    134	WINPR_API DWORD CredUIStoreSSOCredA(PCSTR pszRealm, PCSTR pszUsername, PCSTR pszPassword,
    135	                                    BOOL bPersist);
    136
    137	WINPR_API DWORD CredUIReadSSOCredW(PCWSTR pszRealm, PWSTR* ppszUsername);
    138	WINPR_API DWORD CredUIReadSSOCredA(PCSTR pszRealm, PSTR* ppszUsername);
    139
    140#ifdef __cplusplus
    141}
    142#endif
    143
    144#ifdef UNICODE
    145#define CredUIPromptForCredentials CredUIPromptForCredentialsW
    146#define CredUIParseUserName CredUIParseUserNameW
    147#define CredUICmdLinePromptForCredentials CredUICmdLinePromptForCredentialsW
    148#define CredUIConfirmCredentials CredUIConfirmCredentialsW
    149#define CredUIStoreSSOCred CredUIStoreSSOCredW
    150#define CredUIReadSSOCred CredUIReadSSOCredW
    151#else
    152#define CredUIPromptForCredentials CredUIPromptForCredentialsA
    153#define CredUIParseUserName CredUIParseUserNameA
    154#define CredUICmdLinePromptForCredentials CredUICmdLinePromptForCredentialsA
    155#define CredUIConfirmCredentials CredUIConfirmCredentialsA
    156#define CredUIStoreSSOCred CredUIStoreSSOCredA
    157#define CredUIReadSSOCred CredUIReadSSOCredA
    158#endif
    159
    160#endif
    161
    162#endif /* WINPR_CREDUI_H */