@@ -23,17 +23,17 @@ IntAddConsoleAlias(LPCVOID Source,
2323 USHORT SourceBufferLength ,
2424 LPCVOID Target ,
2525 USHORT TargetBufferLength ,
26- LPCVOID lpExeName ,
26+ LPCVOID ExeName ,
2727 BOOLEAN bUnicode )
2828{
2929 CONSOLE_API_MESSAGE ApiMessage ;
3030 PCONSOLE_ADDGETALIAS ConsoleAliasRequest = & ApiMessage .Data .ConsoleAliasRequest ;
3131 PCSR_CAPTURE_BUFFER CaptureBuffer ;
3232 ULONG CapturedStrings ;
3333
34- USHORT NumChars = (USHORT )(lpExeName ? (bUnicode ? wcslen (lpExeName ) : strlen (lpExeName )) : 0 );
34+ USHORT NumChars = (USHORT )(ExeName ? (bUnicode ? wcslen (ExeName ) : strlen (ExeName )) : 0 );
3535
36- if (lpExeName == NULL || NumChars == 0 )
36+ if (ExeName == NULL || NumChars == 0 )
3737 {
3838 SetLastError (ERROR_INVALID_PARAMETER );
3939 return FALSE;
@@ -78,7 +78,7 @@ IntAddConsoleAlias(LPCVOID Source,
7878 (PVOID * )& ConsoleAliasRequest -> Source );
7979
8080 CsrCaptureMessageBuffer (CaptureBuffer ,
81- (PVOID )lpExeName ,
81+ (PVOID )ExeName ,
8282 ConsoleAliasRequest -> ExeLength ,
8383 (PVOID * )& ConsoleAliasRequest -> ExeName );
8484
@@ -117,21 +117,22 @@ IntAddConsoleAlias(LPCVOID Source,
117117BOOL
118118WINAPI
119119DECLSPEC_HOTPATCH
120- AddConsoleAliasW (LPCWSTR lpSource ,
121- LPCWSTR lpTarget ,
122- LPCWSTR lpExeName )
120+ AddConsoleAliasW (
121+ _In_ LPCWSTR Source ,
122+ _In_ LPCWSTR Target ,
123+ _In_ LPCWSTR ExeName )
123124{
124- USHORT SourceBufferLength = (USHORT )wcslen (lpSource ) * sizeof (WCHAR );
125- USHORT TargetBufferLength = (USHORT )(lpTarget ? wcslen (lpTarget ) * sizeof (WCHAR ) : 0 );
125+ USHORT SourceBufferLength = (USHORT )wcslen (Source ) * sizeof (WCHAR );
126+ USHORT TargetBufferLength = (USHORT )(Target ? wcslen (Target ) * sizeof (WCHAR ) : 0 );
126127
127- DPRINT ("AddConsoleAliasW entered with lpSource '%S' lpTarget '%S' lpExeName '%S'\n" ,
128- lpSource , lpTarget , lpExeName );
128+ DPRINT ("AddConsoleAliasW entered with Source '%S' Target '%S' ExeName '%S'\n" ,
129+ Source , Target , ExeName );
129130
130- return IntAddConsoleAlias (lpSource ,
131+ return IntAddConsoleAlias (Source ,
131132 SourceBufferLength ,
132- lpTarget ,
133+ Target ,
133134 TargetBufferLength ,
134- lpExeName ,
135+ ExeName ,
135136 TRUE);
136137}
137138
@@ -142,46 +143,47 @@ AddConsoleAliasW(LPCWSTR lpSource,
142143BOOL
143144WINAPI
144145DECLSPEC_HOTPATCH
145- AddConsoleAliasA (LPCSTR lpSource ,
146- LPCSTR lpTarget ,
147- LPCSTR lpExeName )
146+ AddConsoleAliasA (
147+ _In_ LPCSTR Source ,
148+ _In_ LPCSTR Target ,
149+ _In_ LPCSTR ExeName )
148150{
149- USHORT SourceBufferLength = (USHORT )strlen (lpSource ) * sizeof (CHAR );
150- USHORT TargetBufferLength = (USHORT )(lpTarget ? strlen (lpTarget ) * sizeof (CHAR ) : 0 );
151+ USHORT SourceBufferLength = (USHORT )strlen (Source ) * sizeof (CHAR );
152+ USHORT TargetBufferLength = (USHORT )(Target ? strlen (Target ) * sizeof (CHAR ) : 0 );
151153
152- DPRINT ("AddConsoleAliasA entered with lpSource '%s' lpTarget '%s' lpExeName '%s'\n" ,
153- lpSource , lpTarget , lpExeName );
154+ DPRINT ("AddConsoleAliasA entered with Source '%s' Target '%s' ExeName '%s'\n" ,
155+ Source , Target , ExeName );
154156
155- return IntAddConsoleAlias (lpSource ,
157+ return IntAddConsoleAlias (Source ,
156158 SourceBufferLength ,
157- lpTarget ,
159+ Target ,
158160 TargetBufferLength ,
159- lpExeName ,
161+ ExeName ,
160162 FALSE);
161163}
162164
163165
164166static DWORD
165- IntGetConsoleAlias (LPVOID Source ,
167+ IntGetConsoleAlias (LPCVOID Source ,
166168 USHORT SourceBufferLength ,
167169 LPVOID Target ,
168170 USHORT TargetBufferLength ,
169- LPVOID lpExeName ,
171+ LPCVOID ExeName ,
170172 BOOLEAN bUnicode )
171173{
172174 CONSOLE_API_MESSAGE ApiMessage ;
173175 PCONSOLE_ADDGETALIAS ConsoleAliasRequest = & ApiMessage .Data .ConsoleAliasRequest ;
174176 PCSR_CAPTURE_BUFFER CaptureBuffer ;
175177
176- USHORT NumChars = (USHORT )(lpExeName ? (bUnicode ? wcslen (lpExeName ) : strlen (lpExeName )) : 0 );
178+ USHORT NumChars = (USHORT )(ExeName ? (bUnicode ? wcslen (ExeName ) : strlen (ExeName )) : 0 );
177179
178180 if (Source == NULL || Target == NULL )
179181 {
180182 SetLastError (ERROR_INVALID_PARAMETER );
181183 return 0 ;
182184 }
183185
184- if (lpExeName == NULL || NumChars == 0 )
186+ if (ExeName == NULL || NumChars == 0 )
185187 {
186188 SetLastError (ERROR_INVALID_PARAMETER );
187189 return 0 ;
@@ -215,7 +217,7 @@ IntGetConsoleAlias(LPVOID Source,
215217 (PVOID * )& ConsoleAliasRequest -> Source );
216218
217219 CsrCaptureMessageBuffer (CaptureBuffer ,
218- (PVOID )lpExeName ,
220+ (PVOID )ExeName ,
219221 ConsoleAliasRequest -> ExeLength ,
220222 (PVOID * )& ConsoleAliasRequest -> ExeName );
221223
@@ -257,19 +259,20 @@ IntGetConsoleAlias(LPVOID Source,
257259DWORD
258260WINAPI
259261DECLSPEC_HOTPATCH
260- GetConsoleAliasW (LPWSTR lpSource ,
261- LPWSTR lpTargetBuffer ,
262- DWORD TargetBufferLength ,
263- LPWSTR lpExeName )
262+ GetConsoleAliasW (
263+ _In_ LPCWSTR Source ,
264+ _Out_writes_ (TargetBufferLength ) LPWSTR TargetBuffer ,
265+ _In_ DWORD TargetBufferLength ,
266+ _In_ LPCWSTR ExeName )
264267{
265- DPRINT ("GetConsoleAliasW entered with lpSource '%S' lpExeName '%S'\n" ,
266- lpSource , lpExeName );
268+ DPRINT ("GetConsoleAliasW entered with Source '%S' ExeName '%S'\n" ,
269+ Source , ExeName );
267270
268- return IntGetConsoleAlias (lpSource ,
269- (USHORT )wcslen (lpSource ) * sizeof (WCHAR ),
270- lpTargetBuffer ,
271+ return IntGetConsoleAlias (Source ,
272+ (USHORT )wcslen (Source ) * sizeof (WCHAR ),
273+ TargetBuffer ,
271274 TargetBufferLength ,
272- lpExeName ,
275+ ExeName ,
273276 TRUE);
274277}
275278
@@ -280,36 +283,37 @@ GetConsoleAliasW(LPWSTR lpSource,
280283DWORD
281284WINAPI
282285DECLSPEC_HOTPATCH
283- GetConsoleAliasA (LPSTR lpSource ,
284- LPSTR lpTargetBuffer ,
285- DWORD TargetBufferLength ,
286- LPSTR lpExeName )
286+ GetConsoleAliasA (
287+ _In_ LPCSTR Source ,
288+ _Out_writes_ (TargetBufferLength ) LPSTR TargetBuffer ,
289+ _In_ DWORD TargetBufferLength ,
290+ _In_ LPCSTR ExeName )
287291{
288- DPRINT ("GetConsoleAliasA entered with lpSource '%s' lpExeName '%s'\n" ,
289- lpSource , lpExeName );
292+ DPRINT ("GetConsoleAliasA entered with Source '%s' ExeName '%s'\n" ,
293+ Source , ExeName );
290294
291- return IntGetConsoleAlias (lpSource ,
292- (USHORT )strlen (lpSource ) * sizeof (CHAR ),
293- lpTargetBuffer ,
295+ return IntGetConsoleAlias (Source ,
296+ (USHORT )strlen (Source ) * sizeof (CHAR ),
297+ TargetBuffer ,
294298 TargetBufferLength ,
295- lpExeName ,
299+ ExeName ,
296300 FALSE);
297301}
298302
299303
300304static DWORD
301- IntGetConsoleAliases (LPVOID AliasBuffer ,
302- DWORD AliasBufferLength ,
303- LPVOID lpExeName ,
305+ IntGetConsoleAliases (LPVOID AliasBuffer ,
306+ DWORD AliasBufferLength ,
307+ LPCVOID ExeName ,
304308 BOOLEAN bUnicode )
305309{
306310 CONSOLE_API_MESSAGE ApiMessage ;
307311 PCONSOLE_GETALLALIASES GetAllAliasesRequest = & ApiMessage .Data .GetAllAliasesRequest ;
308312 PCSR_CAPTURE_BUFFER CaptureBuffer ;
309313
310- USHORT NumChars = (USHORT )(lpExeName ? (bUnicode ? wcslen (lpExeName ) : strlen (lpExeName )) : 0 );
314+ USHORT NumChars = (USHORT )(ExeName ? (bUnicode ? wcslen (ExeName ) : strlen (ExeName )) : 0 );
311315
312- if (lpExeName == NULL || NumChars == 0 )
316+ if (ExeName == NULL || NumChars == 0 )
313317 {
314318 SetLastError (ERROR_INVALID_PARAMETER );
315319 return 0 ;
@@ -336,7 +340,7 @@ IntGetConsoleAliases(LPVOID AliasBuffer,
336340
337341 /* Capture the exe name and allocate space for the aliases buffer */
338342 CsrCaptureMessageBuffer (CaptureBuffer ,
339- (PVOID )lpExeName ,
343+ (PVOID )ExeName ,
340344 GetAllAliasesRequest -> ExeLength ,
341345 (PVOID * )& GetAllAliasesRequest -> ExeName );
342346
@@ -373,11 +377,12 @@ IntGetConsoleAliases(LPVOID AliasBuffer,
373377DWORD
374378WINAPI
375379DECLSPEC_HOTPATCH
376- GetConsoleAliasesW (LPWSTR AliasBuffer ,
377- DWORD AliasBufferLength ,
378- LPWSTR ExeName )
380+ GetConsoleAliasesW (
381+ _Out_writes_ (AliasBufferLength ) LPWSTR AliasBuffer ,
382+ _In_ DWORD AliasBufferLength ,
383+ _In_ LPCWSTR ExeName )
379384{
380- DPRINT ("GetConsoleAliasesW entered with lpExeName '%S'\n" ,
385+ DPRINT ("GetConsoleAliasesW entered with ExeName '%S'\n" ,
381386 ExeName );
382387
383388 return IntGetConsoleAliases (AliasBuffer ,
@@ -393,11 +398,12 @@ GetConsoleAliasesW(LPWSTR AliasBuffer,
393398DWORD
394399WINAPI
395400DECLSPEC_HOTPATCH
396- GetConsoleAliasesA (LPSTR AliasBuffer ,
397- DWORD AliasBufferLength ,
398- LPSTR ExeName )
401+ GetConsoleAliasesA (
402+ _Out_writes_ (AliasBufferLength ) LPSTR AliasBuffer ,
403+ _In_ DWORD AliasBufferLength ,
404+ _In_ LPCSTR ExeName )
399405{
400- DPRINT ("GetConsoleAliasesA entered with lpExeName '%s'\n" ,
406+ DPRINT ("GetConsoleAliasesA entered with ExeName '%s'\n" ,
401407 ExeName );
402408
403409 return IntGetConsoleAliases (AliasBuffer ,
@@ -408,15 +414,15 @@ GetConsoleAliasesA(LPSTR AliasBuffer,
408414
409415
410416static DWORD
411- IntGetConsoleAliasesLength (LPVOID lpExeName , BOOLEAN bUnicode )
417+ IntGetConsoleAliasesLength (LPCVOID ExeName , BOOLEAN bUnicode )
412418{
413419 CONSOLE_API_MESSAGE ApiMessage ;
414420 PCONSOLE_GETALLALIASESLENGTH GetAllAliasesLengthRequest = & ApiMessage .Data .GetAllAliasesLengthRequest ;
415421 PCSR_CAPTURE_BUFFER CaptureBuffer ;
416422
417- USHORT NumChars = (USHORT )(lpExeName ? (bUnicode ? wcslen (lpExeName ) : strlen (lpExeName )) : 0 );
423+ USHORT NumChars = (USHORT )(ExeName ? (bUnicode ? wcslen (ExeName ) : strlen (ExeName )) : 0 );
418424
419- if (lpExeName == NULL || NumChars == 0 )
425+ if (ExeName == NULL || NumChars == 0 )
420426 {
421427 SetLastError (ERROR_INVALID_PARAMETER );
422428 return 0 ;
@@ -436,7 +442,7 @@ IntGetConsoleAliasesLength(LPVOID lpExeName, BOOLEAN bUnicode)
436442 }
437443
438444 CsrCaptureMessageBuffer (CaptureBuffer ,
439- (PVOID )lpExeName ,
445+ (PVOID )ExeName ,
440446 GetAllAliasesLengthRequest -> ExeLength ,
441447 (PVOID )& GetAllAliasesLengthRequest -> ExeName );
442448
@@ -463,9 +469,10 @@ IntGetConsoleAliasesLength(LPVOID lpExeName, BOOLEAN bUnicode)
463469DWORD
464470WINAPI
465471DECLSPEC_HOTPATCH
466- GetConsoleAliasesLengthW (LPWSTR lpExeName )
472+ GetConsoleAliasesLengthW (
473+ _In_ LPCWSTR ExeName )
467474{
468- return IntGetConsoleAliasesLength (lpExeName , TRUE);
475+ return IntGetConsoleAliasesLength (ExeName , TRUE);
469476}
470477
471478
@@ -475,9 +482,10 @@ GetConsoleAliasesLengthW(LPWSTR lpExeName)
475482DWORD
476483WINAPI
477484DECLSPEC_HOTPATCH
478- GetConsoleAliasesLengthA (LPSTR lpExeName )
485+ GetConsoleAliasesLengthA (
486+ _In_ LPCSTR ExeName )
479487{
480- return IntGetConsoleAliasesLength (lpExeName , FALSE);
488+ return IntGetConsoleAliasesLength (ExeName , FALSE);
481489}
482490
483491
0 commit comments