diff --git a/base/applications/cmdutils/doskey/doskey.c b/base/applications/cmdutils/doskey/doskey.c index 57539f4cdc0..5ab60079e71 100644 --- a/base/applications/cmdutils/doskey/doskey.c +++ b/base/applications/cmdutils/doskey/doskey.c @@ -15,28 +15,7 @@ #include #include #include - -/* Console API functions which are absent from wincon.h */ -#define EXENAME_LENGTH (255 + 1) - -VOID -WINAPI -ExpungeConsoleCommandHistoryW(LPCWSTR lpExeName); - -DWORD -WINAPI -GetConsoleCommandHistoryW(LPWSTR lpHistory, - DWORD cbHistory, - LPCWSTR lpExeName); - -DWORD -WINAPI -GetConsoleCommandHistoryLengthW(LPCWSTR lpExeName); - -BOOL -WINAPI -SetConsoleNumberOfCommandsW(DWORD dwNumCommands, - LPCWSTR lpExeName); +#include #include "doskey.h" diff --git a/base/setup/usetup/usetup.h b/base/setup/usetup/usetup.h index e0d7f7face8..c4b59d3a53a 100644 --- a/base/setup/usetup/usetup.h +++ b/base/setup/usetup/usetup.h @@ -33,10 +33,11 @@ /* PSDK/NDK */ #define WIN32_NO_STATUS +#define _KERNEL32_ // To define WINBASEAPI empty #include #include #include -#include +#include #include #define NTOS_MODE_USER diff --git a/dll/win32/kernel32/client/console/alias.c b/dll/win32/kernel32/client/console/alias.c index d835c05632b..72209622126 100644 --- a/dll/win32/kernel32/client/console/alias.c +++ b/dll/win32/kernel32/client/console/alias.c @@ -23,7 +23,7 @@ IntAddConsoleAlias(LPCVOID Source, USHORT SourceBufferLength, LPCVOID Target, USHORT TargetBufferLength, - LPCVOID lpExeName, + LPCVOID ExeName, BOOLEAN bUnicode) { CONSOLE_API_MESSAGE ApiMessage; @@ -31,9 +31,9 @@ IntAddConsoleAlias(LPCVOID Source, PCSR_CAPTURE_BUFFER CaptureBuffer; ULONG CapturedStrings; - USHORT NumChars = (USHORT)(lpExeName ? (bUnicode ? wcslen(lpExeName) : strlen(lpExeName)) : 0); + USHORT NumChars = (USHORT)(ExeName ? (bUnicode ? wcslen(ExeName) : strlen(ExeName)) : 0); - if (lpExeName == NULL || NumChars == 0) + if (ExeName == NULL || NumChars == 0) { SetLastError(ERROR_INVALID_PARAMETER); return FALSE; @@ -78,7 +78,7 @@ IntAddConsoleAlias(LPCVOID Source, (PVOID*)&ConsoleAliasRequest->Source); CsrCaptureMessageBuffer(CaptureBuffer, - (PVOID)lpExeName, + (PVOID)ExeName, ConsoleAliasRequest->ExeLength, (PVOID*)&ConsoleAliasRequest->ExeName); @@ -117,21 +117,22 @@ IntAddConsoleAlias(LPCVOID Source, BOOL WINAPI DECLSPEC_HOTPATCH -AddConsoleAliasW(LPCWSTR lpSource, - LPCWSTR lpTarget, - LPCWSTR lpExeName) +AddConsoleAliasW( + _In_ LPCWSTR Source, + _In_ LPCWSTR Target, + _In_ LPCWSTR ExeName) { - USHORT SourceBufferLength = (USHORT)wcslen(lpSource) * sizeof(WCHAR); - USHORT TargetBufferLength = (USHORT)(lpTarget ? wcslen(lpTarget) * sizeof(WCHAR) : 0); + USHORT SourceBufferLength = (USHORT)wcslen(Source) * sizeof(WCHAR); + USHORT TargetBufferLength = (USHORT)(Target ? wcslen(Target) * sizeof(WCHAR) : 0); - DPRINT("AddConsoleAliasW entered with lpSource '%S' lpTarget '%S' lpExeName '%S'\n", - lpSource, lpTarget, lpExeName); + DPRINT("AddConsoleAliasW entered with Source '%S' Target '%S' ExeName '%S'\n", + Source, Target, ExeName); - return IntAddConsoleAlias(lpSource, + return IntAddConsoleAlias(Source, SourceBufferLength, - lpTarget, + Target, TargetBufferLength, - lpExeName, + ExeName, TRUE); } @@ -142,38 +143,39 @@ AddConsoleAliasW(LPCWSTR lpSource, BOOL WINAPI DECLSPEC_HOTPATCH -AddConsoleAliasA(LPCSTR lpSource, - LPCSTR lpTarget, - LPCSTR lpExeName) +AddConsoleAliasA( + _In_ LPCSTR Source, + _In_ LPCSTR Target, + _In_ LPCSTR ExeName) { - USHORT SourceBufferLength = (USHORT)strlen(lpSource) * sizeof(CHAR); - USHORT TargetBufferLength = (USHORT)(lpTarget ? strlen(lpTarget) * sizeof(CHAR) : 0); + USHORT SourceBufferLength = (USHORT)strlen(Source) * sizeof(CHAR); + USHORT TargetBufferLength = (USHORT)(Target ? strlen(Target) * sizeof(CHAR) : 0); - DPRINT("AddConsoleAliasA entered with lpSource '%s' lpTarget '%s' lpExeName '%s'\n", - lpSource, lpTarget, lpExeName); + DPRINT("AddConsoleAliasA entered with Source '%s' Target '%s' ExeName '%s'\n", + Source, Target, ExeName); - return IntAddConsoleAlias(lpSource, + return IntAddConsoleAlias(Source, SourceBufferLength, - lpTarget, + Target, TargetBufferLength, - lpExeName, + ExeName, FALSE); } static DWORD -IntGetConsoleAlias(LPVOID Source, +IntGetConsoleAlias(LPCVOID Source, USHORT SourceBufferLength, LPVOID Target, USHORT TargetBufferLength, - LPVOID lpExeName, + LPCVOID ExeName, BOOLEAN bUnicode) { CONSOLE_API_MESSAGE ApiMessage; PCONSOLE_ADDGETALIAS ConsoleAliasRequest = &ApiMessage.Data.ConsoleAliasRequest; PCSR_CAPTURE_BUFFER CaptureBuffer; - USHORT NumChars = (USHORT)(lpExeName ? (bUnicode ? wcslen(lpExeName) : strlen(lpExeName)) : 0); + USHORT NumChars = (USHORT)(ExeName ? (bUnicode ? wcslen(ExeName) : strlen(ExeName)) : 0); if (Source == NULL || Target == NULL) { @@ -181,7 +183,7 @@ IntGetConsoleAlias(LPVOID Source, return 0; } - if (lpExeName == NULL || NumChars == 0) + if (ExeName == NULL || NumChars == 0) { SetLastError(ERROR_INVALID_PARAMETER); return 0; @@ -215,7 +217,7 @@ IntGetConsoleAlias(LPVOID Source, (PVOID*)&ConsoleAliasRequest->Source); CsrCaptureMessageBuffer(CaptureBuffer, - (PVOID)lpExeName, + (PVOID)ExeName, ConsoleAliasRequest->ExeLength, (PVOID*)&ConsoleAliasRequest->ExeName); @@ -257,19 +259,20 @@ IntGetConsoleAlias(LPVOID Source, DWORD WINAPI DECLSPEC_HOTPATCH -GetConsoleAliasW(LPWSTR lpSource, - LPWSTR lpTargetBuffer, - DWORD TargetBufferLength, - LPWSTR lpExeName) +GetConsoleAliasW( + _In_ LPCWSTR Source, + _Out_writes_(TargetBufferLength) LPWSTR TargetBuffer, + _In_ DWORD TargetBufferLength, + _In_ LPCWSTR ExeName) { - DPRINT("GetConsoleAliasW entered with lpSource '%S' lpExeName '%S'\n", - lpSource, lpExeName); + DPRINT("GetConsoleAliasW entered with Source '%S' ExeName '%S'\n", + Source, ExeName); - return IntGetConsoleAlias(lpSource, - (USHORT)wcslen(lpSource) * sizeof(WCHAR), - lpTargetBuffer, + return IntGetConsoleAlias(Source, + (USHORT)wcslen(Source) * sizeof(WCHAR), + TargetBuffer, TargetBufferLength, - lpExeName, + ExeName, TRUE); } @@ -280,36 +283,37 @@ GetConsoleAliasW(LPWSTR lpSource, DWORD WINAPI DECLSPEC_HOTPATCH -GetConsoleAliasA(LPSTR lpSource, - LPSTR lpTargetBuffer, - DWORD TargetBufferLength, - LPSTR lpExeName) +GetConsoleAliasA( + _In_ LPCSTR Source, + _Out_writes_(TargetBufferLength) LPSTR TargetBuffer, + _In_ DWORD TargetBufferLength, + _In_ LPCSTR ExeName) { - DPRINT("GetConsoleAliasA entered with lpSource '%s' lpExeName '%s'\n", - lpSource, lpExeName); + DPRINT("GetConsoleAliasA entered with Source '%s' ExeName '%s'\n", + Source, ExeName); - return IntGetConsoleAlias(lpSource, - (USHORT)strlen(lpSource) * sizeof(CHAR), - lpTargetBuffer, + return IntGetConsoleAlias(Source, + (USHORT)strlen(Source) * sizeof(CHAR), + TargetBuffer, TargetBufferLength, - lpExeName, + ExeName, FALSE); } static DWORD -IntGetConsoleAliases(LPVOID AliasBuffer, - DWORD AliasBufferLength, - LPVOID lpExeName, +IntGetConsoleAliases(LPVOID AliasBuffer, + DWORD AliasBufferLength, + LPCVOID ExeName, BOOLEAN bUnicode) { CONSOLE_API_MESSAGE ApiMessage; PCONSOLE_GETALLALIASES GetAllAliasesRequest = &ApiMessage.Data.GetAllAliasesRequest; PCSR_CAPTURE_BUFFER CaptureBuffer; - USHORT NumChars = (USHORT)(lpExeName ? (bUnicode ? wcslen(lpExeName) : strlen(lpExeName)) : 0); + USHORT NumChars = (USHORT)(ExeName ? (bUnicode ? wcslen(ExeName) : strlen(ExeName)) : 0); - if (lpExeName == NULL || NumChars == 0) + if (ExeName == NULL || NumChars == 0) { SetLastError(ERROR_INVALID_PARAMETER); return 0; @@ -336,7 +340,7 @@ IntGetConsoleAliases(LPVOID AliasBuffer, /* Capture the exe name and allocate space for the aliases buffer */ CsrCaptureMessageBuffer(CaptureBuffer, - (PVOID)lpExeName, + (PVOID)ExeName, GetAllAliasesRequest->ExeLength, (PVOID*)&GetAllAliasesRequest->ExeName); @@ -373,11 +377,12 @@ IntGetConsoleAliases(LPVOID AliasBuffer, DWORD WINAPI DECLSPEC_HOTPATCH -GetConsoleAliasesW(LPWSTR AliasBuffer, - DWORD AliasBufferLength, - LPWSTR ExeName) +GetConsoleAliasesW( + _Out_writes_(AliasBufferLength) LPWSTR AliasBuffer, + _In_ DWORD AliasBufferLength, + _In_ LPCWSTR ExeName) { - DPRINT("GetConsoleAliasesW entered with lpExeName '%S'\n", + DPRINT("GetConsoleAliasesW entered with ExeName '%S'\n", ExeName); return IntGetConsoleAliases(AliasBuffer, @@ -393,11 +398,12 @@ GetConsoleAliasesW(LPWSTR AliasBuffer, DWORD WINAPI DECLSPEC_HOTPATCH -GetConsoleAliasesA(LPSTR AliasBuffer, - DWORD AliasBufferLength, - LPSTR ExeName) +GetConsoleAliasesA( + _Out_writes_(AliasBufferLength) LPSTR AliasBuffer, + _In_ DWORD AliasBufferLength, + _In_ LPCSTR ExeName) { - DPRINT("GetConsoleAliasesA entered with lpExeName '%s'\n", + DPRINT("GetConsoleAliasesA entered with ExeName '%s'\n", ExeName); return IntGetConsoleAliases(AliasBuffer, @@ -408,15 +414,15 @@ GetConsoleAliasesA(LPSTR AliasBuffer, static DWORD -IntGetConsoleAliasesLength(LPVOID lpExeName, BOOLEAN bUnicode) +IntGetConsoleAliasesLength(LPCVOID ExeName, BOOLEAN bUnicode) { CONSOLE_API_MESSAGE ApiMessage; PCONSOLE_GETALLALIASESLENGTH GetAllAliasesLengthRequest = &ApiMessage.Data.GetAllAliasesLengthRequest; PCSR_CAPTURE_BUFFER CaptureBuffer; - USHORT NumChars = (USHORT)(lpExeName ? (bUnicode ? wcslen(lpExeName) : strlen(lpExeName)) : 0); + USHORT NumChars = (USHORT)(ExeName ? (bUnicode ? wcslen(ExeName) : strlen(ExeName)) : 0); - if (lpExeName == NULL || NumChars == 0) + if (ExeName == NULL || NumChars == 0) { SetLastError(ERROR_INVALID_PARAMETER); return 0; @@ -436,7 +442,7 @@ IntGetConsoleAliasesLength(LPVOID lpExeName, BOOLEAN bUnicode) } CsrCaptureMessageBuffer(CaptureBuffer, - (PVOID)lpExeName, + (PVOID)ExeName, GetAllAliasesLengthRequest->ExeLength, (PVOID)&GetAllAliasesLengthRequest->ExeName); @@ -463,9 +469,10 @@ IntGetConsoleAliasesLength(LPVOID lpExeName, BOOLEAN bUnicode) DWORD WINAPI DECLSPEC_HOTPATCH -GetConsoleAliasesLengthW(LPWSTR lpExeName) +GetConsoleAliasesLengthW( + _In_ LPCWSTR ExeName) { - return IntGetConsoleAliasesLength(lpExeName, TRUE); + return IntGetConsoleAliasesLength(ExeName, TRUE); } @@ -475,9 +482,10 @@ GetConsoleAliasesLengthW(LPWSTR lpExeName) DWORD WINAPI DECLSPEC_HOTPATCH -GetConsoleAliasesLengthA(LPSTR lpExeName) +GetConsoleAliasesLengthA( + _In_ LPCSTR ExeName) { - return IntGetConsoleAliasesLength(lpExeName, FALSE); + return IntGetConsoleAliasesLength(ExeName, FALSE); } diff --git a/dll/win32/kernel32/client/console/console.c b/dll/win32/kernel32/client/console/console.c index debf86854ac..9bb8fa6174a 100644 --- a/dll/win32/kernel32/client/console/console.c +++ b/dll/win32/kernel32/client/console/console.c @@ -421,7 +421,7 @@ ConsoleMenuControl(HANDLE hConsoleOutput, HANDLE WINAPI DECLSPEC_HOTPATCH -DuplicateConsoleHandle(HANDLE hConsole, +DuplicateConsoleHandle(HANDLE hSourceHandle, DWORD dwDesiredAccess, BOOL bInheritHandle, DWORD dwOptions) @@ -438,7 +438,7 @@ DuplicateConsoleHandle(HANDLE hConsole, } DuplicateHandleRequest->ConsoleHandle = NtCurrentPeb()->ProcessParameters->ConsoleHandle; - DuplicateHandleRequest->SourceHandle = hConsole; + DuplicateHandleRequest->SourceHandle = hSourceHandle; DuplicateHandleRequest->DesiredAccess = dwDesiredAccess; DuplicateHandleRequest->InheritHandle = bInheritHandle; DuplicateHandleRequest->Options = dwOptions; @@ -975,12 +975,14 @@ SetConsoleHardwareState(HANDLE hConsoleOutput, BOOL WINAPI DECLSPEC_HOTPATCH -SetConsoleKeyShortcuts(DWORD Unknown0, - DWORD Unknown1, - DWORD Unknown2, - DWORD Unknown3) +SetConsoleKeyShortcuts( + _In_ BOOL bSet, + _In_ BYTE bReserveKeys, + _In_reads_(dwNumAppKeys) LPAPPKEY lpAppKeys, + _In_ DWORD dwNumAppKeys) { - DPRINT1("SetConsoleKeyShortcuts(0x%x, 0x%x, 0x%x, 0x%x) UNIMPLEMENTED!\n", Unknown0, Unknown1, Unknown2, Unknown3); + DPRINT1("SetConsoleKeyShortcuts(%lu, 0x%x, 0x%p, 0x%x) UNIMPLEMENTED!\n", + bSet, bReserveKeys, lpAppKeys, dwNumAppKeys); SetLastError(ERROR_CALL_NOT_IMPLEMENTED); return FALSE; } @@ -3024,7 +3026,11 @@ SetConsoleNlsMode(HANDLE hConsole, DWORD dwMode) BOOL WINAPI DECLSPEC_HOTPATCH -SetConsoleLocalEUDC(DWORD Unknown1, DWORD Unknown2, DWORD Unknown3, DWORD Unknown4) +SetConsoleLocalEUDC( + _In_ HANDLE hConsoleHandle, + _In_ WORD wCodePoint, + _In_ COORD cFontSize, + _In_ PCHAR lpSB) { STUB; return FALSE; diff --git a/dll/win32/kernel32/client/vdm.c b/dll/win32/kernel32/client/vdm.c index 98c326a5f24..d30f69d95bd 100644 --- a/dll/win32/kernel32/client/vdm.c +++ b/dll/win32/kernel32/client/vdm.c @@ -1988,12 +1988,11 @@ SetVDMCurrentDirectories(DWORD cchCurDirs, PCHAR lpszzCurDirs) /* * @unimplemented */ -DWORD +BOOL WINAPI -VDMConsoleOperation ( - DWORD Unknown0, - DWORD Unknown1 - ) +VDMConsoleOperation( + _In_ DWORD iFunction, + _Inout_opt_ LPVOID lpData) { STUB; return 0; diff --git a/dll/win32/kernel32/include/console.h b/dll/win32/kernel32/include/console.h index 5fe84cb304c..e7144d8ad0b 100644 --- a/dll/win32/kernel32/include/console.h +++ b/dll/win32/kernel32/include/console.h @@ -33,12 +33,6 @@ DWORD WINAPI PropDialogHandler(IN LPVOID lpThreadParameter); -HANDLE WINAPI -DuplicateConsoleHandle(HANDLE hConsole, - DWORD dwDesiredAccess, - BOOL bInheritHandle, - DWORD dwOptions); - BOOL WINAPI GetConsoleHandleInformation(IN HANDLE hHandle, OUT LPDWORD lpdwFlags); @@ -48,15 +42,6 @@ SetConsoleHandleInformation(IN HANDLE hHandle, IN DWORD dwMask, IN DWORD dwFlags); -BOOL WINAPI -VerifyConsoleIoHandle(HANDLE Handle); - -BOOL WINAPI -CloseConsoleHandle(HANDLE Handle); - -HANDLE WINAPI -GetConsoleInputWaitHandle(VOID); - HANDLE TranslateStdHandle(HANDLE hHandle); @@ -92,10 +77,4 @@ LPCWSTR IntCheckForConsoleFileName(IN LPCWSTR pszName, IN DWORD dwDesiredAccess); -HANDLE WINAPI -OpenConsoleW(LPCWSTR wsName, - DWORD dwDesiredAccess, - BOOL bInheritHandle, - DWORD dwShareMode); - /* EOF */ diff --git a/dll/win32/kernel32/k32.h b/dll/win32/kernel32/k32.h index c9a3c52eaad..756a29b61b2 100644 --- a/dll/win32/kernel32/k32.h +++ b/dll/win32/kernel32/k32.h @@ -21,6 +21,7 @@ #include #include #include +#include #include #undef TEXT diff --git a/modules/rosapps/applications/sysutils/regexpl/RegistryExplorer.cpp b/modules/rosapps/applications/sysutils/regexpl/RegistryExplorer.cpp index 83b1cbca1e2..e7a4ca6003a 100644 --- a/modules/rosapps/applications/sysutils/regexpl/RegistryExplorer.cpp +++ b/modules/rosapps/applications/sysutils/regexpl/RegistryExplorer.cpp @@ -187,7 +187,7 @@ int main () Console.SetTitle(_T("Registry Explorer")); Console.SetTextAttribute(pSettings->GetNormalTextAttributes()); - VERIFY(SetConsoleCtrlHandler((PHANDLER_ROUTINE)HandlerRoutine,TRUE)); + VERIFY(SetConsoleCtrlHandler(HandlerRoutine,TRUE)); if (!Console.Write(HELLO_MSG //(_L(__TIMESTAMP__)) diff --git a/subsystems/mvdm/ntvdm/ntvdm.h b/subsystems/mvdm/ntvdm/ntvdm.h index 1c99f2a0011..7c3c6e8902a 100644 --- a/subsystems/mvdm/ntvdm/ntvdm.h +++ b/subsystems/mvdm/ntvdm/ntvdm.h @@ -55,6 +55,7 @@ #include #include #include +#include #include #include #include @@ -67,8 +68,6 @@ #define NO_NTVDD_COMPAT #include -DWORD WINAPI SetLastConsoleEventActive(VOID); - #define NTOS_MODE_USER #include // For NtQueryPerformanceCounter() #include diff --git a/win32ss/user/winsrv/consrv/consrv.h b/win32ss/user/winsrv/consrv/consrv.h index 5700b9b6548..2608e8cf005 100644 --- a/win32ss/user/winsrv/consrv/consrv.h +++ b/win32ss/user/winsrv/consrv/consrv.h @@ -21,6 +21,7 @@ #include #include +#include #define NTOS_MODE_USER #include