diff --git a/dll/win32/samsrv/samsrv.c b/dll/win32/samsrv/samsrv.c index 23049e00249..490f6167607 100644 --- a/dll/win32/samsrv/samsrv.c +++ b/dll/win32/samsrv/samsrv.c @@ -131,7 +131,7 @@ SamIFree_SAMPR_PSID_ARRAY(PSAMPR_PSID_ARRAY Ptr) { if (Ptr != NULL) { - if (Ptr->Sids !=0) + if (Ptr->Sids != NULL) { MIDL_user_free(Ptr->Sids); } @@ -176,7 +176,222 @@ SamIFree_SAMPR_ULONG_ARRAY(PSAMPR_ULONG_ARRAY Ptr) Ptr->Count = 0; } } +} + +VOID +NTAPI +SamIFree_SAMPR_USER_INFO_BUFFER(PSAMPR_USER_INFO_BUFFER Ptr, + USER_INFORMATION_CLASS InformationClass) +{ + if (Ptr == NULL) + return; + + switch (InformationClass) + { + case UserGeneralInformation: + if (Ptr->General.UserName.Buffer != NULL) + MIDL_user_free(Ptr->General.UserName.Buffer); + + if (Ptr->General.FullName.Buffer != NULL) + MIDL_user_free(Ptr->General.FullName.Buffer); + + if (Ptr->General.AdminComment.Buffer != NULL) + MIDL_user_free(Ptr->General.AdminComment.Buffer); + + if (Ptr->General.UserComment.Buffer != NULL) + MIDL_user_free(Ptr->General.UserComment.Buffer); + break; + + case UserPreferencesInformation: + if (Ptr->Preferences.UserComment.Buffer != NULL) + MIDL_user_free(Ptr->Preferences.UserComment.Buffer); + + if (Ptr->Preferences.Reserved1.Buffer != NULL) + MIDL_user_free(Ptr->Preferences.Reserved1.Buffer); + break; + + case UserLogonInformation: + if (Ptr->Logon.UserName.Buffer != NULL) + MIDL_user_free(Ptr->Logon.UserName.Buffer); + + if (Ptr->Logon.FullName.Buffer != NULL) + MIDL_user_free(Ptr->Logon.FullName.Buffer); + + if (Ptr->Logon.HomeDirectory.Buffer != NULL) + MIDL_user_free(Ptr->Logon.HomeDirectory.Buffer); + + if (Ptr->Logon.HomeDirectoryDrive.Buffer != NULL) + MIDL_user_free(Ptr->Logon.HomeDirectoryDrive.Buffer); + + if (Ptr->Logon.ScriptPath.Buffer != NULL) + MIDL_user_free(Ptr->Logon.ScriptPath.Buffer); + + if (Ptr->Logon.ProfilePath.Buffer != NULL) + MIDL_user_free(Ptr->Logon.ProfilePath.Buffer); + + if (Ptr->Logon.WorkStations.Buffer != NULL) + MIDL_user_free(Ptr->Logon.WorkStations.Buffer); + + if (Ptr->Logon.LogonHours.LogonHours != NULL) + MIDL_user_free(Ptr->Logon.LogonHours.LogonHours); + break; + + case UserLogonHoursInformation: + if (Ptr->LogonHours.LogonHours.LogonHours != NULL) + MIDL_user_free(Ptr->LogonHours.LogonHours.LogonHours); + break; + + case UserAccountInformation: + if (Ptr->Account.UserName.Buffer != NULL) + MIDL_user_free(Ptr->Account.UserName.Buffer); + + if (Ptr->Account.FullName.Buffer != NULL) + MIDL_user_free(Ptr->Account.FullName.Buffer); + + if (Ptr->Account.HomeDirectory.Buffer != NULL) + MIDL_user_free(Ptr->Account.HomeDirectory.Buffer); + + if (Ptr->Account.HomeDirectoryDrive.Buffer != NULL) + MIDL_user_free(Ptr->Account.HomeDirectoryDrive.Buffer); + + if (Ptr->Account.ScriptPath.Buffer != NULL) + MIDL_user_free(Ptr->Account.ScriptPath.Buffer); + + if (Ptr->Account.ProfilePath.Buffer != NULL) + MIDL_user_free(Ptr->Account.ProfilePath.Buffer); + + if (Ptr->Account.AdminComment.Buffer != NULL) + MIDL_user_free(Ptr->Account.AdminComment.Buffer); + + if (Ptr->Account.WorkStations.Buffer != NULL) + MIDL_user_free(Ptr->Account.WorkStations.Buffer); + + if (Ptr->Account.LogonHours.LogonHours != NULL) + MIDL_user_free(Ptr->Account.LogonHours.LogonHours); + break; + + case UserNameInformation: + if (Ptr->Name.UserName.Buffer != NULL) + MIDL_user_free(Ptr->Name.UserName.Buffer); + + if (Ptr->Name.FullName.Buffer != NULL) + MIDL_user_free(Ptr->Name.FullName.Buffer); + break; + + case UserAccountNameInformation: + if (Ptr->AccountName.UserName.Buffer != NULL) + MIDL_user_free(Ptr->AccountName.UserName.Buffer); + break; + + case UserFullNameInformation: + if (Ptr->FullName.FullName.Buffer != NULL) + MIDL_user_free(Ptr->FullName.FullName.Buffer); + break; + + case UserPrimaryGroupInformation: + break; + + case UserHomeInformation: + if (Ptr->Home.HomeDirectory.Buffer != NULL) + MIDL_user_free(Ptr->Home.HomeDirectory.Buffer); + + if (Ptr->Home.HomeDirectoryDrive.Buffer != NULL) + MIDL_user_free(Ptr->Home.HomeDirectoryDrive.Buffer); + break; + + case UserScriptInformation: + if (Ptr->Script.ScriptPath.Buffer != NULL) + MIDL_user_free(Ptr->Script.ScriptPath.Buffer); + + case UserProfileInformation: + if (Ptr->Profile.ProfilePath.Buffer != NULL) + MIDL_user_free(Ptr->Profile.ProfilePath.Buffer); + + case UserAdminCommentInformation: + if (Ptr->AdminComment.AdminComment.Buffer != NULL) + MIDL_user_free(Ptr->AdminComment.AdminComment.Buffer); + break; + + case UserWorkStationsInformation: + if (Ptr->WorkStations.WorkStations.Buffer != NULL) + MIDL_user_free(Ptr->WorkStations.WorkStations.Buffer); + break; + + case UserSetPasswordInformation: + ERR("Information class UserSetPasswordInformation cannot be queried!\n"); + break; + + case UserControlInformation: + break; + + case UserExpiresInformation: + break; + + case UserInternal1Information: + break; + + case UserInternal2Information: + break; + + case UserParametersInformation: + if (Ptr->Parameters.Parameters.Buffer != NULL) + MIDL_user_free(Ptr->Parameters.Parameters.Buffer); + break; + + case UserAllInformation: + if (Ptr->All.UserName.Buffer != NULL) + MIDL_user_free(Ptr->All.UserName.Buffer); + + if (Ptr->All.FullName.Buffer != NULL) + MIDL_user_free(Ptr->All.FullName.Buffer); + + if (Ptr->All.HomeDirectory.Buffer != NULL) + MIDL_user_free(Ptr->All.HomeDirectory.Buffer); + + if (Ptr->All.HomeDirectoryDrive.Buffer != NULL) + MIDL_user_free(Ptr->All.HomeDirectoryDrive.Buffer); + + if (Ptr->All.ScriptPath.Buffer != NULL) + MIDL_user_free(Ptr->All.ScriptPath.Buffer); + + if (Ptr->All.ProfilePath.Buffer != NULL) + MIDL_user_free(Ptr->All.ProfilePath.Buffer); + + if (Ptr->All.AdminComment.Buffer != NULL) + MIDL_user_free(Ptr->All.AdminComment.Buffer); + + if (Ptr->All.WorkStations.Buffer != NULL) + MIDL_user_free(Ptr->All.WorkStations.Buffer); + + if (Ptr->All.UserComment.Buffer != NULL) + MIDL_user_free(Ptr->All.UserComment.Buffer); + + if (Ptr->All.Parameters.Buffer != NULL) + MIDL_user_free(Ptr->All.Parameters.Buffer); + + if (Ptr->All.LmOwfPassword.Buffer != NULL) + MIDL_user_free(Ptr->All.LmOwfPassword.Buffer); + + if (Ptr->All.NtOwfPassword.Buffer != NULL) + MIDL_user_free(Ptr->All.NtOwfPassword.Buffer); + + if (Ptr->All.PrivateData.Buffer != NULL) + MIDL_user_free(Ptr->All.PrivateData.Buffer); + + if (Ptr->All.SecurityDescriptor.SecurityDescriptor != NULL) + MIDL_user_free(Ptr->All.SecurityDescriptor.SecurityDescriptor); + + if (Ptr->All.LogonHours.LogonHours != NULL) + MIDL_user_free(Ptr->All.LogonHours.LogonHours); + break; + + default: + FIXME("Unsupported information class: %lu\n", InformationClass); + break; + } + + MIDL_user_free(Ptr); } /* EOF */ diff --git a/dll/win32/samsrv/samsrv.spec b/dll/win32/samsrv/samsrv.spec index 4d5e97d05ad..f7129cfd7fd 100644 --- a/dll/win32/samsrv/samsrv.spec +++ b/dll/win32/samsrv/samsrv.spec @@ -28,7 +28,7 @@ @ stdcall SamIFree_SAMPR_RETURNED_USTRING_ARRAY(ptr) @ stub SamIFree_SAMPR_SR_SECURITY_DESCRIPTOR @ stdcall SamIFree_SAMPR_ULONG_ARRAY(ptr) -@ stub SamIFree_SAMPR_USER_INFO_BUFFER +@ stdcall SamIFree_SAMPR_USER_INFO_BUFFER(ptr long) @ stub SamIFree_UserInternal6Information @ stub SamIGCLookupNames @ stub SamIGCLookupSids diff --git a/win32ss/user/consrv/frontends/tui/tuiterm.c b/win32ss/user/consrv/frontends/tui/tuiterm.c index 2ff25475133..6b092d00ff7 100644 --- a/win32ss/user/consrv/frontends/tui/tuiterm.c +++ b/win32ss/user/consrv/frontends/tui/tuiterm.c @@ -11,7 +11,7 @@ #include "consrv.h" #include "include/conio.h" -// #include "include/console.h" +#include "include/console.h" #include "include/settings.h" #include "tuiterm.h" #include @@ -258,14 +258,55 @@ TuiCopyRect(char *Dest, PCONSOLE_SCREEN_BUFFER Buff, SMALL_RECT* Region) static LRESULT CALLBACK TuiConsoleWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) { - if (msg == WM_ACTIVATE) +/* + PTUI_CONSOLE_DATA TuiData = NULL; + PCONSOLE Console = NULL; + + TuiData = TuiGetGuiData(hWnd); + if (TuiData == NULL) return 0; +*/ + + switch (msg) { - if (LOWORD(wParam) != WA_INACTIVE) + case WM_CHAR: + case WM_SYSCHAR: + case WM_KEYDOWN: + case WM_SYSKEYDOWN: + case WM_KEYUP: + case WM_SYSKEYUP: { - SetFocus(hWnd); - ConioDrawConsole(ActiveConsole->Console); + if (ConSrvValidateConsoleUnsafe(ActiveConsole->Console, CONSOLE_RUNNING, TRUE)) + { + MSG Message; + Message.hwnd = hWnd; + Message.message = msg; + Message.wParam = wParam; + Message.lParam = lParam; + + ConioProcessKey(ActiveConsole->Console, &Message); + LeaveCriticalSection(&ActiveConsole->Console->Lock); + } + break; } + + case WM_ACTIVATE: + { + if (ConSrvValidateConsoleUnsafe(ActiveConsole->Console, CONSOLE_RUNNING, TRUE)) + { + if (LOWORD(wParam) != WA_INACTIVE) + { + SetFocus(hWnd); + ConioDrawConsole(ActiveConsole->Console); + } + LeaveCriticalSection(&ActiveConsole->Console->Lock); + } + break; + } + + default: + break; } + return DefWindowProcW(hWnd, msg, wParam, lParam); } @@ -298,13 +339,6 @@ TuiConsoleThread(PVOID Data) { TranslateMessage(&msg); DispatchMessageW(&msg); - - if (msg.message == WM_CHAR || msg.message == WM_SYSCHAR || - msg.message == WM_KEYDOWN || msg.message == WM_SYSKEYDOWN || - msg.message == WM_KEYUP || msg.message == WM_SYSKEYUP) - { - ConioProcessKey(Console, &msg); - } } return 0;