ReactOS 0.4.16-dev-1946-g52006dd
alias.c File Reference
#include <k32.h>
#include <debug.h>
Include dependency graph for alias.c:

Go to the source code of this file.

Macros

#define NDEBUG
 

Functions

static BOOL IntAddConsoleAlias (LPCVOID Source, USHORT SourceBufferLength, LPCVOID Target, USHORT TargetBufferLength, LPCVOID ExeName, BOOLEAN bUnicode)
 
BOOL WINAPI DECLSPEC_HOTPATCH AddConsoleAliasW (_In_ LPCWSTR Source, _In_ LPCWSTR Target, _In_ LPCWSTR ExeName)
 
BOOL WINAPI DECLSPEC_HOTPATCH AddConsoleAliasA (_In_ LPCSTR Source, _In_ LPCSTR Target, _In_ LPCSTR ExeName)
 
static DWORD IntGetConsoleAlias (LPCVOID Source, USHORT SourceBufferLength, LPVOID Target, USHORT TargetBufferLength, LPCVOID ExeName, BOOLEAN bUnicode)
 
DWORD WINAPI DECLSPEC_HOTPATCH GetConsoleAliasW (_In_ LPCWSTR Source, _Out_writes_(TargetBufferLength) LPWSTR TargetBuffer, _In_ DWORD TargetBufferLength, _In_ LPCWSTR ExeName)
 
DWORD WINAPI DECLSPEC_HOTPATCH GetConsoleAliasA (_In_ LPCSTR Source, _Out_writes_(TargetBufferLength) LPSTR TargetBuffer, _In_ DWORD TargetBufferLength, _In_ LPCSTR ExeName)
 
static DWORD IntGetConsoleAliases (LPVOID AliasBuffer, DWORD AliasBufferLength, LPCVOID ExeName, BOOLEAN bUnicode)
 
DWORD WINAPI DECLSPEC_HOTPATCH GetConsoleAliasesW (_Out_writes_(AliasBufferLength) LPWSTR AliasBuffer, _In_ DWORD AliasBufferLength, _In_ LPCWSTR ExeName)
 
DWORD WINAPI DECLSPEC_HOTPATCH GetConsoleAliasesA (_Out_writes_(AliasBufferLength) LPSTR AliasBuffer, _In_ DWORD AliasBufferLength, _In_ LPCSTR ExeName)
 
static DWORD IntGetConsoleAliasesLength (LPCVOID ExeName, BOOLEAN bUnicode)
 
DWORD WINAPI DECLSPEC_HOTPATCH GetConsoleAliasesLengthW (_In_ LPCWSTR ExeName)
 
DWORD WINAPI DECLSPEC_HOTPATCH GetConsoleAliasesLengthA (_In_ LPCSTR ExeName)
 
static DWORD IntGetConsoleAliasExes (PVOID lpExeNameBuffer, DWORD ExeNameBufferLength, BOOLEAN bUnicode)
 
DWORD WINAPI DECLSPEC_HOTPATCH GetConsoleAliasExesW (LPWSTR lpExeNameBuffer, DWORD ExeNameBufferLength)
 
DWORD WINAPI DECLSPEC_HOTPATCH GetConsoleAliasExesA (LPSTR lpExeNameBuffer, DWORD ExeNameBufferLength)
 
static DWORD IntGetConsoleAliasExesLength (BOOLEAN bUnicode)
 
DWORD WINAPI DECLSPEC_HOTPATCH GetConsoleAliasExesLengthW (VOID)
 
DWORD WINAPI DECLSPEC_HOTPATCH GetConsoleAliasExesLengthA (VOID)
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 15 of file alias.c.

Function Documentation

◆ AddConsoleAliasA()

BOOL WINAPI DECLSPEC_HOTPATCH AddConsoleAliasA ( _In_ LPCSTR  Source,
_In_ LPCSTR  Target,
_In_ LPCSTR  ExeName 
)

Definition at line 146 of file alias.c.

150{
151 USHORT SourceBufferLength = (USHORT)strlen(Source) * sizeof(CHAR);
152 USHORT TargetBufferLength = (USHORT)(Target ? strlen(Target) * sizeof(CHAR) : 0);
153
154 DPRINT("AddConsoleAliasA entered with Source '%s' Target '%s' ExeName '%s'\n",
155 Source, Target, ExeName);
156
158 SourceBufferLength,
159 Target,
160 TargetBufferLength,
161 ExeName,
162 FALSE);
163}
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
#define CHAR(Char)
#define FALSE
Definition: types.h:117
static BOOL IntAddConsoleAlias(LPCVOID Source, USHORT SourceBufferLength, LPCVOID Target, USHORT TargetBufferLength, LPCVOID ExeName, BOOLEAN bUnicode)
Definition: alias.c:22
_In_ UINT _In_ UINT _In_ PNDIS_PACKET Source
Definition: ndis.h:3169
unsigned short USHORT
Definition: pedump.c:61
#define DPRINT
Definition: sndvol32.h:73
_In_ WDFIOTARGET Target
Definition: wdfrequest.h:306

◆ AddConsoleAliasW()

BOOL WINAPI DECLSPEC_HOTPATCH AddConsoleAliasW ( _In_ LPCWSTR  Source,
_In_ LPCWSTR  Target,
_In_ LPCWSTR  ExeName 
)

Definition at line 120 of file alias.c.

124{
125 USHORT SourceBufferLength = (USHORT)wcslen(Source) * sizeof(WCHAR);
126 USHORT TargetBufferLength = (USHORT)(Target ? wcslen(Target) * sizeof(WCHAR) : 0);
127
128 DPRINT("AddConsoleAliasW entered with Source '%S' Target '%S' ExeName '%S'\n",
129 Source, Target, ExeName);
130
132 SourceBufferLength,
133 Target,
134 TargetBufferLength,
135 ExeName,
136 TRUE);
137}
#define TRUE
Definition: types.h:120
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by SetMacro().

◆ GetConsoleAliasA()

DWORD WINAPI DECLSPEC_HOTPATCH GetConsoleAliasA ( _In_ LPCSTR  Source,
_Out_writes_(TargetBufferLength) LPSTR  TargetBuffer,
_In_ DWORD  TargetBufferLength,
_In_ LPCSTR  ExeName 
)

Definition at line 286 of file alias.c.

291{
292 DPRINT("GetConsoleAliasA entered with Source '%s' ExeName '%s'\n",
293 Source, ExeName);
294
296 (USHORT)strlen(Source) * sizeof(CHAR),
297 TargetBuffer,
298 TargetBufferLength,
299 ExeName,
300 FALSE);
301}
static DWORD IntGetConsoleAlias(LPCVOID Source, USHORT SourceBufferLength, LPVOID Target, USHORT TargetBufferLength, LPCVOID ExeName, BOOLEAN bUnicode)
Definition: alias.c:167
char CHAR
Definition: xmlstorage.h:175

◆ GetConsoleAliasesA()

DWORD WINAPI DECLSPEC_HOTPATCH GetConsoleAliasesA ( _Out_writes_(AliasBufferLength) LPSTR  AliasBuffer,
_In_ DWORD  AliasBufferLength,
_In_ LPCSTR  ExeName 
)

Definition at line 401 of file alias.c.

405{
406 DPRINT("GetConsoleAliasesA entered with ExeName '%s'\n",
407 ExeName);
408
409 return IntGetConsoleAliases(AliasBuffer,
410 AliasBufferLength,
411 ExeName,
412 FALSE);
413}
static DWORD IntGetConsoleAliases(LPVOID AliasBuffer, DWORD AliasBufferLength, LPCVOID ExeName, BOOLEAN bUnicode)
Definition: alias.c:305

◆ GetConsoleAliasesLengthA()

DWORD WINAPI DECLSPEC_HOTPATCH GetConsoleAliasesLengthA ( _In_ LPCSTR  ExeName)

Definition at line 485 of file alias.c.

487{
488 return IntGetConsoleAliasesLength(ExeName, FALSE);
489}
static DWORD IntGetConsoleAliasesLength(LPCVOID ExeName, BOOLEAN bUnicode)
Definition: alias.c:417

◆ GetConsoleAliasesLengthW()

DWORD WINAPI DECLSPEC_HOTPATCH GetConsoleAliasesLengthW ( _In_ LPCWSTR  ExeName)

Definition at line 472 of file alias.c.

474{
475 return IntGetConsoleAliasesLength(ExeName, TRUE);
476}

Referenced by PrintMacros().

◆ GetConsoleAliasesW()

DWORD WINAPI DECLSPEC_HOTPATCH GetConsoleAliasesW ( _Out_writes_(AliasBufferLength) LPWSTR  AliasBuffer,
_In_ DWORD  AliasBufferLength,
_In_ LPCWSTR  ExeName 
)

Definition at line 380 of file alias.c.

384{
385 DPRINT("GetConsoleAliasesW entered with ExeName '%S'\n",
386 ExeName);
387
388 return IntGetConsoleAliases(AliasBuffer,
389 AliasBufferLength,
390 ExeName,
391 TRUE);
392}

Referenced by PrintMacros().

◆ GetConsoleAliasExesA()

DWORD WINAPI DECLSPEC_HOTPATCH GetConsoleAliasExesA ( LPSTR  lpExeNameBuffer,
DWORD  ExeNameBufferLength 
)

Definition at line 557 of file alias.c.

559{
560 DPRINT("GetConsoleAliasExesA called\n");
561 return IntGetConsoleAliasExes(lpExeNameBuffer, ExeNameBufferLength, FALSE);
562}
static DWORD IntGetConsoleAliasExes(PVOID lpExeNameBuffer, DWORD ExeNameBufferLength, BOOLEAN bUnicode)
Definition: alias.c:493

◆ GetConsoleAliasExesLengthA()

DWORD WINAPI DECLSPEC_HOTPATCH GetConsoleAliasExesLengthA ( VOID  )

Definition at line 607 of file alias.c.

608{
609 DPRINT("GetConsoleAliasExesLengthA called\n");
611}
static DWORD IntGetConsoleAliasExesLength(BOOLEAN bUnicode)
Definition: alias.c:566

◆ GetConsoleAliasExesLengthW()

DWORD WINAPI DECLSPEC_HOTPATCH GetConsoleAliasExesLengthW ( VOID  )

Definition at line 594 of file alias.c.

595{
596 DPRINT("GetConsoleAliasExesLengthW called\n");
598}

◆ GetConsoleAliasExesW()

DWORD WINAPI DECLSPEC_HOTPATCH GetConsoleAliasExesW ( LPWSTR  lpExeNameBuffer,
DWORD  ExeNameBufferLength 
)

Definition at line 543 of file alias.c.

545{
546 DPRINT("GetConsoleAliasExesW called\n");
547 return IntGetConsoleAliasExes(lpExeNameBuffer, ExeNameBufferLength, TRUE);
548}

Referenced by PrintAllMacros().

◆ GetConsoleAliasW()

DWORD WINAPI DECLSPEC_HOTPATCH GetConsoleAliasW ( _In_ LPCWSTR  Source,
_Out_writes_(TargetBufferLength) LPWSTR  TargetBuffer,
_In_ DWORD  TargetBufferLength,
_In_ LPCWSTR  ExeName 
)

Definition at line 262 of file alias.c.

267{
268 DPRINT("GetConsoleAliasW entered with Source '%S' ExeName '%S'\n",
269 Source, ExeName);
270
272 (USHORT)wcslen(Source) * sizeof(WCHAR),
273 TargetBuffer,
274 TargetBufferLength,
275 ExeName,
276 TRUE);
277}

◆ IntAddConsoleAlias()

static BOOL IntAddConsoleAlias ( LPCVOID  Source,
USHORT  SourceBufferLength,
LPCVOID  Target,
USHORT  TargetBufferLength,
LPCVOID  ExeName,
BOOLEAN  bUnicode 
)
static

Definition at line 22 of file alias.c.

28{
29 CONSOLE_API_MESSAGE ApiMessage;
30 PCONSOLE_ADDGETALIAS ConsoleAliasRequest = &ApiMessage.Data.ConsoleAliasRequest;
31 PCSR_CAPTURE_BUFFER CaptureBuffer;
32 ULONG CapturedStrings;
33
34 USHORT NumChars = (USHORT)(ExeName ? (bUnicode ? wcslen(ExeName) : strlen(ExeName)) : 0);
35
36 if (ExeName == NULL || NumChars == 0)
37 {
39 return FALSE;
40 }
41
42 ConsoleAliasRequest->ConsoleHandle = NtCurrentPeb()->ProcessParameters->ConsoleHandle;
43
44 /* Determine the needed sizes */
45 ConsoleAliasRequest->SourceLength = SourceBufferLength;
46 ConsoleAliasRequest->ExeLength = NumChars * (bUnicode ? sizeof(WCHAR) : sizeof(CHAR));
47 ConsoleAliasRequest->Unicode =
48 ConsoleAliasRequest->Unicode2 = bUnicode;
49
50 CapturedStrings = 2;
51
52 if (Target) /* The target can be optional */
53 {
54 ConsoleAliasRequest->TargetLength = TargetBufferLength;
55 CapturedStrings++;
56 }
57 else
58 {
59 ConsoleAliasRequest->TargetLength = 0;
60 }
61
62 /* Allocate a Capture Buffer */
63 CaptureBuffer = CsrAllocateCaptureBuffer(CapturedStrings,
64 ConsoleAliasRequest->SourceLength +
65 ConsoleAliasRequest->ExeLength +
66 ConsoleAliasRequest->TargetLength);
67 if (CaptureBuffer == NULL)
68 {
69 DPRINT1("CsrAllocateCaptureBuffer failed!\n");
71 return FALSE;
72 }
73
74 /* Capture the strings */
75 CsrCaptureMessageBuffer(CaptureBuffer,
77 ConsoleAliasRequest->SourceLength,
78 (PVOID*)&ConsoleAliasRequest->Source);
79
80 CsrCaptureMessageBuffer(CaptureBuffer,
81 (PVOID)ExeName,
82 ConsoleAliasRequest->ExeLength,
83 (PVOID*)&ConsoleAliasRequest->ExeName);
84
85 if (Target) /* The target can be optional */
86 {
87 CsrCaptureMessageBuffer(CaptureBuffer,
89 ConsoleAliasRequest->TargetLength,
90 (PVOID*)&ConsoleAliasRequest->Target);
91 }
92 else
93 {
94 ConsoleAliasRequest->Target = NULL;
95 }
96
98 CaptureBuffer,
100 sizeof(*ConsoleAliasRequest));
101
102 CsrFreeCaptureBuffer(CaptureBuffer);
103
104 if (!NT_SUCCESS(ApiMessage.Status))
105 {
106 BaseSetLastNTError(ApiMessage.Status);
107 return FALSE;
108 }
109
110 return TRUE;
111}
#define NtCurrentPeb()
Definition: FLS.c:22
#define DPRINT1
Definition: precomp.h:8
@ ConsolepAddAlias
Definition: conmsg.h:73
#define CONSRV_SERVERDLL_INDEX
Definition: conmsg.h:15
#define CSR_CREATE_API_NUMBER(ServerId, ApiId)
Definition: csrmsg.h:37
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
#define NULL
Definition: types.h:112
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:33
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
#define SetLastError(x)
Definition: compat.h:752
DWORD BaseSetLastNTError(IN NTSTATUS Status)
Definition: reactos.cpp:167
PCSR_CAPTURE_BUFFER NTAPI CsrAllocateCaptureBuffer(_In_ ULONG ArgumentCount, _In_ ULONG BufferSize)
Definition: capture.c:87
VOID NTAPI CsrFreeCaptureBuffer(_In_ _Frees_ptr_ PCSR_CAPTURE_BUFFER CaptureBuffer)
Definition: capture.c:210
VOID NTAPI CsrCaptureMessageBuffer(_Inout_ PCSR_CAPTURE_BUFFER CaptureBuffer, _In_opt_ PVOID MessageBuffer, _In_ ULONG MessageLength, _Out_ PVOID *CapturedData)
Definition: capture.c:189
NTSTATUS NTAPI CsrClientCallServer(_Inout_ PCSR_API_MESSAGE ApiMessage, _Inout_opt_ PCSR_CAPTURE_BUFFER CaptureBuffer, _In_ CSR_API_NUMBER ApiNumber, _In_ ULONG DataLength)
Definition: connect.c:366
HANDLE ConsoleHandle
Definition: conmsg.h:730
USHORT TargetLength
Definition: conmsg.h:732
USHORT SourceLength
Definition: conmsg.h:731
BOOLEAN Unicode2
Definition: conmsg.h:738
CONSOLE_ADDGETALIAS ConsoleAliasRequest
Definition: conmsg.h:999
union _CONSOLE_API_MESSAGE::@3738 Data
NTSTATUS Status
Definition: csrmsg.h:110
uint32_t ULONG
Definition: typedefs.h:59

Referenced by AddConsoleAliasA(), and AddConsoleAliasW().

◆ IntGetConsoleAlias()

static DWORD IntGetConsoleAlias ( LPCVOID  Source,
USHORT  SourceBufferLength,
LPVOID  Target,
USHORT  TargetBufferLength,
LPCVOID  ExeName,
BOOLEAN  bUnicode 
)
static

Definition at line 167 of file alias.c.

173{
174 CONSOLE_API_MESSAGE ApiMessage;
175 PCONSOLE_ADDGETALIAS ConsoleAliasRequest = &ApiMessage.Data.ConsoleAliasRequest;
176 PCSR_CAPTURE_BUFFER CaptureBuffer;
177
178 USHORT NumChars = (USHORT)(ExeName ? (bUnicode ? wcslen(ExeName) : strlen(ExeName)) : 0);
179
180 if (Source == NULL || Target == NULL)
181 {
183 return 0;
184 }
185
186 if (ExeName == NULL || NumChars == 0)
187 {
189 return 0;
190 }
191
192 ConsoleAliasRequest->ConsoleHandle = NtCurrentPeb()->ProcessParameters->ConsoleHandle;
193
194 /* Determine the needed sizes */
195 ConsoleAliasRequest->SourceLength = SourceBufferLength;
196 ConsoleAliasRequest->ExeLength = NumChars * (bUnicode ? sizeof(WCHAR) : sizeof(CHAR));
197 ConsoleAliasRequest->Unicode =
198 ConsoleAliasRequest->Unicode2 = bUnicode;
199
200 ConsoleAliasRequest->TargetLength = TargetBufferLength;
201
202 /* Allocate a Capture Buffer */
203 CaptureBuffer = CsrAllocateCaptureBuffer(3, ConsoleAliasRequest->SourceLength +
204 ConsoleAliasRequest->ExeLength +
205 ConsoleAliasRequest->TargetLength);
206 if (!CaptureBuffer)
207 {
208 DPRINT1("CsrAllocateCaptureBuffer failed!\n");
210 return 0;
211 }
212
213 /* Capture the strings */
214 CsrCaptureMessageBuffer(CaptureBuffer,
215 (PVOID)Source,
216 ConsoleAliasRequest->SourceLength,
217 (PVOID*)&ConsoleAliasRequest->Source);
218
219 CsrCaptureMessageBuffer(CaptureBuffer,
220 (PVOID)ExeName,
221 ConsoleAliasRequest->ExeLength,
222 (PVOID*)&ConsoleAliasRequest->ExeName);
223
224 /* Allocate space for the target buffer */
225 CsrAllocateMessagePointer(CaptureBuffer,
226 ConsoleAliasRequest->TargetLength,
227 (PVOID*)&ConsoleAliasRequest->Target);
228
230 CaptureBuffer,
232 sizeof(*ConsoleAliasRequest));
233 if (!NT_SUCCESS(ApiMessage.Status))
234 {
235 CsrFreeCaptureBuffer(CaptureBuffer);
236 BaseSetLastNTError(ApiMessage.Status);
237
238 if (ApiMessage.Status == STATUS_BUFFER_TOO_SMALL)
239 return ConsoleAliasRequest->TargetLength;
240 else
241 return 0;
242 }
243
244 /* Copy the returned target string into the user buffer */
246 ConsoleAliasRequest->Target,
247 ConsoleAliasRequest->TargetLength);
248
249 /* Release the capture buffer and exit */
250 CsrFreeCaptureBuffer(CaptureBuffer);
251
252 return ConsoleAliasRequest->TargetLength;
253}
@ ConsolepGetAlias
Definition: conmsg.h:74
ULONG NTAPI CsrAllocateMessagePointer(_Inout_ PCSR_CAPTURE_BUFFER CaptureBuffer, _In_ ULONG MessageLength, _Out_ PVOID *CapturedData)
Definition: capture.c:152
#define STATUS_BUFFER_TOO_SMALL
Definition: shellext.h:69
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263

Referenced by GetConsoleAliasA(), and GetConsoleAliasW().

◆ IntGetConsoleAliases()

static DWORD IntGetConsoleAliases ( LPVOID  AliasBuffer,
DWORD  AliasBufferLength,
LPCVOID  ExeName,
BOOLEAN  bUnicode 
)
static

Definition at line 305 of file alias.c.

309{
310 CONSOLE_API_MESSAGE ApiMessage;
311 PCONSOLE_GETALLALIASES GetAllAliasesRequest = &ApiMessage.Data.GetAllAliasesRequest;
312 PCSR_CAPTURE_BUFFER CaptureBuffer;
313
314 USHORT NumChars = (USHORT)(ExeName ? (bUnicode ? wcslen(ExeName) : strlen(ExeName)) : 0);
315
316 if (ExeName == NULL || NumChars == 0)
317 {
319 return 0;
320 }
321
322 GetAllAliasesRequest->ConsoleHandle = NtCurrentPeb()->ProcessParameters->ConsoleHandle;
323
324 /* Determine the needed sizes */
325 GetAllAliasesRequest->ExeLength = NumChars * (bUnicode ? sizeof(WCHAR) : sizeof(CHAR));
326 GetAllAliasesRequest->Unicode =
327 GetAllAliasesRequest->Unicode2 = bUnicode;
328
329 GetAllAliasesRequest->AliasesBufferLength = AliasBufferLength;
330
331 /* Allocate a Capture Buffer */
332 CaptureBuffer = CsrAllocateCaptureBuffer(2, GetAllAliasesRequest->ExeLength +
333 GetAllAliasesRequest->AliasesBufferLength);
334 if (!CaptureBuffer)
335 {
336 DPRINT1("CsrAllocateCaptureBuffer failed!\n");
338 return 0;
339 }
340
341 /* Capture the exe name and allocate space for the aliases buffer */
342 CsrCaptureMessageBuffer(CaptureBuffer,
343 (PVOID)ExeName,
344 GetAllAliasesRequest->ExeLength,
345 (PVOID*)&GetAllAliasesRequest->ExeName);
346
347 CsrAllocateMessagePointer(CaptureBuffer,
348 GetAllAliasesRequest->AliasesBufferLength,
349 (PVOID*)&GetAllAliasesRequest->AliasesBuffer);
350
352 CaptureBuffer,
354 sizeof(*GetAllAliasesRequest));
355 if (!NT_SUCCESS(ApiMessage.Status))
356 {
357 CsrFreeCaptureBuffer(CaptureBuffer);
358 BaseSetLastNTError(ApiMessage.Status);
359 return 0;
360 }
361
362 /* Copy the returned aliases string into the user buffer */
363 RtlCopyMemory(AliasBuffer,
364 GetAllAliasesRequest->AliasesBuffer,
365 GetAllAliasesRequest->AliasesBufferLength);
366
367 /* Release the capture buffer and exit */
368 CsrFreeCaptureBuffer(CaptureBuffer);
369
370 return GetAllAliasesRequest->AliasesBufferLength;
371}
@ ConsolepGetAliases
Definition: conmsg.h:77
CONSOLE_GETALLALIASES GetAllAliasesRequest
Definition: conmsg.h:1000
ULONG AliasesBufferLength
Definition: conmsg.h:748

Referenced by GetConsoleAliasesA(), and GetConsoleAliasesW().

◆ IntGetConsoleAliasesLength()

static DWORD IntGetConsoleAliasesLength ( LPCVOID  ExeName,
BOOLEAN  bUnicode 
)
static

Definition at line 417 of file alias.c.

418{
419 CONSOLE_API_MESSAGE ApiMessage;
420 PCONSOLE_GETALLALIASESLENGTH GetAllAliasesLengthRequest = &ApiMessage.Data.GetAllAliasesLengthRequest;
421 PCSR_CAPTURE_BUFFER CaptureBuffer;
422
423 USHORT NumChars = (USHORT)(ExeName ? (bUnicode ? wcslen(ExeName) : strlen(ExeName)) : 0);
424
425 if (ExeName == NULL || NumChars == 0)
426 {
428 return 0;
429 }
430
431 GetAllAliasesLengthRequest->ConsoleHandle = NtCurrentPeb()->ProcessParameters->ConsoleHandle;
432 GetAllAliasesLengthRequest->ExeLength = NumChars * (bUnicode ? sizeof(WCHAR) : sizeof(CHAR));
433 GetAllAliasesLengthRequest->Unicode =
434 GetAllAliasesLengthRequest->Unicode2 = bUnicode;
435
436 CaptureBuffer = CsrAllocateCaptureBuffer(1, GetAllAliasesLengthRequest->ExeLength);
437 if (!CaptureBuffer)
438 {
439 DPRINT1("CsrAllocateCaptureBuffer failed!\n");
441 return 0;
442 }
443
444 CsrCaptureMessageBuffer(CaptureBuffer,
445 (PVOID)ExeName,
446 GetAllAliasesLengthRequest->ExeLength,
447 (PVOID)&GetAllAliasesLengthRequest->ExeName);
448
450 CaptureBuffer,
452 sizeof(*GetAllAliasesLengthRequest));
453
454 CsrFreeCaptureBuffer(CaptureBuffer);
455
456 if (!NT_SUCCESS(ApiMessage.Status))
457 {
458 BaseSetLastNTError(ApiMessage.Status);
459 return 0;
460 }
461
462 return GetAllAliasesLengthRequest->Length;
463}
@ ConsolepGetAliasesLength
Definition: conmsg.h:75
CONSOLE_GETALLALIASESLENGTH GetAllAliasesLengthRequest
Definition: conmsg.h:1001

Referenced by GetConsoleAliasesLengthA(), and GetConsoleAliasesLengthW().

◆ IntGetConsoleAliasExes()

static DWORD IntGetConsoleAliasExes ( PVOID  lpExeNameBuffer,
DWORD  ExeNameBufferLength,
BOOLEAN  bUnicode 
)
static

Definition at line 493 of file alias.c.

496{
497 CONSOLE_API_MESSAGE ApiMessage;
498 PCONSOLE_GETALIASESEXES GetAliasesExesRequest = &ApiMessage.Data.GetAliasesExesRequest;
499 PCSR_CAPTURE_BUFFER CaptureBuffer;
500
501 GetAliasesExesRequest->ConsoleHandle = NtCurrentPeb()->ProcessParameters->ConsoleHandle;
502 GetAliasesExesRequest->Length = ExeNameBufferLength;
503 GetAliasesExesRequest->Unicode = bUnicode;
504
505 CaptureBuffer = CsrAllocateCaptureBuffer(1, ExeNameBufferLength);
506 if (!CaptureBuffer)
507 {
508 DPRINT1("CsrAllocateCaptureBuffer failed!\n");
510 return 0;
511 }
512
513 CsrAllocateMessagePointer(CaptureBuffer,
514 ExeNameBufferLength,
515 (PVOID*)&GetAliasesExesRequest->ExeNames);
516
518 CaptureBuffer,
520 sizeof(*GetAliasesExesRequest));
521 if (!NT_SUCCESS(ApiMessage.Status))
522 {
523 CsrFreeCaptureBuffer(CaptureBuffer);
524 BaseSetLastNTError(ApiMessage.Status);
525 return 0;
526 }
527
528 RtlCopyMemory(lpExeNameBuffer,
529 GetAliasesExesRequest->ExeNames,
530 GetAliasesExesRequest->Length);
531
532 CsrFreeCaptureBuffer(CaptureBuffer);
533
534 return GetAliasesExesRequest->Length;
535}
@ ConsolepGetAliasExes
Definition: conmsg.h:78
CONSOLE_GETALIASESEXES GetAliasesExesRequest
Definition: conmsg.h:1002

Referenced by GetConsoleAliasExesA(), and GetConsoleAliasExesW().

◆ IntGetConsoleAliasExesLength()

static DWORD IntGetConsoleAliasExesLength ( BOOLEAN  bUnicode)
static

Definition at line 566 of file alias.c.

567{
568 CONSOLE_API_MESSAGE ApiMessage;
569 PCONSOLE_GETALIASESEXESLENGTH GetAliasesExesLengthRequest = &ApiMessage.Data.GetAliasesExesLengthRequest;
570
571 GetAliasesExesLengthRequest->ConsoleHandle = NtCurrentPeb()->ProcessParameters->ConsoleHandle;
572 GetAliasesExesLengthRequest->Unicode = bUnicode;
573
575 NULL,
577 sizeof(*GetAliasesExesLengthRequest));
578 if (!NT_SUCCESS(ApiMessage.Status))
579 {
580 BaseSetLastNTError(ApiMessage.Status);
581 return 0;
582 }
583
584 return GetAliasesExesLengthRequest->Length;
585}
@ ConsolepGetAliasExesLength
Definition: conmsg.h:76
CONSOLE_GETALIASESEXESLENGTH GetAliasesExesLengthRequest
Definition: conmsg.h:1003

Referenced by GetConsoleAliasExesLengthA(), and GetConsoleAliasExesLengthW().