xref: /reactos/dll/win32/msv1_0/ntlm/util.h (revision 99dcd6f7)
1*99dcd6f7SAndreas Maier /*
2*99dcd6f7SAndreas Maier  * PROJECT:     Authentication Package DLL
3*99dcd6f7SAndreas Maier  * LICENSE:     GPL-2.0-or-later (https://spdx.org/licenses/GPL-2.0-or-later)
4*99dcd6f7SAndreas Maier  * PURPOSE:     Utils for msv1_0 (header)
5*99dcd6f7SAndreas Maier  * COPYRIGHT:   Copyright 2011 Samuel Serapión
6*99dcd6f7SAndreas Maier  *              Copyright 2020 Andreas Maier <staubim@quantentunnel.de>
7*99dcd6f7SAndreas Maier  */
8*99dcd6f7SAndreas Maier 
9*99dcd6f7SAndreas Maier #pragma once
10*99dcd6f7SAndreas Maier 
11*99dcd6f7SAndreas Maier bool
12*99dcd6f7SAndreas Maier NtlmUStrAlloc(
13*99dcd6f7SAndreas Maier     _Out_ PUNICODE_STRING Dst,
14*99dcd6f7SAndreas Maier     _In_ UINT16 SizeInBytes,
15*99dcd6f7SAndreas Maier     _In_ UINT16 InitLength);
16*99dcd6f7SAndreas Maier 
17*99dcd6f7SAndreas Maier VOID
18*99dcd6f7SAndreas Maier NtlmUStrFree(
19*99dcd6f7SAndreas Maier     _In_ PUNICODE_STRING String);
20*99dcd6f7SAndreas Maier 
21*99dcd6f7SAndreas Maier bool
22*99dcd6f7SAndreas Maier NtlmUStrWriteToStruct(
23*99dcd6f7SAndreas Maier     _In_ PVOID DataStart,
24*99dcd6f7SAndreas Maier     _In_ ULONG DataSize,
25*99dcd6f7SAndreas Maier     _Out_ PUNICODE_STRING DstData,
26*99dcd6f7SAndreas Maier     _In_ const PUNICODE_STRING SrcData,
27*99dcd6f7SAndreas Maier     _In_ OUT PBYTE* AbsoluteOffsetPtr,
28*99dcd6f7SAndreas Maier     _In_ bool TerminateWith0);
29*99dcd6f7SAndreas Maier 
30*99dcd6f7SAndreas Maier /* misc */
31*99dcd6f7SAndreas Maier bool
32*99dcd6f7SAndreas Maier NtlmFixupAndValidateUStr(
33*99dcd6f7SAndreas Maier     _Inout_ PUNICODE_STRING String,
34*99dcd6f7SAndreas Maier     _In_ ULONG_PTR FixupOffset);
35*99dcd6f7SAndreas Maier 
36*99dcd6f7SAndreas Maier bool
37*99dcd6f7SAndreas Maier NtlmFixupAStr(
38*99dcd6f7SAndreas Maier     _Inout_ PSTRING String,
39*99dcd6f7SAndreas Maier     _In_ ULONG_PTR FixupOffset);
40*99dcd6f7SAndreas Maier 
41*99dcd6f7SAndreas Maier /* ClientBuffer */
42*99dcd6f7SAndreas Maier typedef struct _NTLM_CLIENT_BUFFER
43*99dcd6f7SAndreas Maier {
44*99dcd6f7SAndreas Maier     PVOID ClientBaseAddress;
45*99dcd6f7SAndreas Maier     PVOID LocalBuffer;
46*99dcd6f7SAndreas Maier } NTLM_CLIENT_BUFFER, *PNTLM_CLIENT_BUFFER;
47*99dcd6f7SAndreas Maier 
48*99dcd6f7SAndreas Maier NTSTATUS
49*99dcd6f7SAndreas Maier NtlmAllocateClientBuffer(
50*99dcd6f7SAndreas Maier     _In_ PLSA_CLIENT_REQUEST ClientRequest,
51*99dcd6f7SAndreas Maier     _In_ ULONG BufferLength,
52*99dcd6f7SAndreas Maier     _Inout_ PNTLM_CLIENT_BUFFER Buffer);
53*99dcd6f7SAndreas Maier 
54*99dcd6f7SAndreas Maier NTSTATUS
55*99dcd6f7SAndreas Maier NtlmCopyToClientBuffer(
56*99dcd6f7SAndreas Maier     _In_ PLSA_CLIENT_REQUEST ClientRequest,
57*99dcd6f7SAndreas Maier     _In_ ULONG BufferLength,
58*99dcd6f7SAndreas Maier     _In_ OUT PNTLM_CLIENT_BUFFER Buffer);
59*99dcd6f7SAndreas Maier 
60*99dcd6f7SAndreas Maier VOID
61*99dcd6f7SAndreas Maier NtlmFreeClientBuffer(
62*99dcd6f7SAndreas Maier     _In_ PLSA_CLIENT_REQUEST ClientRequest,
63*99dcd6f7SAndreas Maier     _In_ bool FreeClientBuffer,
64*99dcd6f7SAndreas Maier     _Inout_ PNTLM_CLIENT_BUFFER Buffer);
65