libwin32
Version:
Node bindings to native Win32 DLLs through Koffi
89 lines • 4.28 kB
TypeScript
import { type SID, type SID_IDENTIFIER_AUTHORITY } from '../structs.js';
import { type SID_NAME_USE } from '../consts.js';
export interface LookupAccountSidResult {
name: string;
referencedDomainName: string;
use: SID_NAME_USE;
}
/**
* Allocates and initializes a security identifier (SID) with up to eight sub-authorities.
*
* Notes:
* - in libwin32, there is no `nSubAuthorityCount` parameter, you simply pass 1 to 8 sub-authorities.
* - the allocated SID is immediately returned to the system by this function.
* The net effect is that you don't need to call {@link FreeSid()} afterwards (which is a NOOP anyway).
*
* https://learn.microsoft.com/en-us/windows/win32/api/securitybaseapi/nf-securitybaseapi-allocateandinitializesid
*/
export declare function AllocateAndInitializeSid(identifierAuthority: SID_IDENTIFIER_AUTHORITY, ...subAuthorities: number[]): SID | null;
/**
* The ConvertSidToStringSid function converts a security identifier (SID) to a string format suitable for display,
* storage, or transmission.
*
* https://learn.microsoft.com/en-us/windows/win32/api/sddl/nf-sddl-convertsidtostringsidw
*/
export declare function ConvertSidToStringSid(sid: SID): string | null;
/**
* The ConvertStringSidToSid function converts a string-format security identifier (SID) into a valid, functional SID.
*
* https://learn.microsoft.com/en-us/windows/win32/api/sddl/nf-sddl-convertstringsidtosidw
*/
export declare function ConvertStringSidToSid(stringSid: string): SID | null;
/**
* Copies a security identifier (SID).
*
* https://learn.microsoft.com/en-us/windows/win32/api/securitybaseapi/nf-securitybaseapi-copysid
*/
export declare function CopySid(sourceSid: SID): SID | null;
/**
* Creates a SID for predefined aliases.
*
* Note: libwin32 does not include the 100+ predefined types enumeration, see the complete list at
* https://learn.microsoft.com/en-us/windows/win32/api/winnt/ne-winnt-well_known_sid_type
*
* https://learn.microsoft.com/en-us/windows/win32/api/securitybaseapi/nf-securitybaseapi-createwellknownsid
*/
export declare function CreateWellKnownSid(wellKnownSidType: number, domainSid?: SID): SID | null;
/**
* Tests two security identifier (SID) values for equality.
*
* https://learn.microsoft.com/en-us/windows/win32/api/securitybaseapi/nf-securitybaseapi-equalsid
*/
export declare function EqualSid(sid1: SID, sid2: SID): boolean;
/**
* Frees a security identifier (SID) previously allocated by using the {@link AllocateAndInitializeSid} function.
*
* Note: in libwin32, `AllocateAndInitializeSid()` immediately frees the allocated memory, so this function is a NOOP.
*
* https://learn.microsoft.com/en-us/windows/win32/api/securitybaseapi/nf-securitybaseapi-freesid
*/
export declare function FreeSid(_sid: SID): void;
/**
* Returns the length, in bytes, of a valid security identifier.
*
* https://learn.microsoft.com/en-us/windows/win32/api/securitybaseapi/nf-securitybaseapi-getlengthsid
*/
export declare function GetLengthSid(sid: SID): number;
/**
* Compares a SID to a well-known SID and returns TRUE if they match.
*
* Note: libwin32 does not include the 100+ predefined types enumeration, see the complete list at
* https://learn.microsoft.com/en-us/windows/win32/api/winnt/ne-winnt-well_known_sid_type
*
* https://learn.microsoft.com/en-us/windows/win32/api/securitybaseapi/nf-securitybaseapi-iswellknownsid
*/
export declare function IsWellKnownSid(sid: SID, wellKnownSidType: number): boolean;
/**
* Retrieves the name of the account for a security identifier (SID) and the name of the domain where the account was found.
*
* https://learn.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-lookupaccountsidw
*/
export declare function LookupAccountSid(systemName: string | null, sid: SID): LookupAccountSidResult | null;
/**
* Retrieves the name of the account for the specified SID on the local machine.
* LookupAccountSidLocal is defined as a function that calls LookupAccountSid with null as the first parameter.
*
* https://learn.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-lookupaccountsidlocalw
*/
export declare function LookupAccountSidLocal(sid: SID): LookupAccountSidResult | null;
//# sourceMappingURL=sid.d.ts.map