' ########################################################################################
' Microsoft Windows
' File: SecExt.inc
' Contents: Security function prototypes for functions not part of the SSPI interface.
' This file should not be directly included - include security.inc instead.
' Copyright (c) 2011 Jos? Roca
' Portions Copyright (c) Microsoft Corporation.
' All Rights Reserved.
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
' ########################################################################################
#IF NOT %DEF(PBX_SecExt_PBI)
#DEFINE PBX_SecExt_PBI
%EQUATE `SECEXT_INC = 1
'//
'// Extended Name APIs for ADS
'//
'typedef enum
'{
' // Examples for the following formats assume a fictitous company
' // which hooks into the global X.500 and DNS name spaces as follows.
' //
' // Enterprise root domain in DNS is
' //
' // widget.com
' //
' // Enterprise root domain in X.500 (RFC 1779 format) is
' //
' // O=Widget, C=US
' //
' // There exists the child domain
' //
' // engineering.widget.com
' //
' // equivalent to
' //
' // OU=Engineering, O=Widget, C=US
' //
' // There exists a container within the Engineering domain
' //
' // OU=Software, OU=Engineering, O=Widget, C=US
' //
' // There exists the user
' //
' // CN=John Doe, OU=Software, OU=Engineering, O=Widget, C=US
' //
' // And this user's downlevel (pre-ADS) user name is
' //
' // Engineering\JohnDoe
' // unknown name type
' NameUnknown = 0,
' // CN=John Doe, OU=Software, OU=Engineering, O=Widget, C=US
' NameFullyQualifiedDN = 1,
' // Engineering\JohnDoe
' NameSamCompatible = 2,
' // Probably "John Doe" but could be something else. I.e. The
' // display name is not necessarily the defining RDN.
' NameDisplay = 3,
' // String-ized GUID as returned by IIDFromString().
' // eg: {4fa050f0-f561-11cf-bdd9-00aa003a77b6}
' NameUniqueId = 6,
' // engineering.widget.com/software/John Doe
' NameCanonical = 7,
' // someone@example.com
' NameUserPrincipal = 8,
' // Same as NameCanonical except that rightmost '/' is
' // replaced with '\n' - even in domain-only case.
' // eg: engineering.widget.com/software\nJohn Doe
' NameCanonicalEx = 9,
' // www/srv.engineering.com/engineering.com
' NameServicePrincipal = 10,
' // DNS domain name + SAM username
' // eg: engineering.widget.com\JohnDoe
' NameDnsDomain = 12
'} EXTENDED_NAME_FORMAT, * PEXTENDED_NAME_FORMAT ;
%EQUATE `NameUnknown = 0
%EQUATE `NameFullyQualifiedDN = 1
%EQUATE `NameSamCompatible = 2
%EQUATE `NameDisplay = 3
%EQUATE `NameUniqueId = 6
%EQUATE `NameCanonical = 7
%EQUATE `NameUserPrincipal = 8
%EQUATE `NameCanonicalEx = 9
%EQUATE `NameServicePrincipal = 10
%EQUATE `NameDnsDomain = 12
DECLARE FUNCTION GetUserNameExA LIB "secur32.dll" ALIAS "GetUserNameExA" ( BYVAL NameFormat AS LONG , BYREF lpNameBuffer AS ASCIIZ , BYREF nSize AS QUAD ) AS BYTE ' BOOLEAN
DECLARE FUNCTION GetUserNameExW LIB "secur32.dll" ALIAS "GetUserNameExW" ( BYVAL NameFormat AS LONG , BYREF lpNameBuffer AS WSTRINGZ , BYREF nSize AS QUAD ) AS BYTE ' BOOLEAN
#IF %DEF(%UNICODE)
 MACRO GetUserNameEx = GetUserNameExW
#ELSE
 MACRO GetUserNameEx = GetUserNameExA
#ENDIF
DECLARE FUNCTION GetComputerObjectNameA LIB "secur32.dll" ALIAS "GetComputerObjectNameA" ( BYVAL NameFormat AS LONG , BYREF lpNameBuffer AS ASCIIZ , BYREF nSize AS QUAD ) AS BYTE ' BOOLEAN
DECLARE FUNCTION GetComputerObjectNameW LIB "secur32.dll" ALIAS "GetComputerObjectNameW" ( BYVAL NameFormat AS LONG , BYREF lpNameBuffer AS WSTRINGZ , BYREF nSize AS QUAD ) AS BYTE ' BOOLEAN
#IF %DEF(%UNICODE)
 MACRO GetComputerObjectName = GetComputerObjectNameW
#ELSE
 MACRO GetComputerObjectName = GetComputerObjectNameA
#ENDIF
DECLARE FUNCTION TranslateNameA LIB "secur32.dll" ALIAS "TranslateNameA" ( BYREF lpAccountName AS ASCIIZ , BYVAL AccountNameFormat AS LONG , BYVAL DesiredNameFormat AS LONG , BYREF lpTranslatedName AS ASCIIZ , BYREF nSize AS QUAD ) AS BYTE ' BOOLEAN
DECLARE FUNCTION TranslateNameW LIB "secur32.dll" ALIAS "TranslateNameW" ( BYREF lpAccountName AS WSTRINGZ , BYVAL AccountNameFormat AS LONG , BYVAL DesiredNameFormat AS LONG , BYREF lpTranslatedName AS WSTRINGZ , BYREF nSize AS QUAD ) AS BYTE ' BOOLEAN
#IF %DEF(%UNICODE)
 MACRO TranslateName = TranslateNameW
#ELSE
 MACRO TranslateName = TranslateNameA
#ENDIF
#ENDIF
