libwin32
Version:
Node bindings to native Win32 DLLs through Koffi
53 lines • 2.52 kB
TypeScript
import { type LSA_HANDLE } from '../ctypes.js';
import { LSA_UNICODE_STRING, type SID, type LSA_TRANSLATED_SID2, type LSA_REFERENCED_DOMAIN_LIST } from '../structs.js';
import { NTSTATUS_, LSA_LOOKUP, POLICY_ } from '../consts.js';
export interface LsaLookupNames2Result {
sids: LSA_TRANSLATED_SID2[];
domains: LSA_REFERENCED_DOMAIN_LIST;
}
/**
* Closes a handle to a Policy or TrustedDomain object.
*
* https://learn.microsoft.com/en-us/windows/win32/api/ntsecapi/nf-ntsecapi-lsaclose
*/
export declare function LsaClose(objectHandle: LSA_HANDLE): NTSTATUS_;
/**
* Enumerates the privileges assigned to an account.
*
* You must run the process "As Administrator" so that the call doesn't fail with ERROR_ACCESS_DENIED.
*
* https://learn.microsoft.com/en-us/windows/win32/api/ntsecapi/nf-ntsecapi-lsaenumerateaccountrights
*/
export declare function LsaEnumerateAccountRights(policyHandle: LSA_HANDLE, accountSid: SID): LSA_UNICODE_STRING[] | NTSTATUS_;
/**
* Frees memory allocated for an output buffer by an LSA function call.
*
* Note: in libwin32, all LSA functions free the allocated memory, so this function is a NOOP.
*
* https://learn.microsoft.com/en-us/windows/win32/api/ntsecapi/nf-ntsecapi-lsafreememory
*/
export declare function LsaFreeMemory(buffer: unknown): NTSTATUS_;
/**
* Retrieves the security identifiers (SIDs) for specified account names in any domain in a Windows forest.
*
* Notes:
* - in libwin32, LsaLookupNames2 accepts 1 to 8 names max.
* - any memory allocated by the system is immediately returned to the system. The net effect is that you don't need
* to call {@link LsaFreeMemory()} afterwards (which is a NOOP anyway).
*
* https://learn.microsoft.com/en-us/windows/win32/api/ntsecapi/nf-ntsecapi-lsalookupnames2
*/
export declare function LsaLookupNames2(policyHandle: LSA_HANDLE, flags: LSA_LOOKUP, ...names: string[]): LsaLookupNames2Result | NTSTATUS_;
/**
* Converts an NTSTATUS code returned by an LSA function to a Windows error code.
*
* https://learn.microsoft.com/en-us/windows/win32/api/ntsecapi/nf-ntsecapi-lsantstatustowinerror
*/
export declare function LsaNtStatusToWinError(status: NTSTATUS_ | number): number;
/**
* Opens a handle to the Policy object on a local or remote system.
*
* https://learn.microsoft.com/en-us/windows/win32/api/ntsecapi/nf-ntsecapi-lsaopenpolicy
*/
export declare function LsaOpenPolicy(systemName: string | null, desiredAcces: POLICY_): LSA_HANDLE | NTSTATUS_;
//# sourceMappingURL=lsa.d.ts.map