ReactOS 0.4.15-dev-7906-g1b85a5f
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 lpExeName, BOOLEAN bUnicode)
 
BOOL WINAPI DECLSPEC_HOTPATCH AddConsoleAliasW (LPCWSTR lpSource, LPCWSTR lpTarget, LPCWSTR lpExeName)
 
BOOL WINAPI DECLSPEC_HOTPATCH AddConsoleAliasA (LPCSTR lpSource, LPCSTR lpTarget, LPCSTR lpExeName)
 
static DWORD IntGetConsoleAlias (LPVOID Source, USHORT SourceBufferLength, LPVOID Target, USHORT TargetBufferLength, LPVOID lpExeName, BOOLEAN bUnicode)
 
DWORD WINAPI DECLSPEC_HOTPATCH GetConsoleAliasW (LPWSTR lpSource, LPWSTR lpTargetBuffer, DWORD TargetBufferLength, LPWSTR lpExeName)
 
DWORD WINAPI DECLSPEC_HOTPATCH GetConsoleAliasA (LPSTR lpSource, LPSTR lpTargetBuffer, DWORD TargetBufferLength, LPSTR lpExeName)
 
static DWORD IntGetConsoleAliases (LPVOID AliasBuffer, DWORD AliasBufferLength, LPVOID lpExeName, BOOLEAN bUnicode)
 
DWORD WINAPI DECLSPEC_HOTPATCH GetConsoleAliasesW (LPWSTR AliasBuffer, DWORD AliasBufferLength, LPWSTR ExeName)
 
DWORD WINAPI DECLSPEC_HOTPATCH GetConsoleAliasesA (LPSTR AliasBuffer, DWORD AliasBufferLength, LPSTR ExeName)
 
static DWORD IntGetConsoleAliasesLength (LPVOID lpExeName, BOOLEAN bUnicode)
 
DWORD WINAPI DECLSPEC_HOTPATCH GetConsoleAliasesLengthW (LPWSTR lpExeName)
 
DWORD WINAPI DECLSPEC_HOTPATCH GetConsoleAliasesLengthA (LPSTR lpExeName)
 
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 ( LPCSTR  lpSource,
LPCSTR  lpTarget,
LPCSTR  lpExeName 
)

Definition at line 145 of file alias.c.

148{
149 USHORT SourceBufferLength = (USHORT)strlen(lpSource) * sizeof(CHAR);
150 USHORT TargetBufferLength = (USHORT)(lpTarget ? strlen(lpTarget) * sizeof(CHAR) : 0);
151
152 DPRINT("AddConsoleAliasA entered with lpSource '%s' lpTarget '%s' lpExeName '%s'\n",
153 lpSource, lpTarget, lpExeName);
154
155 return IntAddConsoleAlias(lpSource,
156 SourceBufferLength,
157 lpTarget,
158 TargetBufferLength,
159 lpExeName,
160 FALSE);
161}
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 lpExeName, BOOLEAN bUnicode)
Definition: alias.c:22
static DWORD LPSTR lpExeName
Definition: process.c:72
unsigned short USHORT
Definition: pedump.c:61
#define DPRINT
Definition: sndvol32.h:71

◆ AddConsoleAliasW()

BOOL WINAPI DECLSPEC_HOTPATCH AddConsoleAliasW ( LPCWSTR  lpSource,
LPCWSTR  lpTarget,
LPCWSTR  lpExeName 
)

Definition at line 120 of file alias.c.

123{
124 USHORT SourceBufferLength = (USHORT)wcslen(lpSource) * sizeof(WCHAR);
125 USHORT TargetBufferLength = (USHORT)(lpTarget ? wcslen(lpTarget) * sizeof(WCHAR) : 0);
126
127 DPRINT("AddConsoleAliasW entered with lpSource '%S' lpTarget '%S' lpExeName '%S'\n",
128 lpSource, lpTarget, lpExeName);
129
130 return IntAddConsoleAlias(lpSource,
131 SourceBufferLength,
132 lpTarget,
133 TargetBufferLength,
134 lpExeName,
135 TRUE);
136}
#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 ( LPSTR  lpSource,
LPSTR  lpTargetBuffer,
DWORD  TargetBufferLength,
LPSTR  lpExeName 
)

Definition at line 283 of file alias.c.

287{
288 DPRINT("GetConsoleAliasA entered with lpSource '%s' lpExeName '%s'\n",
289 lpSource, lpExeName);
290
291 return IntGetConsoleAlias(lpSource,
292 (USHORT)strlen(lpSource) * sizeof(CHAR),
293 lpTargetBuffer,
294 TargetBufferLength,
295 lpExeName,
296 FALSE);
297}
static DWORD IntGetConsoleAlias(LPVOID Source, USHORT SourceBufferLength, LPVOID Target, USHORT TargetBufferLength, LPVOID lpExeName, BOOLEAN bUnicode)
Definition: alias.c:165
char CHAR
Definition: xmlstorage.h:175

◆ GetConsoleAliasesA()

DWORD WINAPI DECLSPEC_HOTPATCH GetConsoleAliasesA ( LPSTR  AliasBuffer,
DWORD  AliasBufferLength,
LPSTR  ExeName 
)

Definition at line 396 of file alias.c.

399{
400 DPRINT("GetConsoleAliasesA entered with lpExeName '%s'\n",
401 ExeName);
402
403 return IntGetConsoleAliases(AliasBuffer,
404 AliasBufferLength,
405 ExeName,
406 FALSE);
407}
static DWORD IntGetConsoleAliases(LPVOID AliasBuffer, DWORD AliasBufferLength, LPVOID lpExeName, BOOLEAN bUnicode)
Definition: alias.c:301

◆ GetConsoleAliasesLengthA()

DWORD WINAPI DECLSPEC_HOTPATCH GetConsoleAliasesLengthA ( LPSTR  lpExeName)

Definition at line 478 of file alias.c.

479{
481}
static DWORD IntGetConsoleAliasesLength(LPVOID lpExeName, BOOLEAN bUnicode)
Definition: alias.c:411

◆ GetConsoleAliasesLengthW()

DWORD WINAPI DECLSPEC_HOTPATCH GetConsoleAliasesLengthW ( LPWSTR  lpExeName)

Definition at line 466 of file alias.c.

467{
469}

Referenced by PrintMacros().

◆ GetConsoleAliasesW()

DWORD WINAPI DECLSPEC_HOTPATCH GetConsoleAliasesW ( LPWSTR  AliasBuffer,
DWORD  AliasBufferLength,
LPWSTR  ExeName 
)

Definition at line 376 of file alias.c.

379{
380 DPRINT("GetConsoleAliasesW entered with lpExeName '%S'\n",
381 ExeName);
382
383 return IntGetConsoleAliases(AliasBuffer,
384 AliasBufferLength,
385 ExeName,
386 TRUE);
387}

Referenced by PrintMacros().

◆ GetConsoleAliasExesA()

DWORD WINAPI DECLSPEC_HOTPATCH GetConsoleAliasExesA ( LPSTR  lpExeNameBuffer,
DWORD  ExeNameBufferLength 
)

Definition at line 549 of file alias.c.

551{
552 DPRINT("GetConsoleAliasExesA called\n");
553 return IntGetConsoleAliasExes(lpExeNameBuffer, ExeNameBufferLength, FALSE);
554}
static DWORD IntGetConsoleAliasExes(PVOID lpExeNameBuffer, DWORD ExeNameBufferLength, BOOLEAN bUnicode)
Definition: alias.c:485

◆ GetConsoleAliasExesLengthA()

DWORD WINAPI DECLSPEC_HOTPATCH GetConsoleAliasExesLengthA ( VOID  )

Definition at line 599 of file alias.c.

600{
601 DPRINT("GetConsoleAliasExesLengthA called\n");
603}
static DWORD IntGetConsoleAliasExesLength(BOOLEAN bUnicode)
Definition: alias.c:558

◆ GetConsoleAliasExesLengthW()

DWORD WINAPI DECLSPEC_HOTPATCH GetConsoleAliasExesLengthW ( VOID  )

Definition at line 586 of file alias.c.

587{
588 DPRINT("GetConsoleAliasExesLengthW called\n");
590}

◆ GetConsoleAliasExesW()

DWORD WINAPI DECLSPEC_HOTPATCH GetConsoleAliasExesW ( LPWSTR  lpExeNameBuffer,
DWORD  ExeNameBufferLength 
)

Definition at line 535 of file alias.c.

537{
538 DPRINT("GetConsoleAliasExesW called\n");
539 return IntGetConsoleAliasExes(lpExeNameBuffer, ExeNameBufferLength, TRUE);
540}

Referenced by PrintAllMacros().

◆ GetConsoleAliasW()

DWORD WINAPI DECLSPEC_HOTPATCH GetConsoleAliasW ( LPWSTR  lpSource,
LPWSTR  lpTargetBuffer,
DWORD  TargetBufferLength,
LPWSTR  lpExeName 
)

Definition at line 260 of file alias.c.

264{
265 DPRINT("GetConsoleAliasW entered with lpSource '%S' lpExeName '%S'\n",
266 lpSource, lpExeName);
267
268 return IntGetConsoleAlias(lpSource,
269 (USHORT)wcslen(lpSource) * sizeof(WCHAR),
270 lpTargetBuffer,
271 TargetBufferLength,
272 lpExeName,
273 TRUE);
274}

◆ IntAddConsoleAlias()

static BOOL IntAddConsoleAlias ( LPCVOID  Source,
USHORT  SourceBufferLength,
LPCVOID  Target,
USHORT  TargetBufferLength,
LPCVOID  lpExeName,
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)(lpExeName ? (bUnicode ? wcslen(lpExeName) : strlen(lpExeName)) : 0);
35
36 if (lpExeName == 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,
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:32
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
#define SetLastError(x)
Definition: compat.h:752
_In_ UINT _In_ UINT _In_ PNDIS_PACKET Source
Definition: ndis.h:3169
DWORD BaseSetLastNTError(IN NTSTATUS Status)
Definition: reactos.cpp:166
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::@3540 Data
NTSTATUS Status
Definition: csrmsg.h:110
uint32_t ULONG
Definition: typedefs.h:59
_In_ WDFIOTARGET Target
Definition: wdfrequest.h:306

Referenced by AddConsoleAliasA(), and AddConsoleAliasW().

◆ IntGetConsoleAlias()

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

Definition at line 165 of file alias.c.

171{
172 CONSOLE_API_MESSAGE ApiMessage;
173 PCONSOLE_ADDGETALIAS ConsoleAliasRequest = &ApiMessage.Data.ConsoleAliasRequest;
174 PCSR_CAPTURE_BUFFER CaptureBuffer;
175
176 USHORT NumChars = (USHORT)(lpExeName ? (bUnicode ? wcslen(lpExeName) : strlen(lpExeName)) : 0);
177
178 if (Source == NULL || Target == NULL)
179 {
181 return 0;
182 }
183
184 if (lpExeName == NULL || NumChars == 0)
185 {
187 return 0;
188 }
189
190 ConsoleAliasRequest->ConsoleHandle = NtCurrentPeb()->ProcessParameters->ConsoleHandle;
191
192 /* Determine the needed sizes */
193 ConsoleAliasRequest->SourceLength = SourceBufferLength;
194 ConsoleAliasRequest->ExeLength = NumChars * (bUnicode ? sizeof(WCHAR) : sizeof(CHAR));
195 ConsoleAliasRequest->Unicode =
196 ConsoleAliasRequest->Unicode2 = bUnicode;
197
198 ConsoleAliasRequest->TargetLength = TargetBufferLength;
199
200 /* Allocate a Capture Buffer */
201 CaptureBuffer = CsrAllocateCaptureBuffer(3, ConsoleAliasRequest->SourceLength +
202 ConsoleAliasRequest->ExeLength +
203 ConsoleAliasRequest->TargetLength);
204 if (!CaptureBuffer)
205 {
206 DPRINT1("CsrAllocateCaptureBuffer failed!\n");
208 return 0;
209 }
210
211 /* Capture the strings */
212 CsrCaptureMessageBuffer(CaptureBuffer,
213 (PVOID)Source,
214 ConsoleAliasRequest->SourceLength,
215 (PVOID*)&ConsoleAliasRequest->Source);
216
217 CsrCaptureMessageBuffer(CaptureBuffer,
219 ConsoleAliasRequest->ExeLength,
220 (PVOID*)&ConsoleAliasRequest->ExeName);
221
222 /* Allocate space for the target buffer */
223 CsrAllocateMessagePointer(CaptureBuffer,
224 ConsoleAliasRequest->TargetLength,
225 (PVOID*)&ConsoleAliasRequest->Target);
226
228 CaptureBuffer,
230 sizeof(*ConsoleAliasRequest));
231 if (!NT_SUCCESS(ApiMessage.Status))
232 {
233 CsrFreeCaptureBuffer(CaptureBuffer);
234 BaseSetLastNTError(ApiMessage.Status);
235
236 if (ApiMessage.Status == STATUS_BUFFER_TOO_SMALL)
237 return ConsoleAliasRequest->TargetLength;
238 else
239 return 0;
240 }
241
242 /* Copy the returned target string into the user buffer */
244 ConsoleAliasRequest->Target,
245 ConsoleAliasRequest->TargetLength);
246
247 /* Release the capture buffer and exit */
248 CsrFreeCaptureBuffer(CaptureBuffer);
249
250 return ConsoleAliasRequest->TargetLength;
251}
@ 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,
LPVOID  lpExeName,
BOOLEAN  bUnicode 
)
static

Definition at line 301 of file alias.c.

305{
306 CONSOLE_API_MESSAGE ApiMessage;
307 PCONSOLE_GETALLALIASES GetAllAliasesRequest = &ApiMessage.Data.GetAllAliasesRequest;
308 PCSR_CAPTURE_BUFFER CaptureBuffer;
309
310 USHORT NumChars = (USHORT)(lpExeName ? (bUnicode ? wcslen(lpExeName) : strlen(lpExeName)) : 0);
311
312 if (lpExeName == NULL || NumChars == 0)
313 {
315 return 0;
316 }
317
318 GetAllAliasesRequest->ConsoleHandle = NtCurrentPeb()->ProcessParameters->ConsoleHandle;
319
320 /* Determine the needed sizes */
321 GetAllAliasesRequest->ExeLength = NumChars * (bUnicode ? sizeof(WCHAR) : sizeof(CHAR));
322 GetAllAliasesRequest->Unicode =
323 GetAllAliasesRequest->Unicode2 = bUnicode;
324
325 GetAllAliasesRequest->AliasesBufferLength = AliasBufferLength;
326
327 /* Allocate a Capture Buffer */
328 CaptureBuffer = CsrAllocateCaptureBuffer(2, GetAllAliasesRequest->ExeLength +
329 GetAllAliasesRequest->AliasesBufferLength);
330 if (!CaptureBuffer)
331 {
332 DPRINT1("CsrAllocateCaptureBuffer failed!\n");
334 return 0;
335 }
336
337 /* Capture the exe name and allocate space for the aliases buffer */
338 CsrCaptureMessageBuffer(CaptureBuffer,
340 GetAllAliasesRequest->ExeLength,
341 (PVOID*)&GetAllAliasesRequest->ExeName);
342
343 CsrAllocateMessagePointer(CaptureBuffer,
344 GetAllAliasesRequest->AliasesBufferLength,
345 (PVOID*)&GetAllAliasesRequest->AliasesBuffer);
346
348 CaptureBuffer,
350 sizeof(*GetAllAliasesRequest));
351 if (!NT_SUCCESS(ApiMessage.Status))
352 {
353 CsrFreeCaptureBuffer(CaptureBuffer);
354 BaseSetLastNTError(ApiMessage.Status);
355 return 0;
356 }
357
358 /* Copy the returned aliases string into the user buffer */
359 RtlCopyMemory(AliasBuffer,
360 GetAllAliasesRequest->AliasesBuffer,
361 GetAllAliasesRequest->AliasesBufferLength);
362
363 /* Release the capture buffer and exit */
364 CsrFreeCaptureBuffer(CaptureBuffer);
365
366 return GetAllAliasesRequest->AliasesBufferLength;
367}
@ 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 ( LPVOID  lpExeName,
BOOLEAN  bUnicode 
)
static

Definition at line 411 of file alias.c.

412{
413 CONSOLE_API_MESSAGE ApiMessage;
414 PCONSOLE_GETALLALIASESLENGTH GetAllAliasesLengthRequest = &ApiMessage.Data.GetAllAliasesLengthRequest;
415 PCSR_CAPTURE_BUFFER CaptureBuffer;
416
417 USHORT NumChars = (USHORT)(lpExeName ? (bUnicode ? wcslen(lpExeName) : strlen(lpExeName)) : 0);
418
419 if (lpExeName == NULL || NumChars == 0)
420 {
422 return 0;
423 }
424
425 GetAllAliasesLengthRequest->ConsoleHandle = NtCurrentPeb()->ProcessParameters->ConsoleHandle;
426 GetAllAliasesLengthRequest->ExeLength = NumChars * (bUnicode ? sizeof(WCHAR) : sizeof(CHAR));
427 GetAllAliasesLengthRequest->Unicode =
428 GetAllAliasesLengthRequest->Unicode2 = bUnicode;
429
430 CaptureBuffer = CsrAllocateCaptureBuffer(1, GetAllAliasesLengthRequest->ExeLength);
431 if (!CaptureBuffer)
432 {
433 DPRINT1("CsrAllocateCaptureBuffer failed!\n");
435 return 0;
436 }
437
438 CsrCaptureMessageBuffer(CaptureBuffer,
440 GetAllAliasesLengthRequest->ExeLength,
441 (PVOID)&GetAllAliasesLengthRequest->ExeName);
442
444 CaptureBuffer,
446 sizeof(*GetAllAliasesLengthRequest));
447
448 CsrFreeCaptureBuffer(CaptureBuffer);
449
450 if (!NT_SUCCESS(ApiMessage.Status))
451 {
452 BaseSetLastNTError(ApiMessage.Status);
453 return 0;
454 }
455
456 return GetAllAliasesLengthRequest->Length;
457}
@ 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 485 of file alias.c.

488{
489 CONSOLE_API_MESSAGE ApiMessage;
490 PCONSOLE_GETALIASESEXES GetAliasesExesRequest = &ApiMessage.Data.GetAliasesExesRequest;
491 PCSR_CAPTURE_BUFFER CaptureBuffer;
492
493 GetAliasesExesRequest->ConsoleHandle = NtCurrentPeb()->ProcessParameters->ConsoleHandle;
494 GetAliasesExesRequest->Length = ExeNameBufferLength;
495 GetAliasesExesRequest->Unicode = bUnicode;
496
497 CaptureBuffer = CsrAllocateCaptureBuffer(1, ExeNameBufferLength);
498 if (!CaptureBuffer)
499 {
500 DPRINT1("CsrAllocateCaptureBuffer failed!\n");
502 return 0;
503 }
504
505 CsrAllocateMessagePointer(CaptureBuffer,
506 ExeNameBufferLength,
507 (PVOID*)&GetAliasesExesRequest->ExeNames);
508
510 CaptureBuffer,
512 sizeof(*GetAliasesExesRequest));
513 if (!NT_SUCCESS(ApiMessage.Status))
514 {
515 CsrFreeCaptureBuffer(CaptureBuffer);
516 BaseSetLastNTError(ApiMessage.Status);
517 return 0;
518 }
519
520 RtlCopyMemory(lpExeNameBuffer,
521 GetAliasesExesRequest->ExeNames,
522 GetAliasesExesRequest->Length);
523
524 CsrFreeCaptureBuffer(CaptureBuffer);
525
526 return GetAliasesExesRequest->Length;
527}
@ 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 558 of file alias.c.

559{
560 CONSOLE_API_MESSAGE ApiMessage;
561 PCONSOLE_GETALIASESEXESLENGTH GetAliasesExesLengthRequest = &ApiMessage.Data.GetAliasesExesLengthRequest;
562
563 GetAliasesExesLengthRequest->ConsoleHandle = NtCurrentPeb()->ProcessParameters->ConsoleHandle;
564 GetAliasesExesLengthRequest->Unicode = bUnicode;
565
567 NULL,
569 sizeof(*GetAliasesExesLengthRequest));
570 if (!NT_SUCCESS(ApiMessage.Status))
571 {
572 BaseSetLastNTError(ApiMessage.Status);
573 return 0;
574 }
575
576 return GetAliasesExesLengthRequest->Length;
577}
@ ConsolepGetAliasExesLength
Definition: conmsg.h:76
CONSOLE_GETALIASESEXESLENGTH GetAliasesExesLengthRequest
Definition: conmsg.h:1003

Referenced by GetConsoleAliasExesLengthA(), and GetConsoleAliasExesLengthW().