From 7ff75bbc9240b29cdeb197da12df6a9f60dcdc2f Mon Sep 17 00:00:00 2001 From: Amine Khaldi Date: Fri, 24 Oct 2014 16:52:57 +0000 Subject: [PATCH 01/91] [ADVAPI32] * Move some functions from token.c to security.c. CORE-8540 svn path=/trunk/; revision=64962 --- reactos/dll/win32/advapi32/token/token.c | 385 --------------------- reactos/dll/win32/advapi32/wine/security.c | 373 ++++++++++++++++++++ 2 files changed, 373 insertions(+), 385 deletions(-) diff --git a/reactos/dll/win32/advapi32/token/token.c b/reactos/dll/win32/advapi32/token/token.c index 5cb88a90572..6be789095e6 100644 --- a/reactos/dll/win32/advapi32/token/token.c +++ b/reactos/dll/win32/advapi32/token/token.c @@ -14,357 +14,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(advapi); -/* - * @implemented - */ -BOOL WINAPI -AdjustTokenGroups(HANDLE TokenHandle, - BOOL ResetToDefault, - PTOKEN_GROUPS NewState, - DWORD BufferLength, - PTOKEN_GROUPS PreviousState, - PDWORD ReturnLength) -{ - NTSTATUS Status; - - Status = NtAdjustGroupsToken(TokenHandle, - ResetToDefault, - NewState, - BufferLength, - PreviousState, - (PULONG)ReturnLength); - if (!NT_SUCCESS(Status)) - { - SetLastError(RtlNtStatusToDosError(Status)); - return FALSE; - } - - return TRUE; -} - - -/* - * @implemented - */ -BOOL WINAPI -AdjustTokenPrivileges(HANDLE TokenHandle, - BOOL DisableAllPrivileges, - PTOKEN_PRIVILEGES NewState, - DWORD BufferLength, - PTOKEN_PRIVILEGES PreviousState, - PDWORD ReturnLength) -{ - NTSTATUS Status; - - Status = NtAdjustPrivilegesToken(TokenHandle, - DisableAllPrivileges, - NewState, - BufferLength, - PreviousState, - (PULONG)ReturnLength); - if (STATUS_NOT_ALL_ASSIGNED == Status) - { - SetLastError(ERROR_NOT_ALL_ASSIGNED); - return TRUE; - } - - if (!NT_SUCCESS(Status)) - { - SetLastError(RtlNtStatusToDosError(Status)); - return FALSE; - } - - /* AdjustTokenPrivileges is documented to do this */ - SetLastError(ERROR_SUCCESS); - - return TRUE; -} - - -/* - * @implemented - */ -BOOL WINAPI -GetTokenInformation(HANDLE TokenHandle, - TOKEN_INFORMATION_CLASS TokenInformationClass, - LPVOID TokenInformation, - DWORD TokenInformationLength, - PDWORD ReturnLength) -{ - NTSTATUS Status; - - Status = NtQueryInformationToken(TokenHandle, - TokenInformationClass, - TokenInformation, - TokenInformationLength, - (PULONG)ReturnLength); - if (!NT_SUCCESS(Status)) - { - SetLastError(RtlNtStatusToDosError(Status)); - return FALSE; - } - - return TRUE; -} - - -/* - * @implemented - */ -BOOL WINAPI -SetTokenInformation(HANDLE TokenHandle, - TOKEN_INFORMATION_CLASS TokenInformationClass, - LPVOID TokenInformation, - DWORD TokenInformationLength) -{ - NTSTATUS Status; - - Status = NtSetInformationToken(TokenHandle, - TokenInformationClass, - TokenInformation, - TokenInformationLength); - if (!NT_SUCCESS(Status)) - { - SetLastError(RtlNtStatusToDosError(Status)); - return FALSE; - } - - return TRUE; -} - - -/* - * @implemented - */ -BOOL -WINAPI -AccessCheck(IN PSECURITY_DESCRIPTOR pSecurityDescriptor, - IN HANDLE ClientToken, - IN DWORD DesiredAccess, - IN PGENERIC_MAPPING GenericMapping, - OUT PPRIVILEGE_SET PrivilegeSet OPTIONAL, - IN OUT LPDWORD PrivilegeSetLength, - OUT LPDWORD GrantedAccess, - OUT LPBOOL AccessStatus) -{ - NTSTATUS Status; - NTSTATUS NtAccessStatus; - - /* Do the access check */ - Status = NtAccessCheck(pSecurityDescriptor, - ClientToken, - DesiredAccess, - GenericMapping, - PrivilegeSet, - (PULONG)PrivilegeSetLength, - (PACCESS_MASK)GrantedAccess, - &NtAccessStatus); - - /* See if the access check operation succeeded */ - if (!NT_SUCCESS(Status)) - { - /* Check failed */ - SetLastError(RtlNtStatusToDosError(Status)); - return FALSE; - } - - /* Now check the access status */ - if (!NT_SUCCESS(NtAccessStatus)) - { - /* Access denied */ - SetLastError(RtlNtStatusToDosError(NtAccessStatus)); - *AccessStatus = FALSE; - } - else - { - /* Access granted */ - *AccessStatus = TRUE; - } - - /* Check succeeded */ - return TRUE; -} - -/* - * @unimplemented - */ -BOOL WINAPI AccessCheckByType( - PSECURITY_DESCRIPTOR pSecurityDescriptor, - PSID PrincipalSelfSid, - HANDLE ClientToken, - DWORD DesiredAccess, - POBJECT_TYPE_LIST ObjectTypeList, - DWORD ObjectTypeListLength, - PGENERIC_MAPPING GenericMapping, - PPRIVILEGE_SET PrivilegeSet, - LPDWORD PrivilegeSetLength, - LPDWORD GrantedAccess, - LPBOOL AccessStatus) -{ - FIXME("stub\n"); - - *AccessStatus = TRUE; - - return !*AccessStatus; -} - -/* - * @implemented - */ -BOOL WINAPI -OpenProcessToken(HANDLE ProcessHandle, - DWORD DesiredAccess, - PHANDLE TokenHandle) -{ - NTSTATUS Status; - - TRACE("%p, %x, %p.\n", ProcessHandle, DesiredAccess, TokenHandle); - - Status = NtOpenProcessToken(ProcessHandle, - DesiredAccess, - TokenHandle); - if (!NT_SUCCESS(Status)) - { - ERR("NtOpenProcessToken failed! Status %08x.\n", Status); - SetLastError(RtlNtStatusToDosError(Status)); - return FALSE; - } - - TRACE("Returning token %p.\n", *TokenHandle); - - return TRUE; -} - - -/* - * @implemented - */ -BOOL WINAPI -OpenThreadToken(HANDLE ThreadHandle, - DWORD DesiredAccess, - BOOL OpenAsSelf, - PHANDLE TokenHandle) -{ - NTSTATUS Status; - - Status = NtOpenThreadToken(ThreadHandle, - DesiredAccess, - OpenAsSelf, - TokenHandle); - if (!NT_SUCCESS(Status)) - { - SetLastError(RtlNtStatusToDosError(Status)); - return FALSE; - } - - return TRUE; -} - - -/* - * @implemented - */ -BOOL WINAPI -SetThreadToken(IN PHANDLE ThreadHandle OPTIONAL, - IN HANDLE TokenHandle) -{ - NTSTATUS Status; - HANDLE hThread; - - hThread = (ThreadHandle != NULL) ? *ThreadHandle : NtCurrentThread(); - - Status = NtSetInformationThread(hThread, - ThreadImpersonationToken, - &TokenHandle, - sizeof(HANDLE)); - if (!NT_SUCCESS(Status)) - { - SetLastError(RtlNtStatusToDosError(Status)); - return FALSE; - } - - return TRUE; -} - - -/* - * @implemented - */ -BOOL WINAPI -DuplicateTokenEx(IN HANDLE ExistingTokenHandle, - IN DWORD dwDesiredAccess, - IN LPSECURITY_ATTRIBUTES lpTokenAttributes OPTIONAL, - IN SECURITY_IMPERSONATION_LEVEL ImpersonationLevel, - IN TOKEN_TYPE TokenType, - OUT PHANDLE DuplicateTokenHandle) -{ - OBJECT_ATTRIBUTES ObjectAttributes; - NTSTATUS Status; - SECURITY_QUALITY_OF_SERVICE Sqos; - - TRACE("%p 0x%08x 0x%08x 0x%08x %p\n", ExistingTokenHandle, dwDesiredAccess, - ImpersonationLevel, TokenType, DuplicateTokenHandle); - - Sqos.Length = sizeof(SECURITY_QUALITY_OF_SERVICE); - Sqos.ImpersonationLevel = ImpersonationLevel; - Sqos.ContextTrackingMode = 0; - Sqos.EffectiveOnly = FALSE; - - if (lpTokenAttributes != NULL) - { - InitializeObjectAttributes(&ObjectAttributes, - NULL, - lpTokenAttributes->bInheritHandle ? OBJ_INHERIT : 0, - NULL, - lpTokenAttributes->lpSecurityDescriptor); - } - else - { - InitializeObjectAttributes(&ObjectAttributes, - NULL, - 0, - NULL, - NULL); - } - - ObjectAttributes.SecurityQualityOfService = &Sqos; - - Status = NtDuplicateToken(ExistingTokenHandle, - dwDesiredAccess, - &ObjectAttributes, - FALSE, - TokenType, - DuplicateTokenHandle); - if (!NT_SUCCESS(Status)) - { - ERR("NtDuplicateToken failed: Status %08x\n", Status); - SetLastError(RtlNtStatusToDosError(Status)); - return FALSE; - } - - TRACE("Returning token %p.\n", *DuplicateTokenHandle); - - return TRUE; -} - - -/* - * @implemented - */ -BOOL WINAPI -DuplicateToken(IN HANDLE ExistingTokenHandle, - IN SECURITY_IMPERSONATION_LEVEL ImpersonationLevel, - OUT PHANDLE DuplicateTokenHandle) -{ - return DuplicateTokenEx(ExistingTokenHandle, - TOKEN_IMPERSONATE | TOKEN_QUERY, - NULL, - ImpersonationLevel, - TokenImpersonation, - DuplicateTokenHandle); -} - - /* * @implemented */ @@ -617,23 +266,6 @@ AllocAndReadRestrictedSids: return Ret; } - -BOOL WINAPI -CreateRestrictedToken(HANDLE TokenHandle, - DWORD Flags, - DWORD DisableSidCount, - PSID_AND_ATTRIBUTES pSidAndAttributes, - DWORD DeletePrivilegeCount, - PLUID_AND_ATTRIBUTES pLUIDAndAttributes, - DWORD RestrictedSidCount, - PSID_AND_ATTRIBUTES pSIDAndAttributes, - PHANDLE NewTokenHandle) -{ - UNIMPLEMENTED; - return FALSE; -} - - /* * @unimplemented */ @@ -711,20 +343,3 @@ GetSiteSidFromToken(IN HANDLE TokenHandle) RtlFreeHeap(RtlGetProcessHeap(), 0, RestrictedSids); return PSiteSid; } - - -BOOL -WINAPI -CreateProcessWithTokenW(IN HANDLE hToken, - IN DWORD dwLogonFlags, - IN LPCWSTR lpApplicationName OPTIONAL, - IN OUT LPWSTR lpCommandLine OPTIONAL, - IN DWORD dwCreationFlags, - IN LPVOID lpEnvironment OPTIONAL, - IN LPCWSTR lpCurrentDirectory OPTIONAL, - IN LPSTARTUPINFOW lpStartupInfo, - OUT LPPROCESS_INFORMATION lpProcessInfo) -{ - UNIMPLEMENTED; - return FALSE; -} diff --git a/reactos/dll/win32/advapi32/wine/security.c b/reactos/dll/win32/advapi32/wine/security.c index 130f6e5b43f..7dd58495650 100644 --- a/reactos/dll/win32/advapi32/wine/security.c +++ b/reactos/dll/win32/advapi32/wine/security.c @@ -313,6 +313,212 @@ static const RECORD SidTable[] = /* Exported functions */ +/* + * @implemented + */ +BOOL WINAPI +OpenProcessToken(HANDLE ProcessHandle, + DWORD DesiredAccess, + PHANDLE TokenHandle) +{ + NTSTATUS Status; + + TRACE("%p, %x, %p.\n", ProcessHandle, DesiredAccess, TokenHandle); + + Status = NtOpenProcessToken(ProcessHandle, + DesiredAccess, + TokenHandle); + if (!NT_SUCCESS(Status)) + { + ERR("NtOpenProcessToken failed! Status %08x.\n", Status); + SetLastError(RtlNtStatusToDosError(Status)); + return FALSE; + } + + TRACE("Returning token %p.\n", *TokenHandle); + + return TRUE; +} + +/* + * @implemented + */ +BOOL WINAPI +OpenThreadToken(HANDLE ThreadHandle, + DWORD DesiredAccess, + BOOL OpenAsSelf, + PHANDLE TokenHandle) +{ + NTSTATUS Status; + + Status = NtOpenThreadToken(ThreadHandle, + DesiredAccess, + OpenAsSelf, + TokenHandle); + if (!NT_SUCCESS(Status)) + { + SetLastError(RtlNtStatusToDosError(Status)); + return FALSE; + } + + return TRUE; +} + +/* + * @implemented + */ +BOOL WINAPI +AdjustTokenGroups(HANDLE TokenHandle, + BOOL ResetToDefault, + PTOKEN_GROUPS NewState, + DWORD BufferLength, + PTOKEN_GROUPS PreviousState, + PDWORD ReturnLength) +{ + NTSTATUS Status; + + Status = NtAdjustGroupsToken(TokenHandle, + ResetToDefault, + NewState, + BufferLength, + PreviousState, + (PULONG)ReturnLength); + if (!NT_SUCCESS(Status)) + { + SetLastError(RtlNtStatusToDosError(Status)); + return FALSE; + } + + return TRUE; +} + +/* + * @implemented + */ +BOOL WINAPI +AdjustTokenPrivileges(HANDLE TokenHandle, + BOOL DisableAllPrivileges, + PTOKEN_PRIVILEGES NewState, + DWORD BufferLength, + PTOKEN_PRIVILEGES PreviousState, + PDWORD ReturnLength) +{ + NTSTATUS Status; + + Status = NtAdjustPrivilegesToken(TokenHandle, + DisableAllPrivileges, + NewState, + BufferLength, + PreviousState, + (PULONG)ReturnLength); + if (STATUS_NOT_ALL_ASSIGNED == Status) + { + SetLastError(ERROR_NOT_ALL_ASSIGNED); + return TRUE; + } + + if (!NT_SUCCESS(Status)) + { + SetLastError(RtlNtStatusToDosError(Status)); + return FALSE; + } + + /* AdjustTokenPrivileges is documented to do this */ + SetLastError(ERROR_SUCCESS); + + return TRUE; +} + +/* + * @implemented + */ +BOOL WINAPI +GetTokenInformation(HANDLE TokenHandle, + TOKEN_INFORMATION_CLASS TokenInformationClass, + LPVOID TokenInformation, + DWORD TokenInformationLength, + PDWORD ReturnLength) +{ + NTSTATUS Status; + + Status = NtQueryInformationToken(TokenHandle, + TokenInformationClass, + TokenInformation, + TokenInformationLength, + (PULONG)ReturnLength); + if (!NT_SUCCESS(Status)) + { + SetLastError(RtlNtStatusToDosError(Status)); + return FALSE; + } + + return TRUE; +} + +/* + * @implemented + */ +BOOL WINAPI +SetTokenInformation(HANDLE TokenHandle, + TOKEN_INFORMATION_CLASS TokenInformationClass, + LPVOID TokenInformation, + DWORD TokenInformationLength) +{ + NTSTATUS Status; + + Status = NtSetInformationToken(TokenHandle, + TokenInformationClass, + TokenInformation, + TokenInformationLength); + if (!NT_SUCCESS(Status)) + { + SetLastError(RtlNtStatusToDosError(Status)); + return FALSE; + } + + return TRUE; +} + +/* + * @implemented + */ +BOOL WINAPI +SetThreadToken(IN PHANDLE ThreadHandle OPTIONAL, + IN HANDLE TokenHandle) +{ + NTSTATUS Status; + HANDLE hThread; + + hThread = (ThreadHandle != NULL) ? *ThreadHandle : NtCurrentThread(); + + Status = NtSetInformationThread(hThread, + ThreadImpersonationToken, + &TokenHandle, + sizeof(HANDLE)); + if (!NT_SUCCESS(Status)) + { + SetLastError(RtlNtStatusToDosError(Status)); + return FALSE; + } + + return TRUE; +} + +BOOL WINAPI +CreateRestrictedToken(HANDLE TokenHandle, + DWORD Flags, + DWORD DisableSidCount, + PSID_AND_ATTRIBUTES pSidAndAttributes, + DWORD DeletePrivilegeCount, + PLUID_AND_ATTRIBUTES pLUIDAndAttributes, + DWORD RestrictedSidCount, + PSID_AND_ATTRIBUTES pSIDAndAttributes, + PHANDLE NewTokenHandle) +{ + UNIMPLEMENTED; + return FALSE; +} + /* * @implemented */ @@ -593,6 +799,81 @@ GetLengthSid(PSID pSid) return (DWORD)RtlLengthSid(pSid); } +/* + * @implemented + */ +BOOL +WINAPI +AccessCheck(IN PSECURITY_DESCRIPTOR pSecurityDescriptor, + IN HANDLE ClientToken, + IN DWORD DesiredAccess, + IN PGENERIC_MAPPING GenericMapping, + OUT PPRIVILEGE_SET PrivilegeSet OPTIONAL, + IN OUT LPDWORD PrivilegeSetLength, + OUT LPDWORD GrantedAccess, + OUT LPBOOL AccessStatus) +{ + NTSTATUS Status; + NTSTATUS NtAccessStatus; + + /* Do the access check */ + Status = NtAccessCheck(pSecurityDescriptor, + ClientToken, + DesiredAccess, + GenericMapping, + PrivilegeSet, + (PULONG)PrivilegeSetLength, + (PACCESS_MASK)GrantedAccess, + &NtAccessStatus); + + /* See if the access check operation succeeded */ + if (!NT_SUCCESS(Status)) + { + /* Check failed */ + SetLastError(RtlNtStatusToDosError(Status)); + return FALSE; + } + + /* Now check the access status */ + if (!NT_SUCCESS(NtAccessStatus)) + { + /* Access denied */ + SetLastError(RtlNtStatusToDosError(NtAccessStatus)); + *AccessStatus = FALSE; + } + else + { + /* Access granted */ + *AccessStatus = TRUE; + } + + /* Check succeeded */ + return TRUE; +} + +/* + * @unimplemented + */ +BOOL WINAPI AccessCheckByType( + PSECURITY_DESCRIPTOR pSecurityDescriptor, + PSID PrincipalSelfSid, + HANDLE ClientToken, + DWORD DesiredAccess, + POBJECT_TYPE_LIST ObjectTypeList, + DWORD ObjectTypeListLength, + PGENERIC_MAPPING GenericMapping, + PPRIVILEGE_SET PrivilegeSet, + LPDWORD PrivilegeSetLength, + LPDWORD GrantedAccess, + LPBOOL AccessStatus) +{ + FIXME("stub\n"); + + *AccessStatus = TRUE; + + return !*AccessStatus; +} + /********************************************************************** * PrivilegeCheck EXPORTED * @@ -1801,6 +2082,98 @@ ConvertSidToStringSidA(PSID Sid, return TRUE; } +BOOL +WINAPI +CreateProcessWithTokenW(IN HANDLE hToken, + IN DWORD dwLogonFlags, + IN LPCWSTR lpApplicationName OPTIONAL, + IN OUT LPWSTR lpCommandLine OPTIONAL, + IN DWORD dwCreationFlags, + IN LPVOID lpEnvironment OPTIONAL, + IN LPCWSTR lpCurrentDirectory OPTIONAL, + IN LPSTARTUPINFOW lpStartupInfo, + OUT LPPROCESS_INFORMATION lpProcessInfo) +{ + UNIMPLEMENTED; + return FALSE; +} + +/* + * @implemented + */ +BOOL WINAPI +DuplicateTokenEx(IN HANDLE ExistingTokenHandle, + IN DWORD dwDesiredAccess, + IN LPSECURITY_ATTRIBUTES lpTokenAttributes OPTIONAL, + IN SECURITY_IMPERSONATION_LEVEL ImpersonationLevel, + IN TOKEN_TYPE TokenType, + OUT PHANDLE DuplicateTokenHandle) +{ + OBJECT_ATTRIBUTES ObjectAttributes; + NTSTATUS Status; + SECURITY_QUALITY_OF_SERVICE Sqos; + + TRACE("%p 0x%08x 0x%08x 0x%08x %p\n", ExistingTokenHandle, dwDesiredAccess, + ImpersonationLevel, TokenType, DuplicateTokenHandle); + + Sqos.Length = sizeof(SECURITY_QUALITY_OF_SERVICE); + Sqos.ImpersonationLevel = ImpersonationLevel; + Sqos.ContextTrackingMode = 0; + Sqos.EffectiveOnly = FALSE; + + if (lpTokenAttributes != NULL) + { + InitializeObjectAttributes(&ObjectAttributes, + NULL, + lpTokenAttributes->bInheritHandle ? OBJ_INHERIT : 0, + NULL, + lpTokenAttributes->lpSecurityDescriptor); + } + else + { + InitializeObjectAttributes(&ObjectAttributes, + NULL, + 0, + NULL, + NULL); + } + + ObjectAttributes.SecurityQualityOfService = &Sqos; + + Status = NtDuplicateToken(ExistingTokenHandle, + dwDesiredAccess, + &ObjectAttributes, + FALSE, + TokenType, + DuplicateTokenHandle); + if (!NT_SUCCESS(Status)) + { + ERR("NtDuplicateToken failed: Status %08x\n", Status); + SetLastError(RtlNtStatusToDosError(Status)); + return FALSE; + } + + TRACE("Returning token %p.\n", *DuplicateTokenHandle); + + return TRUE; +} + +/* + * @implemented + */ +BOOL WINAPI +DuplicateToken(IN HANDLE ExistingTokenHandle, + IN SECURITY_IMPERSONATION_LEVEL ImpersonationLevel, + OUT PHANDLE DuplicateTokenHandle) +{ + return DuplicateTokenEx(ExistingTokenHandle, + TOKEN_IMPERSONATE | TOKEN_QUERY, + NULL, + ImpersonationLevel, + TokenImpersonation, + DuplicateTokenHandle); +} + /* * @implemented */ From f54eb842d6c3ad25dcd5b0a47ce822ccc6c37858 Mon Sep 17 00:00:00 2001 From: Amine Khaldi Date: Fri, 24 Oct 2014 16:57:17 +0000 Subject: [PATCH 02/91] [ADVAPI32] * Reorder AllocateLocallyUniqueId() to reduce difference to Wine. CORE-8540 svn path=/trunk/; revision=64963 --- reactos/dll/win32/advapi32/wine/security.c | 36 +++++++++++----------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/reactos/dll/win32/advapi32/wine/security.c b/reactos/dll/win32/advapi32/wine/security.c index 7dd58495650..00884176078 100644 --- a/reactos/dll/win32/advapi32/wine/security.c +++ b/reactos/dll/win32/advapi32/wine/security.c @@ -799,6 +799,24 @@ GetLengthSid(PSID pSid) return (DWORD)RtlLengthSid(pSid); } +/* + * @implemented + */ +BOOL WINAPI +AllocateLocallyUniqueId(PLUID Luid) +{ + NTSTATUS Status; + + Status = NtAllocateLocallyUniqueId (Luid); + if (!NT_SUCCESS (Status)) + { + SetLastError(RtlNtStatusToDosError(Status)); + return FALSE; + } + + return TRUE; +} + /* * @implemented */ @@ -2174,24 +2192,6 @@ DuplicateToken(IN HANDLE ExistingTokenHandle, DuplicateTokenHandle); } -/* - * @implemented - */ -BOOL WINAPI -AllocateLocallyUniqueId(PLUID Luid) -{ - NTSTATUS Status; - - Status = NtAllocateLocallyUniqueId (Luid); - if (!NT_SUCCESS (Status)) - { - SetLastError(RtlNtStatusToDosError(Status)); - return FALSE; - } - - return TRUE; -} - /****************************************************************************** * ComputeStringSidSize */ From 2c1be0283738b3964da3a8307057827698adfec6 Mon Sep 17 00:00:00 2001 From: Thomas Faber Date: Fri, 24 Oct 2014 17:28:21 +0000 Subject: [PATCH 03/91] [WIN32K] - Move call to UserRegisterClass out of SEH. All parameters are kernel pointers, so exceptions here are critical kernel bugs that shouldn't be hidden. CORE-8702 #resolve svn path=/trunk/; revision=64964 --- reactos/win32ss/user/ntuser/class.c | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/reactos/win32ss/user/ntuser/class.c b/reactos/win32ss/user/ntuser/class.c index 4c0db763055..256dc22c59a 100644 --- a/reactos/win32ss/user/ntuser/class.c +++ b/reactos/win32ss/user/ntuser/class.c @@ -230,7 +230,7 @@ IntDestroyClass(IN OUT PCLS Class) // Fixes running the static test then run class test issue. // Some applications do not use UnregisterClass before exiting. - // Keep from reusing the same atom with case insensitive + // Keep from reusing the same atom with case insensitive // comparisons, remove registration of the atom if not zeroed. if (Class->atomClassName) IntDeregisterClassAtom(Class->atomClassName); @@ -1937,7 +1937,7 @@ UserSetClassLongPtr(IN PCLS Class, // hIconSm, A handle to a small icon that is associated with the window class. // If this member is NULL, the system searches the icon resource specified by // the hIcon member for an icon of the appropriate size to use as the small icon. - // + // case GCLP_HICON: #ifdef NEW_CURSORICON { @@ -2445,6 +2445,7 @@ NtUserRegisterClassExWOW( UNICODE_STRING CapturedName = {0}, CapturedMenuName = {0}; RTL_ATOM Ret = (RTL_ATOM)0; PPROCESSINFO ppi = GetW32ProcessInfo(); + BOOL Exception = FALSE; if (Flags & ~(CSF_ANSIPROC)) { @@ -2536,7 +2537,17 @@ InvalidParameter: } TRACE("NtUserRegisterClassExWOW MnuN %wZ\n",&CapturedMenuName); + } + _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) + { + ERR("NtUserRegisterClassExWOW Exception Error!\n"); + SetLastNtError(_SEH2_GetExceptionCode()); + Exception = TRUE; + } + _SEH2_END; + if (!Exception) + { /* Register the class */ Ret = UserRegisterClass(&CapturedClassInfo, &CapturedName, @@ -2544,18 +2555,12 @@ InvalidParameter: fnID, Flags); } - _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) - { - ERR("NtUserRegisterClassExWOW Exception Error!\n"); - SetLastNtError(_SEH2_GetExceptionCode()); - } - _SEH2_END; -/* + if (!Ret) { - ERR("NtUserRegisterClassExWOW Null Return!\n"); + TRACE("NtUserRegisterClassExWOW Null Return!\n"); } - */ + UserLeave(); return Ret; From de410717f3e27246960cdb87a313f4108e31806c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Gardou?= Date: Fri, 24 Oct 2014 17:31:37 +0000 Subject: [PATCH 04/91] [WIN32K] - Differenciate 16bpp 565 from 16bpp 555 in alphablending code. - Fix RGB vs BGR mismatch CORE-8695 svn path=/trunk/; revision=64965 --- reactos/win32ss/gdi/dib/dib16bpp.c | 138 +++++++++++++++++++++-------- 1 file changed, 100 insertions(+), 38 deletions(-) diff --git a/reactos/win32ss/gdi/dib/dib16bpp.c b/reactos/win32ss/gdi/dib/dib16bpp.c index 713529533f0..1fd539cb4aa 100644 --- a/reactos/win32ss/gdi/dib/dib16bpp.c +++ b/reactos/win32ss/gdi/dib/dib16bpp.c @@ -542,11 +542,23 @@ typedef union USHORT us; struct { - USHORT red :5; - USHORT green :6; USHORT blue :5; + USHORT green :6; + USHORT red :5; } col; -} NICEPIXEL16; +} NICEPIXEL16_565; + +typedef union +{ + USHORT us; + struct + { + USHORT blue :5; + USHORT green :5; + USHORT red :5; + USHORT xxxx :1; + } col; +} NICEPIXEL16_555; static __inline UCHAR Clamp6(ULONG val) @@ -568,8 +580,7 @@ DIB_16BPP_AlphaBlend(SURFOBJ* Dest, SURFOBJ* Source, RECTL* DestRect, INT DstX, DstY, SrcX, SrcY; BLENDFUNCTION BlendFunc; NICEPIXEL32 SrcPixel32; - NICEPIXEL16 DstPixel16; - UCHAR Alpha, Alpha6, Alpha5; + UCHAR Alpha; EXLATEOBJ* pexlo; EXLATEOBJ exloSrcRGB; @@ -609,46 +620,97 @@ DIB_16BPP_AlphaBlend(SURFOBJ* Dest, SURFOBJ* Source, RECTL* DestRect, pexlo = CONTAINING_RECORD(ColorTranslation, EXLATEOBJ, xlo); EXLATEOBJ_vInitialize(&exloSrcRGB, pexlo->ppalSrc, &gpalRGB, 0, 0, 0); - SrcY = SourceRect->top; - DstY = DestRect->top; - while ( DstY < DestRect->bottom ) + if (pexlo->ppalDst->flFlags & PAL_RGB16_555) { - SrcX = SourceRect->left; - DstX = DestRect->left; - while(DstX < DestRect->right) - { - SrcPixel32.ul = DIB_GetSource(Source, SrcX, SrcY, &exloSrcRGB.xlo); - SrcPixel32.col.red = (SrcPixel32.col.red * BlendFunc.SourceConstantAlpha) / 255; - SrcPixel32.col.green = (SrcPixel32.col.green * BlendFunc.SourceConstantAlpha) / 255; - SrcPixel32.col.blue = (SrcPixel32.col.blue * BlendFunc.SourceConstantAlpha) / 255; + NICEPIXEL16_555 DstPixel16; - Alpha = ((BlendFunc.AlphaFormat & AC_SRC_ALPHA) != 0) ? - (SrcPixel32.col.alpha * BlendFunc.SourceConstantAlpha) / 255 : - BlendFunc.SourceConstantAlpha; + SrcY = SourceRect->top; + DstY = DestRect->top; + while ( DstY < DestRect->bottom ) + { + SrcX = SourceRect->left; + DstX = DestRect->left; + while(DstX < DestRect->right) + { + SrcPixel32.ul = DIB_GetSource(Source, SrcX, SrcY, &exloSrcRGB.xlo); + SrcPixel32.col.red = (SrcPixel32.col.red * BlendFunc.SourceConstantAlpha) / 255; + SrcPixel32.col.green = (SrcPixel32.col.green * BlendFunc.SourceConstantAlpha) / 255; + SrcPixel32.col.blue = (SrcPixel32.col.blue * BlendFunc.SourceConstantAlpha) / 255; - Alpha6 = Alpha >> 2; - Alpha5 = Alpha >> 3; + Alpha = ((BlendFunc.AlphaFormat & AC_SRC_ALPHA) != 0) ? + (SrcPixel32.col.alpha * BlendFunc.SourceConstantAlpha) / 255 : + BlendFunc.SourceConstantAlpha; - DstPixel16.us = DIB_16BPP_GetPixel(Dest, DstX, DstY) & 0xFFFF; - /* Perform bit loss */ - SrcPixel32.col.red >>= 3; - SrcPixel32.col.green >>= 2; - SrcPixel32.col.blue >>= 3; + Alpha >>= 3; - /* Do the blend in the right bit depth */ - DstPixel16.col.red = Clamp5((DstPixel16.col.red * (31 - Alpha5)) / 31 + SrcPixel32.col.red); - DstPixel16.col.green = Clamp6((DstPixel16.col.green * (63 - Alpha6)) / 63 + SrcPixel32.col.green); - DstPixel16.col.blue = Clamp5((DstPixel16.col.blue * (31 - Alpha5)) / 31 + SrcPixel32.col.blue); + DstPixel16.us = DIB_16BPP_GetPixel(Dest, DstX, DstY) & 0xFFFF; + /* Perform bit loss */ + SrcPixel32.col.red >>= 3; + SrcPixel32.col.green >>= 3; + SrcPixel32.col.blue >>= 3; - DIB_16BPP_PutPixel(Dest, DstX, DstY, DstPixel16.us); + /* Do the blend in the right bit depth */ + DstPixel16.col.red = Clamp5((DstPixel16.col.red * (31 - Alpha)) / 31 + SrcPixel32.col.red); + DstPixel16.col.green = Clamp5((DstPixel16.col.green * (31 - Alpha)) / 31 + SrcPixel32.col.green); + DstPixel16.col.blue = Clamp5((DstPixel16.col.blue * (31 - Alpha)) / 31 + SrcPixel32.col.blue); - DstX++; - SrcX = SourceRect->left + ((DstX-DestRect->left)*(SourceRect->right - SourceRect->left)) - /(DestRect->right-DestRect->left); - } - DstY++; - SrcY = SourceRect->top + ((DstY-DestRect->top)*(SourceRect->bottom - SourceRect->top)) - /(DestRect->bottom-DestRect->top); + DIB_16BPP_PutPixel(Dest, DstX, DstY, DstPixel16.us); + + DstX++; + SrcX = SourceRect->left + ((DstX-DestRect->left)*(SourceRect->right - SourceRect->left)) + /(DestRect->right-DestRect->left); + } + DstY++; + SrcY = SourceRect->top + ((DstY-DestRect->top)*(SourceRect->bottom - SourceRect->top)) + /(DestRect->bottom-DestRect->top); + } + } + else + { + NICEPIXEL16_565 DstPixel16; + UCHAR Alpha6, Alpha5; + + SrcY = SourceRect->top; + DstY = DestRect->top; + while ( DstY < DestRect->bottom ) + { + SrcX = SourceRect->left; + DstX = DestRect->left; + while(DstX < DestRect->right) + { + SrcPixel32.ul = DIB_GetSource(Source, SrcX, SrcY, &exloSrcRGB.xlo); + SrcPixel32.col.red = (SrcPixel32.col.red * BlendFunc.SourceConstantAlpha) / 255; + SrcPixel32.col.green = (SrcPixel32.col.green * BlendFunc.SourceConstantAlpha) / 255; + SrcPixel32.col.blue = (SrcPixel32.col.blue * BlendFunc.SourceConstantAlpha) / 255; + + Alpha = ((BlendFunc.AlphaFormat & AC_SRC_ALPHA) != 0) ? + (SrcPixel32.col.alpha * BlendFunc.SourceConstantAlpha) / 255 : + BlendFunc.SourceConstantAlpha; + + Alpha6 = Alpha >> 2; + Alpha5 = Alpha >> 3; + + DstPixel16.us = DIB_16BPP_GetPixel(Dest, DstX, DstY) & 0xFFFF; + /* Perform bit loss */ + SrcPixel32.col.red >>= 3; + SrcPixel32.col.green >>= 2; + SrcPixel32.col.blue >>= 3; + + /* Do the blend in the right bit depth */ + DstPixel16.col.red = Clamp5((DstPixel16.col.red * (31 - Alpha5)) / 31 + SrcPixel32.col.red); + DstPixel16.col.green = Clamp6((DstPixel16.col.green * (63 - Alpha6)) / 63 + SrcPixel32.col.green); + DstPixel16.col.blue = Clamp5((DstPixel16.col.blue * (31 - Alpha5)) / 31 + SrcPixel32.col.blue); + + DIB_16BPP_PutPixel(Dest, DstX, DstY, DstPixel16.us); + + DstX++; + SrcX = SourceRect->left + ((DstX-DestRect->left)*(SourceRect->right - SourceRect->left)) + /(DestRect->right-DestRect->left); + } + DstY++; + SrcY = SourceRect->top + ((DstY-DestRect->top)*(SourceRect->bottom - SourceRect->top)) + /(DestRect->bottom-DestRect->top); + } } EXLATEOBJ_vCleanup(&exloSrcRGB); From a09a102a08cac7b2809229b963dfa93f6364d2d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Gardou?= Date: Fri, 24 Oct 2014 17:31:46 +0000 Subject: [PATCH 05/91] [WIN32K] - First implementation of CreateDIBitmap with the undocumented CBM_CREATEDIB flag. CORE-8695 svn path=/trunk/; revision=64966 --- reactos/win32ss/gdi/gdi32/objects/bitmap.c | 10 +++ reactos/win32ss/gdi/ntgdi/bitmaps.c | 18 +++--- reactos/win32ss/gdi/ntgdi/dibobj.c | 75 ++++++++++++++++++++-- reactos/win32ss/gdi/ntgdi/intgdi.h | 9 ++- 4 files changed, 95 insertions(+), 17 deletions(-) diff --git a/reactos/win32ss/gdi/gdi32/objects/bitmap.c b/reactos/win32ss/gdi/gdi32/objects/bitmap.c index 3ba54c165ef..4173e4ba84c 100644 --- a/reactos/win32ss/gdi/gdi32/objects/bitmap.c +++ b/reactos/win32ss/gdi/gdi32/objects/bitmap.c @@ -480,6 +480,9 @@ CreateDIBitmap( GdiSetLastError(ERROR_INVALID_PARAMETER); return 0; } + + /* Use the header from the data */ + Header = &Data->bmiHeader; } /* Header is required */ @@ -507,6 +510,13 @@ CreateDIBitmap( return 0; } + /* If some Bits are given, only DIB_PAL_COLORS and DIB_RGB_COLORS are valid */ + if (Bits && (ColorUse > DIB_PAL_COLORS)) + { + GdiSetLastError(ERROR_INVALID_PARAMETER); + return 0; + } + /* Negative width is not allowed */ if (width < 0) return 0; diff --git a/reactos/win32ss/gdi/ntgdi/bitmaps.c b/reactos/win32ss/gdi/ntgdi/bitmaps.c index 430622bf014..e72dec295e7 100644 --- a/reactos/win32ss/gdi/ntgdi/bitmaps.c +++ b/reactos/win32ss/gdi/ntgdi/bitmaps.c @@ -217,7 +217,9 @@ HBITMAP FASTCALL IntCreateCompatibleBitmap( PDC Dc, INT Width, - INT Height) + INT Height, + UINT Planes, + UINT Bpp) { HBITMAP Bmp = NULL; PPALETTE ppal; @@ -234,8 +236,8 @@ IntCreateCompatibleBitmap( Bmp = GreCreateBitmap(abs(Width), abs(Height), - 1, - Dc->ppdev->gdiinfo.cBitsPixel, + Planes ? Planes : 1, + Bpp ? Bpp : Dc->ppdev->gdiinfo.cBitsPixel, NULL); psurf = SURFACE_ShareLockSurface(Bmp); ASSERT(psurf); @@ -266,8 +268,8 @@ IntCreateCompatibleBitmap( Bmp = GreCreateBitmap(abs(Width), abs(Height), - 1, - dibs.dsBm.bmBitsPixel, + Planes ? Planes : 1, + Bpp ? Bpp : dibs.dsBm.bmBitsPixel, NULL); psurfBmp = SURFACE_ShareLockSurface(Bmp); ASSERT(psurfBmp); @@ -291,8 +293,8 @@ IntCreateCompatibleBitmap( bi->bmiHeader.biSize = sizeof(bi->bmiHeader); bi->bmiHeader.biWidth = Width; bi->bmiHeader.biHeight = Height; - bi->bmiHeader.biPlanes = dibs.dsBmih.biPlanes; - bi->bmiHeader.biBitCount = dibs.dsBmih.biBitCount; + bi->bmiHeader.biPlanes = Planes ? Planes : dibs.dsBmih.biPlanes; + bi->bmiHeader.biBitCount = Bpp ? Bpp : dibs.dsBmih.biBitCount; bi->bmiHeader.biCompression = dibs.dsBmih.biCompression; bi->bmiHeader.biSizeImage = 0; bi->bmiHeader.biXPelsPerMeter = dibs.dsBmih.biXPelsPerMeter; @@ -373,7 +375,7 @@ NtGdiCreateCompatibleBitmap( return NULL; } - Bmp = IntCreateCompatibleBitmap(Dc, Width, Height); + Bmp = IntCreateCompatibleBitmap(Dc, Width, Height, 0, 0); DC_UnlockDc(Dc); return Bmp; diff --git a/reactos/win32ss/gdi/ntgdi/dibobj.c b/reactos/win32ss/gdi/ntgdi/dibobj.c index 2dc749ecc1c..304d00e66a4 100644 --- a/reactos/win32ss/gdi/ntgdi/dibobj.c +++ b/reactos/win32ss/gdi/ntgdi/dibobj.c @@ -1317,7 +1317,9 @@ IntCreateDIBitmap( PDC Dc, INT width, INT height, + UINT planes, UINT bpp, + ULONG compression, DWORD init, LPBYTE bits, PBITMAPINFO data, @@ -1325,12 +1327,16 @@ IntCreateDIBitmap( { HBITMAP handle; BOOL fColor; + ULONG BmpFormat = 0; + + if (planes && bpp) + BmpFormat = BitmapFormat(planes * bpp, compression); // Check if we should create a monochrome or color bitmap. We create a monochrome bitmap only if it has exactly 2 // colors, which are black followed by white, nothing else. In all other cases, we create a color bitmap. - if (bpp != 1) fColor = TRUE; - else if ((coloruse != DIB_RGB_COLORS) || (init != CBM_INIT) || !data) fColor = FALSE; + if (BmpFormat != BMF_1BPP) fColor = TRUE; + else if ((coloruse > DIB_RGB_COLORS) || (init != CBM_INIT) || !data) fColor = FALSE; else { const RGBQUAD *rgb = (RGBQUAD*)((PBYTE)data + data->bmiHeader.biSize); @@ -1351,7 +1357,16 @@ IntCreateDIBitmap( // Now create the bitmap if (fColor) { - handle = IntCreateCompatibleBitmap(Dc, width, height); + if (init & CBM_CREATDIB) + { + /* Undocumented flag which creates a DDB of the format specified by the bitmap info. */ + handle = IntCreateCompatibleBitmap(Dc, width, height, planes, bpp); + } + else + { + /* Create a regular compatible bitmap, in the same format as the device */ + handle = IntCreateCompatibleBitmap(Dc, width, height, 0, 0); + } } else { @@ -1365,8 +1380,47 @@ IntCreateDIBitmap( if (height < 0) height = -height; - if (NULL != handle && CBM_INIT == init) + if ((NULL != handle) && (CBM_INIT & init)) { + if (init & CBM_CREATDIB) + { + PSURFACE Surface; + PPALETTE Palette; + NTSTATUS Status = STATUS_SUCCESS; + + Surface = SURFACE_ShareLockSurface(handle); + ASSERT(Surface); + + Palette = CreateDIBPalette(data, Dc, coloruse); + ASSERT(Palette); + SURFACE_vSetPalette(Surface, Palette); + PALETTE_ShareUnlockPalette(Palette); + + if (Surface->SurfObj.pvBits) + { + _SEH2_TRY + { + RtlCopyMemory(Surface->SurfObj.pvBits, bits, + abs(Surface->sizlDim.cy * Surface->SurfObj.lDelta)); + } + _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) + { + Status = _SEH2_GetExceptionCode(); + } + _SEH2_END + } + + SURFACE_ShareUnlockSurface(Surface); + + if (!NT_SUCCESS(Status)) + { + SetLastNtError(Status); + GreDeleteObject(handle); + handle = NULL; + } + return handle; + } + IntSetDIBits(Dc, handle, 0, height, bits, data, coloruse); } @@ -1458,7 +1512,8 @@ GreCreateDIBitmapInternal( { PDC Dc; HBITMAP Bmp; - WORD bpp; + USHORT bpp, planes; + DWORD compression; HDC hdcDest; if (!hDc) /* 1bpp monochrome bitmap */ @@ -1484,10 +1539,18 @@ GreCreateDIBitmapInternal( /* It's OK to set bpp=0 here, as IntCreateDIBitmap will create a compatible Bitmap * if bpp != 1 and ignore the real value that was passed */ if (pbmi) + { bpp = pbmi->bmiHeader.biBitCount; + planes = pbmi->bmiHeader.biPlanes; + compression = pbmi->bmiHeader.biCompression; + } else + { bpp = 0; - Bmp = IntCreateDIBitmap(Dc, cx, cy, bpp, fInit, pjInit, pbmi, iUsage); + planes = 0; + compression = 0; + } + Bmp = IntCreateDIBitmap(Dc, cx, cy, bpp, planes, compression, fInit, pjInit, pbmi, iUsage); DC_UnlockDc(Dc); if(!hDc) diff --git a/reactos/win32ss/gdi/ntgdi/intgdi.h b/reactos/win32ss/gdi/ntgdi/intgdi.h index 913470a8a02..6971510be01 100644 --- a/reactos/win32ss/gdi/ntgdi/intgdi.h +++ b/reactos/win32ss/gdi/ntgdi/intgdi.h @@ -87,9 +87,12 @@ IntGetSysColor(INT nIndex); HBITMAP FASTCALL -IntCreateCompatibleBitmap(PDC Dc, - INT Width, - INT Height); +IntCreateCompatibleBitmap( + _In_ PDC Dc, + _In_ INT Width, + _In_ INT Height, + _In_ UINT Bpp, + _In_ UINT Planes); WORD APIENTRY IntGdiSetHookFlags(HDC hDC, WORD Flags); From 954bd930d0af4335faebae68c77570d25ebd1020 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Gardou?= Date: Fri, 24 Oct 2014 17:31:50 +0000 Subject: [PATCH 06/91] [USER32] - Use CreateDIBitmap with the CDM_CREATEDIB undocumented flag to create alpha bitmaps. This permits to create display compatible yet 32bpp DDBs. CORE-8695 #comment PLease retest, should be OK now. svn path=/trunk/; revision=64967 --- .../user/user32/windows/cursoricon_new.c | 192 +++++++++++------- 1 file changed, 123 insertions(+), 69 deletions(-) diff --git a/reactos/win32ss/user/user32/windows/cursoricon_new.c b/reactos/win32ss/user/user32/windows/cursoricon_new.c index e79c8dc831f..6e024620edf 100644 --- a/reactos/win32ss/user/user32/windows/cursoricon_new.c +++ b/reactos/win32ss/user/user32/windows/cursoricon_new.c @@ -241,56 +241,41 @@ static BOOL bmi_has_alpha( const BITMAPINFO *info, const void *bits ) * * Create the alpha bitmap for a 32-bpp icon that has an alpha channel. */ -static HBITMAP create_alpha_bitmap( - _In_ HBITMAP color, - _In_opt_ const BITMAPINFO *src_info, - _In_opt_ const void *color_bits ) +static +HBITMAP +create_alpha_bitmap( + _In_opt_ HBITMAP color, + _In_opt_ BITMAPINFO *src_info, + _In_opt_ const void *color_bits, + _In_ LONG width, + _In_ LONG height) { HBITMAP alpha = NULL, hbmpOld; - BITMAPINFO *info = NULL; HDC hdc = NULL, hdcScreen; - void *bits = NULL; unsigned char *ptr; + void *bits = NULL; int i; - LONG width, height; - BITMAP bm; - - if (!GetObjectW( color, sizeof(bm), &bm )) - return NULL; - if (bm.bmBitsPixel != 32) - return NULL; hdcScreen = CreateDCW(DISPLAYW, NULL, NULL, NULL); - if(!hdcScreen) + if (!hdcScreen) return NULL; - if(GetDeviceCaps(hdcScreen, BITSPIXEL) != 32) - goto done; hdc = CreateCompatibleDC(hdcScreen); - if(!hdc) - goto done; - - if(src_info) + if (!hdc) { - WORD bpp; - DWORD compr; - int size; - - if(!bmi_has_alpha(src_info, color_bits)) - goto done; - - if(!DIB_GetBitmapInfo(&src_info->bmiHeader, &width, &height, &bpp, &compr)) - goto done; - if(bpp != 32) - goto done; - - size = get_dib_image_size(width, height, bpp); - bits = HeapAlloc(GetProcessHeap(), 0, size); - if(!bits) - goto done; - CopyMemory(bits, color_bits, size); + DeleteDC(hdcScreen); + return NULL; } - else + + if (color) { + BITMAP bm; + BITMAPINFO *info = NULL; + + if (!GetObjectW( color, sizeof(bm), &bm )) + goto done; + if (bm.bmBitsPixel != 32) + goto done; + info = HeapAlloc(GetProcessHeap(), 0, FIELD_OFFSET(BITMAPINFO, bmiColors[256])); if(!info) goto done; @@ -308,46 +293,116 @@ static HBITMAP create_alpha_bitmap( bits = HeapAlloc(GetProcessHeap(), 0, info->bmiHeader.biSizeImage); if(!bits) + { + HeapFree(GetProcessHeap(), 0, info); goto done; + } if(!GetDIBits( hdc, color, 0, bm.bmHeight, bits, info, DIB_RGB_COLORS )) + { + HeapFree(GetProcessHeap(), 0, info); goto done; + } if (!bmi_has_alpha( info, bits )) + { + HeapFree(GetProcessHeap(), 0, info); goto done; - width = bm.bmWidth; - height = bm.bmHeight; - } + } - /* pre-multiply by alpha */ - for (i = 0, ptr = bits; i < width * height; i++, ptr += 4) - { - unsigned int alpha = ptr[3]; - ptr[0] = ptr[0] * alpha / 255; - ptr[1] = ptr[1] * alpha / 255; - ptr[2] = ptr[2] * alpha / 255; + /* pre-multiply by alpha */ + for (i = 0, ptr = bits; i < width * height; i++, ptr += 4) + { + unsigned int alpha = ptr[3]; + ptr[0] = (ptr[0] * alpha) / 255; + ptr[1] = (ptr[1] * alpha) / 255; + ptr[2] = (ptr[2] * alpha) / 255; + } + + /* Directly create a 32-bits DDB (thanks to undocumented CreateDIBitmap flag). */ + alpha = CreateDIBitmap(hdc, NULL, CBM_INIT | 2, bits, info, DIB_RGB_COLORS); + + HeapFree(GetProcessHeap(), 0, info); + HeapFree(GetProcessHeap(), 0, bits); } - - /* Create the bitmap */ - alpha = CreateCompatibleBitmap(hdcScreen, bm.bmWidth, bm.bmHeight); - if(!alpha) - goto done; - hbmpOld = SelectObject(hdc, alpha); - if(!hbmpOld) - goto done; - if(!StretchDIBits( hdc, 0, 0, bm.bmWidth, bm.bmHeight, - 0, 0, width, height, - bits, src_info ? src_info : info, DIB_RGB_COLORS, SRCCOPY )) + else { - SelectObject(hdc, hbmpOld); - hbmpOld = NULL; - DeleteObject(alpha); - alpha = NULL; + WORD bpp; + DWORD compr; + int size; + LONG orig_width, orig_height; + + if(!bmi_has_alpha(src_info, color_bits)) + goto done; + + if(!DIB_GetBitmapInfo(&src_info->bmiHeader, &orig_width, &orig_height, &bpp, &compr)) + goto done; + if(bpp != 32) + goto done; + + size = get_dib_image_size(orig_width, orig_height, bpp); + bits = HeapAlloc(GetProcessHeap(), 0, size); + if(!bits) + goto done; + CopyMemory(bits, color_bits, size); + /* pre-multiply by alpha */ + for (i = 0, ptr = bits; i < width * height; i++, ptr += 4) + { + unsigned int alpha = ptr[3]; + ptr[0] = (ptr[0] * alpha) / 255; + ptr[1] = (ptr[1] * alpha) / 255; + ptr[2] = (ptr[2] * alpha) / 255; + } + + /* Create the bitmap. Set the bitmap info to have the right width and height */ + if(src_info->bmiHeader.biSize == sizeof(BITMAPCOREHEADER)) + { + ((BITMAPCOREHEADER*)&src_info->bmiHeader)->bcWidth = width; + ((BITMAPCOREHEADER*)&src_info->bmiHeader)->bcHeight = height; + } + else + { + src_info->bmiHeader.biWidth = width; + src_info->bmiHeader.biHeight = height; + } + /* Directly create a 32-bits DDB (thanks to undocumented CreateDIBitmap flag). */ + alpha = CreateDIBitmap(hdcScreen, NULL, 2, NULL, src_info, DIB_RGB_COLORS); + /* Restore values */ + if(src_info->bmiHeader.biSize == sizeof(BITMAPCOREHEADER)) + { + ((BITMAPCOREHEADER*)&src_info->bmiHeader)->bcWidth = orig_width; + ((BITMAPCOREHEADER*)&src_info->bmiHeader)->bcHeight = orig_height; + } + else + { + src_info->bmiHeader.biWidth = orig_width; + src_info->bmiHeader.biHeight = orig_height; + } + if(!alpha) + goto done; + hbmpOld = SelectObject(hdc, alpha); + if(!hbmpOld) + { + DeleteObject(alpha); + alpha = NULL; + goto done; + } + if(!StretchDIBits( hdc, 0, 0, width, height, + 0, 0, orig_width, orig_height, + bits, src_info, DIB_RGB_COLORS, SRCCOPY )) + { + SelectObject(hdc, hbmpOld); + hbmpOld = NULL; + DeleteObject(alpha); + alpha = NULL; + } + else + { + SelectObject(hdc, hbmpOld); + } } - SelectObject(hdc, hbmpOld); done: DeleteDC(hdcScreen); - if(hdc) DeleteDC( hdc ); - if(info) HeapFree( GetProcessHeap(), 0, info ); + DeleteDC( hdc ); if(bits) HeapFree(GetProcessHeap(), 0, bits); TRACE("Returning 0x%08x.\n", alpha); @@ -571,8 +626,7 @@ static BOOL CURSORICON_GetCursorDataFromBMI( pvColor, pbmiCopy, DIB_RGB_COLORS, SRCCOPY)) goto done; pdata->bpp = GetDeviceCaps(hdcScreen, BITSPIXEL); - if(pdata->bpp == 32) - pdata->hbmAlpha = create_alpha_bitmap(pdata->hbmColor, pbmiCopy, pvColor); + pdata->hbmAlpha = create_alpha_bitmap(NULL, pbmiCopy, pvColor, pdata->cx, pdata->cy); /* Now convert the info to monochrome for the mask bits */ if (pbmiCopy->bmiHeader.biSize != sizeof(BITMAPCOREHEADER)) @@ -673,7 +727,7 @@ static BOOL CURSORICON_GetCursorDataFromIconInfo( pCursorData->cx = bm.bmWidth; pCursorData->cy = bm.bmHeight; if(pCursorData->bpp == 32) - pCursorData->hbmAlpha = create_alpha_bitmap(pCursorData->hbmColor, NULL, NULL); + pCursorData->hbmAlpha = create_alpha_bitmap(pCursorData->hbmColor, NULL, NULL, 0, 0); } else { From 2252d516b013feae668d3e523e2a2f127133daef Mon Sep 17 00:00:00 2001 From: Amine Khaldi Date: Fri, 24 Oct 2014 17:51:40 +0000 Subject: [PATCH 07/91] [ADVAPI32] * Move some functions from ac.c to security.c. CORE-8540 svn path=/trunk/; revision=64968 --- reactos/dll/win32/advapi32/sec/ac.c | 345 --------------------- reactos/dll/win32/advapi32/wine/security.c | 328 ++++++++++++++++++++ 2 files changed, 328 insertions(+), 345 deletions(-) diff --git a/reactos/dll/win32/advapi32/sec/ac.c b/reactos/dll/win32/advapi32/sec/ac.c index 65b22c26c17..3299d2fc93c 100644 --- a/reactos/dll/win32/advapi32/sec/ac.c +++ b/reactos/dll/win32/advapi32/sec/ac.c @@ -8,150 +8,8 @@ #include WINE_DEFAULT_DEBUG_CHANNEL(advapi); -/* --- ACL --- */ - -/* - * @implemented - */ -BOOL -WINAPI -GetAclInformation(PACL pAcl, - LPVOID pAclInformation, - DWORD nAclInformationLength, - ACL_INFORMATION_CLASS dwAclInformationClass) -{ - NTSTATUS Status; - - Status = RtlQueryInformationAcl(pAcl, - pAclInformation, - nAclInformationLength, - dwAclInformationClass); - if (!NT_SUCCESS(Status)) - { - SetLastError(RtlNtStatusToDosError(Status)); - return FALSE; - } - - return TRUE; -} - - -/* - * @implemented - */ -BOOL -WINAPI -InitializeAcl(PACL pAcl, - DWORD nAclLength, - DWORD dwAclRevision) -{ - NTSTATUS Status; - - Status = RtlCreateAcl(pAcl, - nAclLength, - dwAclRevision); - if (!NT_SUCCESS(Status)) - { - SetLastError(RtlNtStatusToDosError(Status)); - return FALSE; - } - - return TRUE; -} - - -/* - * @implemented - */ -BOOL -WINAPI -IsValidAcl(PACL pAcl) -{ - return RtlValidAcl (pAcl); -} - - -/* - * @implemented - */ -BOOL -WINAPI -SetAclInformation(PACL pAcl, - LPVOID pAclInformation, - DWORD nAclInformationLength, - ACL_INFORMATION_CLASS dwAclInformationClass) -{ - NTSTATUS Status; - - Status = RtlSetInformationAcl(pAcl, - pAclInformation, - nAclInformationLength, - dwAclInformationClass); - if (!NT_SUCCESS(Status)) - { - SetLastError(RtlNtStatusToDosError(Status)); - return FALSE; - } - - return TRUE; -} - - /* --- ACE --- */ -/* - * @implemented - */ -BOOL -WINAPI -AddAccessAllowedAce(PACL pAcl, - DWORD dwAceRevision, - DWORD AccessMask, - PSID pSid) -{ - NTSTATUS Status; - - Status = RtlAddAccessAllowedAce(pAcl, - dwAceRevision, - AccessMask, - pSid); - if (!NT_SUCCESS(Status)) - { - SetLastError(RtlNtStatusToDosError(Status)); - return FALSE; - } - - return TRUE; -} - - -/* - * @implemented - */ -BOOL WINAPI -AddAccessAllowedAceEx(PACL pAcl, - DWORD dwAceRevision, - DWORD AceFlags, - DWORD AccessMask, - PSID pSid) -{ - NTSTATUS Status; - - Status = RtlAddAccessAllowedAceEx(pAcl, - dwAceRevision, - AceFlags, - AccessMask, - pSid); - if (!NT_SUCCESS(Status)) - { - SetLastError(RtlNtStatusToDosError(Status)); - return FALSE; - } - - return TRUE; -} - - /* * @implemented */ @@ -183,60 +41,6 @@ AddAccessAllowedObjectAce(PACL pAcl, return TRUE; } - -/* - * @implemented - */ -BOOL -WINAPI -AddAccessDeniedAce(PACL pAcl, - DWORD dwAceRevision, - DWORD AccessMask, - PSID pSid) -{ - NTSTATUS Status; - - Status = RtlAddAccessDeniedAce(pAcl, - dwAceRevision, - AccessMask, - pSid); - if (!NT_SUCCESS(Status)) - { - SetLastError(RtlNtStatusToDosError(Status)); - return FALSE; - } - - return TRUE; -} - - -/* - * @implemented - */ -BOOL WINAPI -AddAccessDeniedAceEx(PACL pAcl, - DWORD dwAceRevision, - DWORD AceFlags, - DWORD AccessMask, - PSID pSid) -{ - NTSTATUS Status; - - Status = RtlAddAccessDeniedAceEx(pAcl, - dwAceRevision, - AceFlags, - AccessMask, - pSid); - if (!NT_SUCCESS(Status)) - { - SetLastError(RtlNtStatusToDosError(Status)); - return FALSE; - } - - return TRUE; -} - - /* * @implemented */ @@ -268,96 +72,6 @@ AddAccessDeniedObjectAce(PACL pAcl, return TRUE; } - -/* - * @implemented - */ -BOOL -WINAPI -AddAce(PACL pAcl, - DWORD dwAceRevision, - DWORD dwStartingAceIndex, - LPVOID pAceList, - DWORD nAceListLength) -{ - NTSTATUS Status; - - Status = RtlAddAce(pAcl, - dwAceRevision, - dwStartingAceIndex, - pAceList, - nAceListLength); - if (!NT_SUCCESS(Status)) - { - SetLastError(RtlNtStatusToDosError(Status)); - return FALSE; - } - - return TRUE; -} - - -/* - * @implemented - */ -BOOL -WINAPI -AddAuditAccessAce(PACL pAcl, - DWORD dwAceRevision, - DWORD dwAccessMask, - PSID pSid, - BOOL bAuditSuccess, - BOOL bAuditFailure) -{ - NTSTATUS Status; - - Status = RtlAddAuditAccessAce(pAcl, - dwAceRevision, - dwAccessMask, - pSid, - bAuditSuccess, - bAuditFailure); - if (!NT_SUCCESS(Status)) - { - SetLastError(RtlNtStatusToDosError(Status)); - return FALSE; - } - - return TRUE; -} - - -/* - * @implemented - */ -BOOL WINAPI -AddAuditAccessAceEx(PACL pAcl, - DWORD dwAceRevision, - DWORD AceFlags, - DWORD dwAccessMask, - PSID pSid, - BOOL bAuditSuccess, - BOOL bAuditFailure) -{ - NTSTATUS Status; - - Status = RtlAddAuditAccessAceEx(pAcl, - dwAceRevision, - AceFlags, - dwAccessMask, - pSid, - bAuditSuccess, - bAuditFailure); - if (!NT_SUCCESS(Status)) - { - SetLastError(RtlNtStatusToDosError(Status)); - return FALSE; - } - - return TRUE; -} - - /* * @implemented */ @@ -393,65 +107,6 @@ AddAuditAccessObjectAce(PACL pAcl, return TRUE; } -/* - * @implemented - */ -BOOL -WINAPI -DeleteAce(PACL pAcl, - DWORD dwAceIndex) -{ - NTSTATUS Status; - - Status = RtlDeleteAce(pAcl, - dwAceIndex); - if (!NT_SUCCESS(Status)) - { - SetLastError(RtlNtStatusToDosError(Status)); - return FALSE; - } - - return TRUE; -} - - -/* - * @implemented - */ -BOOL -WINAPI -FindFirstFreeAce(PACL pAcl, - LPVOID *pAce) -{ - return RtlFirstFreeAce(pAcl, - (PACE*)pAce); -} - - -/* - * @implemented - */ -BOOL -WINAPI -GetAce(PACL pAcl, - DWORD dwAceIndex, - LPVOID *pAce) -{ - NTSTATUS Status; - - Status = RtlGetAce(pAcl, - dwAceIndex, - pAce); - if (!NT_SUCCESS(Status)) - { - SetLastError(RtlNtStatusToDosError(Status)); - return FALSE; - } - - return TRUE; -} - - /* * @implemented */ diff --git a/reactos/dll/win32/advapi32/wine/security.c b/reactos/dll/win32/advapi32/wine/security.c index 00884176078..b6824c06301 100644 --- a/reactos/dll/win32/advapi32/wine/security.c +++ b/reactos/dll/win32/advapi32/wine/security.c @@ -799,6 +799,250 @@ GetLengthSid(PSID pSid) return (DWORD)RtlLengthSid(pSid); } +/* + * @implemented + */ +BOOL +WINAPI +InitializeAcl(PACL pAcl, + DWORD nAclLength, + DWORD dwAclRevision) +{ + NTSTATUS Status; + + Status = RtlCreateAcl(pAcl, + nAclLength, + dwAclRevision); + if (!NT_SUCCESS(Status)) + { + SetLastError(RtlNtStatusToDosError(Status)); + return FALSE; + } + + return TRUE; +} + +/* + * @implemented + */ +BOOL +WINAPI +AddAccessAllowedAce(PACL pAcl, + DWORD dwAceRevision, + DWORD AccessMask, + PSID pSid) +{ + NTSTATUS Status; + + Status = RtlAddAccessAllowedAce(pAcl, + dwAceRevision, + AccessMask, + pSid); + if (!NT_SUCCESS(Status)) + { + SetLastError(RtlNtStatusToDosError(Status)); + return FALSE; + } + + return TRUE; +} + +/* + * @implemented + */ +BOOL WINAPI +AddAccessAllowedAceEx(PACL pAcl, + DWORD dwAceRevision, + DWORD AceFlags, + DWORD AccessMask, + PSID pSid) +{ + NTSTATUS Status; + + Status = RtlAddAccessAllowedAceEx(pAcl, + dwAceRevision, + AceFlags, + AccessMask, + pSid); + if (!NT_SUCCESS(Status)) + { + SetLastError(RtlNtStatusToDosError(Status)); + return FALSE; + } + + return TRUE; +} + +/* + * @implemented + */ +BOOL +WINAPI +AddAccessDeniedAce(PACL pAcl, + DWORD dwAceRevision, + DWORD AccessMask, + PSID pSid) +{ + NTSTATUS Status; + + Status = RtlAddAccessDeniedAce(pAcl, + dwAceRevision, + AccessMask, + pSid); + if (!NT_SUCCESS(Status)) + { + SetLastError(RtlNtStatusToDosError(Status)); + return FALSE; + } + + return TRUE; +} + +/* + * @implemented + */ +BOOL WINAPI +AddAccessDeniedAceEx(PACL pAcl, + DWORD dwAceRevision, + DWORD AceFlags, + DWORD AccessMask, + PSID pSid) +{ + NTSTATUS Status; + + Status = RtlAddAccessDeniedAceEx(pAcl, + dwAceRevision, + AceFlags, + AccessMask, + pSid); + if (!NT_SUCCESS(Status)) + { + SetLastError(RtlNtStatusToDosError(Status)); + return FALSE; + } + + return TRUE; +} + +/* + * @implemented + */ +BOOL +WINAPI +AddAce(PACL pAcl, + DWORD dwAceRevision, + DWORD dwStartingAceIndex, + LPVOID pAceList, + DWORD nAceListLength) +{ + NTSTATUS Status; + + Status = RtlAddAce(pAcl, + dwAceRevision, + dwStartingAceIndex, + pAceList, + nAceListLength); + if (!NT_SUCCESS(Status)) + { + SetLastError(RtlNtStatusToDosError(Status)); + return FALSE; + } + + return TRUE; +} + +/* + * @implemented + */ +BOOL +WINAPI +DeleteAce(PACL pAcl, + DWORD dwAceIndex) +{ + NTSTATUS Status; + + Status = RtlDeleteAce(pAcl, + dwAceIndex); + if (!NT_SUCCESS(Status)) + { + SetLastError(RtlNtStatusToDosError(Status)); + return FALSE; + } + + return TRUE; +} + +/* + * @implemented + */ +BOOL +WINAPI +FindFirstFreeAce(PACL pAcl, + LPVOID *pAce) +{ + return RtlFirstFreeAce(pAcl, + (PACE*)pAce); +} + + +/* + * @implemented + */ +BOOL +WINAPI +GetAce(PACL pAcl, + DWORD dwAceIndex, + LPVOID *pAce) +{ + NTSTATUS Status; + + Status = RtlGetAce(pAcl, + dwAceIndex, + pAce); + if (!NT_SUCCESS(Status)) + { + SetLastError(RtlNtStatusToDosError(Status)); + return FALSE; + } + + return TRUE; +} + +/* + * @implemented + */ +BOOL +WINAPI +GetAclInformation(PACL pAcl, + LPVOID pAclInformation, + DWORD nAclInformationLength, + ACL_INFORMATION_CLASS dwAclInformationClass) +{ + NTSTATUS Status; + + Status = RtlQueryInformationAcl(pAcl, + pAclInformation, + nAclInformationLength, + dwAclInformationClass); + if (!NT_SUCCESS(Status)) + { + SetLastError(RtlNtStatusToDosError(Status)); + return FALSE; + } + + return TRUE; +} + +/* + * @implemented + */ +BOOL +WINAPI +IsValidAcl(PACL pAcl) +{ + return RtlValidAcl (pAcl); +} + /* * @implemented */ @@ -892,6 +1136,65 @@ BOOL WINAPI AccessCheckByType( return !*AccessStatus; } +/* + * @implemented + */ +BOOL +WINAPI +AddAuditAccessAce(PACL pAcl, + DWORD dwAceRevision, + DWORD dwAccessMask, + PSID pSid, + BOOL bAuditSuccess, + BOOL bAuditFailure) +{ + NTSTATUS Status; + + Status = RtlAddAuditAccessAce(pAcl, + dwAceRevision, + dwAccessMask, + pSid, + bAuditSuccess, + bAuditFailure); + if (!NT_SUCCESS(Status)) + { + SetLastError(RtlNtStatusToDosError(Status)); + return FALSE; + } + + return TRUE; +} + +/* + * @implemented + */ +BOOL WINAPI +AddAuditAccessAceEx(PACL pAcl, + DWORD dwAceRevision, + DWORD AceFlags, + DWORD dwAccessMask, + PSID pSid, + BOOL bAuditSuccess, + BOOL bAuditFailure) +{ + NTSTATUS Status; + + Status = RtlAddAuditAccessAceEx(pAcl, + dwAceRevision, + AceFlags, + dwAccessMask, + pSid, + bAuditSuccess, + bAuditFailure); + if (!NT_SUCCESS(Status)) + { + SetLastError(RtlNtStatusToDosError(Status)); + return FALSE; + } + + return TRUE; +} + /********************************************************************** * PrivilegeCheck EXPORTED * @@ -919,6 +1222,31 @@ PrivilegeCheck(HANDLE ClientToken, return TRUE; } +/* + * @implemented + */ +BOOL +WINAPI +SetAclInformation(PACL pAcl, + LPVOID pAclInformation, + DWORD nAclInformationLength, + ACL_INFORMATION_CLASS dwAclInformationClass) +{ + NTSTATUS Status; + + Status = RtlSetInformationAcl(pAcl, + pAclInformation, + nAclInformationLength, + dwAclInformationClass); + if (!NT_SUCCESS(Status)) + { + SetLastError(RtlNtStatusToDosError(Status)); + return FALSE; + } + + return TRUE; +} + /****************************************************************************** * ParseAclStringFlags */ From 5acaa31a62b9e2f3a0e8406f61494d60b0e23d31 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Gardou?= Date: Fri, 24 Oct 2014 18:45:25 +0000 Subject: [PATCH 08/91] [WIN32K] - Properly check for CBM_INIT bit in CreateDIBitmap. - Take into account the fact that we could be passed a BITMAPCOREHEADER CORE-8695 svn path=/trunk/; revision=64969 --- reactos/win32ss/gdi/ntgdi/dibobj.c | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/reactos/win32ss/gdi/ntgdi/dibobj.c b/reactos/win32ss/gdi/ntgdi/dibobj.c index 304d00e66a4..a041043c28c 100644 --- a/reactos/win32ss/gdi/ntgdi/dibobj.c +++ b/reactos/win32ss/gdi/ntgdi/dibobj.c @@ -1336,7 +1336,7 @@ IntCreateDIBitmap( // colors, which are black followed by white, nothing else. In all other cases, we create a color bitmap. if (BmpFormat != BMF_1BPP) fColor = TRUE; - else if ((coloruse > DIB_RGB_COLORS) || (init != CBM_INIT) || !data) fColor = FALSE; + else if ((coloruse > DIB_RGB_COLORS) || ((init & CBM_INIT) == 0) || !data) fColor = FALSE; else { const RGBQUAD *rgb = (RGBQUAD*)((PBYTE)data + data->bmiHeader.biSize); @@ -1448,7 +1448,7 @@ NtGdiCreateDIBitmapInternal( PBYTE safeBits = NULL; HBITMAP hbmResult = NULL; - if(pjInit && (fInit == CBM_INIT)) + if(pjInit && (fInit & CBM_INIT)) { if (cjMaxBits == 0) return NULL; safeBits = ExAllocatePoolWithTag(PagedPool, cjMaxBits, TAG_DIB); @@ -1462,7 +1462,7 @@ NtGdiCreateDIBitmapInternal( _SEH2_TRY { if(pbmi) ProbeForRead(pbmi, cjMaxInitInfo, 1); - if(pjInit && (fInit == CBM_INIT)) + if(pjInit && (fInit & CBM_INIT)) { ProbeForRead(pjInit, cjMaxBits, 1); RtlCopyMemory(safeBits, pjInit, cjMaxBits); @@ -1540,9 +1540,19 @@ GreCreateDIBitmapInternal( * if bpp != 1 and ignore the real value that was passed */ if (pbmi) { - bpp = pbmi->bmiHeader.biBitCount; - planes = pbmi->bmiHeader.biPlanes; - compression = pbmi->bmiHeader.biCompression; + if (pbmi->bmiHeader.biSize == sizeof(BITMAPCOREHEADER)) + { + BITMAPCOREHEADER* CoreHeader = (BITMAPCOREHEADER*)&pbmi->bmiHeader; + bpp = CoreHeader->bcBitCount; + planes = CoreHeader->bcPlanes; + compression = BI_RGB; + } + else + { + bpp = pbmi->bmiHeader.biBitCount; + planes = pbmi->bmiHeader.biPlanes; + compression = pbmi->bmiHeader.biCompression; + } } else { From 33e318ed914e920d2665cbe375e113c0c94f3f89 Mon Sep 17 00:00:00 2001 From: Thomas Faber Date: Fri, 24 Oct 2014 19:05:54 +0000 Subject: [PATCH 09/91] [RTL] - Implement RtlTryEnterHeapLock and use it to fix RtlpDphEnterCriticalSection svn path=/trunk/; revision=64970 --- reactos/dll/ntdll/rtl/libsupp.c | 9 +++++++++ reactos/lib/rtl/heappage.c | 2 +- reactos/lib/rtl/rtlp.h | 4 ++++ reactos/ntoskrnl/rtl/libsupp.c | 18 ++++++++++++++++++ 4 files changed, 32 insertions(+), 1 deletion(-) diff --git a/reactos/dll/ntdll/rtl/libsupp.c b/reactos/dll/ntdll/rtl/libsupp.c index 22c6811b91b..43276aee74b 100644 --- a/reactos/dll/ntdll/rtl/libsupp.c +++ b/reactos/dll/ntdll/rtl/libsupp.c @@ -127,6 +127,15 @@ RtlEnterHeapLock(IN OUT PHEAP_LOCK Lock, IN BOOLEAN Exclusive) return RtlEnterCriticalSection(&Lock->CriticalSection); } +BOOLEAN +NTAPI +RtlTryEnterHeapLock(IN OUT PHEAP_LOCK Lock, IN BOOLEAN Exclusive) +{ + UNREFERENCED_PARAMETER(Exclusive); + + return RtlTryEnterCriticalSection(&Lock->CriticalSection); +} + NTSTATUS NTAPI RtlInitializeHeapLock(IN OUT PHEAP_LOCK *Lock) diff --git a/reactos/lib/rtl/heappage.c b/reactos/lib/rtl/heappage.c index 1cc3099b6b6..696fcda309b 100644 --- a/reactos/lib/rtl/heappage.c +++ b/reactos/lib/rtl/heappage.c @@ -236,7 +236,7 @@ RtlpDphEnterCriticalSection(PDPH_HEAP_ROOT DphRoot, ULONG Flags) if (Flags & HEAP_NO_SERIALIZE) { /* More complex scenario */ - if (!RtlEnterHeapLock(DphRoot->HeapCritSect, TRUE)) + if (!RtlTryEnterHeapLock(DphRoot->HeapCritSect, TRUE)) { if (!DphRoot->nRemoteLockAcquired) { diff --git a/reactos/lib/rtl/rtlp.h b/reactos/lib/rtl/rtlp.h index b9429af356f..a57e78bda4a 100644 --- a/reactos/lib/rtl/rtlp.h +++ b/reactos/lib/rtl/rtlp.h @@ -103,6 +103,10 @@ NTSTATUS NTAPI RtlEnterHeapLock(IN OUT PHEAP_LOCK Lock, IN BOOLEAN Exclusive); +BOOLEAN +NTAPI +RtlTryEnterHeapLock(IN OUT PHEAP_LOCK Lock, IN BOOLEAN Exclusive); + NTSTATUS NTAPI RtlInitializeHeapLock(IN OUT PHEAP_LOCK *Lock); diff --git a/reactos/ntoskrnl/rtl/libsupp.c b/reactos/ntoskrnl/rtl/libsupp.c index b5099a5f2de..fb7dc0db47c 100644 --- a/reactos/ntoskrnl/rtl/libsupp.c +++ b/reactos/ntoskrnl/rtl/libsupp.c @@ -178,6 +178,24 @@ RtlEnterHeapLock(IN OUT PHEAP_LOCK Lock, IN BOOLEAN Exclusive) return STATUS_SUCCESS; } +BOOLEAN +NTAPI +RtlTryEnterHeapLock(IN OUT PHEAP_LOCK Lock, IN BOOLEAN Exclusive) +{ + BOOLEAN Success; + KeEnterCriticalRegion(); + + if (Exclusive) + Success = ExAcquireResourceExclusiveLite(&Lock->Resource, FALSE); + else + Success = ExAcquireResourceSharedLite(&Lock->Resource, FALSE); + + if (!Success) + KeLeaveCriticalRegion(); + + return Success; +} + NTSTATUS NTAPI RtlInitializeHeapLock(IN OUT PHEAP_LOCK *Lock) From 40369c24e3bdeeda22984649a575e05ff35f0701 Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Fri, 24 Oct 2014 19:17:58 +0000 Subject: [PATCH 10/91] [CMAKE] Improve configure script to allow passing multiple arguments, like "configure VSSolution RTC". Add a small help command ("help" or "/?"), allow passing CMake parameters like -DFOO:BOOL=TRUE after our custom parameters. svn path=/trunk/; revision=64971 --- reactos/configure.cmd | 168 ++++++++++++++++++++++++------------------ 1 file changed, 95 insertions(+), 73 deletions(-) diff --git a/reactos/configure.cmd b/reactos/configure.cmd index 78e6360a3db..d6cfb525429 100755 --- a/reactos/configure.cmd +++ b/reactos/configure.cmd @@ -7,6 +7,17 @@ :: Precisely needed for configuring Visual Studio Environment. setlocal enabledelayedexpansion +:: Does the user need help? +if /I "%1" == "help" goto help +if /I "%1" == "/?" ( +:help + echo Help for configure script + echo Syntax: path\to\source\configure.cmd [script-options] [Cmake-options] + echo Available script-options: Codeblocks, Eclipse, Makefiles, clang, VSSolution, RTC + echo Cmake-options: -DVARIABLE:TYPE=VALUE + exit /b +) + :: Special case %1 = arm_hosttools %2 = vcvarsall.bat %3 = %CMAKE_GENERATOR% if /I "%1" == "arm_hosttools" ( echo Configuring x86 host tools for ARM cross build @@ -21,7 +32,10 @@ if /I "%1" == "arm_hosttools" ( :: Get the source root directory set REACTOS_SOURCE_DIR=%~dp0 -set USE_VSCMD=0 + +:: Set default generator +set CMAKE_GENERATOR="Ninja" +set CMAKE_GENERATOR_HOST=!CMAKE_GENERATOR! :: Detect presence of cmake cmd /c cmake --version 2>&1 | find "cmake version" > NUL || goto cmake_notfound @@ -31,71 +45,25 @@ if defined ROS_ARCH ( echo Detected RosBE for %ROS_ARCH% set BUILD_ENVIRONMENT=MinGW set ARCH=%ROS_ARCH% - if /I "%1" == "Codeblocks" ( - set CMAKE_GENERATOR="CodeBlocks - MinGW Makefiles" - ) else if /I "%1" == "Eclipse" ( - set CMAKE_GENERATOR="Eclipse CDT4 - MinGW Makefiles" - ) else if /I "%1" == "Makefiles" ( - set CMAKE_GENERATOR="MinGW Makefiles" - ) else if /I "%1" == "clang" ( - set BUILD_ENVIRONMENT=Clang - set CMAKE_GENERATOR="Ninja" - ) else ( - set CMAKE_GENERATOR="Ninja" - ) + set MINGW_TOOCHAIN_FILE=toolchain-gcc.cmake ) else if defined VCINSTALLDIR ( :: VS command prompt does not put this in environment vars cl 2>&1 | find "x86" > NUL && set ARCH=i386 cl 2>&1 | find "x64" > NUL && set ARCH=amd64 cl 2>&1 | find "ARM" > NUL && set ARCH=arm - cl 2>&1 | find "15.00." > NUL && set BUILD_ENVIRONMENT=VS9 - cl 2>&1 | find "16.00." > NUL && set BUILD_ENVIRONMENT=VS10 - cl 2>&1 | find "17.00." > NUL && set BUILD_ENVIRONMENT=VS11 - cl 2>&1 | find "18.00." > NUL && set BUILD_ENVIRONMENT=VS12 - if not defined BUILD_ENVIRONMENT ( + cl 2>&1 | find "15.00." > NUL && set VS_VERSION=9 + cl 2>&1 | find "16.00." > NUL && set VS_VERSION=10 + cl 2>&1 | find "17.00." > NUL && set VS_VERSION=11 + cl 2>&1 | find "18.00." > NUL && set VS_VERSION=12 + if not defined VS_VERSION ( echo Error: Visual Studio version too old or version detection failed. exit /b ) - - echo Detected Visual Studio Environment !BUILD_ENVIRONMENT!-!ARCH! - if /I "%1" == "VSSolution" ( - if "!BUILD_ENVIRONMENT!" == "VS9" ( - if "!ARCH!" == "amd64" ( - set CMAKE_GENERATOR="Visual Studio 9 2008 Win64" - ) else ( - set CMAKE_GENERATOR="Visual Studio 9 2008" - ) - ) else if "!BUILD_ENVIRONMENT!" == "VS10" ( - if "!ARCH!" == "amd64" ( - set CMAKE_GENERATOR="Visual Studio 10 Win64" - ) else ( - set CMAKE_GENERATOR="Visual Studio 10" - ) - ) else if "!BUILD_ENVIRONMENT!" == "VS11" ( - if "!ARCH!" == "amd64" ( - set CMAKE_GENERATOR="Visual Studio 11 Win64" - ) else if "!ARCH!" == "arm" ( - set CMAKE_GENERATOR="Visual Studio 11 ARM" - set CMAKE_GENERATOR_HOST="Visual Studio 11" - ) else ( - set CMAKE_GENERATOR="Visual Studio 11" - ) - ) else if "!BUILD_ENVIRONMENT!" == "VS12" ( - if "!ARCH!" == "amd64" ( - set CMAKE_GENERATOR="Visual Studio 12 Win64" - ) else if "!ARCH!" == "arm" ( - set CMAKE_GENERATOR="Visual Studio 12 ARM" - set CMAKE_GENERATOR_HOST="Visual Studio 12" - ) else ( - set CMAKE_GENERATOR="Visual Studio 12" - ) - ) - ) else ( - set USE_VSCMD=1 - echo This script defaults to Ninja. To use Visual Studio GUI specify "VSSolution" as a parameter. - ) - + set BUILD_ENVIRONMENT=VS + set VS_SOLUTION=0 + set VS_RUNTIME_CHECKS=0 + echo Detected Visual Studio Environment !BUILD_ENVIRONMENT!!VS_VERSION!-!ARCH! ) else ( echo Error: Unable to detect build environment. Configure script failure. exit /b @@ -107,20 +75,76 @@ if not defined ARCH ( exit /b ) -:: Detect VS command line generator -if %USE_VSCMD% == 1 ( - if /I "%1" == "CodeBlocks" ( - set CMAKE_GENERATOR="CodeBlocks - NMake Makefiles" - ) else if /I "%1" == "Eclipse" ( - set CMAKE_GENERATOR="Eclipse CDT4 - NMake Makefiles" - ) else if /I "%1" == "Makefiles" ( - set CMAKE_GENERATOR="NMake Makefiles" +:: Parse command line parameters +:repeat + if "%BUILD_ENVIRONMENT%" == "MinGW" ( + if /I "%1" == "Codeblocks" ( + set CMAKE_GENERATOR="CodeBlocks - MinGW Makefiles" + ) else if /I "%1" == "Eclipse" ( + set CMAKE_GENERATOR="Eclipse CDT4 - MinGW Makefiles" + ) else if /I "%1" == "Makefiles" ( + set CMAKE_GENERATOR="MinGW Makefiles" + ) else if /I "%1" == "clang" ( + set MINGW_TOOCHAIN_FILE=toolchain-clang.cmake + ) else ( + goto continue + ) ) else ( - set CMAKE_GENERATOR="Ninja" - ) - if "!ARCH!" == "arm" ( - set CMAKE_GENERATOR_HOST=!CMAKE_GENERATOR! + if /I "%1" == "CodeBlocks" ( + set CMAKE_GENERATOR="CodeBlocks - NMake Makefiles" + ) else if /I "%1" == "Eclipse" ( + set CMAKE_GENERATOR="Eclipse CDT4 - NMake Makefiles" + ) else if /I "%1" == "Makefiles" ( + set CMAKE_GENERATOR="NMake Makefiles" + ) else if /I "%1" == "VSSolution" ( + set VS_SOLUTION=1 + if "!VS_VERSION!" == "9" ( + if "!ARCH!" == "amd64" ( + set CMAKE_GENERATOR="Visual Studio 9 2008 Win64" + ) else ( + set CMAKE_GENERATOR="Visual Studio 9 2008" + ) + ) else if "!VS_VERSION!" == "10" ( + if "!ARCH!" == "amd64" ( + set CMAKE_GENERATOR="Visual Studio 10 Win64" + ) else ( + set CMAKE_GENERATOR="Visual Studio 10" + ) + ) else if "!VS_VERSION!" == "11" ( + if "!ARCH!" == "amd64" ( + set CMAKE_GENERATOR="Visual Studio 11 Win64" + ) else if "!ARCH!" == "arm" ( + set CMAKE_GENERATOR="Visual Studio 11 ARM" + set CMAKE_GENERATOR_HOST="Visual Studio 11" + ) else ( + set CMAKE_GENERATOR="Visual Studio 11" + ) + ) else if "!VS_VERSION!" == "12" ( + if "!ARCH!" == "amd64" ( + set CMAKE_GENERATOR="Visual Studio 12 Win64" + ) else if "!ARCH!" == "arm" ( + set CMAKE_GENERATOR="Visual Studio 12 ARM" + set CMAKE_GENERATOR_HOST="Visual Studio 12" + ) else ( + set CMAKE_GENERATOR="Visual Studio 12" + ) + ) + ) else if /I "%1" == "RTC" ( + echo Runtime checks enabled + set VS_RUNTIME_CHECKS=1 + ) else ( + goto continue + ) ) + + :: Go to next parameter + SHIFT + goto repeat +:continue + +:: Inform the user about the default build +if "!CMAKE_GENERATOR!" == "Ninja" ( + echo This script defaults to Ninja. Type "configure help" for alternative options. ) :: Create directories @@ -165,11 +189,9 @@ if EXIST CMakeCache.txt ( ) if "%BUILD_ENVIRONMENT%" == "MinGW" ( - cmake -G %CMAKE_GENERATOR% -DENABLE_CCACHE:BOOL=0 -DCMAKE_TOOLCHAIN_FILE:FILEPATH=toolchain-gcc.cmake -DARCH:STRING=%ARCH% -DREACTOS_BUILD_TOOLS_DIR:PATH="%REACTOS_BUILD_TOOLS_DIR%" "%REACTOS_SOURCE_DIR%" -) else if "%BUILD_ENVIRONMENT%" == "Clang" ( - cmake -G %CMAKE_GENERATOR% -DENABLE_CCACHE:BOOL=0 -DCMAKE_TOOLCHAIN_FILE:FILEPATH=toolchain-clang.cmake -DARCH:STRING=%ARCH% -DREACTOS_BUILD_TOOLS_DIR:PATH="%REACTOS_BUILD_TOOLS_DIR%" "%REACTOS_SOURCE_DIR%" + cmake -G %CMAKE_GENERATOR% -DENABLE_CCACHE:BOOL=0 -DCMAKE_TOOLCHAIN_FILE:FILEPATH=%MINGW_TOOCHAIN_FILE% -DARCH:STRING=%ARCH% -DREACTOS_BUILD_TOOLS_DIR:PATH="%REACTOS_BUILD_TOOLS_DIR%" %* "%REACTOS_SOURCE_DIR%" ) else ( - cmake -G %CMAKE_GENERATOR% -DCMAKE_TOOLCHAIN_FILE:FILEPATH=toolchain-msvc.cmake -DARCH:STRING=%ARCH% -DREACTOS_BUILD_TOOLS_DIR:PATH="%REACTOS_BUILD_TOOLS_DIR%" "%REACTOS_SOURCE_DIR%" + cmake -G %CMAKE_GENERATOR% -DCMAKE_TOOLCHAIN_FILE:FILEPATH=toolchain-msvc.cmake -DARCH:STRING=%ARCH% -DREACTOS_BUILD_TOOLS_DIR:PATH="%REACTOS_BUILD_TOOLS_DIR%" -DRUNTIME_CHECKS:BOOL=%VS_RUNTIME_CHECKS% %* "%REACTOS_SOURCE_DIR%" ) cd.. From 2c42dec0d7bddae5715ae8b2804e4d4ce9bc8952 Mon Sep 17 00:00:00 2001 From: Christoph von Wittich Date: Fri, 24 Oct 2014 20:41:25 +0000 Subject: [PATCH 11/91] [TASKMGR] fix HMENU leak in TaskManager_OnTabWndSelChange CORE-8705 svn path=/trunk/; revision=64972 --- reactos/base/applications/taskmgr/taskmgr.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/reactos/base/applications/taskmgr/taskmgr.c b/reactos/base/applications/taskmgr/taskmgr.c index 9e318b59162..01a73b296b8 100644 --- a/reactos/base/applications/taskmgr/taskmgr.c +++ b/reactos/base/applications/taskmgr/taskmgr.c @@ -38,6 +38,8 @@ HWND hMainWnd; /* Main Window */ HWND hStatusWnd; /* Status Bar Window */ HWND hTabWnd; /* Tab Control Window */ +HMENU hWindowMenu = NULL; + int nMinimumWidth; /* Minimum width of the dialog (OnSize()'s cx) */ int nMinimumHeight; /* Minimum height of the dialog (OnSize()'s cy) */ @@ -187,6 +189,8 @@ int APIENTRY wWinMain(HINSTANCE hInstance, SaveSettings(); PerfDataUninitialize(); CloseHandle(hMutex); + if (hWindowMenu) + DestroyMenu(hWindowMenu); return 0; } @@ -974,6 +978,8 @@ void TaskManager_OnTabWndSelChange(void) RemoveMenu(hViewMenu, i, MF_BYPOSITION); } RemoveMenu(hOptionsMenu, 3, MF_BYPOSITION); + if (hWindowMenu) + DestroyMenu(hWindowMenu); switch (TaskManagerSettings.ActiveTabPage) { case 0: ShowWindow(hApplicationPage, SW_SHOW); @@ -991,10 +997,10 @@ void TaskManager_OnTabWndSelChange(void) AppendMenuW(hViewMenu, MF_STRING, ID_VIEW_DETAILS, szTemp); if (GetMenuItemCount(hMenu) <= 5) { - hSubMenu = LoadMenuW(hInst, MAKEINTRESOURCEW(IDR_WINDOWSMENU)); + hWindowMenu = LoadMenuW(hInst, MAKEINTRESOURCEW(IDR_WINDOWSMENU)); LoadStringW(hInst, IDS_MENU_WINDOWS, szTemp, 256); - InsertMenuW(hMenu, 3, MF_BYPOSITION|MF_POPUP, (UINT_PTR) hSubMenu, szTemp); + InsertMenuW(hMenu, 3, MF_BYPOSITION|MF_POPUP, (UINT_PTR) hWindowMenu, szTemp); DrawMenuBar(hMainWnd); } From 23c10d8d815af826b55c1aba4122759a2b4b2851 Mon Sep 17 00:00:00 2001 From: Thomas Faber Date: Sat, 25 Oct 2014 00:08:23 +0000 Subject: [PATCH 12/91] [CRT] - Add frame pointer omission information to assembly string functions to fix debugging annoyances. Reviews appreciated svn path=/trunk/; revision=64974 --- reactos/lib/sdk/crt/string/i386/tcscat.inc | 4 +++- reactos/lib/sdk/crt/string/i386/tcschr.inc | 4 +++- reactos/lib/sdk/crt/string/i386/tcscmp.inc | 4 +++- reactos/lib/sdk/crt/string/i386/tcslen.inc | 4 +++- reactos/lib/sdk/crt/string/i386/tcsncat.inc | 4 +++- reactos/lib/sdk/crt/string/i386/tcsncmp.inc | 4 +++- reactos/lib/sdk/crt/string/i386/tcsncpy.inc | 4 +++- reactos/lib/sdk/crt/string/i386/tcsnlen.inc | 4 +++- reactos/lib/sdk/crt/string/i386/tcsrchr.inc | 4 +++- 9 files changed, 27 insertions(+), 9 deletions(-) diff --git a/reactos/lib/sdk/crt/string/i386/tcscat.inc b/reactos/lib/sdk/crt/string/i386/tcscat.inc index bc709f7e264..b9d41f2eb7a 100644 --- a/reactos/lib/sdk/crt/string/i386/tcscat.inc +++ b/reactos/lib/sdk/crt/string/i386/tcscat.inc @@ -5,7 +5,8 @@ PUBLIC _tcscat .code -_tcscat: +FUNC _tcscat + FPO 0, 2, 2, 2, 0, FRAME_FPO push esi push edi mov edi, [esp + 12] @@ -28,6 +29,7 @@ _tcscat: pop edi pop esi ret +ENDFUNC END /* EOF */ diff --git a/reactos/lib/sdk/crt/string/i386/tcschr.inc b/reactos/lib/sdk/crt/string/i386/tcschr.inc index 8e7184f7dda..5dffa1dbf96 100644 --- a/reactos/lib/sdk/crt/string/i386/tcschr.inc +++ b/reactos/lib/sdk/crt/string/i386/tcschr.inc @@ -5,7 +5,8 @@ PUBLIC _tcschr .code -_tcschr: +FUNC _tcschr + FPO 0, 2, 1, 1, 0, FRAME_FPO push esi mov esi, [esp + 8] mov edx, [esp + 12] @@ -25,6 +26,7 @@ _tcschr: pop esi ret +ENDFUNC END /* EOF */ diff --git a/reactos/lib/sdk/crt/string/i386/tcscmp.inc b/reactos/lib/sdk/crt/string/i386/tcscmp.inc index 7331dbb24f9..62167acc8ce 100644 --- a/reactos/lib/sdk/crt/string/i386/tcscmp.inc +++ b/reactos/lib/sdk/crt/string/i386/tcscmp.inc @@ -5,7 +5,8 @@ PUBLIC _tcscmp .code -_tcscmp: +FUNC _tcscmp + FPO 0, 2, 2, 2, 0, FRAME_FPO push esi push edi mov esi, [esp + 12] @@ -30,6 +31,7 @@ _tcscmp: pop edi pop esi ret +ENDFUNC END /* EOF */ diff --git a/reactos/lib/sdk/crt/string/i386/tcslen.inc b/reactos/lib/sdk/crt/string/i386/tcslen.inc index c1304cc3e93..b5256d586c9 100644 --- a/reactos/lib/sdk/crt/string/i386/tcslen.inc +++ b/reactos/lib/sdk/crt/string/i386/tcslen.inc @@ -5,7 +5,8 @@ PUBLIC _tcslen .code -_tcslen: +FUNC _tcslen + FPO 0, 1, 1, 1, 0, FRAME_FPO push edi mov edi, [esp + 8] xor eax, eax @@ -25,6 +26,7 @@ _tcslen: _tcslen_end: pop edi ret +ENDFUNC END /* EOF */ diff --git a/reactos/lib/sdk/crt/string/i386/tcsncat.inc b/reactos/lib/sdk/crt/string/i386/tcsncat.inc index a25df29eb16..2b6fce6ec72 100644 --- a/reactos/lib/sdk/crt/string/i386/tcsncat.inc +++ b/reactos/lib/sdk/crt/string/i386/tcsncat.inc @@ -5,7 +5,8 @@ PUBLIC _tcsncat .code -_tcsncat: +FUNC _tcsncat + FPO 0, 3, 2, 2, 0, FRAME_FPO push esi push edi mov edi, [esp + 12] @@ -38,6 +39,7 @@ _tcsncat: pop esi ret +ENDFUNC END /* EOF */ diff --git a/reactos/lib/sdk/crt/string/i386/tcsncmp.inc b/reactos/lib/sdk/crt/string/i386/tcsncmp.inc index ce8fdf8110f..fede776aada 100644 --- a/reactos/lib/sdk/crt/string/i386/tcsncmp.inc +++ b/reactos/lib/sdk/crt/string/i386/tcsncmp.inc @@ -5,7 +5,8 @@ PUBLIC _tcsncmp .code -_tcsncmp: +FUNC _tcsncmp + FPO 0, 3, 2, 2, 0, FRAME_FPO push esi push edi mov esi, [esp + 12] /* s1 */ @@ -36,6 +37,7 @@ _tcsncmp: pop edi pop esi ret +ENDFUNC END /* EOF */ diff --git a/reactos/lib/sdk/crt/string/i386/tcsncpy.inc b/reactos/lib/sdk/crt/string/i386/tcsncpy.inc index 9d021d4ee80..0bd27487dfd 100644 --- a/reactos/lib/sdk/crt/string/i386/tcsncpy.inc +++ b/reactos/lib/sdk/crt/string/i386/tcsncpy.inc @@ -5,7 +5,8 @@ PUBLIC _tcsncpy .code -_tcsncpy: +FUNC _tcsncpy + FPO 0, 3, 2, 2, 0, FRAME_FPO push esi push edi mov edi, [esp + 12] /* s1 */ @@ -30,6 +31,7 @@ _tcsncpy: pop edi pop esi ret +ENDFUNC END /* EOF */ diff --git a/reactos/lib/sdk/crt/string/i386/tcsnlen.inc b/reactos/lib/sdk/crt/string/i386/tcsnlen.inc index 59827783abd..d8741188c59 100644 --- a/reactos/lib/sdk/crt/string/i386/tcsnlen.inc +++ b/reactos/lib/sdk/crt/string/i386/tcsnlen.inc @@ -5,7 +5,8 @@ PUBLIC _tcsnlen .code -_tcsnlen: +FUNC _tcsnlen + FPO 0, 1, 1, 1, 0, FRAME_FPO push edi mov edi, [esp + 8] mov ecx, [esp + 12] @@ -26,6 +27,7 @@ _tcsnlen: .L1: pop edi ret +ENDFUNC END /* EOF */ diff --git a/reactos/lib/sdk/crt/string/i386/tcsrchr.inc b/reactos/lib/sdk/crt/string/i386/tcsrchr.inc index 84c759895d4..11b7c401bfe 100644 --- a/reactos/lib/sdk/crt/string/i386/tcsrchr.inc +++ b/reactos/lib/sdk/crt/string/i386/tcsrchr.inc @@ -5,7 +5,8 @@ PUBLIC _tcsrchr .code -_tcsrchr: +FUNC _tcsrchr + FPO 0, 2, 1, 1, 0, FRAME_FPO push esi mov esi, [esp + 8] mov edx, [esp + 12] @@ -27,6 +28,7 @@ _tcsrchr: _tdec(eax) pop esi ret +ENDFUNC END /* EOF */ From 36c59fdf14d5daaf1af9d2a6e76a9e531f0b171f Mon Sep 17 00:00:00 2001 From: Daniel Reimer Date: Sat, 25 Oct 2014 11:43:51 +0000 Subject: [PATCH 13/91] [RAPPS] Updates for some softwares. Fix several broken mirrors and replace the in theory working one for IrfanView. Fix some sizes. svn path=/trunk/; revision=64975 --- .../base/applications/rapps/rapps/abyss.txt | 8 +-- .../applications/rapps/rapps/alreader.txt | 6 +- .../base/applications/rapps/rapps/ants.txt | 34 ---------- .../applications/rapps/rapps/audiograbber.txt | 10 +-- .../applications/rapps/rapps/bittorrent.txt | 6 +- .../rapps/rapps/devcpp_mingw32.txt | 28 -------- .../rapps/rapps/devcpp_tdm_gcc_x64.txt | 4 +- .../rapps/rapps/doublecommander.txt | 10 +-- .../base/applications/rapps/rapps/firefox.txt | 64 +++++++++---------- .../applications/rapps/rapps/ghostscript.txt | 10 +-- .../applications/rapps/rapps/irfanview.txt | 2 +- .../rapps/rapps/irfanviewplugins.txt | 2 +- .../applications/rapps/rapps/lazaruside.txt | 8 +-- .../applications/rapps/rapps/libreoffice.txt | 12 ++-- .../base/applications/rapps/rapps/miktex.txt | 2 +- .../applications/rapps/rapps/mirandaim.txt | 8 +-- .../base/applications/rapps/rapps/mono2.txt | 12 ++-- reactos/base/applications/rapps/rapps/mpc.txt | 12 ++-- .../applications/rapps/rapps/nirlauncher.txt | 6 +- .../base/applications/rapps/rapps/openttd.txt | 4 +- .../base/applications/rapps/rapps/peazip.txt | 10 +-- .../base/applications/rapps/rapps/pspad.txt | 2 +- .../base/applications/rapps/rapps/python.txt | 12 ++-- .../base/applications/rapps/rapps/python2.txt | 12 ++-- .../base/applications/rapps/rapps/qmmp.txt | 10 +-- .../base/applications/rapps/rapps/scite.txt | 12 ++-- .../applications/rapps/rapps/seamonkey.txt | 43 ++++++------- .../applications/rapps/rapps/sumatrapdf.txt | 2 +- .../applications/rapps/rapps/thunderbird.txt | 40 ++++++------ .../applications/rapps/rapps/ultravnc.txt | 12 ++-- .../applications/rapps/rapps/utorrent.txt | 8 +-- 31 files changed, 172 insertions(+), 239 deletions(-) delete mode 100644 reactos/base/applications/rapps/rapps/ants.txt delete mode 100644 reactos/base/applications/rapps/rapps/devcpp_mingw32.txt diff --git a/reactos/base/applications/rapps/rapps/abyss.txt b/reactos/base/applications/rapps/rapps/abyss.txt index 5085c32717a..6322dab3a62 100644 --- a/reactos/base/applications/rapps/rapps/abyss.txt +++ b/reactos/base/applications/rapps/rapps/abyss.txt @@ -6,7 +6,7 @@ Name = Abyss Web server X1 Version = 2.9.3.5 Licence = Freeware Description = Abyss Web Server enables you to host your Web sites on your computer. It supports secure SSL/TLS connections (HTTPS) as well as a wide range of Web technologies. It can also run advanced PHP, Perl, Python, ASP, ASP.NET, and Ruby on Rails Web applications, which can be backed by databases such as MySQL, SQLite, MS SQL Server, MS Access, or Oracle. -Size = 2.1 MB +Size = 2.06 MB Category = 5 URLSite = http://www.aprelium.com/ URLDownload = http://www.aprelium.com/data/abwsx1.exe @@ -20,7 +20,7 @@ Description = Abyss Web Server le permite alojar sitios Web en su ordenador. Sop [Section.040c] Description = Abyss Web Server vous permet d'héberger vos sites internet sur votre ordinateur. Il supporte les connexions sécurisées SSL/TLS (HTTPS) ainsi qu'un grand nombre de technologies web. Il peut également faire tourner des applications web PHP, Perl, Python, ASP, ASP.Net, Ruby et Ruby on Rails, qui peuvent être associées à des bases de données telles que MySQL, SQLite, MS SQL Server, MS Access ou Oracle. -Size = 2,1 Mo +Size = 2,06 Mo [Section.0410] Description = Abyss Web Server consente di ospitare i vostri siti Web sul computer. Supporta connessioni sicure SSL / TLS (HTTPS), così come una vasta gamma di tecnologie web. E' inoltre possibile eseguire avanzato PHP, Perl, Python, ASP, ASP.NET, e Ruby on Rails, applicazioni Web che possono essere supportate da database come MySQL, SQLite, MS SQL Server, MS Access, o Oracle. @@ -36,13 +36,13 @@ Mogą one zostać oparte o MySQL, SQLite, MS SQL Server, MS Access, lub Oracle. [Section.0418] Licence = Gratuită Description = Abyss Web Server vă permite găzduirea de pagini Web pe calculatorul dumneavoastră. Oferă conexiuni securizate SSL/TLS (HTTPS) și multe alte tehnologii Web. Poate executa aplicații Web avansate ]n PHP, Perl, Python, ASP, ASP.NET și Ruby on Rails, ce pot fi susținute de baze de date ca MySQL, SQLite, MS SQL Server, MS Access, sau Oracle. -Size = 2,1 Mo +Size = 2,06 Mo [Section.041f] Name = Abyss Umûmî Ağ Sunucusu X1 Licence = Ücretsiz Description = Abyss Umûmî Ağ Sunucusu, bilgisayarınızda Umûmî Ağ sitelerinizin barındırılmasına olanak sağlar. Umûmî Ağ uygulayım biliminin bir geniş yelpâzesiyle birlikte güvenli SSL/TLS bağlantılarını (HTTPS) destekler. Ayrıca MySQL, SQLite, MS SQL Server, MS Access, ve Oracle gibi veri tabanlarıyla desteklenebilen gelişmiş PHP, Perl, Python, ASP, ASP.NET ve Rails üzerinde Ruby Umûmî Ağ uygulamalarını çalıştırabilir. -Size = 2,1 MB +Size = 2,06 MB [Section.0422] Description = Abyss Web Server дозволить вам утримувати веб-сайти на вашому комп'ютері. Від підтримує безпечні SSL/TLS з'єднання (HTTPS) та великий ряд веб-технологій. Він також запускає PHP, Perl, Python, ASP, ASP.NET, та Ruby on Rails веб-додатки, які можуть підтримуватись такими базами даних, як MySQL, SQLite, MS SQL Server, MS Access, чи Oracle. diff --git a/reactos/base/applications/rapps/rapps/alreader.txt b/reactos/base/applications/rapps/rapps/alreader.txt index 173cbe2a7d9..d83701d72e7 100644 --- a/reactos/base/applications/rapps/rapps/alreader.txt +++ b/reactos/base/applications/rapps/rapps/alreader.txt @@ -5,7 +5,7 @@ Name = AlReader Description = A FB2 eBook Reader. Supported read formats: fb2, fbz, txt, epub, html, doc, docx, odt, rtf, mobi, prc (PalmDoc), tcr. Supported ZIP and GZ archives. URLSite = http://www.alreader.com -Size = 4.6 MB +Size = 4.56 MB Category = 6 URLDownload = http://svn.reactos.org/packages/AlReader2Setup.exe CDPath = none @@ -21,8 +21,8 @@ Description = Czytnik eBooków. Obsługuje formaty: fb2, fbz, txt, epub, html, d [Section.0418] Description = Un cititor de cărți electronice. Poate citi fișiere de tip: fb2, fbz, txt, epub, html, doc, docx, odt, rtf, mobi, prc (PalmDoc), tcr. Include suport pentru arhive ZIP și GZ. -Size = 4,6 Mo +Size = 4,56 Mo [Section.041f] Description = Bir FB2 elektronik kitap okuyucusu. Desteklenen okuma biçimleri: fb2, fbz, txt, epub, html, doc, docx, odt, rtf, mobi, prc (PalmDoc), tcr. ZIP ve GZ belgeliklerini destekler. -Size = 4,6 MB +Size = 4,56 MB diff --git a/reactos/base/applications/rapps/rapps/ants.txt b/reactos/base/applications/rapps/rapps/ants.txt deleted file mode 100644 index dad3be18ecd..00000000000 --- a/reactos/base/applications/rapps/rapps/ants.txt +++ /dev/null @@ -1,34 +0,0 @@ -; UTF-8 -; Polish translation by wojo664 -; Turkish translation by Erdem Ersoy (eersoy93) (erdemersoy@live.com) - -[Section] -Name = Ants -Version = N/A -Licence = Freeware -Description = A card strategic game. Build your own castle and try to destroy enemy castle. You need a ZIP decompression program to install it. -Size = 632 kB -Category = 4 -URLSite = http://peter.hostuju.cz/ -URLDownload = http://petr.hostuju.cz/program/download/ANTS.zip -CDPath = none - -[Section.0407] -Description = Ein strategisches Kartenspiel. Sie bauen Ihr eigenes Schloss und versuchen, die gegnerische Burg zu zerstören. Sie benötigen ein ZIP-Programm, um es zu installieren. - -[Section.0410] -Description = Un gioco di carte strategico. Costruisci il tuo castello e prova a distruggere il castello nemico. Necessita di un programma di estrazione ZIP per essere installato. - -[Section.0415] -Description = Karciana gra strategiczna. Budujesz zamek, przy okazji próbujesz zniszczyć zamek wroga. Wymaga programu archiwizującego do wypakowania. - -[Section.0418] -Licence = Gratuită -Description = Un joc strategic de cărți. Jucătorul își va construi un castel și încerca să distrugă castelele oponenților. Este necesar un utilitar de dezarhivare ZIP pentru a instala acest joc. -Size = 632 ko - -[Section.041f] -Version = Yok -Licence = Ücretsiz -Description = Bir kartlarla izlem oyunu. Kendi kurganınızı yapınız ve rakip kaleyi yıkmaya çalışınız. Kurmak için bir ZIP çıkartma izlencesi gerekir. -Size = 632 KB diff --git a/reactos/base/applications/rapps/rapps/audiograbber.txt b/reactos/base/applications/rapps/rapps/audiograbber.txt index 9c7410cb103..5086efde0ab 100644 --- a/reactos/base/applications/rapps/rapps/audiograbber.txt +++ b/reactos/base/applications/rapps/rapps/audiograbber.txt @@ -6,10 +6,10 @@ Name = Audio Grabber Version = 1.83 SE Licence = Freeware Description = A very good CD Ripper/Audio File Converter. -Size = 4.35 MB +Size = 3.43 MB Category = 1 URLSite = http://www.audiograbber.de/ -URLDownload = http://www.audiograbber.de/files/4898276276/agsetup183se.exe +URLDownload = http://ftp.freenet.de/pub/filepilot/fpt/audio/bearbeitung/audiograbber/agsetup183se.exe CDPath = none [Section.0407] @@ -23,7 +23,7 @@ Description = Un buen CD Ripper/ conversor de archivos de audio. [Section.040c] Description = Un très bon extracteur de CD/convertisseur de fichier audio. -Size = 4,35 Mo +Size = 3,43 Mo [Section.0410] Description = Un ottimo CD Ripper/Audio File Converter. @@ -37,12 +37,12 @@ Description = Bardzo dobry CD Ripper/konwerter plików audio. [Section.0418] Licence = Gratuită Description = Program de extragere conținuturi CD audio și de conversie a fișierelor de sunet. -Size = 4,35 Mo +Size = 3,43 Mo [Section.041f] Licence = Ücretsiz Description = Çok iyi bir CD ripleyicisi ve ses kütüğü dönüştürücüsü. -Size = 4,35 MB +Size = 3,43 MB [Section.0422] Description = Чудовий CD Ріппер/Конвертер аудіо файлів. diff --git a/reactos/base/applications/rapps/rapps/bittorrent.txt b/reactos/base/applications/rapps/rapps/bittorrent.txt index 6fe557e1a7b..3cc4ae4bed2 100644 --- a/reactos/base/applications/rapps/rapps/bittorrent.txt +++ b/reactos/base/applications/rapps/rapps/bittorrent.txt @@ -6,7 +6,7 @@ Name = BitTorrent Version = 7.9.2 Licence = Freeware for non-commercial uses Description = The Original BitTorrent Client. -Size = 1.9 MB +Size = 1.61 MB Category = 5 URLSite = http://www.bittorrent.com/ URLDownload = http://download-new.utorrent.com/endpoint/bittorrent/os/windows/track/stable/BitTorrent.exe @@ -26,9 +26,9 @@ Description = Oryginalny klient BitTorrent. [Section.0418] Licence = Gratuită pentru uz necomercial Description = Originalul client BitTorrent. -Size = 1,9 Mo +Size = 1,61 Mo [Section.041f] Licence = Tecimlik olmayan kullanımlar için ücretsiz. Description = Özgün BitTorrent istemcisi. -Size = 1,9 MB +Size = 1,61 MB diff --git a/reactos/base/applications/rapps/rapps/devcpp_mingw32.txt b/reactos/base/applications/rapps/rapps/devcpp_mingw32.txt deleted file mode 100644 index eadcfbef7d2..00000000000 --- a/reactos/base/applications/rapps/rapps/devcpp_mingw32.txt +++ /dev/null @@ -1,28 +0,0 @@ -; UTF-8 -; Turkish translation by Erdem Ersoy (eersoy93) (erdemersoy@live.com) - -[Section] -Name = Orwell Dev-C++ MinGW32 -Version = 5.7.1 -Licence = GPLv2 -Description = A maintained version of Dev-C++. It contains MinGW32 compiler. -Size = 60.2 MB -Category = 7 -URLSite = http://orwelldevcpp.blogspot.com/ -URLDownload = http://download.sourceforge.net/project/orwelldevcpp/Setup%20Releases/Dev-Cpp%205.7.1%20MinGW%204.8.1%20Setup.exe -CDPath = none - -[Section.0407] -Description = Eine gepflegte Version von Dev-C++. Der MinGW32 Compiler liegt bei. - -[Section.0410] -Description = Una versione mantenuta di Dev-C++. Contiene il compilatore MinGW32. - -[Section.0418] -Description = O versiune menținută a Dev-C++. Conține compilatorul MinGW32. -Size = 60,2 Mo - -[Section.041f] -Licence = GPL 2. sürüm -Description = Dev-C++'nın sürdürülen bir sürümü. MinGW32 derleyicisi içerir. -Size = 60,2 MB diff --git a/reactos/base/applications/rapps/rapps/devcpp_tdm_gcc_x64.txt b/reactos/base/applications/rapps/rapps/devcpp_tdm_gcc_x64.txt index 26951593192..269f478c2e6 100644 --- a/reactos/base/applications/rapps/rapps/devcpp_tdm_gcc_x64.txt +++ b/reactos/base/applications/rapps/rapps/devcpp_tdm_gcc_x64.txt @@ -3,13 +3,13 @@ [Section] Name = Orwell Dev-C++ TDM GCC x64 -Version = 5.7.1 +Version = 5.8.0 Licence = GPLv2 Description = A maintained version of Dev-C++. It contains 64 bit TDM-GCC compiler. Size = 44.7 MB Category = 7 URLSite = http://orwelldevcpp.blogspot.com/ -URLDownload = http://download.sourceforge.net/project/orwelldevcpp/Setup%20Releases/Dev-Cpp%205.7.1%20TDM-GCC%20x64%204.8.1%20Setup.exe +URLDownload = http://download.sourceforge.net/project/orwelldevcpp/Setup%20Releases/Dev-Cpp%205.8.0%20TDM-GCC%204.8.1%20Setup.exe CDPath = none [Section.0407] diff --git a/reactos/base/applications/rapps/rapps/doublecommander.txt b/reactos/base/applications/rapps/rapps/doublecommander.txt index 842c91e030d..0e1d4f76bf3 100644 --- a/reactos/base/applications/rapps/rapps/doublecommander.txt +++ b/reactos/base/applications/rapps/rapps/doublecommander.txt @@ -3,13 +3,13 @@ [Section] Name = Double Commander -Version = 0.5.10 Beta +Version = 0.5.11 Beta Licence = GPL Description = Double Commander is an open source file manager with two panels side by side. You need 7-Zip or a similar Utility to extract it. -Size = 7.6 MB +Size = 8.0 MB Category = 12 URLSite = http://doublecmd.sourceforge.net/ -URLDownload = http://download.sourceforge.net/project/doublecmd/DC%20for%20Windows%2032%20bit/Double%20Commander%200.5.10%20beta/doublecmd-0.5.10.i386-win32.exe +URLDownload = http://download.sourceforge.net/project/doublecmd/DC%20for%20Windows%2032%20bit/Double%20Commander%200.5.11%20beta/doublecmd-0.5.11.i386-win32.exe CDPath = none [Section.0407] @@ -26,7 +26,7 @@ Description = Double Commander to menedżer plików, o otwartym źródle, z klas [Section.0418] Description = Double Commander este un gestionar (cu surse deschise) de fișiere după modelul «două paneluri alăturate». Este necesar 7-Zip sau un utilitar similar de dezarhivare pentru a-l putea extrage. -Size = 7,6 Mo +Size = 8,0 Mo [Section.0419] Description = Double Commander - это открытый двухпанельный файловый менеджер. Вам нужен 7-Zip или подобная утилита для его распаковки. @@ -34,7 +34,7 @@ Description = Double Commander - это открытый двухпанельн [Section.041f] Version = 0.5.8 Gelişme Description = Double Commander, yan yana iki bölmeli bir açık kaynak kütük yöneticisidir. Çıkartmak için 7-Zip ya da benzeri bir yazılım kullanmanız gerekir. -Size = 7,6 MB +Size = 8,0 MB [Section.0422] Description = Double Commander - це відкритий двопанельний файловий менеджер. Вам потрібен 7-Zip або подібна утиліта щоб розпакувати його. diff --git a/reactos/base/applications/rapps/rapps/firefox.txt b/reactos/base/applications/rapps/rapps/firefox.txt index e38428c1019..b28e7b76141 100644 --- a/reactos/base/applications/rapps/rapps/firefox.txt +++ b/reactos/base/applications/rapps/rapps/firefox.txt @@ -2,95 +2,95 @@ ; Turkish translation by Erdem Ersoy (eersoy93) (erdemersoy@live.com) [Section] -Name = Mozilla Firefox 32 -Version = 32.0.1 +Name = Mozilla Firefox 33 +Version = 33.0 Licence = MPL/GPL/LGPL Description = The most popular and one of the best free Web Browsers out there. -Size = 30.75 MB +Size = 34.76 MB Category = 5 URLSite = http://www.mozilla.org/en-US/ -URLDownload = http://ftp.mozilla.org/pub/mozilla.org/firefox/releases/32.0.1/win32/en-US/Firefox%20Setup%2032.0.1.exe +URLDownload = http://ftp.mozilla.org/pub/mozilla.org/firefox/releases/33.0/win32/en-US/Firefox%20Setup%2033.0.exe CDPath = none [Section.0405] Description = Nejpopulárnější a jeden z nejlepších svobodných webových prohlížečů. -Size = 30.6 MB +Size = 34.57 MB URLSite = http://www.mozilla.org/cs/ -URLDownload = http://ftp.mozilla.org/pub/mozilla.org/firefox/releases/32.0.1/win32/cs/Firefox%20Setup%2032.0.1.exe +URLDownload = http://ftp.mozilla.org/pub/mozilla.org/firefox/releases/33.0/win32/cs/Firefox%20Setup%2033.0.exe [Section.0407] Description = Der populärste und einer der besten freien Webbrowser. -Size = 30.56 MB +Size = 34.57 MB URLSite = http://www.mozilla.org/de/ -URLDownload = http://ftp.mozilla.org/pub/mozilla.org/firefox/releases/32.0.1/win32/de/Firefox%20Setup%2032.0.1.exe +URLDownload = http://ftp.mozilla.org/pub/mozilla.org/firefox/releases/33.0/win32/de/Firefox%20Setup%2033.0.exe [Section.040a] Description = El más popular y uno de los mejores navegadores web gratuitos que hay. -Size = 30.5 MB +Size = 34.5 MB URLSite = http://www.mozilla.org/es-ES/ -URLDownload = http://ftp.mozilla.org/pub/mozilla.org/firefox/releases/32.0.1/win32/es-ES/Firefox%20Setup%2032.0.1.exe +URLDownload = http://ftp.mozilla.org/pub/mozilla.org/firefox/releases/33.0/win32/es-ES/Firefox%20Setup%2033.0.exe [Section.040c] Description = Le navigateur web gratuit le plus populaire et l'un des meilleurs. -Size = 30,85 Mo +Size = 34,86 Mo URLSite = http://www.mozilla.org/fr/ -URLDownload = http://ftp.mozilla.org/pub/mozilla.org/firefox/releases/32.0.1/win32/fr/Firefox%20Setup%2032.0.1.exe +URLDownload = http://ftp.mozilla.org/pub/mozilla.org/firefox/releases/33.0/win32/fr/Firefox%20Setup%2033.0.exe [Section.0410] Description = Il più popolare e uno dei migliori web browser gratuiti. -Size = 30.49 MB +Size = 34.5 MB URLSite = http://www.mozilla.org/it/ -URLDownload = http://ftp.mozilla.org/pub/mozilla.org/firefox/releases/32.0.1/win32/it/Firefox%20Setup%2032.0.1.exe +URLDownload = http://ftp.mozilla.org/pub/mozilla.org/firefox/releases/33.0/win32/it/Firefox%20Setup%2033.0.exe [Section.0413] Description = De meest populaire en een van de beste gratis Web browsers. -Size = 31.2 MB +Size = 35.21 MB URLSite = http://www.mozilla.org/nl/ -URLDownload = http://ftp.mozilla.org/pub/mozilla.org/firefox/releases/32.0.1/win32/nl/Firefox%20Setup%2032.0.1.exe +URLDownload = http://ftp.mozilla.org/pub/mozilla.org/firefox/releases/33.0/win32/nl/Firefox%20Setup%2033.0.exe [Section.0414] Description = Mest populære og best også gratis nettleserene der ute. -Size = 30.55 MB -URLDownload = http://ftp.mozilla.org/pub/mozilla.org/firefox/releases/32.0.1/win32/nb-NO/Firefox%20Setup%2032.0.1.exe +Size = 34.57 MB +URLDownload = http://ftp.mozilla.org/pub/mozilla.org/firefox/releases/33.0/win32/nb-NO/Firefox%20Setup%2033.0.exe [Section.0415] Description = Najpopularniejsza i jedna z najlepszych darmowych przeglądarek internetowych. -Size = 31.42 MB +Size = 35.43 MB URLSite = http://www.mozilla.org/pl/ -URLDownload = http://ftp.mozilla.org/pub/mozilla.org/firefox/releases/32.0.1/win32/pl/Firefox%20Setup%2032.0.1.exe +URLDownload = http://ftp.mozilla.org/pub/mozilla.org/firefox/releases/33.0/win32/pl/Firefox%20Setup%2033.0.exe [Section.0418] Description = Cel mai popular și unul dintre cele mai bune navigatoare web gratuite existente. -Size = 31,0 Mo +Size = 35,08 Mo URLSite = http://www.mozilla.org/ro/ -URLDownload = http://ftp.mozilla.org/pub/mozilla.org/firefox/releases/32.0.1/win32/ro/Firefox%20Setup%2032.0.1.exe +URLDownload = http://ftp.mozilla.org/pub/mozilla.org/firefox/releases/33.0/win32/ro/Firefox%20Setup%2033.0.exe [Section.0419] Description = Один из самых популярных и лучших бесплатных браузеров. -Size = 30.94 MB +Size = 34.95 MB URLSite = http://www.mozilla.org/ru/ -URLDownload = http://ftp.mozilla.org/pub/mozilla.org/firefox/releases/32.0.1/win32/ru/Firefox%20Setup%2032.0.1.exe +URLDownload = http://ftp.mozilla.org/pub/mozilla.org/firefox/releases/33.0/win32/ru/Firefox%20Setup%2033.0.exe [Section.041b] Description = Najpopulárnejší a jeden z najlepších slobodný webových prehliadačov. -Size = 31.23 MB +Size = 35.24 MB URLSite = http://www.mozilla.org/sk/ -URLDownload = http://ftp.mozilla.org/pub/mozilla.org/firefox/releases/32.0.1/win32/sk/Firefox%20Setup%2032.0.1.exe +URLDownload = http://ftp.mozilla.org/pub/mozilla.org/firefox/releases/33.0/win32/sk/Firefox%20Setup%2033.0.exe [Section.041f] Description = Özgür Umûmî Ağ tarayıcıları arasında en tutulanı ve en iyilerinden biri. -Size = 30,58 MB +Size = 34,59 MB URLSite = http://www.mozilla.org/tr/ -URLDownload = http://ftp.mozilla.org/pub/mozilla.org/firefox/releases/32.0.1/win32/tr/Firefox%20Setup%2032.0.1.exe +URLDownload = http://ftp.mozilla.org/pub/mozilla.org/firefox/releases/33.0/win32/tr/Firefox%20Setup%2033.0.exe [Section.0422] Description = Найпопулярніший та один з кращих безплатних веб-браузерів. -Size = 30.97 MB +Size = 34.98 MB URLSite = http://www.mozilla.org/uk/ -URLDownload = http://ftp.mozilla.org/pub/mozilla.org/firefox/releases/32.0.1/win32/uk/Firefox%20Setup%2032.0.1.exe +URLDownload = http://ftp.mozilla.org/pub/mozilla.org/firefox/releases/33.0/win32/uk/Firefox%20Setup%2033.0.exe [Section.0813] Description = De meest populaire en een van de beste gratis Web browsers. -Size = 31.2 MB +Size = 35.21 MB URLSite = http://www.mozilla.org/nl/ -URLDownload = http://ftp.mozilla.org/pub/mozilla.org/firefox/releases/32.0.1/win32/nl/Firefox%20Setup%2032.0.1.exe +URLDownload = http://ftp.mozilla.org/pub/mozilla.org/firefox/releases/33.0/win32/nl/Firefox%20Setup%2033.0.exe diff --git a/reactos/base/applications/rapps/rapps/ghostscript.txt b/reactos/base/applications/rapps/rapps/ghostscript.txt index 62f00b9ab67..25186e041e0 100644 --- a/reactos/base/applications/rapps/rapps/ghostscript.txt +++ b/reactos/base/applications/rapps/rapps/ghostscript.txt @@ -1,12 +1,12 @@ [Section] Name = Ghostscript -Version = 9.14 +Version = 9.15 Licence = AGPL Description = An open interpreter for the PostScript language and for PDF. -Size = 12.44 MB +Size = 12.65 MB Category = 6 URLSite = http://www.ghostscript.com/ -URLDownload = http://downloads.ghostscript.com/public/gs914w32.exe +URLDownload = http://downloads.ghostscript.com/public/gs915w32.exe CDPath = none [Section.0407] @@ -14,8 +14,8 @@ Description = Ein offener Interpreter für die PostScript Sprache und PDF. [Section.0418] Description = Un interpretor pentru limbajul PostScript și pentru PDF. -Size = 12,44 Mo +Size = 12,65 Mo [Section.041f] Description = PostScript dili ve PDF için bir açık kaynak yorumlayıcı. -Size = 12,44 MB +Size = 12,65 MB diff --git a/reactos/base/applications/rapps/rapps/irfanview.txt b/reactos/base/applications/rapps/rapps/irfanview.txt index 438352d240a..a8db2635f8b 100644 --- a/reactos/base/applications/rapps/rapps/irfanview.txt +++ b/reactos/base/applications/rapps/rapps/irfanview.txt @@ -9,7 +9,7 @@ Description = Viewer for all kinds of graphics/audio files/video files. Size = 1.81 MB Category = 3 URLSite = http://www.irfanview.com/ -URLDownload = http://www.irfanview.info/files/iview438_setup.exe +URLDownload = http://img.cs.montana.edu/windows/iview438_setup.exe CDPath = none [Section.0407] diff --git a/reactos/base/applications/rapps/rapps/irfanviewplugins.txt b/reactos/base/applications/rapps/rapps/irfanviewplugins.txt index 8956a2eb8a9..60b134e2fa8 100644 --- a/reactos/base/applications/rapps/rapps/irfanviewplugins.txt +++ b/reactos/base/applications/rapps/rapps/irfanviewplugins.txt @@ -9,7 +9,7 @@ Description = Additional Plugins for supporting more file types. Size = 10.24 MB Category = 3 URLSite = http://www.irfanview.com/ -URLDownload = http://www.irfanview.info/files/irfanview_plugins_438_setup.exe +URLDownload = http://files.netmediaeurope.com/de-nmi/downloads/2014_download/irfanview_plugins_438_setup.exe CDPath = none [Section.0407] diff --git a/reactos/base/applications/rapps/rapps/lazaruside.txt b/reactos/base/applications/rapps/rapps/lazaruside.txt index 0ac6b58d0e7..62ea89eceda 100644 --- a/reactos/base/applications/rapps/rapps/lazaruside.txt +++ b/reactos/base/applications/rapps/rapps/lazaruside.txt @@ -4,13 +4,13 @@ [Section] Name = Lazarus -Version = 1.2.4 +Version = 1.2.6 Licence = modified LGPL, GPL Description = A cross-platform integrated development environment (IDE) that lets you create visual (GUI) and non-visual Object Pascal programs, and uses the Free Pascal compiler to generate your executable. -Size = 114 MB +Size = 107 MB Category = 7 URLSite = http://www.lazarus.freepascal.org/ -URLDownload = http://download.sourceforge.net/project/lazarus/Lazarus%20Windows%2032%20bits/Lazarus%201.2.4/lazarus-1.2.4-fpc-2.6.4-win32.exe +URLDownload = http://download.sourceforge.net/project/lazarus/Lazarus%20Windows%2032%20bits/Lazarus%201.2.6/lazarus-1.2.6-fpc-2.6.4-win32.exe CDPath = none [Section.0407] @@ -25,7 +25,7 @@ Description = Un ambiente di sviluppo integrato (IDE) cross-platform che consent [Section.0418] Licence = GPL, LGPL modificată Description = Un mediu integrat de dezvoltare (IDE) multi-platformă care vă permite crearea de programe Object Pascal, atât vizuale (GUI) cât și ne-vizuale, și utilizează compilatorul Free Pascal pentru a genera executabile. -Size = 114 Mo +Size = 107 Mo [Section.041f] Licence = Değiştirilmiş LGPL, GPL diff --git a/reactos/base/applications/rapps/rapps/libreoffice.txt b/reactos/base/applications/rapps/rapps/libreoffice.txt index 55e49c7fbc1..6b098836114 100644 --- a/reactos/base/applications/rapps/rapps/libreoffice.txt +++ b/reactos/base/applications/rapps/rapps/libreoffice.txt @@ -3,13 +3,13 @@ [Section] Name = LibreOffice -Version = 4.3.1 +Version = 4.3.2 Licence = LGPL Description = A powerful and open source office suite. It has been forked from OpenOffice. -Size = 214.52 MB +Size = 214.49 MB Category = 6 URLSite = http://www.documentfoundation.org/ -URLDownload = http://download.documentfoundation.org/libreoffice/stable/4.3.1/win/x86/LibreOffice_4.3.1_Win_x86.msi +URLDownload = http://download.documentfoundation.org/libreoffice/stable/4.3.2/win/x86/LibreOffice_4.3.2_Win_x86.msi CDPath = none [Section.0407] @@ -20,7 +20,7 @@ Description = La suite de ofimática de código abierto. [Section.040c] Description = Précédemment appelé OpenOffice. Suite bureautique open source. -Size = 209,36 Mo +Size = 214,49 Mo [Section.0410] Description = Precedentemente chiamato OpenOffice. Open Source Office Suite. @@ -33,11 +33,11 @@ Description = Otwarty pakiet biurowy. [Section.0418] Description = O suită office completă, cu surse deschise. Reprezintă o bifurcare a dezvoltării OpenOffice. -Size = 209,36 Mo +Size = 214,49 Mo [Section.041f] Description = Güçlü ve açık kaynak bir ofis paketi. OpenOffice'ten çatallanılmıştır. -Size = 209,36 MB +Size = 214,49 MB [Section.0422] Description = Відкритий офісний пакет. diff --git a/reactos/base/applications/rapps/rapps/miktex.txt b/reactos/base/applications/rapps/rapps/miktex.txt index 7175ac5af8b..9447e2d3ae2 100644 --- a/reactos/base/applications/rapps/rapps/miktex.txt +++ b/reactos/base/applications/rapps/rapps/miktex.txt @@ -6,7 +6,7 @@ Description = MiKTeX is an up-to-date implementation of TeX/LaTeX and related pr Size = 163.18 MB Category = 6 URLSite = http://www.miktex.org/ -URLDownload = http://mirrors.ctan.org/systems/win32/miktex/setup/basic-miktex-2.9.5105.exe +URLDownload = http://ftp.gwdg.de/pub/ctan/systems/win32/miktex/setup/basic-miktex-2.9.5105.exe CDPath = none [Section.0407] diff --git a/reactos/base/applications/rapps/rapps/mirandaim.txt b/reactos/base/applications/rapps/rapps/mirandaim.txt index df58198cbd5..86ea0a92cba 100644 --- a/reactos/base/applications/rapps/rapps/mirandaim.txt +++ b/reactos/base/applications/rapps/rapps/mirandaim.txt @@ -6,7 +6,7 @@ Name = Miranda IM Version = 0.10.24 Licence = GPL Description = Open source multiprotocol instant messaging application - May not work completely. -Size = 3.8 MB +Size = 3.77 MB Category = 5 URLSite = http://www.miranda-im.org/ URLDownload = http://files.miranda-im.org/stable/0.10.24.0/miranda-im-v0.10.24-unicode.exe @@ -20,7 +20,7 @@ Description = Aplicación de mensajería instantánea multiprotocolo de código [Section.040c] Description = Application de messagerie instantannée multi-protocoles open source - pourrait ne pas fonctionner complètement. -Size = 3,8 Mo +Size = 3,77 Mo [Section.0410] Description = Multi-protocollo open source per applicazioni di messaggistica istantanea - potrebbe non funzionare del tutto. @@ -33,11 +33,11 @@ Description = Otwarty komunikator internetowy, obsługujący wiele różnych pro [Section.0418] Description = Aplicație de mesagerie instant multiprotocol (cu surse deschise) - posibil cu limitări în funcționalitate. -Size = 3,8 Mo +Size = 3,77 Mo [Section.041f] Description = Açık kaynak, çoklu iletişim kâideli, evgin iletileşme uygulaması. Eksiksiz olarak çalışmayabilir. -Size = 3,8 MB +Size = 3,77 MB [Section.0422] Description = Відкрита мультипротокольна програма миттєвих повідомлень - може не працювати повністю. diff --git a/reactos/base/applications/rapps/rapps/mono2.txt b/reactos/base/applications/rapps/rapps/mono2.txt index e691987514a..27b8ab88052 100644 --- a/reactos/base/applications/rapps/rapps/mono2.txt +++ b/reactos/base/applications/rapps/rapps/mono2.txt @@ -3,13 +3,13 @@ [Section] Name = Mono .NET Development Framework -Version = 2.11.4 +Version = 3.2.3 Licence = Unknown Description = Open-source .NET Framework. -Size = 91.93 MB +Size = 98.49 MB Category = 14 URLSite = http://www.mono-project.com/ -URLDownload = http://download.mono-project.com/archive/2.11.4/windows-installer/mono-2.11.4-gtksharp-2.12.11-win32-0.exe +URLDownload = http://download.mono-project.com/archive/3.2.3/windows-installer/mono-3.2.3-gtksharp-2.12.11-win32-0.exe CDPath = none [Section.0407] @@ -20,7 +20,7 @@ Description = Versión open-source de .NET Framework. [Section.040c] Description = Framework .NET open source. -Size = 91,93 Mo +Size = 98,49 Mo [Section.0410] Description = Versione Open-source di .NET Framework. @@ -31,13 +31,13 @@ Description = Pakiet Mono .NET Framework dla Programistów. [Section.0418] Licence = Nespecificată Description = Platformă .NET (cu surse deschise). -Size = 91,93 Mo +Size = 98,49 Mo [Section.041f] Name = Mono .NET Geliştirme Çatısı Licence = Bilinmiyor Description = Açık kaynak .NET Çatısı. -Size = 91,93 MB +Size = 98,49 MB [Section.0422] Description = Відкритий .NET Фреймворк. diff --git a/reactos/base/applications/rapps/rapps/mpc.txt b/reactos/base/applications/rapps/rapps/mpc.txt index c383b171e7e..427ecbbd3b5 100644 --- a/reactos/base/applications/rapps/rapps/mpc.txt +++ b/reactos/base/applications/rapps/rapps/mpc.txt @@ -3,13 +3,13 @@ [Section] Name = Media Player Classic Home Cinema -Version = 1.7.6 +Version = 1.7.7 Licence = GPL Description = A media player. -Size = 10.3 MB +Size = 10.7 MB Category = 2 URLSite = http://mpc-hc.org/ -URLDownload = http://download.sourceforge.net/project/mpc-hc/MPC%20HomeCinema%20-%20Win32/MPC-HC_v1.7.6_x86/MPC-HC.1.7.6.x86.exe +URLDownload = http://download.sourceforge.net/project/mpc-hc/MPC%20HomeCinema%20-%20Win32/MPC-HC_v1.7.7_x86/MPC-HC.1.7.7.x86.exe CDPath = none [Section.0407] @@ -20,7 +20,7 @@ Description = Reproductor multimedia. [Section.040c] Description = Un lecteur media. -Size = 10,3 Mo +Size = 10,7 Mo [Section.0410] Description = Lettore multimediale. @@ -33,7 +33,7 @@ Description = Odtwarzacz multimediów. [Section.0418] Description = Lector multimedia. -Size = 10,3 Mo +Size = 10,7 Mo [Section.0419] Description = Мультимедийный проигрыватель. @@ -43,7 +43,7 @@ Description = Multimediálny prehrávač. [Section.041f] Description = Bir ortam oynatıcısı. -Size = 10,3 MB +Size = 10,7 MB [Section.0422] Description = Мультимедійний програвач. diff --git a/reactos/base/applications/rapps/rapps/nirlauncher.txt b/reactos/base/applications/rapps/rapps/nirlauncher.txt index 8d3e256bb0f..50f2766ad8c 100644 --- a/reactos/base/applications/rapps/rapps/nirlauncher.txt +++ b/reactos/base/applications/rapps/rapps/nirlauncher.txt @@ -1,12 +1,12 @@ [Section] Name = NirLauncher -Version = 1.18.76 +Version = 1.19.5 Licence = Freeware Description = A package of more than 180 utilities for Windows. -Size = 19.8 MB +Size = 20.2 MB Category = 12 URLSite = http://launcher.nirsoft.net/ -URLDownload = http://download.nirsoft.net/nirsoft_package_1.18.76.zip +URLDownload = http://download.nirsoft.net/nirsoft_package_1.19.5.zip CDPath = none [Section.0407] diff --git a/reactos/base/applications/rapps/rapps/openttd.txt b/reactos/base/applications/rapps/rapps/openttd.txt index 99f80679759..69b54088788 100644 --- a/reactos/base/applications/rapps/rapps/openttd.txt +++ b/reactos/base/applications/rapps/rapps/openttd.txt @@ -3,13 +3,13 @@ [Section] Name = OpenTTD -Version = 1.4.2 +Version = 1.4.4 Licence = GPL v2 Description = Open Source clone of the "Transport Tycoon Deluxe" game engine. You need a copy of Transport Tycoon. Size = 7.0 MB Category = 4 URLSite = http://www.openttd.org/ -URLDownload = http://binaries.openttd.org/releases/1.4.2/openttd-1.4.2-windows-win32.exe +URLDownload = http://binaries.openttd.org/releases/1.4.4/openttd-1.4.4-windows-win32.exe CDPath = none [Section.0407] diff --git a/reactos/base/applications/rapps/rapps/peazip.txt b/reactos/base/applications/rapps/rapps/peazip.txt index 7151465e521..fcfe24b924e 100644 --- a/reactos/base/applications/rapps/rapps/peazip.txt +++ b/reactos/base/applications/rapps/rapps/peazip.txt @@ -3,13 +3,13 @@ [Section] Name = PeaZip -Version = 5.4.1 +Version = 5.5.0 Licence = LGPL v3, OpenCandy EULA Description = PeaZip is a free, cross-platform, open source file and archive manager. It supports over 150 archive formats. -Size = 5.8 MB +Size = 5.9 MB Category = 12 URLSite = http://peazip.sourceforge.net/ -URLDownload = http://download.sourceforge.net/project/peazip/5.4.1/peazip-5.4.1.WINDOWS.exe +URLDownload = http://download.sourceforge.net/project/peazip/5.5.0/peazip-5.5.0.WINDOWS.exe CDPath = none [Section.0407] @@ -23,9 +23,9 @@ PeaZip to darmowy, wieloplatformowy menedżer plików i archiwów, o otwartym ź [Section.0418] Description = PeaZip este un gestionar de fișiere și arhive gratuit, multi-platformă, cu sursă deschisă. Recunoaște peste 150 tipuri de arhive. -Size = 5,8 Mo +Size = 5,9 Mo [Section.041f] Licence = LGPL 3. sürüm, OpenCandy EULA Description = PeaZip; ücretsiz, çapraz platform, açık kaynak kütük ve belgelik yöneticisidir. 150'den çok belgelikleme biçimini destekler. -Size = 5,8 MB +Size = 5,9 MB diff --git a/reactos/base/applications/rapps/rapps/pspad.txt b/reactos/base/applications/rapps/rapps/pspad.txt index 085a5ab64a0..8fe91ecdd35 100644 --- a/reactos/base/applications/rapps/rapps/pspad.txt +++ b/reactos/base/applications/rapps/rapps/pspad.txt @@ -10,7 +10,7 @@ Description = A text editor. Size = 4.46 MB Category = 6 URLSite = http://www.pspad.com -URLDownload = http://www.fosshub.com/download/pspad458instim_en.exe +URLDownload = http://pspad.poradna.net/release/pspad458insti_en.exe CDPath = none [Section.0407] diff --git a/reactos/base/applications/rapps/rapps/python.txt b/reactos/base/applications/rapps/rapps/python.txt index d60fd11133d..995c880c823 100644 --- a/reactos/base/applications/rapps/rapps/python.txt +++ b/reactos/base/applications/rapps/rapps/python.txt @@ -3,13 +3,13 @@ [Section] Name = Python 3 -Version = 3.4.1 +Version = 3.4.2 Licence = GPL/LGPL Description = A remarkably powerful dynamic programming language. -Size = 23.3 MB +Size = 23.39 MB Category = 7 URLSite = http://www.python.org/ -URLDownload = http://www.python.org/ftp/python/3.4.1/python-3.4.1.msi +URLDownload = http://www.python.org/ftp/python/3.4.2/python-3.4.2.msi CDPath = none [Section.0407] @@ -20,7 +20,7 @@ Description = Un lenguaje de programación dinámico sumamente potente. [Section.040c] Description = Un langage de programmation dynamique remarquablement puissant. -Size = 23,3 Mo +Size = 23,39 Mo [Section.0410] Description = Un Linguaggio di programmazione dinamico e potente. @@ -33,11 +33,11 @@ Description = Potęży i dynamiczny język programowania. [Section.0418] Description = Un limbaj de programare dinamic și puternic. -Size = 23,3 Mo +Size = 23,39 Mo [Section.041f] Description = Dikkat çekici, güçlü ve devingen bir izlenceleme dili. -Size = 23,3 MB +Size = 23,39 MB [Section.0422] Description = Дуже потужна динамічна мова програмування. diff --git a/reactos/base/applications/rapps/rapps/python2.txt b/reactos/base/applications/rapps/rapps/python2.txt index 23b90742890..4bbbcc6c15b 100644 --- a/reactos/base/applications/rapps/rapps/python2.txt +++ b/reactos/base/applications/rapps/rapps/python2.txt @@ -3,13 +3,13 @@ [Section] Name = Python 2 -Version = 2.7.6 +Version = 2.7.8 Licence = GPL/LGPL Description = A remarkably powerful dynamic programming language. -Size = 15.48 MB +Size = 15.93 MB Category = 7 URLSite = http://www.python.org/ -URLDownload = http://www.python.org/ftp/python/2.7.6/python-2.7.6.msi +URLDownload = http://www.python.org/ftp/python/2.7.8/python-2.7.8.msi CDPath = none [Section.0407] @@ -20,7 +20,7 @@ Description = Un lenguaje de programación dinámico sumamente potente. [Section.040c] Description = Un langage de programmation dynamique remarquablement puissant. -Size = 15,48 Mo +Size = 15,93 Mo [Section.0410] Description = Un Linguaggio di programmazione dinamico e potente. @@ -33,11 +33,11 @@ Description = Potęży i dynamiczny język programowania. [Section.0418] Description = Un limbaj de programare dinamic și puternic. -Size = 15,48 Mo +Size = 15,93 Mo [Section.041f] Description = Dikkat çekici, güçlü ve devingen bir izlenceleme dili. -Size = 15,48 MB +Size = 15,93 MB [Section.0422] Description = Дуже потужна динамічна мова програмування. diff --git a/reactos/base/applications/rapps/rapps/qmmp.txt b/reactos/base/applications/rapps/rapps/qmmp.txt index 6d084948c0f..be58282ca62 100644 --- a/reactos/base/applications/rapps/rapps/qmmp.txt +++ b/reactos/base/applications/rapps/rapps/qmmp.txt @@ -4,13 +4,13 @@ [Section] Name = Qmmp (Qt-based Multimedia Player) -Version = 0.8.1 +Version = 0.8.2 Licence = GPL Description = Qmmp is an audio-player, written with the help of the Qt library. The user interface is similar to WinAMP or XMMS. Alternative user interfaces also are available. -Size = 12.51 MB +Size = 12.66 MB Category = 1 URLSite = http://qmmp.ylsoftware.com/ -URLDownload = http://qmmp.ylsoftware.com/files/windows/qmmp-0.8.1-win32.exe +URLDownload = http://qmmp.ylsoftware.com/files/windows/qmmp-0.8.2-win32.exe CDPath = none [Section.0407] @@ -25,7 +25,7 @@ Description = Gmmp to odtwarzacz audio, napisany z pomocą biblioteki Qt. Interf [Section.0418] Name = Qmmp (Lector Multimedia bazat pe Qt) Description = Qmmp este un lector audio, ce utilizează biblioteca QT. Interfața de utilizare e asemănătoare cu cea din WinAMP sau XMMS. De asemenea sunt disponibile interfețe de utilizare alternative. -Size = 12,51 Mo +Size = 12,66 Mo [Section.0419] Description = Аудиоплеер Qmmp (Qt-based Multimedia Player). @@ -33,4 +33,4 @@ Description = Аудиоплеер Qmmp (Qt-based Multimedia Player). [Section.041f] Name = Qmmp (Qt Tabanlı Çoklu Ortam Oynatıcısı) Description = Qmmp, Qt kitaplığının yardımıyla yazılmış bir ses oynatıcısıdır. Kullanıcı arayüzü WinAMP'a ve XMMS'ye benzer. Başka kullanıcı arayüzleri de vardır. -Size = 12,51 MB +Size = 12,66 MB diff --git a/reactos/base/applications/rapps/rapps/scite.txt b/reactos/base/applications/rapps/rapps/scite.txt index 314902ce5af..7104731cd51 100644 --- a/reactos/base/applications/rapps/rapps/scite.txt +++ b/reactos/base/applications/rapps/rapps/scite.txt @@ -3,13 +3,13 @@ [Section] Name = SciTE -Version = 3.5.0 +Version = 3.5.1 Licence = Freeware Description = SciTE is a SCIntilla based text editor. Originally built to demonstrate Scintilla, it has grown to be a generally useful editor with facilities for building and running programs. -Size = 742 kB +Size = 744 kB Category = 7 URLSite = http://www.scintilla.org/ -URLDownload = http://download.sourceforge.net/project/scintilla/SciTE/3.5.0/Sc350.exe +URLDownload = http://download.sourceforge.net/project/scintilla/SciTE/3.5.1/Sc351.exe CDPath = none [Section.0407] @@ -20,7 +20,7 @@ Description = Editor de texto basado en SCIntilla. Originalmente creado para dem [Section.040c] Description = SciTE est un éditeur de texte basé sur SCIntilla. Originelement réalisé pour montrer Scintilla, il a évolué pour devenir un éditeur généralement utile avec des options pour compiler et lancer des programmes. -Size = 742 ko +Size = 744 ko [Section.0410] Description = SciTE è un editor di testo basato su scintilla. Originariamente costruito per dimostrare Scintilla, è cresciuto fino a essere un editor generalmente utile con strutture per la creazione e l'esecuzione di programmi. @@ -34,12 +34,12 @@ Description = SciTE to edytor tekstu bazowany na SCIntilla. Oryginalnie stworzon [Section.0418] Licence = Gratuită Description = SciTE este un editor de text bazat pe SCIntilla. Construit inițial pentru a demonstra Scintilla, a crescut ulterior într-un editor de uz general cu funcționalități de compilare și execuție a programelor. -Size = 742 ko +Size = 744 ko [Section.041f] Licence = Ücretsiz Description = SciTE, bir Scintilla tabanlı metin düzenleyicisidir. İlk başta Scintilla'yı göstermek için yapıldı; izlenceleri yapmak ve çalıştırmak yetenekleriyle, umûmiyetle kullanışlı bir düzenleyici olmak için gelişti. -Size = 742 KB +Size = 744 KB [Section.0422] Description = Текстовий редактор на основі SCIntilla. Був зібраний як презентація Scintilla, але виріс до редактора загального користування з засобами збирання та запуску програм. diff --git a/reactos/base/applications/rapps/rapps/seamonkey.txt b/reactos/base/applications/rapps/rapps/seamonkey.txt index 3444bc0a352..6219ea2c773 100644 --- a/reactos/base/applications/rapps/rapps/seamonkey.txt +++ b/reactos/base/applications/rapps/rapps/seamonkey.txt @@ -3,44 +3,44 @@ [Section] Name = Mozilla SeaMonkey -Version = 2.29 +Version = 2.30 Licence = MPL/GPL/LGPL Description = Mozilla Suite is alive. This is the one and only Browser, Mail, Chat, and Composer bundle you will ever need. -Size = 30.17 MB +Size = 30.05 MB Category = 5 URLSite = http://www.seamonkey-project.org/ -URLDownload = http://ftp.mozilla.org/pub/mozilla.org/seamonkey/releases/2.29/win32/en-US/SeaMonkey%20Setup%202.29.exe +URLDownload = http://ftp.mozilla.org/pub/mozilla.org/seamonkey/releases/2.30/win32/en-US/SeaMonkey%20Setup%202.30.exe CDPath = none [Section.0407] Description = Mozilla Suite lebt. Dies ist das einzige Browser-, Mail-, Chat- and Composerwerkzeug-Bundle welches Sie benötigen. -Size = 30.05 MB -URLDownload = http://ftp.mozilla.org/pub/mozilla.org/seamonkey/releases/2.29/win32/de/SeaMonkey%20Setup%202.29.exe +Size = 29.92 MB +URLDownload = http://ftp.mozilla.org/pub/mozilla.org/seamonkey/releases/2.30/win32/de/SeaMonkey%20Setup%202.30.exe [Section.040a] Description = La suite de Mozilla está viva. Es el primero y único navegador web, gestor de correo, lector de noticias, Chat y editor HTML que necesitarás. -Size = 30.03 MB -URLDownload = http://ftp.mozilla.org/pub/mozilla.org/seamonkey/releases/2.29/win32/es-ES/SeaMonkey%20Setup%202.29.exe +Size = 29.91 MB +URLDownload = http://ftp.mozilla.org/pub/mozilla.org/seamonkey/releases/2.30/win32/es-ES/SeaMonkey%20Setup%202.30.exe [Section.040c] Description = La suite Mozilla est en vie. Ceci est le seul et l'unique package navigateur, client mail, client chat et composer dont vous aurez besoin. -Size = 30,30 Mo -URLDownload = http://ftp.mozilla.org/pub/mozilla.org/seamonkey/releases/2.29/win32/fr/SeaMonkey%20Setup%202.29.exe +Size = 30,18 Mo +URLDownload = http://ftp.mozilla.org/pub/mozilla.org/seamonkey/releases/2.30/win32/fr/SeaMonkey%20Setup%202.30.exe [Section.0410] Description = Mozilla Suite è vivo. Questo è l'unico pachetto che include Browser, Mail, Chat, e Composer di cui avrete mai bisogno... -Size = 29.97 MB -URLDownload = http://ftp.mozilla.org/pub/mozilla.org/seamonkey/releases/2.29/win32/it/SeaMonkey%20Setup%202.29.exe +Size = 29.84 MB +URLDownload = http://ftp.mozilla.org/pub/mozilla.org/seamonkey/releases/2.30/win32/it/SeaMonkey%20Setup%202.30.exe [Section.0413] Description = Mozilla Suite bundelt alle applicaties voor het Web: Browser, Mail, Chat, Composer. -Size = 30.65 MB -URLDownload = http://ftp.mozilla.org/pub/mozilla.org/seamonkey/releases/2.29/win32/nl/SeaMonkey%20Setup%202.29.exe +Size = 30.52 MB +URLDownload = http://ftp.mozilla.org/pub/mozilla.org/seamonkey/releases/2.30/win32/nl/SeaMonkey%20Setup%202.30.exe [Section.0415] Description = Pakiet Mozilla żyje. W zestawie: przeglądarka, klient poczty, IRC oraz Edytor HTML - wszystko, czego potrzebujesz. -Size = 30.96 MB -URLDownload = http://ftp.mozilla.org/pub/mozilla.org/seamonkey/releases/2.29/win32/pl/SeaMonkey%20Setup%202.29.exe +Size = 30.83 MB +URLDownload = http://ftp.mozilla.org/pub/mozilla.org/seamonkey/releases/2.30/win32/pl/SeaMonkey%20Setup%202.30.exe [Section.0418] Description = Suita Mozilla. Acest pachet încorporează navigator, poștă electronică, client IRC și editor HTML, acoperind astfel o arie largă de necesități. @@ -48,15 +48,10 @@ Size = 30,17 Mo [Section.0419] Description = Продолжение Mozilla Suite. Включает браузер, почтовый клиент, IRC-клиент и HTML-редактор. -Size = 30.52 MB -URLDownload = http://ftp.mozilla.org/pub/mozilla.org/seamonkey/releases/2.29/win32/ru/SeaMonkey%20Setup%202.29.exe +Size = 30.39 MB +URLDownload = http://ftp.mozilla.org/pub/mozilla.org/seamonkey/releases/2.30/win32/ru/SeaMonkey%20Setup%202.30.exe [Section.041f] Description = Mozilla Bohçası sağ. Bu, hiç gereksinim duymayacağınız, yalnızca Tarayıcı, Posta, Söyleşi ve Yazar bohçasıdır. -Size = 30,02 MB -URLDownload = http://ftp.mozilla.org/pub/mozilla.org/seamonkey/releases/2.29/win32/tr/SeaMonkey%20Setup%202.29.exe - -[Section.0422] -Description = Продовження Mozilla Suite. Включає в себе браузер, поштовий клієнт, IRC-клієнт та HTML-редактор. -Size = 30.52 MB -URLDownload = http://ftp.mozilla.org/pub/mozilla.org/seamonkey/releases/2.29/win32/ru/SeaMonkey%20Setup%202.29.exe +Size = 29,89 MB +URLDownload = http://ftp.mozilla.org/pub/mozilla.org/seamonkey/releases/2.30/win32/tr/SeaMonkey%20Setup%202.30.exe diff --git a/reactos/base/applications/rapps/rapps/sumatrapdf.txt b/reactos/base/applications/rapps/rapps/sumatrapdf.txt index ca3b4f641d1..55717c637e3 100644 --- a/reactos/base/applications/rapps/rapps/sumatrapdf.txt +++ b/reactos/base/applications/rapps/rapps/sumatrapdf.txt @@ -9,7 +9,7 @@ Description = Sumatra PDF is a slim, free, open-source PDF reader. Portable out Size = 4.0 MB Category = 6 URLSite = http://blog.kowalczyk.info/software/sumatrapdf/free-pdf-reader.html -URLDownload = https://kjkpub.s3.amazonaws.com/sumatrapdf/rel/SumatraPDF-2.5.2-install.exe +URLDownload = http://kjkpub.s3.amazonaws.com/sumatrapdf/rel/SumatraPDF-2.5.2-install.exe CDPath = none [Section.0407] diff --git a/reactos/base/applications/rapps/rapps/thunderbird.txt b/reactos/base/applications/rapps/rapps/thunderbird.txt index 7bbff38f855..fc72de5ebf7 100644 --- a/reactos/base/applications/rapps/rapps/thunderbird.txt +++ b/reactos/base/applications/rapps/rapps/thunderbird.txt @@ -3,77 +3,77 @@ [Section] Name = Mozilla Thunderbird 31 -Version = 31.1.1 +Version = 31.2.0 Licence = MPL/GPL/LGPL Description = The most popular and one of the best free Mail Clients out there. Size = 25.25 MB Category = 5 URLSite = https://www.mozilla.org/en-US/thunderbird/ -URLDownload = http://ftp.mozilla.org/pub/mozilla.org/thunderbird/releases/31.1.1/win32/en-US/Thunderbird%20Setup%2031.1.1.exe +URLDownload = http://ftp.mozilla.org/pub/mozilla.org/thunderbird/releases/31.2.0/win32/en-US/Thunderbird%20Setup%2031.2.0.exe CDPath = none [Section.0407] Description = Der populärste und einer der besten freien Mail-Clients. -Size = 25.09 MB +Size = 25.1 MB URLSite = https://www.mozilla.org/de/thunderbird/ -URLDownload = http://ftp.mozilla.org/pub/mozilla.org/thunderbird/releases/31.1.1/win32/de/Thunderbird%20Setup%2031.1.1.exe +URLDownload = http://ftp.mozilla.org/pub/mozilla.org/thunderbird/releases/31.2.0/win32/de/Thunderbird%20Setup%2031.2.0.exe [Section.040a] Description = El más popular y uno de los mejores clientes mail que hay. Size = 25.04 MB URLSite = https://www.mozilla.org/es-ES/thunderbird/ -URLDownload = http://ftp.mozilla.org/pub/mozilla.org/thunderbird/releases/31.1.1/win32/es-ES/Thunderbird%20Setup%2031.1.1.exe +URLDownload = http://ftp.mozilla.org/pub/mozilla.org/thunderbird/releases/31.2.0/win32/es-ES/Thunderbird%20Setup%2031.2.0.exe [Section.040c] Description = Le plus populaire et l'un des meilleurs clients mail gratuits disponible. -Size = 25,39 Mo +Size = 25,4 Mo URLSite = https://www.mozilla.org/fr/thunderbird/ -URLDownload = http://ftp.mozilla.org/pub/mozilla.org/thunderbird/releases/31.1.1/win32/fr/Thunderbird%20Setup%2031.1.1.exe +URLDownload = http://ftp.mozilla.org/pub/mozilla.org/thunderbird/releases/31.2.0/win32/fr/Thunderbird%20Setup%2031.2.0.exe [Section.0410] Description = Il più popolare e il migliore Client mail gratuito. Size = 25.04 MB URLSite = https://www.mozilla.org/it/thunderbird/ -URLDownload = http://ftp.mozilla.org/pub/mozilla.org/thunderbird/releases/31.1.1/win32/it/Thunderbird%20Setup%2031.1.1.exe +URLDownload = http://ftp.mozilla.org/pub/mozilla.org/thunderbird/releases/31.2.0/win32/it/Thunderbird%20Setup%2031.2.0.exe [Section.0413] Description = De meest populaire en een van de beste gratis e-mail-programma's. -Size = 25.73 MB +Size = 25.74 MB URLSite = https://www.mozilla.org/nl/thunderbird/ -URLDownload = http://ftp.mozilla.org/pub/mozilla.org/thunderbird/releases/31.1.1/win32/nl/Thunderbird%20Setup%2031.1.1.exe +URLDownload = http://ftp.mozilla.org/pub/mozilla.org/thunderbird/releases/31.2.0/win32/nl/Thunderbird%20Setup%2031.2.0.exe [Section.0415] Description = Najpopularniejszy i jeden z najlepszych darmowych klientów poczty. -Size = 25.95 MB +Size = 25.96 MB URLSite = https://www.mozilla.org/pl/thunderbird/ -URLDownload = http://ftp.mozilla.org/pub/mozilla.org/thunderbird/releases/31.1.1/win32/pl/Thunderbird%20Setup%2031.1.1.exe +URLDownload = http://ftp.mozilla.org/pub/mozilla.org/thunderbird/releases/31.2.0/win32/pl/Thunderbird%20Setup%2031.2.0.exe [Section.0418] Description = Cel mai popular și unul dintre cele mai bune clientele gratuite de poștă electronică. Size = 25,61 Mo URLSite = https://www.mozilla.org/ro/thunderbird/ -URLDownload = http://ftp.mozilla.org/pub/mozilla.org/thunderbird/releases/31.1.1/win32/ro/Thunderbird%20Setup%2031.1.1.exe +URLDownload = http://ftp.mozilla.org/pub/mozilla.org/thunderbird/releases/31.2.0/win32/ro/Thunderbird%20Setup%2031.2.0.exe [Section.0419] Description = Один из самых популярных и лучших бесплатных почтовых клиентов. -Size = 25.5 MB +Size = 25.51 MB URLSite = https://www.mozilla.org/ru/thunderbird/ -URLDownload = http://ftp.mozilla.org/pub/mozilla.org/thunderbird/releases/31.1.1/win32/ru/Thunderbird%20Setup%2031.1.1.exe +URLDownload = http://ftp.mozilla.org/pub/mozilla.org/thunderbird/releases/31.2.0/win32/ru/Thunderbird%20Setup%2031.2.0.exe [Section.041f] Description = Özgür posta istemcileri arasında en tutulanı ve en iyilerinden biri. -Size = 25,12 MB +Size = 25,13 MB URLSite = https://www.mozilla.org/tr/thunderbird/ -URLDownload = http://ftp.mozilla.org/pub/mozilla.org/thunderbird/releases/31.1.1/win32/tr/Thunderbird%20Setup%2031.1.1.exe +URLDownload = http://ftp.mozilla.org/pub/mozilla.org/thunderbird/releases/31.2.0/win32/tr/Thunderbird%20Setup%2031.2.0.exe [Section.0422] Description = Найпопулярніший та один з кращих поштових клієнтів. Size = 25.54 MB URLSite = https://www.mozilla.org/uk/thunderbird/ -URLDownload = http://ftp.mozilla.org/pub/mozilla.org/thunderbird/releases/31.1.1/win32/uk/Thunderbird%20Setup%2031.1.1.exe +URLDownload = http://ftp.mozilla.org/pub/mozilla.org/thunderbird/releases/31.2.0/win32/uk/Thunderbird%20Setup%2031.2.0.exe [Section.0813] Description = De meest populaire en een van de beste gratis e-mail-programma's. -Size = 25.73 MB +Size = 25.74 MB URLSite = https://www.mozilla.org/nl/thunderbird/ -URLDownload = http://ftp.mozilla.org/pub/mozilla.org/thunderbird/releases/31.1.1/win32/nl/Thunderbird%20Setup%2031.1.1.exe +URLDownload = http://ftp.mozilla.org/pub/mozilla.org/thunderbird/releases/31.2.0/win32/nl/Thunderbird%20Setup%2031.2.0.exe diff --git a/reactos/base/applications/rapps/rapps/ultravnc.txt b/reactos/base/applications/rapps/rapps/ultravnc.txt index 41922739d5e..0f684551e77 100644 --- a/reactos/base/applications/rapps/rapps/ultravnc.txt +++ b/reactos/base/applications/rapps/rapps/ultravnc.txt @@ -3,13 +3,13 @@ [Section] Name = UltraVNC -Version = 1.2.0.1 +Version = 1.2.0.3 Licence = GPL Description = Open source VNC client/server. -Size = 3.29 MB +Size = 3.22 MB Category = 5 URLSite = http://www.uvnc.com/ -URLDownload = http://support1.uvnc.com/download/1201/UltraVNC_1_2_01_X86_Setup.exe +URLDownload = http://www.uvnc.eu/download/1203/UltraVNC_1_2_03_X86_Setup.exe CDPath = none [Section.0407] @@ -20,7 +20,7 @@ Description = Cliente/Servidor VNC de código abierto. [Section.040c] Description = Client/serveur VNC open source. -Size = 3,29 Mo +Size = 3,22 Mo [Section.0410] Description = Client/server VNC open source. @@ -33,11 +33,11 @@ Description = Otwarty klient/serwer VNC. [Section.0418] Description = Client/server VNC (cu surse deschise). -Size = 3,29 Mo +Size = 3,22 Mo [Section.041f] Description = Açık kaynak VNC istemcisi ve sunucusu. -Size = 3,29 MB +Size = 3,22 MB [Section.0422] Description = Відкритий VNC клієнт/сервер. diff --git a/reactos/base/applications/rapps/rapps/utorrent.txt b/reactos/base/applications/rapps/rapps/utorrent.txt index b465ecaca74..a5c6822483f 100644 --- a/reactos/base/applications/rapps/rapps/utorrent.txt +++ b/reactos/base/applications/rapps/rapps/utorrent.txt @@ -6,7 +6,7 @@ Name = µTorrent Version = 3.4.2 Licence = Freeware for non-commercial uses Description = Small and fast BitTorrent Client. -Size = 1.6 MB +Size = 1.61 MB Category = 5 URLSite = http://www.utorrent.com/ URLDownload = http://download-new.utorrent.com/endpoint/utorrent/os/windows/track/stable/utorrent.exe @@ -23,7 +23,7 @@ Description = Pequeño y rápido cliente BitTorrent. [Section.040c] Licence = Gratuit pour une utilisation non-commerciale Description = Client BitTorrent petit et rapide. -Size = 1,6 Mo +Size = 1,61 Mo [Section.040c] Licence = Gratita per un uso non-commerciale @@ -44,7 +44,7 @@ Description = Mały i szybki klient BitTorrent. [Section.0418] Licence = Gratuită pentru uz necomercial Description = Client BitTorrent, mic și rapid. -Size = 1,6 Mo +Size = 1,61 Mo [Section.0419] Licence = Бесплатная для некоммерческого использования @@ -53,7 +53,7 @@ Description = Маленький и быстрый клиент BitTorrent. [Section.041f] Licence = Tecimlik olmayan kullanımlar için ücretsiz. Description = Küçük ve hızlı BitTorrent istemcisi. -Size = 1,6 MB +Size = 1,61 MB [Section.0422] Licence = Безплатна для некомерційного використання From e4cff1c66a8c13299f50c8ad287b3e44cfa7c1cd Mon Sep 17 00:00:00 2001 From: James Tabor Date: Sat, 25 Oct 2014 11:45:47 +0000 Subject: [PATCH 14/91] [Win32k] - Fix a copy paste error, see CORE-8667. - Set top margin to 2. svn path=/trunk/; revision=64976 --- reactos/win32ss/user/ntuser/menu.c | 2 +- reactos/win32ss/user/user32/windows/menu.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/reactos/win32ss/user/ntuser/menu.c b/reactos/win32ss/user/ntuser/menu.c index 9cd09171564..c16acbcc3cf 100644 --- a/reactos/win32ss/user/ntuser/menu.c +++ b/reactos/win32ss/user/ntuser/menu.c @@ -649,7 +649,7 @@ IntGetMenuInfo(PMENU Menu, PROSMENUINFO lpmi) lpmi->cyMenu = Menu->cyMenu; lpmi->spwndNotify = Menu->spwndNotify; lpmi->cxTextAlign = Menu->cxTextAlign; - lpmi->iTop = Menu->iMaxTop; + lpmi->iTop = Menu->iTop; lpmi->iMaxTop = Menu->iMaxTop; lpmi->dwArrowsOn = Menu->dwArrowsOn; diff --git a/reactos/win32ss/user/user32/windows/menu.c b/reactos/win32ss/user/user32/windows/menu.c index 8241379a974..392b42136c1 100644 --- a/reactos/win32ss/user/user32/windows/menu.c +++ b/reactos/win32ss/user/user32/windows/menu.c @@ -43,7 +43,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(menu); #define MENU_COL_SPACE 4 /* top and bottom margins for popup menus */ -#define MENU_TOP_MARGIN 3 +#define MENU_TOP_MARGIN 2 //3 #define MENU_BOTTOM_MARGIN 2 #define MENU_TYPE_MASK (MF_STRING | MF_BITMAP | MF_OWNERDRAW | MF_SEPARATOR) @@ -395,7 +395,7 @@ MenuGetRosMenuInfo(PROSMENUINFO MenuInfo, HMENU Menu) MenuInfo->cyMenu = pMenu->cyMenu; MenuInfo->spwndNotify = pMenu->spwndNotify; MenuInfo->cxTextAlign = pMenu->cxTextAlign; - MenuInfo->iTop = pMenu->iMaxTop; + MenuInfo->iTop = pMenu->iTop; MenuInfo->iMaxTop = pMenu->iMaxTop; MenuInfo->dwArrowsOn = pMenu->dwArrowsOn; @@ -1301,7 +1301,7 @@ static void FASTCALL MenuPopupMenuCalcSize(PROSMENUINFO MenuInfo, HWND WndOwner) orgX = maxX; //if( lpitem.fType & (MF_MENUBREAK | MF_MENUBARBREAK)) // orgX += MENU_COL_SPACE; - orgY = 2;//MENU_TOP_MARGIN; + orgY = MENU_TOP_MARGIN; maxTab = maxTabWidth = 0; /* Parse items until column break or end of menu */ From 2d07e343d670d816fc0535e98de5e1ec3c2795d1 Mon Sep 17 00:00:00 2001 From: Amine Khaldi Date: Sat, 25 Oct 2014 12:27:03 +0000 Subject: [PATCH 15/91] [ADVAPI32] * Move CreateProcessWithLogonW() from logon.c to security.c. CORE-8540 svn path=/trunk/; revision=64977 --- reactos/dll/win32/advapi32/misc/logon.c | 24 ---------------------- reactos/dll/win32/advapi32/wine/security.c | 24 ++++++++++++++++++++++ 2 files changed, 24 insertions(+), 24 deletions(-) diff --git a/reactos/dll/win32/advapi32/misc/logon.c b/reactos/dll/win32/advapi32/misc/logon.c index 8c13d053cd7..25cf381d9f6 100644 --- a/reactos/dll/win32/advapi32/misc/logon.c +++ b/reactos/dll/win32/advapi32/misc/logon.c @@ -215,30 +215,6 @@ CreateProcessAsUserW(HANDLE hToken, return TRUE; } -/* - * @unimplemented - */ -BOOL WINAPI -CreateProcessWithLogonW(LPCWSTR lpUsername, - LPCWSTR lpDomain, - LPCWSTR lpPassword, - DWORD dwLogonFlags, - LPCWSTR lpApplicationName, - LPWSTR lpCommandLine, - DWORD dwCreationFlags, - LPVOID lpEnvironment, - LPCWSTR lpCurrentDirectory, - LPSTARTUPINFOW lpStartupInfo, - LPPROCESS_INFORMATION lpProcessInformation) -{ - FIXME("%s %s %s 0x%08x %s %s 0x%08x %p %s %p %p stub\n", debugstr_w(lpUsername), debugstr_w(lpDomain), - debugstr_w(lpPassword), dwLogonFlags, debugstr_w(lpApplicationName), - debugstr_w(lpCommandLine), dwCreationFlags, lpEnvironment, debugstr_w(lpCurrentDirectory), - lpStartupInfo, lpProcessInformation); - - return FALSE; -} - /* * @implemented */ diff --git a/reactos/dll/win32/advapi32/wine/security.c b/reactos/dll/win32/advapi32/wine/security.c index b6824c06301..edfea353f83 100644 --- a/reactos/dll/win32/advapi32/wine/security.c +++ b/reactos/dll/win32/advapi32/wine/security.c @@ -2428,6 +2428,30 @@ ConvertSidToStringSidA(PSID Sid, return TRUE; } +/* + * @unimplemented + */ +BOOL WINAPI +CreateProcessWithLogonW(LPCWSTR lpUsername, + LPCWSTR lpDomain, + LPCWSTR lpPassword, + DWORD dwLogonFlags, + LPCWSTR lpApplicationName, + LPWSTR lpCommandLine, + DWORD dwCreationFlags, + LPVOID lpEnvironment, + LPCWSTR lpCurrentDirectory, + LPSTARTUPINFOW lpStartupInfo, + LPPROCESS_INFORMATION lpProcessInformation) +{ + FIXME("%s %s %s 0x%08x %s %s 0x%08x %p %s %p %p stub\n", debugstr_w(lpUsername), debugstr_w(lpDomain), + debugstr_w(lpPassword), dwLogonFlags, debugstr_w(lpApplicationName), + debugstr_w(lpCommandLine), dwCreationFlags, lpEnvironment, debugstr_w(lpCurrentDirectory), + lpStartupInfo, lpProcessInformation); + + return FALSE; +} + BOOL WINAPI CreateProcessWithTokenW(IN HANDLE hToken, From 5781991967dc652ab108c6a6fff696bc97a88694 Mon Sep 17 00:00:00 2001 From: Amine Khaldi Date: Sat, 25 Oct 2014 12:30:01 +0000 Subject: [PATCH 16/91] [ADVAPI32] * Move some functions from sec/misc.c to security.c. CORE-8540 svn path=/trunk/; revision=64978 --- reactos/dll/win32/advapi32/sec/misc.c | 715 --------------------- reactos/dll/win32/advapi32/wine/security.c | 689 ++++++++++++++++++++ 2 files changed, 689 insertions(+), 715 deletions(-) diff --git a/reactos/dll/win32/advapi32/sec/misc.c b/reactos/dll/win32/advapi32/sec/misc.c index a8f92ef63c8..a83f22993f1 100644 --- a/reactos/dll/win32/advapi32/sec/misc.c +++ b/reactos/dll/win32/advapi32/sec/misc.c @@ -125,337 +125,6 @@ UnloadNtMarta(VOID) /******************************************************************************/ -/* - * @implemented - */ -BOOL -WINAPI -AreAllAccessesGranted(DWORD GrantedAccess, - DWORD DesiredAccess) -{ - return (BOOL)RtlAreAllAccessesGranted(GrantedAccess, - DesiredAccess); -} - - -/* - * @implemented - */ -BOOL -WINAPI -AreAnyAccessesGranted(DWORD GrantedAccess, - DWORD DesiredAccess) -{ - return (BOOL)RtlAreAnyAccessesGranted(GrantedAccess, - DesiredAccess); -} - - -/************************************************************ - * ADVAPI_IsLocalComputer - * - * Checks whether the server name indicates local machine. - */ -BOOL ADVAPI_IsLocalComputer(LPCWSTR ServerName) -{ - DWORD dwSize = MAX_COMPUTERNAME_LENGTH + 1; - BOOL Result; - LPWSTR buf; - - if (!ServerName || !ServerName[0]) - return TRUE; - - buf = HeapAlloc(GetProcessHeap(), 0, dwSize * sizeof(WCHAR)); - Result = GetComputerNameW(buf, &dwSize); - if (Result && (ServerName[0] == '\\') && (ServerName[1] == '\\')) - ServerName += 2; - Result = Result && !lstrcmpW(ServerName, buf); - HeapFree(GetProcessHeap(), 0, buf); - - return Result; -} - - -/****************************************************************************** - * GetFileSecurityA [ADVAPI32.@] - * - * Obtains Specified information about the security of a file or directory. - * - * PARAMS - * lpFileName [I] Name of the file to get info for - * RequestedInformation [I] SE_ flags from "winnt.h" - * pSecurityDescriptor [O] Destination for security information - * nLength [I] Length of pSecurityDescriptor - * lpnLengthNeeded [O] Destination for length of returned security information - * - * RETURNS - * Success: TRUE. pSecurityDescriptor contains the requested information. - * Failure: FALSE. lpnLengthNeeded contains the required space to return the info. - * - * NOTES - * The information returned is constrained by the callers access rights and - * privileges. - * - * @implemented - */ -BOOL -WINAPI -GetFileSecurityA(LPCSTR lpFileName, - SECURITY_INFORMATION RequestedInformation, - PSECURITY_DESCRIPTOR pSecurityDescriptor, - DWORD nLength, - LPDWORD lpnLengthNeeded) -{ - UNICODE_STRING FileName; - BOOL bResult; - - if (!RtlCreateUnicodeStringFromAsciiz(&FileName, lpFileName)) - { - SetLastError(ERROR_NOT_ENOUGH_MEMORY); - return FALSE; - } - - bResult = GetFileSecurityW(FileName.Buffer, - RequestedInformation, - pSecurityDescriptor, - nLength, - lpnLengthNeeded); - - RtlFreeUnicodeString(&FileName); - - return bResult; -} - - -/* - * @implemented - */ -BOOL -WINAPI -GetFileSecurityW(LPCWSTR lpFileName, - SECURITY_INFORMATION RequestedInformation, - PSECURITY_DESCRIPTOR pSecurityDescriptor, - DWORD nLength, - LPDWORD lpnLengthNeeded) -{ - OBJECT_ATTRIBUTES ObjectAttributes; - IO_STATUS_BLOCK StatusBlock; - UNICODE_STRING FileName; - ULONG AccessMask = 0; - HANDLE FileHandle; - NTSTATUS Status; - - TRACE("GetFileSecurityW() called\n"); - - QuerySecurityAccessMask(RequestedInformation, &AccessMask); - - if (!RtlDosPathNameToNtPathName_U(lpFileName, - &FileName, - NULL, - NULL)) - { - ERR("Invalid path\n"); - SetLastError(ERROR_INVALID_NAME); - return FALSE; - } - - InitializeObjectAttributes(&ObjectAttributes, - &FileName, - OBJ_CASE_INSENSITIVE, - NULL, - NULL); - - Status = NtOpenFile(&FileHandle, - AccessMask, - &ObjectAttributes, - &StatusBlock, - FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, - 0); - - RtlFreeHeap(RtlGetProcessHeap(), - 0, - FileName.Buffer); - - if (!NT_SUCCESS(Status)) - { - ERR("NtOpenFile() failed (Status %lx)\n", Status); - SetLastError(RtlNtStatusToDosError(Status)); - return FALSE; - } - - Status = NtQuerySecurityObject(FileHandle, - RequestedInformation, - pSecurityDescriptor, - nLength, - lpnLengthNeeded); - NtClose(FileHandle); - if (!NT_SUCCESS(Status)) - { - ERR("NtQuerySecurityObject() failed (Status %lx)\n", Status); - SetLastError(RtlNtStatusToDosError(Status)); - return FALSE; - } - - return TRUE; -} - - -/* - * @implemented - */ -BOOL -WINAPI -GetKernelObjectSecurity(HANDLE Handle, - SECURITY_INFORMATION RequestedInformation, - PSECURITY_DESCRIPTOR pSecurityDescriptor, - DWORD nLength, - LPDWORD lpnLengthNeeded) -{ - NTSTATUS Status; - - Status = NtQuerySecurityObject(Handle, - RequestedInformation, - pSecurityDescriptor, - nLength, - lpnLengthNeeded); - if (!NT_SUCCESS(Status)) - { - SetLastError(RtlNtStatusToDosError(Status)); - return FALSE; - } - - return TRUE; -} - - -/****************************************************************************** - * SetFileSecurityA [ADVAPI32.@] - * Sets the security of a file or directory - * - * @implemented - */ -BOOL -WINAPI -SetFileSecurityA(LPCSTR lpFileName, - SECURITY_INFORMATION SecurityInformation, - PSECURITY_DESCRIPTOR pSecurityDescriptor) -{ - UNICODE_STRING FileName; - BOOL bResult; - - if (!RtlCreateUnicodeStringFromAsciiz(&FileName, lpFileName)) - { - SetLastError(ERROR_NOT_ENOUGH_MEMORY); - return FALSE; - } - - bResult = SetFileSecurityW(FileName.Buffer, - SecurityInformation, - pSecurityDescriptor); - - RtlFreeUnicodeString(&FileName); - - return bResult; -} - - -/****************************************************************************** - * SetFileSecurityW [ADVAPI32.@] - * Sets the security of a file or directory - * - * @implemented - */ -BOOL -WINAPI -SetFileSecurityW(LPCWSTR lpFileName, - SECURITY_INFORMATION SecurityInformation, - PSECURITY_DESCRIPTOR pSecurityDescriptor) -{ - OBJECT_ATTRIBUTES ObjectAttributes; - IO_STATUS_BLOCK StatusBlock; - UNICODE_STRING FileName; - ULONG AccessMask = 0; - HANDLE FileHandle; - NTSTATUS Status; - - TRACE("SetFileSecurityW() called\n"); - - SetSecurityAccessMask(SecurityInformation, &AccessMask); - - if (!RtlDosPathNameToNtPathName_U(lpFileName, - &FileName, - NULL, - NULL)) - { - ERR("Invalid path\n"); - SetLastError(ERROR_INVALID_NAME); - return FALSE; - } - - InitializeObjectAttributes(&ObjectAttributes, - &FileName, - OBJ_CASE_INSENSITIVE, - NULL, - NULL); - - Status = NtOpenFile(&FileHandle, - AccessMask, - &ObjectAttributes, - &StatusBlock, - FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, - 0); - - RtlFreeHeap(RtlGetProcessHeap(), - 0, - FileName.Buffer); - - if (!NT_SUCCESS(Status)) - { - ERR("NtOpenFile() failed (Status %lx)\n", Status); - SetLastError(RtlNtStatusToDosError(Status)); - return FALSE; - } - - Status = NtSetSecurityObject(FileHandle, - SecurityInformation, - pSecurityDescriptor); - NtClose(FileHandle); - - if (!NT_SUCCESS(Status)) - { - ERR("NtSetSecurityObject() failed (Status %lx)\n", Status); - SetLastError(RtlNtStatusToDosError(Status)); - return FALSE; - } - - return TRUE; -} - - -/* - * @implemented - */ -BOOL -WINAPI -SetKernelObjectSecurity(HANDLE Handle, - SECURITY_INFORMATION SecurityInformation, - PSECURITY_DESCRIPTOR SecurityDescriptor) -{ - NTSTATUS Status; - - Status = NtSetSecurityObject(Handle, - SecurityInformation, - SecurityDescriptor); - if (!NT_SUCCESS(Status)) - { - SetLastError(RtlNtStatusToDosError(Status)); - return FALSE; - } - - return TRUE; -} - - /* * @implemented */ @@ -475,7 +144,6 @@ ImpersonateAnonymousToken(IN HANDLE ThreadHandle) return TRUE; } - /* * @implemented */ @@ -561,51 +229,6 @@ ImpersonateLoggedOnUser(HANDLE hToken) return TRUE; } - -/* - * @implemented - */ -BOOL -WINAPI -ImpersonateSelf(SECURITY_IMPERSONATION_LEVEL ImpersonationLevel) -{ - NTSTATUS Status; - - Status = RtlImpersonateSelf(ImpersonationLevel); - if (!NT_SUCCESS(Status)) - { - SetLastError(RtlNtStatusToDosError(Status)); - return FALSE; - } - - return TRUE; -} - - -/* - * @implemented - */ -BOOL -WINAPI -RevertToSelf(VOID) -{ - NTSTATUS Status; - HANDLE Token = NULL; - - Status = NtSetInformationThread(NtCurrentThread(), - ThreadImpersonationToken, - &Token, - sizeof(HANDLE)); - if (!NT_SUCCESS(Status)) - { - SetLastError(RtlNtStatusToDosError(Status)); - return FALSE; - } - - return TRUE; -} - - /****************************************************************************** * GetUserNameA [ADVAPI32.@] * @@ -656,7 +279,6 @@ GetUserNameA(LPSTR lpszName, return Ret; } - /****************************************************************************** * GetUserNameW [ADVAPI32.@] * @@ -994,63 +616,6 @@ LookupAccountSidW(LPCWSTR pSystemName, return ret; } - -/****************************************************************************** - * LookupAccountNameA [ADVAPI32.@] - * - * @implemented - */ -BOOL -WINAPI -LookupAccountNameA(LPCSTR SystemName, - LPCSTR AccountName, - PSID Sid, - LPDWORD SidLength, - LPSTR ReferencedDomainName, - LPDWORD hReferencedDomainNameLength, - PSID_NAME_USE SidNameUse) -{ - BOOL ret; - UNICODE_STRING lpSystemW; - UNICODE_STRING lpAccountW; - LPWSTR lpReferencedDomainNameW = NULL; - - RtlCreateUnicodeStringFromAsciiz(&lpSystemW, SystemName); - RtlCreateUnicodeStringFromAsciiz(&lpAccountW, AccountName); - - if (ReferencedDomainName) - lpReferencedDomainNameW = HeapAlloc(GetProcessHeap(), - 0, - *hReferencedDomainNameLength * sizeof(WCHAR)); - - ret = LookupAccountNameW(lpSystemW.Buffer, - lpAccountW.Buffer, - Sid, - SidLength, - lpReferencedDomainNameW, - hReferencedDomainNameLength, - SidNameUse); - - if (ret && lpReferencedDomainNameW) - { - WideCharToMultiByte(CP_ACP, - 0, - lpReferencedDomainNameW, - *hReferencedDomainNameLength + 1, - ReferencedDomainName, - *hReferencedDomainNameLength + 1, - NULL, - NULL); - } - - RtlFreeUnicodeString(&lpSystemW); - RtlFreeUnicodeString(&lpAccountW); - HeapFree(GetProcessHeap(), 0, lpReferencedDomainNameW); - - return ret; -} - - /****************************************************************************** * LookupAccountNameW [ADVAPI32.@] * @@ -1257,103 +822,6 @@ LookupPrivilegeValueW(LPCWSTR lpSystemName, return TRUE; } - -/********************************************************************** - * LookupPrivilegeDisplayNameA EXPORTED - * - * @unimplemented - */ -BOOL -WINAPI -LookupPrivilegeDisplayNameA(LPCSTR lpSystemName, - LPCSTR lpName, - LPSTR lpDisplayName, - LPDWORD cbDisplayName, - LPDWORD lpLanguageId) -{ - FIXME("%s() not implemented!\n", __FUNCTION__); - SetLastError (ERROR_CALL_NOT_IMPLEMENTED); - return FALSE; -} - - -/********************************************************************** - * LookupPrivilegeDisplayNameW EXPORTED - * - * @unimplemented - */ -BOOL -WINAPI -LookupPrivilegeDisplayNameW(LPCWSTR lpSystemName, - LPCWSTR lpName, - LPWSTR lpDisplayName, - LPDWORD cbDisplayName, - LPDWORD lpLanguageId) -{ - FIXME("%s() not implemented!\n", __FUNCTION__); - SetLastError (ERROR_CALL_NOT_IMPLEMENTED); - return FALSE; -} - - -/********************************************************************** - * LookupPrivilegeNameA EXPORTED - * - * @implemented - */ -BOOL -WINAPI -LookupPrivilegeNameA(LPCSTR lpSystemName, - PLUID lpLuid, - LPSTR lpName, - LPDWORD cchName) -{ - UNICODE_STRING lpSystemNameW; - BOOL ret; - DWORD wLen = 0; - - TRACE("%s %p %p %p\n", debugstr_a(lpSystemName), lpLuid, lpName, cchName); - - RtlCreateUnicodeStringFromAsciiz(&lpSystemNameW, lpSystemName); - ret = LookupPrivilegeNameW(lpSystemNameW.Buffer, lpLuid, NULL, &wLen); - if (!ret && GetLastError() == ERROR_INSUFFICIENT_BUFFER) - { - LPWSTR lpNameW = HeapAlloc(GetProcessHeap(), 0, wLen * sizeof(WCHAR)); - - ret = LookupPrivilegeNameW(lpSystemNameW.Buffer, lpLuid, lpNameW, - &wLen); - if (ret) - { - /* Windows crashes if cchName is NULL, so will I */ - unsigned int len = WideCharToMultiByte(CP_ACP, 0, lpNameW, -1, lpName, - *cchName, NULL, NULL); - - if (len == 0) - { - /* WideCharToMultiByte failed */ - ret = FALSE; - } - else if (len > *cchName) - { - *cchName = len; - SetLastError(ERROR_INSUFFICIENT_BUFFER); - ret = FALSE; - } - else - { - /* WideCharToMultiByte succeeded, output length needs to be - * length not including NULL terminator - */ - *cchName = len - 1; - } - } - HeapFree(GetProcessHeap(), 0, lpNameW); - } - RtlFreeUnicodeString(&lpSystemNameW); - return ret; -} - - /********************************************************************** * LookupPrivilegeNameW EXPORTED * @@ -1650,46 +1118,6 @@ GetNamedSecurityInfoW(LPWSTR pObjectName, return ErrorCode; } - -/********************************************************************** - * GetNamedSecurityInfoA EXPORTED - * - * @implemented - */ -DWORD -WINAPI -GetNamedSecurityInfoA(LPSTR pObjectName, - SE_OBJECT_TYPE ObjectType, - SECURITY_INFORMATION SecurityInfo, - PSID *ppsidOwner, - PSID *ppsidGroup, - PACL *ppDacl, - PACL *ppSacl, - PSECURITY_DESCRIPTOR *ppSecurityDescriptor) -{ - DWORD len; - LPWSTR wstr = NULL; - DWORD r; - - TRACE("%s %d %d %p %p %p %p %p\n", pObjectName, ObjectType, SecurityInfo, - ppsidOwner, ppsidGroup, ppDacl, ppSacl, ppSecurityDescriptor); - - if( pObjectName ) - { - len = MultiByteToWideChar( CP_ACP, 0, pObjectName, -1, NULL, 0 ); - wstr = HeapAlloc( GetProcessHeap(), 0, len*sizeof(WCHAR)); - MultiByteToWideChar( CP_ACP, 0, pObjectName, -1, wstr, len ); - } - - r = GetNamedSecurityInfoW( wstr, ObjectType, SecurityInfo, ppsidOwner, - ppsidGroup, ppDacl, ppSacl, ppSecurityDescriptor ); - - HeapFree( GetProcessHeap(), 0, wstr ); - - return r; -} - - /********************************************************************** * SetNamedSecurityInfoW EXPORTED * @@ -1737,44 +1165,6 @@ SetNamedSecurityInfoW(LPWSTR pObjectName, return ErrorCode; } - -/********************************************************************** - * SetNamedSecurityInfoA EXPORTED - * - * @implemented - */ -DWORD -WINAPI -SetNamedSecurityInfoA(LPSTR pObjectName, - SE_OBJECT_TYPE ObjectType, - SECURITY_INFORMATION SecurityInfo, - PSID psidOwner, - PSID psidGroup, - PACL pDacl, - PACL pSacl) -{ - UNICODE_STRING ObjectName; - DWORD Ret; - - if (!RtlCreateUnicodeStringFromAsciiz(&ObjectName, pObjectName)) - { - return ERROR_NOT_ENOUGH_MEMORY; - } - - Ret = SetNamedSecurityInfoW(ObjectName.Buffer, - ObjectType, - SecurityInfo, - psidOwner, - psidGroup, - pDacl, - pSacl); - - RtlFreeUnicodeString(&ObjectName); - - return Ret; -} - - /********************************************************************** * GetSecurityInfo EXPORTED * @@ -1873,81 +1263,6 @@ SetSecurityInfo(HANDLE handle, return ErrorCode; } - -/****************************************************************************** - * GetSecurityInfoExW EXPORTED - */ -DWORD -WINAPI -GetSecurityInfoExA(HANDLE hObject, - SE_OBJECT_TYPE ObjectType, - SECURITY_INFORMATION SecurityInfo, - LPCSTR lpProvider, - LPCSTR lpProperty, - PACTRL_ACCESSA *ppAccessList, - PACTRL_AUDITA *ppAuditList, - LPSTR *lppOwner, - LPSTR *lppGroup) -{ - FIXME("%s() not implemented!\n", __FUNCTION__); - return ERROR_BAD_PROVIDER; -} - - -/****************************************************************************** - * GetSecurityInfoExW EXPORTED - */ -DWORD -WINAPI -GetSecurityInfoExW(HANDLE hObject, - SE_OBJECT_TYPE ObjectType, - SECURITY_INFORMATION SecurityInfo, - LPCWSTR lpProvider, - LPCWSTR lpProperty, - PACTRL_ACCESSW *ppAccessList, - PACTRL_AUDITW *ppAuditList, - LPWSTR *lppOwner, - LPWSTR *lppGroup) -{ - FIXME("%s() not implemented!\n", __FUNCTION__); - return ERROR_BAD_PROVIDER; -} - - -/********************************************************************** - * ImpersonateNamedPipeClient EXPORTED - * - * @implemented - */ -BOOL -WINAPI -ImpersonateNamedPipeClient(HANDLE hNamedPipe) -{ - IO_STATUS_BLOCK StatusBlock; - NTSTATUS Status; - - TRACE("ImpersonateNamedPipeClient() called\n"); - - Status = NtFsControlFile(hNamedPipe, - NULL, - NULL, - NULL, - &StatusBlock, - FSCTL_PIPE_IMPERSONATE, - NULL, - 0, - NULL, - 0); - if (!NT_SUCCESS(Status)) - { - SetLastError(RtlNtStatusToDosError(Status)); - return FALSE; - } - - return TRUE; -} - - /* * @implemented */ @@ -2281,34 +1596,4 @@ TreeResetNamedSecurityInfoA(LPSTR pObjectName, #endif } -/****************************************************************************** - * QueryWindows31FilesMigration [ADVAPI32.@] - * - * PARAMS - * x1 [] - */ -BOOL WINAPI -QueryWindows31FilesMigration( DWORD x1 ) -{ - FIXME("(%d):stub\n",x1); - return TRUE; -} - -/****************************************************************************** - * SynchronizeWindows31FilesAndWindowsNTRegistry [ADVAPI32.@] - * - * PARAMS - * x1 [] - * x2 [] - * x3 [] - * x4 [] - */ -BOOL WINAPI -SynchronizeWindows31FilesAndWindowsNTRegistry( DWORD x1, DWORD x2, DWORD x3, - DWORD x4 ) -{ - FIXME("(0x%08x,0x%08x,0x%08x,0x%08x):stub\n",x1,x2,x3,x4); - return TRUE; -} - /* EOF */ diff --git a/reactos/dll/win32/advapi32/wine/security.c b/reactos/dll/win32/advapi32/wine/security.c index edfea353f83..c3364a9d473 100644 --- a/reactos/dll/win32/advapi32/wine/security.c +++ b/reactos/dll/win32/advapi32/wine/security.c @@ -311,6 +311,30 @@ static const RECORD SidTable[] = { NULL, 0 }, }; +/************************************************************ + * ADVAPI_IsLocalComputer + * + * Checks whether the server name indicates local machine. + */ +BOOL ADVAPI_IsLocalComputer(LPCWSTR ServerName) +{ + DWORD dwSize = MAX_COMPUTERNAME_LENGTH + 1; + BOOL Result; + LPWSTR buf; + + if (!ServerName || !ServerName[0]) + return TRUE; + + buf = HeapAlloc(GetProcessHeap(), 0, dwSize * sizeof(WCHAR)); + Result = GetComputerNameW(buf, &dwSize); + if (Result && (ServerName[0] == '\\') && (ServerName[1] == '\\')) + ServerName += 2; + Result = Result && !lstrcmpW(ServerName, buf); + HeapFree(GetProcessHeap(), 0, buf); + + return Result; +} + /* Exported functions */ /* @@ -799,6 +823,33 @@ GetLengthSid(PSID pSid) return (DWORD)RtlLengthSid(pSid); } +/* + * @implemented + */ +BOOL +WINAPI +GetKernelObjectSecurity(HANDLE Handle, + SECURITY_INFORMATION RequestedInformation, + PSECURITY_DESCRIPTOR pSecurityDescriptor, + DWORD nLength, + LPDWORD lpnLengthNeeded) +{ + NTSTATUS Status; + + Status = NtQuerySecurityObject(Handle, + RequestedInformation, + pSecurityDescriptor, + nLength, + lpnLengthNeeded); + if (!NT_SUCCESS(Status)) + { + SetLastError(RtlNtStatusToDosError(Status)); + return FALSE; + } + + return TRUE; +} + /* * @implemented */ @@ -822,6 +873,39 @@ InitializeAcl(PACL pAcl, return TRUE; } +/********************************************************************** + * ImpersonateNamedPipeClient EXPORTED + * + * @implemented + */ +BOOL +WINAPI +ImpersonateNamedPipeClient(HANDLE hNamedPipe) +{ + IO_STATUS_BLOCK StatusBlock; + NTSTATUS Status; + + TRACE("ImpersonateNamedPipeClient() called\n"); + + Status = NtFsControlFile(hNamedPipe, + NULL, + NULL, + NULL, + &StatusBlock, + FSCTL_PIPE_IMPERSONATE, + NULL, + 0, + NULL, + 0); + if (!NT_SUCCESS(Status)) + { + SetLastError(RtlNtStatusToDosError(Status)); + return FALSE; + } + + return TRUE; +} + /* * @implemented */ @@ -1061,6 +1145,396 @@ AllocateLocallyUniqueId(PLUID Luid) return TRUE; } +/********************************************************************** + * LookupPrivilegeDisplayNameA EXPORTED + * + * @unimplemented + */ +BOOL +WINAPI +LookupPrivilegeDisplayNameA(LPCSTR lpSystemName, + LPCSTR lpName, + LPSTR lpDisplayName, + LPDWORD cbDisplayName, + LPDWORD lpLanguageId) +{ + FIXME("%s() not implemented!\n", __FUNCTION__); + SetLastError (ERROR_CALL_NOT_IMPLEMENTED); + return FALSE; +} + + +/********************************************************************** + * LookupPrivilegeDisplayNameW EXPORTED + * + * @unimplemented + */ +BOOL +WINAPI +LookupPrivilegeDisplayNameW(LPCWSTR lpSystemName, + LPCWSTR lpName, + LPWSTR lpDisplayName, + LPDWORD cbDisplayName, + LPDWORD lpLanguageId) +{ + FIXME("%s() not implemented!\n", __FUNCTION__); + SetLastError (ERROR_CALL_NOT_IMPLEMENTED); + return FALSE; +} + +/********************************************************************** + * LookupPrivilegeNameA EXPORTED + * + * @implemented + */ +BOOL +WINAPI +LookupPrivilegeNameA(LPCSTR lpSystemName, + PLUID lpLuid, + LPSTR lpName, + LPDWORD cchName) +{ + UNICODE_STRING lpSystemNameW; + BOOL ret; + DWORD wLen = 0; + + TRACE("%s %p %p %p\n", debugstr_a(lpSystemName), lpLuid, lpName, cchName); + + RtlCreateUnicodeStringFromAsciiz(&lpSystemNameW, lpSystemName); + ret = LookupPrivilegeNameW(lpSystemNameW.Buffer, lpLuid, NULL, &wLen); + if (!ret && GetLastError() == ERROR_INSUFFICIENT_BUFFER) + { + LPWSTR lpNameW = HeapAlloc(GetProcessHeap(), 0, wLen * sizeof(WCHAR)); + + ret = LookupPrivilegeNameW(lpSystemNameW.Buffer, lpLuid, lpNameW, + &wLen); + if (ret) + { + /* Windows crashes if cchName is NULL, so will I */ + unsigned int len = WideCharToMultiByte(CP_ACP, 0, lpNameW, -1, lpName, + *cchName, NULL, NULL); + + if (len == 0) + { + /* WideCharToMultiByte failed */ + ret = FALSE; + } + else if (len > *cchName) + { + *cchName = len; + SetLastError(ERROR_INSUFFICIENT_BUFFER); + ret = FALSE; + } + else + { + /* WideCharToMultiByte succeeded, output length needs to be + * length not including NULL terminator + */ + *cchName = len - 1; + } + } + HeapFree(GetProcessHeap(), 0, lpNameW); + } + RtlFreeUnicodeString(&lpSystemNameW); + return ret; +} + +/****************************************************************************** + * GetFileSecurityA [ADVAPI32.@] + * + * Obtains Specified information about the security of a file or directory. + * + * PARAMS + * lpFileName [I] Name of the file to get info for + * RequestedInformation [I] SE_ flags from "winnt.h" + * pSecurityDescriptor [O] Destination for security information + * nLength [I] Length of pSecurityDescriptor + * lpnLengthNeeded [O] Destination for length of returned security information + * + * RETURNS + * Success: TRUE. pSecurityDescriptor contains the requested information. + * Failure: FALSE. lpnLengthNeeded contains the required space to return the info. + * + * NOTES + * The information returned is constrained by the callers access rights and + * privileges. + * + * @implemented + */ +BOOL +WINAPI +GetFileSecurityA(LPCSTR lpFileName, + SECURITY_INFORMATION RequestedInformation, + PSECURITY_DESCRIPTOR pSecurityDescriptor, + DWORD nLength, + LPDWORD lpnLengthNeeded) +{ + UNICODE_STRING FileName; + BOOL bResult; + + if (!RtlCreateUnicodeStringFromAsciiz(&FileName, lpFileName)) + { + SetLastError(ERROR_NOT_ENOUGH_MEMORY); + return FALSE; + } + + bResult = GetFileSecurityW(FileName.Buffer, + RequestedInformation, + pSecurityDescriptor, + nLength, + lpnLengthNeeded); + + RtlFreeUnicodeString(&FileName); + + return bResult; +} + +/* + * @implemented + */ +BOOL +WINAPI +GetFileSecurityW(LPCWSTR lpFileName, + SECURITY_INFORMATION RequestedInformation, + PSECURITY_DESCRIPTOR pSecurityDescriptor, + DWORD nLength, + LPDWORD lpnLengthNeeded) +{ + OBJECT_ATTRIBUTES ObjectAttributes; + IO_STATUS_BLOCK StatusBlock; + UNICODE_STRING FileName; + ULONG AccessMask = 0; + HANDLE FileHandle; + NTSTATUS Status; + + TRACE("GetFileSecurityW() called\n"); + + QuerySecurityAccessMask(RequestedInformation, &AccessMask); + + if (!RtlDosPathNameToNtPathName_U(lpFileName, + &FileName, + NULL, + NULL)) + { + ERR("Invalid path\n"); + SetLastError(ERROR_INVALID_NAME); + return FALSE; + } + + InitializeObjectAttributes(&ObjectAttributes, + &FileName, + OBJ_CASE_INSENSITIVE, + NULL, + NULL); + + Status = NtOpenFile(&FileHandle, + AccessMask, + &ObjectAttributes, + &StatusBlock, + FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, + 0); + + RtlFreeHeap(RtlGetProcessHeap(), + 0, + FileName.Buffer); + + if (!NT_SUCCESS(Status)) + { + ERR("NtOpenFile() failed (Status %lx)\n", Status); + SetLastError(RtlNtStatusToDosError(Status)); + return FALSE; + } + + Status = NtQuerySecurityObject(FileHandle, + RequestedInformation, + pSecurityDescriptor, + nLength, + lpnLengthNeeded); + NtClose(FileHandle); + if (!NT_SUCCESS(Status)) + { + ERR("NtQuerySecurityObject() failed (Status %lx)\n", Status); + SetLastError(RtlNtStatusToDosError(Status)); + return FALSE; + } + + return TRUE; +} + +/****************************************************************************** + * SetFileSecurityA [ADVAPI32.@] + * Sets the security of a file or directory + * + * @implemented + */ +BOOL +WINAPI +SetFileSecurityA(LPCSTR lpFileName, + SECURITY_INFORMATION SecurityInformation, + PSECURITY_DESCRIPTOR pSecurityDescriptor) +{ + UNICODE_STRING FileName; + BOOL bResult; + + if (!RtlCreateUnicodeStringFromAsciiz(&FileName, lpFileName)) + { + SetLastError(ERROR_NOT_ENOUGH_MEMORY); + return FALSE; + } + + bResult = SetFileSecurityW(FileName.Buffer, + SecurityInformation, + pSecurityDescriptor); + + RtlFreeUnicodeString(&FileName); + + return bResult; +} + +/****************************************************************************** + * SetFileSecurityW [ADVAPI32.@] + * Sets the security of a file or directory + * + * @implemented + */ +BOOL +WINAPI +SetFileSecurityW(LPCWSTR lpFileName, + SECURITY_INFORMATION SecurityInformation, + PSECURITY_DESCRIPTOR pSecurityDescriptor) +{ + OBJECT_ATTRIBUTES ObjectAttributes; + IO_STATUS_BLOCK StatusBlock; + UNICODE_STRING FileName; + ULONG AccessMask = 0; + HANDLE FileHandle; + NTSTATUS Status; + + TRACE("SetFileSecurityW() called\n"); + + SetSecurityAccessMask(SecurityInformation, &AccessMask); + + if (!RtlDosPathNameToNtPathName_U(lpFileName, + &FileName, + NULL, + NULL)) + { + ERR("Invalid path\n"); + SetLastError(ERROR_INVALID_NAME); + return FALSE; + } + + InitializeObjectAttributes(&ObjectAttributes, + &FileName, + OBJ_CASE_INSENSITIVE, + NULL, + NULL); + + Status = NtOpenFile(&FileHandle, + AccessMask, + &ObjectAttributes, + &StatusBlock, + FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, + 0); + + RtlFreeHeap(RtlGetProcessHeap(), + 0, + FileName.Buffer); + + if (!NT_SUCCESS(Status)) + { + ERR("NtOpenFile() failed (Status %lx)\n", Status); + SetLastError(RtlNtStatusToDosError(Status)); + return FALSE; + } + + Status = NtSetSecurityObject(FileHandle, + SecurityInformation, + pSecurityDescriptor); + NtClose(FileHandle); + + if (!NT_SUCCESS(Status)) + { + ERR("NtSetSecurityObject() failed (Status %lx)\n", Status); + SetLastError(RtlNtStatusToDosError(Status)); + return FALSE; + } + + return TRUE; +} + +/****************************************************************************** + * QueryWindows31FilesMigration [ADVAPI32.@] + * + * PARAMS + * x1 [] + */ +BOOL WINAPI +QueryWindows31FilesMigration( DWORD x1 ) +{ + FIXME("(%d):stub\n",x1); + return TRUE; +} + +/****************************************************************************** + * SynchronizeWindows31FilesAndWindowsNTRegistry [ADVAPI32.@] + * + * PARAMS + * x1 [] + * x2 [] + * x3 [] + * x4 [] + */ +BOOL WINAPI +SynchronizeWindows31FilesAndWindowsNTRegistry( DWORD x1, DWORD x2, DWORD x3, + DWORD x4 ) +{ + FIXME("(0x%08x,0x%08x,0x%08x,0x%08x):stub\n",x1,x2,x3,x4); + return TRUE; +} + +/* + * @implemented + */ +BOOL +WINAPI +RevertToSelf(VOID) +{ + NTSTATUS Status; + HANDLE Token = NULL; + + Status = NtSetInformationThread(NtCurrentThread(), + ThreadImpersonationToken, + &Token, + sizeof(HANDLE)); + if (!NT_SUCCESS(Status)) + { + SetLastError(RtlNtStatusToDosError(Status)); + return FALSE; + } + + return TRUE; +} + +/* + * @implemented + */ +BOOL +WINAPI +ImpersonateSelf(SECURITY_IMPERSONATION_LEVEL ImpersonationLevel) +{ + NTSTATUS Status; + + Status = RtlImpersonateSelf(ImpersonationLevel); + if (!NT_SUCCESS(Status)) + { + SetLastError(RtlNtStatusToDosError(Status)); + return FALSE; + } + + return TRUE; +} + /* * @implemented */ @@ -1136,6 +1610,29 @@ BOOL WINAPI AccessCheckByType( return !*AccessStatus; } +/* + * @implemented + */ +BOOL +WINAPI +SetKernelObjectSecurity(HANDLE Handle, + SECURITY_INFORMATION SecurityInformation, + PSECURITY_DESCRIPTOR SecurityDescriptor) +{ + NTSTATUS Status; + + Status = NtSetSecurityObject(Handle, + SecurityInformation, + SecurityDescriptor); + if (!NT_SUCCESS(Status)) + { + SetLastError(RtlNtStatusToDosError(Status)); + return FALSE; + } + + return TRUE; +} + /* * @implemented */ @@ -1195,6 +1692,61 @@ AddAuditAccessAceEx(PACL pAcl, return TRUE; } +/****************************************************************************** + * LookupAccountNameA [ADVAPI32.@] + * + * @implemented + */ +BOOL +WINAPI +LookupAccountNameA(LPCSTR SystemName, + LPCSTR AccountName, + PSID Sid, + LPDWORD SidLength, + LPSTR ReferencedDomainName, + LPDWORD hReferencedDomainNameLength, + PSID_NAME_USE SidNameUse) +{ + BOOL ret; + UNICODE_STRING lpSystemW; + UNICODE_STRING lpAccountW; + LPWSTR lpReferencedDomainNameW = NULL; + + RtlCreateUnicodeStringFromAsciiz(&lpSystemW, SystemName); + RtlCreateUnicodeStringFromAsciiz(&lpAccountW, AccountName); + + if (ReferencedDomainName) + lpReferencedDomainNameW = HeapAlloc(GetProcessHeap(), + 0, + *hReferencedDomainNameLength * sizeof(WCHAR)); + + ret = LookupAccountNameW(lpSystemW.Buffer, + lpAccountW.Buffer, + Sid, + SidLength, + lpReferencedDomainNameW, + hReferencedDomainNameLength, + SidNameUse); + + if (ret && lpReferencedDomainNameW) + { + WideCharToMultiByte(CP_ACP, + 0, + lpReferencedDomainNameW, + *hReferencedDomainNameLength + 1, + ReferencedDomainName, + *hReferencedDomainNameLength + 1, + NULL, + NULL); + } + + RtlFreeUnicodeString(&lpSystemW); + RtlFreeUnicodeString(&lpAccountW); + HeapFree(GetProcessHeap(), 0, lpReferencedDomainNameW); + + return ret; +} + /********************************************************************** * PrivilegeCheck EXPORTED * @@ -1222,6 +1774,45 @@ PrivilegeCheck(HANDLE ClientToken, return TRUE; } +/****************************************************************************** + * GetSecurityInfoExW EXPORTED + */ +DWORD +WINAPI +GetSecurityInfoExA(HANDLE hObject, + SE_OBJECT_TYPE ObjectType, + SECURITY_INFORMATION SecurityInfo, + LPCSTR lpProvider, + LPCSTR lpProperty, + PACTRL_ACCESSA *ppAccessList, + PACTRL_AUDITA *ppAuditList, + LPSTR *lppOwner, + LPSTR *lppGroup) +{ + FIXME("%s() not implemented!\n", __FUNCTION__); + return ERROR_BAD_PROVIDER; +} + + +/****************************************************************************** + * GetSecurityInfoExW EXPORTED + */ +DWORD +WINAPI +GetSecurityInfoExW(HANDLE hObject, + SE_OBJECT_TYPE ObjectType, + SECURITY_INFORMATION SecurityInfo, + LPCWSTR lpProvider, + LPCWSTR lpProperty, + PACTRL_ACCESSW *ppAccessList, + PACTRL_AUDITW *ppAuditList, + LPWSTR *lppOwner, + LPWSTR *lppGroup) +{ + FIXME("%s() not implemented!\n", __FUNCTION__); + return ERROR_BAD_PROVIDER; +} + /* * @implemented */ @@ -1247,6 +1838,66 @@ SetAclInformation(PACL pAcl, return TRUE; } +/********************************************************************** + * SetNamedSecurityInfoA EXPORTED + * + * @implemented + */ +DWORD +WINAPI +SetNamedSecurityInfoA(LPSTR pObjectName, + SE_OBJECT_TYPE ObjectType, + SECURITY_INFORMATION SecurityInfo, + PSID psidOwner, + PSID psidGroup, + PACL pDacl, + PACL pSacl) +{ + UNICODE_STRING ObjectName; + DWORD Ret; + + if (!RtlCreateUnicodeStringFromAsciiz(&ObjectName, pObjectName)) + { + return ERROR_NOT_ENOUGH_MEMORY; + } + + Ret = SetNamedSecurityInfoW(ObjectName.Buffer, + ObjectType, + SecurityInfo, + psidOwner, + psidGroup, + pDacl, + pSacl); + + RtlFreeUnicodeString(&ObjectName); + + return Ret; +} + +/* + * @implemented + */ +BOOL +WINAPI +AreAllAccessesGranted(DWORD GrantedAccess, + DWORD DesiredAccess) +{ + return (BOOL)RtlAreAllAccessesGranted(GrantedAccess, + DesiredAccess); +} + +/* + * @implemented + */ +BOOL +WINAPI +AreAnyAccessesGranted(DWORD GrantedAccess, + DWORD DesiredAccess) +{ + return (BOOL)RtlAreAnyAccessesGranted(GrantedAccess, + DesiredAccess); +} + /****************************************************************************** * ParseAclStringFlags */ @@ -2687,6 +3338,44 @@ lend: return bret; } +/********************************************************************** + * GetNamedSecurityInfoA EXPORTED + * + * @implemented + */ +DWORD +WINAPI +GetNamedSecurityInfoA(LPSTR pObjectName, + SE_OBJECT_TYPE ObjectType, + SECURITY_INFORMATION SecurityInfo, + PSID *ppsidOwner, + PSID *ppsidGroup, + PACL *ppDacl, + PACL *ppSacl, + PSECURITY_DESCRIPTOR *ppSecurityDescriptor) +{ + DWORD len; + LPWSTR wstr = NULL; + DWORD r; + + TRACE("%s %d %d %p %p %p %p %p\n", pObjectName, ObjectType, SecurityInfo, + ppsidOwner, ppsidGroup, ppDacl, ppSacl, ppSecurityDescriptor); + + if( pObjectName ) + { + len = MultiByteToWideChar( CP_ACP, 0, pObjectName, -1, NULL, 0 ); + wstr = HeapAlloc( GetProcessHeap(), 0, len*sizeof(WCHAR)); + MultiByteToWideChar( CP_ACP, 0, pObjectName, -1, wstr, len ); + } + + r = GetNamedSecurityInfoW( wstr, ObjectType, SecurityInfo, ppsidOwner, + ppsidGroup, ppDacl, ppSacl, ppSecurityDescriptor ); + + HeapFree( GetProcessHeap(), 0, wstr ); + + return r; +} + /* * @unimplemented */ From 648ce226ac9486cfcc71b7d867f12d9356a56de9 Mon Sep 17 00:00:00 2001 From: Amine Khaldi Date: Sat, 25 Oct 2014 12:45:57 +0000 Subject: [PATCH 17/91] [ADVAPI32] * Move some functions from trustee.c to security.c. CORE-8540 svn path=/trunk/; revision=64979 --- reactos/dll/win32/advapi32/sec/trustee.c | 354 --------------------- reactos/dll/win32/advapi32/wine/security.c | 333 +++++++++++++++++++ 2 files changed, 333 insertions(+), 354 deletions(-) diff --git a/reactos/dll/win32/advapi32/sec/trustee.c b/reactos/dll/win32/advapi32/sec/trustee.c index 9b62f7954aa..a889cc9e6ab 100644 --- a/reactos/dll/win32/advapi32/sec/trustee.c +++ b/reactos/dll/win32/advapi32/sec/trustee.c @@ -32,51 +32,6 @@ BuildImpersonateTrusteeW(PTRUSTEE_W pTrustee, pTrustee->MultipleTrusteeOperation = TRUSTEE_IS_IMPERSONATE; } - -/****************************************************************************** - * BuildExplicitAccessWithNameA [ADVAPI32.@] - */ -VOID WINAPI -BuildExplicitAccessWithNameA(PEXPLICIT_ACCESSA pExplicitAccess, - LPSTR pTrusteeName, - DWORD AccessPermissions, - ACCESS_MODE AccessMode, - DWORD Inheritance) -{ - pExplicitAccess->grfAccessPermissions = AccessPermissions; - pExplicitAccess->grfAccessMode = AccessMode; - pExplicitAccess->grfInheritance = Inheritance; - - pExplicitAccess->Trustee.pMultipleTrustee = NULL; - pExplicitAccess->Trustee.MultipleTrusteeOperation = NO_MULTIPLE_TRUSTEE; - pExplicitAccess->Trustee.TrusteeForm = TRUSTEE_IS_NAME; - pExplicitAccess->Trustee.TrusteeType = TRUSTEE_IS_UNKNOWN; - pExplicitAccess->Trustee.ptstrName = pTrusteeName; -} - - -/****************************************************************************** - * BuildExplicitAccessWithNameW [ADVAPI32.@] - */ -VOID WINAPI -BuildExplicitAccessWithNameW(PEXPLICIT_ACCESSW pExplicitAccess, - LPWSTR pTrusteeName, - DWORD AccessPermissions, - ACCESS_MODE AccessMode, - DWORD Inheritance) -{ - pExplicitAccess->grfAccessPermissions = AccessPermissions; - pExplicitAccess->grfAccessMode = AccessMode; - pExplicitAccess->grfInheritance = Inheritance; - - pExplicitAccess->Trustee.pMultipleTrustee = NULL; - pExplicitAccess->Trustee.MultipleTrusteeOperation = NO_MULTIPLE_TRUSTEE; - pExplicitAccess->Trustee.TrusteeForm = TRUSTEE_IS_NAME; - pExplicitAccess->Trustee.TrusteeType = TRUSTEE_IS_UNKNOWN; - pExplicitAccess->Trustee.ptstrName = pTrusteeName; -} - - /****************************************************************************** * BuildImpersonateExplicitAccessWithNameA [ADVAPI32.@] */ @@ -122,255 +77,6 @@ BuildImpersonateExplicitAccessWithNameW(PEXPLICIT_ACCESS_W pExplicitAccess, pExplicitAccess->Trustee.ptstrName = pTrusteeName; } - -/****************************************************************************** - * BuildTrusteeWithSidA [ADVAPI32.@] - */ -VOID WINAPI -BuildTrusteeWithSidA(PTRUSTEE_A pTrustee, - PSID pSid) -{ - TRACE("%p %p\n", pTrustee, pSid); - - pTrustee->pMultipleTrustee = NULL; - pTrustee->MultipleTrusteeOperation = NO_MULTIPLE_TRUSTEE; - pTrustee->TrusteeForm = TRUSTEE_IS_SID; - pTrustee->TrusteeType = TRUSTEE_IS_UNKNOWN; - pTrustee->ptstrName = (LPSTR) pSid; -} - - -/****************************************************************************** - * BuildTrusteeWithSidW [ADVAPI32.@] - */ -VOID WINAPI -BuildTrusteeWithSidW(PTRUSTEE_W pTrustee, - PSID pSid) -{ - TRACE("%p %p\n", pTrustee, pSid); - - pTrustee->pMultipleTrustee = NULL; - pTrustee->MultipleTrusteeOperation = NO_MULTIPLE_TRUSTEE; - pTrustee->TrusteeForm = TRUSTEE_IS_SID; - pTrustee->TrusteeType = TRUSTEE_IS_UNKNOWN; - pTrustee->ptstrName = (LPWSTR) pSid; -} - - -/****************************************************************************** - * BuildTrusteeWithNameA [ADVAPI32.@] - */ -VOID WINAPI -BuildTrusteeWithNameA(PTRUSTEE_A pTrustee, - LPSTR name) -{ - TRACE("%p %s\n", pTrustee, name); - - pTrustee->pMultipleTrustee = NULL; - pTrustee->MultipleTrusteeOperation = NO_MULTIPLE_TRUSTEE; - pTrustee->TrusteeForm = TRUSTEE_IS_NAME; - pTrustee->TrusteeType = TRUSTEE_IS_UNKNOWN; - pTrustee->ptstrName = name; -} - - -/****************************************************************************** - * BuildTrusteeWithNameW [ADVAPI32.@] - */ -VOID WINAPI -BuildTrusteeWithNameW(PTRUSTEE_W pTrustee, - LPWSTR name) -{ - TRACE("%p %s\n", pTrustee, name); - - pTrustee->pMultipleTrustee = NULL; - pTrustee->MultipleTrusteeOperation = NO_MULTIPLE_TRUSTEE; - pTrustee->TrusteeForm = TRUSTEE_IS_NAME; - pTrustee->TrusteeType = TRUSTEE_IS_UNKNOWN; - pTrustee->ptstrName = name; -} - - -/****************************************************************************** - * BuildTrusteeWithObjectsAndNameA [ADVAPI32.@] - */ -VOID WINAPI -BuildTrusteeWithObjectsAndNameA(PTRUSTEEA pTrustee, - POBJECTS_AND_NAME_A pObjName, - SE_OBJECT_TYPE ObjectType, - LPSTR ObjectTypeName, - LPSTR InheritedObjectTypeName, - LPSTR Name) -{ - DWORD ObjectsPresent = 0; - - TRACE("%p %p 0x%08x %p %p %s\n", pTrustee, pObjName, - ObjectType, ObjectTypeName, InheritedObjectTypeName, Name); - - /* Fill the OBJECTS_AND_NAME structure */ - pObjName->ObjectType = ObjectType; - if (ObjectTypeName != NULL) - { - ObjectsPresent |= ACE_OBJECT_TYPE_PRESENT; - } - - pObjName->InheritedObjectTypeName = InheritedObjectTypeName; - if (InheritedObjectTypeName != NULL) - { - ObjectsPresent |= ACE_INHERITED_OBJECT_TYPE_PRESENT; - } - - pObjName->ObjectsPresent = ObjectsPresent; - pObjName->ptstrName = Name; - - /* Fill the TRUSTEE structure */ - pTrustee->pMultipleTrustee = NULL; - pTrustee->MultipleTrusteeOperation = NO_MULTIPLE_TRUSTEE; - pTrustee->TrusteeForm = TRUSTEE_IS_OBJECTS_AND_NAME; - pTrustee->TrusteeType = TRUSTEE_IS_UNKNOWN; - pTrustee->ptstrName = (LPSTR)pObjName; -} - - -/****************************************************************************** - * BuildTrusteeWithObjectsAndNameW [ADVAPI32.@] - */ -VOID WINAPI -BuildTrusteeWithObjectsAndNameW(PTRUSTEEW pTrustee, - POBJECTS_AND_NAME_W pObjName, - SE_OBJECT_TYPE ObjectType, - LPWSTR ObjectTypeName, - LPWSTR InheritedObjectTypeName, - LPWSTR Name) -{ - DWORD ObjectsPresent = 0; - - TRACE("%p %p 0x%08x %p %p %s\n", pTrustee, pObjName, - ObjectType, ObjectTypeName, InheritedObjectTypeName, Name); - - /* Fill the OBJECTS_AND_NAME structure */ - pObjName->ObjectType = ObjectType; - if (ObjectTypeName != NULL) - { - ObjectsPresent |= ACE_OBJECT_TYPE_PRESENT; - } - - pObjName->InheritedObjectTypeName = InheritedObjectTypeName; - if (InheritedObjectTypeName != NULL) - { - ObjectsPresent |= ACE_INHERITED_OBJECT_TYPE_PRESENT; - } - - pObjName->ObjectsPresent = ObjectsPresent; - pObjName->ptstrName = Name; - - /* Fill the TRUSTEE structure */ - pTrustee->pMultipleTrustee = NULL; - pTrustee->MultipleTrusteeOperation = NO_MULTIPLE_TRUSTEE; - pTrustee->TrusteeForm = TRUSTEE_IS_OBJECTS_AND_NAME; - pTrustee->TrusteeType = TRUSTEE_IS_UNKNOWN; - pTrustee->ptstrName = (LPWSTR)pObjName; -} - - -/****************************************************************************** - * BuildTrusteeWithObjectsAndSidA [ADVAPI32.@] - */ -VOID WINAPI -BuildTrusteeWithObjectsAndSidA(PTRUSTEEA pTrustee, - POBJECTS_AND_SID pObjSid, - GUID *pObjectGuid, - GUID *pInheritedObjectGuid, - PSID pSid) -{ - DWORD ObjectsPresent = 0; - - TRACE("%p %p %p %p %p\n", pTrustee, pObjSid, pObjectGuid, pInheritedObjectGuid, pSid); - - /* Fill the OBJECTS_AND_SID structure */ - if (pObjectGuid != NULL) - { - pObjSid->ObjectTypeGuid = *pObjectGuid; - ObjectsPresent |= ACE_OBJECT_TYPE_PRESENT; - } - else - { - ZeroMemory(&pObjSid->ObjectTypeGuid, - sizeof(GUID)); - } - - if (pInheritedObjectGuid != NULL) - { - pObjSid->InheritedObjectTypeGuid = *pInheritedObjectGuid; - ObjectsPresent |= ACE_INHERITED_OBJECT_TYPE_PRESENT; - } - else - { - ZeroMemory(&pObjSid->InheritedObjectTypeGuid, - sizeof(GUID)); - } - - pObjSid->ObjectsPresent = ObjectsPresent; - pObjSid->pSid = pSid; - - /* Fill the TRUSTEE structure */ - pTrustee->pMultipleTrustee = NULL; - pTrustee->MultipleTrusteeOperation = NO_MULTIPLE_TRUSTEE; - pTrustee->TrusteeForm = TRUSTEE_IS_OBJECTS_AND_SID; - pTrustee->TrusteeType = TRUSTEE_IS_UNKNOWN; - pTrustee->ptstrName = (LPSTR) pObjSid; -} - - -/****************************************************************************** - * BuildTrusteeWithObjectsAndSidW [ADVAPI32.@] - */ -VOID WINAPI -BuildTrusteeWithObjectsAndSidW(PTRUSTEEW pTrustee, - POBJECTS_AND_SID pObjSid, - GUID *pObjectGuid, - GUID *pInheritedObjectGuid, - PSID pSid) -{ - DWORD ObjectsPresent = 0; - - TRACE("%p %p %p %p %p\n", pTrustee, pObjSid, pObjectGuid, pInheritedObjectGuid, pSid); - - /* Fill the OBJECTS_AND_SID structure */ - if (pObjectGuid != NULL) - { - pObjSid->ObjectTypeGuid = *pObjectGuid; - ObjectsPresent |= ACE_OBJECT_TYPE_PRESENT; - } - else - { - ZeroMemory(&pObjSid->ObjectTypeGuid, - sizeof(GUID)); - } - - if (pInheritedObjectGuid != NULL) - { - pObjSid->InheritedObjectTypeGuid = *pInheritedObjectGuid; - ObjectsPresent |= ACE_INHERITED_OBJECT_TYPE_PRESENT; - } - else - { - ZeroMemory(&pObjSid->InheritedObjectTypeGuid, - sizeof(GUID)); - } - - pObjSid->ObjectsPresent = ObjectsPresent; - pObjSid->pSid = pSid; - - /* Fill the TRUSTEE structure */ - pTrustee->pMultipleTrustee = NULL; - pTrustee->MultipleTrusteeOperation = NO_MULTIPLE_TRUSTEE; - pTrustee->TrusteeForm = TRUSTEE_IS_OBJECTS_AND_SID; - pTrustee->TrusteeType = TRUSTEE_IS_UNKNOWN; - pTrustee->ptstrName = (LPWSTR) pObjSid; -} - - /****************************************************************************** * GetMultipleTrusteeA [ADVAPI32.@] */ @@ -410,64 +116,4 @@ GetMultipleTrusteeOperationW(PTRUSTEE_W pTrustee) return pTrustee->MultipleTrusteeOperation; } - -/****************************************************************************** - * GetTrusteeFormW [ADVAPI32.@] - */ -TRUSTEE_FORM WINAPI -GetTrusteeFormA(PTRUSTEE_A pTrustee) -{ - return pTrustee->TrusteeForm; -} - - -/****************************************************************************** - * GetTrusteeFormW [ADVAPI32.@] - */ -TRUSTEE_FORM WINAPI -GetTrusteeFormW(PTRUSTEE_W pTrustee) -{ - return pTrustee->TrusteeForm; -} - - -/****************************************************************************** - * GetTrusteeNameA [ADVAPI32.@] - */ -LPSTR WINAPI -GetTrusteeNameA(PTRUSTEE_A pTrustee) -{ - return pTrustee->ptstrName; -} - - -/****************************************************************************** - * GetTrusteeNameW [ADVAPI32.@] - */ -LPWSTR WINAPI -GetTrusteeNameW(PTRUSTEE_W pTrustee) -{ - return pTrustee->ptstrName; -} - - -/****************************************************************************** - * GetTrusteeTypeA [ADVAPI32.@] - */ -TRUSTEE_TYPE WINAPI -GetTrusteeTypeA(PTRUSTEE_A pTrustee) -{ - return pTrustee->TrusteeType; -} - - -/****************************************************************************** - * GetTrusteeTypeW [ADVAPI32.@] - */ -TRUSTEE_TYPE WINAPI -GetTrusteeTypeW(PTRUSTEE_W pTrustee) -{ - return pTrustee->TrusteeType; -} - /* EOF */ diff --git a/reactos/dll/win32/advapi32/wine/security.c b/reactos/dll/win32/advapi32/wine/security.c index c3364a9d473..1b77f36eb7d 100644 --- a/reactos/dll/win32/advapi32/wine/security.c +++ b/reactos/dll/win32/advapi32/wine/security.c @@ -1813,6 +1813,339 @@ GetSecurityInfoExW(HANDLE hObject, return ERROR_BAD_PROVIDER; } +/****************************************************************************** + * BuildExplicitAccessWithNameA [ADVAPI32.@] + */ +VOID WINAPI +BuildExplicitAccessWithNameA(PEXPLICIT_ACCESSA pExplicitAccess, + LPSTR pTrusteeName, + DWORD AccessPermissions, + ACCESS_MODE AccessMode, + DWORD Inheritance) +{ + pExplicitAccess->grfAccessPermissions = AccessPermissions; + pExplicitAccess->grfAccessMode = AccessMode; + pExplicitAccess->grfInheritance = Inheritance; + + pExplicitAccess->Trustee.pMultipleTrustee = NULL; + pExplicitAccess->Trustee.MultipleTrusteeOperation = NO_MULTIPLE_TRUSTEE; + pExplicitAccess->Trustee.TrusteeForm = TRUSTEE_IS_NAME; + pExplicitAccess->Trustee.TrusteeType = TRUSTEE_IS_UNKNOWN; + pExplicitAccess->Trustee.ptstrName = pTrusteeName; +} + + +/****************************************************************************** + * BuildExplicitAccessWithNameW [ADVAPI32.@] + */ +VOID WINAPI +BuildExplicitAccessWithNameW(PEXPLICIT_ACCESSW pExplicitAccess, + LPWSTR pTrusteeName, + DWORD AccessPermissions, + ACCESS_MODE AccessMode, + DWORD Inheritance) +{ + pExplicitAccess->grfAccessPermissions = AccessPermissions; + pExplicitAccess->grfAccessMode = AccessMode; + pExplicitAccess->grfInheritance = Inheritance; + + pExplicitAccess->Trustee.pMultipleTrustee = NULL; + pExplicitAccess->Trustee.MultipleTrusteeOperation = NO_MULTIPLE_TRUSTEE; + pExplicitAccess->Trustee.TrusteeForm = TRUSTEE_IS_NAME; + pExplicitAccess->Trustee.TrusteeType = TRUSTEE_IS_UNKNOWN; + pExplicitAccess->Trustee.ptstrName = pTrusteeName; +} + +/****************************************************************************** + * BuildTrusteeWithObjectsAndNameA [ADVAPI32.@] + */ +VOID WINAPI BuildTrusteeWithObjectsAndNameA( PTRUSTEEA pTrustee, POBJECTS_AND_NAME_A pObjName, + SE_OBJECT_TYPE ObjectType, LPSTR ObjectTypeName, + LPSTR InheritedObjectTypeName, LPSTR Name ) +{ + DWORD ObjectsPresent = 0; + + TRACE("%p %p 0x%08x %p %p %s\n", pTrustee, pObjName, + ObjectType, ObjectTypeName, InheritedObjectTypeName, debugstr_a(Name)); + + /* Fill the OBJECTS_AND_NAME structure */ + pObjName->ObjectType = ObjectType; + if (ObjectTypeName != NULL) + { + ObjectsPresent |= ACE_OBJECT_TYPE_PRESENT; + } + + pObjName->InheritedObjectTypeName = InheritedObjectTypeName; + if (InheritedObjectTypeName != NULL) + { + ObjectsPresent |= ACE_INHERITED_OBJECT_TYPE_PRESENT; + } + + pObjName->ObjectsPresent = ObjectsPresent; + pObjName->ptstrName = Name; + + /* Fill the TRUSTEE structure */ + pTrustee->pMultipleTrustee = NULL; + pTrustee->MultipleTrusteeOperation = NO_MULTIPLE_TRUSTEE; + pTrustee->TrusteeForm = TRUSTEE_IS_OBJECTS_AND_NAME; + pTrustee->TrusteeType = TRUSTEE_IS_UNKNOWN; + pTrustee->ptstrName = (LPSTR)pObjName; +} + +/****************************************************************************** + * BuildTrusteeWithObjectsAndNameW [ADVAPI32.@] + */ +VOID WINAPI BuildTrusteeWithObjectsAndNameW( PTRUSTEEW pTrustee, POBJECTS_AND_NAME_W pObjName, + SE_OBJECT_TYPE ObjectType, LPWSTR ObjectTypeName, + LPWSTR InheritedObjectTypeName, LPWSTR Name ) +{ + DWORD ObjectsPresent = 0; + + TRACE("%p %p 0x%08x %p %p %s\n", pTrustee, pObjName, + ObjectType, ObjectTypeName, InheritedObjectTypeName, debugstr_w(Name)); + + /* Fill the OBJECTS_AND_NAME structure */ + pObjName->ObjectType = ObjectType; + if (ObjectTypeName != NULL) + { + ObjectsPresent |= ACE_OBJECT_TYPE_PRESENT; + } + + pObjName->InheritedObjectTypeName = InheritedObjectTypeName; + if (InheritedObjectTypeName != NULL) + { + ObjectsPresent |= ACE_INHERITED_OBJECT_TYPE_PRESENT; + } + + pObjName->ObjectsPresent = ObjectsPresent; + pObjName->ptstrName = Name; + + /* Fill the TRUSTEE structure */ + pTrustee->pMultipleTrustee = NULL; + pTrustee->MultipleTrusteeOperation = NO_MULTIPLE_TRUSTEE; + pTrustee->TrusteeForm = TRUSTEE_IS_OBJECTS_AND_NAME; + pTrustee->TrusteeType = TRUSTEE_IS_UNKNOWN; + pTrustee->ptstrName = (LPWSTR)pObjName; +} + +/****************************************************************************** + * BuildTrusteeWithObjectsAndSidA [ADVAPI32.@] + */ +VOID WINAPI +BuildTrusteeWithObjectsAndSidA(PTRUSTEEA pTrustee, + POBJECTS_AND_SID pObjSid, + GUID *pObjectGuid, + GUID *pInheritedObjectGuid, + PSID pSid) +{ + DWORD ObjectsPresent = 0; + + TRACE("%p %p %p %p %p\n", pTrustee, pObjSid, pObjectGuid, pInheritedObjectGuid, pSid); + + /* Fill the OBJECTS_AND_SID structure */ + if (pObjectGuid != NULL) + { + pObjSid->ObjectTypeGuid = *pObjectGuid; + ObjectsPresent |= ACE_OBJECT_TYPE_PRESENT; + } + else + { + ZeroMemory(&pObjSid->ObjectTypeGuid, + sizeof(GUID)); + } + + if (pInheritedObjectGuid != NULL) + { + pObjSid->InheritedObjectTypeGuid = *pInheritedObjectGuid; + ObjectsPresent |= ACE_INHERITED_OBJECT_TYPE_PRESENT; + } + else + { + ZeroMemory(&pObjSid->InheritedObjectTypeGuid, + sizeof(GUID)); + } + + pObjSid->ObjectsPresent = ObjectsPresent; + pObjSid->pSid = pSid; + + /* Fill the TRUSTEE structure */ + pTrustee->pMultipleTrustee = NULL; + pTrustee->MultipleTrusteeOperation = NO_MULTIPLE_TRUSTEE; + pTrustee->TrusteeForm = TRUSTEE_IS_OBJECTS_AND_SID; + pTrustee->TrusteeType = TRUSTEE_IS_UNKNOWN; + pTrustee->ptstrName = (LPSTR) pObjSid; +} + + +/****************************************************************************** + * BuildTrusteeWithObjectsAndSidW [ADVAPI32.@] + */ +VOID WINAPI +BuildTrusteeWithObjectsAndSidW(PTRUSTEEW pTrustee, + POBJECTS_AND_SID pObjSid, + GUID *pObjectGuid, + GUID *pInheritedObjectGuid, + PSID pSid) +{ + DWORD ObjectsPresent = 0; + + TRACE("%p %p %p %p %p\n", pTrustee, pObjSid, pObjectGuid, pInheritedObjectGuid, pSid); + + /* Fill the OBJECTS_AND_SID structure */ + if (pObjectGuid != NULL) + { + pObjSid->ObjectTypeGuid = *pObjectGuid; + ObjectsPresent |= ACE_OBJECT_TYPE_PRESENT; + } + else + { + ZeroMemory(&pObjSid->ObjectTypeGuid, + sizeof(GUID)); + } + + if (pInheritedObjectGuid != NULL) + { + pObjSid->InheritedObjectTypeGuid = *pInheritedObjectGuid; + ObjectsPresent |= ACE_INHERITED_OBJECT_TYPE_PRESENT; + } + else + { + ZeroMemory(&pObjSid->InheritedObjectTypeGuid, + sizeof(GUID)); + } + + pObjSid->ObjectsPresent = ObjectsPresent; + pObjSid->pSid = pSid; + + /* Fill the TRUSTEE structure */ + pTrustee->pMultipleTrustee = NULL; + pTrustee->MultipleTrusteeOperation = NO_MULTIPLE_TRUSTEE; + pTrustee->TrusteeForm = TRUSTEE_IS_OBJECTS_AND_SID; + pTrustee->TrusteeType = TRUSTEE_IS_UNKNOWN; + pTrustee->ptstrName = (LPWSTR) pObjSid; +} + +/****************************************************************************** + * BuildTrusteeWithSidA [ADVAPI32.@] + */ +VOID WINAPI +BuildTrusteeWithSidA(PTRUSTEE_A pTrustee, + PSID pSid) +{ + TRACE("%p %p\n", pTrustee, pSid); + + pTrustee->pMultipleTrustee = NULL; + pTrustee->MultipleTrusteeOperation = NO_MULTIPLE_TRUSTEE; + pTrustee->TrusteeForm = TRUSTEE_IS_SID; + pTrustee->TrusteeType = TRUSTEE_IS_UNKNOWN; + pTrustee->ptstrName = (LPSTR) pSid; +} + + +/****************************************************************************** + * BuildTrusteeWithSidW [ADVAPI32.@] + */ +VOID WINAPI +BuildTrusteeWithSidW(PTRUSTEE_W pTrustee, + PSID pSid) +{ + TRACE("%p %p\n", pTrustee, pSid); + + pTrustee->pMultipleTrustee = NULL; + pTrustee->MultipleTrusteeOperation = NO_MULTIPLE_TRUSTEE; + pTrustee->TrusteeForm = TRUSTEE_IS_SID; + pTrustee->TrusteeType = TRUSTEE_IS_UNKNOWN; + pTrustee->ptstrName = (LPWSTR) pSid; +} + +/****************************************************************************** + * BuildTrusteeWithNameA [ADVAPI32.@] + */ +VOID WINAPI +BuildTrusteeWithNameA(PTRUSTEE_A pTrustee, + LPSTR name) +{ + TRACE("%p %s\n", pTrustee, name); + + pTrustee->pMultipleTrustee = NULL; + pTrustee->MultipleTrusteeOperation = NO_MULTIPLE_TRUSTEE; + pTrustee->TrusteeForm = TRUSTEE_IS_NAME; + pTrustee->TrusteeType = TRUSTEE_IS_UNKNOWN; + pTrustee->ptstrName = name; +} + +/****************************************************************************** + * BuildTrusteeWithNameW [ADVAPI32.@] + */ +VOID WINAPI +BuildTrusteeWithNameW(PTRUSTEE_W pTrustee, + LPWSTR name) +{ + TRACE("%p %s\n", pTrustee, name); + + pTrustee->pMultipleTrustee = NULL; + pTrustee->MultipleTrusteeOperation = NO_MULTIPLE_TRUSTEE; + pTrustee->TrusteeForm = TRUSTEE_IS_NAME; + pTrustee->TrusteeType = TRUSTEE_IS_UNKNOWN; + pTrustee->ptstrName = name; +} + +/****************************************************************************** + * GetTrusteeFormW [ADVAPI32.@] + */ +TRUSTEE_FORM WINAPI +GetTrusteeFormA(PTRUSTEE_A pTrustee) +{ + return pTrustee->TrusteeForm; +} + + +/****************************************************************************** + * GetTrusteeFormW [ADVAPI32.@] + */ +TRUSTEE_FORM WINAPI +GetTrusteeFormW(PTRUSTEE_W pTrustee) +{ + return pTrustee->TrusteeForm; +} + +/****************************************************************************** + * GetTrusteeNameA [ADVAPI32.@] + */ +LPSTR WINAPI +GetTrusteeNameA(PTRUSTEE_A pTrustee) +{ + return pTrustee->ptstrName; +} + + +/****************************************************************************** + * GetTrusteeNameW [ADVAPI32.@] + */ +LPWSTR WINAPI +GetTrusteeNameW(PTRUSTEE_W pTrustee) +{ + return pTrustee->ptstrName; +} + +/****************************************************************************** + * GetTrusteeTypeA [ADVAPI32.@] + */ +TRUSTEE_TYPE WINAPI +GetTrusteeTypeA(PTRUSTEE_A pTrustee) +{ + return pTrustee->TrusteeType; +} + +/****************************************************************************** + * GetTrusteeTypeW [ADVAPI32.@] + */ +TRUSTEE_TYPE WINAPI +GetTrusteeTypeW(PTRUSTEE_W pTrustee) +{ + return pTrustee->TrusteeType; +} + /* * @implemented */ From 21ef917d3f24a51885518cfae55012f1c3f3f3be Mon Sep 17 00:00:00 2001 From: Amine Khaldi Date: Sat, 25 Oct 2014 13:56:28 +0000 Subject: [PATCH 18/91] [ADVAPI32] * Fix set_ntstatus() to use NT_SUCCESS when performing the checks. CORE-8540 svn path=/trunk/; revision=64980 --- reactos/dll/win32/advapi32/wine/security.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/reactos/dll/win32/advapi32/wine/security.c b/reactos/dll/win32/advapi32/wine/security.c index 1b77f36eb7d..6456cf3eed1 100644 --- a/reactos/dll/win32/advapi32/wine/security.c +++ b/reactos/dll/win32/advapi32/wine/security.c @@ -264,8 +264,8 @@ static const ACEFLAG AceRights[] = /* used for functions that are a simple wrapper around the corresponding ntdll API */ static __inline BOOL set_ntstatus( NTSTATUS status ) { - if (status) SetLastError( RtlNtStatusToDosError( status )); - return !status; + if (!NT_SUCCESS(status)) SetLastError( RtlNtStatusToDosError( status )); + return NT_SUCCESS(status); } static const RECORD SidTable[] = From 93ecff8e68c00797df7e8d0de2eff364a0737894 Mon Sep 17 00:00:00 2001 From: Amine Khaldi Date: Sat, 25 Oct 2014 14:02:23 +0000 Subject: [PATCH 19/91] [ADVAPI32] * Update ADVAPI_IsLocalComputer(). CORE-8540 svn path=/trunk/; revision=64981 --- reactos/dll/win32/advapi32/wine/security.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/reactos/dll/win32/advapi32/wine/security.c b/reactos/dll/win32/advapi32/wine/security.c index 6456cf3eed1..8c3841da5f5 100644 --- a/reactos/dll/win32/advapi32/wine/security.c +++ b/reactos/dll/win32/advapi32/wine/security.c @@ -325,12 +325,12 @@ BOOL ADVAPI_IsLocalComputer(LPCWSTR ServerName) if (!ServerName || !ServerName[0]) return TRUE; - buf = HeapAlloc(GetProcessHeap(), 0, dwSize * sizeof(WCHAR)); + buf = heap_alloc(dwSize * sizeof(WCHAR)); Result = GetComputerNameW(buf, &dwSize); if (Result && (ServerName[0] == '\\') && (ServerName[1] == '\\')) ServerName += 2; Result = Result && !lstrcmpW(ServerName, buf); - HeapFree(GetProcessHeap(), 0, buf); + heap_free(buf); return Result; } From a3930ce68fe328c2ff66f3a95a0ae598330528d6 Mon Sep 17 00:00:00 2001 From: Amine Khaldi Date: Sat, 25 Oct 2014 14:15:00 +0000 Subject: [PATCH 20/91] [ADVAPI32] * Update CreateRestrictedToken(). * More advapi32:security tests run now. CORE-8540 svn path=/trunk/; revision=64982 --- reactos/dll/win32/advapi32/wine/security.c | 61 +++++++++++++++++----- 1 file changed, 49 insertions(+), 12 deletions(-) diff --git a/reactos/dll/win32/advapi32/wine/security.c b/reactos/dll/win32/advapi32/wine/security.c index 8c3841da5f5..892e5876b9e 100644 --- a/reactos/dll/win32/advapi32/wine/security.c +++ b/reactos/dll/win32/advapi32/wine/security.c @@ -528,19 +528,56 @@ SetThreadToken(IN PHANDLE ThreadHandle OPTIONAL, return TRUE; } -BOOL WINAPI -CreateRestrictedToken(HANDLE TokenHandle, - DWORD Flags, - DWORD DisableSidCount, - PSID_AND_ATTRIBUTES pSidAndAttributes, - DWORD DeletePrivilegeCount, - PLUID_AND_ATTRIBUTES pLUIDAndAttributes, - DWORD RestrictedSidCount, - PSID_AND_ATTRIBUTES pSIDAndAttributes, - PHANDLE NewTokenHandle) +/************************************************************************* + * CreateRestrictedToken [ADVAPI32.@] + * + * Create a new more restricted token from an existing token. + * + * PARAMS + * baseToken [I] Token to base the new restricted token on + * flags [I] Options + * nDisableSids [I] Length of disableSids array + * disableSids [I] Array of SIDs to disable in the new token + * nDeletePrivs [I] Length of deletePrivs array + * deletePrivs [I] Array of privileges to delete in the new token + * nRestrictSids [I] Length of restrictSids array + * restrictSids [I] Array of SIDs to restrict in the new token + * newToken [O] Address where the new token is stored + * + * RETURNS + * Success: TRUE + * Failure: FALSE + */ +BOOL WINAPI CreateRestrictedToken( + HANDLE baseToken, + DWORD flags, + DWORD nDisableSids, + PSID_AND_ATTRIBUTES disableSids, + DWORD nDeletePrivs, + PLUID_AND_ATTRIBUTES deletePrivs, + DWORD nRestrictSids, + PSID_AND_ATTRIBUTES restrictSids, + PHANDLE newToken) { - UNIMPLEMENTED; - return FALSE; + TOKEN_TYPE type; + SECURITY_IMPERSONATION_LEVEL level = TokenImpersonationLevel; + DWORD size; + + FIXME("(%p, 0x%x, %u, %p, %u, %p, %u, %p, %p): stub\n", + baseToken, flags, nDisableSids, disableSids, + nDeletePrivs, deletePrivs, + nRestrictSids, restrictSids, + newToken); + + size = sizeof(type); + if (!GetTokenInformation( baseToken, TokenType, &type, size, &size )) return FALSE; + if (type == TokenImpersonation) + { + size = sizeof(level); + if (!GetTokenInformation( baseToken, TokenImpersonationLevel, &level, size, &size )) + return FALSE; + } + return DuplicateTokenEx( baseToken, MAXIMUM_ALLOWED, NULL, level, type, newToken ); } /* From c1e082a84a8400322d23d81d2115058cc869cbb5 Mon Sep 17 00:00:00 2001 From: Eric Kohl Date: Sat, 25 Oct 2014 14:28:38 +0000 Subject: [PATCH 21/91] [NET] Display local group properties and members. svn path=/trunk/; revision=64983 --- .../applications/network/net/cmdLocalGroup.c | 93 +++++++++++++++++++ 1 file changed, 93 insertions(+) diff --git a/reactos/base/applications/network/net/cmdLocalGroup.c b/reactos/base/applications/network/net/cmdLocalGroup.c index 43400d1c3b0..1995c2650a1 100644 --- a/reactos/base/applications/network/net/cmdLocalGroup.c +++ b/reactos/base/applications/network/net/cmdLocalGroup.c @@ -72,6 +72,93 @@ EnumerateLocalGroups(VOID) } +static +NET_API_STATUS +DisplayLocalGroup(LPWSTR lpGroupName) +{ + PLOCALGROUP_INFO_1 pGroupInfo = NULL; + PLOCALGROUP_MEMBERS_INFO_3 pMembers = NULL; + PSERVER_INFO_100 pServer = NULL; + LPWSTR *pNames = NULL; + DWORD dwRead = 0; + DWORD dwTotal = 0; + DWORD_PTR ResumeHandle = 0; + DWORD i; + DWORD len; + NET_API_STATUS Status; + + Status = NetLocalGroupGetInfo(NULL, + lpGroupName, + 1, + (LPBYTE*)&pGroupInfo); + if (Status != NERR_Success) + return Status; + + Status = NetLocalGroupGetMembers(NULL, + lpGroupName, + 3, + (LPBYTE*)&pMembers, + MAX_PREFERRED_LENGTH, + &dwRead, + &dwTotal, + &ResumeHandle); + if (Status != NERR_Success) + goto done; + + Status = NetServerGetInfo(NULL, + 100, + (LPBYTE*)&pServer); + if (Status != NERR_Success) + goto done; + + pNames = RtlAllocateHeap(RtlGetProcessHeap(), + HEAP_ZERO_MEMORY, + dwRead * sizeof(LPWSTR)); + if (pNames == NULL) + { + Status = ERROR_OUTOFMEMORY; + goto done; + } + + len = wcslen(pServer->sv100_name); + for (i = 0; i < dwRead; i++) + { + if (!wcsncmp(pMembers[i].lgrmi3_domainandname, pServer->sv100_name, len)) + pNames[i] = &pMembers[i].lgrmi3_domainandname[len + 1]; + else + pNames[i] = pMembers[i].lgrmi3_domainandname; + } + + printf("Alias name %S\n", pGroupInfo->lgrpi1_name); + printf("Comment %S\n", pGroupInfo->lgrpi1_comment); + printf("\n"); + printf("Members\n"); + printf("\n"); + printf("------------------------------------------\n"); + + for (i = 0; i < dwRead; i++) + { + if (pNames[i]) + printf("%S\n", pNames[i]); + } + +done: + if (pNames != NULL) + RtlFreeHeap(RtlGetProcessHeap(), 0, pNames); + + if (pServer != NULL) + NetApiBufferFree(pServer); + + if (pMembers != NULL) + NetApiBufferFree(pMembers); + + if (pGroupInfo != NULL) + NetApiBufferFree(pGroupInfo); + + return Status; +} + + INT cmdLocalGroup( INT argc, @@ -99,6 +186,12 @@ cmdLocalGroup( printf("Status: %lu\n", Status); return 0; } + else if (argc == 3) + { + Status = DisplayLocalGroup(argv[2]); + printf("Status: %lu\n", Status); + return 0; + } i = 2; if (argv[i][0] != L'/') From be62f3c6b35008e9a868db0d3667fce13c850e3e Mon Sep 17 00:00:00 2001 From: Amine Khaldi Date: Sat, 25 Oct 2014 15:28:29 +0000 Subject: [PATCH 22/91] [ADVAPI32] * Update AllocateAndInitializeSid(). CORE-8540 svn path=/trunk/; revision=64984 --- reactos/dll/win32/advapi32/wine/security.c | 60 ++++++++++------------ 1 file changed, 27 insertions(+), 33 deletions(-) diff --git a/reactos/dll/win32/advapi32/wine/security.c b/reactos/dll/win32/advapi32/wine/security.c index 892e5876b9e..d6ce28aa805 100644 --- a/reactos/dll/win32/advapi32/wine/security.c +++ b/reactos/dll/win32/advapi32/wine/security.c @@ -580,42 +580,36 @@ BOOL WINAPI CreateRestrictedToken( return DuplicateTokenEx( baseToken, MAXIMUM_ALLOWED, NULL, level, type, newToken ); } -/* - * @implemented +/****************************************************************************** + * AllocateAndInitializeSid [ADVAPI32.@] + * + * PARAMS + * pIdentifierAuthority [] + * nSubAuthorityCount [] + * nSubAuthority0 [] + * nSubAuthority1 [] + * nSubAuthority2 [] + * nSubAuthority3 [] + * nSubAuthority4 [] + * nSubAuthority5 [] + * nSubAuthority6 [] + * nSubAuthority7 [] + * pSid [] */ BOOL WINAPI -AllocateAndInitializeSid(PSID_IDENTIFIER_AUTHORITY pIdentifierAuthority, - BYTE nSubAuthorityCount, - DWORD dwSubAuthority0, - DWORD dwSubAuthority1, - DWORD dwSubAuthority2, - DWORD dwSubAuthority3, - DWORD dwSubAuthority4, - DWORD dwSubAuthority5, - DWORD dwSubAuthority6, - DWORD dwSubAuthority7, - PSID *pSid) +AllocateAndInitializeSid( PSID_IDENTIFIER_AUTHORITY pIdentifierAuthority, + BYTE nSubAuthorityCount, + DWORD nSubAuthority0, DWORD nSubAuthority1, + DWORD nSubAuthority2, DWORD nSubAuthority3, + DWORD nSubAuthority4, DWORD nSubAuthority5, + DWORD nSubAuthority6, DWORD nSubAuthority7, + PSID *pSid ) { - NTSTATUS Status; - - Status = RtlAllocateAndInitializeSid(pIdentifierAuthority, - nSubAuthorityCount, - dwSubAuthority0, - dwSubAuthority1, - dwSubAuthority2, - dwSubAuthority3, - dwSubAuthority4, - dwSubAuthority5, - dwSubAuthority6, - dwSubAuthority7, - pSid); - if (!NT_SUCCESS(Status)) - { - SetLastError(RtlNtStatusToDosError(Status)); - return FALSE; - } - - return TRUE; + return set_ntstatus( RtlAllocateAndInitializeSid( + pIdentifierAuthority, nSubAuthorityCount, + nSubAuthority0, nSubAuthority1, nSubAuthority2, nSubAuthority3, + nSubAuthority4, nSubAuthority5, nSubAuthority6, nSubAuthority7, + pSid )); } /* From ab0736d95a848a6d9675765c8253df6f69e20844 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herm=C3=A8s=20B=C3=A9lusca-Ma=C3=AFto?= Date: Sat, 25 Oct 2014 15:36:11 +0000 Subject: [PATCH 23/91] [NTVDM]: So..... do not overflow the Cycles count, i.e. better estimate the number of instructions per second :) svn path=/trunk/; revision=64985 --- reactos/subsystems/ntvdm/clock.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/reactos/subsystems/ntvdm/clock.c b/reactos/subsystems/ntvdm/clock.c index c9d9a5cb45a..bd4ff2e55ca 100644 --- a/reactos/subsystems/ntvdm/clock.c +++ b/reactos/subsystems/ntvdm/clock.c @@ -56,7 +56,7 @@ UINT Irq12Counter = 0; #ifdef IPS_DISPLAY DWORD LastCyclePrintout; - DWORD Cycles = 0; + ULONGLONG Cycles = 0; #endif /* PUBLIC FUNCTIONS ***********************************************************/ @@ -142,7 +142,7 @@ VOID ClockUpdate(VOID) { CpuStep(); #ifdef IPS_DISPLAY - Cycles++; + ++Cycles; #endif } From 9e3669b4fbeece34a590e93f55887479c42a2e5c Mon Sep 17 00:00:00 2001 From: Amine Khaldi Date: Sat, 25 Oct 2014 16:08:39 +0000 Subject: [PATCH 24/91] [ADVAPI32] * Update GetKernelObjectSecurity(). CORE-8540 svn path=/trunk/; revision=64987 --- reactos/dll/win32/advapi32/wine/security.c | 34 ++++++++-------------- 1 file changed, 12 insertions(+), 22 deletions(-) diff --git a/reactos/dll/win32/advapi32/wine/security.c b/reactos/dll/win32/advapi32/wine/security.c index d6ce28aa805..ad8a0c0a8b4 100644 --- a/reactos/dll/win32/advapi32/wine/security.c +++ b/reactos/dll/win32/advapi32/wine/security.c @@ -854,31 +854,21 @@ GetLengthSid(PSID pSid) return (DWORD)RtlLengthSid(pSid); } -/* - * @implemented +/****************************************************************************** + * GetKernelObjectSecurity [ADVAPI32.@] */ -BOOL -WINAPI -GetKernelObjectSecurity(HANDLE Handle, - SECURITY_INFORMATION RequestedInformation, - PSECURITY_DESCRIPTOR pSecurityDescriptor, - DWORD nLength, - LPDWORD lpnLengthNeeded) +BOOL WINAPI GetKernelObjectSecurity( + HANDLE Handle, + SECURITY_INFORMATION RequestedInformation, + PSECURITY_DESCRIPTOR pSecurityDescriptor, + DWORD nLength, + LPDWORD lpnLengthNeeded ) { - NTSTATUS Status; + TRACE("(%p,0x%08x,%p,0x%08x,%p)\n", Handle, RequestedInformation, + pSecurityDescriptor, nLength, lpnLengthNeeded); - Status = NtQuerySecurityObject(Handle, - RequestedInformation, - pSecurityDescriptor, - nLength, - lpnLengthNeeded); - if (!NT_SUCCESS(Status)) - { - SetLastError(RtlNtStatusToDosError(Status)); - return FALSE; - } - - return TRUE; + return set_ntstatus( NtQuerySecurityObject(Handle, RequestedInformation, pSecurityDescriptor, + nLength, lpnLengthNeeded )); } /* From a037c16a5bd907b3eb087636d8eb3d64652dc4bc Mon Sep 17 00:00:00 2001 From: Aleksandar Andrejevic Date: Sat, 25 Oct 2014 17:16:37 +0000 Subject: [PATCH 25/91] [FAST486] The opcode handlers don't need a return value, it's not used anywhere. svn path=/trunk/; revision=64988 --- reactos/lib/fast486/common.h | 2 +- reactos/lib/fast486/extraops.c | 465 +++++-------- reactos/lib/fast486/fpu.c | 42 +- reactos/lib/fast486/fpu.h | 2 +- reactos/lib/fast486/opcodes.c | 1114 +++++++++++++------------------- reactos/lib/fast486/opcodes.h | 4 +- reactos/lib/fast486/opgroups.c | 427 ++++++------ 7 files changed, 820 insertions(+), 1236 deletions(-) diff --git a/reactos/lib/fast486/common.h b/reactos/lib/fast486/common.h index 0e0c0c8d426..6b9cb6aa09e 100644 --- a/reactos/lib/fast486/common.h +++ b/reactos/lib/fast486/common.h @@ -44,7 +44,7 @@ if (State->PrefixFlags & FAST486_PREFIX_LOCK)\ {\ Fast486Exception(State, FAST486_EXCEPTION_UD);\ - return FALSE;\ + return;\ } #define TOGGLE_OPSIZE(x)\ diff --git a/reactos/lib/fast486/extraops.c b/reactos/lib/fast486/extraops.c index 38dfc3f0018..9d23cb97394 100644 --- a/reactos/lib/fast486/extraops.c +++ b/reactos/lib/fast486/extraops.c @@ -301,21 +301,19 @@ FAST486_OPCODE_HANDLER(Fast486ExtOpcodeInvalid) { DPRINT1("FAST486 -- Extended opcode 0x%02X is INVALID!\n", Opcode); Fast486Exception(State, FAST486_EXCEPTION_UD); - return FALSE; + return; } FAST486_OPCODE_HANDLER(Fast486ExtOpcodeUnimplemented) { DPRINT1("FAST486 -- Extended opcode 0x%02X is UNIMPLEMENTED\n", Opcode); // Fast486Exception(State, FAST486_EXCEPTION_UD); - return FALSE; } FAST486_OPCODE_HANDLER(Fast486ExtOpcode0F0B) { /* Reserved opcode (UD2) */ Fast486Exception(State, FAST486_EXCEPTION_UD); - return FALSE; } FAST486_OPCODE_HANDLER(Fast486ExtOpcodeLar) @@ -333,7 +331,7 @@ FAST486_OPCODE_HANDLER(Fast486ExtOpcodeLar) { /* Not recognized */ Fast486Exception(State, FAST486_EXCEPTION_UD); - return FALSE; + return; } NO_LOCK_PREFIX(); @@ -344,7 +342,7 @@ FAST486_OPCODE_HANDLER(Fast486ExtOpcodeLar) if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm)) { /* Exception occurred */ - return FALSE; + return; } if (OperandSize) @@ -355,7 +353,7 @@ FAST486_OPCODE_HANDLER(Fast486ExtOpcodeLar) if (!Fast486ReadModrmDwordOperands(State, &ModRegRm, NULL, &Value)) { /* Exception occurred */ - return FALSE; + return; } Selector = LOWORD(Value); @@ -366,7 +364,7 @@ FAST486_OPCODE_HANDLER(Fast486ExtOpcodeLar) if (!Fast486ReadModrmWordOperands(State, &ModRegRm, NULL, &Selector)) { /* Exception occurred */ - return FALSE; + return; } } @@ -376,7 +374,7 @@ FAST486_OPCODE_HANDLER(Fast486ExtOpcodeLar) if (GET_SEGMENT_INDEX(Selector) >= (State->Gdtr.Size + 1)) { State->Flags.Zf = FALSE; - return TRUE; + return; } /* Read the GDT */ @@ -387,7 +385,7 @@ FAST486_OPCODE_HANDLER(Fast486ExtOpcodeLar) sizeof(GdtEntry))) { /* Exception occurred */ - return FALSE; + return; } } else @@ -396,7 +394,7 @@ FAST486_OPCODE_HANDLER(Fast486ExtOpcodeLar) if (GET_SEGMENT_INDEX(Selector) >= (State->Ldtr.Limit + 1)) { State->Flags.Zf = FALSE; - return TRUE; + return; } /* Read the LDT */ @@ -407,7 +405,7 @@ FAST486_OPCODE_HANDLER(Fast486ExtOpcodeLar) sizeof(GdtEntry))) { /* Exception occurred */ - return FALSE; + return; } } @@ -416,7 +414,7 @@ FAST486_OPCODE_HANDLER(Fast486ExtOpcodeLar) || (Fast486GetCurrentPrivLevel(State) > GdtEntry.Dpl)) { State->Flags.Zf = FALSE; - return TRUE; + return; } /* Set ZF */ @@ -426,24 +424,8 @@ FAST486_OPCODE_HANDLER(Fast486ExtOpcodeLar) AccessRights = ((PDWORD)&GdtEntry)[1] & 0x00F0FF00; /* Return the access rights */ - if (OperandSize) - { - if (!Fast486WriteModrmDwordOperands(State, &ModRegRm, TRUE, AccessRights)) - { - /* Exception occurred */ - return FALSE; - } - } - else - { - if (!Fast486WriteModrmWordOperands(State, &ModRegRm, TRUE, LOWORD(AccessRights))) - { - /* Exception occurred */ - return FALSE; - } - } - - return TRUE; + if (OperandSize) Fast486WriteModrmDwordOperands(State, &ModRegRm, TRUE, AccessRights); + else Fast486WriteModrmWordOperands(State, &ModRegRm, TRUE, LOWORD(AccessRights)); } FAST486_OPCODE_HANDLER(Fast486ExtOpcodeLsl) @@ -461,7 +443,7 @@ FAST486_OPCODE_HANDLER(Fast486ExtOpcodeLsl) { /* Not recognized */ Fast486Exception(State, FAST486_EXCEPTION_UD); - return FALSE; + return; } NO_LOCK_PREFIX(); @@ -472,7 +454,7 @@ FAST486_OPCODE_HANDLER(Fast486ExtOpcodeLsl) if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm)) { /* Exception occurred */ - return FALSE; + return; } if (OperandSize) @@ -483,7 +465,7 @@ FAST486_OPCODE_HANDLER(Fast486ExtOpcodeLsl) if (!Fast486ReadModrmDwordOperands(State, &ModRegRm, NULL, &Value)) { /* Exception occurred */ - return FALSE; + return; } Selector = LOWORD(Value); @@ -494,7 +476,7 @@ FAST486_OPCODE_HANDLER(Fast486ExtOpcodeLsl) if (!Fast486ReadModrmWordOperands(State, &ModRegRm, NULL, &Selector)) { /* Exception occurred */ - return FALSE; + return; } } @@ -504,7 +486,7 @@ FAST486_OPCODE_HANDLER(Fast486ExtOpcodeLsl) if (GET_SEGMENT_INDEX(Selector) >= (State->Gdtr.Size + 1)) { State->Flags.Zf = FALSE; - return TRUE; + return; } /* Read the GDT */ @@ -515,7 +497,7 @@ FAST486_OPCODE_HANDLER(Fast486ExtOpcodeLsl) sizeof(GdtEntry))) { /* Exception occurred */ - return FALSE; + return; } } else @@ -524,7 +506,7 @@ FAST486_OPCODE_HANDLER(Fast486ExtOpcodeLsl) if (GET_SEGMENT_INDEX(Selector) >= (State->Ldtr.Limit + 1)) { State->Flags.Zf = FALSE; - return TRUE; + return; } /* Read the LDT */ @@ -535,7 +517,7 @@ FAST486_OPCODE_HANDLER(Fast486ExtOpcodeLsl) sizeof(GdtEntry))) { /* Exception occurred */ - return FALSE; + return; } } @@ -544,7 +526,7 @@ FAST486_OPCODE_HANDLER(Fast486ExtOpcodeLsl) || (Fast486GetCurrentPrivLevel(State) > GdtEntry.Dpl)) { State->Flags.Zf = FALSE; - return TRUE; + return; } /* Calculate the limit */ @@ -554,26 +536,9 @@ FAST486_OPCODE_HANDLER(Fast486ExtOpcodeLsl) /* Set ZF */ State->Flags.Zf = TRUE; - if (OperandSize) - { - /* Return the limit */ - if (!Fast486WriteModrmDwordOperands(State, &ModRegRm, TRUE, Limit)) - { - /* Exception occurred */ - return FALSE; - } - } - else - { - /* Return the limit */ - if (!Fast486WriteModrmWordOperands(State, &ModRegRm, TRUE, LOWORD(Limit))) - { - /* Exception occurred */ - return FALSE; - } - } - - return TRUE; + /* Return the limit */ + if (OperandSize) Fast486WriteModrmDwordOperands(State, &ModRegRm, TRUE, Limit); + else Fast486WriteModrmWordOperands(State, &ModRegRm, TRUE, LOWORD(Limit)); } FAST486_OPCODE_HANDLER(Fast486ExtOpcodeClts) @@ -584,13 +549,11 @@ FAST486_OPCODE_HANDLER(Fast486ExtOpcodeClts) if (Fast486GetCurrentPrivLevel(State) != 0) { Fast486Exception(State, FAST486_EXCEPTION_GP); - return FALSE; + return; } /* Clear the task switch bit */ State->ControlRegisters[FAST486_REG_CR0] &= ~FAST486_CR0_TS; - - return TRUE; } FAST486_OPCODE_HANDLER(Fast486ExtOpcodeStoreControlReg) @@ -605,21 +568,21 @@ FAST486_OPCODE_HANDLER(Fast486ExtOpcodeStoreControlReg) if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm)) { /* Exception occurred */ - return FALSE; + return; } /* The current privilege level must be zero */ if (Fast486GetCurrentPrivLevel(State) != 0) { Fast486Exception(State, FAST486_EXCEPTION_GP); - return FALSE; + return; } if ((ModRegRm.Register == 1) || (ModRegRm.Register > 3)) { /* CR1, CR4, CR5, CR6 and CR7 don't exist */ Fast486Exception(State, FAST486_EXCEPTION_UD); - return FALSE; + return; } if (ModRegRm.Register != 0) @@ -630,9 +593,6 @@ FAST486_OPCODE_HANDLER(Fast486ExtOpcodeStoreControlReg) /* Store the value of the control register */ State->GeneralRegs[ModRegRm.SecondRegister].Long = State->ControlRegisters[ModRegRm.Register]; - - /* Return success */ - return TRUE; } FAST486_OPCODE_HANDLER(Fast486ExtOpcodeStoreDebugReg) @@ -647,14 +607,14 @@ FAST486_OPCODE_HANDLER(Fast486ExtOpcodeStoreDebugReg) if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm)) { /* Exception occurred */ - return FALSE; + return; } /* The current privilege level must be zero */ if (Fast486GetCurrentPrivLevel(State) != 0) { Fast486Exception(State, FAST486_EXCEPTION_GP); - return FALSE; + return; } if ((ModRegRm.Register == 6) || (ModRegRm.Register == 7)) @@ -667,14 +627,11 @@ FAST486_OPCODE_HANDLER(Fast486ExtOpcodeStoreDebugReg) { /* Disallow access to debug registers */ Fast486Exception(State, FAST486_EXCEPTION_GP); - return FALSE; + return; } /* Store the value of the debug register */ State->GeneralRegs[ModRegRm.SecondRegister].Long = State->DebugRegisters[ModRegRm.Register]; - - /* Return success */ - return TRUE; } FAST486_OPCODE_HANDLER(Fast486ExtOpcodeLoadControlReg) @@ -690,21 +647,21 @@ FAST486_OPCODE_HANDLER(Fast486ExtOpcodeLoadControlReg) if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm)) { /* Exception occurred */ - return FALSE; + return; } /* The current privilege level must be zero */ if (Fast486GetCurrentPrivLevel(State) != 0) { Fast486Exception(State, FAST486_EXCEPTION_GP); - return FALSE; + return; } if ((ModRegRm.Register == 1) || (ModRegRm.Register > 3)) { /* CR1, CR4, CR5, CR6 and CR7 don't exist */ Fast486Exception(State, FAST486_EXCEPTION_UD); - return FALSE; + return; } if (ModRegRm.Register != 0) @@ -725,15 +682,12 @@ FAST486_OPCODE_HANDLER(Fast486ExtOpcodeLoadControlReg) { /* Invalid value */ Fast486Exception(State, FAST486_EXCEPTION_GP); - return FALSE; + return; } } /* Load a value to the control register */ State->ControlRegisters[ModRegRm.Register] = Value; - - /* Return success */ - return TRUE; } FAST486_OPCODE_HANDLER(Fast486ExtOpcodeLoadDebugReg) @@ -748,14 +702,14 @@ FAST486_OPCODE_HANDLER(Fast486ExtOpcodeLoadDebugReg) if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm)) { /* Exception occurred */ - return FALSE; + return; } /* The current privilege level must be zero */ if (Fast486GetCurrentPrivLevel(State) != 0) { Fast486Exception(State, FAST486_EXCEPTION_GP); - return FALSE; + return; } if ((ModRegRm.Register == 6) || (ModRegRm.Register == 7)) @@ -768,7 +722,7 @@ FAST486_OPCODE_HANDLER(Fast486ExtOpcodeLoadDebugReg) { /* Disallow access to debug registers */ Fast486Exception(State, FAST486_EXCEPTION_GP); - return FALSE; + return; } /* Load a value to the debug register */ @@ -784,15 +738,12 @@ FAST486_OPCODE_HANDLER(Fast486ExtOpcodeLoadDebugReg) /* The reserved bits are 0 */ State->DebugRegisters[ModRegRm.Register] &= ~FAST486_DR5_RESERVED; } - - /* Return success */ - return TRUE; } FAST486_OPCODE_HANDLER(Fast486ExtOpcodePushFs) { /* Call the internal API */ - return Fast486StackPush(State, State->SegmentRegs[FAST486_REG_FS].Selector); + Fast486StackPush(State, State->SegmentRegs[FAST486_REG_FS].Selector); } FAST486_OPCODE_HANDLER(Fast486ExtOpcodePopFs) @@ -802,11 +753,11 @@ FAST486_OPCODE_HANDLER(Fast486ExtOpcodePopFs) if (!Fast486StackPop(State, &NewSelector)) { /* Exception occurred */ - return FALSE; + return; } /* Call the internal API */ - return Fast486LoadSegment(State, FAST486_REG_FS, LOWORD(NewSelector)); + Fast486LoadSegment(State, FAST486_REG_FS, LOWORD(NewSelector)); } FAST486_OPCODE_HANDLER(Fast486ExtOpcodeBitTest) @@ -828,7 +779,7 @@ FAST486_OPCODE_HANDLER(Fast486ExtOpcodeBitTest) if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm)) { /* Exception occurred */ - return FALSE; + return; } /* Get the bit number */ @@ -855,7 +806,7 @@ FAST486_OPCODE_HANDLER(Fast486ExtOpcodeBitTest) if (!Fast486ReadModrmDwordOperands(State, &ModRegRm, NULL, &Value)) { /* Exception occurred */ - return FALSE; + return; } /* Set CF to the bit value */ @@ -869,15 +820,12 @@ FAST486_OPCODE_HANDLER(Fast486ExtOpcodeBitTest) if (!Fast486ReadModrmWordOperands(State, &ModRegRm, NULL, &Value)) { /* Exception occurred */ - return FALSE; + return; } /* Set CF to the bit value */ State->Flags.Cf = (Value >> BitNumber) & 1; } - - /* Return success */ - return TRUE; } FAST486_OPCODE_HANDLER(Fast486ExtOpcodeShld) @@ -897,7 +845,7 @@ FAST486_OPCODE_HANDLER(Fast486ExtOpcodeShld) if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm)) { /* Exception occurred */ - return FALSE; + return; } if (Opcode == 0xA4) @@ -906,7 +854,7 @@ FAST486_OPCODE_HANDLER(Fast486ExtOpcodeShld) if (!Fast486FetchByte(State, &Count)) { /* Exception occurred */ - return FALSE; + return; } } else @@ -919,7 +867,7 @@ FAST486_OPCODE_HANDLER(Fast486ExtOpcodeShld) Count &= 0x1F; /* Do nothing if the count is zero */ - if (Count == 0) return TRUE; + if (Count == 0) return; if (OperandSize) { @@ -928,7 +876,7 @@ FAST486_OPCODE_HANDLER(Fast486ExtOpcodeShld) if (!Fast486ReadModrmDwordOperands(State, &ModRegRm, &Source, &Destination)) { /* Exception occurred */ - return FALSE; + return; } /* Calculate the result */ @@ -943,7 +891,7 @@ FAST486_OPCODE_HANDLER(Fast486ExtOpcodeShld) State->Flags.Pf = Fast486CalculateParity(Result); /* Write back the result */ - return Fast486WriteModrmDwordOperands(State, &ModRegRm, FALSE, Result); + Fast486WriteModrmDwordOperands(State, &ModRegRm, FALSE, Result); } else { @@ -953,7 +901,7 @@ FAST486_OPCODE_HANDLER(Fast486ExtOpcodeShld) if (!Fast486ReadModrmWordOperands(State, &ModRegRm, &Source, &Destination)) { /* Exception occurred */ - return FALSE; + return; } DoubleSource = Source | (Source << 16); @@ -972,14 +920,14 @@ FAST486_OPCODE_HANDLER(Fast486ExtOpcodeShld) State->Flags.Pf = Fast486CalculateParity(Result); /* Write back the result */ - return Fast486WriteModrmWordOperands(State, &ModRegRm, FALSE, Result); + Fast486WriteModrmWordOperands(State, &ModRegRm, FALSE, Result); } } FAST486_OPCODE_HANDLER(Fast486ExtOpcodePushGs) { /* Call the internal API */ - return Fast486StackPush(State, State->SegmentRegs[FAST486_REG_GS].Selector); + Fast486StackPush(State, State->SegmentRegs[FAST486_REG_GS].Selector); } FAST486_OPCODE_HANDLER(Fast486ExtOpcodePopGs) @@ -989,11 +937,11 @@ FAST486_OPCODE_HANDLER(Fast486ExtOpcodePopGs) if (!Fast486StackPop(State, &NewSelector)) { /* Exception occurred */ - return FALSE; + return; } /* Call the internal API */ - return Fast486LoadSegment(State, FAST486_REG_GS, LOWORD(NewSelector)); + Fast486LoadSegment(State, FAST486_REG_GS, LOWORD(NewSelector)); } FAST486_OPCODE_HANDLER(Fast486ExtOpcodeBts) @@ -1015,7 +963,7 @@ FAST486_OPCODE_HANDLER(Fast486ExtOpcodeBts) if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm)) { /* Exception occurred */ - return FALSE; + return; } /* Get the bit number */ @@ -1042,7 +990,7 @@ FAST486_OPCODE_HANDLER(Fast486ExtOpcodeBts) if (!Fast486ReadModrmDwordOperands(State, &ModRegRm, NULL, &Value)) { /* Exception occurred */ - return FALSE; + return; } /* Set CF to the bit value */ @@ -1052,11 +1000,7 @@ FAST486_OPCODE_HANDLER(Fast486ExtOpcodeBts) Value |= 1 << BitNumber; /* Write back the result */ - if (!Fast486WriteModrmDwordOperands(State, &ModRegRm, FALSE, Value)) - { - /* Exception occurred */ - return FALSE; - } + Fast486WriteModrmDwordOperands(State, &ModRegRm, FALSE, Value); } else { @@ -1066,7 +1010,7 @@ FAST486_OPCODE_HANDLER(Fast486ExtOpcodeBts) if (!Fast486ReadModrmWordOperands(State, &ModRegRm, NULL, &Value)) { /* Exception occurred */ - return FALSE; + return; } /* Set CF to the bit value */ @@ -1076,15 +1020,8 @@ FAST486_OPCODE_HANDLER(Fast486ExtOpcodeBts) Value |= 1 << BitNumber; /* Write back the result */ - if (!Fast486WriteModrmWordOperands(State, &ModRegRm, FALSE, Value)) - { - /* Exception occurred */ - return FALSE; - } + Fast486WriteModrmWordOperands(State, &ModRegRm, FALSE, Value); } - - /* Return success */ - return TRUE; } FAST486_OPCODE_HANDLER(Fast486ExtOpcodeShrd) @@ -1104,7 +1041,7 @@ FAST486_OPCODE_HANDLER(Fast486ExtOpcodeShrd) if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm)) { /* Exception occurred */ - return FALSE; + return; } if (Opcode == 0xAC) @@ -1113,7 +1050,7 @@ FAST486_OPCODE_HANDLER(Fast486ExtOpcodeShrd) if (!Fast486FetchByte(State, &Count)) { /* Exception occurred */ - return FALSE; + return; } } else @@ -1126,7 +1063,7 @@ FAST486_OPCODE_HANDLER(Fast486ExtOpcodeShrd) Count &= 0x1F; /* Do nothing if the count is zero */ - if (Count == 0) return TRUE; + if (Count == 0) return; if (OperandSize) { @@ -1135,7 +1072,7 @@ FAST486_OPCODE_HANDLER(Fast486ExtOpcodeShrd) if (!Fast486ReadModrmDwordOperands(State, &ModRegRm, &Source, &Destination)) { /* Exception occurred */ - return FALSE; + return; } /* Calculate the result */ @@ -1150,7 +1087,7 @@ FAST486_OPCODE_HANDLER(Fast486ExtOpcodeShrd) State->Flags.Pf = Fast486CalculateParity(Result); /* Write back the result */ - return Fast486WriteModrmDwordOperands(State, &ModRegRm, FALSE, Result); + Fast486WriteModrmDwordOperands(State, &ModRegRm, FALSE, Result); } else { @@ -1159,7 +1096,7 @@ FAST486_OPCODE_HANDLER(Fast486ExtOpcodeShrd) if (!Fast486ReadModrmWordOperands(State, &ModRegRm, &Source, &Destination)) { /* Exception occurred */ - return FALSE; + return; } /* Calculate the result */ @@ -1178,7 +1115,7 @@ FAST486_OPCODE_HANDLER(Fast486ExtOpcodeShrd) State->Flags.Pf = Fast486CalculateParity(Result); /* Write back the result */ - return Fast486WriteModrmWordOperands(State, &ModRegRm, FALSE, Result); + Fast486WriteModrmWordOperands(State, &ModRegRm, FALSE, Result); } } @@ -1196,7 +1133,7 @@ FAST486_OPCODE_HANDLER(Fast486ExtOpcodeImul) if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm)) { /* Exception occurred */ - return FALSE; + return; } if (OperandSize) @@ -1211,7 +1148,7 @@ FAST486_OPCODE_HANDLER(Fast486ExtOpcodeImul) (PULONG)&Source)) { /* Exception occurred */ - return FALSE; + return; } /* Calculate the result */ @@ -1221,7 +1158,7 @@ FAST486_OPCODE_HANDLER(Fast486ExtOpcodeImul) State->Flags.Cf = State->Flags.Of = ((Result < -2147483648LL) || (Result > 2147483647LL)); /* Write back the result */ - return Fast486WriteModrmDwordOperands(State, &ModRegRm, TRUE, (ULONG)((LONG)Result)); + Fast486WriteModrmDwordOperands(State, &ModRegRm, TRUE, (ULONG)((LONG)Result)); } else { @@ -1235,7 +1172,7 @@ FAST486_OPCODE_HANDLER(Fast486ExtOpcodeImul) (PUSHORT)&Source)) { /* Exception occurred */ - return FALSE; + return; } /* Calculate the result */ @@ -1245,7 +1182,7 @@ FAST486_OPCODE_HANDLER(Fast486ExtOpcodeImul) State->Flags.Cf = State->Flags.Of = ((Result < -32768) || (Result > 32767)); /* Write back the result */ - return Fast486WriteModrmWordOperands(State, &ModRegRm, TRUE, (USHORT)((SHORT)Result)); + Fast486WriteModrmWordOperands(State, &ModRegRm, TRUE, (USHORT)((SHORT)Result)); } } @@ -1262,14 +1199,14 @@ FAST486_OPCODE_HANDLER(Fast486ExtOpcodeCmpXchgByte) if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm)) { /* Exception occurred */ - return FALSE; + return; } /* Read the operands */ if (!Fast486ReadModrmByteOperands(State, &ModRegRm, &Source, &Destination)) { /* Exception occurred */ - return FALSE; + return; } /* Compare AL with the destination */ @@ -1287,16 +1224,13 @@ FAST486_OPCODE_HANDLER(Fast486ExtOpcodeCmpXchgByte) if (State->Flags.Zf) { /* Load the source operand into the destination */ - return Fast486WriteModrmByteOperands(State, &ModRegRm, FALSE, Source); + Fast486WriteModrmByteOperands(State, &ModRegRm, FALSE, Source); } else { /* Load the destination into AL */ State->GeneralRegs[FAST486_REG_EAX].LowByte = Destination; } - - /* Return success */ - return TRUE; } FAST486_OPCODE_HANDLER(Fast486ExtOpcodeCmpXchg) @@ -1313,7 +1247,7 @@ FAST486_OPCODE_HANDLER(Fast486ExtOpcodeCmpXchg) if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm)) { /* Exception occurred */ - return FALSE; + return; } if (OperandSize) @@ -1325,7 +1259,7 @@ FAST486_OPCODE_HANDLER(Fast486ExtOpcodeCmpXchg) if (!Fast486ReadModrmDwordOperands(State, &ModRegRm, &Source, &Destination)) { /* Exception occurred */ - return FALSE; + return; } /* Compare EAX with the destination */ @@ -1343,7 +1277,7 @@ FAST486_OPCODE_HANDLER(Fast486ExtOpcodeCmpXchg) if (State->Flags.Zf) { /* Load the source operand into the destination */ - return Fast486WriteModrmDwordOperands(State, &ModRegRm, FALSE, Source); + Fast486WriteModrmDwordOperands(State, &ModRegRm, FALSE, Source); } else { @@ -1360,7 +1294,7 @@ FAST486_OPCODE_HANDLER(Fast486ExtOpcodeCmpXchg) if (!Fast486ReadModrmWordOperands(State, &ModRegRm, &Source, &Destination)) { /* Exception occurred */ - return FALSE; + return; } /* Compare AX with the destination */ @@ -1378,7 +1312,7 @@ FAST486_OPCODE_HANDLER(Fast486ExtOpcodeCmpXchg) if (State->Flags.Zf) { /* Load the source operand into the destination */ - return Fast486WriteModrmWordOperands(State, &ModRegRm, FALSE, Source); + Fast486WriteModrmWordOperands(State, &ModRegRm, FALSE, Source); } else { @@ -1386,9 +1320,6 @@ FAST486_OPCODE_HANDLER(Fast486ExtOpcodeCmpXchg) State->GeneralRegs[FAST486_REG_EAX].LowWord = Destination; } } - - /* Return success */ - return TRUE; } FAST486_OPCODE_HANDLER(Fast486ExtOpcodeLss) @@ -1409,14 +1340,14 @@ FAST486_OPCODE_HANDLER(Fast486ExtOpcodeLss) if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm)) { /* Exception occurred */ - return FALSE; + return; } if (!ModRegRm.Memory) { /* Invalid */ Fast486Exception(State, FAST486_EXCEPTION_UD); - return FALSE; + return; } if (!Fast486ReadMemory(State, @@ -1428,7 +1359,7 @@ FAST486_OPCODE_HANDLER(Fast486ExtOpcodeLss) OperandSize ? 6 : 4)) { /* Exception occurred */ - return FALSE; + return; } if (OperandSize) @@ -1440,9 +1371,7 @@ FAST486_OPCODE_HANDLER(Fast486ExtOpcodeLss) State->GeneralRegs[ModRegRm.Register].Long = Offset; /* Load the segment */ - return Fast486LoadSegment(State, - FAST486_REG_SS, - Segment); + Fast486LoadSegment(State, FAST486_REG_SS, Segment); } else { @@ -1453,9 +1382,7 @@ FAST486_OPCODE_HANDLER(Fast486ExtOpcodeLss) State->GeneralRegs[ModRegRm.Register].LowWord = Offset; /* Load the segment */ - return Fast486LoadSegment(State, - FAST486_REG_SS, - Segment); + Fast486LoadSegment(State, FAST486_REG_SS, Segment); } } @@ -1478,7 +1405,7 @@ FAST486_OPCODE_HANDLER(Fast486ExtOpcodeBtr) if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm)) { /* Exception occurred */ - return FALSE; + return; } /* Get the bit number */ @@ -1505,7 +1432,7 @@ FAST486_OPCODE_HANDLER(Fast486ExtOpcodeBtr) if (!Fast486ReadModrmDwordOperands(State, &ModRegRm, NULL, &Value)) { /* Exception occurred */ - return FALSE; + return; } /* Set CF to the bit value */ @@ -1515,11 +1442,7 @@ FAST486_OPCODE_HANDLER(Fast486ExtOpcodeBtr) Value &= ~(1 << BitNumber); /* Write back the result */ - if (!Fast486WriteModrmDwordOperands(State, &ModRegRm, FALSE, Value)) - { - /* Exception occurred */ - return FALSE; - } + Fast486WriteModrmDwordOperands(State, &ModRegRm, FALSE, Value); } else { @@ -1529,7 +1452,7 @@ FAST486_OPCODE_HANDLER(Fast486ExtOpcodeBtr) if (!Fast486ReadModrmWordOperands(State, &ModRegRm, NULL, &Value)) { /* Exception occurred */ - return FALSE; + return; } /* Set CF to the bit value */ @@ -1539,15 +1462,8 @@ FAST486_OPCODE_HANDLER(Fast486ExtOpcodeBtr) Value &= ~(1 << BitNumber); /* Write back the result */ - if (!Fast486WriteModrmWordOperands(State, &ModRegRm, FALSE, Value)) - { - /* Exception occurred */ - return FALSE; - } + Fast486WriteModrmWordOperands(State, &ModRegRm, FALSE, Value); } - - /* Return success */ - return TRUE; } FAST486_OPCODE_HANDLER(Fast486ExtOpcodeLfsLgs) @@ -1568,14 +1484,14 @@ FAST486_OPCODE_HANDLER(Fast486ExtOpcodeLfsLgs) if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm)) { /* Exception occurred */ - return FALSE; + return; } if (!ModRegRm.Memory) { /* Invalid */ Fast486Exception(State, FAST486_EXCEPTION_UD); - return FALSE; + return; } if (!Fast486ReadMemory(State, @@ -1587,7 +1503,7 @@ FAST486_OPCODE_HANDLER(Fast486ExtOpcodeLfsLgs) OperandSize ? 6 : 4)) { /* Exception occurred */ - return FALSE; + return; } if (OperandSize) @@ -1599,10 +1515,10 @@ FAST486_OPCODE_HANDLER(Fast486ExtOpcodeLfsLgs) State->GeneralRegs[ModRegRm.Register].Long = Offset; /* Load the segment */ - return Fast486LoadSegment(State, - (Opcode == 0xB4) - ? FAST486_REG_FS : FAST486_REG_GS, - Segment); + Fast486LoadSegment(State, + (Opcode == 0xB4) + ? FAST486_REG_FS : FAST486_REG_GS, + Segment); } else { @@ -1613,10 +1529,10 @@ FAST486_OPCODE_HANDLER(Fast486ExtOpcodeLfsLgs) State->GeneralRegs[ModRegRm.Register].LowWord = Offset; /* Load the segment */ - return Fast486LoadSegment(State, - (Opcode == 0xB4) - ? FAST486_REG_FS : FAST486_REG_GS, - Segment); + Fast486LoadSegment(State, + (Opcode == 0xB4) + ? FAST486_REG_FS : FAST486_REG_GS, + Segment); } } @@ -1635,21 +1551,21 @@ FAST486_OPCODE_HANDLER(Fast486ExtOpcodeMovzxByte) if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm)) { /* Exception occurred */ - return FALSE; + return; } /* Read the operands */ if (!Fast486ReadModrmByteOperands(State, &ModRegRm, NULL, &Value)) { /* Exception occurred */ - return FALSE; + return; } /* Write back the zero-extended value */ - return Fast486WriteModrmDwordOperands(State, - &ModRegRm, - TRUE, - (ULONG)Value); + Fast486WriteModrmDwordOperands(State, + &ModRegRm, + TRUE, + (ULONG)Value); } FAST486_OPCODE_HANDLER(Fast486ExtOpcodeMovzxWord) @@ -1667,21 +1583,21 @@ FAST486_OPCODE_HANDLER(Fast486ExtOpcodeMovzxWord) if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm)) { /* Exception occurred */ - return FALSE; + return; } /* Read the operands */ if (!Fast486ReadModrmWordOperands(State, &ModRegRm, NULL, &Value)) { /* Exception occurred */ - return FALSE; + return; } /* Write back the zero-extended value */ - return Fast486WriteModrmDwordOperands(State, - &ModRegRm, - TRUE, - (ULONG)Value); + Fast486WriteModrmDwordOperands(State, + &ModRegRm, + TRUE, + (ULONG)Value); } FAST486_OPCODE_HANDLER(Fast486ExtOpcodeBtc) @@ -1703,7 +1619,7 @@ FAST486_OPCODE_HANDLER(Fast486ExtOpcodeBtc) if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm)) { /* Exception occurred */ - return FALSE; + return; } /* Get the bit number */ @@ -1730,7 +1646,7 @@ FAST486_OPCODE_HANDLER(Fast486ExtOpcodeBtc) if (!Fast486ReadModrmDwordOperands(State, &ModRegRm, NULL, &Value)) { /* Exception occurred */ - return FALSE; + return; } /* Set CF to the bit value */ @@ -1740,11 +1656,7 @@ FAST486_OPCODE_HANDLER(Fast486ExtOpcodeBtc) Value ^= 1 << BitNumber; /* Write back the result */ - if (!Fast486WriteModrmDwordOperands(State, &ModRegRm, FALSE, Value)) - { - /* Exception occurred */ - return FALSE; - } + Fast486WriteModrmDwordOperands(State, &ModRegRm, FALSE, Value); } else { @@ -1754,7 +1666,7 @@ FAST486_OPCODE_HANDLER(Fast486ExtOpcodeBtc) if (!Fast486ReadModrmWordOperands(State, &ModRegRm, NULL, &Value)) { /* Exception occurred */ - return FALSE; + return; } /* Set CF to the bit value */ @@ -1764,15 +1676,8 @@ FAST486_OPCODE_HANDLER(Fast486ExtOpcodeBtc) Value ^= 1 << BitNumber; /* Write back the result */ - if (!Fast486WriteModrmWordOperands(State, &ModRegRm, FALSE, Value)) - { - /* Exception occurred */ - return FALSE; - } + Fast486WriteModrmWordOperands(State, &ModRegRm, FALSE, Value); } - - /* Return success */ - return TRUE; } FAST486_OPCODE_HANDLER(Fast486ExtOpcodeBsf) @@ -1799,7 +1704,7 @@ FAST486_OPCODE_HANDLER(Fast486ExtOpcodeBsf) if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm)) { /* Exception occurred */ - return FALSE; + return; } /* Read the value */ @@ -1808,7 +1713,7 @@ FAST486_OPCODE_HANDLER(Fast486ExtOpcodeBsf) if (!Fast486ReadModrmDwordOperands(State, &ModRegRm, NULL, &Value)) { /* Exception occurred */ - return FALSE; + return; } } else @@ -1819,13 +1724,13 @@ FAST486_OPCODE_HANDLER(Fast486ExtOpcodeBsf) (PUSHORT)&Value)) { /* Exception occurred */ - return FALSE; + return; } } /* Set ZF */ State->Flags.Zf = (Value == 0); - if (State->Flags.Zf) return TRUE; + if (State->Flags.Zf) return; for (i = 0; i < DataSize; i++) { @@ -1840,24 +1745,8 @@ FAST486_OPCODE_HANDLER(Fast486ExtOpcodeBsf) } /* Write back the result */ - if (OperandSize) - { - if (!Fast486WriteModrmDwordOperands(State, &ModRegRm, TRUE, BitNumber)) - { - /* Exception occurred */ - return FALSE; - } - } - else - { - if (!Fast486WriteModrmWordOperands(State, &ModRegRm, TRUE, LOWORD(BitNumber))) - { - /* Exception occurred */ - return FALSE; - } - } - - return TRUE; + if (OperandSize) Fast486WriteModrmDwordOperands(State, &ModRegRm, TRUE, BitNumber); + else Fast486WriteModrmWordOperands(State, &ModRegRm, TRUE, LOWORD(BitNumber)); } FAST486_OPCODE_HANDLER(Fast486ExtOpcodeBsr) @@ -1884,7 +1773,7 @@ FAST486_OPCODE_HANDLER(Fast486ExtOpcodeBsr) if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm)) { /* Exception occurred */ - return FALSE; + return; } /* Read the value */ @@ -1893,7 +1782,7 @@ FAST486_OPCODE_HANDLER(Fast486ExtOpcodeBsr) if (!Fast486ReadModrmDwordOperands(State, &ModRegRm, NULL, &Value)) { /* Exception occurred */ - return FALSE; + return; } } else @@ -1904,13 +1793,13 @@ FAST486_OPCODE_HANDLER(Fast486ExtOpcodeBsr) (PUSHORT)&Value)) { /* Exception occurred */ - return FALSE; + return; } } /* Set ZF according to the value */ State->Flags.Zf = (Value == 0); - if (State->Flags.Zf) return TRUE; + if (State->Flags.Zf) return; for (i = DataSize - 1; i >= 0; i--) { @@ -1925,24 +1814,8 @@ FAST486_OPCODE_HANDLER(Fast486ExtOpcodeBsr) } /* Write back the result */ - if (OperandSize) - { - if (!Fast486WriteModrmDwordOperands(State, &ModRegRm, TRUE, BitNumber)) - { - /* Exception occurred */ - return FALSE; - } - } - else - { - if (!Fast486WriteModrmWordOperands(State, &ModRegRm, TRUE, LOWORD(BitNumber))) - { - /* Exception occurred */ - return FALSE; - } - } - - return TRUE; + if (OperandSize) Fast486WriteModrmDwordOperands(State, &ModRegRm, TRUE, BitNumber); + else Fast486WriteModrmWordOperands(State, &ModRegRm, TRUE, LOWORD(BitNumber)); } FAST486_OPCODE_HANDLER(Fast486ExtOpcodeMovsxByte) @@ -1960,21 +1833,21 @@ FAST486_OPCODE_HANDLER(Fast486ExtOpcodeMovsxByte) if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm)) { /* Exception occurred */ - return FALSE; + return; } /* Read the operands */ if (!Fast486ReadModrmByteOperands(State, &ModRegRm, NULL, (PUCHAR)&Value)) { /* Exception occurred */ - return FALSE; + return; } /* Write back the sign-extended value */ - return Fast486WriteModrmDwordOperands(State, - &ModRegRm, - TRUE, - (ULONG)((LONG)Value)); + Fast486WriteModrmDwordOperands(State, + &ModRegRm, + TRUE, + (ULONG)((LONG)Value)); } FAST486_OPCODE_HANDLER(Fast486ExtOpcodeMovsxWord) @@ -1992,21 +1865,21 @@ FAST486_OPCODE_HANDLER(Fast486ExtOpcodeMovsxWord) if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm)) { /* Exception occurred */ - return FALSE; + return; } /* Read the operands */ if (!Fast486ReadModrmWordOperands(State, &ModRegRm, NULL, (PUSHORT)&Value)) { /* Exception occurred */ - return FALSE; + return; } /* Write back the sign-extended value */ - return Fast486WriteModrmDwordOperands(State, - &ModRegRm, - TRUE, - (ULONG)((LONG)Value)); + Fast486WriteModrmDwordOperands(State, + &ModRegRm, + TRUE, + (ULONG)((LONG)Value)); } FAST486_OPCODE_HANDLER(Fast486ExtOpcodeConditionalJmp) @@ -2027,7 +1900,7 @@ FAST486_OPCODE_HANDLER(Fast486ExtOpcodeConditionalJmp) if (!Fast486FetchDword(State, (PULONG)&Offset)) { /* Exception occurred */ - return FALSE; + return; } } else @@ -2037,7 +1910,7 @@ FAST486_OPCODE_HANDLER(Fast486ExtOpcodeConditionalJmp) if (!Fast486FetchWord(State, (PUSHORT)&Value)) { /* Exception occurred */ - return FALSE; + return; } /* Sign-extend */ @@ -2114,9 +1987,6 @@ FAST486_OPCODE_HANDLER(Fast486ExtOpcodeConditionalJmp) /* Move the instruction pointer */ State->InstPtr.Long += Offset; } - - /* Return success */ - return TRUE; } FAST486_OPCODE_HANDLER(Fast486ExtOpcodeConditionalSet) @@ -2131,7 +2001,7 @@ FAST486_OPCODE_HANDLER(Fast486ExtOpcodeConditionalSet) if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm)) { /* Exception occurred */ - return FALSE; + return; } /* Make sure this is the right instruction */ @@ -2203,7 +2073,7 @@ FAST486_OPCODE_HANDLER(Fast486ExtOpcodeConditionalSet) } /* Write back the result */ - return Fast486WriteModrmByteOperands(State, &ModRegRm, FALSE, Value); + Fast486WriteModrmByteOperands(State, &ModRegRm, FALSE, Value); } FAST486_OPCODE_HANDLER(Fast486ExtOpcodeXaddByte) @@ -2221,7 +2091,7 @@ FAST486_OPCODE_HANDLER(Fast486ExtOpcodeXaddByte) if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm)) { /* Exception occurred */ - return FALSE; + return; } if (!Fast486ReadModrmByteOperands(State, @@ -2230,7 +2100,7 @@ FAST486_OPCODE_HANDLER(Fast486ExtOpcodeXaddByte) &Destination)) { /* Exception occurred */ - return FALSE; + return; } /* Calculate the result */ @@ -2249,17 +2119,11 @@ FAST486_OPCODE_HANDLER(Fast486ExtOpcodeXaddByte) if (!Fast486WriteModrmByteOperands(State, &ModRegRm, FALSE, Result)) { /* Exception occurred */ - return FALSE; + return; } /* Write the old value of the destination to the source */ - if (!Fast486WriteModrmByteOperands(State, &ModRegRm, TRUE, Destination)) - { - /* Exception occurred */ - return FALSE; - } - - return TRUE; + Fast486WriteModrmByteOperands(State, &ModRegRm, TRUE, Destination); } FAST486_OPCODE_HANDLER(Fast486ExtOpcodeXadd) @@ -2279,7 +2143,7 @@ FAST486_OPCODE_HANDLER(Fast486ExtOpcodeXadd) if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm)) { /* Exception occurred */ - return FALSE; + return; } /* Check the operand size */ @@ -2293,7 +2157,7 @@ FAST486_OPCODE_HANDLER(Fast486ExtOpcodeXadd) &Destination)) { /* Exception occurred */ - return FALSE; + return; } /* Calculate the result */ @@ -2312,15 +2176,11 @@ FAST486_OPCODE_HANDLER(Fast486ExtOpcodeXadd) if (!Fast486WriteModrmDwordOperands(State, &ModRegRm, TRUE, Destination)) { /* Exception occurred */ - return FALSE; + return; } /* Write the sum to the destination */ - if (!Fast486WriteModrmDwordOperands(State, &ModRegRm, FALSE, Result)) - { - /* Exception occurred */ - return FALSE; - } + Fast486WriteModrmDwordOperands(State, &ModRegRm, FALSE, Result); } else { @@ -2332,7 +2192,7 @@ FAST486_OPCODE_HANDLER(Fast486ExtOpcodeXadd) &Destination)) { /* Exception occurred */ - return FALSE; + return; } /* Calculate the result */ @@ -2351,18 +2211,12 @@ FAST486_OPCODE_HANDLER(Fast486ExtOpcodeXadd) if (!Fast486WriteModrmWordOperands(State, &ModRegRm, TRUE, Destination)) { /* Exception occurred */ - return FALSE; + return; } /* Write the sum to the destination */ - if (!Fast486WriteModrmWordOperands(State, &ModRegRm, FALSE, Result)) - { - /* Exception occurred */ - return FALSE; - } + Fast486WriteModrmWordOperands(State, &ModRegRm, FALSE, Result); } - - return TRUE; } FAST486_OPCODE_HANDLER(Fast486ExtOpcodeBswap) @@ -2377,9 +2231,6 @@ FAST486_OPCODE_HANDLER(Fast486ExtOpcodeBswap) /* Swap the byte order */ SWAP(Pointer[0], Pointer[3]); SWAP(Pointer[1], Pointer[2]); - - /* Return success */ - return TRUE; } FAST486_OPCODE_HANDLER(Fast486OpcodeExtended) @@ -2390,11 +2241,11 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeExtended) if (!Fast486FetchByte(State, &SecondOpcode)) { /* Exception occurred */ - return FALSE; + return; } /* Call the extended opcode handler */ - return Fast486ExtendedHandlers[SecondOpcode](State, SecondOpcode); + Fast486ExtendedHandlers[SecondOpcode](State, SecondOpcode); } /* EOF */ diff --git a/reactos/lib/fast486/fpu.c b/reactos/lib/fast486/fpu.c index 6a16fdfc838..a0399e57ebf 100644 --- a/reactos/lib/fast486/fpu.c +++ b/reactos/lib/fast486/fpu.c @@ -316,7 +316,7 @@ FAST486_OPCODE_HANDLER(Fast486FpuOpcodeD8DC) if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm)) { /* Exception occurred */ - return FALSE; + return; } FPU_CHECK(); @@ -340,7 +340,7 @@ FAST486_OPCODE_HANDLER(Fast486FpuOpcodeD8DC) sizeof(ULONGLONG))) { /* Exception occurred */ - return FALSE; + return; } Fast486FpuGetDoubleReal(State, Value, &MemoryData); @@ -352,7 +352,7 @@ FAST486_OPCODE_HANDLER(Fast486FpuOpcodeD8DC) if (!Fast486ReadModrmDwordOperands(State, &ModRegRm, NULL, &Value)) { /* Exception occurred */ - return FALSE; + return; } Fast486FpuGetSingleReal(State, Value, &MemoryData); @@ -369,7 +369,7 @@ FAST486_OPCODE_HANDLER(Fast486FpuOpcodeD8DC) { /* Invalid operation */ State->FpuStatus.Ie = TRUE; - return FALSE; + return; } } @@ -380,7 +380,7 @@ FAST486_OPCODE_HANDLER(Fast486FpuOpcodeD8DC) { /* Invalid operation */ State->FpuStatus.Ie = TRUE; - return FALSE; + return; } /* Check the operation */ @@ -441,8 +441,6 @@ FAST486_OPCODE_HANDLER(Fast486FpuOpcodeD8DC) } #endif - - return TRUE; } FAST486_OPCODE_HANDLER(Fast486FpuOpcodeD9) @@ -454,7 +452,7 @@ FAST486_OPCODE_HANDLER(Fast486FpuOpcodeD9) if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm)) { /* Exception occurred */ - return FALSE; + return; } FPU_CHECK(); @@ -462,11 +460,8 @@ FAST486_OPCODE_HANDLER(Fast486FpuOpcodeD9) #ifndef FAST486_NO_FPU // TODO: NOT IMPLEMENTED UNIMPLEMENTED; - - return FALSE; #else /* Do nothing */ - return TRUE; #endif } @@ -479,7 +474,7 @@ FAST486_OPCODE_HANDLER(Fast486FpuOpcodeDA) if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm)) { /* Exception occurred */ - return FALSE; + return; } FPU_CHECK(); @@ -487,11 +482,8 @@ FAST486_OPCODE_HANDLER(Fast486FpuOpcodeDA) #ifndef FAST486_NO_FPU // TODO: NOT IMPLEMENTED UNIMPLEMENTED; - - return FALSE; #else /* Do nothing */ - return TRUE; #endif } @@ -504,7 +496,7 @@ FAST486_OPCODE_HANDLER(Fast486FpuOpcodeDB) if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm)) { /* Exception occurred */ - return FALSE; + return; } FPU_CHECK(); @@ -562,14 +554,11 @@ FAST486_OPCODE_HANDLER(Fast486FpuOpcodeDB) default: { Fast486Exception(State, FAST486_EXCEPTION_UD); - return FALSE; } } } #endif - - return TRUE; } FAST486_OPCODE_HANDLER(Fast486FpuOpcodeDD) @@ -581,7 +570,7 @@ FAST486_OPCODE_HANDLER(Fast486FpuOpcodeDD) if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm)) { /* Exception occurred */ - return FALSE; + return; } FPU_CHECK(); @@ -589,11 +578,8 @@ FAST486_OPCODE_HANDLER(Fast486FpuOpcodeDD) #ifndef FAST486_NO_FPU // TODO: NOT IMPLEMENTED UNIMPLEMENTED; - - return FALSE; #else /* Do nothing */ - return TRUE; #endif } @@ -606,7 +592,7 @@ FAST486_OPCODE_HANDLER(Fast486FpuOpcodeDE) if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm)) { /* Exception occurred */ - return FALSE; + return; } FPU_CHECK(); @@ -614,11 +600,8 @@ FAST486_OPCODE_HANDLER(Fast486FpuOpcodeDE) #ifndef FAST486_NO_FPU // TODO: NOT IMPLEMENTED UNIMPLEMENTED; - - return FALSE; #else /* Do nothing */ - return TRUE; #endif } @@ -631,7 +614,7 @@ FAST486_OPCODE_HANDLER(Fast486FpuOpcodeDF) if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm)) { /* Exception occurred */ - return FALSE; + return; } FPU_CHECK(); @@ -639,11 +622,8 @@ FAST486_OPCODE_HANDLER(Fast486FpuOpcodeDF) #ifndef FAST486_NO_FPU // TODO: NOT IMPLEMENTED UNIMPLEMENTED; - - return FALSE; #else /* Do nothing */ - return TRUE; #endif } diff --git a/reactos/lib/fast486/fpu.h b/reactos/lib/fast486/fpu.h index 00c292199bb..b23c795d32b 100644 --- a/reactos/lib/fast486/fpu.h +++ b/reactos/lib/fast486/fpu.h @@ -31,7 +31,7 @@ #define FPU_CHECK() if (State->ControlRegisters[FAST486_REG_CR0] & FAST486_CR0_EM) \ { \ Fast486Exception(State, FAST486_EXCEPTION_NM); \ - return FALSE; \ + return; \ } #define FPU_ST(i) State->FpuRegisters[(State->FpuStatus.Top + (i)) % FAST486_NUM_FPU_REGS] #define FPU_GET_TAG(i) ((State->FpuTag >> ((i) * 2)) & 3) diff --git a/reactos/lib/fast486/opcodes.c b/reactos/lib/fast486/opcodes.c index 06b3f9eea54..f31ce73d7f6 100644 --- a/reactos/lib/fast486/opcodes.c +++ b/reactos/lib/fast486/opcodes.c @@ -307,7 +307,6 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeInvalid) */ DPRINT1("FAST486 -- Calling ICEBP opcode\n"); Fast486Exception(State, FAST486_EXCEPTION_UD); - return FALSE; } FAST486_OPCODE_HANDLER(Fast486OpcodePrefix) @@ -465,10 +464,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodePrefix) /* Throw an exception */ Fast486Exception(State, FAST486_EXCEPTION_UD); - return FALSE; } - - return TRUE; } FAST486_OPCODE_HANDLER(Fast486OpcodeIncrement) @@ -500,9 +496,6 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeIncrement) State->Flags.Zf = (Value == 0); State->Flags.Af = ((Value & 0x0F) == 0); State->Flags.Pf = Fast486CalculateParity(LOBYTE(Value)); - - /* Return success */ - return TRUE; } FAST486_OPCODE_HANDLER(Fast486OpcodeDecrement) @@ -534,9 +527,6 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeDecrement) State->Flags.Zf = (Value == 0); State->Flags.Af = ((Value & 0x0F) == 0x0F); State->Flags.Pf = Fast486CalculateParity(LOBYTE(Value)); - - /* Return success */ - return TRUE; } FAST486_OPCODE_HANDLER(Fast486OpcodePushReg) @@ -547,7 +537,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodePushReg) ASSERT((Opcode & 0xF8) == 0x50); /* Call the internal function */ - return Fast486StackPush(State, State->GeneralRegs[Opcode & 0x07].Long); + Fast486StackPush(State, State->GeneralRegs[Opcode & 0x07].Long); } FAST486_OPCODE_HANDLER(Fast486OpcodePopReg) @@ -562,19 +552,15 @@ FAST486_OPCODE_HANDLER(Fast486OpcodePopReg) ASSERT((Opcode & 0xF8) == 0x58); /* Call the internal function */ - if (!Fast486StackPop(State, &Value)) return FALSE; + if (!Fast486StackPop(State, &Value)) return; /* Store the value */ if (Size) State->GeneralRegs[Opcode & 0x07].Long = Value; else State->GeneralRegs[Opcode & 0x07].LowWord = Value; - - /* Return success */ - return TRUE; } FAST486_OPCODE_HANDLER(Fast486OpcodeNop) { - return TRUE; } FAST486_OPCODE_HANDLER(Fast486OpcodeExchangeEax) @@ -605,8 +591,6 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeExchangeEax) State->GeneralRegs[Reg].LowWord = State->GeneralRegs[FAST486_REG_EAX].LowWord; State->GeneralRegs[FAST486_REG_EAX].LowWord = Value; } - - return TRUE; } FAST486_OPCODE_HANDLER(Fast486OpcodeShortConditionalJmp) @@ -624,7 +608,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeShortConditionalJmp) if (!Fast486FetchByte(State, (PUCHAR)&Offset)) { /* An exception occurred */ - return FALSE; + return; } switch ((Opcode & 0x0F) >> 1) @@ -703,9 +687,6 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeShortConditionalJmp) State->InstPtr.Long &= 0xFFFF; } } - - /* Return success */ - return TRUE; } FAST486_OPCODE_HANDLER(Fast486OpcodeClearCarry) @@ -717,12 +698,11 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeClearCarry) if (State->PrefixFlags) { Fast486Exception(State, FAST486_EXCEPTION_UD); - return FALSE; + return; } /* Clear CF and return success */ State->Flags.Cf = FALSE; - return TRUE; } FAST486_OPCODE_HANDLER(Fast486OpcodeSetCarry) @@ -734,12 +714,11 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeSetCarry) if (State->PrefixFlags) { Fast486Exception(State, FAST486_EXCEPTION_UD); - return FALSE; + return; } /* Set CF and return success*/ State->Flags.Cf = TRUE; - return TRUE; } FAST486_OPCODE_HANDLER(Fast486OpcodeComplCarry) @@ -751,12 +730,12 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeComplCarry) if (State->PrefixFlags) { Fast486Exception(State, FAST486_EXCEPTION_UD); - return FALSE; + return; } /* Toggle CF and return success */ State->Flags.Cf = !State->Flags.Cf; - return TRUE; + return; } FAST486_OPCODE_HANDLER(Fast486OpcodeClearInt) @@ -768,7 +747,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeClearInt) if (State->PrefixFlags) { Fast486Exception(State, FAST486_EXCEPTION_UD); - return FALSE; + return; } /* Check for protected mode */ @@ -784,7 +763,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeClearInt) { /* General Protection Fault */ Fast486Exception(State, FAST486_EXCEPTION_GP); - return FALSE; + return; } } else @@ -792,9 +771,6 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeClearInt) /* Just clear the interrupt flag */ State->Flags.If = FALSE; } - - /* Return success */ - return TRUE; } FAST486_OPCODE_HANDLER(Fast486OpcodeSetInt) @@ -806,7 +782,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeSetInt) if (State->PrefixFlags) { Fast486Exception(State, FAST486_EXCEPTION_UD); - return FALSE; + return; } /* Check for protected mode */ @@ -822,7 +798,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeSetInt) { /* General Protection Fault */ Fast486Exception(State, FAST486_EXCEPTION_GP); - return FALSE; + return; } } else @@ -830,9 +806,6 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeSetInt) /* Just set the interrupt flag */ State->Flags.If = TRUE; } - - /* Return success */ - return TRUE; } FAST486_OPCODE_HANDLER(Fast486OpcodeClearDir) @@ -844,12 +817,11 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeClearDir) if (State->PrefixFlags) { Fast486Exception(State, FAST486_EXCEPTION_UD); - return FALSE; + return; } - /* Clear DF and return success */ + /* Clear DF */ State->Flags.Df = FALSE; - return TRUE; } FAST486_OPCODE_HANDLER(Fast486OpcodeSetDir) @@ -861,12 +833,11 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeSetDir) if (State->PrefixFlags) { Fast486Exception(State, FAST486_EXCEPTION_UD); - return FALSE; + return; } - /* Set DF and return success*/ + /* Set DF */ State->Flags.Df = TRUE; - return TRUE; } FAST486_OPCODE_HANDLER(Fast486OpcodeHalt) @@ -878,21 +849,18 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeHalt) if (State->PrefixFlags) { Fast486Exception(State, FAST486_EXCEPTION_UD); - return FALSE; + return; } /* Privileged instructions can only be executed under CPL = 0 */ if (State->SegmentRegs[FAST486_REG_CS].Dpl != 0) { Fast486Exception(State, FAST486_EXCEPTION_GP); - return FALSE; + return; } /* Halt */ State->Halted = TRUE; - - /* Return success */ - return TRUE; } FAST486_OPCODE_HANDLER(Fast486OpcodeInByte) @@ -909,7 +877,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeInByte) if (!Fast486FetchByte(State, &Data)) { /* Exception occurred */ - return FALSE; + return; } /* Set the port number to the parameter */ @@ -926,8 +894,6 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeInByte) /* Store the result in AL */ State->GeneralRegs[FAST486_REG_EAX].LowByte = Data; - - return TRUE; } FAST486_OPCODE_HANDLER(Fast486OpcodeIn) @@ -949,7 +915,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeIn) if (!Fast486FetchByte(State, &Data)) { /* Exception occurred */ - return FALSE; + return; } /* Set the port number to the parameter */ @@ -981,8 +947,6 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeIn) /* Store the value in AX */ State->GeneralRegs[FAST486_REG_EAX].LowWord = Data; } - - return TRUE; } FAST486_OPCODE_HANDLER(Fast486OpcodeOutByte) @@ -999,7 +963,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeOutByte) if (!Fast486FetchByte(State, &Data)) { /* Exception occurred */ - return FALSE; + return; } /* Set the port number to the parameter */ @@ -1016,8 +980,6 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeOutByte) /* Write the byte to the I/O port */ State->IoWriteCallback(State, Port, &Data, 1, sizeof(UCHAR)); - - return TRUE; } FAST486_OPCODE_HANDLER(Fast486OpcodeOut) @@ -1039,7 +1001,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeOut) if (!Fast486FetchByte(State, &Data)) { /* Exception occurred */ - return FALSE; + return; } /* Set the port number to the parameter */ @@ -1067,8 +1029,6 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeOut) /* Write a word to the I/O port */ State->IoWriteCallback(State, Port, &Data, 1, sizeof(USHORT)); } - - return TRUE; } FAST486_OPCODE_HANDLER(Fast486OpcodeShortJump) @@ -1085,7 +1045,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeShortJump) if (!Fast486FetchByte(State, (PUCHAR)&Offset)) { /* An exception occurred */ - return FALSE; + return; } /* Move the instruction pointer */ @@ -1096,8 +1056,6 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeShortJump) /* Clear the top half of EIP */ State->InstPtr.Long &= 0xFFFF; } - - return TRUE; } FAST486_OPCODE_HANDLER(Fast486OpcodeMovRegImm) @@ -1118,7 +1076,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeMovRegImm) if (!Fast486FetchDword(State, &Value)) { /* Exception occurred */ - return FALSE; + return; } /* Store the value in the register */ @@ -1132,14 +1090,12 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeMovRegImm) if (!Fast486FetchWord(State, &Value)) { /* Exception occurred */ - return FALSE; + return; } /* Store the value in the register */ State->GeneralRegs[Opcode & 0x07].LowWord = Value; } - - return TRUE; } FAST486_OPCODE_HANDLER(Fast486OpcodeMovByteRegImm) @@ -1153,14 +1109,14 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeMovByteRegImm) { /* Invalid prefix */ Fast486Exception(State, FAST486_EXCEPTION_UD); - return FALSE; + return; } /* Fetch the byte */ if (!Fast486FetchByte(State, &Value)) { /* Exception occurred */ - return FALSE; + return; } if (Opcode & 0x04) @@ -1173,8 +1129,6 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeMovByteRegImm) /* AL, CL, DL or BL */ State->GeneralRegs[Opcode & 0x03].LowByte = Value; } - - return TRUE; } FAST486_OPCODE_HANDLER(Fast486OpcodeAddByteModrm) @@ -1192,7 +1146,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeAddByteModrm) if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm)) { /* Exception occurred */ - return FALSE; + return; } if (!Fast486ReadModrmByteOperands(State, @@ -1201,7 +1155,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeAddByteModrm) &SecondValue)) { /* Exception occurred */ - return FALSE; + return; } /* Calculate the result */ @@ -1217,10 +1171,10 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeAddByteModrm) State->Flags.Pf = Fast486CalculateParity(Result); /* Write back the result */ - return Fast486WriteModrmByteOperands(State, - &ModRegRm, - Opcode & FAST486_OPCODE_WRITE_REG, - Result); + Fast486WriteModrmByteOperands(State, + &ModRegRm, + Opcode & FAST486_OPCODE_WRITE_REG, + Result); } FAST486_OPCODE_HANDLER(Fast486OpcodeAddModrm) @@ -1240,7 +1194,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeAddModrm) if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm)) { /* Exception occurred */ - return FALSE; + return; } /* Check the operand size */ @@ -1254,7 +1208,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeAddModrm) &SecondValue)) { /* Exception occurred */ - return FALSE; + return; } /* Calculate the result */ @@ -1270,10 +1224,10 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeAddModrm) State->Flags.Pf = Fast486CalculateParity(Result); /* Write back the result */ - return Fast486WriteModrmDwordOperands(State, - &ModRegRm, - Opcode & FAST486_OPCODE_WRITE_REG, - Result); + Fast486WriteModrmDwordOperands(State, + &ModRegRm, + Opcode & FAST486_OPCODE_WRITE_REG, + Result); } else { @@ -1285,7 +1239,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeAddModrm) &SecondValue)) { /* Exception occurred */ - return FALSE; + return; } /* Calculate the result */ @@ -1301,10 +1255,10 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeAddModrm) State->Flags.Pf = Fast486CalculateParity(Result); /* Write back the result */ - return Fast486WriteModrmWordOperands(State, - &ModRegRm, - Opcode & FAST486_OPCODE_WRITE_REG, - Result); + Fast486WriteModrmWordOperands(State, + &ModRegRm, + Opcode & FAST486_OPCODE_WRITE_REG, + Result); } } @@ -1320,13 +1274,13 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeAddAl) { /* This opcode doesn't take any prefixes */ Fast486Exception(State, FAST486_EXCEPTION_UD); - return FALSE; + return; } if (!Fast486FetchByte(State, &SecondValue)) { /* Exception occurred */ - return FALSE; + return; } /* Calculate the result */ @@ -1343,8 +1297,6 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeAddAl) /* Write back the result */ State->GeneralRegs[FAST486_REG_EAX].LowByte = Result; - - return TRUE; } FAST486_OPCODE_HANDLER(Fast486OpcodeAddEax) @@ -1365,7 +1317,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeAddEax) if (!Fast486FetchDword(State, &SecondValue)) { /* Exception occurred */ - return FALSE; + return; } /* Calculate the result */ @@ -1391,7 +1343,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeAddEax) if (!Fast486FetchWord(State, &SecondValue)) { /* Exception occurred */ - return FALSE; + return; } /* Calculate the result */ @@ -1409,8 +1361,6 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeAddEax) /* Write back the result */ State->GeneralRegs[FAST486_REG_EAX].LowWord = Result; } - - return TRUE; } FAST486_OPCODE_HANDLER(Fast486OpcodeOrByteModrm) @@ -1428,7 +1378,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeOrByteModrm) if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm)) { /* Exception occurred */ - return FALSE; + return; } if (!Fast486ReadModrmByteOperands(State, @@ -1437,7 +1387,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeOrByteModrm) &SecondValue)) { /* Exception occurred */ - return FALSE; + return; } /* Calculate the result */ @@ -1451,10 +1401,10 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeOrByteModrm) State->Flags.Pf = Fast486CalculateParity(Result); /* Write back the result */ - return Fast486WriteModrmByteOperands(State, - &ModRegRm, - Opcode & FAST486_OPCODE_WRITE_REG, - Result); + Fast486WriteModrmByteOperands(State, + &ModRegRm, + Opcode & FAST486_OPCODE_WRITE_REG, + Result); } FAST486_OPCODE_HANDLER(Fast486OpcodeOrModrm) @@ -1474,7 +1424,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeOrModrm) if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm)) { /* Exception occurred */ - return FALSE; + return; } /* Check the operand size */ @@ -1488,7 +1438,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeOrModrm) &SecondValue)) { /* Exception occurred */ - return FALSE; + return; } /* Calculate the result */ @@ -1502,10 +1452,10 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeOrModrm) State->Flags.Pf = Fast486CalculateParity(Result); /* Write back the result */ - return Fast486WriteModrmDwordOperands(State, - &ModRegRm, - Opcode & FAST486_OPCODE_WRITE_REG, - Result); + Fast486WriteModrmDwordOperands(State, + &ModRegRm, + Opcode & FAST486_OPCODE_WRITE_REG, + Result); } else { @@ -1517,7 +1467,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeOrModrm) &SecondValue)) { /* Exception occurred */ - return FALSE; + return; } /* Calculate the result */ @@ -1531,10 +1481,10 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeOrModrm) State->Flags.Pf = Fast486CalculateParity(Result); /* Write back the result */ - return Fast486WriteModrmWordOperands(State, - &ModRegRm, - Opcode & FAST486_OPCODE_WRITE_REG, - Result); + Fast486WriteModrmWordOperands(State, + &ModRegRm, + Opcode & FAST486_OPCODE_WRITE_REG, + Result); } } @@ -1550,13 +1500,13 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeOrAl) { /* This opcode doesn't take any prefixes */ Fast486Exception(State, FAST486_EXCEPTION_UD); - return FALSE; + return; } if (!Fast486FetchByte(State, &SecondValue)) { /* Exception occurred */ - return FALSE; + return; } /* Calculate the result */ @@ -1571,8 +1521,6 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeOrAl) /* Write back the result */ State->GeneralRegs[FAST486_REG_EAX].LowByte = Result; - - return TRUE; } FAST486_OPCODE_HANDLER(Fast486OpcodeOrEax) @@ -1593,7 +1541,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeOrEax) if (!Fast486FetchDword(State, &SecondValue)) { /* Exception occurred */ - return FALSE; + return; } /* Calculate the result */ @@ -1617,7 +1565,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeOrEax) if (!Fast486FetchWord(State, &SecondValue)) { /* Exception occurred */ - return FALSE; + return; } /* Calculate the result */ @@ -1633,8 +1581,6 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeOrEax) /* Write back the result */ State->GeneralRegs[FAST486_REG_EAX].LowWord = Result; } - - return TRUE; } FAST486_OPCODE_HANDLER(Fast486OpcodeAndByteModrm) @@ -1652,7 +1598,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeAndByteModrm) if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm)) { /* Exception occurred */ - return FALSE; + return; } if (!Fast486ReadModrmByteOperands(State, @@ -1661,7 +1607,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeAndByteModrm) &SecondValue)) { /* Exception occurred */ - return FALSE; + return; } /* Calculate the result */ @@ -1675,10 +1621,10 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeAndByteModrm) State->Flags.Pf = Fast486CalculateParity(Result); /* Write back the result */ - return Fast486WriteModrmByteOperands(State, - &ModRegRm, - Opcode & FAST486_OPCODE_WRITE_REG, - Result); + Fast486WriteModrmByteOperands(State, + &ModRegRm, + Opcode & FAST486_OPCODE_WRITE_REG, + Result); } FAST486_OPCODE_HANDLER(Fast486OpcodeAndModrm) @@ -1698,7 +1644,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeAndModrm) if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm)) { /* Exception occurred */ - return FALSE; + return; } /* Check the operand size */ @@ -1712,7 +1658,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeAndModrm) &SecondValue)) { /* Exception occurred */ - return FALSE; + return; } /* Calculate the result */ @@ -1726,10 +1672,10 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeAndModrm) State->Flags.Pf = Fast486CalculateParity(Result); /* Write back the result */ - return Fast486WriteModrmDwordOperands(State, - &ModRegRm, - Opcode & FAST486_OPCODE_WRITE_REG, - Result); + Fast486WriteModrmDwordOperands(State, + &ModRegRm, + Opcode & FAST486_OPCODE_WRITE_REG, + Result); } else { @@ -1741,7 +1687,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeAndModrm) &SecondValue)) { /* Exception occurred */ - return FALSE; + return; } /* Calculate the result */ @@ -1755,10 +1701,10 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeAndModrm) State->Flags.Pf = Fast486CalculateParity(Result); /* Write back the result */ - return Fast486WriteModrmWordOperands(State, - &ModRegRm, - Opcode & FAST486_OPCODE_WRITE_REG, - Result); + Fast486WriteModrmWordOperands(State, + &ModRegRm, + Opcode & FAST486_OPCODE_WRITE_REG, + Result); } } @@ -1775,7 +1721,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeAndAl) if (!Fast486FetchByte(State, &SecondValue)) { /* Exception occurred */ - return FALSE; + return; } /* Calculate the result */ @@ -1790,8 +1736,6 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeAndAl) /* Write back the result */ State->GeneralRegs[FAST486_REG_EAX].LowByte = Result; - - return TRUE; } FAST486_OPCODE_HANDLER(Fast486OpcodeAndEax) @@ -1812,7 +1756,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeAndEax) if (!Fast486FetchDword(State, &SecondValue)) { /* Exception occurred */ - return FALSE; + return; } /* Calculate the result */ @@ -1836,7 +1780,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeAndEax) if (!Fast486FetchWord(State, &SecondValue)) { /* Exception occurred */ - return FALSE; + return; } /* Calculate the result */ @@ -1852,8 +1796,6 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeAndEax) /* Write back the result */ State->GeneralRegs[FAST486_REG_EAX].LowWord = Result; } - - return TRUE; } FAST486_OPCODE_HANDLER(Fast486OpcodeXorByteModrm) @@ -1871,7 +1813,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeXorByteModrm) if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm)) { /* Exception occurred */ - return FALSE; + return; } if (!Fast486ReadModrmByteOperands(State, @@ -1880,7 +1822,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeXorByteModrm) &SecondValue)) { /* Exception occurred */ - return FALSE; + return; } /* Calculate the result */ @@ -1894,10 +1836,10 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeXorByteModrm) State->Flags.Pf = Fast486CalculateParity(Result); /* Write back the result */ - return Fast486WriteModrmByteOperands(State, - &ModRegRm, - Opcode & FAST486_OPCODE_WRITE_REG, - Result); + Fast486WriteModrmByteOperands(State, + &ModRegRm, + Opcode & FAST486_OPCODE_WRITE_REG, + Result); } FAST486_OPCODE_HANDLER(Fast486OpcodeXorModrm) @@ -1917,7 +1859,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeXorModrm) if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm)) { /* Exception occurred */ - return FALSE; + return; } /* Check the operand size */ @@ -1931,7 +1873,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeXorModrm) &SecondValue)) { /* Exception occurred */ - return FALSE; + return; } /* Calculate the result */ @@ -1945,10 +1887,10 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeXorModrm) State->Flags.Pf = Fast486CalculateParity(Result); /* Write back the result */ - return Fast486WriteModrmDwordOperands(State, - &ModRegRm, - Opcode & FAST486_OPCODE_WRITE_REG, - Result); + Fast486WriteModrmDwordOperands(State, + &ModRegRm, + Opcode & FAST486_OPCODE_WRITE_REG, + Result); } else { @@ -1960,7 +1902,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeXorModrm) &SecondValue)) { /* Exception occurred */ - return FALSE; + return; } /* Calculate the result */ @@ -1974,10 +1916,10 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeXorModrm) State->Flags.Pf = Fast486CalculateParity(Result); /* Write back the result */ - return Fast486WriteModrmWordOperands(State, - &ModRegRm, - Opcode & FAST486_OPCODE_WRITE_REG, - Result); + Fast486WriteModrmWordOperands(State, + &ModRegRm, + Opcode & FAST486_OPCODE_WRITE_REG, + Result); } } @@ -1993,13 +1935,13 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeXorAl) { /* This opcode doesn't take any prefixes */ Fast486Exception(State, FAST486_EXCEPTION_UD); - return FALSE; + return; } if (!Fast486FetchByte(State, &SecondValue)) { /* Exception occurred */ - return FALSE; + return; } /* Calculate the result */ @@ -2014,8 +1956,6 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeXorAl) /* Write back the result */ State->GeneralRegs[FAST486_REG_EAX].LowByte = Result; - - return TRUE; } FAST486_OPCODE_HANDLER(Fast486OpcodeXorEax) @@ -2036,7 +1976,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeXorEax) if (!Fast486FetchDword(State, &SecondValue)) { /* Exception occurred */ - return FALSE; + return; } /* Calculate the result */ @@ -2060,7 +2000,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeXorEax) if (!Fast486FetchWord(State, &SecondValue)) { /* Exception occurred */ - return FALSE; + return; } /* Calculate the result */ @@ -2076,8 +2016,6 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeXorEax) /* Write back the result */ State->GeneralRegs[FAST486_REG_EAX].LowWord = Result; } - - return TRUE; } FAST486_OPCODE_HANDLER(Fast486OpcodeTestByteModrm) @@ -2095,7 +2033,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeTestByteModrm) if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm)) { /* Exception occurred */ - return FALSE; + return; } if (!Fast486ReadModrmByteOperands(State, @@ -2104,7 +2042,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeTestByteModrm) &SecondValue)) { /* Exception occurred */ - return FALSE; + return; } /* Calculate the result */ Result = FirstValue & SecondValue; @@ -2115,9 +2053,6 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeTestByteModrm) State->Flags.Zf = (Result == 0); State->Flags.Sf = ((Result & SIGN_FLAG_BYTE) != 0); State->Flags.Pf = Fast486CalculateParity(Result); - - /* The result is discarded */ - return TRUE; } FAST486_OPCODE_HANDLER(Fast486OpcodeTestModrm) @@ -2137,7 +2072,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeTestModrm) if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm)) { /* Exception occurred */ - return FALSE; + return; } /* Check the operand size */ @@ -2151,7 +2086,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeTestModrm) &SecondValue)) { /* Exception occurred */ - return FALSE; + return; } /* Calculate the result */ @@ -2174,7 +2109,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeTestModrm) &SecondValue)) { /* Exception occurred */ - return FALSE; + return; } /* Calculate the result */ @@ -2187,9 +2122,6 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeTestModrm) State->Flags.Sf = ((Result & SIGN_FLAG_WORD) != 0); State->Flags.Pf = Fast486CalculateParity(Result); } - - /* The result is discarded */ - return TRUE; } FAST486_OPCODE_HANDLER(Fast486OpcodeTestAl) @@ -2204,13 +2136,13 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeTestAl) { /* This opcode doesn't take any prefixes */ Fast486Exception(State, FAST486_EXCEPTION_UD); - return FALSE; + return; } if (!Fast486FetchByte(State, &SecondValue)) { /* Exception occurred */ - return FALSE; + return; } /* Calculate the result */ @@ -2222,9 +2154,6 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeTestAl) State->Flags.Zf = (Result == 0); State->Flags.Sf = ((Result & SIGN_FLAG_BYTE) != 0); State->Flags.Pf = Fast486CalculateParity(Result); - - /* The result is discarded */ - return TRUE; } FAST486_OPCODE_HANDLER(Fast486OpcodeTestEax) @@ -2245,7 +2174,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeTestEax) if (!Fast486FetchDword(State, &SecondValue)) { /* Exception occurred */ - return FALSE; + return; } /* Calculate the result */ @@ -2266,7 +2195,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeTestEax) if (!Fast486FetchWord(State, &SecondValue)) { /* Exception occurred */ - return FALSE; + return; } /* Calculate the result */ @@ -2279,9 +2208,6 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeTestEax) State->Flags.Sf = ((Result & SIGN_FLAG_WORD) != 0); State->Flags.Pf = Fast486CalculateParity(Result); } - - /* The result is discarded */ - return TRUE; } FAST486_OPCODE_HANDLER(Fast486OpcodeXchgByteModrm) @@ -2299,7 +2225,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeXchgByteModrm) if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm)) { /* Exception occurred */ - return FALSE; + return; } if (!Fast486ReadModrmByteOperands(State, @@ -2308,7 +2234,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeXchgByteModrm) &SecondValue)) { /* Exception occurred */ - return FALSE; + return; } /* Write the value from the register to the R/M */ @@ -2318,20 +2244,14 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeXchgByteModrm) FirstValue)) { /* Exception occurred */ - return FALSE; + return; } /* Write the value from the R/M to the register */ - if (!Fast486WriteModrmByteOperands(State, - &ModRegRm, - TRUE, - SecondValue)) - { - /* Exception occurred */ - return FALSE; - } - - return TRUE; + Fast486WriteModrmByteOperands(State, + &ModRegRm, + TRUE, + SecondValue); } FAST486_OPCODE_HANDLER(Fast486OpcodeXchgModrm) @@ -2351,7 +2271,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeXchgModrm) if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm)) { /* Exception occurred */ - return FALSE; + return; } /* Check the operand size */ @@ -2365,7 +2285,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeXchgModrm) &SecondValue)) { /* Exception occurred */ - return FALSE; + return; } /* Write the value from the register to the R/M */ @@ -2375,18 +2295,14 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeXchgModrm) FirstValue)) { /* Exception occurred */ - return FALSE; + return; } /* Write the value from the R/M to the register */ - if (!Fast486WriteModrmDwordOperands(State, - &ModRegRm, - TRUE, - SecondValue)) - { - /* Exception occurred */ - return FALSE; - } + Fast486WriteModrmDwordOperands(State, + &ModRegRm, + TRUE, + SecondValue); } else { @@ -2398,7 +2314,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeXchgModrm) &SecondValue)) { /* Exception occurred */ - return FALSE; + return; } /* Write the value from the register to the R/M */ @@ -2408,28 +2324,21 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeXchgModrm) FirstValue)) { /* Exception occurred */ - return FALSE; + return; } /* Write the value from the R/M to the register */ - if (!Fast486WriteModrmWordOperands(State, - &ModRegRm, - TRUE, - SecondValue)) - { - /* Exception occurred */ - return FALSE; - } + Fast486WriteModrmWordOperands(State, + &ModRegRm, + TRUE, + SecondValue); } - - /* The result is discarded */ - return TRUE; } FAST486_OPCODE_HANDLER(Fast486OpcodePushEs) { /* Call the internal API */ - return Fast486StackPush(State, State->SegmentRegs[FAST486_REG_ES].Selector); + Fast486StackPush(State, State->SegmentRegs[FAST486_REG_ES].Selector); } FAST486_OPCODE_HANDLER(Fast486OpcodePopEs) @@ -2439,17 +2348,17 @@ FAST486_OPCODE_HANDLER(Fast486OpcodePopEs) if (!Fast486StackPop(State, &NewSelector)) { /* Exception occurred */ - return FALSE; + return; } /* Call the internal API */ - return Fast486LoadSegment(State, FAST486_REG_ES, LOWORD(NewSelector)); + Fast486LoadSegment(State, FAST486_REG_ES, LOWORD(NewSelector)); } FAST486_OPCODE_HANDLER(Fast486OpcodePushCs) { /* Call the internal API */ - return Fast486StackPush(State, State->SegmentRegs[FAST486_REG_CS].Selector); + Fast486StackPush(State, State->SegmentRegs[FAST486_REG_CS].Selector); } FAST486_OPCODE_HANDLER(Fast486OpcodeAdcByteModrm) @@ -2467,7 +2376,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeAdcByteModrm) if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm)) { /* Exception occurred */ - return FALSE; + return; } if (!Fast486ReadModrmByteOperands(State, @@ -2476,7 +2385,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeAdcByteModrm) &SecondValue)) { /* Exception occurred */ - return FALSE; + return; } /* Calculate the result */ @@ -2496,10 +2405,10 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeAdcByteModrm) State->Flags.Pf = Fast486CalculateParity(Result); /* Write back the result */ - return Fast486WriteModrmByteOperands(State, - &ModRegRm, - Opcode & FAST486_OPCODE_WRITE_REG, - Result); + Fast486WriteModrmByteOperands(State, + &ModRegRm, + Opcode & FAST486_OPCODE_WRITE_REG, + Result); } FAST486_OPCODE_HANDLER(Fast486OpcodeAdcModrm) @@ -2519,7 +2428,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeAdcModrm) if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm)) { /* Exception occurred */ - return FALSE; + return; } /* Check the operand size */ @@ -2533,7 +2442,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeAdcModrm) &SecondValue)) { /* Exception occurred */ - return FALSE; + return; } /* Calculate the result */ @@ -2553,10 +2462,10 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeAdcModrm) State->Flags.Pf = Fast486CalculateParity(Result); /* Write back the result */ - return Fast486WriteModrmDwordOperands(State, - &ModRegRm, - Opcode & FAST486_OPCODE_WRITE_REG, - Result); + Fast486WriteModrmDwordOperands(State, + &ModRegRm, + Opcode & FAST486_OPCODE_WRITE_REG, + Result); } else { @@ -2568,7 +2477,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeAdcModrm) &SecondValue)) { /* Exception occurred */ - return FALSE; + return; } /* Calculate the result */ @@ -2588,10 +2497,10 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeAdcModrm) State->Flags.Pf = Fast486CalculateParity(Result); /* Write back the result */ - return Fast486WriteModrmWordOperands(State, - &ModRegRm, - Opcode & FAST486_OPCODE_WRITE_REG, - Result); + Fast486WriteModrmWordOperands(State, + &ModRegRm, + Opcode & FAST486_OPCODE_WRITE_REG, + Result); } } @@ -2608,13 +2517,13 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeAdcAl) { /* This opcode doesn't take any prefixes */ Fast486Exception(State, FAST486_EXCEPTION_UD); - return FALSE; + return; } if (!Fast486FetchByte(State, &SecondValue)) { /* Exception occurred */ - return FALSE; + return; } /* Calculate the result */ @@ -2635,8 +2544,6 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeAdcAl) /* Write back the result */ State->GeneralRegs[FAST486_REG_EAX].LowByte = Result; - - return TRUE; } FAST486_OPCODE_HANDLER(Fast486OpcodeAdcEax) @@ -2657,7 +2564,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeAdcEax) if (!Fast486FetchDword(State, &SecondValue)) { /* Exception occurred */ - return FALSE; + return; } /* Calculate the result */ @@ -2687,7 +2594,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeAdcEax) if (!Fast486FetchWord(State, &SecondValue)) { /* Exception occurred */ - return FALSE; + return; } /* Calculate the result */ @@ -2709,14 +2616,12 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeAdcEax) /* Write back the result */ State->GeneralRegs[FAST486_REG_EAX].LowWord = Result; } - - return TRUE; } FAST486_OPCODE_HANDLER(Fast486OpcodePushSs) { /* Call the internal API */ - return Fast486StackPush(State, State->SegmentRegs[FAST486_REG_SS].Selector); + Fast486StackPush(State, State->SegmentRegs[FAST486_REG_SS].Selector); } FAST486_OPCODE_HANDLER(Fast486OpcodePopSs) @@ -2726,11 +2631,11 @@ FAST486_OPCODE_HANDLER(Fast486OpcodePopSs) if (!Fast486StackPop(State, &NewSelector)) { /* Exception occurred */ - return FALSE; + return; } /* Call the internal API */ - return Fast486LoadSegment(State, FAST486_REG_SS, LOWORD(NewSelector)); + Fast486LoadSegment(State, FAST486_REG_SS, LOWORD(NewSelector)); } FAST486_OPCODE_HANDLER(Fast486OpcodeSbbByteModrm) @@ -2749,7 +2654,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeSbbByteModrm) if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm)) { /* Exception occurred */ - return FALSE; + return; } if (!Fast486ReadModrmByteOperands(State, @@ -2758,7 +2663,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeSbbByteModrm) &SecondValue)) { /* Exception occurred */ - return FALSE; + return; } /* Check if this is the instruction that writes to R/M */ @@ -2781,10 +2686,10 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeSbbByteModrm) State->Flags.Pf = Fast486CalculateParity(Result); /* Write back the result */ - return Fast486WriteModrmByteOperands(State, - &ModRegRm, - Opcode & FAST486_OPCODE_WRITE_REG, - Result); + Fast486WriteModrmByteOperands(State, + &ModRegRm, + Opcode & FAST486_OPCODE_WRITE_REG, + Result); } FAST486_OPCODE_HANDLER(Fast486OpcodeSbbModrm) @@ -2805,7 +2710,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeSbbModrm) if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm)) { /* Exception occurred */ - return FALSE; + return; } /* Check the operand size */ @@ -2819,7 +2724,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeSbbModrm) &SecondValue)) { /* Exception occurred */ - return FALSE; + return; } /* Check if this is the instruction that writes to R/M */ @@ -2842,10 +2747,10 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeSbbModrm) State->Flags.Pf = Fast486CalculateParity(Result); /* Write back the result */ - return Fast486WriteModrmDwordOperands(State, - &ModRegRm, - Opcode & FAST486_OPCODE_WRITE_REG, - Result); + Fast486WriteModrmDwordOperands(State, + &ModRegRm, + Opcode & FAST486_OPCODE_WRITE_REG, + Result); } else { @@ -2857,7 +2762,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeSbbModrm) &SecondValue)) { /* Exception occurred */ - return FALSE; + return; } /* Check if this is the instruction that writes to R/M */ @@ -2880,10 +2785,10 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeSbbModrm) State->Flags.Pf = Fast486CalculateParity(Result); /* Write back the result */ - return Fast486WriteModrmWordOperands(State, - &ModRegRm, - Opcode & FAST486_OPCODE_WRITE_REG, - Result); + Fast486WriteModrmWordOperands(State, + &ModRegRm, + Opcode & FAST486_OPCODE_WRITE_REG, + Result); } } @@ -2900,13 +2805,13 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeSbbAl) { /* This opcode doesn't take any prefixes */ Fast486Exception(State, FAST486_EXCEPTION_UD); - return FALSE; + return; } if (!Fast486FetchByte(State, &SecondValue)) { /* Exception occurred */ - return FALSE; + return; } /* Calculate the result */ @@ -2923,9 +2828,6 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeSbbAl) /* Write back the result */ State->GeneralRegs[FAST486_REG_EAX].LowByte = Result; - - return TRUE; - } FAST486_OPCODE_HANDLER(Fast486OpcodeSbbEax) @@ -2947,7 +2849,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeSbbEax) if (!Fast486FetchDword(State, &SecondValue)) { /* Exception occurred */ - return FALSE; + return; } /* Calculate the result */ @@ -2973,7 +2875,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeSbbEax) if (!Fast486FetchWord(State, &SecondValue)) { /* Exception occurred */ - return FALSE; + return; } /* Calculate the result */ @@ -2991,15 +2893,12 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeSbbEax) /* Write back the result */ State->GeneralRegs[FAST486_REG_EAX].LowWord = Result; } - - return TRUE; - } FAST486_OPCODE_HANDLER(Fast486OpcodePushDs) { /* Call the internal API */ - return Fast486StackPush(State, State->SegmentRegs[FAST486_REG_DS].Selector); + Fast486StackPush(State, State->SegmentRegs[FAST486_REG_DS].Selector); } FAST486_OPCODE_HANDLER(Fast486OpcodePopDs) @@ -3009,11 +2908,11 @@ FAST486_OPCODE_HANDLER(Fast486OpcodePopDs) if (!Fast486StackPop(State, &NewSelector)) { /* Exception occurred */ - return FALSE; + return; } /* Call the internal API */ - return Fast486LoadSegment(State, FAST486_REG_DS, LOWORD(NewSelector)); + Fast486LoadSegment(State, FAST486_REG_DS, LOWORD(NewSelector)); } FAST486_OPCODE_HANDLER(Fast486OpcodeDaa) @@ -3055,8 +2954,6 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeDaa) State->Flags.Sf = (Value & SIGN_FLAG_BYTE) != 0; State->Flags.Zf = (Value == 0); State->Flags.Pf = Fast486CalculateParity(Value); - - return TRUE; } FAST486_OPCODE_HANDLER(Fast486OpcodeCmpSubByteModrm) @@ -3074,7 +2971,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeCmpSubByteModrm) if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm)) { /* Exception occurred */ - return FALSE; + return; } if (!Fast486ReadModrmByteOperands(State, @@ -3083,7 +2980,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeCmpSubByteModrm) &SecondValue)) { /* Exception occurred */ - return FALSE; + return; } /* Check if this is the instruction that writes to R/M */ @@ -3109,15 +3006,10 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeCmpSubByteModrm) if (!(Opcode & 0x10)) { /* Write back the result */ - return Fast486WriteModrmByteOperands(State, - &ModRegRm, - Opcode & FAST486_OPCODE_WRITE_REG, - Result); - } - else - { - /* Discard the result */ - return TRUE; + Fast486WriteModrmByteOperands(State, + &ModRegRm, + Opcode & FAST486_OPCODE_WRITE_REG, + Result); } } @@ -3138,7 +3030,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeCmpSubModrm) if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm)) { /* Exception occurred */ - return FALSE; + return; } /* Check the operand size */ @@ -3152,7 +3044,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeCmpSubModrm) &SecondValue)) { /* Exception occurred */ - return FALSE; + return; } /* Check if this is the instruction that writes to R/M */ @@ -3178,15 +3070,10 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeCmpSubModrm) if (!(Opcode & 0x10)) { /* Write back the result */ - return Fast486WriteModrmDwordOperands(State, - &ModRegRm, - Opcode & FAST486_OPCODE_WRITE_REG, - Result); - } - else - { - /* Discard the result */ - return TRUE; + Fast486WriteModrmDwordOperands(State, + &ModRegRm, + Opcode & FAST486_OPCODE_WRITE_REG, + Result); } } else @@ -3199,7 +3086,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeCmpSubModrm) &SecondValue)) { /* Exception occurred */ - return FALSE; + return; } /* Check if this is the instruction that writes to R/M */ @@ -3225,15 +3112,10 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeCmpSubModrm) if (!(Opcode & 0x10)) { /* Write back the result */ - return Fast486WriteModrmWordOperands(State, - &ModRegRm, - Opcode & FAST486_OPCODE_WRITE_REG, - Result); - } - else - { - /* Discard the result */ - return TRUE; + Fast486WriteModrmWordOperands(State, + &ModRegRm, + Opcode & FAST486_OPCODE_WRITE_REG, + Result); } } } @@ -3250,13 +3132,13 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeCmpSubAl) { /* This opcode doesn't take any prefixes */ Fast486Exception(State, FAST486_EXCEPTION_UD); - return FALSE; + return; } if (!Fast486FetchByte(State, &SecondValue)) { /* Exception occurred */ - return FALSE; + return; } /* Calculate the result */ @@ -3277,8 +3159,6 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeCmpSubAl) /* Write back the result */ State->GeneralRegs[FAST486_REG_EAX].LowByte = Result; } - - return TRUE; } FAST486_OPCODE_HANDLER(Fast486OpcodeCmpSubEax) @@ -3299,7 +3179,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeCmpSubEax) if (!Fast486FetchDword(State, &SecondValue)) { /* Exception occurred */ - return FALSE; + return; } /* Calculate the result */ @@ -3329,7 +3209,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeCmpSubEax) if (!Fast486FetchWord(State, &SecondValue)) { /* Exception occurred */ - return FALSE; + return; } /* Calculate the result */ @@ -3351,8 +3231,6 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeCmpSubEax) State->GeneralRegs[FAST486_REG_EAX].LowWord = Result; } } - - return TRUE; } FAST486_OPCODE_HANDLER(Fast486OpcodeDas) @@ -3394,8 +3272,6 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeDas) State->Flags.Sf = (Value & SIGN_FLAG_BYTE) != 0; State->Flags.Zf = (Value == 0); State->Flags.Pf = Fast486CalculateParity(Value); - - return TRUE; } FAST486_OPCODE_HANDLER(Fast486OpcodeAaa) @@ -3423,8 +3299,6 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeAaa) /* Keep only the lowest 4 bits of AL */ State->GeneralRegs[FAST486_REG_EAX].LowByte &= 0x0F; - - return TRUE; } FAST486_OPCODE_HANDLER(Fast486OpcodeAas) @@ -3452,8 +3326,6 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeAas) /* Keep only the lowest 4 bits of AL */ State->GeneralRegs[FAST486_REG_EAX].LowByte &= 0x0F; - - return TRUE; } FAST486_OPCODE_HANDLER(Fast486OpcodePushAll) @@ -3477,7 +3349,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodePushAll) if (!Fast486StackPush(State, Size ? SavedEsp.Long : SavedEsp.LowWord)) { /* Exception occurred */ - return FALSE; + return; } } else @@ -3487,12 +3359,10 @@ FAST486_OPCODE_HANDLER(Fast486OpcodePushAll) : State->GeneralRegs[i].LowWord)) { /* Exception occurred */ - return FALSE; + return; } } } - - return TRUE; } FAST486_OPCODE_HANDLER(Fast486OpcodePopAll) @@ -3514,7 +3384,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodePopAll) if (!Fast486StackPop(State, &Value)) { /* Exception occurred */ - return FALSE; + return; } /* Don't modify ESP */ @@ -3524,8 +3394,6 @@ FAST486_OPCODE_HANDLER(Fast486OpcodePopAll) else State->GeneralRegs[i].LowWord = LOWORD(Value); } } - - return TRUE; } FAST486_OPCODE_HANDLER(Fast486OpcodeBound) @@ -3543,14 +3411,14 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeBound) if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm)) { /* Exception occurred */ - return FALSE; + return; } if (!ModRegRm.Memory) { /* Invalid */ Fast486Exception(State, FAST486_EXCEPTION_UD); - return FALSE; + return; } /* Check for the segment override */ @@ -3571,7 +3439,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeBound) (PULONG)&LowerBound)) { /* Exception occurred */ - return FALSE; + return; } if (!Fast486ReadMemory(State, @@ -3582,14 +3450,13 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeBound) sizeof(ULONG))) { /* Exception occurred */ - return FALSE; + return; } if ((Index < LowerBound) || (Index > UpperBound)) { /* Out of bounds */ Fast486Exception(State, FAST486_EXCEPTION_BR); - return FALSE; } } else @@ -3603,7 +3470,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeBound) (PUSHORT)&LowerBound)) { /* Exception occurred */ - return FALSE; + return; } if (!Fast486ReadMemory(State, @@ -3614,18 +3481,15 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeBound) sizeof(USHORT))) { /* Exception occurred */ - return FALSE; + return; } if ((Index < LowerBound) || (Index > UpperBound)) { /* Out of bounds */ Fast486Exception(State, FAST486_EXCEPTION_BR); - return FALSE; } } - - return TRUE; } FAST486_OPCODE_HANDLER(Fast486OpcodeArpl) @@ -3640,7 +3504,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeArpl) { /* Cannot be used in real mode or with a LOCK prefix */ Fast486Exception(State, FAST486_EXCEPTION_UD); - return FALSE; + return; } TOGGLE_ADSIZE(AddressSize); @@ -3649,7 +3513,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeArpl) if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm)) { /* Exception occurred */ - return FALSE; + return; } /* Read the operands */ @@ -3659,7 +3523,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeArpl) &SecondValue)) { /* Exception occurred */ - return FALSE; + return; } /* Check if the RPL needs adjusting */ @@ -3673,13 +3537,12 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeArpl) State->Flags.Zf = TRUE; /* Write back the result */ - return Fast486WriteModrmWordOperands(State, &ModRegRm, FALSE, SecondValue); + Fast486WriteModrmWordOperands(State, &ModRegRm, FALSE, SecondValue); } else { /* Clear ZF */ State->Flags.Zf = FALSE; - return TRUE; } } @@ -3700,11 +3563,11 @@ FAST486_OPCODE_HANDLER(Fast486OpcodePushImm) if (!Fast486FetchDword(State, &Data)) { /* Exception occurred */ - return FALSE; + return; } /* Call the internal API */ - return Fast486StackPush(State, Data); + Fast486StackPush(State, Data); } else { @@ -3713,11 +3576,11 @@ FAST486_OPCODE_HANDLER(Fast486OpcodePushImm) if (!Fast486FetchWord(State, (PUSHORT)&Data)) { /* Exception occurred */ - return FALSE; + return; } /* Call the internal API */ - return Fast486StackPush(State, Data); + Fast486StackPush(State, Data); } } @@ -3739,7 +3602,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeImulModrmImm) if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm)) { /* Exception occurred */ - return FALSE; + return; } if (Opcode == 0x6B) @@ -3750,7 +3613,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeImulModrmImm) if (!Fast486FetchByte(State, (PUCHAR)&Byte)) { /* Exception occurred */ - return FALSE; + return; } Multiplier = (LONG)Byte; @@ -3765,7 +3628,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeImulModrmImm) if (!Fast486FetchDword(State, (PULONG)&Dword)) { /* Exception occurred */ - return FALSE; + return; } Multiplier = Dword; @@ -3778,7 +3641,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeImulModrmImm) if (!Fast486FetchWord(State, (PUSHORT)&Word)) { /* Exception occurred */ - return FALSE; + return; } Multiplier = (LONG)Word; @@ -3797,7 +3660,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeImulModrmImm) (PULONG)&Multiplicand)) { /* Exception occurred */ - return FALSE; + return; } /* Multiply */ @@ -3807,10 +3670,10 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeImulModrmImm) State->Flags.Cf = State->Flags.Of = ((Product < MINLONG) || (Product > MAXLONG)); /* Write-back the result */ - return Fast486WriteModrmDwordOperands(State, - &ModRegRm, - TRUE, - (ULONG)((LONG)Product)); + Fast486WriteModrmDwordOperands(State, + &ModRegRm, + TRUE, + (ULONG)((LONG)Product)); } else { @@ -3824,7 +3687,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeImulModrmImm) (PUSHORT)&Multiplicand)) { /* Exception occurred */ - return FALSE; + return; } /* Multiply */ @@ -3834,10 +3697,10 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeImulModrmImm) State->Flags.Cf = State->Flags.Of = ((Product < MINSHORT) || (Product > MAXSHORT)); /* Write-back the result */ - return Fast486WriteModrmWordOperands(State, - &ModRegRm, - TRUE, - (USHORT)((SHORT)Product)); + Fast486WriteModrmWordOperands(State, + &ModRegRm, + TRUE, + (USHORT)((SHORT)Product)); } } @@ -3851,11 +3714,11 @@ FAST486_OPCODE_HANDLER(Fast486OpcodePushByteImm) if (!Fast486FetchByte(State, (PUCHAR)&Data)) { /* Exception occurred */ - return FALSE; + return; } /* Call the internal API */ - return Fast486StackPush(State, Data); + Fast486StackPush(State, Data); } FAST486_OPCODE_HANDLER(Fast486OpcodeMovByteModrm) @@ -3873,7 +3736,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeMovByteModrm) if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm)) { /* Exception occurred */ - return FALSE; + return; } if (!Fast486ReadModrmByteOperands(State, @@ -3882,17 +3745,17 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeMovByteModrm) &SecondValue)) { /* Exception occurred */ - return FALSE; + return; } if (Opcode & FAST486_OPCODE_WRITE_REG) Result = SecondValue; else Result = FirstValue; /* Write back the result */ - return Fast486WriteModrmByteOperands(State, - &ModRegRm, - Opcode & FAST486_OPCODE_WRITE_REG, - Result); + Fast486WriteModrmByteOperands(State, + &ModRegRm, + Opcode & FAST486_OPCODE_WRITE_REG, + Result); } @@ -3913,7 +3776,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeMovModrm) if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm)) { /* Exception occurred */ - return FALSE; + return; } /* Check the operand size */ @@ -3927,17 +3790,17 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeMovModrm) &SecondValue)) { /* Exception occurred */ - return FALSE; + return; } if (Opcode & FAST486_OPCODE_WRITE_REG) Result = SecondValue; else Result = FirstValue; /* Write back the result */ - return Fast486WriteModrmDwordOperands(State, - &ModRegRm, - Opcode & FAST486_OPCODE_WRITE_REG, - Result); + Fast486WriteModrmDwordOperands(State, + &ModRegRm, + Opcode & FAST486_OPCODE_WRITE_REG, + Result); } else { @@ -3949,17 +3812,17 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeMovModrm) &SecondValue)) { /* Exception occurred */ - return FALSE; + return; } if (Opcode & FAST486_OPCODE_WRITE_REG) Result = SecondValue; else Result = FirstValue; /* Write back the result */ - return Fast486WriteModrmWordOperands(State, - &ModRegRm, - Opcode & FAST486_OPCODE_WRITE_REG, - Result); + Fast486WriteModrmWordOperands(State, + &ModRegRm, + Opcode & FAST486_OPCODE_WRITE_REG, + Result); } } @@ -3980,29 +3843,29 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeMovStoreSeg) if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm)) { /* Exception occurred */ - return FALSE; + return; } if (ModRegRm.Register >= FAST486_NUM_SEG_REGS) { /* Invalid */ Fast486Exception(State, FAST486_EXCEPTION_UD); - return FALSE; + return; } if (OperandSize) { - return Fast486WriteModrmDwordOperands(State, - &ModRegRm, - FALSE, - State->SegmentRegs[ModRegRm.Register].Selector); + Fast486WriteModrmDwordOperands(State, + &ModRegRm, + FALSE, + State->SegmentRegs[ModRegRm.Register].Selector); } else { - return Fast486WriteModrmWordOperands(State, - &ModRegRm, - FALSE, - State->SegmentRegs[ModRegRm.Register].Selector); + Fast486WriteModrmWordOperands(State, + &ModRegRm, + FALSE, + State->SegmentRegs[ModRegRm.Register].Selector); } } @@ -4023,7 +3886,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeLea) if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm)) { /* Exception occurred */ - return FALSE; + return; } /* The second operand must be memory */ @@ -4031,23 +3894,23 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeLea) { /* Invalid */ Fast486Exception(State, FAST486_EXCEPTION_UD); - return FALSE; + return; } /* Write the address to the register */ if (OperandSize) { - return Fast486WriteModrmDwordOperands(State, - &ModRegRm, - TRUE, - ModRegRm.MemoryAddress); + Fast486WriteModrmDwordOperands(State, + &ModRegRm, + TRUE, + ModRegRm.MemoryAddress); } else { - return Fast486WriteModrmWordOperands(State, - &ModRegRm, - TRUE, - ModRegRm.MemoryAddress); + Fast486WriteModrmWordOperands(State, + &ModRegRm, + TRUE, + ModRegRm.MemoryAddress); } } @@ -4069,7 +3932,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeMovLoadSeg) if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm)) { /* Exception occurred */ - return FALSE; + return; } if ((ModRegRm.Register >= FAST486_NUM_SEG_REGS) @@ -4077,7 +3940,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeMovLoadSeg) { /* Invalid */ Fast486Exception(State, FAST486_EXCEPTION_UD); - return FALSE; + return; } if (OperandSize) @@ -4087,10 +3950,10 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeMovLoadSeg) if (!Fast486ReadModrmDwordOperands(State, &ModRegRm, NULL, &Selector)) { /* Exception occurred */ - return FALSE; + return; } - return Fast486LoadSegment(State, ModRegRm.Register, LOWORD(Selector)); + Fast486LoadSegment(State, ModRegRm.Register, LOWORD(Selector)); } else { @@ -4099,10 +3962,10 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeMovLoadSeg) if (!Fast486ReadModrmWordOperands(State, &ModRegRm, NULL, &Selector)) { /* Exception occurred */ - return FALSE; + return; } - return Fast486LoadSegment(State, ModRegRm.Register, Selector); + Fast486LoadSegment(State, ModRegRm.Register, Selector); } } @@ -4133,8 +3996,6 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeCwde) (State->GeneralRegs[FAST486_REG_EAX].LowByte & SIGN_FLAG_BYTE) ? 0xFF : 0x00; } - - return TRUE; } FAST486_OPCODE_HANDLER(Fast486OpcodeCdq) @@ -4161,8 +4022,6 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeCdq) (State->GeneralRegs[FAST486_REG_EAX].LowWord & SIGN_FLAG_WORD) ? 0xFFFF : 0x0000; } - - return TRUE; } FAST486_OPCODE_HANDLER(Fast486OpcodeCallAbs) @@ -4183,7 +4042,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeCallAbs) if (!Fast486FetchDword(State, &Offset)) { /* Exception occurred */ - return FALSE; + return; } } else @@ -4191,7 +4050,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeCallAbs) if (!Fast486FetchWord(State, (PUSHORT)&Offset)) { /* Exception occurred */ - return FALSE; + return; } } @@ -4199,43 +4058,39 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeCallAbs) if (!Fast486FetchWord(State, &Segment)) { /* Exception occurred */ - return FALSE; + return; } /* Push the current code segment selector */ if (!Fast486StackPush(State, State->SegmentRegs[FAST486_REG_CS].Selector)) { /* Exception occurred */ - return FALSE; + return; } /* Push the current value of the instruction pointer */ if (!Fast486StackPush(State, State->InstPtr.Long)) { /* Exception occurred */ - return FALSE; + return; } /* Load the new CS */ if (!Fast486LoadSegment(State, FAST486_REG_CS, Segment)) { /* Exception occurred */ - return FALSE; + return; } /* Load new (E)IP */ if (Size) State->InstPtr.Long = Offset; else State->InstPtr.LowWord = LOWORD(Offset); - - return TRUE; } FAST486_OPCODE_HANDLER(Fast486OpcodeWait) { // TODO: NOT IMPLEMENTED UNIMPLEMENTED; - - return FALSE; } FAST486_OPCODE_HANDLER(Fast486OpcodePushFlags) @@ -4250,12 +4105,12 @@ FAST486_OPCODE_HANDLER(Fast486OpcodePushFlags) { /* Call the VM86 monitor */ Fast486ExceptionWithErrorCode(State, FAST486_EXCEPTION_GP, 0); - return FALSE; + return; } /* Push the flags */ - if (Size) return Fast486StackPush(State, State->Flags.Long); - else return Fast486StackPush(State, LOWORD(State->Flags.Long)); + if (Size) Fast486StackPush(State, State->Flags.Long); + else Fast486StackPush(State, LOWORD(State->Flags.Long)); } FAST486_OPCODE_HANDLER(Fast486OpcodePopFlags) @@ -4271,7 +4126,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodePopFlags) if (!Fast486StackPop(State, &NewFlags.Long)) { /* Exception occurred */ - return FALSE; + return; } /* Check for VM86 mode when IOPL is not 3 */ @@ -4279,7 +4134,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodePopFlags) { /* Call the VM86 monitor */ Fast486ExceptionWithErrorCode(State, FAST486_EXCEPTION_GP, 0); - return FALSE; + return; } State->Flags.Cf = NewFlags.Cf; @@ -4295,8 +4150,6 @@ FAST486_OPCODE_HANDLER(Fast486OpcodePopFlags) if (Cpl == 0) State->Flags.Iopl = NewFlags.Iopl; if (Cpl <= State->Flags.Iopl) State->Flags.If = NewFlags.If; - - return TRUE; } FAST486_OPCODE_HANDLER(Fast486OpcodeSahf) @@ -4311,8 +4164,6 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeSahf) /* Restore the reserved bits of FLAGS */ State->Flags.AlwaysSet = TRUE; State->Flags.Reserved0 = State->Flags.Reserved1 = FALSE; - - return TRUE; } FAST486_OPCODE_HANDLER(Fast486OpcodeLahf) @@ -4322,8 +4173,6 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeLahf) /* Set AH to the low-order byte of FLAGS */ State->GeneralRegs[FAST486_REG_EAX].HighByte = LOBYTE(State->Flags.Long); - - return TRUE; } FAST486_OPCODE_HANDLER(Fast486OpcodeRet) @@ -4341,11 +4190,11 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeRet) if (Opcode == 0xC2) { /* Fetch the number of bytes to pop after the return */ - if (!Fast486FetchWord(State, &BytesToPop)) return FALSE; + if (!Fast486FetchWord(State, &BytesToPop)) return; } /* Pop the return address */ - if (!Fast486StackPop(State, &ReturnAddress)) return FALSE; + if (!Fast486StackPop(State, &ReturnAddress)) return; /* Return to the calling procedure, and if necessary, pop the parameters */ if (Size) @@ -4358,8 +4207,6 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeRet) State->InstPtr.LowWord = LOWORD(ReturnAddress); State->GeneralRegs[FAST486_REG_ESP].LowWord += BytesToPop; } - - return TRUE; } FAST486_OPCODE_HANDLER(Fast486OpcodeLdsLes) @@ -4380,7 +4227,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeLdsLes) if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm)) { /* Exception occurred */ - return FALSE; + return; } if (!ModRegRm.Memory) @@ -4397,7 +4244,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeLdsLes) if (!Fast486FetchByte(State, &BopCode)) { /* Exception occurred */ - return FALSE; + return; } /* Call the BOP handler */ @@ -4414,13 +4261,12 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeLdsLes) State->IntStatus = FAST486_INT_DELAYED; } - /* Return success */ - return TRUE; + return; } /* Invalid */ Fast486Exception(State, FAST486_EXCEPTION_UD); - return FALSE; + return; } if (!Fast486ReadMemory(State, @@ -4432,7 +4278,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeLdsLes) OperandSize ? 6 : 4)) { /* Exception occurred */ - return FALSE; + return; } if (OperandSize) @@ -4444,10 +4290,10 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeLdsLes) State->GeneralRegs[ModRegRm.Register].Long = Offset; /* Load the segment */ - return Fast486LoadSegment(State, - (Opcode == 0xC4) - ? FAST486_REG_ES : FAST486_REG_DS, - Segment); + Fast486LoadSegment(State, + (Opcode == 0xC4) + ? FAST486_REG_ES : FAST486_REG_DS, + Segment); } else { @@ -4458,10 +4304,10 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeLdsLes) State->GeneralRegs[ModRegRm.Register].LowWord = Offset; /* Load the segment */ - return Fast486LoadSegment(State, - (Opcode == 0xC4) - ? FAST486_REG_ES : FAST486_REG_DS, - Segment); + Fast486LoadSegment(State, + (Opcode == 0xC4) + ? FAST486_REG_ES : FAST486_REG_DS, + Segment); } } @@ -4482,20 +4328,20 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeEnter) if (!Fast486FetchWord(State, &FrameSize)) { /* Exception occurred */ - return FALSE; + return; } if (!Fast486FetchByte(State, &NestingLevel)) { /* Exception occurred */ - return FALSE; + return; } /* Push EBP */ if (!Fast486StackPush(State, State->GeneralRegs[FAST486_REG_EBP].Long)) { /* Exception occurred */ - return FALSE; + return; } /* Save ESP */ @@ -4524,8 +4370,6 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeEnter) /* Reserve space for the frame */ if (Size) State->GeneralRegs[FAST486_REG_ESP].Long -= (ULONG)FrameSize; else State->GeneralRegs[FAST486_REG_ESP].LowWord -= FrameSize; - - return TRUE; } FAST486_OPCODE_HANDLER(Fast486OpcodeLeave) @@ -4544,7 +4388,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeLeave) State->GeneralRegs[FAST486_REG_ESP].Long = State->GeneralRegs[FAST486_REG_EBP].Long; /* Pop the saved base pointer from the stack */ - return Fast486StackPop(State, &State->GeneralRegs[FAST486_REG_EBP].Long); + Fast486StackPop(State, &State->GeneralRegs[FAST486_REG_EBP].Long); } else { @@ -4557,9 +4401,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeLeave) if (Fast486StackPop(State, &Value)) { State->GeneralRegs[FAST486_REG_EBP].LowWord = LOWORD(Value); - return TRUE; } - else return FALSE; } } @@ -4579,28 +4421,28 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeRetFar) if (Opcode == 0xCA) { /* Fetch the number of bytes to pop after the return */ - if (!Fast486FetchWord(State, &BytesToPop)) return FALSE; + if (!Fast486FetchWord(State, &BytesToPop)) return; } /* Pop the offset */ if (!Fast486StackPop(State, &Offset)) { /* Exception occurred */ - return FALSE; + return; } /* Pop the segment */ if (!Fast486StackPop(State, &Segment)) { /* Exception occurred */ - return FALSE; + return; } /* Load the new CS */ if (!Fast486LoadSegment(State, FAST486_REG_CS, Segment)) { /* Exception occurred */ - return FALSE; + return; } /* Load new (E)IP, and if necessary, pop the parameters */ @@ -4614,8 +4456,6 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeRetFar) State->InstPtr.LowWord = LOWORD(Offset); State->GeneralRegs[FAST486_REG_ESP].LowWord += BytesToPop; } - - return TRUE; } FAST486_OPCODE_HANDLER(Fast486OpcodeInt) @@ -4637,7 +4477,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeInt) if (!Fast486FetchByte(State, &IntNum)) { /* Exception occurred */ - return FALSE; + return; } break; @@ -4646,7 +4486,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeInt) case 0xCE: // INTO { /* Don't do anything if OF is cleared */ - if (!State->Flags.Of) return TRUE; + if (!State->Flags.Of) return; /* Exception #OF */ IntNum = FAST486_EXCEPTION_OF; @@ -4662,7 +4502,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeInt) } /* Perform the interrupt */ - return Fast486PerformInterrupt(State, IntNum); + Fast486PerformInterrupt(State, IntNum); } FAST486_OPCODE_HANDLER(Fast486OpcodeIret) @@ -4682,21 +4522,21 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeIret) if (!Fast486StackPop(State, &InstPtr)) { /* Exception occurred */ - return FALSE; + return; } /* Pop CS */ if (!Fast486StackPop(State, &CodeSel)) { /* Exception occurred */ - return FALSE; + return; } /* Pop EFLAGS */ if (!Fast486StackPop(State, &NewFlags.Long)) { /* Exception occurred */ - return FALSE; + return; } /* Check for protected mode */ @@ -4718,7 +4558,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeIret) if (!Fast486LoadSegment(State, FAST486_REG_CS, CodeSel)) { /* Exception occurred */ - return FALSE; + return; } /* Set the new flags */ @@ -4731,10 +4571,10 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeIret) { /* Call the VM86 monitor */ Fast486ExceptionWithErrorCode(State, FAST486_EXCEPTION_GP, 0); - return FALSE; + return; } - return TRUE; + return; } if (State->Flags.Nt) @@ -4742,7 +4582,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeIret) /* Nested task return */ UNIMPLEMENTED; - return FALSE; + return; } if (NewFlags.Vm) @@ -4751,12 +4591,12 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeIret) ULONG Es, Ds, Fs, Gs; /* Pop ESP, SS, ES, FS, GS */ - if (!Fast486StackPop(State, &StackPtr)) return FALSE; - if (!Fast486StackPop(State, &StackSel)) return FALSE; - if (!Fast486StackPop(State, &Es)) return FALSE; - if (!Fast486StackPop(State, &Ds)) return FALSE; - if (!Fast486StackPop(State, &Fs)) return FALSE; - if (!Fast486StackPop(State, &Gs)) return FALSE; + if (!Fast486StackPop(State, &StackPtr)) return; + if (!Fast486StackPop(State, &StackSel)) return; + if (!Fast486StackPop(State, &Es)) return; + if (!Fast486StackPop(State, &Ds)) return; + if (!Fast486StackPop(State, &Fs)) return; + if (!Fast486StackPop(State, &Gs)) return; /* Set the new IP */ State->InstPtr.Long = LOWORD(InstPtr); @@ -4767,21 +4607,21 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeIret) State->Flags.AlwaysSet = State->Flags.Vm = TRUE; /* Load the new segments */ - if (!Fast486LoadSegment(State, FAST486_REG_CS, CodeSel)) return FALSE; - if (!Fast486LoadSegment(State, FAST486_REG_SS, StackSel)) return FALSE; - if (!Fast486LoadSegment(State, FAST486_REG_ES, Es)) return FALSE; - if (!Fast486LoadSegment(State, FAST486_REG_DS, Ds)) return FALSE; - if (!Fast486LoadSegment(State, FAST486_REG_FS, Fs)) return FALSE; - if (!Fast486LoadSegment(State, FAST486_REG_GS, Gs)) return FALSE; + if (!Fast486LoadSegment(State, FAST486_REG_CS, CodeSel)) return; + if (!Fast486LoadSegment(State, FAST486_REG_SS, StackSel)) return; + if (!Fast486LoadSegment(State, FAST486_REG_ES, Es)) return; + if (!Fast486LoadSegment(State, FAST486_REG_DS, Ds)) return; + if (!Fast486LoadSegment(State, FAST486_REG_FS, Fs)) return; + if (!Fast486LoadSegment(State, FAST486_REG_GS, Gs)) return; - return TRUE; + return; } /* Load the new CS */ if (!Fast486LoadSegment(State, FAST486_REG_CS, CodeSel)) { /* Exception occurred */ - return FALSE; + return; } /* Set EIP */ @@ -4794,21 +4634,21 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeIret) if (!Fast486StackPop(State, &StackPtr)) { /* Exception */ - return FALSE; + return; } /* Pop SS */ if (!Fast486StackPop(State, &StackSel)) { /* Exception */ - return FALSE; + return; } /* Load new SS */ if (!Fast486LoadSegment(State, FAST486_REG_SS, StackSel)) { /* Exception */ - return FALSE; + return; } /* Set ESP */ @@ -4841,7 +4681,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeIret) || !State->SegmentRegs[i].DirConf)) { /* Load the NULL descriptor in the segment */ - if (!Fast486LoadSegment(State, i, 0)) return FALSE; + if (!Fast486LoadSegment(State, i, 0)) return; } } } @@ -4852,7 +4692,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeIret) { /* Invalid */ Fast486ExceptionWithErrorCode(State, FAST486_EXCEPTION_GP, 0); - return FALSE; + return; } /* Set new EIP */ @@ -4862,7 +4702,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeIret) if (!Fast486LoadSegment(State, FAST486_REG_CS, CodeSel)) { /* Exception occurred */ - return FALSE; + return; } /* Set the new flags */ @@ -4870,8 +4710,6 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeIret) else State->Flags.LowWord = NewFlags.LowWord & REAL_MODE_FLAGS_MASK; State->Flags.AlwaysSet = TRUE; } - - return TRUE; } FAST486_OPCODE_HANDLER(Fast486OpcodeAam) @@ -4885,7 +4723,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeAam) if (!Fast486FetchByte(State, &Base)) { /* Exception occurred */ - return FALSE; + return; } /* Check if the base is zero */ @@ -4893,7 +4731,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeAam) { /* Divide error */ Fast486Exception(State, FAST486_EXCEPTION_DE); - return FALSE; + return; } /* Adjust */ @@ -4905,8 +4743,6 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeAam) State->Flags.Zf = (Value == 0); State->Flags.Sf = ((Value & SIGN_FLAG_BYTE) != 0); State->Flags.Pf = Fast486CalculateParity(Value); - - return TRUE; } FAST486_OPCODE_HANDLER(Fast486OpcodeAad) @@ -4920,7 +4756,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeAad) if (!Fast486FetchByte(State, &Base)) { /* Exception occurred */ - return FALSE; + return; } /* Adjust */ @@ -4932,8 +4768,6 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeAad) State->Flags.Zf = (Value == 0); State->Flags.Sf = ((Value & SIGN_FLAG_BYTE) != 0); State->Flags.Pf = Fast486CalculateParity(Value); - - return TRUE; } FAST486_OPCODE_HANDLER(Fast486OpcodeXlat) @@ -4955,14 +4789,11 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeXlat) sizeof(UCHAR))) { /* Exception occurred */ - return FALSE; + return; } /* Set AL to the result */ State->GeneralRegs[FAST486_REG_EAX].LowByte = Value; - - /* Return success */ - return TRUE; } FAST486_OPCODE_HANDLER(Fast486OpcodeLoop) @@ -4995,7 +4826,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeLoop) if (!Fast486FetchByte(State, (PUCHAR)&Offset)) { /* An exception occurred */ - return FALSE; + return; } if (Condition) @@ -5004,8 +4835,6 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeLoop) if (Size) State->InstPtr.Long += Offset; else State->InstPtr.LowWord += Offset; } - - return TRUE; } FAST486_OPCODE_HANDLER(Fast486OpcodeJecxz) @@ -5027,7 +4856,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeJecxz) if (!Fast486FetchByte(State, (PUCHAR)&Offset)) { /* An exception occurred */ - return FALSE; + return; } if (Condition) @@ -5036,8 +4865,6 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeJecxz) if (Size) State->InstPtr.Long += Offset; else State->InstPtr.LowWord += Offset; } - - return TRUE; } FAST486_OPCODE_HANDLER(Fast486OpcodeCall) @@ -5058,14 +4885,14 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeCall) if (!Fast486FetchDword(State, (PULONG)&Offset)) { /* An exception occurred */ - return FALSE; + return; } /* Push the current value of the instruction pointer */ if (!Fast486StackPush(State, State->InstPtr.Long)) { /* Exception occurred */ - return FALSE; + return; } /* Move the instruction pointer */ @@ -5079,21 +4906,19 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeCall) if (!Fast486FetchWord(State, (PUSHORT)&Offset)) { /* An exception occurred */ - return FALSE; + return; } /* Push the current value of the instruction pointer */ if (!Fast486StackPush(State, State->InstPtr.Long)) { /* Exception occurred */ - return FALSE; + return; } /* Move the instruction pointer */ State->InstPtr.LowWord += Offset; } - - return TRUE; } FAST486_OPCODE_HANDLER(Fast486OpcodeJmp) @@ -5114,7 +4939,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeJmp) if (!Fast486FetchDword(State, (PULONG)&Offset)) { /* An exception occurred */ - return FALSE; + return; } /* Move the instruction pointer */ @@ -5128,7 +4953,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeJmp) if (!Fast486FetchWord(State, (PUSHORT)&Offset)) { /* An exception occurred */ - return FALSE; + return; } /* Move the instruction pointer */ @@ -5137,8 +4962,6 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeJmp) /* Clear the top half of EIP */ State->InstPtr.Long &= 0xFFFF; } - - return TRUE; } FAST486_OPCODE_HANDLER(Fast486OpcodeJmpAbs) @@ -5159,7 +4982,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeJmpAbs) if (!Fast486FetchDword(State, &Offset)) { /* Exception occurred */ - return FALSE; + return; } } else @@ -5167,7 +4990,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeJmpAbs) if (!Fast486FetchWord(State, (PUSHORT)&Offset)) { /* Exception occurred */ - return FALSE; + return; } } @@ -5175,20 +4998,18 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeJmpAbs) if (!Fast486FetchWord(State, &Segment)) { /* Exception occurred */ - return FALSE; + return; } /* Load the new CS */ if (!Fast486LoadSegment(State, FAST486_REG_CS, Segment)) { /* Exception occurred */ - return FALSE; + return; } /* Load new EIP */ State->InstPtr.Long = Offset; - - return TRUE; } FAST486_OPCODE_HANDLER(Fast486OpcodeMovAlOffset) @@ -5206,7 +5027,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeMovAlOffset) if (!Fast486FetchDword(State, &Offset)) { /* Exception occurred */ - return FALSE; + return; } } else @@ -5216,20 +5037,20 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeMovAlOffset) if (!Fast486FetchWord(State, &WordOffset)) { /* Exception occurred */ - return FALSE; + return; } Offset = (ULONG)WordOffset; } /* Read from memory */ - return Fast486ReadMemory(State, - (State->PrefixFlags & FAST486_PREFIX_SEG) ? - State->SegmentOverride : FAST486_REG_DS, - Offset, - FALSE, - &State->GeneralRegs[FAST486_REG_EAX].LowByte, - sizeof(UCHAR)); + Fast486ReadMemory(State, + (State->PrefixFlags & FAST486_PREFIX_SEG) ? + State->SegmentOverride : FAST486_REG_DS, + Offset, + FALSE, + &State->GeneralRegs[FAST486_REG_EAX].LowByte, + sizeof(UCHAR)); } FAST486_OPCODE_HANDLER(Fast486OpcodeMovEaxOffset) @@ -5251,29 +5072,29 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeMovEaxOffset) if (!Fast486FetchDword(State, &Offset)) { /* Exception occurred */ - return FALSE; + return; } /* Read from memory */ if (OperandSize) { - return Fast486ReadMemory(State, - (State->PrefixFlags & FAST486_PREFIX_SEG) ? - State->SegmentOverride : FAST486_REG_DS, - Offset, - FALSE, - &State->GeneralRegs[FAST486_REG_EAX].Long, - sizeof(ULONG)); + Fast486ReadMemory(State, + (State->PrefixFlags & FAST486_PREFIX_SEG) ? + State->SegmentOverride : FAST486_REG_DS, + Offset, + FALSE, + &State->GeneralRegs[FAST486_REG_EAX].Long, + sizeof(ULONG)); } else { - return Fast486ReadMemory(State, - (State->PrefixFlags & FAST486_PREFIX_SEG) ? - State->SegmentOverride : FAST486_REG_DS, - Offset, - FALSE, - &State->GeneralRegs[FAST486_REG_EAX].LowWord, - sizeof(USHORT)); + Fast486ReadMemory(State, + (State->PrefixFlags & FAST486_PREFIX_SEG) ? + State->SegmentOverride : FAST486_REG_DS, + Offset, + FALSE, + &State->GeneralRegs[FAST486_REG_EAX].LowWord, + sizeof(USHORT)); } } else @@ -5283,29 +5104,29 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeMovEaxOffset) if (!Fast486FetchWord(State, &Offset)) { /* Exception occurred */ - return FALSE; + return; } /* Read from memory */ if (OperandSize) { - return Fast486ReadMemory(State, - (State->PrefixFlags & FAST486_PREFIX_SEG) ? - State->SegmentOverride : FAST486_REG_DS, - Offset, - FALSE, - &State->GeneralRegs[FAST486_REG_EAX].Long, - sizeof(ULONG)); + Fast486ReadMemory(State, + (State->PrefixFlags & FAST486_PREFIX_SEG) ? + State->SegmentOverride : FAST486_REG_DS, + Offset, + FALSE, + &State->GeneralRegs[FAST486_REG_EAX].Long, + sizeof(ULONG)); } else { - return Fast486ReadMemory(State, - (State->PrefixFlags & FAST486_PREFIX_SEG) ? - State->SegmentOverride : FAST486_REG_DS, - Offset, - FALSE, - &State->GeneralRegs[FAST486_REG_EAX].LowWord, - sizeof(USHORT)); + Fast486ReadMemory(State, + (State->PrefixFlags & FAST486_PREFIX_SEG) ? + State->SegmentOverride : FAST486_REG_DS, + Offset, + FALSE, + &State->GeneralRegs[FAST486_REG_EAX].LowWord, + sizeof(USHORT)); } } } @@ -5325,7 +5146,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeMovOffsetAl) if (!Fast486FetchDword(State, &Offset)) { /* Exception occurred */ - return FALSE; + return; } } else @@ -5335,19 +5156,19 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeMovOffsetAl) if (!Fast486FetchWord(State, &WordOffset)) { /* Exception occurred */ - return FALSE; + return; } Offset = (ULONG)WordOffset; } /* Write to memory */ - return Fast486WriteMemory(State, - (State->PrefixFlags & FAST486_PREFIX_SEG) ? - State->SegmentOverride : FAST486_REG_DS, - Offset, - &State->GeneralRegs[FAST486_REG_EAX].LowByte, - sizeof(UCHAR)); + Fast486WriteMemory(State, + (State->PrefixFlags & FAST486_PREFIX_SEG) ? + State->SegmentOverride : FAST486_REG_DS, + Offset, + &State->GeneralRegs[FAST486_REG_EAX].LowByte, + sizeof(UCHAR)); } FAST486_OPCODE_HANDLER(Fast486OpcodeMovOffsetEax) @@ -5369,27 +5190,27 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeMovOffsetEax) if (!Fast486FetchDword(State, &Offset)) { /* Exception occurred */ - return FALSE; + return; } /* Write to memory */ if (OperandSize) { - return Fast486WriteMemory(State, - (State->PrefixFlags & FAST486_PREFIX_SEG) ? - State->SegmentOverride : FAST486_REG_DS, - Offset, - &State->GeneralRegs[FAST486_REG_EAX].Long, - sizeof(ULONG)); + Fast486WriteMemory(State, + (State->PrefixFlags & FAST486_PREFIX_SEG) ? + State->SegmentOverride : FAST486_REG_DS, + Offset, + &State->GeneralRegs[FAST486_REG_EAX].Long, + sizeof(ULONG)); } else { - return Fast486WriteMemory(State, - (State->PrefixFlags & FAST486_PREFIX_SEG) ? - State->SegmentOverride : FAST486_REG_DS, - Offset, - &State->GeneralRegs[FAST486_REG_EAX].LowWord, - sizeof(USHORT)); + Fast486WriteMemory(State, + (State->PrefixFlags & FAST486_PREFIX_SEG) ? + State->SegmentOverride : FAST486_REG_DS, + Offset, + &State->GeneralRegs[FAST486_REG_EAX].LowWord, + sizeof(USHORT)); } } else @@ -5399,27 +5220,27 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeMovOffsetEax) if (!Fast486FetchWord(State, &Offset)) { /* Exception occurred */ - return FALSE; + return; } /* Write to memory */ if (OperandSize) { - return Fast486WriteMemory(State, - (State->PrefixFlags & FAST486_PREFIX_SEG) ? - State->SegmentOverride : FAST486_REG_DS, - Offset, - &State->GeneralRegs[FAST486_REG_EAX].Long, - sizeof(ULONG)); + Fast486WriteMemory(State, + (State->PrefixFlags & FAST486_PREFIX_SEG) ? + State->SegmentOverride : FAST486_REG_DS, + Offset, + &State->GeneralRegs[FAST486_REG_EAX].Long, + sizeof(ULONG)); } else { - return Fast486WriteMemory(State, - (State->PrefixFlags & FAST486_PREFIX_SEG) ? - State->SegmentOverride : FAST486_REG_DS, - Offset, - &State->GeneralRegs[FAST486_REG_EAX].LowWord, - sizeof(USHORT)); + Fast486WriteMemory(State, + (State->PrefixFlags & FAST486_PREFIX_SEG) ? + State->SegmentOverride : FAST486_REG_DS, + Offset, + &State->GeneralRegs[FAST486_REG_EAX].LowWord, + sizeof(USHORT)); } } } @@ -5438,8 +5259,6 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeSalc) /* Set all the bits of AL to CF */ State->GeneralRegs[FAST486_REG_EAX].LowByte = State->Flags.Cf ? 0xFF : 0x00; - - return TRUE; } FAST486_OPCODE_HANDLER(Fast486OpcodeMovs) @@ -5468,7 +5287,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeMovs) || (!AddressSize && (State->GeneralRegs[FAST486_REG_ECX].LowWord == 0))) { /* Do nothing */ - return TRUE; + return; } } @@ -5486,7 +5305,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeMovs) DataSize)) { /* Exception occurred */ - return FALSE; + return; } /* Write to the destination operand */ @@ -5498,7 +5317,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeMovs) DataSize)) { /* Exception occurred */ - return FALSE; + return; } /* Increment/decrement ESI and EDI */ @@ -5549,9 +5368,6 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeMovs) } } } - - /* Return success */ - return TRUE; } FAST486_OPCODE_HANDLER(Fast486OpcodeCmps) @@ -5582,7 +5398,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeCmps) || (!AddressSize && (State->GeneralRegs[FAST486_REG_ECX].LowWord == 0))) { /* Do nothing */ - return TRUE; + return; } } @@ -5604,7 +5420,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeCmps) DataSize)) { /* Exception occurred */ - return FALSE; + return; } /* Read from the second source operand */ @@ -5617,7 +5433,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeCmps) DataSize)) { /* Exception occurred */ - return FALSE; + return; } /* Calculate the result */ @@ -5698,9 +5514,6 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeCmps) State->InstPtr = State->SavedInstPtr; } } - - /* Return success */ - return TRUE; } FAST486_OPCODE_HANDLER(Fast486OpcodeStos) @@ -5784,7 +5597,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeStos) else State->GeneralRegs[FAST486_REG_ECX].LowWord = LOWORD(Count); /* Exception occurred */ - return FALSE; + return; } if (!State->Flags.Df) @@ -5819,7 +5632,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeStos) DataSize)) { /* Exception occurred */ - return FALSE; + return; } /* Increment/decrement EDI */ @@ -5834,9 +5647,6 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeStos) else State->GeneralRegs[FAST486_REG_EDI].LowWord -= DataSize; } } - - /* Return success */ - return TRUE; } FAST486_OPCODE_HANDLER(Fast486OpcodeLods) @@ -5869,7 +5679,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeLods) : State->GeneralRegs[FAST486_REG_ECX].LowWord; /* If the count is 0, do nothing */ - if (Count == 0) return TRUE; + if (Count == 0) return; /* Only the last entry will be loaded */ if (!State->Flags.Df) @@ -5898,7 +5708,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeLods) DataSize)) { /* Exception occurred */ - return FALSE; + return; } /* Increment/decrement ESI */ @@ -5912,9 +5722,6 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeLods) if (!State->Flags.Df) State->GeneralRegs[FAST486_REG_ESI].LowWord += DataSize; else State->GeneralRegs[FAST486_REG_ESI].LowWord -= DataSize; } - - /* Return success */ - return TRUE; } FAST486_OPCODE_HANDLER(Fast486OpcodeScas) @@ -5940,7 +5747,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeScas) || (!AddressSize && (State->GeneralRegs[FAST486_REG_ECX].LowWord == 0))) { /* Do nothing */ - return TRUE; + return; } } @@ -5962,7 +5769,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeScas) DataSize)) { /* Exception occurred */ - return FALSE; + return; } /* Calculate the result */ @@ -6027,9 +5834,6 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeScas) State->InstPtr = State->SavedInstPtr; } } - - /* Return success */ - return TRUE; } FAST486_OPCODE_HANDLER(Fast486OpcodeIns) @@ -6115,7 +5919,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeIns) else State->GeneralRegs[FAST486_REG_ECX].LowWord = LOWORD(Count); /* Exception occurred */ - return FALSE; + return; } if (!State->Flags.Df) @@ -6153,7 +5957,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeIns) DataSize)) { /* Exception occurred */ - return FALSE; + return; } /* Increment/decrement EDI */ @@ -6168,9 +5972,6 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeIns) else State->GeneralRegs[FAST486_REG_EDI].LowWord -= DataSize; } } - - /* Return success */ - return TRUE; } FAST486_OPCODE_HANDLER(Fast486OpcodeOuts) @@ -6230,7 +6031,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeOuts) else State->GeneralRegs[FAST486_REG_ECX].LowWord = LOWORD(Count); /* Exception occurred */ - return FALSE; + return; } if (State->Flags.Df) @@ -6291,7 +6092,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeOuts) DataSize)) { /* Exception occurred */ - return FALSE; + return; } /* Write to the I/O port */ @@ -6313,9 +6114,6 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeOuts) else State->GeneralRegs[FAST486_REG_ESI].LowWord -= DataSize; } } - - /* Return success */ - return TRUE; } /* EOF */ diff --git a/reactos/lib/fast486/opcodes.h b/reactos/lib/fast486/opcodes.h index 06de80ee138..193b38f5996 100644 --- a/reactos/lib/fast486/opcodes.h +++ b/reactos/lib/fast486/opcodes.h @@ -29,9 +29,9 @@ #define FAST486_NUM_OPCODE_HANDLERS 256 #define FAST486_OPCODE_WRITE_REG (1 << 1) #define FAST486_OPCODE_HANDLER(x) \ - BOOLEAN FASTCALL x(PFAST486_STATE State, UCHAR Opcode) + VOID FASTCALL x(PFAST486_STATE State, UCHAR Opcode) -typedef BOOLEAN (FASTCALL *FAST486_OPCODE_HANDLER_PROC)(PFAST486_STATE, UCHAR); +typedef VOID (FASTCALL *FAST486_OPCODE_HANDLER_PROC)(PFAST486_STATE, UCHAR); extern FAST486_OPCODE_HANDLER_PROC diff --git a/reactos/lib/fast486/opgroups.c b/reactos/lib/fast486/opgroups.c index 303fcd1958a..03eb09181d2 100644 --- a/reactos/lib/fast486/opgroups.c +++ b/reactos/lib/fast486/opgroups.c @@ -304,21 +304,21 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeGroup8082) if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm)) { /* Exception occurred */ - return FALSE; + return; } /* Fetch the immediate operand */ if (!Fast486FetchByte(State, &Immediate)) { /* Exception occurred */ - return FALSE; + return; } /* Read the operands */ if (!Fast486ReadModrmByteOperands(State, &ModRegRm, NULL, &Value)) { /* Exception occurred */ - return FALSE; + return; } /* Calculate the result */ @@ -327,10 +327,8 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeGroup8082) /* Unless this is CMP, write back the result */ if (ModRegRm.Register != 7) { - return Fast486WriteModrmByteOperands(State, &ModRegRm, FALSE, Value); + Fast486WriteModrmByteOperands(State, &ModRegRm, FALSE, Value); } - - return TRUE; } FAST486_OPCODE_HANDLER(Fast486OpcodeGroup81) @@ -346,7 +344,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeGroup81) if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm)) { /* Exception occurred */ - return FALSE; + return; } if (OperandSize) @@ -357,14 +355,14 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeGroup81) if (!Fast486FetchDword(State, &Immediate)) { /* Exception occurred */ - return FALSE; + return; } /* Read the operands */ if (!Fast486ReadModrmDwordOperands(State, &ModRegRm, NULL, &Value)) { /* Exception occurred */ - return FALSE; + return; } /* Calculate the result */ @@ -373,7 +371,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeGroup81) /* Unless this is CMP, write back the result */ if (ModRegRm.Register != 7) { - return Fast486WriteModrmDwordOperands(State, &ModRegRm, FALSE, Value); + Fast486WriteModrmDwordOperands(State, &ModRegRm, FALSE, Value); } } else @@ -384,14 +382,14 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeGroup81) if (!Fast486FetchWord(State, &Immediate)) { /* Exception occurred */ - return FALSE; + return; } /* Read the operands */ if (!Fast486ReadModrmWordOperands(State, &ModRegRm, NULL, &Value)) { /* Exception occurred */ - return FALSE; + return; } /* Calculate the result */ @@ -400,11 +398,9 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeGroup81) /* Unless this is CMP, write back the result */ if (ModRegRm.Register != 7) { - return Fast486WriteModrmWordOperands(State, &ModRegRm, FALSE, Value); + Fast486WriteModrmWordOperands(State, &ModRegRm, FALSE, Value); } } - - return TRUE; } FAST486_OPCODE_HANDLER(Fast486OpcodeGroup83) @@ -421,14 +417,14 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeGroup83) if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm)) { /* Exception occurred */ - return FALSE; + return; } /* Fetch the immediate operand */ if (!Fast486FetchByte(State, (PUCHAR)&ImmByte)) { /* Exception occurred */ - return FALSE; + return; } if (OperandSize) @@ -440,7 +436,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeGroup83) if (!Fast486ReadModrmDwordOperands(State, &ModRegRm, NULL, &Value)) { /* Exception occurred */ - return FALSE; + return; } /* Calculate the result */ @@ -449,7 +445,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeGroup83) /* Unless this is CMP, write back the result */ if (ModRegRm.Register != 7) { - return Fast486WriteModrmDwordOperands(State, &ModRegRm, FALSE, Value); + Fast486WriteModrmDwordOperands(State, &ModRegRm, FALSE, Value); } } else @@ -461,7 +457,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeGroup83) if (!Fast486ReadModrmWordOperands(State, &ModRegRm, NULL, &Value)) { /* Exception occurred */ - return FALSE; + return; } /* Calculate the result */ @@ -470,11 +466,9 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeGroup83) /* Unless this is CMP, write back the result */ if (ModRegRm.Register != 7) { - return Fast486WriteModrmWordOperands(State, &ModRegRm, FALSE, Value); + Fast486WriteModrmWordOperands(State, &ModRegRm, FALSE, Value); } } - - return TRUE; } FAST486_OPCODE_HANDLER(Fast486OpcodeGroup8F) @@ -492,7 +486,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeGroup8F) if (!Fast486StackPop(State, &Value)) { /* Exception occurred */ - return FALSE; + return; } if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm)) @@ -501,30 +495,18 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeGroup8F) if (OperandSize) State->GeneralRegs[FAST486_REG_ESP].Long -= sizeof(ULONG); else State->GeneralRegs[FAST486_REG_ESP].LowWord -= sizeof(USHORT); - return FALSE; + return; } if (ModRegRm.Register != 0) { /* Invalid */ Fast486Exception(State, FAST486_EXCEPTION_UD); - return FALSE; + return; } - if (OperandSize) - { - return Fast486WriteModrmDwordOperands(State, - &ModRegRm, - FALSE, - Value); - } - else - { - return Fast486WriteModrmWordOperands(State, - &ModRegRm, - FALSE, - LOWORD(Value)); - } + if (OperandSize) Fast486WriteModrmDwordOperands(State, &ModRegRm, FALSE, Value); + else Fast486WriteModrmWordOperands(State, &ModRegRm, FALSE, LOWORD(Value)); } FAST486_OPCODE_HANDLER(Fast486OpcodeGroupC0) @@ -538,21 +520,21 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeGroupC0) if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm)) { /* Exception occurred */ - return FALSE; + return; } /* Fetch the count */ if (!Fast486FetchByte(State, &Count)) { /* Exception occurred */ - return FALSE; + return; } /* Read the operands */ if (!Fast486ReadModrmByteOperands(State, &ModRegRm, NULL, &Value)) { /* Exception occurred */ - return FALSE; + return; } /* Calculate the result */ @@ -563,10 +545,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeGroupC0) Count)); /* Write back the result */ - return Fast486WriteModrmByteOperands(State, - &ModRegRm, - FALSE, - Value); + Fast486WriteModrmByteOperands(State, &ModRegRm, FALSE, Value); } FAST486_OPCODE_HANDLER(Fast486OpcodeGroupC1) @@ -583,14 +562,14 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeGroupC1) if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm)) { /* Exception occurred */ - return FALSE; + return; } /* Fetch the count */ if (!Fast486FetchByte(State, &Count)) { /* Exception occurred */ - return FALSE; + return; } if (OperandSize) @@ -601,7 +580,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeGroupC1) if (!Fast486ReadModrmDwordOperands(State, &ModRegRm, NULL, &Value)) { /* Exception occurred */ - return FALSE; + return; } /* Calculate the result */ @@ -612,7 +591,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeGroupC1) Count); /* Write back the result */ - return Fast486WriteModrmDwordOperands(State, &ModRegRm, FALSE, Value); + Fast486WriteModrmDwordOperands(State, &ModRegRm, FALSE, Value); } else { @@ -622,7 +601,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeGroupC1) if (!Fast486ReadModrmWordOperands(State, &ModRegRm, NULL, &Value)) { /* Exception occurred */ - return FALSE; + return; } /* Calculate the result */ @@ -633,7 +612,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeGroupC1) Count)); /* Write back the result */ - return Fast486WriteModrmWordOperands(State, &ModRegRm, FALSE, Value); + Fast486WriteModrmWordOperands(State, &ModRegRm, FALSE, Value); } } @@ -648,27 +627,24 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeGroupC6) if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm)) { /* Exception occurred */ - return FALSE; + return; } if (ModRegRm.Register != 0) { /* Invalid */ Fast486Exception(State, FAST486_EXCEPTION_UD); - return FALSE; + return; } /* Get the immediate operand */ if (!Fast486FetchByte(State, &Immediate)) { /* Exception occurred */ - return FALSE; + return; } - return Fast486WriteModrmByteOperands(State, - &ModRegRm, - FALSE, - Immediate); + Fast486WriteModrmByteOperands(State, &ModRegRm, FALSE, Immediate); } FAST486_OPCODE_HANDLER(Fast486OpcodeGroupC7) @@ -684,14 +660,14 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeGroupC7) if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm)) { /* Exception occurred */ - return FALSE; + return; } if (ModRegRm.Register != 0) { /* Invalid */ Fast486Exception(State, FAST486_EXCEPTION_UD); - return FALSE; + return; } if (OperandSize) @@ -702,13 +678,10 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeGroupC7) if (!Fast486FetchDword(State, &Immediate)) { /* Exception occurred */ - return FALSE; + return; } - return Fast486WriteModrmDwordOperands(State, - &ModRegRm, - FALSE, - Immediate); + Fast486WriteModrmDwordOperands(State, &ModRegRm, FALSE, Immediate); } else { @@ -718,13 +691,10 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeGroupC7) if (!Fast486FetchWord(State, &Immediate)) { /* Exception occurred */ - return FALSE; + return; } - return Fast486WriteModrmWordOperands(State, - &ModRegRm, - FALSE, - Immediate); + Fast486WriteModrmWordOperands(State, &ModRegRm, FALSE, Immediate); } } @@ -739,24 +709,21 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeGroupD0) if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm)) { /* Exception occurred */ - return FALSE; + return; } /* Read the operands */ if (!Fast486ReadModrmByteOperands(State, &ModRegRm, NULL, &Value)) { /* Exception occurred */ - return FALSE; + return; } /* Calculate the result */ Value = LOBYTE(Fast486RotateOperation(State, ModRegRm.Register, Value, 8, 1)); /* Write back the result */ - return Fast486WriteModrmByteOperands(State, - &ModRegRm, - FALSE, - Value); + Fast486WriteModrmByteOperands(State, &ModRegRm, FALSE, Value); } @@ -773,7 +740,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeGroupD1) if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm)) { /* Exception occurred */ - return FALSE; + return; } if (OperandSize) @@ -784,14 +751,14 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeGroupD1) if (!Fast486ReadModrmDwordOperands(State, &ModRegRm, NULL, &Value)) { /* Exception occurred */ - return FALSE; + return; } /* Calculate the result */ Value = Fast486RotateOperation(State, ModRegRm.Register, Value, 32, 1); /* Write back the result */ - return Fast486WriteModrmDwordOperands(State, &ModRegRm, FALSE, Value); + Fast486WriteModrmDwordOperands(State, &ModRegRm, FALSE, Value); } else { @@ -801,14 +768,14 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeGroupD1) if (!Fast486ReadModrmWordOperands(State, &ModRegRm, NULL, &Value)) { /* Exception occurred */ - return FALSE; + return; } /* Calculate the result */ Value = LOWORD(Fast486RotateOperation(State, ModRegRm.Register, Value, 16, 1)); /* Write back the result */ - return Fast486WriteModrmWordOperands(State, &ModRegRm, FALSE, Value); + Fast486WriteModrmWordOperands(State, &ModRegRm, FALSE, Value); } } @@ -823,14 +790,14 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeGroupD2) if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm)) { /* Exception occurred */ - return FALSE; + return; } /* Read the operands */ if (!Fast486ReadModrmByteOperands(State, &ModRegRm, NULL, &Value)) { /* Exception occurred */ - return FALSE; + return; } /* Calculate the result */ @@ -841,10 +808,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeGroupD2) State->GeneralRegs[FAST486_REG_ECX].LowByte)); /* Write back the result */ - return Fast486WriteModrmByteOperands(State, - &ModRegRm, - FALSE, - Value); + Fast486WriteModrmByteOperands(State, &ModRegRm, FALSE, Value); } FAST486_OPCODE_HANDLER(Fast486OpcodeGroupD3) @@ -860,7 +824,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeGroupD3) if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm)) { /* Exception occurred */ - return FALSE; + return; } if (OperandSize) @@ -871,7 +835,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeGroupD3) if (!Fast486ReadModrmDwordOperands(State, &ModRegRm, NULL, &Value)) { /* Exception occurred */ - return FALSE; + return; } /* Calculate the result */ @@ -882,7 +846,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeGroupD3) State->GeneralRegs[FAST486_REG_ECX].LowByte); /* Write back the result */ - return Fast486WriteModrmDwordOperands(State, &ModRegRm, FALSE, Value); + Fast486WriteModrmDwordOperands(State, &ModRegRm, FALSE, Value); } else { @@ -892,7 +856,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeGroupD3) if (!Fast486ReadModrmWordOperands(State, &ModRegRm, NULL, &Value)) { /* Exception occurred */ - return FALSE; + return; } /* Calculate the result */ @@ -903,7 +867,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeGroupD3) State->GeneralRegs[FAST486_REG_ECX].LowByte)); /* Write back the result */ - return Fast486WriteModrmWordOperands(State, &ModRegRm, FALSE, Value); + Fast486WriteModrmWordOperands(State, &ModRegRm, FALSE, Value); } } @@ -918,14 +882,14 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeGroupF6) if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm)) { /* Exception occurred */ - return FALSE; + return; } /* Read the operands */ if (!Fast486ReadModrmByteOperands(State, &ModRegRm, NULL, &Value)) { /* Exception occurred */ - return FALSE; + return; } switch (ModRegRm.Register) @@ -940,7 +904,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeGroupF6) if (!Fast486FetchByte(State, &Immediate)) { /* Exception occurred */ - return FALSE; + return; } /* Calculate the result */ @@ -960,7 +924,9 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeGroupF6) case 2: { /* Write back the result */ - return Fast486WriteModrmByteOperands(State, &ModRegRm, FALSE, ~Value); + Fast486WriteModrmByteOperands(State, &ModRegRm, FALSE, ~Value); + + break; } /* NEG */ @@ -978,7 +944,9 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeGroupF6) State->Flags.Pf = Fast486CalculateParity(Result); /* Write back the result */ - return Fast486WriteModrmByteOperands(State, &ModRegRm, FALSE, Result); + Fast486WriteModrmByteOperands(State, &ModRegRm, FALSE, Result); + + break; } /* MUL */ @@ -1018,7 +986,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeGroupF6) { /* Divide error */ Fast486Exception(State, FAST486_EXCEPTION_DE); - return FALSE; + return; } Quotient = State->GeneralRegs[FAST486_REG_EAX].LowWord / Value; @@ -1040,7 +1008,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeGroupF6) { /* Divide error */ Fast486Exception(State, FAST486_EXCEPTION_DE); - return FALSE; + return; } Quotient = (SHORT)State->GeneralRegs[FAST486_REG_EAX].LowWord / (CHAR)Value; @@ -1053,8 +1021,6 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeGroupF6) break; } } - - return TRUE; } FAST486_OPCODE_HANDLER(Fast486OpcodeGroupF7) @@ -1071,7 +1037,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeGroupF7) if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm)) { /* Exception occurred */ - return FALSE; + return; } /* Set the sign flag */ @@ -1085,7 +1051,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeGroupF7) if (!Fast486ReadModrmDwordOperands(State, &ModRegRm, NULL, &Value)) { /* Exception occurred */ - return FALSE; + return; } } else @@ -1094,7 +1060,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeGroupF7) if (!Fast486ReadModrmWordOperands(State, &ModRegRm, NULL, (PUSHORT)&Value)) { /* Exception occurred */ - return FALSE; + return; } } @@ -1112,7 +1078,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeGroupF7) if (!Fast486FetchDword(State, &Immediate)) { /* Exception occurred */ - return FALSE; + return; } } else @@ -1121,7 +1087,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeGroupF7) if (!Fast486FetchWord(State, (PUSHORT)&Immediate)) { /* Exception occurred */ - return FALSE; + return; } } @@ -1145,13 +1111,15 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeGroupF7) if (OperandSize) { /* 32-bit */ - return Fast486WriteModrmDwordOperands(State, &ModRegRm, FALSE, ~Value); + Fast486WriteModrmDwordOperands(State, &ModRegRm, FALSE, ~Value); } else { /* 16-bit */ - return Fast486WriteModrmWordOperands(State, &ModRegRm, FALSE, LOWORD(~Value)); + Fast486WriteModrmWordOperands(State, &ModRegRm, FALSE, LOWORD(~Value)); } + + break; } /* NEG */ @@ -1173,13 +1141,15 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeGroupF7) if (OperandSize) { /* 32-bit */ - return Fast486WriteModrmDwordOperands(State, &ModRegRm, FALSE, Result); + Fast486WriteModrmDwordOperands(State, &ModRegRm, FALSE, Result); } else { /* 16-bit */ - return Fast486WriteModrmWordOperands(State, &ModRegRm, FALSE, LOWORD(Result)); + Fast486WriteModrmWordOperands(State, &ModRegRm, FALSE, LOWORD(Result)); } + + break; } /* MUL */ @@ -1247,7 +1217,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeGroupF7) { /* Divide error */ Fast486Exception(State, FAST486_EXCEPTION_DE); - return FALSE; + return; } if (OperandSize) @@ -1283,7 +1253,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeGroupF7) { /* Divide error */ Fast486Exception(State, FAST486_EXCEPTION_DE); - return FALSE; + return; } if (OperandSize) @@ -1312,8 +1282,6 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeGroupF7) break; } } - - return TRUE; } FAST486_OPCODE_HANDLER(Fast486OpcodeGroupFE) @@ -1327,21 +1295,21 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeGroupFE) if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm)) { /* Exception occurred */ - return FALSE; + return; } if (ModRegRm.Register > 1) { /* Invalid */ Fast486Exception(State, FAST486_EXCEPTION_UD); - return FALSE; + return; } /* Read the operands */ if (!Fast486ReadModrmByteOperands(State, &ModRegRm, NULL, &Value)) { /* Exception occurred */ - return FALSE; + return; } if (ModRegRm.Register == 0) @@ -1365,10 +1333,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeGroupFE) State->Flags.Pf = Fast486CalculateParity(Value); /* Write back the result */ - return Fast486WriteModrmByteOperands(State, - &ModRegRm, - FALSE, - Value); + Fast486WriteModrmByteOperands(State, &ModRegRm, FALSE, Value); } FAST486_OPCODE_HANDLER(Fast486OpcodeGroupFF) @@ -1384,14 +1349,14 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeGroupFF) if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm)) { /* Exception occurred */ - return FALSE; + return; } if (ModRegRm.Register == 7) { /* Invalid */ Fast486Exception(State, FAST486_EXCEPTION_UD); - return FALSE; + return; } /* Read the operands */ @@ -1402,7 +1367,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeGroupFF) if (!Fast486ReadModrmDwordOperands(State, &ModRegRm, NULL, &Value)) { /* Exception occurred */ - return FALSE; + return; } if (ModRegRm.Register == 0) @@ -1425,7 +1390,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeGroupFF) if (!Fast486StackPush(State, State->InstPtr.Long)) { /* Exception occurred */ - return FALSE; + return; } /* Set the EIP to the address */ @@ -1452,28 +1417,28 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeGroupFF) sizeof(USHORT))) { /* Exception occurred */ - return FALSE; + return; } /* Push the current value of CS */ if (!Fast486StackPush(State, State->SegmentRegs[FAST486_REG_CS].Selector)) { /* Exception occurred */ - return FALSE; + return; } /* Push the current value of EIP */ if (!Fast486StackPush(State, State->InstPtr.Long)) { /* Exception occurred */ - return FALSE; + return; } /* Load the new code segment */ if (!Fast486LoadSegment(State, FAST486_REG_CS, Selector)) { /* Exception occurred */ - return FALSE; + return; } /* Set the EIP to the address */ @@ -1505,14 +1470,14 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeGroupFF) sizeof(USHORT))) { /* Exception occurred */ - return FALSE; + return; } /* Load the new code segment */ if (!Fast486LoadSegment(State, FAST486_REG_CS, Selector)) { /* Exception occurred */ - return FALSE; + return; } /* Set the EIP to the address */ @@ -1521,7 +1486,8 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeGroupFF) else if (ModRegRm.Register == 6) { /* Push the value on to the stack */ - return Fast486StackPush(State, Value); + Fast486StackPush(State, Value); + return; } if (ModRegRm.Register <= 1) @@ -1532,10 +1498,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeGroupFF) State->Flags.Pf = Fast486CalculateParity(Value); /* Write back the result */ - return Fast486WriteModrmDwordOperands(State, - &ModRegRm, - FALSE, - Value); + Fast486WriteModrmDwordOperands(State, &ModRegRm, FALSE, Value); } } else @@ -1545,7 +1508,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeGroupFF) if (!Fast486ReadModrmWordOperands(State, &ModRegRm, NULL, &Value)) { /* Exception occurred */ - return FALSE; + return; } if (ModRegRm.Register == 0) @@ -1568,7 +1531,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeGroupFF) if (!Fast486StackPush(State, State->InstPtr.LowWord)) { /* Exception occurred */ - return FALSE; + return; } /* Set the IP to the address */ @@ -1598,28 +1561,28 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeGroupFF) sizeof(USHORT))) { /* Exception occurred */ - return FALSE; + return; } /* Push the current value of CS */ if (!Fast486StackPush(State, State->SegmentRegs[FAST486_REG_CS].Selector)) { /* Exception occurred */ - return FALSE; + return; } /* Push the current value of IP */ if (!Fast486StackPush(State, State->InstPtr.LowWord)) { /* Exception occurred */ - return FALSE; + return; } /* Load the new code segment */ if (!Fast486LoadSegment(State, FAST486_REG_CS, Selector)) { /* Exception occurred */ - return FALSE; + return; } /* Set the IP to the address */ @@ -1657,14 +1620,14 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeGroupFF) sizeof(USHORT))) { /* Exception occurred */ - return FALSE; + return; } /* Load the new code segment */ if (!Fast486LoadSegment(State, FAST486_REG_CS, Selector)) { /* Exception occurred */ - return FALSE; + return; } /* Set the IP to the address */ @@ -1676,13 +1639,14 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeGroupFF) else if (ModRegRm.Register == 6) { /* Push the value on to the stack */ - return Fast486StackPush(State, Value); + Fast486StackPush(State, Value); + return; } else { /* Invalid */ Fast486Exception(State, FAST486_EXCEPTION_UD); - return FALSE; + return; } if (ModRegRm.Register <= 1) @@ -1693,17 +1657,11 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeGroupFF) State->Flags.Pf = Fast486CalculateParity(Value); /* Write back the result */ - return Fast486WriteModrmWordOperands(State, - &ModRegRm, - FALSE, - Value); + Fast486WriteModrmWordOperands(State, &ModRegRm, FALSE, Value); } } - - return TRUE; } - FAST486_OPCODE_HANDLER(Fast486ExtOpcodeGroup0F00) { FAST486_MOD_REG_RM ModRegRm; @@ -1715,7 +1673,7 @@ FAST486_OPCODE_HANDLER(Fast486ExtOpcodeGroup0F00) if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm)) { /* Exception occurred */ - return FALSE; + return; } /* Check which operation this is */ @@ -1729,13 +1687,11 @@ FAST486_OPCODE_HANDLER(Fast486ExtOpcodeGroup0F00) || State->Flags.Vm) { Fast486Exception(State, FAST486_EXCEPTION_UD); - return FALSE; + return; } - return Fast486WriteModrmWordOperands(State, - &ModRegRm, - FALSE, - State->Ldtr.Selector); + Fast486WriteModrmWordOperands(State, &ModRegRm, FALSE, State->Ldtr.Selector); + break; } /* STR */ @@ -1746,13 +1702,11 @@ FAST486_OPCODE_HANDLER(Fast486ExtOpcodeGroup0F00) || State->Flags.Vm) { Fast486Exception(State, FAST486_EXCEPTION_UD); - return FALSE; + return; } - return Fast486WriteModrmWordOperands(State, - &ModRegRm, - FALSE, - State->TaskReg.Selector); + Fast486WriteModrmWordOperands(State, &ModRegRm, FALSE, State->TaskReg.Selector); + break; } /* LLDT */ @@ -1766,14 +1720,14 @@ FAST486_OPCODE_HANDLER(Fast486ExtOpcodeGroup0F00) || State->Flags.Vm) { Fast486Exception(State, FAST486_EXCEPTION_UD); - return FALSE; + return; } /* This is a privileged instruction */ if (Fast486GetCurrentPrivLevel(State) != 0) { Fast486Exception(State, FAST486_EXCEPTION_GP); - return FALSE; + return; } if (!Fast486ReadModrmWordOperands(State, @@ -1782,14 +1736,14 @@ FAST486_OPCODE_HANDLER(Fast486ExtOpcodeGroup0F00) &Selector)) { /* Exception occurred */ - return FALSE; + return; } /* Make sure the GDT contains the entry */ if (GET_SEGMENT_INDEX(Selector) >= (State->Gdtr.Size + 1)) { Fast486ExceptionWithErrorCode(State, FAST486_EXCEPTION_GP, Selector); - return FALSE; + return; } /* Read the GDT */ @@ -1800,26 +1754,26 @@ FAST486_OPCODE_HANDLER(Fast486ExtOpcodeGroup0F00) sizeof(GdtEntry))) { /* Exception occurred */ - return FALSE; + return; } if (GET_SEGMENT_INDEX(Selector) == 0) { RtlZeroMemory(&State->Ldtr, sizeof(State->Ldtr)); - return TRUE; + return; } if (!GdtEntry.Present) { Fast486ExceptionWithErrorCode(State, FAST486_EXCEPTION_NP, Selector); - return FALSE; + return; } if (GdtEntry.Signature != FAST486_LDT_SIGNATURE) { /* This is not a LDT descriptor */ Fast486ExceptionWithErrorCode(State, FAST486_EXCEPTION_GP, Selector); - return FALSE; + return; } /* Update the LDTR */ @@ -1828,7 +1782,7 @@ FAST486_OPCODE_HANDLER(Fast486ExtOpcodeGroup0F00) State->Ldtr.Limit = GdtEntry.Limit | (GdtEntry.LimitHigh << 16); if (GdtEntry.Granularity) State->Ldtr.Limit <<= 12; - return TRUE; + break; } /* LTR */ @@ -1842,14 +1796,14 @@ FAST486_OPCODE_HANDLER(Fast486ExtOpcodeGroup0F00) || State->Flags.Vm) { Fast486Exception(State, FAST486_EXCEPTION_UD); - return FALSE; + return; } /* This is a privileged instruction */ if (Fast486GetCurrentPrivLevel(State) != 0) { Fast486Exception(State, FAST486_EXCEPTION_GP); - return FALSE; + return; } if (!Fast486ReadModrmWordOperands(State, @@ -1858,14 +1812,14 @@ FAST486_OPCODE_HANDLER(Fast486ExtOpcodeGroup0F00) &Selector)) { /* Exception occurred */ - return FALSE; + return; } /* Make sure the GDT contains the entry */ if (GET_SEGMENT_INDEX(Selector) >= (State->Gdtr.Size + 1)) { Fast486ExceptionWithErrorCode(State, FAST486_EXCEPTION_GP, Selector); - return FALSE; + return; } /* Read the GDT */ @@ -1876,26 +1830,26 @@ FAST486_OPCODE_HANDLER(Fast486ExtOpcodeGroup0F00) sizeof(GdtEntry))) { /* Exception occurred */ - return FALSE; + return; } if (GET_SEGMENT_INDEX(Selector) == 0) { Fast486Exception(State, FAST486_EXCEPTION_GP); - return FALSE; + return; } if (!GdtEntry.Present) { Fast486ExceptionWithErrorCode(State, FAST486_EXCEPTION_NP, Selector); - return FALSE; + return; } if (GdtEntry.Signature != FAST486_TSS_SIGNATURE) { /* This is not a TSS descriptor */ Fast486ExceptionWithErrorCode(State, FAST486_EXCEPTION_GP, Selector); - return FALSE; + return; } /* Update the TR */ @@ -1905,7 +1859,7 @@ FAST486_OPCODE_HANDLER(Fast486ExtOpcodeGroup0F00) if (GdtEntry.Granularity) State->TaskReg.Limit <<= 12; State->TaskReg.Busy = TRUE; - return TRUE; + break; } /* VERR/VERW */ @@ -1920,14 +1874,14 @@ FAST486_OPCODE_HANDLER(Fast486ExtOpcodeGroup0F00) || State->Flags.Vm) { Fast486Exception(State, FAST486_EXCEPTION_UD); - return FALSE; + return; } /* This is a privileged instruction */ if (Fast486GetCurrentPrivLevel(State) != 0) { Fast486Exception(State, FAST486_EXCEPTION_GP); - return FALSE; + return; } if (!Fast486ReadModrmWordOperands(State, @@ -1936,7 +1890,7 @@ FAST486_OPCODE_HANDLER(Fast486ExtOpcodeGroup0F00) &Selector)) { /* Exception occurred */ - return FALSE; + return; } if (!(Selector & SEGMENT_TABLE_INDICATOR)) @@ -1946,7 +1900,7 @@ FAST486_OPCODE_HANDLER(Fast486ExtOpcodeGroup0F00) { /* Clear ZF */ State->Flags.Zf = FALSE; - return TRUE; + return; } /* Read the GDT */ @@ -1957,7 +1911,7 @@ FAST486_OPCODE_HANDLER(Fast486ExtOpcodeGroup0F00) sizeof(GdtEntry))) { /* Exception occurred */ - return FALSE; + return; } } else @@ -1967,7 +1921,7 @@ FAST486_OPCODE_HANDLER(Fast486ExtOpcodeGroup0F00) { /* Clear ZF */ State->Flags.Zf = FALSE; - return TRUE; + return; } /* Read the LDT */ @@ -1978,7 +1932,7 @@ FAST486_OPCODE_HANDLER(Fast486ExtOpcodeGroup0F00) sizeof(GdtEntry))) { /* Exception occurred */ - return FALSE; + return; } } @@ -2003,14 +1957,13 @@ FAST486_OPCODE_HANDLER(Fast486ExtOpcodeGroup0F00) && (GdtEntry.Dpl <= Fast486GetCurrentPrivLevel(State))); - return TRUE; + break; } /* Invalid */ default: { Fast486Exception(State, FAST486_EXCEPTION_UD); - return FALSE; } } } @@ -2032,7 +1985,7 @@ FAST486_OPCODE_HANDLER(Fast486ExtOpcodeGroup0F01) if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm)) { /* Exception occurred */ - return FALSE; + return; } /* Check for the segment override */ @@ -2052,7 +2005,7 @@ FAST486_OPCODE_HANDLER(Fast486ExtOpcodeGroup0F01) { /* The second operand must be a memory location */ Fast486Exception(State, FAST486_EXCEPTION_UD); - return FALSE; + return; } /* Fill the 6-byte table register */ @@ -2061,11 +2014,13 @@ FAST486_OPCODE_HANDLER(Fast486ExtOpcodeGroup0F01) *((PULONG)&TableReg[sizeof(USHORT)]) = State->Gdtr.Address; /* Store the GDTR */ - return Fast486WriteMemory(State, - Segment, - ModRegRm.MemoryAddress, - TableReg, - sizeof(TableReg)); + Fast486WriteMemory(State, + Segment, + ModRegRm.MemoryAddress, + TableReg, + sizeof(TableReg)); + + break; } /* SIDT */ @@ -2075,7 +2030,7 @@ FAST486_OPCODE_HANDLER(Fast486ExtOpcodeGroup0F01) { /* The second operand must be a memory location */ Fast486Exception(State, FAST486_EXCEPTION_UD); - return FALSE; + return; } /* Fill the 6-byte table register */ @@ -2084,11 +2039,13 @@ FAST486_OPCODE_HANDLER(Fast486ExtOpcodeGroup0F01) *((PULONG)&TableReg[sizeof(USHORT)]) = State->Idtr.Address; /* Store the IDTR */ - return Fast486WriteMemory(State, - Segment, - ModRegRm.MemoryAddress, - TableReg, - sizeof(TableReg)); + Fast486WriteMemory(State, + Segment, + ModRegRm.MemoryAddress, + TableReg, + sizeof(TableReg)); + + break; } /* LGDT */ @@ -2098,14 +2055,14 @@ FAST486_OPCODE_HANDLER(Fast486ExtOpcodeGroup0F01) if (Fast486GetCurrentPrivLevel(State) != 0) { Fast486Exception(State, FAST486_EXCEPTION_GP); - return FALSE; + return; } if (!ModRegRm.Memory) { /* The second operand must be a memory location */ Fast486Exception(State, FAST486_EXCEPTION_UD); - return FALSE; + return; } /* Read the new GDTR */ @@ -2117,7 +2074,7 @@ FAST486_OPCODE_HANDLER(Fast486ExtOpcodeGroup0F01) sizeof(TableReg))) { /* Exception occurred */ - return FALSE; + return; } /* Load the new GDT */ @@ -2128,7 +2085,7 @@ FAST486_OPCODE_HANDLER(Fast486ExtOpcodeGroup0F01) /* In 16-bit mode the highest byte is masked out */ if (!OperandSize) State->Gdtr.Address &= 0x00FFFFFF; - return TRUE; + break; } /* LIDT */ @@ -2138,14 +2095,14 @@ FAST486_OPCODE_HANDLER(Fast486ExtOpcodeGroup0F01) if (Fast486GetCurrentPrivLevel(State) != 0) { Fast486Exception(State, FAST486_EXCEPTION_GP); - return FALSE; + return; } if (!ModRegRm.Memory) { /* The second operand must be a memory location */ Fast486Exception(State, FAST486_EXCEPTION_UD); - return FALSE; + return; } /* Read the new IDTR */ @@ -2157,7 +2114,7 @@ FAST486_OPCODE_HANDLER(Fast486ExtOpcodeGroup0F01) sizeof(TableReg))) { /* Exception occurred */ - return FALSE; + return; } /* Load the new IDT */ @@ -2168,17 +2125,19 @@ FAST486_OPCODE_HANDLER(Fast486ExtOpcodeGroup0F01) /* In 16-bit mode the highest byte is masked out */ if (!OperandSize) State->Idtr.Address &= 0x00FFFFFF; - return TRUE; + break; } /* SMSW */ case 4: { /* Store the lower 16 bits (Machine Status Word) of CR0 */ - return Fast486WriteModrmWordOperands(State, - &ModRegRm, - FALSE, - LOWORD(State->ControlRegisters[FAST486_REG_CR0])); + Fast486WriteModrmWordOperands(State, + &ModRegRm, + FALSE, + LOWORD(State->ControlRegisters[FAST486_REG_CR0])); + + break; } /* LMSW */ @@ -2190,14 +2149,14 @@ FAST486_OPCODE_HANDLER(Fast486ExtOpcodeGroup0F01) if (Fast486GetCurrentPrivLevel(State) != 0) { Fast486Exception(State, FAST486_EXCEPTION_GP); - return FALSE; + return; } /* Read the new Machine Status Word */ if (!Fast486ReadModrmWordOperands(State, &ModRegRm, NULL, &MachineStatusWord)) { /* Exception occurred */ - return FALSE; + return; } /* This instruction cannot be used to return to real mode */ @@ -2205,28 +2164,27 @@ FAST486_OPCODE_HANDLER(Fast486ExtOpcodeGroup0F01) && !(MachineStatusWord & FAST486_CR0_PE)) { Fast486Exception(State, FAST486_EXCEPTION_GP); - return FALSE; + return; } /* Set the lowest 4 bits */ State->ControlRegisters[FAST486_REG_CR0] &= 0xFFFFFFF0; State->ControlRegisters[FAST486_REG_CR0] |= MachineStatusWord & 0x0F; - return TRUE; + break; } /* INVLPG */ case 7: { UNIMPLEMENTED; - return FALSE; + break; } /* Invalid */ default: { Fast486Exception(State, FAST486_EXCEPTION_UD); - return FALSE; } } } @@ -2241,12 +2199,12 @@ FAST486_OPCODE_HANDLER(Fast486ExtOpcodeGroup0FB9) if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm)) { /* Exception occurred */ - return FALSE; + return; } /* All of them are reserved (UD2) */ Fast486Exception(State, FAST486_EXCEPTION_UD); - return FALSE; + return; } FAST486_OPCODE_HANDLER(Fast486ExtOpcodeGroup0FBA) @@ -2268,21 +2226,21 @@ FAST486_OPCODE_HANDLER(Fast486ExtOpcodeGroup0FBA) if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm)) { /* Exception occurred */ - return FALSE; + return; } if (ModRegRm.Register < 4) { /* Invalid */ Fast486Exception(State, FAST486_EXCEPTION_UD); - return FALSE; + return; } /* Get the bit number */ if (!Fast486FetchByte(State, &BitNumber)) { /* Exception occurred */ - return FALSE; + return; } if (ModRegRm.Memory) @@ -2305,7 +2263,7 @@ FAST486_OPCODE_HANDLER(Fast486ExtOpcodeGroup0FBA) if (!Fast486ReadModrmDwordOperands(State, &ModRegRm, NULL, &Value)) { /* Exception occurred */ - return FALSE; + return; } /* Set CF to the bit value */ @@ -2333,7 +2291,7 @@ FAST486_OPCODE_HANDLER(Fast486ExtOpcodeGroup0FBA) if (!Fast486WriteModrmDwordOperands(State, &ModRegRm, FALSE, Value)) { /* Exception occurred */ - return FALSE; + return; } } } @@ -2345,7 +2303,7 @@ FAST486_OPCODE_HANDLER(Fast486ExtOpcodeGroup0FBA) if (!Fast486ReadModrmWordOperands(State, &ModRegRm, NULL, &Value)) { /* Exception occurred */ - return FALSE; + return; } /* Set CF to the bit value */ @@ -2373,13 +2331,10 @@ FAST486_OPCODE_HANDLER(Fast486ExtOpcodeGroup0FBA) if (!Fast486WriteModrmWordOperands(State, &ModRegRm, FALSE, Value)) { /* Exception occurred */ - return FALSE; + return; } } } - - /* Return success */ - return TRUE; } /* EOF */ From 147bfd92e5000d5e3db933173cdfe72b43a44e73 Mon Sep 17 00:00:00 2001 From: Amine Khaldi Date: Sat, 25 Oct 2014 17:46:33 +0000 Subject: [PATCH 26/91] [ADVAPI32] * Move a couple functions from sec.c to security.c. CORE-8540 svn path=/trunk/; revision=64989 --- reactos/dll/win32/advapi32/sec/sec.c | 64 ---------------------- reactos/dll/win32/advapi32/wine/security.c | 60 ++++++++++++++++++++ 2 files changed, 60 insertions(+), 64 deletions(-) diff --git a/reactos/dll/win32/advapi32/sec/sec.c b/reactos/dll/win32/advapi32/sec/sec.c index d62edc39481..9b84496a1b7 100644 --- a/reactos/dll/win32/advapi32/sec/sec.c +++ b/reactos/dll/win32/advapi32/sec/sec.c @@ -168,29 +168,6 @@ GetSecurityDescriptorSacl(PSECURITY_DESCRIPTOR pSecurityDescriptor, return TRUE; } - -/* - * @implemented - */ -BOOL -WINAPI -InitializeSecurityDescriptor(PSECURITY_DESCRIPTOR pSecurityDescriptor, - DWORD dwRevision) -{ - NTSTATUS Status; - - Status = RtlCreateSecurityDescriptor(pSecurityDescriptor, - dwRevision); - if (!NT_SUCCESS(Status)) - { - SetLastError(RtlNtStatusToDosError(Status)); - return FALSE; - } - - return TRUE; -} - - /* * @implemented */ @@ -207,47 +184,6 @@ IsValidSecurityDescriptor(PSECURITY_DESCRIPTOR pSecurityDescriptor) return (BOOL)Result; } - -/* - * @implemented - */ -BOOL -WINAPI -MakeAbsoluteSD(PSECURITY_DESCRIPTOR pSelfRelativeSecurityDescriptor, - PSECURITY_DESCRIPTOR pAbsoluteSecurityDescriptor, - LPDWORD lpdwAbsoluteSecurityDescriptorSize, - PACL pDacl, - LPDWORD lpdwDaclSize, - PACL pSacl, - LPDWORD lpdwSaclSize, - PSID pOwner, - LPDWORD lpdwOwnerSize, - PSID pPrimaryGroup, - LPDWORD lpdwPrimaryGroupSize) -{ - NTSTATUS Status; - - Status = RtlSelfRelativeToAbsoluteSD(pSelfRelativeSecurityDescriptor, - pAbsoluteSecurityDescriptor, - lpdwAbsoluteSecurityDescriptorSize, - pDacl, - lpdwDaclSize, - pSacl, - lpdwSaclSize, - pOwner, - lpdwOwnerSize, - pPrimaryGroup, - lpdwPrimaryGroupSize); - if (!NT_SUCCESS(Status)) - { - SetLastError(RtlNtStatusToDosError(Status)); - return FALSE; - } - - return TRUE; -} - - /* * @implemented */ diff --git a/reactos/dll/win32/advapi32/wine/security.c b/reactos/dll/win32/advapi32/wine/security.c index ad8a0c0a8b4..a8f16d1aa46 100644 --- a/reactos/dll/win32/advapi32/wine/security.c +++ b/reactos/dll/win32/advapi32/wine/security.c @@ -854,6 +854,66 @@ GetLengthSid(PSID pSid) return (DWORD)RtlLengthSid(pSid); } +/* + * @implemented + */ +BOOL +WINAPI +InitializeSecurityDescriptor(PSECURITY_DESCRIPTOR pSecurityDescriptor, + DWORD dwRevision) +{ + NTSTATUS Status; + + Status = RtlCreateSecurityDescriptor(pSecurityDescriptor, + dwRevision); + if (!NT_SUCCESS(Status)) + { + SetLastError(RtlNtStatusToDosError(Status)); + return FALSE; + } + + return TRUE; +} + +/* + * @implemented + */ +BOOL +WINAPI +MakeAbsoluteSD(PSECURITY_DESCRIPTOR pSelfRelativeSecurityDescriptor, + PSECURITY_DESCRIPTOR pAbsoluteSecurityDescriptor, + LPDWORD lpdwAbsoluteSecurityDescriptorSize, + PACL pDacl, + LPDWORD lpdwDaclSize, + PACL pSacl, + LPDWORD lpdwSaclSize, + PSID pOwner, + LPDWORD lpdwOwnerSize, + PSID pPrimaryGroup, + LPDWORD lpdwPrimaryGroupSize) +{ + NTSTATUS Status; + + Status = RtlSelfRelativeToAbsoluteSD(pSelfRelativeSecurityDescriptor, + pAbsoluteSecurityDescriptor, + lpdwAbsoluteSecurityDescriptorSize, + pDacl, + lpdwDaclSize, + pSacl, + lpdwSaclSize, + pOwner, + lpdwOwnerSize, + pPrimaryGroup, + lpdwPrimaryGroupSize); + if (!NT_SUCCESS(Status)) + { + SetLastError(RtlNtStatusToDosError(Status)); + return FALSE; + } + + return TRUE; +} + /****************************************************************************** * GetKernelObjectSecurity [ADVAPI32.@] */ From 34a323186d913efada84186a9cd1d627cb52bf99 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Gardou?= Date: Sat, 25 Oct 2014 18:11:11 +0000 Subject: [PATCH 27/91] [USER32] - Fix a stupid buffer overflow I introduced in r64967. - Take BITMAPCOREINFO into account when loading a cursor from file. svn path=/trunk/; revision=64990 --- .../user/user32/windows/cursoricon_new.c | 23 ++++++++++++------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/reactos/win32ss/user/user32/windows/cursoricon_new.c b/reactos/win32ss/user/user32/windows/cursoricon_new.c index 6e024620edf..a20d2d78111 100644 --- a/reactos/win32ss/user/user32/windows/cursoricon_new.c +++ b/reactos/win32ss/user/user32/windows/cursoricon_new.c @@ -254,7 +254,7 @@ create_alpha_bitmap( HDC hdc = NULL, hdcScreen; unsigned char *ptr; void *bits = NULL; - int i; + size_t size; hdcScreen = CreateDCW(DISPLAYW, NULL, NULL, NULL); if (!hdcScreen) @@ -270,12 +270,16 @@ create_alpha_bitmap( { BITMAP bm; BITMAPINFO *info = NULL; + + TRACE("Creating alpha bitmap from existing bitmap.\n"); if (!GetObjectW( color, sizeof(bm), &bm )) goto done; if (bm.bmBitsPixel != 32) goto done; + size = get_dib_image_size(bm.bmWidth, bm.bmHeight, 32); + info = HeapAlloc(GetProcessHeap(), 0, FIELD_OFFSET(BITMAPINFO, bmiColors[256])); if(!info) goto done; @@ -285,13 +289,13 @@ create_alpha_bitmap( info->bmiHeader.biPlanes = 1; info->bmiHeader.biBitCount = 32; info->bmiHeader.biCompression = BI_RGB; - info->bmiHeader.biSizeImage = bm.bmWidth * bm.bmHeight * 4; + info->bmiHeader.biSizeImage = size; info->bmiHeader.biXPelsPerMeter = 0; info->bmiHeader.biYPelsPerMeter = 0; info->bmiHeader.biClrUsed = 0; info->bmiHeader.biClrImportant = 0; - bits = HeapAlloc(GetProcessHeap(), 0, info->bmiHeader.biSizeImage); + bits = HeapAlloc(GetProcessHeap(), 0, size); if(!bits) { HeapFree(GetProcessHeap(), 0, info); @@ -309,7 +313,7 @@ create_alpha_bitmap( } /* pre-multiply by alpha */ - for (i = 0, ptr = bits; i < width * height; i++, ptr += 4) + for (ptr = bits; ptr < ((BYTE*)bits + size); ptr += 4) { unsigned int alpha = ptr[3]; ptr[0] = (ptr[0] * alpha) / 255; @@ -321,15 +325,15 @@ create_alpha_bitmap( alpha = CreateDIBitmap(hdc, NULL, CBM_INIT | 2, bits, info, DIB_RGB_COLORS); HeapFree(GetProcessHeap(), 0, info); - HeapFree(GetProcessHeap(), 0, bits); } else { WORD bpp; DWORD compr; - int size; LONG orig_width, orig_height; + TRACE("Creating alpha bitmap from bitmap info.\n"); + if(!bmi_has_alpha(src_info, color_bits)) goto done; @@ -344,7 +348,7 @@ create_alpha_bitmap( goto done; CopyMemory(bits, color_bits, size); /* pre-multiply by alpha */ - for (i = 0, ptr = bits; i < width * height; i++, ptr += 4) + for (ptr = bits; ptr < ((BYTE*)bits + size); ptr += 4) { unsigned int alpha = ptr[3]; ptr[0] = (ptr[0] * alpha) / 255; @@ -497,7 +501,10 @@ get_best_icon_file_entry( /* Let's assume there's always one plane */ fakeEntry->wPlanes = 1; /* We must get the bitcount from the BITMAPINFOHEADER itself */ - fakeEntry->wBitCount = ((BITMAPINFOHEADER *)((char *)dir + entry->dwDIBOffset))->biBitCount; + if (((BITMAPINFOHEADER *)((char *)dir + entry->dwDIBOffset))->biSize == sizeof(BITMAPCOREHEADER)) + fakeEntry->wBitCount = ((BITMAPCOREHEADER *)((char *)dir + entry->dwDIBOffset))->bcBitCount; + else + fakeEntry->wBitCount = ((BITMAPINFOHEADER *)((char *)dir + entry->dwDIBOffset))->biBitCount; fakeEntry->dwBytesInRes = entry->dwDIBSize; fakeEntry->wResId = i + 1; } From 5211c92255245f402bfdb90fd9af20d43315e01f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Gardou?= Date: Sat, 25 Oct 2014 18:11:27 +0000 Subject: [PATCH 28/91] [WIN32K] - Avoid leaking handles when loading animated cursors. svn path=/trunk/; revision=64991 --- reactos/win32ss/user/ntuser/cursoricon_new.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/reactos/win32ss/user/ntuser/cursoricon_new.c b/reactos/win32ss/user/ntuser/cursoricon_new.c index fb7a5c70376..69a5011ebdb 100644 --- a/reactos/win32ss/user/ntuser/cursoricon_new.c +++ b/reactos/win32ss/user/ntuser/cursoricon_new.c @@ -229,7 +229,10 @@ FreeCurIconObject( UINT i; for(i = 0; i < AniCurIcon->cpcur; i++) + { + UserDereferenceObject(AniCurIcon->aspcur[i]); IntDestroyCurIconObject(AniCurIcon->aspcur[i]); + } ExFreePoolWithTag(AniCurIcon->aspcur, USERTAG_CURSOR); } @@ -1068,7 +1071,10 @@ done: for(i = 0; i < numFrames; i++) { if(AniCurIcon->aspcur[i]) + { + UserDereferenceObject(AniCurIcon->aspcur[i]); IntDestroyCurIconObject(AniCurIcon->aspcur[i]); + } } AniCurIcon->cicur = 0; AniCurIcon->cpcur = 0; From 35e122d62f12506c9c6e755bca89ebabf12da40f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Gardou?= Date: Sat, 25 Oct 2014 18:11:31 +0000 Subject: [PATCH 29/91] [WIN32K] - Always store alpha-aware cursors in a 32bpp RGB surface. CORE-8695 svn path=/trunk/; revision=64992 --- reactos/win32ss/gdi/eng/mouse.c | 78 +++++++++++++++++++++---------- reactos/win32ss/gdi/eng/pdevobj.h | 1 - 2 files changed, 53 insertions(+), 26 deletions(-) diff --git a/reactos/win32ss/gdi/eng/mouse.c b/reactos/win32ss/gdi/eng/mouse.c index e4cd3abbba3..5170644b650 100644 --- a/reactos/win32ss/gdi/eng/mouse.c +++ b/reactos/win32ss/gdi/eng/mouse.c @@ -263,11 +263,9 @@ IntShowMousePointer(PDEVOBJ *ppdev, SURFOBJ *psoDest) BLENDOBJ blendobj = { {AC_SRC_OVER, 0, 255, AC_SRC_ALPHA } }; EXLATEOBJ exlo; EXLATEOBJ_vInitialize(&exlo, - pgp->psurfColor->ppal, + &gpalRGB, ppdev->ppalSurf, - 0xFFFFFFFF, - 0xFFFFFFFF, - 0); + 0, 0, 0); IntEngAlphaBlend(psoDest, &pgp->psurfColor->SurfObj, NULL, @@ -373,34 +371,62 @@ EngSetPointerShape( if (psoColor) { - /* Color bitmap must have the same format as the dest surface */ - if (psoColor->iBitmapFormat != pso->iBitmapFormat) + if (fl & SPS_ALPHA) { - /* It's OK if we have an alpha bitmap */ - if(!(fl & SPS_ALPHA)) + /* Always store the alpha cursor in RGB. */ + EXLATEOBJ exloSrcRGB; + PEXLATEOBJ pexlo; + + pexlo = CONTAINING_RECORD(pxlo, EXLATEOBJ, xlo); + EXLATEOBJ_vInitialize(&exloSrcRGB, pexlo->ppalSrc, &gpalRGB, 0, 0, 0); + + hbmColor = EngCreateBitmap(psoColor->sizlBitmap, + WIDTH_BYTES_ALIGN32(sizel.cx, 32), + BMF_32BPP, + BMF_TOPDOWN | BMF_NOZEROINIT, + NULL); + psurfColor = SURFACE_ShareLockSurface(hbmColor); + if (!psurfColor) goto failure; + + /* Now copy the given bitmap. */ + rectl.bottom = psoColor->sizlBitmap.cy; + IntEngCopyBits(&psurfColor->SurfObj, + psoColor, + NULL, + &exloSrcRGB.xlo, + &rectl, + (POINTL*)&rectl); + + EXLATEOBJ_vCleanup(&exloSrcRGB); + } + else + { + /* Color bitmap must have the same format as the dest surface */ + if (psoColor->iBitmapFormat != pso->iBitmapFormat) { DPRINT1("Screen surface and cursor color bitmap format don't match!.\n"); goto failure; } + + /* Create a bitmap to copy the color bitmap to */ + hbmColor = EngCreateBitmap(psoColor->sizlBitmap, + lDelta, + pso->iBitmapFormat, + BMF_TOPDOWN | BMF_NOZEROINIT, + NULL); + psurfColor = SURFACE_ShareLockSurface(hbmColor); + if (!psurfColor) goto failure; + + /* Now copy the given bitmap. */ + rectl.bottom = psoColor->sizlBitmap.cy; + IntEngCopyBits(&psurfColor->SurfObj, + psoColor, + NULL, + pxlo, + &rectl, + (POINTL*)&rectl); } - /* Create a bitmap to copy the color bitmap to */ - hbmColor = EngCreateBitmap(psoColor->sizlBitmap, - lDelta, - pso->iBitmapFormat, - BMF_TOPDOWN | BMF_NOZEROINIT, - NULL); - psurfColor = SURFACE_ShareLockSurface(hbmColor); - if (!psurfColor) goto failure; - - /* Now copy the given bitmap */ - rectl.bottom = psoColor->sizlBitmap.cy; - IntEngCopyBits(&psurfColor->SurfObj, - psoColor, - NULL, - pxlo, - &rectl, - (POINTL*)&rectl); } /* Create a mask surface */ @@ -409,6 +435,8 @@ EngSetPointerShape( EXLATEOBJ exlo; PPALETTE ppal; + lDelta = WIDTH_BYTES_ALIGN32(sizel.cx, BitsPerFormat(pso->iBitmapFormat)); + /* Create a bitmap for the mask */ hbmMask = EngCreateBitmap(psoMask->sizlBitmap, lDelta, diff --git a/reactos/win32ss/gdi/eng/pdevobj.h b/reactos/win32ss/gdi/eng/pdevobj.h index d319078b043..f5bd95a305a 100644 --- a/reactos/win32ss/gdi/eng/pdevobj.h +++ b/reactos/win32ss/gdi/eng/pdevobj.h @@ -30,7 +30,6 @@ typedef struct _GDIPOINTER /* should stay private to ENG? No, part of PDEVOBJ ak BOOL Enabled; SIZEL Size; POINTL HotSpot; - XLATEOBJ *XlateObject; SURFACE *psurfColor; SURFACE *psurfMask; SURFACE *psurfSave; From 8680a1f13875993cd4396307fb1be014d840b821 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Gardou?= Date: Sat, 25 Oct 2014 18:11:36 +0000 Subject: [PATCH 30/91] [WIN32K] - Use a palette created from the DIB infos for surface created through CreateDIBitmap(CBM_CREATEDIB) CORE-8695 #comment Booting in 16bpp mode is now OK, but some problems remain when switching mode from 16bpp to 32bpp svn path=/trunk/; revision=64993 --- reactos/win32ss/gdi/ntgdi/dibobj.c | 57 +++++++++--------------------- 1 file changed, 16 insertions(+), 41 deletions(-) diff --git a/reactos/win32ss/gdi/ntgdi/dibobj.c b/reactos/win32ss/gdi/ntgdi/dibobj.c index a041043c28c..acca0991bb6 100644 --- a/reactos/win32ss/gdi/ntgdi/dibobj.c +++ b/reactos/win32ss/gdi/ntgdi/dibobj.c @@ -1359,8 +1359,22 @@ IntCreateDIBitmap( { if (init & CBM_CREATDIB) { + PSURFACE Surface; + PPALETTE Palette; + /* Undocumented flag which creates a DDB of the format specified by the bitmap info. */ handle = IntCreateCompatibleBitmap(Dc, width, height, planes, bpp); + if (!handle) + return NULL; + /* The palette must also match the given data */ + Surface = SURFACE_ShareLockSurface(handle); + ASSERT(Surface); + Palette = CreateDIBPalette(data, Dc, coloruse); + ASSERT(Palette); + SURFACE_vSetPalette(Surface, Palette); + + PALETTE_ShareUnlockPalette(Palette); + SURFACE_ShareUnlockSurface(Surface); } else { @@ -1382,45 +1396,6 @@ IntCreateDIBitmap( if ((NULL != handle) && (CBM_INIT & init)) { - if (init & CBM_CREATDIB) - { - PSURFACE Surface; - PPALETTE Palette; - NTSTATUS Status = STATUS_SUCCESS; - - Surface = SURFACE_ShareLockSurface(handle); - ASSERT(Surface); - - Palette = CreateDIBPalette(data, Dc, coloruse); - ASSERT(Palette); - SURFACE_vSetPalette(Surface, Palette); - PALETTE_ShareUnlockPalette(Palette); - - if (Surface->SurfObj.pvBits) - { - _SEH2_TRY - { - RtlCopyMemory(Surface->SurfObj.pvBits, bits, - abs(Surface->sizlDim.cy * Surface->SurfObj.lDelta)); - } - _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) - { - Status = _SEH2_GetExceptionCode(); - } - _SEH2_END - } - - SURFACE_ShareUnlockSurface(Surface); - - if (!NT_SUCCESS(Status)) - { - SetLastNtError(Status); - GreDeleteObject(handle); - handle = NULL; - } - return handle; - } - IntSetDIBits(Dc, handle, 0, height, bits, data, coloruse); } @@ -1544,13 +1519,13 @@ GreCreateDIBitmapInternal( { BITMAPCOREHEADER* CoreHeader = (BITMAPCOREHEADER*)&pbmi->bmiHeader; bpp = CoreHeader->bcBitCount; - planes = CoreHeader->bcPlanes; + planes = CoreHeader->bcPlanes ? CoreHeader->bcPlanes : 1; compression = BI_RGB; } else { bpp = pbmi->bmiHeader.biBitCount; - planes = pbmi->bmiHeader.biPlanes; + planes = pbmi->bmiHeader.biPlanes ? pbmi->bmiHeader.biPlanes : 1; compression = pbmi->bmiHeader.biCompression; } } From 8a0b31154d830e2f77101b28afae40264848b751 Mon Sep 17 00:00:00 2001 From: Amine Khaldi Date: Sat, 25 Oct 2014 18:30:05 +0000 Subject: [PATCH 31/91] [ADVAPI32] * Update ImpersonateNamedPipeClient(). CORE-8540 svn path=/trunk/; revision=64994 --- reactos/dll/win32/advapi32/wine/security.c | 33 ++++------------------ 1 file changed, 5 insertions(+), 28 deletions(-) diff --git a/reactos/dll/win32/advapi32/wine/security.c b/reactos/dll/win32/advapi32/wine/security.c index a8f16d1aa46..4e60c9ee01b 100644 --- a/reactos/dll/win32/advapi32/wine/security.c +++ b/reactos/dll/win32/advapi32/wine/security.c @@ -954,37 +954,14 @@ InitializeAcl(PACL pAcl, return TRUE; } -/********************************************************************** - * ImpersonateNamedPipeClient EXPORTED - * - * @implemented - */ -BOOL -WINAPI -ImpersonateNamedPipeClient(HANDLE hNamedPipe) +BOOL WINAPI ImpersonateNamedPipeClient( HANDLE hNamedPipe ) { - IO_STATUS_BLOCK StatusBlock; - NTSTATUS Status; + IO_STATUS_BLOCK io_block; - TRACE("ImpersonateNamedPipeClient() called\n"); + TRACE("(%p)\n", hNamedPipe); - Status = NtFsControlFile(hNamedPipe, - NULL, - NULL, - NULL, - &StatusBlock, - FSCTL_PIPE_IMPERSONATE, - NULL, - 0, - NULL, - 0); - if (!NT_SUCCESS(Status)) - { - SetLastError(RtlNtStatusToDosError(Status)); - return FALSE; - } - - return TRUE; + return set_ntstatus( NtFsControlFile(hNamedPipe, NULL, NULL, NULL, + &io_block, FSCTL_PIPE_IMPERSONATE, NULL, 0, NULL, 0) ); } /* From 518b6188ecbafbe0be6841c67e3461d1160704d4 Mon Sep 17 00:00:00 2001 From: Amine Khaldi Date: Sat, 25 Oct 2014 18:35:58 +0000 Subject: [PATCH 32/91] [WININET_WINETEST] * ROSTESTS-73 is not fixed yet. svn path=/trunk/; revision=64995 --- rostests/winetests/wininet/http.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/rostests/winetests/wininet/http.c b/rostests/winetests/wininet/http.c index 38b1ab42fe1..ffd2a725dc0 100644 --- a/rostests/winetests/wininet/http.c +++ b/rostests/winetests/wininet/http.c @@ -3269,7 +3269,11 @@ static void test_conn_close(int port) SET_EXPECT(INTERNET_STATUS_CONNECTION_CLOSED); SET_EXPECT(INTERNET_STATUS_REQUEST_COMPLETE); SetEvent(conn_close_event); +#ifdef ROSTESTS_73_FIXED WaitForSingleObject(hCompleteEvent, INFINITE); +#else /* ROSTESTS_73_FIXED */ + ok(WaitForSingleObject(hCompleteEvent, 5000) == WAIT_OBJECT_0, "Wait timed out\n"); +#endif /* ROSTESTS_73_FIXED */ ok(req_error == ERROR_SUCCESS, "req_error = %u\n", req_error); CLEAR_NOTIFIED(INTERNET_STATUS_RESPONSE_RECEIVED); CHECK_NOTIFIED(INTERNET_STATUS_CLOSING_CONNECTION); From 75d471db4bcae832935bd01e61d84c18b9c8e98d Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Sat, 25 Oct 2014 21:16:17 +0000 Subject: [PATCH 33/91] [WIN32k] Stop ASSERTing, that we always have all the resources we need in IntCreateCompatibleBitmap svn path=/trunk/; revision=64997 --- reactos/win32ss/gdi/ntgdi/bitmaps.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/reactos/win32ss/gdi/ntgdi/bitmaps.c b/reactos/win32ss/gdi/ntgdi/bitmaps.c index e72dec295e7..2ded5a86e34 100644 --- a/reactos/win32ss/gdi/ntgdi/bitmaps.c +++ b/reactos/win32ss/gdi/ntgdi/bitmaps.c @@ -239,6 +239,12 @@ IntCreateCompatibleBitmap( Planes ? Planes : 1, Bpp ? Bpp : Dc->ppdev->gdiinfo.cBitsPixel, NULL); + if (Bmp == NULL) + { + DPRINT1("Failed to allocate a bitmap!\n"); + return NULL; + } + psurf = SURFACE_ShareLockSurface(Bmp); ASSERT(psurf); From 8caa060f5237c990cf43b4329566ce6227be9367 Mon Sep 17 00:00:00 2001 From: Eric Kohl Date: Sat, 25 Oct 2014 21:27:05 +0000 Subject: [PATCH 34/91] [NET] Implement and use console-aware print functions to print strings and resources. svn path=/trunk/; revision=64998 --- .../applications/network/net/cmdAccounts.c | 50 ++++++------ .../applications/network/net/cmdHelpMsg.c | 4 +- .../applications/network/net/cmdLocalGroup.c | 24 +++--- .../base/applications/network/net/cmdStart.c | 4 +- .../base/applications/network/net/cmdUser.c | 78 ++++++++++++------- reactos/base/applications/network/net/main.c | 63 ++++++++++++++- reactos/base/applications/network/net/net.h | 10 +++ 7 files changed, 158 insertions(+), 75 deletions(-) diff --git a/reactos/base/applications/network/net/cmdAccounts.c b/reactos/base/applications/network/net/cmdAccounts.c index c297da0af48..dcd93de724c 100644 --- a/reactos/base/applications/network/net/cmdAccounts.c +++ b/reactos/base/applications/network/net/cmdAccounts.c @@ -48,7 +48,7 @@ cmdAccounts( if (_wcsicmp(argv[i], L"/domain") == 0) { - printf("The /DOMAIN option is not supported yet!\n"); + PrintToConsole(L"The /DOMAIN option is not supported yet!\n"); #if 0 Domain = TRUE; #endif @@ -74,7 +74,7 @@ cmdAccounts( value = wcstoul(p, &endptr, 10); if (*endptr != 0) { - printf("You entered an invalid value for the /FORCELOGOFF option.\n"); + PrintToConsole(L"You entered an invalid value for the /FORCELOGOFF option.\n"); result = 1; goto done; } @@ -89,7 +89,7 @@ cmdAccounts( value = wcstoul(p, &endptr, 10); if (*endptr != 0) { - printf("You entered an invalid value for the /MINPWLEN option.\n"); + PrintToConsole(L"You entered an invalid value for the /MINPWLEN option.\n"); result = 1; goto done; } @@ -111,7 +111,7 @@ cmdAccounts( value = wcstoul(p, &endptr, 10); if (*endptr != 0) { - printf("You entered an invalid value for the /MAXPWAGE option.\n"); + PrintToConsole(L"You entered an invalid value for the /MAXPWAGE option.\n"); result = 1; goto done; } @@ -126,7 +126,7 @@ cmdAccounts( value = wcstoul(p, &endptr, 10); if (*endptr != 0) { - printf("You entered an invalid value for the /MINPWAGE option.\n"); + PrintToConsole(L"You entered an invalid value for the /MINPWAGE option.\n"); result = 1; goto done; } @@ -140,7 +140,7 @@ cmdAccounts( value = wcstoul(p, &endptr, 10); if (*endptr != 0) { - printf("You entered an invalid value for the /UNIQUEPW option.\n"); + PrintToConsole(L"You entered an invalid value for the /UNIQUEPW option.\n"); result = 1; goto done; } @@ -168,51 +168,51 @@ cmdAccounts( RtlGetNtProductType(&ProductType); - printf("Force logoff after: "); + PrintToConsole(L"Force logoff after: "); if (Info0->usrmod0_force_logoff == TIMEQ_FOREVER) - printf("Never\n"); + PrintToConsole(L"Never\n"); else - printf("%lu seconds\n", Info0->usrmod0_force_logoff); + PrintToConsole(L"%lu seconds\n", Info0->usrmod0_force_logoff); - printf("Minimum password age (in days): %lu\n", Info0->usrmod0_min_passwd_age / 86400); - printf("Maximum password age (in days): %lu\n", Info0->usrmod0_max_passwd_age / 86400); - printf("Minimum password length: %lu\n", Info0->usrmod0_min_passwd_len); + PrintToConsole(L"Minimum password age (in days): %lu\n", Info0->usrmod0_min_passwd_age / 86400); + PrintToConsole(L"Maximum password age (in days): %lu\n", Info0->usrmod0_max_passwd_age / 86400); + PrintToConsole(L"Minimum password length: %lu\n", Info0->usrmod0_min_passwd_len); - printf("Password history length: "); + PrintToConsole(L"Password history length: "); if (Info0->usrmod0_password_hist_len == 0) - printf("None\n"); + PrintToConsole(L"None\n"); else - printf("%lu\n", Info0->usrmod0_password_hist_len); + PrintToConsole(L"%lu\n", Info0->usrmod0_password_hist_len); - printf("Lockout threshold: "); + PrintToConsole(L"Lockout threshold: "); if (Info3->usrmod3_lockout_threshold == 0) - printf("Never\n"); + PrintToConsole(L"Never\n"); else - printf("%lu\n", Info3->usrmod3_lockout_threshold); + PrintToConsole(L"%lu\n", Info3->usrmod3_lockout_threshold); - printf("Lockout duration (in minutes): %lu\n", Info3->usrmod3_lockout_duration / 60); - printf("Lockout observation window (in minutes): %lu\n", Info3->usrmod3_lockout_observation_window / 60); + PrintToConsole(L"Lockout duration (in minutes): %lu\n", Info3->usrmod3_lockout_duration / 60); + PrintToConsole(L"Lockout observation window (in minutes): %lu\n", Info3->usrmod3_lockout_observation_window / 60); - printf("Computer role: "); + PrintToConsole(L"Computer role: "); if (Info1->usrmod1_role == UAS_ROLE_PRIMARY) { if (ProductType == NtProductLanManNt) { - printf("Primary server\n"); + PrintToConsole(L"Primary server\n"); } else if (ProductType == NtProductServer) { - printf("Standalone server\n"); + PrintToConsole(L"Standalone server\n"); } else { - printf("Workstation\n"); + PrintToConsole(L"Workstation\n"); } } else { - printf("Backup server\n"); + PrintToConsole(L"Backup server\n"); } } diff --git a/reactos/base/applications/network/net/cmdHelpMsg.c b/reactos/base/applications/network/net/cmdHelpMsg.c index 8247836b354..d78d4e86e39 100644 --- a/reactos/base/applications/network/net/cmdHelpMsg.c +++ b/reactos/base/applications/network/net/cmdHelpMsg.c @@ -49,12 +49,12 @@ INT cmdHelpMsg(INT argc, WCHAR **argv) 0, NULL)) { - printf("\n%S\n", lpBuffer); + PrintToConsole(L"\n%s\n", lpBuffer); LocalFree(lpBuffer); } else { - printf("Unrecognized error code: %ld\n", errNum); + PrintToConsole(L"Unrecognized error code: %ld\n", errNum); } return 0; diff --git a/reactos/base/applications/network/net/cmdLocalGroup.c b/reactos/base/applications/network/net/cmdLocalGroup.c index 1995c2650a1..3cd5af48af3 100644 --- a/reactos/base/applications/network/net/cmdLocalGroup.c +++ b/reactos/base/applications/network/net/cmdLocalGroup.c @@ -38,8 +38,8 @@ EnumerateLocalGroups(VOID) if (Status != NERR_Success) return Status; - printf("\nAliases for \\\\%S\n\n", pServer->sv100_name); - printf("------------------------------------------\n"); + PrintToConsole(L"\nAliases for \\\\%s\n\n", pServer->sv100_name); + PrintToConsole(L"------------------------------------------\n"); NetApiBufferFree(pServer); @@ -58,12 +58,10 @@ EnumerateLocalGroups(VOID) sizeof(PLOCALGROUP_INFO_0), CompareInfo); -// printf("dwRead: %lu dwTotal: %lu\n", dwRead, dwTotal); for (i = 0; i < dwRead; i++) { -// printf("%p\n", pBuffer[i].lgrpi0_name); if (pBuffer[i].lgrpi0_name) - printf("*%S\n", pBuffer[i].lgrpi0_name); + PrintToConsole(L"*%s\n", pBuffer[i].lgrpi0_name); } NetApiBufferFree(pBuffer); @@ -129,17 +127,17 @@ DisplayLocalGroup(LPWSTR lpGroupName) pNames[i] = pMembers[i].lgrmi3_domainandname; } - printf("Alias name %S\n", pGroupInfo->lgrpi1_name); - printf("Comment %S\n", pGroupInfo->lgrpi1_comment); - printf("\n"); - printf("Members\n"); - printf("\n"); - printf("------------------------------------------\n"); + PrintToConsole(L"Alias name %s\n", pGroupInfo->lgrpi1_name); + PrintToConsole(L"Comment %s\n", pGroupInfo->lgrpi1_comment); + PrintToConsole(L"\n"); + PrintToConsole(L"Members\n"); + PrintToConsole(L"\n"); + PrintToConsole(L"------------------------------------------\n"); for (i = 0; i < dwRead; i++) { - if (pNames[i]) - printf("%S\n", pNames[i]); + if (pNames[i]) + PrintToConsole(L"%s\n", pNames[i]); } done: diff --git a/reactos/base/applications/network/net/cmdStart.c b/reactos/base/applications/network/net/cmdStart.c index 34070584f72..ad6021c2a13 100644 --- a/reactos/base/applications/network/net/cmdStart.c +++ b/reactos/base/applications/network/net/cmdStart.c @@ -57,11 +57,11 @@ EnumerateRunningServices(VOID) &dwServiceCount, &dwResumeHandle)) { - printf("The following services hav been started:\n\n"); + PrintToConsole(L"The following services hav been started:\n\n"); for (i = 0; i < dwServiceCount; i++) { - printf(" %S\n", lpServiceBuffer[i].lpDisplayName); + PrintToConsole(L" %s\n", lpServiceBuffer[i].lpDisplayName); } } diff --git a/reactos/base/applications/network/net/cmdUser.c b/reactos/base/applications/network/net/cmdUser.c index a8289ea80bc..038df08d1c3 100644 --- a/reactos/base/applications/network/net/cmdUser.c +++ b/reactos/base/applications/network/net/cmdUser.c @@ -37,11 +37,11 @@ EnumerateUsers(VOID) if (Status != NERR_Success) return Status; - printf("\nUser accounts for \\\\%S\n\n", pServer->sv100_name); + PrintToConsole(L"\nUser accounts for \\\\%s\n\n", pServer->sv100_name); NetApiBufferFree(pServer); - printf("------------------------------------------\n"); + PrintToConsole(L"------------------------------------------\n"); Status = NetUserEnum(NULL, 0, @@ -64,7 +64,7 @@ EnumerateUsers(VOID) { // printf("%p\n", pBuffer[i].lgrpi0_name); if (pBuffer[i].usri0_name) - printf("%S\n", pBuffer[i].usri0_name); + PrintToConsole(L"%s\n", pBuffer[i].usri0_name); } NetApiBufferFree(pBuffer); @@ -102,7 +102,7 @@ PrintDateTime(DWORD dwSeconds) TimeBuffer, 80); - printf("%S %S\n", DateBuffer, TimeBuffer); + PrintToConsole(L"%s %s\n", DateBuffer, TimeBuffer); } @@ -110,6 +110,7 @@ static NET_API_STATUS DisplayUser(LPWSTR lpUserName) { + PUSER_MODALS_INFO_0 pUserModals = NULL; PUSER_INFO_4 pUserInfo = NULL; NET_API_STATUS Status; @@ -121,39 +122,56 @@ DisplayUser(LPWSTR lpUserName) if (Status != NERR_Success) return Status; - printf("User name %S\n", pUserInfo->usri4_name); - printf("Full name %S\n", pUserInfo->usri4_full_name); - printf("Comment %S\n", pUserInfo->usri4_comment); - printf("User comment %S\n", pUserInfo->usri4_usr_comment); - printf("Country code %03ld ()\n", pUserInfo->usri4_country_code); - printf("Account active %S\n", (pUserInfo->usri4_flags & UF_ACCOUNTDISABLE)? L"No" : ((pUserInfo->usri4_flags & UF_LOCKOUT) ? L"Locked" : L"Yes")); - printf("Account expires "); + Status = NetUserModalsGet(NULL, + 0, + (LPBYTE*)&pUserModals); + if (Status != NERR_Success) + goto done; + + PrintToConsole(L"User name %s\n", pUserInfo->usri4_name); + PrintToConsole(L"Full name %s\n", pUserInfo->usri4_full_name); + PrintToConsole(L"Comment %s\n", pUserInfo->usri4_comment); + PrintToConsole(L"User comment %s\n", pUserInfo->usri4_usr_comment); + PrintToConsole(L"Country code %03ld ()\n", pUserInfo->usri4_country_code); + PrintToConsole(L"Account active %s\n", (pUserInfo->usri4_flags & UF_ACCOUNTDISABLE)? L"No" : ((pUserInfo->usri4_flags & UF_LOCKOUT) ? L"Locked" : L"Yes")); + PrintToConsole(L"Account expires "); if (pUserInfo->usri4_acct_expires == TIMEQ_FOREVER) - printf("Never\n"); + PrintToConsole(L"Never\n"); else PrintDateTime(pUserInfo->usri4_acct_expires); - printf("\n"); - printf("Password last set \n"); - printf("Password expires \n"); - printf("Password changeable \n"); - printf("Password required \n"); - printf("User may change password \n"); - printf("\n"); - printf("Workstation allowed %S\n", pUserInfo->usri4_workstations); - printf("Logon script %S\n", pUserInfo->usri4_script_path); - printf("User profile %S\n", pUserInfo->usri4_profile); - printf("Home directory %S\n", pUserInfo->usri4_home_dir); - printf("Last logon "); + PrintToConsole(L"\n"); + PrintToConsole(L"Password last set \n"); + + PrintToConsole(L"Password expires "); + if (pUserModals->usrmod0_max_passwd_age == TIMEQ_FOREVER) + PrintToConsole(L"Never\n"); + else + PrintDateTime(pUserInfo->usri4_acct_expires); + + PrintToConsole(L"Password changeable \n"); + PrintToConsole(L"Password required \n"); + PrintToConsole(L"User may change password \n"); + + PrintToConsole(L"\n"); + PrintToConsole(L"Workstation allowed %s\n", pUserInfo->usri4_workstations); + PrintToConsole(L"Logon script %s\n", pUserInfo->usri4_script_path); + PrintToConsole(L"User profile %s\n", pUserInfo->usri4_profile); + PrintToConsole(L"Home directory %s\n", pUserInfo->usri4_home_dir); + PrintToConsole(L"Last logon "); if (pUserInfo->usri4_last_logon == 0) - printf("Never\n"); + PrintToConsole(L"Never\n"); else PrintDateTime(pUserInfo->usri4_last_logon); - printf("\n"); - printf("Logon hours allowed \n"); - printf("\n"); - printf("Local group memberships \n"); - printf("Global group memberships \n"); + PrintToConsole(L"\n"); + PrintToConsole(L"Logon hours allowed \n"); + PrintToConsole(L"\n"); + PrintToConsole(L"Local group memberships \n"); + PrintToConsole(L"Global group memberships \n"); + +done: + if (pUserModals != NULL) + NetApiBufferFree(pUserModals); if (pUserInfo != NULL) NetApiBufferFree(pUserInfo); diff --git a/reactos/base/applications/network/net/main.c b/reactos/base/applications/network/net/main.c index cc93fea82fd..1b489cc493c 100644 --- a/reactos/base/applications/network/net/main.c +++ b/reactos/base/applications/network/net/main.c @@ -51,13 +51,70 @@ PrintResourceString( INT resID, ...) { - WCHAR szMsgBuf[MAX_BUFFER_SIZE]; + WCHAR szMsgBuffer[MAX_BUFFER_SIZE]; + WCHAR szOutBuffer[MAX_BUFFER_SIZE]; va_list arg_ptr; va_start(arg_ptr, resID); - LoadStringW(GetModuleHandle(NULL), resID, szMsgBuf, MAX_BUFFER_SIZE); - vwprintf(szMsgBuf, arg_ptr); + LoadStringW(GetModuleHandle(NULL), resID, szMsgBuffer, MAX_BUFFER_SIZE); + _vsnwprintf(szOutBuffer, MAX_BUFFER_SIZE, szMsgBuffer, arg_ptr); va_end(arg_ptr); + + WriteToConsole(szOutBuffer); +} + + +VOID +PrintToConsole( + LPWSTR lpFormat, + ...) +{ + WCHAR szBuffer[MAX_BUFFER_SIZE]; + va_list arg_ptr; + + va_start(arg_ptr, lpFormat); + _vsnwprintf(szBuffer, MAX_BUFFER_SIZE, lpFormat, arg_ptr); + va_end(arg_ptr); + + WriteToConsole(szBuffer); +} + + +VOID +WriteToConsole( + LPWSTR lpString) +{ + CHAR szOemBuffer[MAX_BUFFER_SIZE * 2]; + HANDLE hOutput; + DWORD dwLength; + + dwLength = wcslen(lpString); + + hOutput = GetStdHandle(STD_OUTPUT_HANDLE); + if ((GetFileType(hOutput) & ~FILE_TYPE_REMOTE) == FILE_TYPE_CHAR) + { + WriteConsoleW(hOutput, + lpString, + dwLength, + &dwLength, + NULL); + } + else + { + dwLength = WideCharToMultiByte(CP_OEMCP, + 0, + lpString, + dwLength, + szOemBuffer, + MAX_BUFFER_SIZE * 2, + NULL, + NULL); + WriteFile(hOutput, + szOemBuffer, + dwLength, + &dwLength, + NULL); + } } diff --git a/reactos/base/applications/network/net/net.h b/reactos/base/applications/network/net/net.h index e100dc9e84a..7f1d05924a3 100644 --- a/reactos/base/applications/network/net/net.h +++ b/reactos/base/applications/network/net/net.h @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include @@ -29,6 +30,15 @@ PrintResourceString( INT resID, ...); +VOID +PrintToConsole( + LPWSTR lpFormat, + ...); + +VOID +WriteToConsole( + LPWSTR lpString); + VOID help(VOID); INT unimplemented(INT argc, WCHAR **argv); From f65a37a7d005eee7995c5ae2508398d22a6afa3a Mon Sep 17 00:00:00 2001 From: James Tabor Date: Sat, 25 Oct 2014 22:06:13 +0000 Subject: [PATCH 35/91] [NtUser] - Do not block sending messages from a dying thread. See CORE-7447. svn path=/trunk/; revision=64999 --- reactos/win32ss/user/ntuser/msgqueue.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/reactos/win32ss/user/ntuser/msgqueue.c b/reactos/win32ss/user/ntuser/msgqueue.c index 3a7f3b3549f..812c8d1ae62 100644 --- a/reactos/win32ss/user/ntuser/msgqueue.c +++ b/reactos/win32ss/user/ntuser/msgqueue.c @@ -973,8 +973,15 @@ co_MsqSendMessage(PTHREADINFO ptirec, /* Don't send from or to a dying thread */ if (pti->TIF_flags & TIF_INCLEANUP || ptirec->TIF_flags & TIF_INCLEANUP) { + // Unless we are dying and need to tell our parents. + if (pti->TIF_flags & TIF_INCLEANUP && !(ptirec->TIF_flags & TIF_INCLEANUP)) + { + // Parent notify is the big one. Fire and forget! + TRACE("Send message from dying thread %d\n",Msg); + co_MsqSendMessageAsync(ptirec, Wnd, Msg, wParam, lParam, NULL, 0, FALSE, HookMessage); + } if (uResult) *uResult = -1; - ERR("MsqSM: Current pti %lu or Rec pti %lu\n", pti->TIF_flags & TIF_INCLEANUP, ptirec->TIF_flags & TIF_INCLEANUP); + TRACE("MsqSM: Msg %d Current pti %lu or Rec pti %lu\n", Msg, pti->TIF_flags & TIF_INCLEANUP, ptirec->TIF_flags & TIF_INCLEANUP); return STATUS_UNSUCCESSFUL; } From c9b98be5d30dd75a18a01161602dafef558456bb Mon Sep 17 00:00:00 2001 From: Amine Khaldi Date: Sat, 25 Oct 2014 22:37:02 +0000 Subject: [PATCH 36/91] [ADVAPI32] * Update OpenThreadToken(). CORE-8540 svn path=/trunk/; revision=65000 --- reactos/dll/win32/advapi32/wine/security.c | 39 +++++++++++----------- 1 file changed, 20 insertions(+), 19 deletions(-) diff --git a/reactos/dll/win32/advapi32/wine/security.c b/reactos/dll/win32/advapi32/wine/security.c index 4e60c9ee01b..f7eb02c0a64 100644 --- a/reactos/dll/win32/advapi32/wine/security.c +++ b/reactos/dll/win32/advapi32/wine/security.c @@ -364,28 +364,29 @@ OpenProcessToken(HANDLE ProcessHandle, return TRUE; } -/* - * @implemented +/****************************************************************************** + * OpenThreadToken [ADVAPI32.@] + * + * Opens the access token associated with a thread handle. + * + * PARAMS + * ThreadHandle [I] Handle to process + * DesiredAccess [I] Desired access to the thread + * OpenAsSelf [I] ??? + * TokenHandle [O] Destination for the token handle + * + * RETURNS + * Success: TRUE. TokenHandle contains the access token. + * Failure: FALSE. + * + * NOTES + * See NtOpenThreadToken. */ BOOL WINAPI -OpenThreadToken(HANDLE ThreadHandle, - DWORD DesiredAccess, - BOOL OpenAsSelf, - PHANDLE TokenHandle) +OpenThreadToken( HANDLE ThreadHandle, DWORD DesiredAccess, + BOOL OpenAsSelf, HANDLE *TokenHandle) { - NTSTATUS Status; - - Status = NtOpenThreadToken(ThreadHandle, - DesiredAccess, - OpenAsSelf, - TokenHandle); - if (!NT_SUCCESS(Status)) - { - SetLastError(RtlNtStatusToDosError(Status)); - return FALSE; - } - - return TRUE; + return set_ntstatus( NtOpenThreadToken(ThreadHandle, DesiredAccess, OpenAsSelf, TokenHandle)); } /* From 6a9276ecb9b26a0c4b59a4ed91290251f87323af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herm=C3=A8s=20B=C3=A9lusca-Ma=C3=AFto?= Date: Sun, 26 Oct 2014 01:28:32 +0000 Subject: [PATCH 37/91] [DDK]: VDD IO handlers are WINAPI and not something undefined (CDECL ... ?). Double-checked by V. svn path=/trunk/; revision=65002 --- reactos/include/ddk/nt_vdd.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/reactos/include/ddk/nt_vdd.h b/reactos/include/ddk/nt_vdd.h index b4b6c7df67d..e3fa8debb45 100644 --- a/reactos/include/ddk/nt_vdd.h +++ b/reactos/include/ddk/nt_vdd.h @@ -45,14 +45,14 @@ VDDTerminateVDM(VOID); * I/O Port services */ -typedef VOID (*PFNVDD_INB) (WORD iport, PBYTE data); -typedef VOID (*PFNVDD_INW) (WORD iport, PWORD data); -typedef VOID (*PFNVDD_INSB) (WORD iport, PBYTE data, WORD count); -typedef VOID (*PFNVDD_INSW) (WORD iport, PWORD data, WORD count); -typedef VOID (*PFNVDD_OUTB) (WORD iport, BYTE data); -typedef VOID (*PFNVDD_OUTW) (WORD iport, WORD data); -typedef VOID (*PFNVDD_OUTSB) (WORD iport, PBYTE data, WORD count); -typedef VOID (*PFNVDD_OUTSW) (WORD iport, PWORD data, WORD count); +typedef VOID (WINAPI *PFNVDD_INB) (WORD iport, PBYTE data); +typedef VOID (WINAPI *PFNVDD_INW) (WORD iport, PWORD data); +typedef VOID (WINAPI *PFNVDD_INSB) (WORD iport, PBYTE data, WORD count); +typedef VOID (WINAPI *PFNVDD_INSW) (WORD iport, PWORD data, WORD count); +typedef VOID (WINAPI *PFNVDD_OUTB) (WORD iport, BYTE data); +typedef VOID (WINAPI *PFNVDD_OUTW) (WORD iport, WORD data); +typedef VOID (WINAPI *PFNVDD_OUTSB) (WORD iport, PBYTE data, WORD count); +typedef VOID (WINAPI *PFNVDD_OUTSW) (WORD iport, PWORD data, WORD count); typedef struct _VDD_IO_HANDLERS { From 1e491f4d402e9d5fbdce902a46abd73e08a21e05 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herm=C3=A8s=20B=C3=A9lusca-Ma=C3=AFto?= Date: Sun, 26 Oct 2014 02:27:11 +0000 Subject: [PATCH 38/91] [NTVDM]: Fix the validity check of the hVdd handle in the port structure so that we don't try to call an invalid VDD IO handler. That fixes stack corruption for example in the case of OUTSB/W operations, where we could call an invalid VDD handler taking 3 parameters that in fact calls (because VDD handlers and our internal ones are stored in a union, the choice of the handler is done via the hVdd value) an internal handler taking only 2 parameters... Bug triggered when testing MSVC-compiled NTVDM in speed-optimized mode. Diagnosed by V. and I, thanks V! svn path=/trunk/; revision=65003 --- reactos/subsystems/ntvdm/io.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/reactos/subsystems/ntvdm/io.c b/reactos/subsystems/ntvdm/io.c index 2fd081bd85c..5ecce93c49f 100644 --- a/reactos/subsystems/ntvdm/io.c +++ b/reactos/subsystems/ntvdm/io.c @@ -37,7 +37,7 @@ typedef struct _EMULATOR_IO_HANDLERS typedef struct _EMULATOR_IOPORT_HANDLERS { - HANDLE hVdd; // == 0 if unused, + HANDLE hVdd; // == NULL if unused, // INVALID_HANDLE_VALUE if handled internally, // a valid VDD handle if handled externally. union @@ -65,7 +65,7 @@ IOReadB(USHORT Port) { return IoPortProc[Port].IoHandlers.InB(Port); } - else if (IoPortProc[Port].hVdd > 0 && + else if (IoPortProc[Port].hVdd != NULL && IoPortProc[Port].hVdd != INVALID_HANDLE_VALUE && IoPortProc[Port].VddIoHandlers.inb_handler) { UCHAR Data; @@ -91,7 +91,7 @@ IOReadStrB(USHORT Port, { IoPortProc[Port].IoHandlers.InsB(Port, Buffer, Count); } - else if (IoPortProc[Port].hVdd > 0 && + else if (IoPortProc[Port].hVdd != NULL && IoPortProc[Port].hVdd != INVALID_HANDLE_VALUE && IoPortProc[Port].VddIoHandlers.insb_handler) { ASSERT(Port <= MAXWORD); @@ -113,7 +113,7 @@ IOWriteB(USHORT Port, { IoPortProc[Port].IoHandlers.OutB(Port, Buffer); } - else if (IoPortProc[Port].hVdd > 0 && + else if (IoPortProc[Port].hVdd != NULL && IoPortProc[Port].hVdd != INVALID_HANDLE_VALUE && IoPortProc[Port].VddIoHandlers.outb_handler) { ASSERT(Port <= MAXWORD); @@ -136,7 +136,7 @@ IOWriteStrB(USHORT Port, { IoPortProc[Port].IoHandlers.OutsB(Port, Buffer, Count); } - else if (IoPortProc[Port].hVdd > 0 && + else if (IoPortProc[Port].hVdd != NULL && IoPortProc[Port].hVdd != INVALID_HANDLE_VALUE && IoPortProc[Port].VddIoHandlers.outsb_handler) { ASSERT(Port <= MAXWORD); @@ -157,7 +157,7 @@ IOReadW(USHORT Port) { return IoPortProc[Port].IoHandlers.InW(Port); } - else if (IoPortProc[Port].hVdd > 0 && + else if (IoPortProc[Port].hVdd != NULL && IoPortProc[Port].hVdd != INVALID_HANDLE_VALUE && IoPortProc[Port].VddIoHandlers.inw_handler) { USHORT Data; @@ -186,7 +186,7 @@ IOReadStrW(USHORT Port, { IoPortProc[Port].IoHandlers.InsW(Port, Buffer, Count); } - else if (IoPortProc[Port].hVdd > 0 && + else if (IoPortProc[Port].hVdd != NULL && IoPortProc[Port].hVdd != INVALID_HANDLE_VALUE && IoPortProc[Port].VddIoHandlers.insw_handler) { ASSERT(Port <= MAXWORD); @@ -208,7 +208,7 @@ IOWriteW(USHORT Port, { IoPortProc[Port].IoHandlers.OutW(Port, Buffer); } - else if (IoPortProc[Port].hVdd > 0 && + else if (IoPortProc[Port].hVdd != NULL && IoPortProc[Port].hVdd != INVALID_HANDLE_VALUE && IoPortProc[Port].VddIoHandlers.outw_handler) { ASSERT(Port <= MAXWORD); @@ -232,7 +232,7 @@ IOWriteStrW(USHORT Port, { IoPortProc[Port].IoHandlers.OutsW(Port, Buffer, Count); } - else if (IoPortProc[Port].hVdd > 0 && + else if (IoPortProc[Port].hVdd != NULL && IoPortProc[Port].hVdd != INVALID_HANDLE_VALUE && IoPortProc[Port].VddIoHandlers.outsw_handler) { ASSERT(Port <= MAXWORD); @@ -501,8 +501,8 @@ VDDInstallIOHook(HANDLE hVdd, PVDD_IO_PORTRANGE pPortRange, PVDD_IO_HANDLERS IOhandler) { - /* Check possible validity of the VDD handle */ - if (hVdd == 0 || hVdd == INVALID_HANDLE_VALUE) return FALSE; + /* Check validity of the VDD handle */ + if (hVdd == NULL || hVdd == INVALID_HANDLE_VALUE) return FALSE; /* Loop for each range of I/O ports */ while (cPortRange--) @@ -516,7 +516,7 @@ VDDInstallIOHook(HANDLE hVdd, * Don't do anything if the I/O port is already * handled internally or externally. */ - if (IoPortProc[i].hVdd != 0) + if (IoPortProc[i].hVdd != NULL) { DPRINT1("IoPortProc[0x%X] already registered\n", i); continue; @@ -560,8 +560,8 @@ VDDDeInstallIOHook(HANDLE hVdd, WORD cPortRange, PVDD_IO_PORTRANGE pPortRange) { - /* Check possible validity of the VDD handle */ - if (hVdd == 0 || hVdd == INVALID_HANDLE_VALUE) return; + /* Check validity of the VDD handle */ + if (hVdd == NULL || hVdd == INVALID_HANDLE_VALUE) return; /* Loop for each range of I/O ports */ while (cPortRange--) From 0c4632c9e5b53077b30398d9827cce4aef476aa5 Mon Sep 17 00:00:00 2001 From: Aleksandar Andrejevic Date: Sun, 26 Oct 2014 02:29:31 +0000 Subject: [PATCH 39/91] [NTVDM] Make sure the offset doesn't exceed the VGA bank size. Load the latch registers after the loop (optimization). svn path=/trunk/; revision=65004 --- reactos/subsystems/ntvdm/hardware/vga.c | 32 ++++++++++++------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/reactos/subsystems/ntvdm/hardware/vga.c b/reactos/subsystems/ntvdm/hardware/vga.c index f2d34639720..5eaa863d3b8 100644 --- a/reactos/subsystems/ntvdm/hardware/vga.c +++ b/reactos/subsystems/ntvdm/hardware/vga.c @@ -1200,16 +1200,16 @@ static VOID VgaUpdateFramebuffer(VOID) { /* One byte per pixel */ PixelData = VgaMemory[(j % VGA_NUM_BANKS) * VGA_BANK_SIZE - + (Address + (j / VGA_NUM_BANKS)) - * AddressSize]; + + LOWORD((Address + (j / VGA_NUM_BANKS)) + * AddressSize)]; } else { /* 4-bits per pixel */ PixelData = VgaMemory[(j % VGA_NUM_BANKS) * VGA_BANK_SIZE - + (Address + (j / (VGA_NUM_BANKS * 2))) - * AddressSize]; + + LOWORD((Address + (j / (VGA_NUM_BANKS * 2))) + * AddressSize)]; /* Check if we should use the highest 4 bits or lowest 4 */ if (((j / VGA_NUM_BANKS) % 2) == 0) @@ -1240,8 +1240,8 @@ static VOID VgaUpdateFramebuffer(VOID) */ DWORD BankNumber = (j / 4) % 2; DWORD Offset = Address + (j / 8); - BYTE LowPlaneData = VgaMemory[BankNumber * VGA_BANK_SIZE + Offset * AddressSize]; - BYTE HighPlaneData = VgaMemory[(BankNumber + 2) * VGA_BANK_SIZE + Offset * AddressSize]; + BYTE LowPlaneData = VgaMemory[BankNumber * VGA_BANK_SIZE + LOWORD(Offset * AddressSize)]; + BYTE HighPlaneData = VgaMemory[(BankNumber + 2) * VGA_BANK_SIZE + LOWORD(Offset * AddressSize)]; /* Extract the two bits from each plane */ LowPlaneData = (LowPlaneData >> (6 - ((j % 4) * 2))) & 3; @@ -1264,8 +1264,8 @@ static VOID VgaUpdateFramebuffer(VOID) { /* The data is on plane k, 4 pixels per byte */ BYTE PlaneData = VgaMemory[k * VGA_BANK_SIZE - + (Address + (j / VGA_NUM_BANKS)) - * AddressSize]; + + LOWORD((Address + (j / VGA_NUM_BANKS)) + * AddressSize)]; /* The mask of the first bit in the pair */ BYTE BitMask = 1 << (((3 - (j % VGA_NUM_BANKS)) * 2) + 1); @@ -1284,8 +1284,8 @@ static VOID VgaUpdateFramebuffer(VOID) for (k = 0; k < VGA_NUM_BANKS; k++) { BYTE PlaneData = VgaMemory[k * VGA_BANK_SIZE - + (Address + (j / (VGA_NUM_BANKS * 2))) - * AddressSize]; + + LOWORD((Address + (j / (VGA_NUM_BANKS * 2))) + * AddressSize)]; /* If the bit on that plane is set, set it */ if (PlaneData & (1 << (7 - (j % 8)))) PixelData |= 1 << k; @@ -1866,15 +1866,15 @@ VOID VgaReadMemory(DWORD Address, LPBYTE Buffer, DWORD Size) { VideoAddress = VgaTranslateReadAddress(Address + i); - /* Load the latch registers */ - VgaLatchRegisters[0] = VgaMemory[LOWORD(VideoAddress)]; - VgaLatchRegisters[1] = VgaMemory[VGA_BANK_SIZE + LOWORD(VideoAddress)]; - VgaLatchRegisters[2] = VgaMemory[(2 * VGA_BANK_SIZE) + LOWORD(VideoAddress)]; - VgaLatchRegisters[3] = VgaMemory[(3 * VGA_BANK_SIZE) + LOWORD(VideoAddress)]; - /* Copy the value to the buffer */ Buffer[i] = VgaMemory[VideoAddress]; } + + /* Load the latch registers */ + VgaLatchRegisters[0] = VgaMemory[LOWORD(VideoAddress)]; + VgaLatchRegisters[1] = VgaMemory[VGA_BANK_SIZE + LOWORD(VideoAddress)]; + VgaLatchRegisters[2] = VgaMemory[(2 * VGA_BANK_SIZE) + LOWORD(VideoAddress)]; + VgaLatchRegisters[3] = VgaMemory[(3 * VGA_BANK_SIZE) + LOWORD(VideoAddress)]; } VOID VgaWriteMemory(DWORD Address, LPBYTE Buffer, DWORD Size) From fd83e0e04fbd7e358fa2c4d9f36e319e73f9ef90 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herm=C3=A8s=20B=C3=A9lusca-Ma=C3=AFto?= Date: Sun, 26 Oct 2014 02:38:07 +0000 Subject: [PATCH 40/91] [NTVDM]: Addendum to r64985: correctly display the IPS and the TimerTicks (both of them are *LONGLONG). svn path=/trunk/; revision=65005 --- reactos/subsystems/ntvdm/clock.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reactos/subsystems/ntvdm/clock.c b/reactos/subsystems/ntvdm/clock.c index bd4ff2e55ca..45b440a51f0 100644 --- a/reactos/subsystems/ntvdm/clock.c +++ b/reactos/subsystems/ntvdm/clock.c @@ -149,7 +149,7 @@ VOID ClockUpdate(VOID) #ifdef IPS_DISPLAY if ((CurrentTickCount - LastCyclePrintout) >= 1000) { - DPRINT1("NTVDM: %lu Instructions Per Second; TimerTicks = %I64d\n", Cycles * 1000 / (CurrentTickCount - LastCyclePrintout), TimerTicks); + DPRINT1("NTVDM: %I64u Instructions Per Second; TimerTicks = %I64d\n", Cycles * 1000 / (CurrentTickCount - LastCyclePrintout), TimerTicks); LastCyclePrintout = CurrentTickCount; Cycles = 0; } From 7a1f0bac6858207c1036b08d7a98b7c7ad22cea2 Mon Sep 17 00:00:00 2001 From: Amine Khaldi Date: Sun, 26 Oct 2014 10:34:40 +0000 Subject: [PATCH 41/91] [ADVAPI32] * Update CopySid(). CORE-8540 svn path=/trunk/; revision=65006 --- reactos/dll/win32/advapi32/wine/security.c | 26 ++++++++-------------- 1 file changed, 9 insertions(+), 17 deletions(-) diff --git a/reactos/dll/win32/advapi32/wine/security.c b/reactos/dll/win32/advapi32/wine/security.c index f7eb02c0a64..9b536750237 100644 --- a/reactos/dll/win32/advapi32/wine/security.c +++ b/reactos/dll/win32/advapi32/wine/security.c @@ -627,26 +627,18 @@ FreeSid(PSID pSid) return RtlFreeSid(pSid); } -/* - * @implemented +/****************************************************************************** + * CopySid [ADVAPI32.@] + * + * PARAMS + * nDestinationSidLength [] + * pDestinationSid [] + * pSourceSid [] */ BOOL WINAPI -CopySid(DWORD nDestinationSidLength, - PSID pDestinationSid, - PSID pSourceSid) +CopySid( DWORD nDestinationSidLength, PSID pDestinationSid, PSID pSourceSid ) { - NTSTATUS Status; - - Status = RtlCopySid(nDestinationSidLength, - pDestinationSid, - pSourceSid); - if (!NT_SUCCESS (Status)) - { - SetLastError(RtlNtStatusToDosError(Status)); - return FALSE; - } - - return TRUE; + return set_ntstatus(RtlCopySid(nDestinationSidLength, pDestinationSid, pSourceSid)); } /* From 6d8f72bf65420fc7f016b1608d12d837ae7b15b2 Mon Sep 17 00:00:00 2001 From: Amine Khaldi Date: Sun, 26 Oct 2014 10:59:11 +0000 Subject: [PATCH 42/91] [ADVAPI32] * Apply Wine commit e57edfea by Paul Vriens: Skip leading spaces when parsing. * Update the related functions with Wine 1.7.27. CORE-8540 svn path=/trunk/; revision=65007 --- reactos/dll/win32/advapi32/wine/security.c | 121 ++++++++++++--------- 1 file changed, 69 insertions(+), 52 deletions(-) diff --git a/reactos/dll/win32/advapi32/wine/security.c b/reactos/dll/win32/advapi32/wine/security.c index 9b536750237..677e274734e 100644 --- a/reactos/dll/win32/advapi32/wine/security.c +++ b/reactos/dll/win32/advapi32/wine/security.c @@ -2335,6 +2335,9 @@ static BYTE ParseAceStringType(LPCWSTR* StringAcl) LPCWSTR szAcl = *StringAcl; const ACEFLAG *lpaf = AceType; + while (*szAcl == ' ') + szAcl++; + while (lpaf->wstr && (len = strlenW(lpaf->wstr)) && strncmpW(lpaf->wstr, szAcl, len)) @@ -2343,7 +2346,7 @@ static BYTE ParseAceStringType(LPCWSTR* StringAcl) if (!lpaf->wstr) return 0; - *StringAcl += len; + *StringAcl = szAcl + len; return lpaf->value; } @@ -2369,6 +2372,9 @@ static BYTE ParseAceStringFlags(LPCWSTR* StringAcl) BYTE flags = 0; LPCWSTR szAcl = *StringAcl; + while (*szAcl == ' ') + szAcl++; + while (*szAcl != ';') { const ACEFLAG *lpaf = AceFlags; @@ -2381,7 +2387,7 @@ static BYTE ParseAceStringFlags(LPCWSTR* StringAcl) if (!lpaf->wstr) return 0; - flags |= lpaf->value; + flags |= lpaf->value; szAcl += len; } @@ -2399,19 +2405,22 @@ static DWORD ParseAceStringRights(LPCWSTR* StringAcl) DWORD rights = 0; LPCWSTR szAcl = *StringAcl; + while (*szAcl == ' ') + szAcl++; + if ((*szAcl == '0') && (*(szAcl + 1) == 'x')) { LPCWSTR p = szAcl; - while (*p && *p != ';') + while (*p && *p != ';') p++; - if (p - szAcl <= 10 /* 8 hex digits + "0x" */ ) - { - rights = strtoulW(szAcl, NULL, 16); - szAcl = p; - } - else + if (p - szAcl <= 10 /* 8 hex digits + "0x" */ ) + { + rights = strtoulW(szAcl, NULL, 16); + szAcl = p; + } + else WARN("Invalid rights string format: %s\n", debugstr_wn(szAcl, p - szAcl)); } else @@ -2421,16 +2430,16 @@ static DWORD ParseAceStringRights(LPCWSTR* StringAcl) const ACEFLAG *lpaf = AceRights; while (lpaf->wstr && - (len = strlenW(lpaf->wstr)) && - strncmpW(lpaf->wstr, szAcl, len)) - { - lpaf++; - } + (len = strlenW(lpaf->wstr)) && + strncmpW(lpaf->wstr, szAcl, len)) + { + lpaf++; + } if (!lpaf->wstr) return 0; - rights |= lpaf->value; + rights |= lpaf->value; szAcl += len; } } @@ -2445,11 +2454,8 @@ static DWORD ParseAceStringRights(LPCWSTR* StringAcl) * * dacl_flags(string_ace1)(string_ace2)... (string_acen) */ -static BOOL -ParseStringAclToAcl(LPCWSTR StringAcl, - LPDWORD lpdwFlags, - PACL pAcl, - LPDWORD cBytes) +static BOOL ParseStringAclToAcl(LPCWSTR StringAcl, LPDWORD lpdwFlags, + PACL pAcl, LPDWORD cBytes) { DWORD val; DWORD sidlen; @@ -2457,11 +2463,12 @@ ParseStringAclToAcl(LPCWSTR StringAcl, DWORD acesize = 0; DWORD acecount = 0; PACCESS_ALLOWED_ACE pAce = NULL; /* pointer to current ACE */ + DWORD error = ERROR_INVALID_ACL; TRACE("%s\n", debugstr_w(StringAcl)); if (!StringAcl) - return FALSE; + return FALSE; if (pAcl) /* pAce is only useful if we're setting values */ pAce = (PACCESS_ALLOWED_ACE) (pAcl + 1); @@ -2476,29 +2483,34 @@ ParseStringAclToAcl(LPCWSTR StringAcl, /* Parse ACE type */ val = ParseAceStringType(&StringAcl); - if (pAce) + if (pAce) pAce->Header.AceType = (BYTE) val; if (*StringAcl != ';') + { + error = RPC_S_INVALID_STRING_UUID; goto lerr; + } StringAcl++; /* Parse ACE flags */ - val = ParseAceStringFlags(&StringAcl); - if (pAce) + val = ParseAceStringFlags(&StringAcl); + if (pAce) pAce->Header.AceFlags = (BYTE) val; if (*StringAcl != ';') goto lerr; StringAcl++; /* Parse ACE rights */ - val = ParseAceStringRights(&StringAcl); - if (pAce) + val = ParseAceStringRights(&StringAcl); + if (pAce) pAce->Mask = val; if (*StringAcl != ';') goto lerr; StringAcl++; /* Parse ACE object guid */ + while (*StringAcl == ' ') + StringAcl++; if (*StringAcl != ';') { FIXME("Support for *_OBJECT_ACE_TYPE not implemented\n"); @@ -2507,6 +2519,8 @@ ParseStringAclToAcl(LPCWSTR StringAcl, StringAcl++; /* Parse ACE inherit object guid */ + while (*StringAcl == ' ') + StringAcl++; if (*StringAcl != ';') { FIXME("Support for *_OBJECT_ACE_TYPE not implemented\n"); @@ -2516,10 +2530,10 @@ ParseStringAclToAcl(LPCWSTR StringAcl, /* Parse ACE account sid */ if (ParseStringSidToSid(StringAcl, pAce ? &pAce->SidStart : NULL, &sidlen)) - { + { while (*StringAcl && *StringAcl != ')') StringAcl++; - } + } if (*StringAcl != ')') goto lerr; @@ -2554,7 +2568,7 @@ ParseStringAclToAcl(LPCWSTR StringAcl, return TRUE; lerr: - SetLastError(ERROR_INVALID_ACL); + SetLastError(error); WARN("Invalid ACE string format\n"); return FALSE; } @@ -2563,10 +2577,10 @@ lerr: /****************************************************************************** * ParseStringSecurityDescriptorToSecurityDescriptor */ -static BOOL -ParseStringSecurityDescriptorToSecurityDescriptor(LPCWSTR StringSecurityDescriptor, - SECURITY_DESCRIPTOR_RELATIVE* SecurityDescriptor, - LPDWORD cBytes) +static BOOL ParseStringSecurityDescriptorToSecurityDescriptor( + LPCWSTR StringSecurityDescriptor, + SECURITY_DESCRIPTOR_RELATIVE* SecurityDescriptor, + LPDWORD cBytes) { BOOL bret = FALSE; WCHAR toktype; @@ -2580,25 +2594,28 @@ ParseStringSecurityDescriptorToSecurityDescriptor(LPCWSTR StringSecurityDescript if (SecurityDescriptor) lpNext = (LPBYTE)(SecurityDescriptor + 1); + while (*StringSecurityDescriptor == ' ') + StringSecurityDescriptor++; + while (*StringSecurityDescriptor) { toktype = *StringSecurityDescriptor; - /* Expect char identifier followed by ':' */ - StringSecurityDescriptor++; + /* Expect char identifier followed by ':' */ + StringSecurityDescriptor++; if (*StringSecurityDescriptor != ':') { SetLastError(ERROR_INVALID_PARAMETER); goto lend; } - StringSecurityDescriptor++; + StringSecurityDescriptor++; - /* Extract token */ - lptoken = StringSecurityDescriptor; - while (*lptoken && *lptoken != ':') + /* Extract token */ + lptoken = StringSecurityDescriptor; + while (*lptoken && *lptoken != ':') lptoken++; - if (*lptoken) + if (*lptoken) lptoken--; len = lptoken - StringSecurityDescriptor; @@ -2606,7 +2623,7 @@ ParseStringSecurityDescriptorToSecurityDescriptor(LPCWSTR StringSecurityDescript tok[len] = 0; switch (toktype) - { + { case 'O': { DWORD bytes; @@ -2620,7 +2637,7 @@ ParseStringSecurityDescriptorToSecurityDescriptor(LPCWSTR StringSecurityDescript lpNext += bytes; /* Advance to next token */ } - *cBytes += bytes; + *cBytes += bytes; break; } @@ -2638,13 +2655,13 @@ ParseStringSecurityDescriptorToSecurityDescriptor(LPCWSTR StringSecurityDescript lpNext += bytes; /* Advance to next token */ } - *cBytes += bytes; + *cBytes += bytes; break; } case 'D': - { + { DWORD flags; DWORD bytes; @@ -2656,11 +2673,11 @@ ParseStringSecurityDescriptorToSecurityDescriptor(LPCWSTR StringSecurityDescript SecurityDescriptor->Control |= SE_DACL_PRESENT | flags; SecurityDescriptor->Dacl = lpNext - (LPBYTE)SecurityDescriptor; lpNext += bytes; /* Advance to next token */ - } + } - *cBytes += bytes; + *cBytes += bytes; - break; + break; } case 'S': @@ -2676,18 +2693,18 @@ ParseStringSecurityDescriptorToSecurityDescriptor(LPCWSTR StringSecurityDescript SecurityDescriptor->Control |= SE_SACL_PRESENT | flags; SecurityDescriptor->Sacl = lpNext - (LPBYTE)SecurityDescriptor; lpNext += bytes; /* Advance to next token */ - } + } - *cBytes += bytes; + *cBytes += bytes; - break; + break; } default: FIXME("Unknown token\n"); SetLastError(ERROR_INVALID_PARAMETER); - goto lend; - } + goto lend; + } StringSecurityDescriptor = lptoken; } From 41f5ac7550f22cc9a1fa602ac7d54ea24b95ec58 Mon Sep 17 00:00:00 2001 From: Amine Khaldi Date: Sun, 26 Oct 2014 11:47:29 +0000 Subject: [PATCH 43/91] [ADVAPI32] * Reorder AceRights to reduce difference to Wine. CORE-8540 svn path=/trunk/; revision=65008 --- reactos/dll/win32/advapi32/wine/security.c | 68 +++++++++++----------- 1 file changed, 34 insertions(+), 34 deletions(-) diff --git a/reactos/dll/win32/advapi32/wine/security.c b/reactos/dll/win32/advapi32/wine/security.c index 677e274734e..8502eb43a12 100644 --- a/reactos/dll/win32/advapi32/wine/security.c +++ b/reactos/dll/win32/advapi32/wine/security.c @@ -226,40 +226,6 @@ static const char * debugstr_sid(PSID sid) return "(too-big)"; } -static const ACEFLAG AceRights[] = -{ - { SDDL_GENERIC_ALL, GENERIC_ALL }, - { SDDL_GENERIC_READ, GENERIC_READ }, - { SDDL_GENERIC_WRITE, GENERIC_WRITE }, - { SDDL_GENERIC_EXECUTE, GENERIC_EXECUTE }, - - { SDDL_READ_CONTROL, READ_CONTROL }, - { SDDL_STANDARD_DELETE, DELETE }, - { SDDL_WRITE_DAC, WRITE_DAC }, - { SDDL_WRITE_OWNER, WRITE_OWNER }, - - { SDDL_READ_PROPERTY, ADS_RIGHT_DS_READ_PROP}, - { SDDL_WRITE_PROPERTY, ADS_RIGHT_DS_WRITE_PROP}, - { SDDL_CREATE_CHILD, ADS_RIGHT_DS_CREATE_CHILD}, - { SDDL_DELETE_CHILD, ADS_RIGHT_DS_DELETE_CHILD}, - { SDDL_LIST_CHILDREN, ADS_RIGHT_ACTRL_DS_LIST}, - { SDDL_SELF_WRITE, ADS_RIGHT_DS_SELF}, - { SDDL_LIST_OBJECT, ADS_RIGHT_DS_LIST_OBJECT}, - { SDDL_DELETE_TREE, ADS_RIGHT_DS_DELETE_TREE}, - { SDDL_CONTROL_ACCESS, ADS_RIGHT_DS_CONTROL_ACCESS}, - - { SDDL_FILE_ALL, FILE_ALL_ACCESS }, - { SDDL_FILE_READ, FILE_GENERIC_READ }, - { SDDL_FILE_WRITE, FILE_GENERIC_WRITE }, - { SDDL_FILE_EXECUTE, FILE_GENERIC_EXECUTE }, - - { SDDL_KEY_ALL, KEY_ALL_ACCESS }, - { SDDL_KEY_READ, KEY_READ }, - { SDDL_KEY_WRITE, KEY_WRITE }, - { SDDL_KEY_EXECUTE, KEY_EXECUTE }, - { NULL, 0 }, -}; - /* set last error code from NT status and get the proper boolean return value */ /* used for functions that are a simple wrapper around the corresponding ntdll API */ static __inline BOOL set_ntstatus( NTSTATUS status ) @@ -2399,6 +2365,40 @@ static BYTE ParseAceStringFlags(LPCWSTR* StringAcl) /****************************************************************************** * ParseAceStringRights */ +static const ACEFLAG AceRights[] = +{ + { SDDL_GENERIC_ALL, GENERIC_ALL }, + { SDDL_GENERIC_READ, GENERIC_READ }, + { SDDL_GENERIC_WRITE, GENERIC_WRITE }, + { SDDL_GENERIC_EXECUTE, GENERIC_EXECUTE }, + + { SDDL_READ_CONTROL, READ_CONTROL }, + { SDDL_STANDARD_DELETE, DELETE }, + { SDDL_WRITE_DAC, WRITE_DAC }, + { SDDL_WRITE_OWNER, WRITE_OWNER }, + + { SDDL_READ_PROPERTY, ADS_RIGHT_DS_READ_PROP}, + { SDDL_WRITE_PROPERTY, ADS_RIGHT_DS_WRITE_PROP}, + { SDDL_CREATE_CHILD, ADS_RIGHT_DS_CREATE_CHILD}, + { SDDL_DELETE_CHILD, ADS_RIGHT_DS_DELETE_CHILD}, + { SDDL_LIST_CHILDREN, ADS_RIGHT_ACTRL_DS_LIST}, + { SDDL_SELF_WRITE, ADS_RIGHT_DS_SELF}, + { SDDL_LIST_OBJECT, ADS_RIGHT_DS_LIST_OBJECT}, + { SDDL_DELETE_TREE, ADS_RIGHT_DS_DELETE_TREE}, + { SDDL_CONTROL_ACCESS, ADS_RIGHT_DS_CONTROL_ACCESS}, + + { SDDL_FILE_ALL, FILE_ALL_ACCESS }, + { SDDL_FILE_READ, FILE_GENERIC_READ }, + { SDDL_FILE_WRITE, FILE_GENERIC_WRITE }, + { SDDL_FILE_EXECUTE, FILE_GENERIC_EXECUTE }, + + { SDDL_KEY_ALL, KEY_ALL_ACCESS }, + { SDDL_KEY_READ, KEY_READ }, + { SDDL_KEY_WRITE, KEY_WRITE }, + { SDDL_KEY_EXECUTE, KEY_EXECUTE }, + { NULL, 0 }, +}; + static DWORD ParseAceStringRights(LPCWSTR* StringAcl) { UINT len = 0; From 0de95c0f94e6693c62a4e6d83c02689ad3090f35 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herm=C3=A8s=20B=C3=A9lusca-Ma=C3=AFto?= Date: Sun, 26 Oct 2014 11:50:14 +0000 Subject: [PATCH 44/91] [FAST486][NTVDM]: Do not compile some FPU functions when FAST486_NO_FPU is defined (fixes build). svn path=/trunk/; revision=65009 --- reactos/lib/fast486/fpu.c | 4 ++++ reactos/subsystems/ntvdm/cpu/registers.c | 2 ++ 2 files changed, 6 insertions(+) diff --git a/reactos/lib/fast486/fpu.c b/reactos/lib/fast486/fpu.c index a0399e57ebf..3da63f4b368 100644 --- a/reactos/lib/fast486/fpu.c +++ b/reactos/lib/fast486/fpu.c @@ -32,6 +32,8 @@ /* PRIVATE FUNCTIONS **********************************************************/ +#ifndef FAST486_NO_FPU + static ULONGLONG UnsignedMult128(ULONGLONG Multiplicand, ULONGLONG Multiplier, @@ -303,6 +305,8 @@ Fast486FpuDivide(PFAST486_STATE State, UNIMPLEMENTED; } +#endif + /* PUBLIC FUNCTIONS ***********************************************************/ FAST486_OPCODE_HANDLER(Fast486FpuOpcodeD8DC) diff --git a/reactos/subsystems/ntvdm/cpu/registers.c b/reactos/subsystems/ntvdm/cpu/registers.c index a326fda00d1..7056787e0e5 100644 --- a/reactos/subsystems/ntvdm/cpu/registers.c +++ b/reactos/subsystems/ntvdm/cpu/registers.c @@ -39,6 +39,7 @@ getIntelRegistersPointer(VOID) IntelRegPtr.Dr7 = EmulatorContext.DebugRegisters[FAST486_REG_DR7]; } +#ifndef FAST486_NO_FPU if (IntelRegPtr.ContextFlags & CONTEXT_FLOATING_POINT) { // IntelRegPtr.FloatSave = ; @@ -52,6 +53,7 @@ getIntelRegistersPointer(VOID) // IntelRegPtr.FloatSave.RegisterArea = ; // This is a region of size SIZE_OF_80387_REGISTERS == 80 bytes // IntelRegPtr.FloatSave.Cr0NpxState = ; } +#endif if (IntelRegPtr.ContextFlags & CONTEXT_SEGMENTS) { From 439fa169035838b251d7c3aefc234957b2c42af4 Mon Sep 17 00:00:00 2001 From: Amine Khaldi Date: Sun, 26 Oct 2014 11:55:05 +0000 Subject: [PATCH 45/91] [ADVAPI32] * Import ADVAPI_GetComputerSid from Wine 1.7.27. * Apply Wine commit f7a6c4c3 by Detlef Riekenberg: Allow string alias for common RID in sid strings. CORE-8540 svn path=/trunk/; revision=65010 --- reactos/dll/win32/advapi32/wine/security.c | 66 +++++++++++++++++----- 1 file changed, 52 insertions(+), 14 deletions(-) diff --git a/reactos/dll/win32/advapi32/wine/security.c b/reactos/dll/win32/advapi32/wine/security.c index 8502eb43a12..ed00f03e525 100644 --- a/reactos/dll/win32/advapi32/wine/security.c +++ b/reactos/dll/win32/advapi32/wine/security.c @@ -115,26 +115,28 @@ static const WELLKNOWNSID WellKnownSids[] = { {'S','I'}, WinSystemLabelSid, { SID_REVISION, 1, { SECURITY_MANDATORY_LABEL_AUTHORITY}, { SECURITY_MANDATORY_SYSTEM_RID } } }, }; +/* these SIDs must be constructed as relative to some domain - only the RID is well-known */ typedef struct WELLKNOWNRID { + WCHAR wstr[2]; WELL_KNOWN_SID_TYPE Type; DWORD Rid; } WELLKNOWNRID; static const WELLKNOWNRID WellKnownRids[] = { - { WinAccountAdministratorSid, DOMAIN_USER_RID_ADMIN }, - { WinAccountGuestSid, DOMAIN_USER_RID_GUEST }, - { WinAccountKrbtgtSid, DOMAIN_USER_RID_KRBTGT }, - { WinAccountDomainAdminsSid, DOMAIN_GROUP_RID_ADMINS }, - { WinAccountDomainUsersSid, DOMAIN_GROUP_RID_USERS }, - { WinAccountDomainGuestsSid, DOMAIN_GROUP_RID_GUESTS }, - { WinAccountComputersSid, DOMAIN_GROUP_RID_COMPUTERS }, - { WinAccountControllersSid, DOMAIN_GROUP_RID_CONTROLLERS }, - { WinAccountCertAdminsSid, DOMAIN_GROUP_RID_CERT_ADMINS }, - { WinAccountSchemaAdminsSid, DOMAIN_GROUP_RID_SCHEMA_ADMINS }, - { WinAccountEnterpriseAdminsSid, DOMAIN_GROUP_RID_ENTERPRISE_ADMINS }, - { WinAccountPolicyAdminsSid, DOMAIN_GROUP_RID_POLICY_ADMINS }, - { WinAccountRasAndIasServersSid, DOMAIN_ALIAS_RID_RAS_SERVERS }, + { {'L','A'}, WinAccountAdministratorSid, DOMAIN_USER_RID_ADMIN }, + { {'L','G'}, WinAccountGuestSid, DOMAIN_USER_RID_GUEST }, + { {0,0}, WinAccountKrbtgtSid, DOMAIN_USER_RID_KRBTGT }, + { {0,0}, WinAccountDomainAdminsSid, DOMAIN_GROUP_RID_ADMINS }, + { {0,0}, WinAccountDomainUsersSid, DOMAIN_GROUP_RID_USERS }, + { {0,0}, WinAccountDomainGuestsSid, DOMAIN_GROUP_RID_GUESTS }, + { {0,0}, WinAccountComputersSid, DOMAIN_GROUP_RID_COMPUTERS }, + { {0,0}, WinAccountControllersSid, DOMAIN_GROUP_RID_CONTROLLERS }, + { {0,0}, WinAccountCertAdminsSid, DOMAIN_GROUP_RID_CERT_ADMINS }, + { {0,0}, WinAccountSchemaAdminsSid, DOMAIN_GROUP_RID_SCHEMA_ADMINS }, + { {0,0}, WinAccountEnterpriseAdminsSid, DOMAIN_GROUP_RID_ENTERPRISE_ADMINS }, + { {0,0}, WinAccountPolicyAdminsSid, DOMAIN_GROUP_RID_POLICY_ADMINS }, + { {0,0}, WinAccountRasAndIasServersSid, DOMAIN_ALIAS_RID_RAS_SERVERS }, }; static const SID sidWorld = { SID_REVISION, 1, { SECURITY_WORLD_SID_AUTHORITY} , { SECURITY_WORLD_RID } }; @@ -301,6 +303,24 @@ BOOL ADVAPI_IsLocalComputer(LPCWSTR ServerName) return Result; } +/************************************************************ + * ADVAPI_GetComputerSid + */ +BOOL ADVAPI_GetComputerSid(PSID sid) +{ + static const struct /* same fields as struct SID */ + { + BYTE Revision; + BYTE SubAuthorityCount; + SID_IDENTIFIER_AUTHORITY IdentifierAuthority; + DWORD SubAuthority[4]; + } computer_sid = + { SID_REVISION, 4, { SECURITY_NT_AUTHORITY }, { SECURITY_NT_NON_UNIQUE, 0, 0, 0 } }; + + memcpy( sid, &computer_sid, sizeof(computer_sid) ); + return TRUE; +} + /* Exported functions */ /* @@ -3621,6 +3641,15 @@ static DWORD ComputeStringSidSize(LPCWSTR StringSid) for (i = 0; i < sizeof(WellKnownSids)/sizeof(WellKnownSids[0]); i++) if (!strncmpW(WellKnownSids[i].wstr, StringSid, 2)) return GetSidLengthRequired(WellKnownSids[i].Sid.SubAuthorityCount); + + for (i = 0; i < sizeof(WellKnownRids)/sizeof(WellKnownRids[0]); i++) + if (!strncmpW(WellKnownRids[i].wstr, StringSid, 2)) + { + MAX_SID local; + ADVAPI_GetComputerSid(&local); + return GetSidLengthRequired(*GetSidSubAuthorityCount(&local) + 1); + } + } return GetSidLengthRequired(0); @@ -3648,7 +3677,7 @@ static BOOL ParseStringSidToSid(LPCWSTR StringSid, PSID pSid, LPDWORD cBytes) *cBytes = ComputeStringSidSize(StringSid); if (!pisid) /* Simply compute the size */ { - TRACE("only size requested, returning TRUE\n"); + TRACE("only size requested, returning TRUE with %d\n", *cBytes); return TRUE; } @@ -3727,6 +3756,15 @@ static BOOL ParseStringSidToSid(LPCWSTR StringSid, PSID pSid, LPDWORD cBytes) bret = TRUE; } + for (i = 0; i < sizeof(WellKnownRids)/sizeof(WellKnownRids[0]); i++) + if (!strncmpW(WellKnownRids[i].wstr, StringSid, 2)) + { + ADVAPI_GetComputerSid(pisid); + pisid->SubAuthority[pisid->SubAuthorityCount] = WellKnownRids[i].Rid; + pisid->SubAuthorityCount++; + bret = TRUE; + } + if (!bret) FIXME("String constant not supported: %s\n", debugstr_wn(StringSid, 2)); } From 95928b831bea4f0a959bbbbd6c7318b08b9a2835 Mon Sep 17 00:00:00 2001 From: Aleksandar Andrejevic Date: Sun, 26 Oct 2014 14:57:44 +0000 Subject: [PATCH 46/91] [NTVDM] Signal the next IRQ on EOI. svn path=/trunk/; revision=65011 --- reactos/subsystems/ntvdm/hardware/pic.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/reactos/subsystems/ntvdm/hardware/pic.c b/reactos/subsystems/ntvdm/hardware/pic.c index b5de2b407c2..624c825c084 100644 --- a/reactos/subsystems/ntvdm/hardware/pic.c +++ b/reactos/subsystems/ntvdm/hardware/pic.c @@ -85,6 +85,12 @@ static VOID PicWriteCommand(BYTE Port, BYTE Value) /* Otherwise, clear all of them */ Pic->InServiceRegister = 0; } + + if (MasterPic.IntRequestRegister || SlavePic.IntRequestRegister) + { + /* Signal the next IRQ */ + EmulatorInterruptSignal(); + } } } From 454d38da2242862dcafa46e244d789da9a3639a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herm=C3=A8s=20B=C3=A9lusca-Ma=C3=AFto?= Date: Sun, 26 Oct 2014 15:01:14 +0000 Subject: [PATCH 47/91] [NTVDM]: Return the latched data for keyboard ps/2 port only. Also when starting an app put a ENTER key release into the keyboard buffer because some apps expect it. svn path=/trunk/; revision=65012 --- reactos/subsystems/ntvdm/dos/dos32krnl/dos.c | 9 +++++++++ reactos/subsystems/ntvdm/hardware/keyboard.c | 2 +- reactos/subsystems/ntvdm/hardware/ps2.c | 20 +++++++++++++++++--- 3 files changed, 27 insertions(+), 4 deletions(-) diff --git a/reactos/subsystems/ntvdm/dos/dos32krnl/dos.c b/reactos/subsystems/ntvdm/dos/dos32krnl/dos.c index f98ef757ba0..582e43c558a 100644 --- a/reactos/subsystems/ntvdm/dos/dos32krnl/dos.c +++ b/reactos/subsystems/ntvdm/dos/dos32krnl/dos.c @@ -20,6 +20,9 @@ #include "bios/bios.h" +#include "io.h" +#include "hardware/ps2.h" + /* PRIVATE VARIABLES **********************************************************/ CALLBACK16 DosContext; @@ -1164,6 +1167,12 @@ DWORD DosStartProcess(IN LPCSTR ExecutablePath, /* Attach to the console */ VidBiosAttachToConsole(); // FIXME: And in fact, attach the full NTVDM UI to the console + // HACK: Simulate a ENTER key release scancode on the PS/2 port because + // some apps expect to read a key release scancode (> 0x80) when they + // are started. + IOWriteB(PS2_CONTROL_PORT, 0xD2); // Next write is for the first PS/2 port + IOWriteB(PS2_DATA_PORT, 0x80 | 0x1C); // ENTER key release + /* Start simulation */ SetEvent(VdmTaskEvent); CpuSimulate(); diff --git a/reactos/subsystems/ntvdm/hardware/keyboard.c b/reactos/subsystems/ntvdm/hardware/keyboard.c index 5e98bf73e89..fbd1d7ac265 100644 --- a/reactos/subsystems/ntvdm/hardware/keyboard.c +++ b/reactos/subsystems/ntvdm/hardware/keyboard.c @@ -47,7 +47,7 @@ VOID KeyboardEventHandler(PKEY_EVENT_RECORD KeyEvent) BOOLEAN KeyboardInit(BYTE PS2Connector) { - /* Finish to plug the mouse to the specified PS/2 port */ + /* Finish to plug the keyboard to the specified PS/2 port */ PS2Port = PS2Connector; PS2SetDeviceCmdProc(PS2Port, NULL, KeyboardCommand); diff --git a/reactos/subsystems/ntvdm/hardware/ps2.c b/reactos/subsystems/ntvdm/hardware/ps2.c index bfede556a03..b7e6c13a9af 100644 --- a/reactos/subsystems/ntvdm/hardware/ps2.c +++ b/reactos/subsystems/ntvdm/hardware/ps2.c @@ -80,11 +80,14 @@ static BYTE WINAPI PS2ReadPort(USHORT Port) if (StatusRegister & (1 << 0)) // || StatusRegister & (1 << 5) for second PS/2 port StatusRegister &= ~(1 << 0); // StatusRegister &= ~(1 << 5); + // FIXME: We may check there whether there is data latched in + // PS2 ports 1 or 2 (keyboard or mouse) and retrieve it there... + /* Always return the available byte stored in the output buffer */ return OutputBuffer; } - return 0; + return 0x00; } static VOID WINAPI PS2WritePort(USHORT Port, BYTE Data) @@ -270,7 +273,18 @@ static BOOLEAN PS2PortQueueRead(BYTE PS2Port) if (!Port->IsEnabled) return FALSE; /* Make sure the queue is not empty (fast check) */ - if (Port->QueueEmpty) return FALSE; + if (Port->QueueEmpty) + { + /* Only the keyboard should have its last data latched */ + // FIXME: Alternatively this can be done in PS2ReadPort when + // we read PS2_DATA_PORT. What is the best solution?? + if (PS2Port == 0) + { + OutputBuffer = Port->Queue[(Port->QueueStart - 1) % BUFFER_SIZE]; + } + + return FALSE; + } WaitForSingleObject(Port->QueueMutex, INFINITE); @@ -337,7 +351,7 @@ BOOLEAN PS2QueuePush(BYTE PS2Port, BYTE Data) Port->QueueEnd++; Port->QueueEnd %= BUFFER_SIZE; - /* Since we inserted a value, it's not empty anymore */ + /* The queue is not empty anymore */ Port->QueueEmpty = FALSE; /* From caedf961bbcca193c5d0794e96104d953470e380 Mon Sep 17 00:00:00 2001 From: Pierre Schweitzer Date: Sun, 26 Oct 2014 15:35:18 +0000 Subject: [PATCH 48/91] [FASTFAT] Don't leak reference on failure in vfatPrepareTargetForRename(). svn path=/trunk/; revision=65013 --- reactos/drivers/filesystems/fastfat/finfo.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/reactos/drivers/filesystems/fastfat/finfo.c b/reactos/drivers/filesystems/fastfat/finfo.c index 87a30843b4b..b5199dac18d 100644 --- a/reactos/drivers/filesystems/fastfat/finfo.c +++ b/reactos/drivers/filesystems/fastfat/finfo.c @@ -400,6 +400,7 @@ vfatPrepareTargetForRename( /* If that's a directory or a read-only file, we're not allowed */ if (vfatFCBIsDirectory(TargetFcb) || ((*TargetFcb->Attributes & FILE_ATTRIBUTE_READONLY) == FILE_ATTRIBUTE_READONLY)); { + vfatReleaseFCB(DeviceExt, *ParentFCB); *ParentFCB = NULL; vfatReleaseFCB(DeviceExt, TargetFcb); return STATUS_OBJECT_NAME_COLLISION; @@ -408,6 +409,7 @@ vfatPrepareTargetForRename( /* Attempt to flush (might close the file) */ if (!MmFlushImageSection(TargetFcb->FileObject->SectionObjectPointer, MmFlushForDelete)) { + vfatReleaseFCB(DeviceExt, *ParentFCB); *ParentFCB = NULL; vfatReleaseFCB(DeviceExt, TargetFcb); return STATUS_ACCESS_DENIED; @@ -416,6 +418,7 @@ vfatPrepareTargetForRename( /* If we are, ensure the file isn't open by anyone! */ if (TargetFcb->OpenHandleCount != 0) { + vfatReleaseFCB(DeviceExt, *ParentFCB); *ParentFCB = NULL; vfatReleaseFCB(DeviceExt, TargetFcb); return STATUS_ACCESS_DENIED; @@ -429,6 +432,7 @@ vfatPrepareTargetForRename( } else { + vfatReleaseFCB(DeviceExt, *ParentFCB); *ParentFCB = NULL; vfatReleaseFCB(DeviceExt, TargetFcb); return STATUS_OBJECT_NAME_COLLISION; From cb5688fcf00c7c53a16c32a940625156353f5a0b Mon Sep 17 00:00:00 2001 From: Pierre Schweitzer Date: Sun, 26 Oct 2014 15:56:20 +0000 Subject: [PATCH 49/91] [FASTFAT] Make FATGetNextDirEntry() and vfatFindDirSpace() complain when they are given a cleaned up FCB (which shouldn't happen!). They'll display full path, references count, open handles count. Where are you little reference leak? svn path=/trunk/; revision=65014 --- reactos/drivers/filesystems/fastfat/direntry.c | 6 ++++++ reactos/drivers/filesystems/fastfat/dirwr.c | 5 +++++ 2 files changed, 11 insertions(+) diff --git a/reactos/drivers/filesystems/fastfat/direntry.c b/reactos/drivers/filesystems/fastfat/direntry.c index 336f014ad5f..f3dc5b9fb06 100644 --- a/reactos/drivers/filesystems/fastfat/direntry.c +++ b/reactos/drivers/filesystems/fastfat/direntry.c @@ -201,6 +201,12 @@ FATGetNextDirEntry( CcUnpinData(*pContext); } + if (!pDirFcb->FileObject) + { + DPRINT1("Buggy FCB (cleaned up)! %S (%d / %u)\n", pDirFcb->PathNameBuffer, pDirFcb->RefCount, pDirFcb->OpenHandleCount); + return STATUS_NO_MORE_ENTRIES; + } + if (FileOffset.u.LowPart >= pDirFcb->RFCB.FileSize.u.LowPart || !CcMapData(pDirFcb->FileObject, &FileOffset, PAGE_SIZE, TRUE, pContext, pPage)) { diff --git a/reactos/drivers/filesystems/fastfat/dirwr.c b/reactos/drivers/filesystems/fastfat/dirwr.c index 21b0e6945c0..e9622a846f1 100644 --- a/reactos/drivers/filesystems/fastfat/dirwr.c +++ b/reactos/drivers/filesystems/fastfat/dirwr.c @@ -167,6 +167,11 @@ vfatFindDirSpace( { CcUnpinData(Context); } + if (!pDirFcb->FileObject) + { + DPRINT1("Buggy FCB (cleaned up)! %S (%d / %u)\n", pDirFcb->PathNameBuffer, pDirFcb->RefCount, pDirFcb->OpenHandleCount); + return FALSE; + } if (!CcPinRead(pDirFcb->FileObject, &FileOffset, DeviceExt->FatInfo.BytesPerCluster, TRUE, &Context, (PVOID*)&pFatEntry)) { From 53adda25130af666a29f5406023273f206be354f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herm=C3=A8s=20B=C3=A9lusca-Ma=C3=AFto?= Date: Sun, 26 Oct 2014 15:57:21 +0000 Subject: [PATCH 50/91] [NTVDM]: No need to re-change to a given video mode when it is already set. Fixes strange changes for e.g. some apps that find intelligent to switch 256 times to mode 13h (for example) before continuing to run. svn path=/trunk/; revision=65015 --- reactos/subsystems/ntvdm/bios/vidbios.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/reactos/subsystems/ntvdm/bios/vidbios.c b/reactos/subsystems/ntvdm/bios/vidbios.c index 3948121b74c..3db458feda6 100644 --- a/reactos/subsystems/ntvdm/bios/vidbios.c +++ b/reactos/subsystems/ntvdm/bios/vidbios.c @@ -2308,6 +2308,9 @@ static BOOLEAN VidBiosSetVideoMode(BYTE ModeNumber) return FALSE; } + /* Check if this is the same mode */ + if (ModeNumber == Bda->VideoMode) return TRUE; + VgaMode = VideoModes[ModeNumber]; DPRINT1("Switching to mode %02Xh %s clearing the screen; VgaMode = 0x%p\n", From 283d189dda4dee83d0540e88a0153e06fab3f2b4 Mon Sep 17 00:00:00 2001 From: Amine Khaldi Date: Sun, 26 Oct 2014 15:59:57 +0000 Subject: [PATCH 51/91] [ADVAPI32] * Update DeleteAce(). CORE-8540 svn path=/trunk/; revision=65016 --- reactos/dll/win32/advapi32/wine/security.c | 21 ++++----------------- 1 file changed, 4 insertions(+), 17 deletions(-) diff --git a/reactos/dll/win32/advapi32/wine/security.c b/reactos/dll/win32/advapi32/wine/security.c index ed00f03e525..c1385780a25 100644 --- a/reactos/dll/win32/advapi32/wine/security.c +++ b/reactos/dll/win32/advapi32/wine/security.c @@ -1072,25 +1072,12 @@ AddAce(PACL pAcl, return TRUE; } -/* - * @implemented +/****************************************************************************** + * DeleteAce [ADVAPI32.@] */ -BOOL -WINAPI -DeleteAce(PACL pAcl, - DWORD dwAceIndex) +BOOL WINAPI DeleteAce(PACL pAcl, DWORD dwAceIndex) { - NTSTATUS Status; - - Status = RtlDeleteAce(pAcl, - dwAceIndex); - if (!NT_SUCCESS(Status)) - { - SetLastError(RtlNtStatusToDosError(Status)); - return FALSE; - } - - return TRUE; + return set_ntstatus(RtlDeleteAce(pAcl, dwAceIndex)); } /* From b10d8f468677503795bd73171a7a9b6f56a4723f Mon Sep 17 00:00:00 2001 From: Amine Khaldi Date: Sun, 26 Oct 2014 16:48:36 +0000 Subject: [PATCH 52/91] [ADVAPI32] * Update GetAce(). CORE-8540 svn path=/trunk/; revision=65017 --- reactos/dll/win32/advapi32/wine/security.c | 24 ++++------------------ 1 file changed, 4 insertions(+), 20 deletions(-) diff --git a/reactos/dll/win32/advapi32/wine/security.c b/reactos/dll/win32/advapi32/wine/security.c index c1385780a25..87afe5fd500 100644 --- a/reactos/dll/win32/advapi32/wine/security.c +++ b/reactos/dll/win32/advapi32/wine/security.c @@ -1092,28 +1092,12 @@ FindFirstFreeAce(PACL pAcl, (PACE*)pAce); } - -/* - * @implemented +/****************************************************************************** + * GetAce [ADVAPI32.@] */ -BOOL -WINAPI -GetAce(PACL pAcl, - DWORD dwAceIndex, - LPVOID *pAce) +BOOL WINAPI GetAce(PACL pAcl,DWORD dwAceIndex,LPVOID *pAce ) { - NTSTATUS Status; - - Status = RtlGetAce(pAcl, - dwAceIndex, - pAce); - if (!NT_SUCCESS(Status)) - { - SetLastError(RtlNtStatusToDosError(Status)); - return FALSE; - } - - return TRUE; + return set_ntstatus(RtlGetAce(pAcl, dwAceIndex, pAce)); } /* From d07dc3a5c24c3367f474983b4c538018a4ca8ae3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herm=C3=A8s=20B=C3=A9lusca-Ma=C3=AFto?= Date: Sun, 26 Oct 2014 16:56:14 +0000 Subject: [PATCH 53/91] [NTVDM]: Temporarily fix for r65015 before a proper fix. svn path=/trunk/; revision=65018 --- reactos/subsystems/ntvdm/bios/vidbios.c | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/reactos/subsystems/ntvdm/bios/vidbios.c b/reactos/subsystems/ntvdm/bios/vidbios.c index 3db458feda6..bb5e5376136 100644 --- a/reactos/subsystems/ntvdm/bios/vidbios.c +++ b/reactos/subsystems/ntvdm/bios/vidbios.c @@ -2296,9 +2296,16 @@ static BOOLEAN VidBiosSetVideoMode(BYTE ModeNumber) { BYTE Page; COORD Resolution; - BOOLEAN DoNotClear = !!(ModeNumber & 0x80); PVGA_REGISTERS VgaMode; + /* + * IBM standard modes do not clear the screen if the + * high bit of AL is set (EGA or higher only). + * See Ralf Brown: http://www.ctyme.com/intr/rb-0069.htm + * for more information. + */ + BOOLEAN DoNotClear = !!(ModeNumber & 0x80); + /* Retrieve the real mode number and check its validity */ ModeNumber &= 0x7F; // if (ModeNumber >= sizeof(VideoModes)/sizeof(VideoModes[0])) @@ -2308,8 +2315,13 @@ static BOOLEAN VidBiosSetVideoMode(BYTE ModeNumber) return FALSE; } - /* Check if this is the same mode */ - if (ModeNumber == Bda->VideoMode) return TRUE; + /* Check if this is the current mode */ + if (ModeNumber == Bda->VideoMode) + { + /* Just clear the VGA memory if needed */ + if (!DoNotClear) VgaClearMemory(); + return TRUE; + } VgaMode = VideoModes[ModeNumber]; @@ -2320,12 +2332,7 @@ static BOOLEAN VidBiosSetVideoMode(BYTE ModeNumber) VgaChangePalette(ModeNumber); - /* - * IBM standard modes do not clear the screen if the - * high bit of AL is set (EGA or higher only). - * See Ralf Brown: http://www.ctyme.com/intr/rb-0069.htm - * for more information. - */ + /* Clear the VGA memory if needed */ if (!DoNotClear) VgaClearMemory(); // Bda->CrtModeControl; From cc4ef02bd01dc43c70def40de9be2dc5f8bd4946 Mon Sep 17 00:00:00 2001 From: Thomas Faber Date: Sun, 26 Oct 2014 17:32:00 +0000 Subject: [PATCH 54/91] [CRT] - Fix strlen/wcslen FPO specification. Spotted by Timo. - Also add FPO info for memset, memchr, memmove/memcpy svn path=/trunk/; revision=65021 --- reactos/lib/sdk/crt/mem/i386/memchr_asm.s | 4 +++- reactos/lib/sdk/crt/mem/i386/memmove_asm.s | 4 +++- reactos/lib/sdk/crt/mem/i386/memset_asm.s | 4 +++- reactos/lib/sdk/crt/string/i386/tcsnlen.inc | 2 +- 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/reactos/lib/sdk/crt/mem/i386/memchr_asm.s b/reactos/lib/sdk/crt/mem/i386/memchr_asm.s index 37e5deb9f52..5a72c94e691 100644 --- a/reactos/lib/sdk/crt/mem/i386/memchr_asm.s +++ b/reactos/lib/sdk/crt/mem/i386/memchr_asm.s @@ -14,7 +14,8 @@ PUBLIC _memchr .code -_memchr: +FUNC _memchr + FPO 0, 3, 4, 1, 1, FRAME_NONFPO push ebp mov ebp, esp push edi @@ -33,5 +34,6 @@ _memchr: pop edi leave ret +ENDFUNC END diff --git a/reactos/lib/sdk/crt/mem/i386/memmove_asm.s b/reactos/lib/sdk/crt/mem/i386/memmove_asm.s index 476f843befe..299b2cc8d38 100644 --- a/reactos/lib/sdk/crt/mem/i386/memmove_asm.s +++ b/reactos/lib/sdk/crt/mem/i386/memmove_asm.s @@ -11,7 +11,8 @@ PUBLIC _memmove .code _memcpy: -_memmove: +FUNC _memmove + FPO 0, 3, 5, 2, 1, FRAME_NONFPO push ebp mov ebp, esp @@ -116,5 +117,6 @@ _memmove: dec esi dec edi jmp .L8 +ENDFUNC END diff --git a/reactos/lib/sdk/crt/mem/i386/memset_asm.s b/reactos/lib/sdk/crt/mem/i386/memset_asm.s index dc964ac3969..ba04724b443 100644 --- a/reactos/lib/sdk/crt/mem/i386/memset_asm.s +++ b/reactos/lib/sdk/crt/mem/i386/memset_asm.s @@ -9,7 +9,8 @@ PUBLIC _memset .code -_memset: +FUNC _memset + FPO 0, 3, 4, 1, 1, FRAME_NONFPO push ebp mov ebp, esp push edi @@ -45,5 +46,6 @@ _memset: mov eax, [ebp + 8] leave ret +ENDFUNC END diff --git a/reactos/lib/sdk/crt/string/i386/tcsnlen.inc b/reactos/lib/sdk/crt/string/i386/tcsnlen.inc index d8741188c59..58febca97a6 100644 --- a/reactos/lib/sdk/crt/string/i386/tcsnlen.inc +++ b/reactos/lib/sdk/crt/string/i386/tcsnlen.inc @@ -6,7 +6,7 @@ PUBLIC _tcsnlen .code FUNC _tcsnlen - FPO 0, 1, 1, 1, 0, FRAME_FPO + FPO 0, 2, 1, 1, 0, FRAME_FPO push edi mov edi, [esp + 8] mov ecx, [esp + 12] From f7a65d315535ddf38b3df46c72f904548e4d13e7 Mon Sep 17 00:00:00 2001 From: Amine Khaldi Date: Sun, 26 Oct 2014 17:51:59 +0000 Subject: [PATCH 55/91] [ADVAPI32] * Update GetAclInformation(). CORE-8540 svn path=/trunk/; revision=65022 --- reactos/dll/win32/advapi32/wine/security.c | 30 +++++++--------------- 1 file changed, 9 insertions(+), 21 deletions(-) diff --git a/reactos/dll/win32/advapi32/wine/security.c b/reactos/dll/win32/advapi32/wine/security.c index 87afe5fd500..9f661a5c023 100644 --- a/reactos/dll/win32/advapi32/wine/security.c +++ b/reactos/dll/win32/advapi32/wine/security.c @@ -1100,29 +1100,17 @@ BOOL WINAPI GetAce(PACL pAcl,DWORD dwAceIndex,LPVOID *pAce ) return set_ntstatus(RtlGetAce(pAcl, dwAceIndex, pAce)); } -/* - * @implemented +/****************************************************************************** + * GetAclInformation [ADVAPI32.@] */ -BOOL -WINAPI -GetAclInformation(PACL pAcl, - LPVOID pAclInformation, - DWORD nAclInformationLength, - ACL_INFORMATION_CLASS dwAclInformationClass) +BOOL WINAPI GetAclInformation( + PACL pAcl, + LPVOID pAclInformation, + DWORD nAclInformationLength, + ACL_INFORMATION_CLASS dwAclInformationClass) { - NTSTATUS Status; - - Status = RtlQueryInformationAcl(pAcl, - pAclInformation, - nAclInformationLength, - dwAclInformationClass); - if (!NT_SUCCESS(Status)) - { - SetLastError(RtlNtStatusToDosError(Status)); - return FALSE; - } - - return TRUE; + return set_ntstatus(RtlQueryInformationAcl(pAcl, pAclInformation, + nAclInformationLength, dwAclInformationClass)); } /* From 7491f794e3fc95955e6af68f6a7d3d0f52480a66 Mon Sep 17 00:00:00 2001 From: Eric Kohl Date: Sun, 26 Oct 2014 18:39:58 +0000 Subject: [PATCH 56/91] [NTOS:SE] Remove the old access check code in SepAccessCheckEx and use the new code instead. The new access check code is a lot better than the old code, but it makes the boot and install fail. This is caused by some kernel objects which are accessed using insufficient access rights. Therefore I added a little hack that shows a warning when insufficient rights are granted for an object and access is granted anyway. svn path=/trunk/; revision=65023 --- reactos/ntoskrnl/se/accesschk.c | 52 +++++++-------------------------- 1 file changed, 10 insertions(+), 42 deletions(-) diff --git a/reactos/ntoskrnl/se/accesschk.c b/reactos/ntoskrnl/se/accesschk.c index 32daa917c86..5f59f5ab89e 100644 --- a/reactos/ntoskrnl/se/accesschk.c +++ b/reactos/ntoskrnl/se/accesschk.c @@ -18,8 +18,6 @@ /* PRIVATE FUNCTIONS **********************************************************/ -#define OLD_ACCESS_CHECK - BOOLEAN NTAPI SepAccessCheckEx(IN PSECURITY_DESCRIPTOR SecurityDescriptor, IN PSECURITY_SUBJECT_CONTEXT SubjectSecurityContext, @@ -48,6 +46,8 @@ SepAccessCheckEx(IN PSECURITY_DESCRIPTOR SecurityDescriptor, NTSTATUS Status; PAGED_CODE(); + DPRINT("SepAccessCheckEx()\n"); + /* Check for no access desired */ if (!DesiredAccess) { @@ -210,11 +210,6 @@ SepAccessCheckEx(IN PSECURITY_DESCRIPTOR SecurityDescriptor, { if (SepSidInToken(Token, Sid)) { -#ifdef OLD_ACCESS_CHECK - PreviouslyGrantedAccess = 0; - Status = STATUS_ACCESS_DENIED; - goto ReturnCommonStatus; -#else /* Map access rights from the ACE */ TempAccess = CurrentAce->AccessMask; RtlMapGenericMask(&TempAccess, GenericMapping); @@ -222,25 +217,21 @@ SepAccessCheckEx(IN PSECURITY_DESCRIPTOR SecurityDescriptor, /* Leave if a remaining right must be denied */ if (RemainingAccess & TempAccess) break; -#endif } } else if (CurrentAce->Header.AceType == ACCESS_ALLOWED_ACE_TYPE) { if (SepSidInToken(Token, Sid)) { -#ifdef OLD_ACCESS_CHECK - TempAccess = CurrentAce->AccessMask; - RtlMapGenericMask(&TempAccess, GenericMapping); - PreviouslyGrantedAccess |= TempAccess; -#else /* Map access rights from the ACE */ TempAccess = CurrentAce->AccessMask; + DPRINT("TempAccess 0x%08lx\n", TempAccess); RtlMapGenericMask(&TempAccess, GenericMapping); /* Remove granted rights */ + DPRINT("RemainingAccess 0x%08lx TempAccess 0x%08lx\n", RemainingAccess, TempAccess); RemainingAccess &= ~TempAccess; -#endif + DPRINT("RemainingAccess 0x%08lx\n", RemainingAccess); } } else @@ -253,58 +244,35 @@ SepAccessCheckEx(IN PSECURITY_DESCRIPTOR SecurityDescriptor, CurrentAce = (PACE)((ULONG_PTR)CurrentAce + CurrentAce->Header.AceSize); } -#ifdef OLD_ACCESS_CHECK - DPRINT("PreviouslyGrantedAccess %08lx\n DesiredAccess %08lx\n", - PreviouslyGrantedAccess, DesiredAccess); - - PreviouslyGrantedAccess &= DesiredAccess; - - if ((PreviouslyGrantedAccess & ~VALID_INHERIT_FLAGS) == - (DesiredAccess & ~VALID_INHERIT_FLAGS)) - { - Status = STATUS_SUCCESS; - goto ReturnCommonStatus; - } - else - { - DPRINT1("HACK: Should deny access for caller: granted 0x%lx, desired 0x%lx (generic mapping %p).\n", - PreviouslyGrantedAccess, DesiredAccess, GenericMapping); - //*AccessStatus = STATUS_ACCESS_DENIED; - //return FALSE; - PreviouslyGrantedAccess = DesiredAccess; - Status = STATUS_SUCCESS; - goto ReturnCommonStatus; - } -#else DPRINT("DesiredAccess %08lx\nPreviouslyGrantedAccess %08lx\nRemainingAccess %08lx\n", DesiredAccess, PreviouslyGrantedAccess, RemainingAccess); /* Fail if some rights have not been granted */ if (RemainingAccess != 0) { - *GrantedAccess = 0; + DPRINT1("HACK: RemainingAccess = 0x%08lx DesiredAccess = 0x%08lx\n", RemainingAccess, DesiredAccess); +#if 0 + /* HACK HACK HACK */ Status = STATUS_ACCESS_DENIED; goto ReturnCommonStatus; +#endif } /* Set granted access rights */ PreviouslyGrantedAccess |= DesiredAccess; - DPRINT("GrantedAccess %08lx\n", *GrantedAccess); - /* Fail if no rights have been granted */ if (PreviouslyGrantedAccess == 0) { + DPRINT1("PreviouslyGrantedAccess == 0 DesiredAccess = %08lx\n", DesiredAccess); Status = STATUS_ACCESS_DENIED; goto ReturnCommonStatus; } Status = STATUS_SUCCESS; goto ReturnCommonStatus; -#endif ReturnCommonStatus: - ResultListLength = UseResultList ? ObjectTypeListLength : 1; for (i = 0; i < ResultListLength; i++) { From d10c7decd5d2063a4582ac90fd78c7a9b842e28a Mon Sep 17 00:00:00 2001 From: Pierre Schweitzer Date: Sun, 26 Oct 2014 18:48:30 +0000 Subject: [PATCH 57/91] [FASTFAT] Acquire DirResource in DoQuery() before attempting to play with FCBs. This is dedicated to Thomas ;-) svn path=/trunk/; revision=65024 --- reactos/drivers/filesystems/fastfat/dir.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/reactos/drivers/filesystems/fastfat/dir.c b/reactos/drivers/filesystems/fastfat/dir.c index 57fda52556f..bf7dd1307da 100644 --- a/reactos/drivers/filesystems/fastfat/dir.c +++ b/reactos/drivers/filesystems/fastfat/dir.c @@ -504,6 +504,13 @@ DoQuery( DirContext.ShortNameU.Buffer = ShortNameBuffer; DirContext.ShortNameU.MaximumLength = sizeof(ShortNameBuffer); + if (!ExAcquireResourceExclusiveLite(&IrpContext->DeviceExt->DirResource, + (BOOLEAN)(IrpContext->Flags & IRPCONTEXT_CANWAIT))) + { + ExReleaseResourceLite(&pFcb->MainResource); + return VfatQueueRequest(IrpContext); + } + while ((Status == STATUS_SUCCESS) && (BufferLength > 0)) { Status = FindFile(IrpContext->DeviceExt, @@ -579,6 +586,7 @@ DoQuery( IrpContext->Irp->IoStatus.Information = Stack->Parameters.QueryDirectory.Length - BufferLength; } + ExReleaseResourceLite(&IrpContext->DeviceExt->DirResource); ExReleaseResourceLite(&pFcb->MainResource); return Status; From d345eefe9ce76731b8c266940720430a8f7d7d98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Poussineau?= Date: Sun, 26 Oct 2014 19:09:52 +0000 Subject: [PATCH 58/91] [NTFS] Fix some debug prints svn path=/trunk/; revision=65025 --- reactos/drivers/filesystems/ntfs/mft.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/reactos/drivers/filesystems/ntfs/mft.c b/reactos/drivers/filesystems/ntfs/mft.c index 864547ff3ae..cc8fa8556e4 100644 --- a/reactos/drivers/filesystems/ntfs/mft.c +++ b/reactos/drivers/filesystems/ntfs/mft.c @@ -85,7 +85,7 @@ FindAttributeHelper(PDEVICE_EXTENSION Vcb, PCWSTR Name, ULONG NameLength) { - DPRINT1("FindAttributeHelper(%p, %p, %p, 0x%x, %S, %u)\n", Vcb, AttrRecord, AttrRecordEnd, Type, Name, NameLength); + DPRINT("FindAttributeHelper(%p, %p, %p, 0x%x, %S, %u)\n", Vcb, AttrRecord, AttrRecordEnd, Type, Name, NameLength); while (AttrRecord < AttrRecordEnd) { @@ -146,7 +146,7 @@ FindAttributeHelper(PDEVICE_EXTENSION Vcb, PWCHAR AttrName; AttrName = (PWCHAR)((PCHAR)AttrRecord + AttrRecord->NameOffset); - DPRINT("%s, %s\n", AttrName, Name); + DPRINT("%.*S, %.*S\n", AttrRecord->NameLength, AttrName, NameLength, Name); if (RtlCompareMemory(AttrName, Name, NameLength << 1) == (NameLength << 1)) { /* Found it, fill up the context and return. */ @@ -180,7 +180,7 @@ FindAttribute(PDEVICE_EXTENSION Vcb, PNTFS_ATTR_RECORD AttrRecord; PNTFS_ATTR_RECORD AttrRecordEnd; - DPRINT1("FindAttribute(%p, %p, %u, %S, %u, %p)\n", Vcb, MftRecord, Type, Name, NameLength, AttrCtx); + DPRINT("FindAttribute(%p, %p, 0x%x, %S, %u, %p)\n", Vcb, MftRecord, Type, Name, NameLength, AttrCtx); AttrRecord = (PNTFS_ATTR_RECORD)((PCHAR)MftRecord + MftRecord->AttributeOffset); AttrRecordEnd = (PNTFS_ATTR_RECORD)((PCHAR)MftRecord + Vcb->NtfsInfo.BytesPerFileRecord); @@ -397,12 +397,12 @@ ReadFileRecord(PDEVICE_EXTENSION Vcb, { ULONGLONG BytesRead; - DPRINT1("ReadFileRecord(%p, %I64x, %p)\n", Vcb, index, file); + DPRINT("ReadFileRecord(%p, %I64x, %p)\n", Vcb, index, file); BytesRead = ReadAttribute(Vcb, Vcb->MFTContext, index * Vcb->NtfsInfo.BytesPerFileRecord, (PCHAR)file, Vcb->NtfsInfo.BytesPerFileRecord); if (BytesRead != Vcb->NtfsInfo.BytesPerFileRecord) { - DPRINT1("ReadFileRecord failed: %u read, %u expected\n", BytesRead, Vcb->NtfsInfo.BytesPerFileRecord); + DPRINT1("ReadFileRecord failed: %I64u read, %u expected\n", BytesRead, Vcb->NtfsInfo.BytesPerFileRecord); return STATUS_PARTIAL_COPY; } @@ -507,7 +507,7 @@ NtfsFindMftRecord(PDEVICE_EXTENSION Vcb, NTSTATUS Status; ULONG CurrentEntry = 0; - DPRINT1("NtfsFindMftRecord(%p, %I64d, %wZ, %p, %u, %p)\n", Vcb, MFTIndex, FileName, FirstEntry, DirSearch, OutMFTIndex); + DPRINT("NtfsFindMftRecord(%p, %I64d, %wZ, %p, %u, %p)\n", Vcb, MFTIndex, FileName, FirstEntry, DirSearch, OutMFTIndex); MftRecord = ExAllocatePoolWithTag(NonPagedPool, Vcb->NtfsInfo.BytesPerFileRecord, @@ -686,13 +686,13 @@ NtfsLookupFileAt(PDEVICE_EXTENSION Vcb, NTSTATUS Status; ULONG FirstEntry = 0; - DPRINT1("NtfsLookupFileAt(%p, %wZ, %p, %p, %I64x)\n", Vcb, PathName, FileRecord, DataContext, CurrentMFTIndex); + DPRINT("NtfsLookupFileAt(%p, %wZ, %p, %p, %I64x)\n", Vcb, PathName, FileRecord, DataContext, CurrentMFTIndex); FsRtlDissectName(*PathName, &Current, &Remaining); while (Current.Length != 0) { - DPRINT1("Current: %wZ\n", &Current); + DPRINT("Current: %wZ\n", &Current); Status = NtfsFindMftRecord(Vcb, CurrentMFTIndex, &Current, &FirstEntry, FALSE, &CurrentMFTIndex); if (!NT_SUCCESS(Status)) @@ -762,11 +762,12 @@ NtfsFindFileAt(PDEVICE_EXTENSION Vcb, { NTSTATUS Status; - DPRINT1("NtfsFindFileAt(%p, %wZ, %p, %p, %p, %p, %I64x)\n", Vcb, SearchPattern, FirstEntry, FileRecord, DataContext, MFTIndex, CurrentMFTIndex); + DPRINT("NtfsFindFileAt(%p, %wZ, %p, %p, %p, %p, %I64x)\n", Vcb, SearchPattern, FirstEntry, FileRecord, DataContext, MFTIndex, CurrentMFTIndex); Status = NtfsFindMftRecord(Vcb, CurrentMFTIndex, SearchPattern, FirstEntry, TRUE, &CurrentMFTIndex); if (!NT_SUCCESS(Status)) { + DPRINT("NtfsFindFileAt: NtfsFindMftRecord() failed with status 0x%08lx\n", Status); return Status; } From 0a8cd9075dccd8a4b0b4e3f730672fb7aaab5e94 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Poussineau?= Date: Sun, 26 Oct 2014 19:10:04 +0000 Subject: [PATCH 59/91] [NTFS] Correctly read indexes This fixes (at least) an infinite loop when trying to mount some partitions. svn path=/trunk/; revision=65026 --- reactos/drivers/filesystems/ntfs/mft.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/reactos/drivers/filesystems/ntfs/mft.c b/reactos/drivers/filesystems/ntfs/mft.c index cc8fa8556e4..d2f0d3b9d9b 100644 --- a/reactos/drivers/filesystems/ntfs/mft.c +++ b/reactos/drivers/filesystems/ntfs/mft.c @@ -631,9 +631,9 @@ NtfsFindMftRecord(PDEVICE_EXTENSION Vcb, IndexBuffer = (PINDEX_BUFFER)IndexRecord; ASSERT(IndexBuffer->Ntfs.Type == 'XDNI'); ASSERT(IndexBuffer->Header.AllocatedSize + 0x18 == IndexBlockSize); - IndexEntry = (PINDEX_ENTRY_ATTRIBUTE)(&IndexBuffer->Header + IndexBuffer->Header.FirstEntryOffset); - IndexEntryEnd = (PINDEX_ENTRY_ATTRIBUTE)(&IndexBuffer->Header + IndexBuffer->Header.TotalSizeOfEntries); - //ASSERT(IndexEntryEnd <= (PINDEX_ENTRY_ATTRIBUTE)((ULONG_PTR)IndexBuffer + IndexBlockSize)); FIXME: Why doesn't it work? + IndexEntry = (PINDEX_ENTRY_ATTRIBUTE)((ULONG_PTR)&IndexBuffer->Header + IndexBuffer->Header.FirstEntryOffset); + IndexEntryEnd = (PINDEX_ENTRY_ATTRIBUTE)((ULONG_PTR)&IndexBuffer->Header + IndexBuffer->Header.TotalSizeOfEntries); + ASSERT(IndexEntryEnd <= (PINDEX_ENTRY_ATTRIBUTE)((ULONG_PTR)IndexBuffer + IndexBlockSize)); while (IndexEntry < IndexEntryEnd && !(IndexEntry->Flags & NTFS_INDEX_ENTRY_END)) @@ -653,6 +653,7 @@ NtfsFindMftRecord(PDEVICE_EXTENSION Vcb, } ++CurrentEntry; + ASSERT(IndexEntry->Length >= sizeof(INDEX_ENTRY_ATTRIBUTE)); IndexEntry = (PINDEX_ENTRY_ATTRIBUTE)((PCHAR)IndexEntry + IndexEntry->Length); } From beb81cc389b312d4f57677013e34ae492c85d7b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Poussineau?= Date: Sun, 26 Oct 2014 19:10:17 +0000 Subject: [PATCH 60/91] [NTFS] Prefer long file name when naming objects We now always see the long file name of an object when browsing NTFS partitions. svn path=/trunk/; revision=65027 --- reactos/drivers/filesystems/ntfs/attrib.c | 13 +++++++++++-- reactos/drivers/filesystems/ntfs/dirctl.c | 8 ++++---- reactos/drivers/filesystems/ntfs/fcb.c | 4 ++-- reactos/drivers/filesystems/ntfs/ntfs.h | 2 +- 4 files changed, 18 insertions(+), 9 deletions(-) diff --git a/reactos/drivers/filesystems/ntfs/attrib.c b/reactos/drivers/filesystems/ntfs/attrib.c index aa525475015..9d00a794f6b 100644 --- a/reactos/drivers/filesystems/ntfs/attrib.c +++ b/reactos/drivers/filesystems/ntfs/attrib.c @@ -287,16 +287,25 @@ NtfsDumpFileAttributes(PFILE_RECORD_HEADER FileRecord) } PFILENAME_ATTRIBUTE -GetFileNameFromRecord(PFILE_RECORD_HEADER FileRecord) +GetFileNameFromRecord(PFILE_RECORD_HEADER FileRecord, UCHAR NameType) { PNTFS_ATTR_RECORD Attribute; + PFILENAME_ATTRIBUTE Name; Attribute = (PNTFS_ATTR_RECORD)((ULONG_PTR)FileRecord + FileRecord->AttributeOffset); while (Attribute < (PNTFS_ATTR_RECORD)((ULONG_PTR)FileRecord + FileRecord->BytesInUse) && Attribute->Type != AttributeEnd) { if (Attribute->Type == AttributeFileName) - return (PFILENAME_ATTRIBUTE)((ULONG_PTR)Attribute + Attribute->Resident.ValueOffset); + { + Name = (PFILENAME_ATTRIBUTE)((ULONG_PTR)Attribute + Attribute->Resident.ValueOffset); + if (Name->NameType == NameType || + (Name->NameType == NTFS_FILE_NAME_WIN32_AND_DOS && NameType == NTFS_FILE_NAME_WIN32) || + (Name->NameType == NTFS_FILE_NAME_WIN32_AND_DOS && NameType == NTFS_FILE_NAME_DOS)) + { + return Name; + } + } Attribute = (PNTFS_ATTR_RECORD)((ULONG_PTR)Attribute + Attribute->Length); } diff --git a/reactos/drivers/filesystems/ntfs/dirctl.c b/reactos/drivers/filesystems/ntfs/dirctl.c index a078686edd7..254cc190869 100644 --- a/reactos/drivers/filesystems/ntfs/dirctl.c +++ b/reactos/drivers/filesystems/ntfs/dirctl.c @@ -135,7 +135,7 @@ NtfsGetNameInformation(PDEVICE_EXTENSION DeviceExt, DPRINT("NtfsGetNameInformation() called\n"); - FileName = GetFileNameFromRecord(FileRecord); + FileName = GetFileNameFromRecord(FileRecord, NTFS_FILE_NAME_WIN32); ASSERT(FileName != NULL); Length = FileName->NameLength * sizeof (WCHAR); @@ -163,7 +163,7 @@ NtfsGetDirectoryInformation(PDEVICE_EXTENSION DeviceExt, DPRINT("NtfsGetDirectoryInformation() called\n"); - FileName = GetFileNameFromRecord(FileRecord); + FileName = GetFileNameFromRecord(FileRecord, NTFS_FILE_NAME_WIN32); ASSERT(FileName != NULL); Length = FileName->NameLength * sizeof (WCHAR); @@ -204,7 +204,7 @@ NtfsGetFullDirectoryInformation(PDEVICE_EXTENSION DeviceExt, DPRINT("NtfsGetFullDirectoryInformation() called\n"); - FileName = GetFileNameFromRecord(FileRecord); + FileName = GetFileNameFromRecord(FileRecord, NTFS_FILE_NAME_WIN32); ASSERT(FileName != NULL); Length = FileName->NameLength * sizeof (WCHAR); @@ -246,7 +246,7 @@ NtfsGetBothDirectoryInformation(PDEVICE_EXTENSION DeviceExt, DPRINT("NtfsGetBothDirectoryInformation() called\n"); - FileName = GetFileNameFromRecord(FileRecord); + FileName = GetFileNameFromRecord(FileRecord, NTFS_FILE_NAME_WIN32); ASSERT(FileName != NULL); Length = FileName->NameLength * sizeof (WCHAR); diff --git a/reactos/drivers/filesystems/ntfs/fcb.c b/reactos/drivers/filesystems/ntfs/fcb.c index c6765a5b268..1e71fd4db51 100644 --- a/reactos/drivers/filesystems/ntfs/fcb.c +++ b/reactos/drivers/filesystems/ntfs/fcb.c @@ -289,7 +289,7 @@ NtfsMakeRootFCB(PNTFS_VCB Vcb) return NULL; } - FileName = GetFileNameFromRecord(MftRecord); + FileName = GetFileNameFromRecord(MftRecord, NTFS_FILE_NAME_WIN32); if (!FileName) { ExFreePoolWithTag(MftRecord, TAG_NTFS); @@ -391,7 +391,7 @@ NtfsMakeFCBFromDirEntry(PNTFS_VCB Vcb, DPRINT1("NtfsMakeFCBFromDirEntry(%p, %p, %wZ, %p, %p)\n", Vcb, DirectoryFCB, Name, Record, fileFCB); - FileName = GetFileNameFromRecord(Record); + FileName = GetFileNameFromRecord(Record, NTFS_FILE_NAME_WIN32); if (!FileName) { return STATUS_OBJECT_NAME_NOT_FOUND; // Not sure that's the best here diff --git a/reactos/drivers/filesystems/ntfs/ntfs.h b/reactos/drivers/filesystems/ntfs/ntfs.h index 663cba24a37..d53bdc54e88 100644 --- a/reactos/drivers/filesystems/ntfs/ntfs.h +++ b/reactos/drivers/filesystems/ntfs/ntfs.h @@ -448,7 +448,7 @@ VOID NtfsDumpFileAttributes(PFILE_RECORD_HEADER FileRecord); PFILENAME_ATTRIBUTE -GetFileNameFromRecord(PFILE_RECORD_HEADER FileRecord); +GetFileNameFromRecord(PFILE_RECORD_HEADER FileRecord, UCHAR NameType); /* blockdev.c */ From fa7836ce2a7770f5bf7ed70db37885913a278128 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Poussineau?= Date: Sun, 26 Oct 2014 19:10:39 +0000 Subject: [PATCH 61/91] [NTFS] Also return the short file name to caller if available svn path=/trunk/; revision=65028 --- reactos/drivers/filesystems/ntfs/dirctl.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/reactos/drivers/filesystems/ntfs/dirctl.c b/reactos/drivers/filesystems/ntfs/dirctl.c index 254cc190869..0d943493386 100644 --- a/reactos/drivers/filesystems/ntfs/dirctl.c +++ b/reactos/drivers/filesystems/ntfs/dirctl.c @@ -242,12 +242,13 @@ NtfsGetBothDirectoryInformation(PDEVICE_EXTENSION DeviceExt, ULONG BufferLength) { ULONG Length; - PFILENAME_ATTRIBUTE FileName; + PFILENAME_ATTRIBUTE FileName, ShortFileName; DPRINT("NtfsGetBothDirectoryInformation() called\n"); FileName = GetFileNameFromRecord(FileRecord, NTFS_FILE_NAME_WIN32); ASSERT(FileName != NULL); + ShortFileName = GetFileNameFromRecord(FileRecord, NTFS_FILE_NAME_DOS); Length = FileName->NameLength * sizeof (WCHAR); if ((sizeof(FILE_BOTH_DIR_INFORMATION) + Length) > BufferLength) @@ -258,6 +259,19 @@ NtfsGetBothDirectoryInformation(PDEVICE_EXTENSION DeviceExt, ROUND_UP(sizeof(FILE_BOTH_DIR_INFORMATION) + Length, sizeof(ULONG)); RtlCopyMemory(Info->FileName, FileName->Name, Length); + if (ShortFileName) + { + /* Should we upcase the filename? */ + ASSERT(ShortFileName->NameLength <= ARRAYSIZE(Info->ShortName)); + Info->ShortNameLength = ShortFileName->NameLength * sizeof(WCHAR); + RtlCopyMemory(Info->ShortName, ShortFileName->Name, Info->ShortNameLength); + } + else + { + Info->ShortName[0] = 0; + Info->ShortNameLength = 0; + } + Info->CreationTime.QuadPart = FileName->CreationTime; Info->LastAccessTime.QuadPart = FileName->LastAccessTime; Info->LastWriteTime.QuadPart = FileName->LastWriteTime; @@ -272,9 +286,6 @@ NtfsGetBothDirectoryInformation(PDEVICE_EXTENSION DeviceExt, // Info->FileIndex=; Info->EaSize = 0; - Info->ShortName[0] = 0; - Info->ShortNameLength = 0; - return STATUS_SUCCESS; } From 68f176a03b22eabfb2c8416623d6a86e0b6be5cd Mon Sep 17 00:00:00 2001 From: Amine Khaldi Date: Sun, 26 Oct 2014 19:43:01 +0000 Subject: [PATCH 62/91] [RASDLG] * Turkish translation update by Erdem Ersoy. CORE-7861 svn path=/trunk/; revision=65029 --- reactos/dll/win32/rasdlg/lang/tr-TR.rc | 276 ++++++++++++------------- 1 file changed, 138 insertions(+), 138 deletions(-) diff --git a/reactos/dll/win32/rasdlg/lang/tr-TR.rc b/reactos/dll/win32/rasdlg/lang/tr-TR.rc index 13cfa52913d..1e3f3b15f67 100644 --- a/reactos/dll/win32/rasdlg/lang/tr-TR.rc +++ b/reactos/dll/win32/rasdlg/lang/tr-TR.rc @@ -46,7 +46,7 @@ BEGIN AUTOCHECKBOX "&İleride, Olmayan Geçekleri Deneme", 1030, 38, 226, 222, 10 DEFPUSHBUTTON "&Onayla", 1, 135, 242, 60, 14 PUSHBUTTON "&Ertele", 2, 201, 242, 60, 14 - LTEXT "Eğer yalnızca bir tek geçek bağlıysa sunucu çoklu bağlantılı aramaları kabul etmeye yapılandırılmamış olabilir. Böyle bir durumda gereksiz bağlantı görevlerinden kaçınmak için ""İleride, Olmayan Geçekleri Deneme""yi imleyiniz.", -1, 37, 36, 224, 44 + LTEXT "Eğer yalnızca bir tek geçek bağlıysa sunucu çoklu bağlantılı aramaları kabul etmeye yapılandırılmamış olabilir. Böyle bir durumda gereksiz bağlantı yüklerinden kaçınmak için ""İleride, Olmayan Geçekleri Deneme""yi imleyiniz.", -1, 37, 36, 224, 44 END 105 DIALOGEX 0, 0, 261, 253 @@ -366,145 +366,145 @@ END 125 DIALOGEX 12, 16, 261, 190 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_VISIBLE | WS_CAPTION -CAPTION "Modem Configuration" +CAPTION "Çevirge Yapılandırılması" FONT 8, "MS Shell Dlg" BEGIN ICON 15102, 1238, 7, 7, 20, 20 - LTEXT "Modem", -1, 25, 27, 24, 8, NOT WS_VISIBLE | NOT WS_GROUP + LTEXT "Çevirge", -1, 25, 27, 24, 8, NOT WS_VISIBLE | NOT WS_GROUP EDITTEXT 1235, 40, 7, 214, 16, ES_AUTOHSCROLL | ES_READONLY | NOT WS_BORDER - LTEXT "&Maximum speed (bps):", 1243, 7, 36, 110, 8 + LTEXT "E&n Çok Hız (bps):", 1243, 7, 36, 110, 8 COMBOBOX 1239, 119, 34, 136, 186, CBS_DROPDOWNLIST | CBS_AUTOHSCROLL | WS_VSCROLL | NOT WS_TABSTOP - LTEXT "Modem &protocol", 1244, 7, 52, 111, 8 + LTEXT "&Çevirge İletişim Kâidesi", 1244, 7, 52, 111, 8 COMBOBOX 1245, 119, 50, 136, 186, CBS_DROPDOWNLIST | CBS_AUTOHSCROLL | WS_VSCROLL | NOT WS_TABSTOP - GROUPBOX "Hardware features", 1237, 6, 70, 248, 61, WS_GROUP - AUTOCHECKBOX "E&nable hardware flow control", 1232, 19, 82, 217, 10, BS_TOP | BS_MULTILINE - AUTOCHECKBOX "En&able modem error control", 1231, 19, 98, 217, 10, BS_TOP | BS_MULTILINE - AUTOCHECKBOX "Enable m&odem compression", 1229, 19, 115, 217, 10, BS_TOP | BS_MULTILINE - AUTOCHECKBOX "&Show terminal window", 1234, 8, 136, 246, 10, BS_TOP | BS_MULTILINE - AUTOCHECKBOX "Enable mo&dem speaker", 1230, 8, 151, 247, 10, BS_TOP | BS_MULTILINE | WS_GROUP - DEFPUSHBUTTON "OK", 1, 129, 171, 60, 14, WS_GROUP - PUSHBUTTON "Cancel", 2, 194, 171, 60, 14 + GROUPBOX "Donanım Husûsiyetleri", 1237, 6, 70, 248, 61, WS_GROUP + AUTOCHECKBOX "&Donanım Akış Denetimini Etkinleştir", 1232, 19, 82, 217, 10, BS_TOP | BS_MULTILINE + AUTOCHECKBOX "Ç&evirge Yanlışlık Denetimini Etkinleştir", 1231, 19, 98, 217, 10, BS_TOP | BS_MULTILINE + AUTOCHECKBOX "Çe&virge Sıkıştırmasını Etkinleştir", 1229, 19, 115, 217, 10, BS_TOP | BS_MULTILINE + AUTOCHECKBOX "&Uçbirim Penceresini Göster", 1234, 8, 136, 246, 10, BS_TOP | BS_MULTILINE + AUTOCHECKBOX "Çev&irge Hoparlörünü Etkinleştir", 1230, 8, 151, 247, 10, BS_TOP | BS_MULTILINE | WS_GROUP + DEFPUSHBUTTON "Tamam", 1, 129, 171, 60, 14, WS_GROUP + PUSHBUTTON "İptal", 2, 194, 171, 60, 14 END 126 DIALOGEX 0, 0, 270, 117 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_CAPTION -CAPTION "Select Network Component Type" +CAPTION "Ağ Bileşeni Türünü Seç" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "Click the type of network component you want to install:", -1, 8, 7, 258, 8 + LTEXT "Kurmak istediğiniz ağ bileşeninin türünü tıklayınız:", -1, 8, 7, 258, 8 CONTROL "", 1251, "SYSLISTVIEW32", WS_BORDER | WS_TABSTOP | 0x0000C04D, 8, 20, 188, 58 GROUPBOX "", -1, 8, 81, 188, 30 LTEXT "", 1250, 12, 90, 177, 17 - DEFPUSHBUTTON "&Add...", 1252, 205, 20, 60, 14 - PUSHBUTTON "Cancel", 2, 205, 38, 60, 14 + DEFPUSHBUTTON "&Ekle...", 1252, 205, 20, 60, 14 + PUSHBUTTON "İptal", 2, 205, 38, 60, 14 END 127 DIALOGEX 16, 20, 260, 135 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_VISIBLE | WS_CAPTION -CAPTION "NetWare or Compatible Connections" +CAPTION "NetWare veyâ Uyumlu Bağlantılar" FONT 8, "MS Shell Dlg" BEGIN ICON 32515, 1278, 7, 7, 21, 20, WS_GROUP - LTEXT "You have connections to a NetWare compatible network. These connections will be closed when the PPP IPX connection is established.", 1279, 42, 7, 215, 37 - LTEXT "Before dialing, to avoid data loss, either close all files using these connections or uncheck IPX on this entry's Network Protocol settings.", 1280, 42, 46, 215, 38, NOT WS_GROUP - AUTOCHECKBOX "&Do not display this message in the future", 1277, 42, 86, 215, 10, BS_TOP | BS_MULTILINE | WS_GROUP - DEFPUSHBUTTON "OK", 1, 65, 112, 60, 14, WS_GROUP - PUSHBUTTON "Cancel", 2, 134, 112, 60, 14 + LTEXT "Bir NetWare uyumlu ağ için bağlantılarınız var. PPP IPX bağlantısı kurulduğunda bu bağlantılar kapatılacaktır.", 1279, 42, 7, 215, 37 + LTEXT "Çevirmeden önce veri yitiminden kaçınmak için ya bu bağlantıları kullanan tüm kütükleri siliniz ya da bu girişin Ağ İletişim Kâidesi ayarlarında IPX'in imini kaldırınız.", 1280, 42, 46, 215, 38, NOT WS_GROUP + AUTOCHECKBOX "&Gelecekte Bu İletiyi Gösterme", 1277, 42, 86, 215, 10, BS_TOP | BS_MULTILINE | WS_GROUP + DEFPUSHBUTTON "Tamam", 1, 65, 112, 60, 14, WS_GROUP + PUSHBUTTON "İptal", 2, 134, 112, 60, 14 END 128 DIALOGEX 7, 22, 236, 90 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_CAPTION -CAPTION "Manual Dial" +CAPTION "Elle Çevir" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "Pick up the handset and dial (or ask the operator to dial). After dialing is complete, click OK. Listen to handset until silent, and then hang up.", 1281, 8, 8, 219, 32 - LTEXT "Phone number:", 1282, 8, 46, 91, 8 + LTEXT "Almacı kaldırınız ve çeviriniz (ya da çevirmek için işletmene sorunuz). Çevirme bitirildikten sonra Tamam'a tıklayınız. Almacı, sessiz olana dek dinleyniz, sonra erteleyiniz.", 1281, 8, 8, 219, 32 + LTEXT "Telefon Numarası:", 1282, 8, 46, 91, 8 LTEXT "", 1283, 103, 46, 126, 8, NOT WS_GROUP - DEFPUSHBUTTON "OK", 1, 104, 70, 60, 14, WS_GROUP - PUSHBUTTON "Cancel", 2, 168, 70, 60, 14 + DEFPUSHBUTTON "Tamam", 1, 104, 70, 60, 14, WS_GROUP + PUSHBUTTON "İptal", 2, 168, 70, 60, 14 END 129 DIALOGEX 6, 20, 260, 85 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_CAPTION -CAPTION "Network Protocol Connection Result" +CAPTION "Ağ İletişim Kâidesi Bağlantı Sonucu" FONT 8, "MS Shell Dlg" BEGIN ICON 32516, 1328, 7, 7, 21, 20, WS_GROUP LTEXT "", 1329, 38, 7, 216, 24, NOT WS_GROUP - AUTOCHECKBOX "&Do not request the failed protocols next time", 1327, 40, 44, 215, 10, BS_TOP | BS_MULTILINE | WS_GROUP - PUSHBUTTON "&Accept", 1, 129, 64, 60, 14 - PUSHBUTTON "&Hang Up", 2, 193, 64, 60, 14 + AUTOCHECKBOX "O&lmayan İletişim Kâidelerini Bir Dahaki Kezde İsteme", 1327, 40, 44, 215, 10, BS_TOP | BS_MULTILINE | WS_GROUP + PUSHBUTTON "&Onayla", 1, 129, 64, 60, 14 + PUSHBUTTON "&Ertele", 2, 193, 64, 60, 14 END 133 DIALOGEX 6, 18, 231, 211 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_VISIBLE | WS_CAPTION -CAPTION "X.25 Logon Settings" +CAPTION "X.25 Oturum Açma Ayarları" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "Select your X.25 network provider and type the X.121 address of the remote server:", 1408, 7, 4, 220, 27 - LTEXT "&Network:", 1410, 9, 35, 213, 8, NOT WS_GROUP + LTEXT "X.25 ağ sağlayıcınızı seçiniz ve uzak sunucunun X.121 adresini yazınız:", 1408, 7, 4, 220, 27 + LTEXT "&Ağ:", 1410, 9, 35, 213, 8, NOT WS_GROUP COMBOBOX 1406, 9, 46, 215, 125, CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | NOT WS_TABSTOP - LTEXT "X.121&address:", 1407, 9, 66, 213, 8, NOT WS_GROUP + LTEXT "&X.121 Adresi:", 1407, 9, 66, 213, 8, NOT WS_GROUP EDITTEXT 1402, 8, 77, 215, 14, ES_AUTOHSCROLL - GROUPBOX "Optional", 1405, 8, 95, 215, 79 - LTEXT "&User data:", 1411, 19, 109, 182, 8, NOT WS_GROUP + GROUPBOX "Seçimlik", 1405, 8, 95, 215, 79 + LTEXT "&Kullanıcı Verisi:", 1411, 19, 109, 182, 8, NOT WS_GROUP EDITTEXT 1404, 19, 120, 193, 14, ES_AUTOHSCROLL - LTEXT "&Facilities:", 1409, 19, 138, 182, 8, NOT WS_GROUP + LTEXT "&Olanaklar:", 1409, 19, 138, 182, 8, NOT WS_GROUP EDITTEXT 1403, 19, 149, 193, 14, ES_AUTOHSCROLL - DEFPUSHBUTTON "OK", 1, 100, 189, 60, 14 - PUSHBUTTON "Cancel", 2, 164, 189, 60, 14 + DEFPUSHBUTTON "Tamam", 1, 100, 189, 60, 14 + PUSHBUTTON "İptal", 2, 164, 189, 60, 14 END 146 DIALOGEX 6, 18, 230, 210 STYLE DS_SHELLFONT | WS_CHILD | WS_VISIBLE | WS_CAPTION -CAPTION "Autodial" +CAPTION "Kendiliğinden Çevirme" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "If you are disconnected from a network, autodial attempts to connect to a network whenever you try to access remote information.", -1, 7, 4, 219, 32 - LTEXT "&Enable autodial by location:", 1006, 8, 42, 213, 8 + LTEXT "Bir ağdan ayrıysanız ne zaman uzak bilgiye erişmeye çalıştığınız bir ağ için kendiliğinden çevirme bağlanmaya girişir.", -1, 7, 4, 219, 32 + LTEXT "&Şu Konuma Göre Kendiliğinden Çevirmeyi Etkinleştir:", 1006, 8, 42, 213, 8 CONTROL "", 1004, "SYSLISTVIEW32", WS_BORDER | WS_GROUP | WS_TABSTOP | 0x0000C401, 7, 53, 216, 109 - AUTOCHECKBOX "Al&ways ask me before autodialing", 1496, 8, 170, 218, 9, BS_TOP | BS_MULTILINE - AUTOCHECKBOX "&Disable autodial while I am logged on", 1550, 8, 185, 217, 9, BS_TOP | BS_MULTILINE + AUTOCHECKBOX "&Kendiliğinden Çevirmeden Önce Tüm Zamanlarda Bana Sor", 1496, 8, 170, 218, 9, BS_TOP | BS_MULTILINE + AUTOCHECKBOX "&Ben Oturum Açtığım Sürede Kendiliğinden Çevirmeyi Edilginleştir", 1550, 8, 185, 217, 9, BS_TOP | BS_MULTILINE END 147 DIALOGEX 6, 18, 230, 215 STYLE DS_SHELLFONT | WS_CHILD | WS_VISIBLE | WS_CAPTION -CAPTION "Dialing" +CAPTION "Çevirme" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "These preferences apply to 'Login using Dial-Up Networking' at Ctrl-Alt-Del login. You, as an administrator, have access to this sheet.", 1007, 7, 4, 221, 40, NOT WS_GROUP - LTEXT "&Number of redial attempts:", 1005, 7, 55, 154, 8 + LTEXT "Bu yeğlemeler; Denetim, Seçenek ve Silme oturum açmada ""Çevirmeli Ağ'ı kullanan oturum açmaya"" uygulanır. Sizin bir yönetici olarak bu sayfaya erişiminiz var.", 1007, 7, 4, 221, 40, NOT WS_GROUP + LTEXT "&Yeniden Çevirme Girişimlerinin Sayısı:", 1005, 7, 55, 154, 8 EDITTEXT 1001, 164, 52, 60, 14, ES_AUTOHSCROLL - LTEXT "&Seconds between redial attempts:", 1009, 7, 73, 156, 8, NOT WS_GROUP + LTEXT "Y&eniden Çevirme Girişimleri Arasındaki Sâniyeler:", 1009, 7, 73, 156, 8, NOT WS_GROUP EDITTEXT 1003, 164, 70, 60, 14, ES_AUTOHSCROLL - LTEXT "I&dle seconds before hanging up:", 1008, 7, 91, 154, 8, NOT WS_GROUP + LTEXT "E&rtelemeden Önce Boşta Kalma Sâniyeleri:", 1008, 7, 91, 154, 8, NOT WS_GROUP EDITTEXT 1002, 164, 88, 60, 14, ES_AUTOHSCROLL END 148 DIALOGEX 6, 18, 230, 215 STYLE DS_SHELLFONT | WS_CHILD | WS_VISIBLE | WS_CAPTION -CAPTION "Callback" +CAPTION "Geri Arama" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "When you dial into a server, it may offer to call you back to reduce your phone charges. Specify whether you want callback. (Callback is not supported for virtual private network (VPN) connections.)", 1043, 8, 4, 219, 43 - AUTORADIOBUTTON "&No callback", 1041, 7, 48, 219, 10, BS_TOP | BS_MULTILINE | WS_GROUP - AUTORADIOBUTTON "A&sk me during dialing when the server offers", 1040, 7, 61, 219, 10, BS_TOP | BS_MULTILINE - AUTORADIOBUTTON "Al&ways call me back at the number(s) below:", 1042, 7, 74, 219, 10, BS_TOP | BS_MULTILINE + LTEXT "Bir sunucuya çevirdiğinizde o, telefonunuzun yükünü azaltmaya sizi yeniden aramak için sağlayabilir. Geri arama isteseniz de istemeseniz de belirtiniz. (Geri arama farazî ve şahsî ağ (VPN) bağlantıları için desteklenmiyor.)", 1043, 8, 4, 219, 43 + AUTORADIOBUTTON "&Geri Arama Yok", 1041, 7, 48, 219, 10, BS_TOP | BS_MULTILINE | WS_GROUP + AUTORADIOBUTTON "S&unucu Sunduğunda Çevirme Esnâsında Bana Sor", 1040, 7, 61, 219, 10, BS_TOP | BS_MULTILINE + AUTORADIOBUTTON "&Beni Tüm Zamanalarda Aşağıdaki Numaralardan Geri Ara:", 1042, 7, 74, 219, 10, BS_TOP | BS_MULTILINE CONTROL "", 1037, "SYSLISTVIEW32", WS_BORDER | WS_GROUP | WS_TABSTOP | 0x00008401, 16, 88, 204, 94 - PUSHBUTTON "&Edit...", 1039, 96, 190, 60, 14 - PUSHBUTTON "&Delete", 1038, 159, 190, 60, 14 + PUSHBUTTON "&Düzenle...", 1039, 96, 190, 60, 14 + PUSHBUTTON "&Sil", 1038, 159, 190, 60, 14 END 149 DIALOGEX 6, 18, 317, 142 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION FONT 8, "MS Shell Dlg" BEGIN - LTEXT "You need to set the dial-in credentials that remote routers will use when connecting to this interface. A user account will be created on this router with the information that you enter here.", 1094, 8, 5, 307, 35 - LTEXT "&User name:", 1078, 8, 47, 124, 8, NOT WS_GROUP + LTEXT "Bu arayüz için bağlandığında kullanılacak uzak yönlendiriciler arama kimlik bilgilerini ayarlamaya gerksiniminiz var. Bu yönlendiricide buraya girdiğiniz bilgiyle bir kullanıcı hesâbı oluşturulacaktır.", 1094, 8, 5, 307, 35 + LTEXT "&Kullanıcı Adı:", 1078, 8, 47, 124, 8, NOT WS_GROUP EDITTEXT 1074, 135, 45, 175, 12, ES_AUTOHSCROLL | WS_DISABLED - LTEXT "&Password:", 1077, 8, 68, 124, 8, NOT WS_GROUP + LTEXT "&Şifre:", 1077, 8, 68, 124, 8, NOT WS_GROUP EDITTEXT 1073, 135, 66, 175, 12, ES_PASSWORD | ES_AUTOHSCROLL - LTEXT "&Confirm password:", 1075, 8, 90, 124, 8, NOT WS_GROUP + LTEXT "Ş&ifreyi Doğrula:", 1075, 8, 90, 124, 8, NOT WS_GROUP EDITTEXT 1071, 135, 87, 175, 12, ES_PASSWORD | ES_AUTOHSCROLL END @@ -512,14 +512,14 @@ END STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION FONT 8, "MS Shell Dlg" BEGIN - LTEXT "You need to set the dial out credentials that this interface will use when connecting to the remote router. These credentials must match the dial in credentials configured on the remote router.", 1094, 8, 5, 308, 33 - LTEXT "&User name:", 1096, 8, 43, 130, 8, NOT WS_GROUP + LTEXT "Uzak yönlendiriciye bağlanırken bu arayüzün kullanacağı dışarıya arama kimlik bilgilerini ayarlamaya gereksiniminiz var. Bu kimlik bilgileri, uzak yönlendiricide yapılandırılmış içeriye arama kimlik bilgileriyle eşleşmelidir.", 1094, 8, 5, 308, 33 + LTEXT "&Kullanıcı Adı:", 1096, 8, 43, 130, 8, NOT WS_GROUP EDITTEXT 1091, 140, 40, 175, 12, ES_AUTOHSCROLL - LTEXT "&Domain:", 1093, 8, 63, 130, 8, NOT WS_GROUP + LTEXT "&Etki Alanı:", 1093, 8, 63, 130, 8, NOT WS_GROUP EDITTEXT 1089, 140, 60, 175, 12, ES_UPPERCASE | ES_AUTOHSCROLL - LTEXT "&Password:", 1095, 8, 81, 130, 8, NOT WS_GROUP + LTEXT "&Şifre:", 1095, 8, 81, 130, 8, NOT WS_GROUP EDITTEXT 1090, 140, 78, 175, 12, ES_PASSWORD | ES_AUTOHSCROLL - LTEXT "&Confirm password:", 1092, 8, 99, 130, 8, NOT WS_GROUP + LTEXT "Ş&ifreyi Doğrula:", 1092, 8, 99, 130, 8, NOT WS_GROUP EDITTEXT 1088, 140, 96, 175, 12, ES_PASSWORD | ES_AUTOHSCROLL END @@ -527,140 +527,140 @@ END STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION FONT 8, "MS Shell Dlg" BEGIN - LTEXT "Type a name you want for this connection:", -1, 8, 4, 190, 8 + LTEXT "Bu bağlantı için istediğiniz bir ad yazınız:", -1, 8, 4, 190, 8 EDITTEXT 1114, 8, 17, 190, 12, ES_AUTOHSCROLL - LTEXT "Click Finish to save it in the Network Connections folder.", -1, 8, 38, 193, 8 - LTEXT "To edit this connection later, select it, click the File menu, and then click Properties.", -1, 8, 58, 193, 16 + LTEXT "Onu Ağ Bağlantıları dizini içine kaydetmek için Bitir'e tıklayınız.", -1, 8, 38, 193, 8 + LTEXT "Bu bağlantıyı daha sonra düzenlemek için onu seçiniz, Kütük seçkesine tıklayınız, sonra Husûsiyetler'e tıklayınız.", -1, 8, 58, 193, 16 END 155 DIALOGEX 0, 0, 231, 215 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION -CAPTION "General" +CAPTION "Umûmî" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "Connec&t using:", 1124, 7, 5, 219, 8 + LTEXT "&Bağlanırken Kullan:", 1124, 7, 5, 219, 8 CONTROL "", 1128, "SYSLISTVIEW32", WS_BORDER | WS_TABSTOP | 0x00004C0D, 7, 17, 198, 44, WS_EX_CLIENTEDGE - PUSHBUTTON "&Up", 1132, 210, 18, 16, 14, BS_ICON - PUSHBUTTON "&Down", 1131, 210, 36, 16, 14, BS_ICON - AUTOCHECKBOX "A&ll devices call the same numbers", 1119, 9, 66, 133, 14, BS_TOP | BS_MULTILINE - PUSHBUTTON "C&onfigure...", 1130, 144, 66, 60, 14 - GROUPBOX "Sample type", 1125, 8, 84, 215, 100, WS_GROUP - LTEXT "Ar&ea code:", 1133, 17, 102, 52, 8 + PUSHBUTTON "&Yukarı", 1132, 210, 18, 16, 14, BS_ICON + PUSHBUTTON "&Aşağı", 1131, 210, 36, 16, 14, BS_ICON + AUTOCHECKBOX "&Tüm Aygıtlar Aynı Numaralardan Arasın", 1119, 9, 66, 133, 14, BS_TOP | BS_MULTILINE + PUSHBUTTON "Ya&pılandır...", 1130, 144, 66, 60, 14 + GROUPBOX "Örnek Tür", 1125, 8, 84, 215, 100, WS_GROUP + LTEXT "A&lan Kodu:", 1133, 17, 102, 52, 8 COMBOBOX 1122, 17, 112, 52, 110, CBS_DROPDOWN | WS_VSCROLL | NOT WS_TABSTOP - LTEXT "&Phone number:", 1135, 71, 102, 139, 8 + LTEXT "T&elefon Numarası:", 1135, 71, 102, 139, 8 EDITTEXT 1123, 73, 112, 79, 14, ES_AUTOHSCROLL - PUSHBUTTON "Alter&nates", 1129, 154, 112, 60, 14 - LTEXT "Country/re&gion code:", 1134, 17, 132, 197, 8 + PUSHBUTTON "Ba&şkaları", 1129, 154, 112, 60, 14 + LTEXT "&Ülke ya da Bölge Kodu:", 1134, 17, 132, 197, 8 COMBOBOX 1126, 17, 143, 193, 130, CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | NOT WS_TABSTOP - AUTOCHECKBOX "U&se dialing rules", 1121, 17, 163, 132, 14, BS_TOP | BS_MULTILINE - PUSHBUTTON "Dialing &Rules", 1136, 151, 161, 60, 14 - AUTOCHECKBOX "Sho&w icon in notification area when connected", 1120, 10, 192, 214, 19, BS_TOP | BS_MULTILINE + AUTOCHECKBOX "&Çevirme Kâidelerini Kullan", 1121, 17, 163, 132, 14, BS_TOP | BS_MULTILINE + PUSHBUTTON "Çe&virme Kâideleri", 1136, 151, 161, 60, 14 + AUTOCHECKBOX "Ba&ğlandığında Bildirim Alanında Simge Göster", 1120, 10, 192, 214, 19, BS_TOP | BS_MULTILINE END 156 DIALOGEX 0, 0, 231, 215 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION -CAPTION "General" +CAPTION "Umûmî" FONT 8, "MS Shell Dlg" BEGIN - PUSHBUTTON "C&onfigure...", 1130, 164, 38, 60, 14 - GROUPBOX "Sample text", 1125, 8, 55, 217, 100, WS_GROUP - LTEXT "Ar&ea code:", 1133, 17, 72, 48, 8 + PUSHBUTTON "&Yapılandır...", 1130, 164, 38, 60, 14 + GROUPBOX "Örnek Metin", 1125, 8, 55, 217, 100, WS_GROUP + LTEXT "A&lan Kodu:", 1133, 17, 72, 48, 8 COMBOBOX 1122, 17, 83, 48, 119, CBS_DROPDOWN | WS_VSCROLL | NOT WS_TABSTOP - LTEXT "&Phone number:", 1135, 71, 72, 146, 8 + LTEXT "T&elefon Numarası:", 1135, 71, 72, 146, 8 EDITTEXT 1123, 71, 83, 81, 14, ES_AUTOHSCROLL - PUSHBUTTON "Alter&nates", 1129, 155, 83, 63, 14 - LTEXT "Country/re&gion code:", 1134, 17, 103, 193, 8 + PUSHBUTTON "Ba&şkaları", 1129, 155, 83, 63, 14 + LTEXT "&Ülke ya da Bölge Kodu:", 1134, 17, 103, 193, 8 COMBOBOX 1126, 17, 114, 201, 130, CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | NOT WS_TABSTOP - AUTOCHECKBOX "U&se dialing rules", 1121, 19, 134, 136, 12, BS_TOP | BS_MULTILINE - PUSHBUTTON "Dialing &Rules", 1136, 157, 132, 60, 14 - AUTOCHECKBOX "Sho&w icon in notification area when connected", 1120, 12, 164, 209, 18, BS_TOP | BS_MULTILINE - LTEXT "Connect using:", 1124, 8, 5, 217, 8 + AUTOCHECKBOX "&Çevirme Kâidelerini Kullan", 1121, 19, 134, 136, 12, BS_TOP | BS_MULTILINE + PUSHBUTTON "Çe&virme Kâideleri", 1136, 157, 132, 60, 14 + AUTOCHECKBOX "Ba&ğlandığında Bildirim Alanında Simge Göster", 1120, 12, 164, 209, 18, BS_TOP | BS_MULTILINE + LTEXT "&Bağlanırken Kullan:", 1124, 8, 5, 217, 8 CONTROL "", 1127, "SYSLISTVIEW32", WS_DISABLED | WS_BORDER | 0x0000EC0D, 7, 18, 217, 15 END 157 DIALOGEX 6, 18, 235, 160 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_VISIBLE | WS_CAPTION -CAPTION "Appearance" +CAPTION "Görünüm" FONT 8, "MS Shell Dlg" BEGIN - AUTOCHECKBOX "&Preview phone numbers before dialing", 1142, 8, 10, 224, 10, WS_GROUP - AUTOCHECKBOX "Show &location setting before dialing", 1139, 8, 27, 224, 10 - AUTOCHECKBOX "Allo&w location edits during login", 1140, 21, 43, 212, 10 - AUTOCHECKBOX "Show &connection progress while dialing", 1143, 8, 59, 224, 10 - AUTOCHECKBOX "Clo&se on dial", 1137, 8, 76, 224, 10 - AUTOCHECKBOX "All&ow phonebook edits during login", 1141, 8, 94, 224, 10 - AUTOCHECKBOX "&Use wizard to create new phonebook entries", 1144, 22, 111, 210, 10 + AUTOCHECKBOX "&Çevirmeden Önce Telefon Numaralarını Önceden Göster", 1142, 8, 10, 224, 10, WS_GROUP + AUTOCHECKBOX "Ç&evirmeden Önce Koum Ayârını Göster", 1139, 8, 27, 224, 10 + AUTOCHECKBOX "&Oturum Açma Esnâsında Konum Düzenlemelerine İzin Ver", 1140, 21, 43, 212, 10 + AUTOCHECKBOX "Çe&virirken Bağlantı İlerlemesini Göster", 1143, 8, 59, 224, 10 + AUTOCHECKBOX "&Aramada Kapat", 1137, 8, 76, 224, 10 + AUTOCHECKBOX "O&turum Açma Esnâsında Telefon Defteri Düzenlemelerine İzin Ver", 1141, 8, 94, 224, 10 + AUTOCHECKBOX "&Yeni Telefon Defteri Girişlerini Oluşturmak İçin Yardımcı Kullan", 1144, 22, 111, 210, 10 END 158 DIALOGEX 6, 18, 235, 160 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_VISIBLE | WS_CAPTION -CAPTION "Appearance" +CAPTION "Görünüm" FONT 8, "MS Shell Dlg" BEGIN - AUTOCHECKBOX "&Preview phone numbers before dialing", 1142, 8, 10, 223, 10, WS_GROUP - AUTOCHECKBOX "Show &location setting before dialing", 1139, 8, 27, 206, 10 - AUTOCHECKBOX "Start dial-up networking &monitor before dialing", 1138, 8, 44, 226, 10 - AUTOCHECKBOX "Show &connection progress while dialing", 1143, 8, 61, 224, 10 - AUTOCHECKBOX "Clo&se on dial", 1137, 8, 79, 220, 10 - AUTOCHECKBOX "&Use wizard to create new phonebook entries", 1144, 8, 97, 220, 10 - AUTOCHECKBOX "Always prompt &before auto-dialing", 1136, 8, 114, 220, 10 + AUTOCHECKBOX "&Çevirmeden Önce Telefon Numaralarını Önceden Göster", 1142, 8, 10, 223, 10, WS_GROUP + AUTOCHECKBOX "Ç&evirmeden Önce Koum Ayârını Göster", 1139, 8, 27, 206, 10 + AUTOCHECKBOX "Çev&irmeden Önce Çevirmeli Ağ İzlemesini Başlat", 1138, 8, 44, 226, 10 + AUTOCHECKBOX "Çe&virirken Bağlantı İlerlemesini Göster", 1143, 8, 61, 224, 10 + AUTOCHECKBOX "&Aramada Kapat", 1137, 8, 79, 220, 10 + AUTOCHECKBOX "&Yeni Telefon Defteri Girişlerini Oluşturmak İçin Yardımcı Kullan", 1144, 8, 97, 220, 10 + AUTOCHECKBOX "&Kendiliğinden Çevirmeden Önce Tüm Zamanlarda Sor", 1136, 8, 114, 220, 10 END 160 DIALOGEX 6, 18, 320, 145 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_CHILD | WS_VISIBLE | WS_CAPTION FONT 8, "MS Shell Dlg" BEGIN - LTEXT "Select a name for this demand dial interface. A common practice is to name interfaces after the network or router to which they connect.", 1158, 7, 5, 309, 29 - LTEXT "&Interface name:", 1159, 17, 41, 285, 8, NOT WS_GROUP + LTEXT "Bu çevirme arayüzü isteği için bir ad seçiniz. Bağlanan yönlendirici ya da ağdan sonra arayüzleri adlandırmak bilinen bir uygulamadır.", 1158, 7, 5, 309, 29 + LTEXT "&Arayüz Adı:", 1159, 17, 41, 285, 8, NOT WS_GROUP EDITTEXT 1157, 17, 53, 284, 12, ES_AUTOHSCROLL - AUTOCHECKBOX "I &know all about demand-dial interfaces and would rather edit the properties directly", 1156, 24, 100, 258, 31, BS_TOP | BS_MULTILINE | NOT WS_VISIBLE | WS_DISABLED + AUTOCHECKBOX "&Çevirme Arayüzleri İsteği Üzerine Tüm Şeyleri Biliyorum ve Husûsiyetleri Doğrudan Düzenlemeyi Yeğliyorum", 1156, 24, 100, 258, 31, BS_TOP | BS_MULTILINE | NOT WS_VISIBLE | WS_DISABLED END 162 DIALOGEX 0, 0, 230, 215 STYLE DS_SHELLFONT | WS_CHILD | WS_CAPTION -CAPTION "Security" +CAPTION "Güvenlik" FONT 8, "MS Shell Dlg" BEGIN - GROUPBOX "Security options", 1580, 8, 3, 215, 139 - AUTORADIOBUTTON "&Typical (recommended settings)", 1540, 14, 16, 201, 9, BS_NOTIFY | WS_GROUP - AUTORADIOBUTTON "A&dvanced (custom settings)", 1541, 14, 102, 198, 8, BS_NOTIFY - LTEXT "&Validate my identity as follows:", 1537, 26, 29, 187, 8, NOT WS_GROUP + GROUPBOX "Güvenlik Seçenekleri", 1580, 8, 3, 215, 139 + AUTORADIOBUTTON "&Tipik (Önerilen Ayarlar)", 1540, 14, 16, 201, 9, BS_NOTIFY | WS_GROUP + AUTORADIOBUTTON "&Gelişmiş (Husûsî Ayarlar)", 1541, 14, 102, 198, 8, BS_NOTIFY + LTEXT "&Kimliğimi Aşağıdaki Gibi Onayla:", 1537, 26, 29, 187, 8, NOT WS_GROUP COMBOBOX 1178, 26, 40, 184, 78, CBS_DROPDOWNLIST | CBS_AUTOHSCROLL | WS_VSCROLL | NOT WS_TABSTOP - AUTOCHECKBOX "A&utomatically use my ReactOS logon name and password (and domain if any)", 1174, 26, 58, 184, 20, BS_TOP | BS_MULTILINE - AUTOCHECKBOX "Requ&ire data encryption (disconnect if none)", 1169, 26, 82, 183, 10, BS_TOP | BS_MULTILINE - LTEXT "Using these settings requires a knowledge of security protocols.", 1539, 15, 114, 134, 20 - PUSHBUTTON "&Settings...", 1180, 151, 115, 60, 14 - GROUPBOX "Interactive logon and scripting", 1177, 8, 146, 215, 62, WS_GROUP - AUTOCHECKBOX "S&how terminal window", 1173, 14, 159, 198, 11, BS_TOP | BS_MULTILINE - AUTOCHECKBOX "&Run script:", 1172, 14, 172, 57, 10, BS_TOP | BS_MULTILINE + AUTOCHECKBOX "&ReactOS Oturum Açma Adımı ve Şifremi Kendiliğinden Kullan (Eğer Varsa Etki Alanını Da)", 1174, 26, 58, 184, 20, BS_TOP | BS_MULTILINE + AUTOCHECKBOX "&Veri Sıkıştırmasını Gerektir (Eğer Yoksa Bağlantıyı Kes)", 1169, 26, 82, 183, 10, BS_TOP | BS_MULTILINE + LTEXT "Bu ayarları kullanmak güvenlik iletişim kâidelerinin bir bilgisini gerektirir.", 1539, 15, 114, 134, 20 + PUSHBUTTON "&Ayarlar...", 1180, 151, 115, 60, 14 + GROUPBOX "Etkileşimli Oturum Açma ve Betikleme", 1177, 8, 146, 215, 62, WS_GROUP + AUTOCHECKBOX "&Uçbirim Penceresini Göster", 1173, 14, 159, 198, 11, BS_TOP | BS_MULTILINE + AUTOCHECKBOX "&Betiği Çalıştır:", 1172, 14, 172, 57, 10, BS_TOP | BS_MULTILINE COMBOBOX 1179, 72, 171, 140, 104, CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | NOT WS_TABSTOP - PUSHBUTTON "&Edit...", 1182, 87, 187, 60, 14 - PUSHBUTTON "&Browse...", 1181, 151, 187, 60, 14 + PUSHBUTTON "&Düzenle...", 1182, 87, 187, 60, 14 + PUSHBUTTON "G&öz At...", 1181, 151, 187, 60, 14 END 163 DIALOGEX 0, 0, 317, 143 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION FONT 8, "MS Shell Dlg" BEGIN - LTEXT "You have more than one dial-up device on your computer.", -1, 6, 3, 307, 13 - LTEXT "&Select the devices to use in this connection:", -1, 6, 15, 307, 11 + LTEXT "Bilgisayarınızda birden çok çevirme aygıtınız var.", -1, 6, 3, 307, 13 + LTEXT "&Bu bağlantıda kullanmak için aygıtları seçiniz:", -1, 6, 15, 307, 11 CONTROL "", 1228, "SYSLISTVIEW32", WS_BORDER | WS_TABSTOP | 0x0000C415, 7, 28, 304, 77 END 165 DIALOGEX 0, 0, 230, 215 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_CAPTION -CAPTION "Networking" +CAPTION "Ağ Kurma" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "Typ&e of dial-up server I am calling:", 1583, 7, 4, 219, 8 + LTEXT "&Aradığım Çevirme Sunucusunun Türü:", 1583, 7, 4, 219, 8 COMBOBOX 1418, 7, 17, 215, 46, CBS_DROPDOWNLIST | WS_VSCROLL | NOT WS_TABSTOP - PUSHBUTTON "&Settings", 1419, 160, 35, 60, 14 - LTEXT "This c&onnection uses the following items:", 1684, 8, 64, 219, 10 + PUSHBUTTON "A&yarlar", 1419, 160, 35, 60, 14 + LTEXT "&Bu Bağlantı Aşağıdaki Öğeleri Kullanır:", 1684, 8, 64, 219, 10 CONTROL "", 1251, "SYSLISTVIEW32", WS_BORDER | WS_TABSTOP | 0x0000C40D, 7, 75, 216, 53 - PUSHBUTTON "I&nstall...", 1252, 7, 133, 67, 14 - PUSHBUTTON "&Uninstall", 1254, 80, 133, 67, 14 - PUSHBUTTON "P&roperties", 1253, 153, 133, 67, 14 - GROUPBOX "Description", 1585, 9, 158, 213, 43 + PUSHBUTTON "&Kur...", 1252, 7, 133, 67, 14 + PUSHBUTTON "Ka&ldır", 1254, 80, 133, 67, 14 + PUSHBUTTON "&Husûsiyetler", 1253, 153, 133, 67, 14 + GROUPBOX "Tanım", 1585, 9, 158, 213, 43 LTEXT "", 1250, 18, 167, 195, 25 END From 531323417df0ef980c57a5cb6f175c5e64e5ca4f Mon Sep 17 00:00:00 2001 From: Amine Khaldi Date: Sun, 26 Oct 2014 19:56:15 +0000 Subject: [PATCH 63/91] [ADVAPI32] * Update ConvertStringSidToSid{A,W}(). * Fixes some advapi32:security tests. CORE-8540 svn path=/trunk/; revision=65030 --- reactos/dll/win32/advapi32/wine/security.c | 194 +++++---------------- 1 file changed, 47 insertions(+), 147 deletions(-) diff --git a/reactos/dll/win32/advapi32/wine/security.c b/reactos/dll/win32/advapi32/wine/security.c index 9f661a5c023..749fc6921c4 100644 --- a/reactos/dll/win32/advapi32/wine/security.c +++ b/reactos/dll/win32/advapi32/wine/security.c @@ -279,6 +279,19 @@ static const RECORD SidTable[] = { NULL, 0 }, }; +static LPWSTR SERV_dup( LPCSTR str ) +{ + UINT len; + LPWSTR wstr; + + if( !str ) + return NULL; + len = MultiByteToWideChar( CP_ACP, 0, str, -1, NULL, 0 ); + wstr = heap_alloc( len*sizeof (WCHAR) ); + MultiByteToWideChar( CP_ACP, 0, str, -1, wstr, len ); + return wstr; +} + /************************************************************ * ADVAPI_IsLocalComputer * @@ -3203,162 +3216,49 @@ ConvertSecurityDescriptorToStringSecurityDescriptorA(PSECURITY_DESCRIPTOR Securi } } -/* - * @implemented +/****************************************************************************** + * ConvertStringSidToSidW [ADVAPI32.@] */ -BOOL -WINAPI -ConvertStringSidToSidW(IN LPCWSTR StringSid, - OUT PSID* sid) +BOOL WINAPI ConvertStringSidToSidW(LPCWSTR StringSid, PSID* Sid) { - DWORD size; - DWORD i, cBytes, identAuth, csubauth; - BOOL ret; - SID* pisid; + BOOL bret = FALSE; + DWORD cBytes; - TRACE("%s %p\n", debugstr_w(StringSid), sid); - - if (!StringSid) - { - SetLastError(ERROR_INVALID_SID); - return FALSE; - } - - for (i = 0; i < sizeof(SidTable) / sizeof(SidTable[0]) - 1; i++) - { - if (wcscmp(StringSid, SidTable[i].key) == 0) - { - WELL_KNOWN_SID_TYPE knownSid = (WELL_KNOWN_SID_TYPE)SidTable[i].value; - size = SECURITY_MAX_SID_SIZE; - *sid = LocalAlloc(0, size); - if (!*sid) - { - SetLastError(ERROR_NOT_ENOUGH_MEMORY); - return FALSE; - } - ret = CreateWellKnownSid(knownSid, - NULL, - *sid, - &size); - if (!ret) - { - SetLastError(ERROR_INVALID_SID); - LocalFree(*sid); - } - return ret; - } - } - - /* That's probably a string S-R-I-S-S... */ - if (StringSid[0] != 'S' || StringSid[1] != '-') - { - SetLastError(ERROR_INVALID_SID); - return FALSE; - } - - cBytes = ComputeStringSidSize(StringSid); - pisid = (SID*)LocalAlloc( 0, cBytes ); - if (!pisid) - { - SetLastError(ERROR_NOT_ENOUGH_MEMORY); - return FALSE; - } - i = 0; - ret = FALSE; - csubauth = ((cBytes - GetSidLengthRequired(0)) / sizeof(DWORD)); - - StringSid += 2; /* Advance to Revision */ - pisid->Revision = atoiW(StringSid); - - if (pisid->Revision != SDDL_REVISION) - { - TRACE("Revision %d is unknown\n", pisid->Revision); - goto lend; /* ERROR_INVALID_SID */ - } - if (csubauth == 0) - { - TRACE("SubAuthorityCount is 0\n"); - goto lend; /* ERROR_INVALID_SID */ - } - - pisid->SubAuthorityCount = csubauth; - - /* Advance to identifier authority */ - while (*StringSid && *StringSid != '-') - StringSid++; - if (*StringSid == '-') - StringSid++; - - /* MS' implementation can't handle values greater than 2^32 - 1, so - * we don't either; assume most significant bytes are always 0 - */ - pisid->IdentifierAuthority.Value[0] = 0; - pisid->IdentifierAuthority.Value[1] = 0; - identAuth = atoiW(StringSid); - pisid->IdentifierAuthority.Value[5] = identAuth & 0xff; - pisid->IdentifierAuthority.Value[4] = (identAuth & 0xff00) >> 8; - pisid->IdentifierAuthority.Value[3] = (identAuth & 0xff0000) >> 16; - pisid->IdentifierAuthority.Value[2] = (identAuth & 0xff000000) >> 24; - - /* Advance to first sub authority */ - while (*StringSid && *StringSid != '-') - StringSid++; - if (*StringSid == '-') - StringSid++; - - while (*StringSid) - { - pisid->SubAuthority[i++] = atoiW(StringSid); - - while (*StringSid && *StringSid != '-') - StringSid++; - if (*StringSid == '-') - StringSid++; - } - - if (i != pisid->SubAuthorityCount) - goto lend; /* ERROR_INVALID_SID */ - - *sid = pisid; - ret = TRUE; - -lend: - if (!ret) - { - LocalFree(pisid); - SetLastError(ERROR_INVALID_SID); - } - - TRACE("returning %s\n", ret ? "TRUE" : "FALSE"); - return ret; -} - -/* - * @implemented - */ -BOOL -WINAPI -ConvertStringSidToSidA(IN LPCSTR StringSid, - OUT PSID* sid) -{ - BOOL bRetVal = FALSE; - - TRACE("%s, %p\n", debugstr_a(StringSid), sid); + TRACE("%s, %p\n", debugstr_w(StringSid), Sid); if (GetVersion() & 0x80000000) SetLastError(ERROR_CALL_NOT_IMPLEMENTED); - else if (!StringSid || !sid) + else if (!StringSid || !Sid) + SetLastError(ERROR_INVALID_PARAMETER); + else if (ParseStringSidToSid(StringSid, NULL, &cBytes)) + { + PSID pSid = *Sid = LocalAlloc(0, cBytes); + + bret = ParseStringSidToSid(StringSid, pSid, &cBytes); + if (!bret) + LocalFree(*Sid); + } + return bret; +} + +/****************************************************************************** + * ConvertStringSidToSidA [ADVAPI32.@] + */ +BOOL WINAPI ConvertStringSidToSidA(LPCSTR StringSid, PSID* Sid) +{ + BOOL bret = FALSE; + + TRACE("%s, %p\n", debugstr_a(StringSid), Sid); + if (GetVersion() & 0x80000000) + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + else if (!StringSid || !Sid) SetLastError(ERROR_INVALID_PARAMETER); else { - UINT len = MultiByteToWideChar(CP_ACP, 0, StringSid, -1, NULL, 0); - LPWSTR wStringSid = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)); - if (wStringSid == NULL) - return FALSE; - MultiByteToWideChar(CP_ACP, 0, StringSid, - 1, wStringSid, len); - bRetVal = ConvertStringSidToSidW(wStringSid, sid); - HeapFree(GetProcessHeap(), 0, wStringSid); + WCHAR *wStringSid = SERV_dup(StringSid); + bret = ConvertStringSidToSidW(wStringSid, Sid); + heap_free(wStringSid); } - return bRetVal; + return bret; } /* From c9e616ea2b73091bbcad1ef80cf01d0b45305819 Mon Sep 17 00:00:00 2001 From: Pierre Schweitzer Date: Sun, 26 Oct 2014 20:20:42 +0000 Subject: [PATCH 64/91] [FASTFAT] Implement vfatGrabFCB() (which was defined but never implemented) for increasing the reference count on a FCB. This will make debugging easier. Dedicated to Thomas :-). svn path=/trunk/; revision=65031 --- reactos/drivers/filesystems/fastfat/create.c | 8 +++---- reactos/drivers/filesystems/fastfat/fcb.c | 24 +++++++++++--------- reactos/drivers/filesystems/fastfat/finfo.c | 4 ++-- 3 files changed, 19 insertions(+), 17 deletions(-) diff --git a/reactos/drivers/filesystems/fastfat/create.c b/reactos/drivers/filesystems/fastfat/create.c index 9352d1c0820..fb4261b99b7 100644 --- a/reactos/drivers/filesystems/fastfat/create.c +++ b/reactos/drivers/filesystems/fastfat/create.c @@ -365,7 +365,7 @@ VfatOpenFile( DPRINT("'%wZ'\n", &FileObject->RelatedFileObject->FileName); *ParentFcb = FileObject->RelatedFileObject->FsContext; - (*ParentFcb)->RefCount++; + vfatGrabFCB(DeviceExt, *ParentFcb); } else { @@ -391,7 +391,7 @@ VfatOpenFile( if (*ParentFcb) { - (*ParentFcb)->RefCount++; + vfatGrabFCB(DeviceExt, *ParentFcb); } /* try first to find an existing FCB in memory */ @@ -497,7 +497,7 @@ VfatCreateFile( pFcb = DeviceExt->VolumeFcb; vfatAttachFCBToFileObject(DeviceExt, pFcb, FileObject); - pFcb->RefCount++; + vfatGrabFCB(DeviceExt, pFcb); Irp->IoStatus.Information = FILE_OPENED; return STATUS_SUCCESS; @@ -562,7 +562,7 @@ VfatCreateFile( if (Status == STATUS_SUCCESS) { - ParentFcb->RefCount++; + vfatGrabFCB(DeviceExt, ParentFcb); vfatReleaseFCB(DeviceExt, TargetFcb); Irp->IoStatus.Information = FILE_EXISTS; } diff --git a/reactos/drivers/filesystems/fastfat/fcb.c b/reactos/drivers/filesystems/fastfat/fcb.c index 251821bcf59..0b5f24a345b 100644 --- a/reactos/drivers/filesystems/fastfat/fcb.c +++ b/reactos/drivers/filesystems/fastfat/fcb.c @@ -287,6 +287,14 @@ vfatFCBIsRoot( return FCB->PathNameU.Length == sizeof(WCHAR) && FCB->PathNameU.Buffer[0] == L'\\' ? TRUE : FALSE; } +VOID +vfatGrabFCB( + PDEVICE_EXTENSION pVCB, + PVFATFCB pFCB) +{ + ++pFCB->RefCount; +} + VOID vfatReleaseFCB( PDEVICE_EXTENSION pVCB, @@ -338,7 +346,7 @@ vfatAddFCBToTable( } if (pFCB->parentFcb) { - pFCB->parentFcb->RefCount++; + vfatGrabFCB(pVCB, pFCB->parentFcb); } } @@ -403,12 +411,6 @@ vfatUpdateFCB( */ vfatReleaseFCB(pVCB, OldParent); - /* In case we were moving accross directories, reset caching on old parent */ - //if (OldParent != ParentFcb) - //{ - // CcUninitializeCacheMap(OldParent->FileObject, NULL, NULL); - //} - return STATUS_SUCCESS; } @@ -455,7 +457,7 @@ vfatGrabFCBFromTable( DPRINT("'%wZ' '%wZ'\n", &FileNameU, FcbNameU); if (RtlEqualUnicodeString(&FileNameU, FcbNameU, TRUE)) { - rcFCB->RefCount++; + vfatGrabFCB(pVCB, rcFCB); return rcFCB; } } @@ -489,7 +491,7 @@ vfatFCBInitializeCacheFromVolume( fileObject->FsContext = fcb; fileObject->FsContext2 = newCCB; fcb->FileObject = fileObject; - fcb->RefCount++; + vfatGrabFCB(vcb, fcb); _SEH2_TRY { @@ -655,7 +657,7 @@ vfatMakeFCBFromDirEntry( rcFCB->RFCB.FileSize.QuadPart = Size; rcFCB->RFCB.ValidDataLength.QuadPart = Size; rcFCB->RFCB.AllocationSize.QuadPart = ROUND_UP(Size, vcb->FatInfo.BytesPerCluster); - rcFCB->RefCount++; + vfatGrabFCB(vcb, rcFCB); if (vfatFCBIsDirectory(rcFCB)) { vfatFCBInitializeCacheFromVolume(vcb, rcFCB); @@ -817,7 +819,7 @@ vfatGetFCBForFile( { *pFCB = FCB; *pParentFCB = FCB->parentFcb; - (*pParentFCB)->RefCount++; + vfatGrabFCB(pVCB, *pParentFCB); return STATUS_SUCCESS; } diff --git a/reactos/drivers/filesystems/fastfat/finfo.c b/reactos/drivers/filesystems/fastfat/finfo.c index b5199dac18d..2bea14d17b0 100644 --- a/reactos/drivers/filesystems/fastfat/finfo.c +++ b/reactos/drivers/filesystems/fastfat/finfo.c @@ -426,7 +426,7 @@ vfatPrepareTargetForRename( /* Effectively delete old file to allow renaming */ VfatDelEntry(DeviceExt, TargetFcb, NULL); - (*ParentFCB)->RefCount++; + vfatGrabFCB(DeviceExt, *ParentFCB); vfatReleaseFCB(DeviceExt, TargetFcb); *Deleted = TRUE; } @@ -720,7 +720,7 @@ VfatSetRenameInformation( { /* Try to find target */ ParentFCB = FCB->parentFcb; - ParentFCB->RefCount++; + vfatGrabFCB(DeviceObject, ParentFCB); Status = vfatPrepareTargetForRename(DeviceObject, &ParentFCB, &NewFile, From 4a49b030deafc95a9f51c3e61297498b391c6247 Mon Sep 17 00:00:00 2001 From: Pierre Schweitzer Date: Sun, 26 Oct 2014 20:23:07 +0000 Subject: [PATCH 65/91] [FASTFAT] s/DeviceObject/DeviceExt/g svn path=/trunk/; revision=65032 --- reactos/drivers/filesystems/fastfat/finfo.c | 50 ++++++++++----------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/reactos/drivers/filesystems/fastfat/finfo.c b/reactos/drivers/filesystems/fastfat/finfo.c index 2bea14d17b0..7a8bbea9289 100644 --- a/reactos/drivers/filesystems/fastfat/finfo.c +++ b/reactos/drivers/filesystems/fastfat/finfo.c @@ -455,7 +455,7 @@ NTSTATUS VfatSetRenameInformation( PFILE_OBJECT FileObject, PVFATFCB FCB, - PDEVICE_EXTENSION DeviceObject, + PDEVICE_EXTENSION DeviceExt, PFILE_RENAME_INFORMATION RenameInfo, PFILE_OBJECT TargetFileObject) { @@ -474,7 +474,7 @@ VfatSetRenameInformation( HANDLE TargetHandle; BOOLEAN DeletedTarget; - DPRINT("VfatSetRenameInfo(%p, %p, %p, %p, %p)\n", FileObject, FCB, DeviceObject, RenameInfo, TargetFileObject); + DPRINT("VfatSetRenameInfo(%p, %p, %p, %p, %p)\n", FileObject, FCB, DeviceExt, RenameInfo, TargetFileObject); /* Disallow renaming root */ if (vfatFCBIsRoot(FCB)) @@ -691,8 +691,8 @@ VfatSetRenameInformation( if (FsRtlAreNamesEqual(&SourceFile, &NewFile, TRUE, NULL)) { - FsRtlNotifyFullReportChange(DeviceObject->NotifySync, - &(DeviceObject->NotifyList), + FsRtlNotifyFullReportChange(DeviceExt->NotifySync, + &(DeviceExt->NotifyList), (PSTRING)&FCB->PathNameU, FCB->PathNameU.Length - FCB->LongNameU.Length, NULL, @@ -701,11 +701,11 @@ VfatSetRenameInformation( FILE_NOTIFY_CHANGE_DIR_NAME : FILE_NOTIFY_CHANGE_FILE_NAME), FILE_ACTION_RENAMED_OLD_NAME, NULL); - Status = vfatRenameEntry(DeviceObject, FCB, &NewFile, TRUE); + Status = vfatRenameEntry(DeviceExt, FCB, &NewFile, TRUE); if (NT_SUCCESS(Status)) { - FsRtlNotifyFullReportChange(DeviceObject->NotifySync, - &(DeviceObject->NotifyList), + FsRtlNotifyFullReportChange(DeviceExt->NotifySync, + &(DeviceExt->NotifyList), (PSTRING)&FCB->PathNameU, FCB->PathNameU.Length - FCB->LongNameU.Length, NULL, @@ -720,8 +720,8 @@ VfatSetRenameInformation( { /* Try to find target */ ParentFCB = FCB->parentFcb; - vfatGrabFCB(DeviceObject, ParentFCB); - Status = vfatPrepareTargetForRename(DeviceObject, + vfatGrabFCB(DeviceExt, ParentFCB); + Status = vfatPrepareTargetForRename(DeviceExt, &ParentFCB, &NewFile, RenameInfo->ReplaceIfExists, @@ -732,8 +732,8 @@ VfatSetRenameInformation( goto Cleanup; } - FsRtlNotifyFullReportChange(DeviceObject->NotifySync, - &(DeviceObject->NotifyList), + FsRtlNotifyFullReportChange(DeviceExt->NotifySync, + &(DeviceExt->NotifyList), (PSTRING)&FCB->PathNameU, FCB->PathNameU.Length - FCB->LongNameU.Length, NULL, @@ -742,13 +742,13 @@ VfatSetRenameInformation( FILE_NOTIFY_CHANGE_DIR_NAME : FILE_NOTIFY_CHANGE_FILE_NAME), (DeletedTarget ? FILE_ACTION_REMOVED : FILE_ACTION_RENAMED_OLD_NAME), NULL); - Status = vfatRenameEntry(DeviceObject, FCB, &NewFile, FALSE); + Status = vfatRenameEntry(DeviceExt, FCB, &NewFile, FALSE); if (NT_SUCCESS(Status)) { if (DeletedTarget) { - FsRtlNotifyFullReportChange(DeviceObject->NotifySync, - &(DeviceObject->NotifyList), + FsRtlNotifyFullReportChange(DeviceExt->NotifySync, + &(DeviceExt->NotifyList), (PSTRING)&FCB->PathNameU, FCB->PathNameU.Length - FCB->LongNameU.Length, NULL, @@ -760,8 +760,8 @@ VfatSetRenameInformation( } else { - FsRtlNotifyFullReportChange(DeviceObject->NotifySync, - &(DeviceObject->NotifyList), + FsRtlNotifyFullReportChange(DeviceExt->NotifySync, + &(DeviceExt->NotifyList), (PSTRING)&FCB->PathNameU, FCB->PathNameU.Length - FCB->LongNameU.Length, NULL, @@ -778,7 +778,7 @@ VfatSetRenameInformation( { /* Try to find target */ ParentFCB = NULL; - Status = vfatPrepareTargetForRename(DeviceObject, + Status = vfatPrepareTargetForRename(DeviceExt, &ParentFCB, &NewName, RenameInfo->ReplaceIfExists, @@ -789,8 +789,8 @@ VfatSetRenameInformation( goto Cleanup; } - FsRtlNotifyFullReportChange(DeviceObject->NotifySync, - &(DeviceObject->NotifyList), + FsRtlNotifyFullReportChange(DeviceExt->NotifySync, + &(DeviceExt->NotifyList), (PSTRING)&FCB->PathNameU, FCB->PathNameU.Length - FCB->LongNameU.Length, NULL, @@ -799,13 +799,13 @@ VfatSetRenameInformation( FILE_NOTIFY_CHANGE_DIR_NAME : FILE_NOTIFY_CHANGE_FILE_NAME), FILE_ACTION_REMOVED, NULL); - Status = VfatMoveEntry(DeviceObject, FCB, &NewFile, ParentFCB); + Status = VfatMoveEntry(DeviceExt, FCB, &NewFile, ParentFCB); if (NT_SUCCESS(Status)) { if (DeletedTarget) { - FsRtlNotifyFullReportChange(DeviceObject->NotifySync, - &(DeviceObject->NotifyList), + FsRtlNotifyFullReportChange(DeviceExt->NotifySync, + &(DeviceExt->NotifyList), (PSTRING)&FCB->PathNameU, FCB->PathNameU.Length - FCB->LongNameU.Length, NULL, @@ -817,8 +817,8 @@ VfatSetRenameInformation( } else { - FsRtlNotifyFullReportChange(DeviceObject->NotifySync, - &(DeviceObject->NotifyList), + FsRtlNotifyFullReportChange(DeviceExt->NotifySync, + &(DeviceExt->NotifyList), (PSTRING)&FCB->PathNameU, FCB->PathNameU.Length - FCB->LongNameU.Length, NULL, @@ -832,7 +832,7 @@ VfatSetRenameInformation( } Cleanup: - if (ParentFCB != NULL) vfatReleaseFCB(DeviceObject, ParentFCB); + if (ParentFCB != NULL) vfatReleaseFCB(DeviceExt, ParentFCB); if (NewName.Buffer != NULL) ExFreePoolWithTag(NewName.Buffer, TAG_VFAT); if (RenameInfo->RootDirectory != NULL) ObDereferenceObject(RootFileObject); From a71e1f3760bfaada8e3cc0fd4d0290dd6f7fc9c2 Mon Sep 17 00:00:00 2001 From: Pierre Schweitzer Date: Sun, 26 Oct 2014 20:29:00 +0000 Subject: [PATCH 66/91] [FASTFAT] Make sure the appropriate resource is exclusively acquired when playing with FCB references svn path=/trunk/; revision=65033 --- reactos/drivers/filesystems/fastfat/fcb.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/reactos/drivers/filesystems/fastfat/fcb.c b/reactos/drivers/filesystems/fastfat/fcb.c index 0b5f24a345b..c698ba72efe 100644 --- a/reactos/drivers/filesystems/fastfat/fcb.c +++ b/reactos/drivers/filesystems/fastfat/fcb.c @@ -292,6 +292,8 @@ vfatGrabFCB( PDEVICE_EXTENSION pVCB, PVFATFCB pFCB) { + ASSERT(ExIsResourceAcquiredExclusive(&pVCB->DirResource)); + ++pFCB->RefCount; } @@ -305,6 +307,8 @@ vfatReleaseFCB( DPRINT("releasing FCB at %p: %wZ, refCount:%d\n", pFCB, &pFCB->PathNameU, pFCB->RefCount); + ASSERT(ExIsResourceAcquiredExclusive(&pVCB->DirResource)); + while (pFCB) { pFCB->RefCount--; From dd58a72a8b456b715aef7d6c33ba3c43721a311e Mon Sep 17 00:00:00 2001 From: Pierre Schweitzer Date: Sun, 26 Oct 2014 21:09:07 +0000 Subject: [PATCH 67/91] [KERNEL32] Prevent a use-after-free issue in GetVolumeNameForVolumeMountPointW() svn path=/trunk/; revision=65034 --- reactos/dll/win32/kernel32/client/file/mntpoint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/reactos/dll/win32/kernel32/client/file/mntpoint.c b/reactos/dll/win32/kernel32/client/file/mntpoint.c index af0ae94df2f..c6beae048be 100644 --- a/reactos/dll/win32/kernel32/client/file/mntpoint.c +++ b/reactos/dll/win32/kernel32/client/file/mntpoint.c @@ -118,14 +118,15 @@ GetVolumeNameForVolumeMountPointW(IN LPCWSTR VolumeMountPoint, NULL, 0, MountDevName, BufferLength); if (!NT_SUCCESS(Status)) { - RtlFreeHeap(GetProcessHeap(), 0, MountDevName); if (Status == STATUS_BUFFER_OVERFLOW) { BufferLength = sizeof(MOUNTDEV_NAME) + MountDevName->NameLength; + RtlFreeHeap(GetProcessHeap(), 0, MountDevName); continue; } else { + RtlFreeHeap(GetProcessHeap(), 0, MountDevName); NtClose(FileHandle); BaseSetLastNTError(Status); return FALSE; From bc64e37fd1c97d74327f6d44c78257976c198cf8 Mon Sep 17 00:00:00 2001 From: Aleksandar Andrejevic Date: Sun, 26 Oct 2014 23:37:54 +0000 Subject: [PATCH 68/91] [FAST486] Implement an (optional) instruction prefetch cache. Implement the INVLPG instruction. svn path=/trunk/; revision=65035 --- .../include/reactos/libs/fast486/fast486.h | 17 +++ reactos/lib/fast486/common.c | 48 ++++++- reactos/lib/fast486/common.h | 4 - reactos/lib/fast486/common.inl | 133 +++++++++++++----- reactos/lib/fast486/extraops.c | 5 + reactos/lib/fast486/opcodes.c | 5 + reactos/lib/fast486/opgroups.c | 26 +++- 7 files changed, 195 insertions(+), 43 deletions(-) diff --git a/reactos/include/reactos/libs/fast486/fast486.h b/reactos/include/reactos/libs/fast486/fast486.h index efc87fefc73..2a933e51a49 100644 --- a/reactos/include/reactos/libs/fast486/fast486.h +++ b/reactos/include/reactos/libs/fast486/fast486.h @@ -93,6 +93,18 @@ #define FAST486_FPU_DEFAULT_CONTROL 0x037F +#define FAST486_PAGE_SIZE 4096 +#define FAST486_CACHE_SIZE 32 + +/* + * These are condiciones sine quibus non that should be respected, because + * otherwise when fetching DWORDs you would read extra garbage bytes + * (by reading outside of the prefetch buffer). The prefetch cache must + * also not cross a page boundary. + */ +C_ASSERT((FAST486_CACHE_SIZE >= sizeof(DWORD)) + && (FAST486_CACHE_SIZE <= FAST486_PAGE_SIZE)); + struct _FAST486_STATE; typedef struct _FAST486_STATE FAST486_STATE, *PFAST486_STATE; @@ -486,6 +498,11 @@ struct _FAST486_STATE FAST486_INT_STATUS IntStatus; UCHAR PendingIntNum; PULONG Tlb; +#ifndef FAST486_NO_PREFETCH + BOOLEAN PrefetchValid; + ULONG PrefetchAddress; + UCHAR PrefetchCache[FAST486_CACHE_SIZE]; +#endif #ifndef FAST486_NO_FPU FAST486_FPU_DATA_REG FpuRegisters[FAST486_NUM_FPU_REGS]; FAST486_FPU_STATUS_REG FpuStatus; diff --git a/reactos/lib/fast486/common.c b/reactos/lib/fast486/common.c index 1e9311ae00b..3bb29a58601 100644 --- a/reactos/lib/fast486/common.c +++ b/reactos/lib/fast486/common.c @@ -95,8 +95,40 @@ Fast486ReadMemory(PFAST486_STATE State, /* Find the linear address */ LinearAddress = CachedDescriptor->Base + Offset; - /* Read from the linear address */ - return Fast486ReadLinearMemory(State, LinearAddress, Buffer, Size); +#ifndef FAST486_NO_PREFETCH + if (InstFetch && ((Offset + FAST486_CACHE_SIZE - 1) <= CachedDescriptor->Limit)) + { + State->PrefetchAddress = LinearAddress; + + if ((State->ControlRegisters[FAST486_REG_CR0] & FAST486_CR0_PG) + && (PAGE_OFFSET(State->PrefetchAddress) > (FAST486_PAGE_SIZE - FAST486_CACHE_SIZE))) + { + /* We mustn't prefetch across a page boundary */ + State->PrefetchAddress = PAGE_ALIGN(State->PrefetchAddress) + | (FAST486_PAGE_SIZE - FAST486_CACHE_SIZE); + } + + /* Prefetch */ + if (Fast486ReadLinearMemory(State, + State->PrefetchAddress, + State->PrefetchCache, + FAST486_CACHE_SIZE)) + { + State->PrefetchValid = TRUE; + + RtlMoveMemory(Buffer, + &State->PrefetchCache[LinearAddress - State->PrefetchAddress], + Size); + return TRUE; + } + else return FALSE; + } + else +#endif + { + /* Read from the linear address */ + return Fast486ReadLinearMemory(State, LinearAddress, Buffer, Size); + } } BOOLEAN @@ -156,6 +188,18 @@ Fast486WriteMemory(PFAST486_STATE State, /* Find the linear address */ LinearAddress = CachedDescriptor->Base + Offset; +#ifndef FAST486_NO_PREFETCH + if (State->PrefetchValid + && (LinearAddress >= State->PrefetchAddress) + && ((LinearAddress + Size) <= (State->PrefetchAddress + FAST486_CACHE_SIZE))) + { + /* Update the prefetch */ + RtlMoveMemory(&State->PrefetchCache[LinearAddress - State->PrefetchAddress], + Buffer, + min(Size, FAST486_CACHE_SIZE + State->PrefetchAddress - LinearAddress)); + } +#endif + /* Write to the linear address */ return Fast486WriteLinearMemory(State, LinearAddress, Buffer, Size); } diff --git a/reactos/lib/fast486/common.h b/reactos/lib/fast486/common.h index 6b9cb6aa09e..a87a3eeb7a1 100644 --- a/reactos/lib/fast486/common.h +++ b/reactos/lib/fast486/common.h @@ -70,10 +70,6 @@ if (State->PrefixFlags & FAST486_PREFIX_LOCK)\ #define GET_ADDR_PTE(x) (((x) >> 12) & 0x3FF) #define INVALID_TLB_FIELD 0xFFFFFFFF -#ifndef PAGE_SIZE -#define PAGE_SIZE 4096 -#endif - typedef struct _FAST486_MOD_REG_RM { FAST486_GEN_REGS Register; diff --git a/reactos/lib/fast486/common.inl b/reactos/lib/fast486/common.inl index 4990172fb1a..53d1deeb246 100644 --- a/reactos/lib/fast486/common.inl +++ b/reactos/lib/fast486/common.inl @@ -163,9 +163,9 @@ Fast486ReadLinearMemory(PFAST486_STATE State, for (Page = PAGE_ALIGN(LinearAddress); Page <= PAGE_ALIGN(LinearAddress + Size - 1); - Page += PAGE_SIZE) + Page += FAST486_PAGE_SIZE) { - ULONG PageOffset = 0, PageLength = PAGE_SIZE; + ULONG PageOffset = 0, PageLength = FAST486_PAGE_SIZE; /* Get the table entry */ TableEntry.Value = Fast486GetPageTableEntry(State, Page, FALSE); @@ -230,9 +230,9 @@ Fast486WriteLinearMemory(PFAST486_STATE State, for (Page = PAGE_ALIGN(LinearAddress); Page <= PAGE_ALIGN(LinearAddress + Size - 1); - Page += PAGE_SIZE) + Page += FAST486_PAGE_SIZE) { - ULONG PageOffset = 0, PageLength = PAGE_SIZE; + ULONG PageOffset = 0, PageLength = FAST486_PAGE_SIZE; /* Get the table entry */ TableEntry.Value = Fast486GetPageTableEntry(State, Page, TRUE); @@ -522,6 +522,11 @@ Fast486LoadSegment(PFAST486_STATE State, { /* Loading the code segment */ +#ifndef FAST486_NO_PREFETCH + /* Invalidate the prefetch */ + State->PrefetchValid = FALSE; +#endif + if (GET_SEGMENT_INDEX(Selector) == 0) { Fast486Exception(State, FAST486_EXCEPTION_GP); @@ -641,21 +646,39 @@ Fast486FetchByte(PFAST486_STATE State, PUCHAR Data) { PFAST486_SEG_REG CachedDescriptor; + ULONG Offset; +#ifndef FAST486_NO_PREFETCH + ULONG LinearAddress; +#endif /* Get the cached descriptor of CS */ CachedDescriptor = &State->SegmentRegs[FAST486_REG_CS]; - /* Read from memory */ - if (!Fast486ReadMemory(State, - FAST486_REG_CS, - (CachedDescriptor->Size) ? State->InstPtr.Long - : State->InstPtr.LowWord, - TRUE, - Data, - sizeof(UCHAR))) + Offset = (CachedDescriptor->Size) ? State->InstPtr.Long + : State->InstPtr.LowWord; +#ifndef FAST486_NO_PREFETCH + LinearAddress = CachedDescriptor->Base + Offset; + + if (State->PrefetchValid + && (LinearAddress >= State->PrefetchAddress) + && ((LinearAddress + sizeof(UCHAR)) <= (State->PrefetchAddress + FAST486_CACHE_SIZE))) { - /* Exception occurred during instruction fetch */ - return FALSE; + *Data = *(PUCHAR)&State->PrefetchCache[LinearAddress - State->PrefetchAddress]; + } + else +#endif + { + /* Read from memory */ + if (!Fast486ReadMemory(State, + FAST486_REG_CS, + Offset, + TRUE, + Data, + sizeof(UCHAR))) + { + /* Exception occurred during instruction fetch */ + return FALSE; + } } /* Advance the instruction pointer */ @@ -672,22 +695,41 @@ Fast486FetchWord(PFAST486_STATE State, PUSHORT Data) { PFAST486_SEG_REG CachedDescriptor; + ULONG Offset; +#ifndef FAST486_NO_PREFETCH + ULONG LinearAddress; +#endif /* Get the cached descriptor of CS */ CachedDescriptor = &State->SegmentRegs[FAST486_REG_CS]; - /* Read from memory */ - // FIXME: Fix byte order on big-endian machines - if (!Fast486ReadMemory(State, - FAST486_REG_CS, - (CachedDescriptor->Size) ? State->InstPtr.Long - : State->InstPtr.LowWord, - TRUE, - Data, - sizeof(USHORT))) + Offset = (CachedDescriptor->Size) ? State->InstPtr.Long + : State->InstPtr.LowWord; + +#ifndef FAST486_NO_PREFETCH + LinearAddress = CachedDescriptor->Base + Offset; + + if (State->PrefetchValid + && (LinearAddress >= State->PrefetchAddress) + && ((LinearAddress + sizeof(USHORT)) <= (State->PrefetchAddress + FAST486_CACHE_SIZE))) { - /* Exception occurred during instruction fetch */ - return FALSE; + *Data = *(PUSHORT)&State->PrefetchCache[LinearAddress - State->PrefetchAddress]; + } + else +#endif + { + /* Read from memory */ + // FIXME: Fix byte order on big-endian machines + if (!Fast486ReadMemory(State, + FAST486_REG_CS, + Offset, + TRUE, + Data, + sizeof(USHORT))) + { + /* Exception occurred during instruction fetch */ + return FALSE; + } } /* Advance the instruction pointer */ @@ -704,22 +746,41 @@ Fast486FetchDword(PFAST486_STATE State, PULONG Data) { PFAST486_SEG_REG CachedDescriptor; + ULONG Offset; +#ifndef FAST486_NO_PREFETCH + ULONG LinearAddress; +#endif /* Get the cached descriptor of CS */ CachedDescriptor = &State->SegmentRegs[FAST486_REG_CS]; - /* Read from memory */ - // FIXME: Fix byte order on big-endian machines - if (!Fast486ReadMemory(State, - FAST486_REG_CS, - (CachedDescriptor->Size) ? State->InstPtr.Long - : State->InstPtr.LowWord, - TRUE, - Data, - sizeof(ULONG))) + Offset = (CachedDescriptor->Size) ? State->InstPtr.Long + : State->InstPtr.LowWord; + +#ifndef FAST486_NO_PREFETCH + LinearAddress = CachedDescriptor->Base + Offset; + + if (State->PrefetchValid + && (LinearAddress >= State->PrefetchAddress) + && ((LinearAddress + sizeof(ULONG)) <= (State->PrefetchAddress + FAST486_CACHE_SIZE))) { - /* Exception occurred during instruction fetch */ - return FALSE; + *Data = *(PULONG)&State->PrefetchCache[LinearAddress - State->PrefetchAddress]; + } + else +#endif + { + /* Read from memory */ + // FIXME: Fix byte order on big-endian machines + if (!Fast486ReadMemory(State, + FAST486_REG_CS, + Offset, + TRUE, + Data, + sizeof(ULONG))) + { + /* Exception occurred during instruction fetch */ + return FALSE; + } } /* Advance the instruction pointer */ diff --git a/reactos/lib/fast486/extraops.c b/reactos/lib/fast486/extraops.c index 9d23cb97394..eefd918aa6f 100644 --- a/reactos/lib/fast486/extraops.c +++ b/reactos/lib/fast486/extraops.c @@ -686,6 +686,11 @@ FAST486_OPCODE_HANDLER(Fast486ExtOpcodeLoadControlReg) } } +#ifndef FAST486_NO_PREFETCH + /* Changing CR0 or CR3 can interfere with prefetching (because of paging) */ + State->PrefetchValid = FALSE; +#endif + /* Load a value to the control register */ State->ControlRegisters[ModRegRm.Register] = Value; } diff --git a/reactos/lib/fast486/opcodes.c b/reactos/lib/fast486/opcodes.c index f31ce73d7f6..101361b0251 100644 --- a/reactos/lib/fast486/opcodes.c +++ b/reactos/lib/fast486/opcodes.c @@ -4240,6 +4240,11 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeLdsLes) { UCHAR BopCode; +#ifndef FAST486_NO_PREFETCH + /* Invalidate the prefetch since BOP handlers can alter the memory */ + State->PrefetchValid = FALSE; +#endif + /* Fetch the BOP code */ if (!Fast486FetchByte(State, &BopCode)) { diff --git a/reactos/lib/fast486/opgroups.c b/reactos/lib/fast486/opgroups.c index 03eb09181d2..bca294d2c96 100644 --- a/reactos/lib/fast486/opgroups.c +++ b/reactos/lib/fast486/opgroups.c @@ -2177,7 +2177,31 @@ FAST486_OPCODE_HANDLER(Fast486ExtOpcodeGroup0F01) /* INVLPG */ case 7: { - UNIMPLEMENTED; +#ifndef FAST486_NO_PREFETCH + /* Invalidate the prefetch */ + State->PrefetchValid = FALSE; +#endif + + /* This is a privileged instruction */ + if (Fast486GetCurrentPrivLevel(State) != 0) + { + Fast486Exception(State, FAST486_EXCEPTION_GP); + return; + } + + if (!ModRegRm.Memory) + { + /* The second operand must be a memory location */ + Fast486Exception(State, FAST486_EXCEPTION_UD); + return; + } + + if (State->Tlb != NULL) + { + /* Clear the TLB entry */ + State->Tlb[ModRegRm.MemoryAddress >> 12] = INVALID_TLB_FIELD; + } + break; } From 949c27964db4ada5d1c6439ea5315684734cf167 Mon Sep 17 00:00:00 2001 From: Aleksandar Andrejevic Date: Mon, 27 Oct 2014 00:21:06 +0000 Subject: [PATCH 69/91] [FAST486] Don't leave the prefetch cache in a possibly invalid state if Fast486ReadLinearMemory returns FALSE. svn path=/trunk/; revision=65037 --- reactos/lib/fast486/common.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/reactos/lib/fast486/common.c b/reactos/lib/fast486/common.c index 3bb29a58601..a9fb89c168f 100644 --- a/reactos/lib/fast486/common.c +++ b/reactos/lib/fast486/common.c @@ -121,7 +121,11 @@ Fast486ReadMemory(PFAST486_STATE State, Size); return TRUE; } - else return FALSE; + else + { + State->PrefetchValid = FALSE; + return FALSE; + } } else #endif From f1caf76d48560257c91a1035dcfb4ae1830fa1af Mon Sep 17 00:00:00 2001 From: James Tabor Date: Mon, 27 Oct 2014 02:11:08 +0000 Subject: [PATCH 70/91] [NtUser] - Fix default sizes for desktop resources. See CORE-8659. svn path=/trunk/; revision=65039 --- reactos/win32ss/user/ntuser/desktop.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/reactos/win32ss/user/ntuser/desktop.c b/reactos/win32ss/user/ntuser/desktop.c index 2f7838b99e3..5759d260e6d 100644 --- a/reactos/win32ss/user/ntuser/desktop.c +++ b/reactos/win32ss/user/ntuser/desktop.c @@ -25,6 +25,10 @@ IntFreeDesktopHeap(IN PDESKTOP pdesk); /* GLOBALS *******************************************************************/ +/* These can be changed via csrss startup, these are defaults */ +DWORD gdwDesktopSectionSize = 512; +DWORD gdwNOIOSectionSize = 128; // A guess, for one or more of the first three system desktops. + /* Currently active desktop */ PDESKTOP gpdeskInputDesktop = NULL; HDC ScreenDeviceContext = NULL; @@ -1194,7 +1198,7 @@ static NTSTATUS UserInitializeDesktop(PDESKTOP pdesk, PUNICODE_STRING DesktopName, PWINSTATION_OBJECT pwinsta) { PVOID DesktopHeapSystemBase = NULL; - ULONG_PTR HeapSize = 400 * 1024; + ULONG_PTR HeapSize = gdwDesktopSectionSize * 1024; SIZE_T DesktopInfoSize; ULONG i; From 6af614fb4a6e0481d92f80eadb1147694c7b9a10 Mon Sep 17 00:00:00 2001 From: Thomas Faber Date: Mon, 27 Oct 2014 11:52:44 +0000 Subject: [PATCH 71/91] [ADVAPI32] - Hackfix CORE-8717 to stop 2nd stage from failing. Proper fix will be submitted to Wine. svn path=/trunk/; revision=65040 --- reactos/dll/win32/advapi32/wine/security.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/reactos/dll/win32/advapi32/wine/security.c b/reactos/dll/win32/advapi32/wine/security.c index 749fc6921c4..5e575b053c2 100644 --- a/reactos/dll/win32/advapi32/wine/security.c +++ b/reactos/dll/win32/advapi32/wine/security.c @@ -3533,6 +3533,9 @@ static BOOL ParseStringSidToSid(LPCWSTR StringSid, PSID pSid, LPDWORD cBytes) while (*StringSid == ' ') StringSid++; + if (!*StringSid) + goto lend; /* ERROR_INVALID_SID */ + *cBytes = ComputeStringSidSize(StringSid); if (!pisid) /* Simply compute the size */ { From 817dfb57e295bcef26fce66c0e0c950f41591786 Mon Sep 17 00:00:00 2001 From: Pierre Schweitzer Date: Mon, 27 Oct 2014 12:35:58 +0000 Subject: [PATCH 72/91] [NTFS] Bugfixing... Part 10/X: - Properly compute entry name length in CompareFileName() - Also, in CompareFileName() properly handle the return of RtlCompareUnicodeString(); this is not RtlEqualUnicodeString()! - In NtfsLookupFileAt(), don't return an error when we're done walking the path, it's a normal behavior All these fixes allow our NTFS to go one step farther: it can open directory/files (reading files data remains untested so far) in root and in its subdirs. Which was broken previously. The said bugfixes in action (and in image): http://www.heisspiter.net/~Pierre/rostests/NTFS_listing_subdir.png svn path=/trunk/; revision=65041 --- reactos/drivers/filesystems/ntfs/mft.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/reactos/drivers/filesystems/ntfs/mft.c b/reactos/drivers/filesystems/ntfs/mft.c index d2f0d3b9d9b..a882700acd4 100644 --- a/reactos/drivers/filesystems/ntfs/mft.c +++ b/reactos/drivers/filesystems/ntfs/mft.c @@ -469,7 +469,7 @@ CompareFileName(PUNICODE_STRING FileName, EntryName.Buffer = IndexEntry->FileName.Name; EntryName.Length = - EntryName.MaximumLength = IndexEntry->FileName.NameLength; + EntryName.MaximumLength = IndexEntry->FileName.NameLength * sizeof(WCHAR); if (DirSearch) { @@ -477,7 +477,7 @@ CompareFileName(PUNICODE_STRING FileName, } else { - return (RtlCompareUnicodeString(FileName, &EntryName, (IndexEntry->FileName.NameType != NTFS_FILE_NAME_POSIX)) == TRUE); + return (RtlCompareUnicodeString(FileName, &EntryName, (IndexEntry->FileName.NameType != NTFS_FILE_NAME_POSIX)) == 0); } } @@ -702,7 +702,7 @@ NtfsLookupFileAt(PDEVICE_EXTENSION Vcb, } if (Remaining.Length == 0) - return STATUS_OBJECT_PATH_NOT_FOUND; + break; FsRtlDissectName(Current, &Current, &Remaining); } From 8c225a0e59b6cc43ab199079753952bdc322b531 Mon Sep 17 00:00:00 2001 From: Pierre Schweitzer Date: Mon, 27 Oct 2014 13:38:14 +0000 Subject: [PATCH 73/91] [FASTFAT] Add sanity checks in VfatSetRenameInformation() to make sure we don't leak any FCB reference svn path=/trunk/; revision=65042 --- reactos/drivers/filesystems/fastfat/finfo.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/reactos/drivers/filesystems/fastfat/finfo.c b/reactos/drivers/filesystems/fastfat/finfo.c index 7a8bbea9289..6ed6745e97b 100644 --- a/reactos/drivers/filesystems/fastfat/finfo.c +++ b/reactos/drivers/filesystems/fastfat/finfo.c @@ -473,6 +473,8 @@ VfatSetRenameInformation( OBJECT_ATTRIBUTES ObjectAttributes; HANDLE TargetHandle; BOOLEAN DeletedTarget; + ULONG OldReferences, NewReferences; + PVFATFCB OldParent; DPRINT("VfatSetRenameInfo(%p, %p, %p, %p, %p)\n", FileObject, FCB, DeviceExt, RenameInfo, TargetFileObject); @@ -482,6 +484,8 @@ VfatSetRenameInformation( return STATUS_INVALID_PARAMETER; } + OldReferences = FCB->parentFcb->RefCount; + /* If we are performing relative opening for rename, get FO for getting FCB and path name */ if (RenameInfo->RootDirectory != NULL) { @@ -686,6 +690,7 @@ VfatSetRenameInformation( if (FsRtlAreNamesEqual(&SourceFile, &NewFile, FALSE, NULL)) { Status = STATUS_SUCCESS; + ASSERT(OldReferences == FCB->parentFcb->RefCount); goto Cleanup; } @@ -729,6 +734,8 @@ VfatSetRenameInformation( &DeletedTarget); if (!NT_SUCCESS(Status)) { + ASSERT(OldReferences == FCB->parentFcb->RefCount - 1); + ASSERT(OldReferences == ParentFCB->RefCount - 1); goto Cleanup; } @@ -773,11 +780,16 @@ VfatSetRenameInformation( } } } + + ASSERT(OldReferences == FCB->parentFcb->RefCount - 1); // extra grab + ASSERT(OldReferences == ParentFCB->RefCount - 1); // extra grab } else { + /* Try to find target */ ParentFCB = NULL; + OldParent = FCB->parentFcb; Status = vfatPrepareTargetForRename(DeviceExt, &ParentFCB, &NewName, @@ -786,9 +798,12 @@ VfatSetRenameInformation( &DeletedTarget); if (!NT_SUCCESS(Status)) { + ASSERT(OldReferences == FCB->parentFcb->RefCount); goto Cleanup; } + NewReferences = ParentFCB->RefCount; + FsRtlNotifyFullReportChange(DeviceExt->NotifySync, &(DeviceExt->NotifyList), (PSTRING)&FCB->PathNameU, @@ -831,6 +846,8 @@ VfatSetRenameInformation( } } + ASSERT(OldReferences == OldParent->RefCount + 1); // removed file + ASSERT(NewReferences == ParentFCB->RefCount - 1); // new file Cleanup: if (ParentFCB != NULL) vfatReleaseFCB(DeviceExt, ParentFCB); if (NewName.Buffer != NULL) ExFreePoolWithTag(NewName.Buffer, TAG_VFAT); From af8bee9d61e0a82689254d672d3cdf34931bce28 Mon Sep 17 00:00:00 2001 From: Pierre Schweitzer Date: Mon, 27 Oct 2014 13:39:03 +0000 Subject: [PATCH 74/91] [FASTFAT] Don't leak reference in case of share access failure. svn path=/trunk/; revision=65043 --- reactos/drivers/filesystems/fastfat/create.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/reactos/drivers/filesystems/fastfat/create.c b/reactos/drivers/filesystems/fastfat/create.c index fb4261b99b7..ffe23bc4edb 100644 --- a/reactos/drivers/filesystems/fastfat/create.c +++ b/reactos/drivers/filesystems/fastfat/create.c @@ -443,9 +443,9 @@ VfatCreateFile( PVFATFCB pFcb = NULL; PVFATFCB ParentFcb = NULL; PWCHAR c, last; - BOOLEAN PagingFileCreate = FALSE; + BOOLEAN PagingFileCreate; BOOLEAN Dots; - BOOLEAN OpenTargetDir = FALSE; + BOOLEAN OpenTargetDir; UNICODE_STRING FileNameU; UNICODE_STRING PathNameU; ULONG Attributes; @@ -633,6 +633,7 @@ VfatCreateFile( FALSE); if (!NT_SUCCESS(Status)) { + vfatReleaseFCB(DeviceExt, ParentFcb); VfatCloseFile(DeviceExt, FileObject); return Status; } From 16c90ce222a60d29f36448617ed7d74bc971d616 Mon Sep 17 00:00:00 2001 From: Amine Khaldi Date: Mon, 27 Oct 2014 16:30:45 +0000 Subject: [PATCH 75/91] [ADVAPI32] * Zap SidTable. svn path=/trunk/; revision=65044 --- reactos/dll/win32/advapi32/wine/security.c | 43 ---------------------- 1 file changed, 43 deletions(-) diff --git a/reactos/dll/win32/advapi32/wine/security.c b/reactos/dll/win32/advapi32/wine/security.c index 5e575b053c2..de9458155ec 100644 --- a/reactos/dll/win32/advapi32/wine/security.c +++ b/reactos/dll/win32/advapi32/wine/security.c @@ -236,49 +236,6 @@ static __inline BOOL set_ntstatus( NTSTATUS status ) return NT_SUCCESS(status); } -static const RECORD SidTable[] = -{ - { SDDL_ACCOUNT_OPERATORS, WinBuiltinAccountOperatorsSid }, - { SDDL_ALIAS_PREW2KCOMPACC, WinBuiltinPreWindows2000CompatibleAccessSid }, - { SDDL_ANONYMOUS, WinAnonymousSid }, - { SDDL_AUTHENTICATED_USERS, WinAuthenticatedUserSid }, - { SDDL_BUILTIN_ADMINISTRATORS, WinBuiltinAdministratorsSid }, - { SDDL_BUILTIN_GUESTS, WinBuiltinGuestsSid }, - { SDDL_BACKUP_OPERATORS, WinBuiltinBackupOperatorsSid }, - { SDDL_BUILTIN_USERS, WinBuiltinUsersSid }, - { SDDL_CERT_SERV_ADMINISTRATORS, WinAccountCertAdminsSid /* FIXME: DOMAIN_GROUP_RID_CERT_ADMINS */ }, - { SDDL_CREATOR_GROUP, WinCreatorGroupSid }, - { SDDL_CREATOR_OWNER, WinCreatorOwnerSid }, - { SDDL_DOMAIN_ADMINISTRATORS, WinAccountDomainAdminsSid /* FIXME: DOMAIN_GROUP_RID_ADMINS */ }, - { SDDL_DOMAIN_COMPUTERS, WinAccountComputersSid /* FIXME: DOMAIN_GROUP_RID_COMPUTERS */ }, - { SDDL_DOMAIN_DOMAIN_CONTROLLERS, WinAccountControllersSid /* FIXME: DOMAIN_GROUP_RID_CONTROLLERS */ }, - { SDDL_DOMAIN_GUESTS, WinAccountDomainGuestsSid /* FIXME: DOMAIN_GROUP_RID_GUESTS */ }, - { SDDL_DOMAIN_USERS, WinAccountDomainUsersSid /* FIXME: DOMAIN_GROUP_RID_USERS */ }, - { SDDL_ENTERPRISE_ADMINS, WinAccountEnterpriseAdminsSid /* FIXME: DOMAIN_GROUP_RID_ENTERPRISE_ADMINS */ }, - { SDDL_ENTERPRISE_DOMAIN_CONTROLLERS, WinEnterpriseControllersSid }, - { SDDL_EVERYONE, WinWorldSid }, - { SDDL_GROUP_POLICY_ADMINS, WinAccountPolicyAdminsSid /* FIXME: DOMAIN_GROUP_RID_POLICY_ADMINS */ }, - { SDDL_INTERACTIVE, WinInteractiveSid }, - { SDDL_LOCAL_ADMIN, WinAccountAdministratorSid /* FIXME: DOMAIN_USER_RID_ADMIN */ }, - { SDDL_LOCAL_GUEST, WinAccountGuestSid /* FIXME: DOMAIN_USER_RID_GUEST */ }, - { SDDL_LOCAL_SERVICE, WinLocalServiceSid }, - { SDDL_LOCAL_SYSTEM, WinLocalSystemSid }, - { SDDL_NETWORK, WinNetworkSid }, - { SDDL_NETWORK_CONFIGURATION_OPS, WinBuiltinNetworkConfigurationOperatorsSid }, - { SDDL_NETWORK_SERVICE, WinNetworkServiceSid }, - { SDDL_PRINTER_OPERATORS, WinBuiltinPrintOperatorsSid }, - { SDDL_PERSONAL_SELF, WinSelfSid }, - { SDDL_POWER_USERS, WinBuiltinPowerUsersSid }, - { SDDL_RAS_SERVERS, WinAccountRasAndIasServersSid /* FIXME: DOMAIN_ALIAS_RID_RAS_SERVERS */ }, - { SDDL_REMOTE_DESKTOP, WinBuiltinRemoteDesktopUsersSid }, - { SDDL_REPLICATOR, WinBuiltinReplicatorSid }, - { SDDL_RESTRICTED_CODE, WinRestrictedCodeSid }, - { SDDL_SCHEMA_ADMINISTRATORS, WinAccountSchemaAdminsSid /* FIXME: DOMAIN_GROUP_RID_SCHEMA_ADMINS */ }, - { SDDL_SERVER_OPERATORS, WinBuiltinSystemOperatorsSid }, - { SDDL_SERVICE, WinServiceSid }, - { NULL, 0 }, -}; - static LPWSTR SERV_dup( LPCSTR str ) { UINT len; From b9febc149015fce69396e32f3509f49d2a4e52c3 Mon Sep 17 00:00:00 2001 From: Amine Khaldi Date: Mon, 27 Oct 2014 17:00:41 +0000 Subject: [PATCH 76/91] [ADVAPI32] * Remove unused MAX_GUID_STRING_LEN and RECORD. * Remove some unneeded forward declarations. * Reorder ACEFLAG to reduce difference to Wine. CORE-8540 svn path=/trunk/; revision=65045 --- reactos/dll/win32/advapi32/wine/security.c | 27 ++++------------------ 1 file changed, 4 insertions(+), 23 deletions(-) diff --git a/reactos/dll/win32/advapi32/wine/security.c b/reactos/dll/win32/advapi32/wine/security.c index de9458155ec..35c5df97877 100644 --- a/reactos/dll/win32/advapi32/wine/security.c +++ b/reactos/dll/win32/advapi32/wine/security.c @@ -16,26 +16,13 @@ WINE_DEFAULT_DEBUG_CHANNEL(advapi); -static DWORD ComputeStringSidSize(LPCWSTR StringSid); static BOOL ParseStringSidToSid(LPCWSTR StringSid, PSID pSid, LPDWORD cBytes); -#define MAX_GUID_STRING_LEN 39 - -BOOL WINAPI -AddAuditAccessAceEx(PACL pAcl, - DWORD dwAceRevision, - DWORD AceFlags, - DWORD dwAccessMask, - PSID pSid, - BOOL bAuditSuccess, - BOOL bAuditFailure); - -typedef struct RECORD +typedef struct _ACEFLAG { - LPCWSTR key; - DWORD value; -} RECORD; - + LPCWSTR wstr; + DWORD value; +} ACEFLAG, *LPACEFLAG; typedef struct _MAX_SID { @@ -53,12 +40,6 @@ typedef struct WELLKNOWNSID MAX_SID Sid; } WELLKNOWNSID; -typedef struct _ACEFLAG -{ - LPCWSTR wstr; - DWORD value; -} ACEFLAG, *LPACEFLAG; - static const WELLKNOWNSID WellKnownSids[] = { { {0,0}, WinNullSid, { SID_REVISION, 1, { SECURITY_NULL_SID_AUTHORITY }, { SECURITY_NULL_RID } } }, From 0593e1599887ea21a7183f00d10f261e69002460 Mon Sep 17 00:00:00 2001 From: Amine Khaldi Date: Mon, 27 Oct 2014 17:23:05 +0000 Subject: [PATCH 77/91] [ADVAPI32] * Update GetTrusteeForm{A,W}(). CORE-8540 svn path=/trunk/; revision=65050 --- reactos/dll/win32/advapi32/wine/security.c | 45 +++++++++++++--------- 1 file changed, 26 insertions(+), 19 deletions(-) diff --git a/reactos/dll/win32/advapi32/wine/security.c b/reactos/dll/win32/advapi32/wine/security.c index 35c5df97877..bbb93aebf84 100644 --- a/reactos/dll/win32/advapi32/wine/security.c +++ b/reactos/dll/win32/advapi32/wine/security.c @@ -2037,25 +2037,32 @@ BuildTrusteeWithNameW(PTRUSTEE_W pTrustee, pTrustee->ptstrName = name; } -/****************************************************************************** - * GetTrusteeFormW [ADVAPI32.@] - */ -TRUSTEE_FORM WINAPI -GetTrusteeFormA(PTRUSTEE_A pTrustee) -{ - return pTrustee->TrusteeForm; -} - - -/****************************************************************************** - * GetTrusteeFormW [ADVAPI32.@] - */ -TRUSTEE_FORM WINAPI -GetTrusteeFormW(PTRUSTEE_W pTrustee) -{ - return pTrustee->TrusteeForm; -} - +/****************************************************************************** + * GetTrusteeFormA [ADVAPI32.@] + */ +TRUSTEE_FORM WINAPI GetTrusteeFormA(PTRUSTEEA pTrustee) +{ + TRACE("(%p)\n", pTrustee); + + if (!pTrustee) + return TRUSTEE_BAD_FORM; + + return pTrustee->TrusteeForm; +} + +/****************************************************************************** + * GetTrusteeFormW [ADVAPI32.@] + */ +TRUSTEE_FORM WINAPI GetTrusteeFormW(PTRUSTEEW pTrustee) +{ + TRACE("(%p)\n", pTrustee); + + if (!pTrustee) + return TRUSTEE_BAD_FORM; + + return pTrustee->TrusteeForm; +} + /****************************************************************************** * GetTrusteeNameA [ADVAPI32.@] */ From 8ab78d931ac860983ba5080aca2f7feefe2eafc4 Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Mon, 27 Oct 2014 20:40:11 +0000 Subject: [PATCH 78/91] [WIN32K] - Fail in NtGdiCreateClientObj, when the object type is not valid. This is based on Windows behavior, only more strict. Windows allows to set the stock bit and reuse count, which is probably not what we want. svn path=/trunk/; revision=65052 --- reactos/win32ss/gdi/ntgdi/gdiobj.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/reactos/win32ss/gdi/ntgdi/gdiobj.c b/reactos/win32ss/gdi/ntgdi/gdiobj.c index 7cfbf470a94..8aa9703b760 100644 --- a/reactos/win32ss/gdi/ntgdi/gdiobj.c +++ b/reactos/win32ss/gdi/ntgdi/gdiobj.c @@ -1272,6 +1272,15 @@ NtGdiCreateClientObj( POBJ pObject; HANDLE handle; + /* Check if ulType is valid */ + if ((ulType != GDILoObjType_LO_METAFILE16_TYPE) && + (ulType != GDILoObjType_LO_METAFILE_TYPE) && + (ulType != GDILoObjType_LO_METADC16_TYPE)) + { + DPRINT1("NtGdiCreateClientObj: Invalid object type 0x%lx.\n", ulType); + return NULL; + } + /* Allocate a new object */ pObject = GDIOBJ_AllocateObject(GDIObjType_CLIENTOBJ_TYPE, sizeof(CLIENTOBJ), @@ -1282,9 +1291,6 @@ NtGdiCreateClientObj( return NULL; } - /* Mask out everything that would change the type in a wrong manner */ - ulType &= (GDI_HANDLE_TYPE_MASK & ~GDI_HANDLE_BASETYPE_MASK); - /* Set the real object type */ pObject->hHmgr = UlongToHandle(ulType | GDILoObjType_LO_CLIENTOBJ_TYPE); From 18134c10dbf7ba74fbf6319387afe1cacd976c5e Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Mon, 27 Oct 2014 20:53:59 +0000 Subject: [PATCH 79/91] [GDI32] Add Support routines for client objects. Will be used later. You might wonder why the code uses a lame hash table to link the client object handles to the user mode pointer, when it should be clear that a *client* object should have a user mode attribute, like other objects, that we can use, especially since that is the only real purpose of that object. Well, tell that the MS developer, who implemented client objects without a user mode attribute... svn path=/trunk/; revision=65053 --- reactos/win32ss/gdi/gdi32/CMakeLists.txt | 1 + reactos/win32ss/gdi/gdi32/include/gdi32p.h | 16 ++ reactos/win32ss/gdi/gdi32/main/dllmain.c | 2 + reactos/win32ss/gdi/gdi32/objects/clientobj.c | 150 ++++++++++++++++++ 4 files changed, 169 insertions(+) create mode 100644 reactos/win32ss/gdi/gdi32/objects/clientobj.c diff --git a/reactos/win32ss/gdi/gdi32/CMakeLists.txt b/reactos/win32ss/gdi/gdi32/CMakeLists.txt index 9ee18750776..1d60fe3e092 100644 --- a/reactos/win32ss/gdi/gdi32/CMakeLists.txt +++ b/reactos/win32ss/gdi/gdi32/CMakeLists.txt @@ -24,6 +24,7 @@ list(APPEND SOURCE objects/arc.c objects/bitmap.c objects/brush.c + objects/clientobj.c objects/coord.c objects/dc.c objects/eng.c diff --git a/reactos/win32ss/gdi/gdi32/include/gdi32p.h b/reactos/win32ss/gdi/gdi32/include/gdi32p.h index 8dc34994166..29d6381af24 100644 --- a/reactos/win32ss/gdi/gdi32/include/gdi32p.h +++ b/reactos/win32ss/gdi/gdi32/include/gdi32p.h @@ -395,4 +395,20 @@ _lrintf(float f) #endif } +HGDIOBJ +WINAPI +GdiInsertClientObj( + _In_ PVOID pvObject, + _In_ GDILOOBJTYPE eObjType); + +PVOID +WINAPI +GdiGetClientObject( + _In_ HGDIOBJ hobj); + +PVOID +WINAPI +GdiRemoveClientObject( + _In_ HGDIOBJ hobj); + /* EOF */ diff --git a/reactos/win32ss/gdi/gdi32/main/dllmain.c b/reactos/win32ss/gdi/gdi32/main/dllmain.c index c3a42a6746b..d6521c374bd 100644 --- a/reactos/win32ss/gdi/gdi32/main/dllmain.c +++ b/reactos/win32ss/gdi/gdi32/main/dllmain.c @@ -10,6 +10,7 @@ PDEVCAPS GdiDevCaps = NULL; PGDIHANDLECACHE GdiHandleCache = NULL; BOOL gbLpk = FALSE; RTL_CRITICAL_SECTION semLocal; +extern CRITICAL_SECTION gcsClientObjLinks; /* * GDI32.DLL does have an entry point for disable threadlibrarycall,. The initialization is done by a call @@ -49,6 +50,7 @@ GdiProcessSetup (VOID) GDI_BatchLimit = (DWORD) NtCurrentTeb()->ProcessEnvironmentBlock->GdiDCAttributeList; GdiHandleCache = (PGDIHANDLECACHE)NtCurrentTeb()->ProcessEnvironmentBlock->GdiHandleBuffer; RtlInitializeCriticalSection(&semLocal); + InitializeCriticalSection(&gcsClientObjLinks); } diff --git a/reactos/win32ss/gdi/gdi32/objects/clientobj.c b/reactos/win32ss/gdi/gdi32/objects/clientobj.c new file mode 100644 index 00000000000..e59006f35a9 --- /dev/null +++ b/reactos/win32ss/gdi/gdi32/objects/clientobj.c @@ -0,0 +1,150 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS WIN32 subsystem + * PURPOSE: Support functions for GDI client objects + * PROGRAMMER: Timo Kreuzer (timo.kreuzer@reactos.org) + */ + +#include + +CRITICAL_SECTION gcsClientObjLinks; + +typedef struct _CLIENTOBJLINK +{ + struct _CLIENTOBJLINK *pcolNext; + HGDIOBJ hobj; + PVOID pvObj; +} CLIENTOBJLINK, *PCLIENTOBJLINK; + +PCLIENTOBJLINK gapcolHashTable[127]; + +HGDIOBJ +WINAPI +GdiInsertClientObj( + _In_ PVOID pvObject, + _In_ GDILOOBJTYPE eObjType) +{ + PCLIENTOBJLINK pcol; + ULONG iHashIndex; + HGDIOBJ hobj; + + /* Call win32k to create a client object handle */ + hobj = NtGdiCreateClientObj(eObjType); + if (hobj == NULL) + { + return NULL; + } + + /* Calculate the hash index */ + iHashIndex = (ULONG_PTR)hobj % _countof(gapcolHashTable); + + /* Allocate a link structure */ + pcol = HeapAlloc(GetProcessHeap(), 0, sizeof(*pcol)); + if (pcol == NULL) + { + NtGdiDeleteClientObj(hobj); + return NULL; + } + + /* Setup the link structure */ + pcol->hobj = hobj; + pcol->pvObj = pvObject; + + /* Enter the critical section */ + EnterCriticalSection(&gcsClientObjLinks); + + /* Insert the link structure */ + pcol->pcolNext = gapcolHashTable[iHashIndex]; + gapcolHashTable[iHashIndex] = pcol; + + /* Leave the critical section */ + LeaveCriticalSection(&gcsClientObjLinks); + + return hobj; +} + +PVOID +WINAPI +GdiGetClientObject( + _In_ HGDIOBJ hobj) +{ + ULONG iHashIndex; + PCLIENTOBJLINK pcol; + PVOID pvObject = NULL; + + /* Calculate the hash index */ + iHashIndex = (ULONG_PTR)hobj % _countof(gapcolHashTable); + + /* Enter the critical section */ + EnterCriticalSection(&gcsClientObjLinks); + + /* Loop the link entries in this hash bucket */ + pcol = gapcolHashTable[iHashIndex]; + while (pcol != NULL) + { + /* Check if this is the object we want */ + if (pcol->hobj == hobj) + { + /* Get the object pointer and bail out */ + pvObject = pcol->pvObj; + break; + } + + /* Go to the next entry */ + pcol = pcol->pcolNext; + } + + /* Leave the critical section */ + LeaveCriticalSection(&gcsClientObjLinks); + + return pvObject; +} + +PVOID +WINAPI +GdiRemoveClientObject( + _In_ HGDIOBJ hobj) +{ + PCLIENTOBJLINK pcol, *ppcol; + ULONG iHashIndex; + PVOID pvObject = NULL; + + /* Calculate the hash index */ + iHashIndex = (ULONG_PTR)hobj % _countof(gapcolHashTable); + + /* Enter the critical section */ + EnterCriticalSection(&gcsClientObjLinks); + + /* Loop the link entries in this hash bucket */ + ppcol = &gapcolHashTable[iHashIndex]; + while (*ppcol != NULL) + { + /* Get the current client object link */ + pcol = *ppcol; + + /* Check if this is the one we want */ + if (pcol->hobj == hobj) + { + /* Update the link pointer, removing this link */ + *ppcol = pcol->pcolNext; + + /* Get the object pointer */ + pvObject = pcol->pvObj; + + /* Free the link structure */ + HeapFree(GetProcessHeap(), 0, pcol); + + /* We're done */ + break; + } + + /* Go to the next link pointer */ + ppcol = &(pcol->pcolNext); + } + + /* Leave the critical section */ + LeaveCriticalSection(&gcsClientObjLinks); + + /* Return the object pointer, or NULL if we did not find it */ + return pvObject; +} From 207b88eaf167df7966994fbd62f9737a36ab9f8b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Gardou?= Date: Mon, 27 Oct 2014 22:05:51 +0000 Subject: [PATCH 80/91] [KERNEL32] - Do not try to open memory events under the process object root directory. CORE-8600 #resolve svn path=/trunk/; revision=65054 --- reactos/dll/win32/kernel32/client/resntfy.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reactos/dll/win32/kernel32/client/resntfy.c b/reactos/dll/win32/kernel32/client/resntfy.c index fec93d43be4..2f2e0fde090 100644 --- a/reactos/dll/win32/kernel32/client/resntfy.c +++ b/reactos/dll/win32/kernel32/client/resntfy.c @@ -41,7 +41,7 @@ CreateMemoryResourceNotification(IN MEMORY_RESOURCE_NOTIFICATION_TYPE Notificati InitializeObjectAttributes(&ObjectAttributes, &EventName, 0, - BaseGetNamedObjectDirectory(), + NULL, NULL); Status = NtOpenEvent(&hEvent, From 2d1292ebbedc84c2458bfd6975ab5eb7c12a95b4 Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Mon, 27 Oct 2014 23:37:05 +0000 Subject: [PATCH 81/91] [GDI32] - Improve formatting - Use more consistent variable names - Remove unnecessary casts - Add some annotations - No intended code changes svn path=/trunk/; revision=65055 --- reactos/win32ss/gdi/gdi32/objects/dc.c | 786 ++++++++++++++----------- 1 file changed, 452 insertions(+), 334 deletions(-) diff --git a/reactos/win32ss/gdi/gdi32/objects/dc.c b/reactos/win32ss/gdi/gdi32/objects/dc.c index 3e0d52477b9..c6c7608dfce 100644 --- a/reactos/win32ss/gdi/gdi32/objects/dc.c +++ b/reactos/win32ss/gdi/gdi32/objects/dc.c @@ -7,14 +7,15 @@ HGDIOBJ stock_objects[NB_STOCK_OBJECTS]; // temp location. HDC FASTCALL -IntCreateDICW ( LPCWSTR lpwszDriver, - LPCWSTR lpwszDevice, - LPCWSTR lpwszOutput, - PDEVMODEW lpInitData, - ULONG iType ) +IntCreateDICW( + LPCWSTR lpwszDriver, + LPCWSTR lpwszDevice, + LPCWSTR lpwszOutput, + PDEVMODEW lpInitData, + ULONG iType) { UNICODE_STRING Device, Output; - HDC hDC = NULL; + HDC hdc = NULL; BOOL Display = FALSE, Default = FALSE; ULONG UMdhpdev = 0; @@ -60,32 +61,32 @@ IntCreateDICW ( LPCWSTR lpwszDriver, DPRINT1("Not a DISPLAY device! %wZ\n", &Device); } - hDC = NtGdiOpenDCW( (Default ? NULL : &Device), - (PDEVMODEW) lpInitData, - (lpwszOutput ? &Output : NULL), - iType, // DCW 0 and ICW 1. - Display, - hspool, - (PVOID) NULL, // NULL for now. - (PVOID) &UMdhpdev ); + hdc = NtGdiOpenDCW((Default ? NULL : &Device), + (PDEVMODEW) lpInitData, + (lpwszOutput ? &Output : NULL), + iType, // DCW 0 and ICW 1. + Display, + hspool, + (PVOID) NULL, // NULL for now. + (PVOID) &UMdhpdev ); #if 0 // Handle something other than a normal dc object. - if (GDI_HANDLE_GET_TYPE(hDC) != GDI_OBJECT_TYPE_DC) + if (GDI_HANDLE_GET_TYPE(hdc) != GDI_OBJECT_TYPE_DC) { PDC_ATTR Dc_Attr; PLDC pLDC; - GdiGetHandleUserData((HGDIOBJ) hDC, GDI_OBJECT_TYPE_DC, (PVOID) &Dc_Attr); + GdiGetHandleUserData(hdc, GDI_OBJECT_TYPE_DC, (PVOID*)&Dc_Attr); pLDC = LocalAlloc(LMEM_ZEROINIT, sizeof(LDC)); Dc_Attr->pvLDC = pLDC; - pLDC->hDC = hDC; + pLDC->hDC = hdc; pLDC->iType = LDC_LDC; // 1 (init) local DC, 2 EMF LDC DbgPrint("DC_ATTR Allocated -> 0x%x\n",Dc_Attr); } #endif - return hDC; + return hdc; } @@ -94,22 +95,24 @@ IntCreateDICW ( LPCWSTR lpwszDriver, */ HDC WINAPI -CreateCompatibleDC ( HDC hdc) +CreateCompatibleDC( + _In_ HDC hdc) { - HDC rhDC; -// PDC_ATTR Dc_Attr; + HDC hdcNew; +// PDC_ATTR pdcattr; - rhDC = NtGdiCreateCompatibleDC(hdc); + hdcNew = NtGdiCreateCompatibleDC(hdc); #if 0 - if ( hdc && rhDC) + if ( hdc && hdcNew) { - if (GdiGetHandleUserData((HGDIOBJ) hdc, GDI_OBJECT_TYPE_DC, (PVOID) &Dc_Attr)) + if (GdiGetHandleUserData(hdc, GDI_OBJECT_TYPE_DC, (PVOID*)&pdcattr)) { - if ( Dc_Attr->pvLIcm ) IcmCompatibleDC(rhDC, hdc, Dc_Attr); + if (pdcattr->pvLIcm) IcmCompatibleDC(hdcNew, hdc, pdcattr); } } #endif - return rhDC; + + return hdcNew; } /* @@ -118,64 +121,68 @@ CreateCompatibleDC ( HDC hdc) HDC WINAPI CreateDCA ( - LPCSTR lpszDriver, - LPCSTR lpszDevice, - LPCSTR lpszOutput, - CONST DEVMODEA * lpdvmInit -) + LPCSTR lpszDriver, + LPCSTR lpszDevice, + LPCSTR lpszOutput, + CONST DEVMODEA * lpdvmInit) { ANSI_STRING DriverA, DeviceA, OutputA; UNICODE_STRING DriverU, DeviceU, OutputU; LPDEVMODEW dvmInitW = NULL; - HDC hDC; + HDC hdc; /* * If needed, convert to Unicode * any string parameter. */ - if (NULL != lpszDriver) + if (lpszDriver != NULL) { RtlInitAnsiString(&DriverA, (LPSTR)lpszDriver); RtlAnsiStringToUnicodeString(&DriverU, &DriverA, TRUE); } else + { DriverU.Buffer = NULL; - if (NULL != lpszDevice) + } + + if (lpszDevice != NULL) { RtlInitAnsiString(&DeviceA, (LPSTR)lpszDevice); RtlAnsiStringToUnicodeString(&DeviceU, &DeviceA, TRUE); } else + { DeviceU.Buffer = NULL; - if (NULL != lpszOutput) + } + + if (lpszOutput != NULL) { RtlInitAnsiString(&OutputA, (LPSTR)lpszOutput); RtlAnsiStringToUnicodeString(&OutputU, &OutputA, TRUE); } else + { OutputU.Buffer = NULL; + } - if ( lpdvmInit ) + if (lpdvmInit != NULL) dvmInitW = GdiConvertToDevmodeW((LPDEVMODEA)lpdvmInit); - hDC = IntCreateDICW ( DriverU.Buffer, - DeviceU.Buffer, - OutputU.Buffer, - lpdvmInit ? dvmInitW : NULL, - 0 ); - HEAP_free (dvmInitW); - /* - * Free Unicode parameters. - */ + hdc = IntCreateDICW(DriverU.Buffer, + DeviceU.Buffer, + OutputU.Buffer, + lpdvmInit ? dvmInitW : NULL, + 0); + HEAP_free(dvmInitW); + + /* Free Unicode parameters. */ RtlFreeUnicodeString(&DriverU); RtlFreeUnicodeString(&DeviceU); RtlFreeUnicodeString(&OutputU); - /* - * Return the possible DC handle. - */ - return hDC; + /* Return the DC handle. */ + return hdc; } @@ -185,18 +192,16 @@ CreateDCA ( HDC WINAPI CreateDCW ( - LPCWSTR lpwszDriver, - LPCWSTR lpwszDevice, - LPCWSTR lpwszOutput, - CONST DEVMODEW *lpInitData -) + LPCWSTR lpwszDriver, + LPCWSTR lpwszDevice, + LPCWSTR lpwszOutput, + CONST DEVMODEW *lpInitData) { - - return IntCreateDICW ( lpwszDriver, - lpwszDevice, - lpwszOutput, - (PDEVMODEW) lpInitData, - 0 ); + return IntCreateDICW(lpwszDriver, + lpwszDevice, + lpwszOutput, + (PDEVMODEW)lpInitData, + 0); } @@ -206,17 +211,16 @@ CreateDCW ( HDC WINAPI CreateICW( - LPCWSTR lpszDriver, - LPCWSTR lpszDevice, - LPCWSTR lpszOutput, - CONST DEVMODEW *lpdvmInit -) + LPCWSTR lpszDriver, + LPCWSTR lpszDevice, + LPCWSTR lpszOutput, + CONST DEVMODEW *lpdvmInit) { - return IntCreateDICW ( lpszDriver, - lpszDevice, - lpszOutput, - (PDEVMODEW) lpdvmInit, - 1 ); + return IntCreateDICW(lpszDriver, + lpszDevice, + lpszOutput, + (PDEVMODEW)lpdvmInit, + 1); } @@ -226,48 +230,48 @@ CreateICW( HDC WINAPI CreateICA( - LPCSTR lpszDriver, - LPCSTR lpszDevice, - LPCSTR lpszOutput, - CONST DEVMODEA *lpdvmInit -) + LPCSTR lpszDriver, + LPCSTR lpszDevice, + LPCSTR lpszOutput, + CONST DEVMODEA *lpdvmInit) { NTSTATUS Status; LPWSTR lpszDriverW, lpszDeviceW, lpszOutputW; LPDEVMODEW dvmInitW = NULL; - HDC rc = 0; + HDC hdc = 0; - Status = HEAP_strdupA2W ( &lpszDriverW, lpszDriver ); - if (!NT_SUCCESS (Status)) - SetLastError (RtlNtStatusToDosError(Status)); + Status = HEAP_strdupA2W(&lpszDriverW, lpszDriver); + if (!NT_SUCCESS(Status)) + SetLastError(RtlNtStatusToDosError(Status)); else { - Status = HEAP_strdupA2W ( &lpszDeviceW, lpszDevice ); - if (!NT_SUCCESS (Status)) - SetLastError (RtlNtStatusToDosError(Status)); + Status = HEAP_strdupA2W(&lpszDeviceW, lpszDevice); + if (!NT_SUCCESS(Status)) + SetLastError(RtlNtStatusToDosError(Status)); else { - Status = HEAP_strdupA2W ( &lpszOutputW, lpszOutput ); - if (!NT_SUCCESS (Status)) - SetLastError (RtlNtStatusToDosError(Status)); + Status = HEAP_strdupA2W(&lpszOutputW, lpszOutput); + if (!NT_SUCCESS(Status)) + SetLastError(RtlNtStatusToDosError(Status)); else { - if ( lpdvmInit ) + if (lpdvmInit) dvmInitW = GdiConvertToDevmodeW((LPDEVMODEA)lpdvmInit); - rc = IntCreateDICW ( lpszDriverW, - lpszDeviceW, - lpszOutputW, - lpdvmInit ? dvmInitW : NULL, - 1 ); - HEAP_free (dvmInitW); - HEAP_free ( lpszOutputW ); + hdc = IntCreateDICW(lpszDriverW, + lpszDeviceW, + lpszOutputW, + lpdvmInit ? dvmInitW : NULL, + 1 ); + HEAP_free(dvmInitW); + HEAP_free(lpszOutputW); } - HEAP_free ( lpszDeviceW ); + HEAP_free(lpszDeviceW); } - HEAP_free ( lpszDriverW ); + HEAP_free(lpszDriverW); } - return rc; + + return hdc; } @@ -276,14 +280,14 @@ CreateICA( */ BOOL WINAPI -DeleteDC(HDC hDC) +DeleteDC(HDC hdc) { - BOOL Ret = TRUE; + BOOL bResult = TRUE; PLDC pLDC = NULL; HANDLE hPrinter = NULL; - ULONG hType = GDI_HANDLE_GET_TYPE(hDC); + ULONG hType = GDI_HANDLE_GET_TYPE(hdc); - pLDC = GdiGetLDC(hDC); + pLDC = GdiGetLDC(hdc); if (hType != GDILoObjType_LO_DC_TYPE) { @@ -293,24 +297,27 @@ DeleteDC(HDC hDC) SetLastError(ERROR_INVALID_HANDLE); return FALSE; } - if (pLDC->Flags & LDC_INIT_DOCUMENT) AbortDoc(hDC); + if (pLDC->Flags & LDC_INIT_DOCUMENT) AbortDoc(hdc); if (pLDC->hPrinter) { - DocumentEventEx(NULL, pLDC->hPrinter, hDC, DOCUMENTEVENT_DELETEDC, 0, NULL, 0, NULL); + DocumentEventEx(NULL, pLDC->hPrinter, hdc, DOCUMENTEVENT_DELETEDC, 0, NULL, 0, NULL); hPrinter = pLDC->hPrinter; pLDC->hPrinter = NULL; } } - Ret = NtGdiDeleteObjectApp(hDC); + bResult = NtGdiDeleteObjectApp(hdc); - if (Ret && pLDC ) + if (bResult && pLDC) { DPRINT1("Delete the Local DC structure\n"); LocalFree( pLDC ); } - if (hPrinter) fpClosePrinter(hPrinter); - return Ret; + + if (hPrinter) + fpClosePrinter(hPrinter); + + return bResult; } /* @@ -370,7 +377,7 @@ DeleteObject(HGDIOBJ hObject) PTEB pTeb; PGDIBSOBJECT pgO; - if ((!GdiGetHandleUserData(hObject, dwType, (PVOID) &Brh_Attr)) || + if ((!GdiGetHandleUserData(hObject, dwType, (PVOID*)&Brh_Attr)) || (Brh_Attr == NULL)) break; pTeb = NtCurrentTeb(); @@ -397,7 +404,8 @@ DeleteObject(HGDIOBJ hObject) INT WINAPI -GetArcDirection( HDC hdc ) +GetArcDirection( + _In_ HDC hdc) { return GetDCDWord( hdc, GdiGetArcDirection, 0); } @@ -405,9 +413,11 @@ GetArcDirection( HDC hdc ) INT WINAPI -SetArcDirection( HDC hdc, INT nDirection ) +SetArcDirection( + _In_ HDC hdc, + _In_ INT nDirection) { - return GetAndSetDCDWord( hdc, GdiGetSetArcDirection, nDirection, 0, 0, 0 ); + return GetAndSetDCDWord(hdc, GdiGetSetArcDirection, nDirection, 0, 0, 0); } /* @@ -474,24 +484,25 @@ GetCurrentObject( */ int WINAPI -GetDeviceCaps(HDC hDC, - int i) +GetDeviceCaps( + _In_ HDC hdc, + _In_ int nIndex) { - PDC_ATTR Dc_Attr; + PDC_ATTR pdcattr; PLDC pLDC; PDEVCAPS pDevCaps = GdiDevCaps; // Primary display device capabilities. DPRINT("Device CAPS1\n"); - if (GDI_HANDLE_GET_TYPE(hDC) != GDI_OBJECT_TYPE_DC) + if (GDI_HANDLE_GET_TYPE(hdc) != GDI_OBJECT_TYPE_DC) { - if (GDI_HANDLE_GET_TYPE(hDC) == GDI_OBJECT_TYPE_METADC) + if (GDI_HANDLE_GET_TYPE(hdc) == GDI_OBJECT_TYPE_METADC) { - if ( i == TECHNOLOGY) return DT_METAFILE; + if (nIndex == TECHNOLOGY) return DT_METAFILE; return 0; } else { - pLDC = GdiGetLDC(hDC); + pLDC = GdiGetLDC(hdc); if ( !pLDC ) { SetLastError(ERROR_INVALID_HANDLE); @@ -499,7 +510,7 @@ GetDeviceCaps(HDC hDC, } if (!(pLDC->Flags & LDC_DEVCAPS)) { - if (!NtGdiGetDeviceCapsAll(hDC, &pLDC->DevCaps)) + if (!NtGdiGetDeviceCapsAll(hdc, &pLDC->DevCaps)) SetLastError(ERROR_INVALID_PARAMETER); pLDC->Flags |= LDC_DEVCAPS; } @@ -508,14 +519,14 @@ GetDeviceCaps(HDC hDC, } else { - if (!GdiGetHandleUserData((HGDIOBJ) hDC, GDI_OBJECT_TYPE_DC, (PVOID) &Dc_Attr)) + if (!GdiGetHandleUserData(hdc, GDI_OBJECT_TYPE_DC, (PVOID*)&pdcattr)) return 0; - if (!(Dc_Attr->ulDirty_ & DC_PRIMARY_DISPLAY) ) - return NtGdiGetDeviceCaps(hDC,i); + if (!(pdcattr->ulDirty_ & DC_PRIMARY_DISPLAY) ) + return NtGdiGetDeviceCaps(hdc, nIndex); } DPRINT("Device CAPS2\n"); - switch (i) + switch (nIndex) { case DRIVERVERSION: return pDevCaps->ulVersion; @@ -643,11 +654,10 @@ GetDeviceCaps(HDC hDC, DWORD WINAPI GetRelAbs( - HDC hdc, - DWORD dwIgnore -) + _In_ HDC hdc, + _In_ DWORD dwIgnore) { - return GetDCDWord( hdc, GdiGetRelAbs, 0); + return GetDCDWord(hdc, GdiGetRelAbs, 0); } @@ -658,10 +668,9 @@ INT WINAPI SetRelAbs( HDC hdc, - INT Mode -) + INT Mode) { - return GetAndSetDCDWord( hdc, GdiGetSetRelAbs, Mode, 0, 0, 0 ); + return GetAndSetDCDWord(hdc, GdiGetSetRelAbs, Mode, 0, 0, 0); } @@ -670,17 +679,25 @@ SetRelAbs( */ DWORD WINAPI -GetAndSetDCDWord( HDC hDC, INT u, DWORD dwIn, DWORD Unk1, DWORD Unk2, DWORD Unk3 ) +GetAndSetDCDWord( + _In_ HDC hdc, + _In_ UINT u, + _In_ DWORD dwIn, + _In_ ULONG ulMFId, + _In_ USHORT usMF16Id, + _In_ DWORD dwError) { + DWORD dwResult; BOOL Ret = TRUE; -// Handle something other than a normal dc object. - if (GDI_HANDLE_GET_TYPE(hDC) != GDI_OBJECT_TYPE_DC) + + /* Handle something other than a normal dc object. */ + if (GDI_HANDLE_GET_TYPE(hdc) != GDI_OBJECT_TYPE_DC) { - if (GDI_HANDLE_GET_TYPE(hDC) == GDI_OBJECT_TYPE_METADC) + if (GDI_HANDLE_GET_TYPE(hdc) == GDI_OBJECT_TYPE_METADC) return 0; //call MFDRV else { - PLDC pLDC = GdiGetLDC(hDC); + PLDC pLDC = GdiGetLDC(hdc); if ( !pLDC ) { SetLastError(ERROR_INVALID_HANDLE); @@ -695,12 +712,14 @@ GetAndSetDCDWord( HDC hDC, INT u, DWORD dwIn, DWORD Unk1, DWORD Unk2, DWORD Unk3 } } } - Ret = NtGdiGetAndSetDCDword( hDC, u, dwIn, (DWORD*) &u ); - if (Ret) - return u; - else + + if (!NtGdiGetAndSetDCDword(hdc, u, dwIn, &dwResult)) + { SetLastError(ERROR_INVALID_HANDLE); - return 0; + return 0; + } + + return dwResult; } @@ -709,11 +728,19 @@ GetAndSetDCDWord( HDC hDC, INT u, DWORD dwIn, DWORD Unk1, DWORD Unk2, DWORD Unk3 */ DWORD WINAPI -GetDCDWord( HDC hDC, INT u, DWORD Result ) +GetDCDWord( + _In_ HDC hdc, + _In_ UINT u, + _In_ DWORD dwError) { - BOOL Ret = NtGdiGetDCDword( hDC, u, (DWORD*) &u ); - if (!Ret) return Result; - else return u; + DWORD dwResult; + + if (!NtGdiGetDCDword(hdc, u, &dwResult)) + { + return dwError; + } + + return dwResult; } @@ -724,10 +751,9 @@ BOOL WINAPI GetAspectRatioFilterEx( HDC hdc, - LPSIZE lpAspectRatio -) + LPSIZE lpAspectRatio) { - return NtGdiGetDCPoint( hdc, GdiGetAspectRatioFilter, (PPOINTL) lpAspectRatio ); + return NtGdiGetDCPoint(hdc, GdiGetAspectRatioFilter, (PPOINTL)lpAspectRatio ); } @@ -738,8 +764,7 @@ BOOL WINAPI GetDCOrgEx( HDC hdc, - LPPOINT lpPoint -) + LPPOINT lpPoint) { return NtGdiGetDCPoint( hdc, GdiGetDCOrg, (PPOINTL)lpPoint ); } @@ -766,7 +791,10 @@ GetDCOrg( */ int WINAPI -GetObjectW(HGDIOBJ hGdiObj, int cbSize, LPVOID lpBuffer) +GetObjectW( + _In_ HGDIOBJ hGdiObj, + _In_ int cbSize, + _Out_ LPVOID lpBuffer) { DWORD dwType; INT cbResult = 0; @@ -858,7 +886,10 @@ GetObjectW(HGDIOBJ hGdiObj, int cbSize, LPVOID lpBuffer) ULONG WINAPI -GetFontObjectA(HGDIOBJ hfont, ULONG cbSize, LPVOID lpBuffer) +GetFontObjectA( + _In_ HGDIOBJ hfont, + _In_ ULONG cbSize, + _Out_ LPVOID lpBuffer) { ENUMLOGFONTEXDVW elfedvW; ENUMLOGFONTEXDVA elfedvA; @@ -904,7 +935,10 @@ GetFontObjectA(HGDIOBJ hfont, ULONG cbSize, LPVOID lpBuffer) */ int WINAPI -GetObjectA(HGDIOBJ hGdiObj, int cbSize, LPVOID lpBuffer) +GetObjectA( + _In_ HGDIOBJ hGdiObj, + _In_ int cbSize, + _Out_ LPVOID lpBuffer) { DWORD dwType = GDI_HANDLE_GET_TYPE(hGdiObj); @@ -927,13 +961,15 @@ GetObjectA(HGDIOBJ hGdiObj, int cbSize, LPVOID lpBuffer) COLORREF WINAPI GetDCBrushColor( - HDC hdc -) + _In_ HDC hdc) { - PDC_ATTR Dc_Attr; + PDC_ATTR pdcattr; - if (!GdiGetHandleUserData((HGDIOBJ) hdc, GDI_OBJECT_TYPE_DC, (PVOID) &Dc_Attr)) return CLR_INVALID; - return (COLORREF) Dc_Attr->ulBrushClr; + /* Get the DC attribute */ + if (!GdiGetHandleUserData(hdc, GDI_OBJECT_TYPE_DC, (PVOID*)&pdcattr)) + return CLR_INVALID; + + return pdcattr->ulBrushClr; } /* @@ -942,13 +978,14 @@ GetDCBrushColor( COLORREF WINAPI GetDCPenColor( - HDC hdc -) + _In_ HDC hdc) { - PDC_ATTR Dc_Attr; + PDC_ATTR pdcattr; - if (!GdiGetHandleUserData((HGDIOBJ) hdc, GDI_OBJECT_TYPE_DC, (PVOID) &Dc_Attr)) return CLR_INVALID; - return (COLORREF) Dc_Attr->ulPenClr; + if (!GdiGetHandleUserData(hdc, GDI_OBJECT_TYPE_DC, (PVOID*)&pdcattr)) + return CLR_INVALID; + + return pdcattr->ulPenClr; } /* @@ -957,26 +994,27 @@ GetDCPenColor( COLORREF WINAPI SetDCBrushColor( - HDC hdc, - COLORREF crColor -) + _In_ HDC hdc, + _In_ COLORREF crColor) { - PDC_ATTR Dc_Attr; - COLORREF OldColor = CLR_INVALID; + PDC_ATTR pdcattr; + COLORREF crOldColor; - if (!GdiGetHandleUserData((HGDIOBJ) hdc, GDI_OBJECT_TYPE_DC, (PVOID) &Dc_Attr)) return OldColor; - else + /* Get the DC attribute */ + if (!GdiGetHandleUserData(hdc, GDI_OBJECT_TYPE_DC, (PVOID*)&pdcattr)) + return CLR_INVALID; + + /* Get old color and store the new */ + crOldColor = pdcattr->ulBrushClr; + pdcattr->ulBrushClr = crColor; + + if (pdcattr->crBrushClr != crColor) { - OldColor = (COLORREF) Dc_Attr->ulBrushClr; - Dc_Attr->ulBrushClr = (ULONG) crColor; - - if ( Dc_Attr->crBrushClr != crColor ) // if same, don't force a copy. - { - Dc_Attr->ulDirty_ |= DIRTY_FILL; - Dc_Attr->crBrushClr = crColor; - } + pdcattr->ulDirty_ |= DIRTY_FILL; + pdcattr->crBrushClr = crColor; } - return OldColor; + + return crOldColor; } /* @@ -989,18 +1027,18 @@ SetDCPenColor( _In_ COLORREF crColor) { PDC_ATTR pdcattr; - COLORREF OldColor; + COLORREF crOldColor; - /* Get the dc attribute */ + /* Get the DC attribute */ pdcattr = GdiGetDcAttr(hdc); - if (!pdcattr) + if (pdcattr == NULL) { SetLastError(ERROR_INVALID_PARAMETER); return CLR_INVALID; } /* Get old color and store the new */ - OldColor = (COLORREF)pdcattr->ulPenClr; + crOldColor = pdcattr->ulPenClr; pdcattr->ulPenClr = (ULONG)crColor; if (pdcattr->crPenClr != crColor) @@ -1009,7 +1047,7 @@ SetDCPenColor( pdcattr->crPenClr = crColor; } - return OldColor; + return crOldColor; } /* @@ -1018,11 +1056,16 @@ SetDCPenColor( */ COLORREF WINAPI -GetBkColor(HDC hdc) +GetBkColor( + _In_ HDC hdc) { - PDC_ATTR Dc_Attr; - if (!GdiGetHandleUserData((HGDIOBJ) hdc, GDI_OBJECT_TYPE_DC, (PVOID) &Dc_Attr)) return 0; - return Dc_Attr->ulBackgroundClr; + PDC_ATTR pdcattr; + + /* Get the DC attribute */ + if (!GdiGetHandleUserData(hdc, GDI_OBJECT_TYPE_DC, (PVOID*)&pdcattr)) + return 0; + + return pdcattr->ulBackgroundClr; } /* @@ -1031,22 +1074,24 @@ GetBkColor(HDC hdc) COLORREF WINAPI SetBkColor( - HDC hdc, - COLORREF crColor -) + _In_ HDC hdc, + _In_ COLORREF crColor) { - PDC_ATTR Dc_Attr; - COLORREF OldColor = CLR_INVALID; + PDC_ATTR pdcattr; + COLORREF crOldColor; + + /* Get the DC attribute */ + if (!GdiGetHandleUserData(hdc, GDI_OBJECT_TYPE_DC, (PVOID*)&pdcattr)) + return CLR_INVALID; - if (!GdiGetHandleUserData((HGDIOBJ) hdc, GDI_OBJECT_TYPE_DC, (PVOID) &Dc_Attr)) return OldColor; #if 0 - if (GDI_HANDLE_GET_TYPE(hDC) != GDI_OBJECT_TYPE_DC) + if (GDI_HANDLE_GET_TYPE(hdc) != GDI_OBJECT_TYPE_DC) { - if (GDI_HANDLE_GET_TYPE(hDC) == GDI_OBJECT_TYPE_METADC) - return MFDRV_SetBkColor( hDC, crColor ); + if (GDI_HANDLE_GET_TYPE(hdc) == GDI_OBJECT_TYPE_METADC) + return MFDRV_SetBkColor(hdc, crColor ); else { - PLDC pLDC = Dc_Attr->pvLDC; + PLDC pLDC = pdcattr->pvLDC; if ( !pLDC ) { SetLastError(ERROR_INVALID_HANDLE); @@ -1054,20 +1099,23 @@ SetBkColor( } if (pLDC->iType == LDC_EMFLDC) { - return EMFDRV_SetBkColor( hDC, crColor ); + return EMFDRV_SetBkColor(hdc, crColor ); } } } #endif - OldColor = (COLORREF) Dc_Attr->ulBackgroundClr; - Dc_Attr->ulBackgroundClr = (ULONG) crColor; - if ( Dc_Attr->crBackgroundClr != crColor ) + /* Get old color and store the new */ + crOldColor = pdcattr->ulBackgroundClr; + pdcattr->ulBackgroundClr = crColor; + + if (pdcattr->crBackgroundClr != crColor) { - Dc_Attr->ulDirty_ |= (DIRTY_BACKGROUND|DIRTY_LINE|DIRTY_FILL); - Dc_Attr->crBackgroundClr = crColor; + pdcattr->ulDirty_ |= (DIRTY_BACKGROUND|DIRTY_LINE|DIRTY_FILL); + pdcattr->crBackgroundClr = crColor; } - return OldColor; + + return crOldColor; } /* @@ -1078,9 +1126,13 @@ int WINAPI GetBkMode(HDC hdc) { - PDC_ATTR Dc_Attr; - if (!GdiGetHandleUserData((HGDIOBJ) hdc, GDI_OBJECT_TYPE_DC, (PVOID) &Dc_Attr)) return 0; - return Dc_Attr->lBkMode; + PDC_ATTR pdcattr; + + /* Get the DC attribute */ + if (!GdiGetHandleUserData(hdc, GDI_OBJECT_TYPE_DC, (PVOID*)&pdcattr)) + return 0; + + return pdcattr->lBkMode; } /* @@ -1089,37 +1141,42 @@ GetBkMode(HDC hdc) */ int WINAPI -SetBkMode(HDC hdc, - int iBkMode) +SetBkMode( + _In_ HDC hdc, + _In_ int iBkMode) { - PDC_ATTR Dc_Attr; - INT OldMode = 0; + PDC_ATTR pdcattr; + INT iOldMode; - if (!GdiGetHandleUserData((HGDIOBJ) hdc, GDI_OBJECT_TYPE_DC, (PVOID) &Dc_Attr)) return OldMode; + /* Get the DC attribute */ + if (!GdiGetHandleUserData(hdc, GDI_OBJECT_TYPE_DC, (PVOID*)&pdcattr)) + return 0; #if 0 if (GDI_HANDLE_GET_TYPE(hdc) != GDI_OBJECT_TYPE_DC) { if (GDI_HANDLE_GET_TYPE(hdc) == GDI_OBJECT_TYPE_METADC) return MFDRV_SetBkMode( hdc, iBkMode ) - else + else + { + PLDC pLDC = pdcattr->pvLDC; + if ( !pLDC ) { - PLDC pLDC = Dc_Attr->pvLDC; - if ( !pLDC ) - { - SetLastError(ERROR_INVALID_HANDLE); - return FALSE; - } - if (pLDC->iType == LDC_EMFLDC) - { - return EMFDRV_SetBkMode( hdc, iBkMode ) - } - } - } + SetLastError(ERROR_INVALID_HANDLE); + return FALSE; + } + if (pLDC->iType == LDC_EMFLDC) + { + return EMFDRV_SetBkMode(hdc, iBkMode) + } + } + } #endif - OldMode = Dc_Attr->lBkMode; - Dc_Attr->jBkMode = iBkMode; // Processed - Dc_Attr->lBkMode = iBkMode; // Raw - return OldMode; + + iOldMode = pdcattr->lBkMode; + pdcattr->jBkMode = iBkMode; // Processed + pdcattr->lBkMode = iBkMode; // Raw + + return iOldMode; } /* @@ -1130,9 +1187,17 @@ int WINAPI GetPolyFillMode(HDC hdc) { - PDC_ATTR Dc_Attr; - if (!GdiGetHandleUserData((HGDIOBJ) hdc, GDI_OBJECT_TYPE_DC, (PVOID) &Dc_Attr)) return 0; - return Dc_Attr->lFillMode; + PDC_ATTR pdcattr; + + /* Get DC attribute */ + pdcattr = GdiGetDcAttr(hdc); + if (pdcattr == NULL) + { + return 0; + } + + /* Return current fill mode */ + return pdcattr->lFillMode; } /* @@ -1140,11 +1205,13 @@ GetPolyFillMode(HDC hdc) */ int WINAPI -SetPolyFillMode(HDC hdc, - int iPolyFillMode) +SetPolyFillMode( + _In_ HDC hdc, + _In_ int iPolyFillMode) { - INT fmode; - PDC_ATTR Dc_Attr; + INT iOldPolyFillMode; + PDC_ATTR pdcattr; + #if 0 if (GDI_HANDLE_GET_TYPE(hdc) != GDI_OBJECT_TYPE_DC) { @@ -1165,21 +1232,26 @@ SetPolyFillMode(HDC hdc, } } #endif - if (!GdiGetHandleUserData((HGDIOBJ) hdc, GDI_OBJECT_TYPE_DC, (PVOID) &Dc_Attr)) return 0; + + /* Get DC attribute */ + if (!GdiGetHandleUserData(hdc, GDI_OBJECT_TYPE_DC, (PVOID*)&pdcattr)) + { + return 0; + } if (NtCurrentTeb()->GdiTebBatch.HDC == hdc) { - if (Dc_Attr->ulDirty_ & DC_MODE_DIRTY) + if (pdcattr->ulDirty_ & DC_MODE_DIRTY) { - NtGdiFlush(); // Sync up Dc_Attr from Kernel space. - Dc_Attr->ulDirty_ &= ~(DC_MODE_DIRTY|DC_FONTTEXT_DIRTY); + NtGdiFlush(); // Sync up pdcattr from Kernel space. + pdcattr->ulDirty_ &= ~(DC_MODE_DIRTY|DC_FONTTEXT_DIRTY); } } - fmode = Dc_Attr->lFillMode; - Dc_Attr->lFillMode = iPolyFillMode; + iOldPolyFillMode = pdcattr->lFillMode; + pdcattr->lFillMode = iPolyFillMode; - return fmode; + return iOldPolyFillMode; } /* @@ -1190,9 +1262,16 @@ int WINAPI GetGraphicsMode(HDC hdc) { - PDC_ATTR Dc_Attr; - if (!GdiGetHandleUserData((HGDIOBJ) hdc, GDI_OBJECT_TYPE_DC, (PVOID) &Dc_Attr)) return 0; - return Dc_Attr->iGraphicsMode; + PDC_ATTR pdcattr; + + /* Get DC attribute */ + if (!GdiGetHandleUserData(hdc, GDI_OBJECT_TYPE_DC, (PVOID*)&pdcattr)) + { + return 0; + } + + /* Return current graphics mode */ + return pdcattr->iGraphicsMode; } /* @@ -1200,37 +1279,48 @@ GetGraphicsMode(HDC hdc) */ int WINAPI -SetGraphicsMode(HDC hdc, - int iMode) +SetGraphicsMode( + _In_ HDC hdc, + _In_ int iMode) { - INT oMode; - PDC_ATTR Dc_Attr; + INT iOldMode; + PDC_ATTR pdcattr; + + /* Check parameters */ if ((iMode < GM_COMPATIBLE) || (iMode > GM_ADVANCED)) { SetLastError(ERROR_INVALID_PARAMETER); return 0; } - if (!GdiGetHandleUserData((HGDIOBJ) hdc, GDI_OBJECT_TYPE_DC, (PVOID) &Dc_Attr)) return 0; - if (iMode == Dc_Attr->iGraphicsMode) return iMode; + /* Get DC attribute */ + if (!GdiGetHandleUserData(hdc, GDI_OBJECT_TYPE_DC, (PVOID*)&pdcattr)) + { + return 0; + } + + /* Check for trivial case */ + if (iMode == pdcattr->iGraphicsMode) + return iMode; if (NtCurrentTeb()->GdiTebBatch.HDC == hdc) { - if (Dc_Attr->ulDirty_ & DC_MODE_DIRTY) + if (pdcattr->ulDirty_ & DC_MODE_DIRTY) { - NtGdiFlush(); // Sync up Dc_Attr from Kernel space. - Dc_Attr->ulDirty_ &= ~(DC_MODE_DIRTY|DC_FONTTEXT_DIRTY); + NtGdiFlush(); // Sync up pdcattr from Kernel space. + pdcattr->ulDirty_ &= ~(DC_MODE_DIRTY|DC_FONTTEXT_DIRTY); } } + /* One would think that setting the graphics mode to GM_COMPATIBLE * would also reset the world transformation matrix to the unity * matrix. However, in Windows, this is not the case. This doesn't * make a lot of sense to me, but that's the way it is. */ - oMode = Dc_Attr->iGraphicsMode; - Dc_Attr->iGraphicsMode = iMode; + iOldMode = pdcattr->iGraphicsMode; + pdcattr->iGraphicsMode = iMode; - return oMode; + return iOldMode; } /* @@ -1239,9 +1329,8 @@ SetGraphicsMode(HDC hdc, HDC WINAPI ResetDCW( - HDC hdc, - CONST DEVMODEW *lpInitData -) + _In_ HDC hdc, + _In_ CONST DEVMODEW *lpInitData) { NtGdiResetDC ( hdc, (PDEVMODEW)lpInitData, NULL, NULL, NULL); return hdc; @@ -1254,9 +1343,8 @@ ResetDCW( HDC WINAPI ResetDCA( - HDC hdc, - CONST DEVMODEA *lpInitData -) + _In_ HDC hdc, + _In_ CONST DEVMODEA *lpInitData) { LPDEVMODEW InitDataW; @@ -1274,12 +1362,11 @@ ResetDCA( DWORD WINAPI GetObjectType( - HGDIOBJ h -) + HGDIOBJ h) { DWORD Ret = 0; - if(GdiIsHandleValid(h)) + if (GdiIsHandleValid(h)) { LONG Type = GDI_HANDLE_GET_TYPE(h); switch(Type) @@ -1326,6 +1413,11 @@ GetObjectType( Ret = OBJ_EXTPEN; break; + case GDILoObjType_LO_ALTDC_TYPE: + // FIXME: could be something else? + Ret = OBJ_ENHMETADC; + break; + default: DPRINT1("GetObjectType: Magic 0x%08x not implemented\n", Type); break; @@ -1344,23 +1436,27 @@ GetObjectType( HGDIOBJ WINAPI GetStockObject( - INT h -) + INT fnObject) { - HGDIOBJ Ret = NULL; - if ((h < 0) || (h >= NB_STOCK_OBJECTS)) return Ret; - Ret = stock_objects[h]; - if (!Ret) - { - HGDIOBJ Obj = NtGdiGetStockObject( h ); + HGDIOBJ hobj; - if (GdiIsHandleValid(Obj)) + if ((fnObject < 0) || (fnObject >= NB_STOCK_OBJECTS)) + return NULL; + + hobj = stock_objects[fnObject]; + if (hobj == NULL) + { + hobj = NtGdiGetStockObject(fnObject); + + if (!GdiIsHandleValid(hobj)) { - stock_objects[h] = Obj; - return Obj; - }// Returns Null anyway. + return NULL; + } + + stock_objects[fnObject] = hobj; } - return Ret; + + return hobj; } /* FIXME: include correct header */ @@ -1371,18 +1467,18 @@ HPALETTE WINAPI NtUserSelectPalette(HDC hDC, HPALETTE WINAPI SelectPalette( - HDC hDC, - HPALETTE hPal, + HDC hdc, + HPALETTE hpal, BOOL bForceBackground) { #if 0 - if (GDI_HANDLE_GET_TYPE(hDC) != GDI_OBJECT_TYPE_DC) + if (GDI_HANDLE_GET_TYPE(hdc) != GDI_OBJECT_TYPE_DC) { - if (GDI_HANDLE_GET_TYPE(hDC) == GDI_OBJECT_TYPE_METADC) - return MFDRV_SelectPalette( hDC, hPal, bForceBackground); + if (GDI_HANDLE_GET_TYPE(hdc) == GDI_OBJECT_TYPE_METADC) + return MFDRV_SelectPalette(hdc, hpal, bForceBackground); else { - PLDC pLDC = GdiGetLDC(hDC); + PLDC pLDC = GdiGetLDC(hdc); if ( !pLDC ) { SetLastError(ERROR_INVALID_HANDLE); @@ -1390,12 +1486,12 @@ SelectPalette( } if (pLDC->iType == LDC_EMFLDC) { - if return EMFDRV_SelectPalette( hDC, hPal, bForceBackground); + if return EMFDRV_SelectPalette(hdc, hpal, bForceBackground); } } } #endif - return NtUserSelectPalette(hDC, hPal, bForceBackground); + return NtUserSelectPalette(hdc, hpal, bForceBackground); } /* @@ -1406,9 +1502,13 @@ int WINAPI GetMapMode(HDC hdc) { - PDC_ATTR Dc_Attr; - if (!GdiGetHandleUserData((HGDIOBJ) hdc, GDI_OBJECT_TYPE_DC, (PVOID) &Dc_Attr)) return 0; - return Dc_Attr->iMapMode; + PDC_ATTR pdcattr; + + /* Get the DC attribute */ + if (!GdiGetHandleUserData((HGDIOBJ) hdc, GDI_OBJECT_TYPE_DC, (PVOID) &pdcattr)) + return 0; + + return pdcattr->iMapMode; } /* @@ -1422,30 +1522,33 @@ SetMapMode( { PDC_ATTR pdcattr; + /* Get the DC attribute */ pdcattr = GdiGetDcAttr(hdc); - if (!pdcattr) + if (pdcattr == NULL) { SetLastError(ERROR_INVALID_PARAMETER); return 0; } #if 0 - if (GDI_HANDLE_GET_TYPE(hDC) != GDI_OBJECT_TYPE_DC) + if (GDI_HANDLE_GET_TYPE(hdc) != GDI_OBJECT_TYPE_DC) { - if (GDI_HANDLE_GET_TYPE(hDC) == GDI_OBJECT_TYPE_METADC) + if (GDI_HANDLE_GET_TYPE(hdc) == GDI_OBJECT_TYPE_METADC) return MFDRV_SetMapMode(hdc, iMode); else { SetLastError(ERROR_INVALID_HANDLE); return 0; } + } #endif - // Force change if Isotropic is set for recompute. + /* Force change if Isotropic is set for recompute. */ if ((iMode != pdcattr->iMapMode) || (iMode == MM_ISOTROPIC)) { pdcattr->ulDirty_ &= ~SLOW_WIDTHS; return GetAndSetDCDWord( hdc, GdiGetSetMapMode, iMode, 0, 0, 0 ); } + return pdcattr->iMapMode; } @@ -1457,9 +1560,13 @@ int WINAPI GetStretchBltMode(HDC hdc) { - PDC_ATTR Dc_Attr; - if (!GdiGetHandleUserData((HGDIOBJ) hdc, GDI_OBJECT_TYPE_DC, (PVOID) &Dc_Attr)) return 0; - return Dc_Attr->lStretchBltMode; + PDC_ATTR pdcattr; + + /* Get the DC attribute */ + if (!GdiGetHandleUserData(hdc, GDI_OBJECT_TYPE_DC, (PVOID*)&pdcattr)) + return 0; + + return pdcattr->lStretchBltMode; } /* @@ -1467,10 +1574,12 @@ GetStretchBltMode(HDC hdc) */ int WINAPI -SetStretchBltMode(HDC hdc, int iStretchMode) +SetStretchBltMode( + _In_ HDC hdc, + _In_ int iStretchMode) { - INT oSMode; - PDC_ATTR Dc_Attr; + INT iOldMode; + PDC_ATTR pdcattr; #if 0 if (GDI_HANDLE_GET_TYPE(hdc) != GDI_OBJECT_TYPE_DC) { @@ -1491,17 +1600,18 @@ SetStretchBltMode(HDC hdc, int iStretchMode) } } #endif - if (!GdiGetHandleUserData((HGDIOBJ) hdc, GDI_OBJECT_TYPE_DC, (PVOID) &Dc_Attr)) return 0; + if (!GdiGetHandleUserData(hdc, GDI_OBJECT_TYPE_DC, (PVOID*)&pdcattr)) + return 0; - oSMode = Dc_Attr->lStretchBltMode; - Dc_Attr->lStretchBltMode = iStretchMode; + iOldMode = pdcattr->lStretchBltMode; + pdcattr->lStretchBltMode = iStretchMode; // Wine returns an error here. We set the default. if ((iStretchMode <= 0) || (iStretchMode > MAXSTRETCHBLTMODE)) iStretchMode = WHITEONBLACK; - Dc_Attr->jStretchBltMode = iStretchMode; + pdcattr->jStretchBltMode = iStretchMode; - return oSMode; + return iOldMode; } /* @@ -1511,9 +1621,16 @@ HFONT WINAPI GetHFONT(HDC hdc) { - PDC_ATTR Dc_Attr; - if (!GdiGetHandleUserData((HGDIOBJ) hdc, GDI_OBJECT_TYPE_DC, (PVOID) &Dc_Attr)) return NULL; - return Dc_Attr->hlfntNew; + PDC_ATTR pdcattr; + + /* Get the DC attribute */ + if (!GdiGetHandleUserData(hdc, GDI_OBJECT_TYPE_DC, (PVOID*)&pdcattr)) + { + return NULL; + } + + /* Return the current font */ + return pdcattr->hlfntNew; } @@ -1523,14 +1640,15 @@ GetHFONT(HDC hdc) */ HGDIOBJ WINAPI -SelectObject(HDC hDC, - HGDIOBJ hGdiObj) +SelectObject( + _In_ HDC hdc, + _In_ HGDIOBJ hGdiObj) { - PDC_ATTR pDc_Attr; + PDC_ATTR pdcattr; HGDIOBJ hOldObj = NULL; UINT uType; - if(!GdiGetHandleUserData(hDC, GDI_OBJECT_TYPE_DC, (PVOID)&pDc_Attr)) + if(!GdiGetHandleUserData(hdc, GDI_OBJECT_TYPE_DC, (PVOID*)&pdcattr)) { SetLastError(ERROR_INVALID_HANDLE); return NULL; @@ -1547,39 +1665,39 @@ SelectObject(HDC hDC, switch (uType) { case GDI_OBJECT_TYPE_REGION: - return (HGDIOBJ)ExtSelectClipRgn(hDC, hGdiObj, RGN_COPY); + return (HGDIOBJ)ExtSelectClipRgn(hdc, hGdiObj, RGN_COPY); case GDI_OBJECT_TYPE_BITMAP: - return NtGdiSelectBitmap(hDC, hGdiObj); + return NtGdiSelectBitmap(hdc, hGdiObj); case GDI_OBJECT_TYPE_BRUSH: - hOldObj = pDc_Attr->hbrush; - pDc_Attr->ulDirty_ |= DC_BRUSH_DIRTY; - pDc_Attr->hbrush = hGdiObj; + hOldObj = pdcattr->hbrush; + pdcattr->ulDirty_ |= DC_BRUSH_DIRTY; + pdcattr->hbrush = hGdiObj; return hOldObj; -// return NtGdiSelectBrush(hDC, hGdiObj); +// return NtGdiSelectBrush(hdc, hGdiObj); case GDI_OBJECT_TYPE_PEN: case GDI_OBJECT_TYPE_EXTPEN: - hOldObj = pDc_Attr->hpen; - pDc_Attr->ulDirty_ |= DC_PEN_DIRTY; - pDc_Attr->hpen = hGdiObj; + hOldObj = pdcattr->hpen; + pdcattr->ulDirty_ |= DC_PEN_DIRTY; + pdcattr->hpen = hGdiObj; return hOldObj; -// return NtGdiSelectPen(hDC, hGdiObj); +// return NtGdiSelectPen(hdc, hGdiObj); case GDI_OBJECT_TYPE_FONT: - hOldObj = pDc_Attr->hlfntNew; + hOldObj = pdcattr->hlfntNew; if (hOldObj == hGdiObj) return hOldObj; - pDc_Attr->ulDirty_ &= ~SLOW_WIDTHS; - pDc_Attr->ulDirty_ |= DIRTY_CHARSET; - pDc_Attr->hlfntNew = hGdiObj; + pdcattr->ulDirty_ &= ~SLOW_WIDTHS; + pdcattr->ulDirty_ |= DIRTY_CHARSET; + pdcattr->hlfntNew = hGdiObj; - if (!(pDc_Attr->ulDirty_ & DC_DIBSECTION)) + if (!(pdcattr->ulDirty_ & DC_DIBSECTION)) { PGDIBSOBJECT pgO; - pgO = GdiAllocBatchCommand(hDC, GdiBCSelObj); + pgO = GdiAllocBatchCommand(hdc, GdiBCSelObj); if (pgO) { pgO->hgdiobj = hGdiObj; @@ -1588,18 +1706,18 @@ SelectObject(HDC hDC, } // default for select object font - return NtGdiSelectFont(hDC, hGdiObj); + return NtGdiSelectFont(hdc, hGdiObj); #if 0 case GDI_OBJECT_TYPE_METADC: - return MFDRV_SelectObject( hDC, hGdiObj); + return MFDRV_SelectObject(hdc, hGdiObj); case GDI_OBJECT_TYPE_EMF: - PLDC pLDC = GdiGetLDC(hDC); - if ( !pLDC ) return NULL; - return EMFDRV_SelectObject( hDC, hGdiObj); + PLDC pLDC = GdiGetLDC(hdc); + if (!pLDC) return NULL; + return EMFDRV_SelectObject(hdc, hGdiObj); #endif case GDI_OBJECT_TYPE_COLORSPACE: - SetColorSpace(hDC, (HCOLORSPACE) hGdiObj); + SetColorSpace(hdc, (HCOLORSPACE) hGdiObj); return NULL; case GDI_OBJECT_TYPE_PALETTE: From a12507355afa212d87c1a3da5ceeabc92ab46f1b Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Mon, 27 Oct 2014 23:39:21 +0000 Subject: [PATCH 82/91] [GDI32] Forgot to commit this... svn path=/trunk/; revision=65056 --- reactos/win32ss/gdi/gdi32/include/gdi32p.h | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/reactos/win32ss/gdi/gdi32/include/gdi32p.h b/reactos/win32ss/gdi/gdi32/include/gdi32p.h index 29d6381af24..3f0c445a598 100644 --- a/reactos/win32ss/gdi/gdi32/include/gdi32p.h +++ b/reactos/win32ss/gdi/gdi32/include/gdi32p.h @@ -236,11 +236,20 @@ ConvertBitmapInfo( DWORD WINAPI -GetAndSetDCDWord( HDC, INT, DWORD, DWORD, DWORD, DWORD ); +GetAndSetDCDWord( + _In_ HDC hdc, + _In_ UINT u, + _In_ DWORD dwIn, + _In_ ULONG ulMFId, + _In_ USHORT usMF16Id, + _In_ DWORD dwError); DWORD WINAPI -GetDCDWord( HDC, INT, DWORD); +GetDCDWord( + _In_ HDC hdc, + _In_ UINT u, + _In_ DWORD dwError); HGDIOBJ WINAPI From bd446bbb0151de6360dab7781f8d9e47cd2d1f79 Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Tue, 28 Oct 2014 00:16:18 +0000 Subject: [PATCH 83/91] [GDI32] - Handle GDILoObjType_LO_ALTDC_TYPE in GdiGetDcAttr - Rewrite GdiGetLDC using GdiGetDcAttr - Implement GdiSetLDC svn path=/trunk/; revision=65058 --- reactos/win32ss/gdi/gdi32/include/gdi32p.h | 20 +++++++- reactos/win32ss/gdi/gdi32/misc/misc.c | 59 +++++++++++----------- 2 files changed, 48 insertions(+), 31 deletions(-) diff --git a/reactos/win32ss/gdi/gdi32/include/gdi32p.h b/reactos/win32ss/gdi/gdi32/include/gdi32p.h index 3f0c445a598..c453784036e 100644 --- a/reactos/win32ss/gdi/gdi32/include/gdi32p.h +++ b/reactos/win32ss/gdi/gdi32/include/gdi32p.h @@ -213,6 +213,10 @@ PLDC FASTCALL GdiGetLDC(HDC hDC); +BOOL +FASTCALL +GdiSetLDC(HDC hdc, PVOID pvLDC); + HGDIOBJ WINAPI GdiFixUpHandle(HGDIOBJ hGO); @@ -369,9 +373,23 @@ FORCEINLINE PDC_ATTR GdiGetDcAttr(HDC hdc) { + GDILOOBJTYPE eDcObjType; PDC_ATTR pdcattr; - if (!GdiGetHandleUserData((HGDIOBJ)hdc, GDI_OBJECT_TYPE_DC, (PVOID*)&pdcattr)) return NULL; + /* Check DC object type */ + eDcObjType = GDI_HANDLE_GET_TYPE(hdc); + if ((eDcObjType != GDILoObjType_LO_DC_TYPE) && + (eDcObjType != GDILoObjType_LO_ALTDC_TYPE)) + { + return NULL; + } + + /* Get the DC attribute */ + if (!GdiGetHandleUserData((HGDIOBJ)hdc, eDcObjType, (PVOID*)&pdcattr)) + { + return NULL; + } + return pdcattr; } diff --git a/reactos/win32ss/gdi/gdi32/misc/misc.c b/reactos/win32ss/gdi/gdi32/misc/misc.c index f326114f129..9d6dae9e1df 100644 --- a/reactos/win32ss/gdi/gdi32/misc/misc.c +++ b/reactos/win32ss/gdi/gdi32/misc/misc.c @@ -145,41 +145,40 @@ BOOL GdiGetHandleUserData(HGDIOBJ hGdiObj, DWORD ObjectType, PVOID *UserData) PLDC FASTCALL -GdiGetLDC(HDC hDC) +GdiGetLDC(HDC hdc) { - PDC_ATTR Dc_Attr; - PGDI_TABLE_ENTRY Entry = GdiHandleTable + GDI_HANDLE_GET_INDEX((HGDIOBJ) hDC); - HANDLE pid = (HANDLE)((ULONG_PTR)Entry->ProcessId & ~0x1); - // Don't check the mask, just the object type. - if ( Entry->ObjectType == GDIObjType_DC_TYPE && - (pid == NULL || pid == CurrentProcessId) ) - { - BOOL Result = TRUE; - if (Entry->UserData) - { - volatile CHAR *Current = (volatile CHAR*)Entry->UserData; - _SEH2_TRY - { - *Current = *Current; - } - _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) - { - Result = FALSE; - } - _SEH2_END - } - else - Result = FALSE; + PDC_ATTR pdcattr; - if (Result) - { - Dc_Attr = (PDC_ATTR)Entry->UserData; - return Dc_Attr->pvLDC; - } + /* Get the DC attribute */ + pdcattr = GdiGetDcAttr(hdc); + if (pdcattr == NULL) + { + return NULL; } - return NULL; + + /* Return the LDC pointer */ + return pdcattr->pvLDC; } +BOOL +FASTCALL +GdiSetLDC(HDC hdc, PVOID pvLDC) +{ + PDC_ATTR pdcattr; + + /* Get the DC attribute */ + pdcattr = GdiGetDcAttr(hdc); + if (pdcattr == NULL) + { + return FALSE; + } + + /* Set the LDC pointer */ + pdcattr->pvLDC = pvLDC; + return TRUE; +} + + VOID GdiSAPCallback(PLDC pldc) { DWORD Time, NewTime = GetTickCount(); From af80d3517d940e41c032f4323aae572c34cec0f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herm=C3=A8s=20B=C3=A9lusca-Ma=C3=AFto?= Date: Tue, 28 Oct 2014 00:19:48 +0000 Subject: [PATCH 84/91] [FAST486]: We should invalidate the prefetch buffer *after* having fetched the BOP byte (but before calling its handler), not before fetching the byte :) svn path=/trunk/; revision=65059 --- reactos/lib/fast486/opcodes.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/reactos/lib/fast486/opcodes.c b/reactos/lib/fast486/opcodes.c index 101361b0251..9337988fd34 100644 --- a/reactos/lib/fast486/opcodes.c +++ b/reactos/lib/fast486/opcodes.c @@ -4240,11 +4240,6 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeLdsLes) { UCHAR BopCode; -#ifndef FAST486_NO_PREFETCH - /* Invalidate the prefetch since BOP handlers can alter the memory */ - State->PrefetchValid = FALSE; -#endif - /* Fetch the BOP code */ if (!Fast486FetchByte(State, &BopCode)) { @@ -4252,6 +4247,11 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeLdsLes) return; } +#ifndef FAST486_NO_PREFETCH + /* Invalidate the prefetch since BOP handlers can alter the memory */ + State->PrefetchValid = FALSE; +#endif + /* Call the BOP handler */ State->BopCallback(State, BopCode); From 14c0c3cbce4c0b9226452d539b0fd0b8f53f9721 Mon Sep 17 00:00:00 2001 From: James Tabor Date: Tue, 28 Oct 2014 00:26:22 +0000 Subject: [PATCH 85/91] [NtUser] - Revert 64363. See CORE-7797. svn path=/trunk/; revision=65060 --- reactos/win32ss/user/ntuser/message.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/reactos/win32ss/user/ntuser/message.c b/reactos/win32ss/user/ntuser/message.c index 8d6a76cab2d..eb1e1272117 100644 --- a/reactos/win32ss/user/ntuser/message.c +++ b/reactos/win32ss/user/ntuser/message.c @@ -851,6 +851,17 @@ co_IntPeekMessage( PMSG Msg, return TRUE; } + if ((ProcessMask & QS_MOUSE) && + co_MsqPeekMouseMove( pti, + RemoveMessages, + Window, + MsgFilterMin, + MsgFilterMax, + Msg )) + { + return TRUE; + } + /* Check for hardware events. */ if ((ProcessMask & QS_INPUT) && co_MsqPeekHardwareMessage( pti, @@ -864,17 +875,6 @@ co_IntPeekMessage( PMSG Msg, return TRUE; } - if ((ProcessMask & QS_MOUSE) && - co_MsqPeekMouseMove( pti, - RemoveMessages, - Window, - MsgFilterMin, - MsgFilterMax, - Msg )) - { - return TRUE; - } - /* Check for sent messages again. */ while ( co_MsqDispatchOneSentMessage(pti) ) { From f1a3c93e0769e61af252017bba0fcb14dfdea55a Mon Sep 17 00:00:00 2001 From: Aleksandar Andrejevic Date: Tue, 28 Oct 2014 00:33:03 +0000 Subject: [PATCH 86/91] [FAST486][NTVDM] Get rid of Fast486Interrupt, since it's not used anywhere. Also we can now remove workarounds for all of the bugs that it caused. Implement the "single-instruction interrupt delay" for instructions that load the stack segment only. svn path=/trunk/; revision=65061 --- .../include/reactos/libs/fast486/fast486.h | 16 +------- reactos/lib/fast486/fast486.c | 40 +++++-------------- reactos/lib/fast486/opcodes.c | 29 ++++++++++---- reactos/subsystems/ntvdm/emulator.c | 6 --- reactos/subsystems/ntvdm/emulator.h | 1 - reactos/subsystems/ntvdm/ntvdm.c | 6 +-- 6 files changed, 38 insertions(+), 60 deletions(-) diff --git a/reactos/include/reactos/libs/fast486/fast486.h b/reactos/include/reactos/libs/fast486/fast486.h index 2a933e51a49..379ad081afa 100644 --- a/reactos/include/reactos/libs/fast486/fast486.h +++ b/reactos/include/reactos/libs/fast486/fast486.h @@ -169,14 +169,6 @@ typedef enum _FAST486_EXCEPTIONS FAST486_EXCEPTION_MC = 0x12 } FAST486_EXCEPTIONS, *PFAST486_EXCEPTIONS; -typedef enum _FAST486_INT_STATUS -{ - FAST486_INT_NONE = 0, - FAST486_INT_EXECUTE = 1, - FAST486_INT_SIGNAL = 2, - FAST486_INT_DELAYED = 3 -} FAST486_INT_STATUS, *PFAST486_INT_STATUS; - typedef VOID (NTAPI *FAST486_MEM_READ_PROC) @@ -495,8 +487,8 @@ struct _FAST486_STATE ULONG PrefixFlags; FAST486_SEG_REGS SegmentOverride; BOOLEAN Halted; - FAST486_INT_STATUS IntStatus; - UCHAR PendingIntNum; + BOOLEAN IntSignaled; + BOOLEAN DoNotInterrupt; PULONG Tlb; #ifndef FAST486_NO_PREFETCH BOOLEAN PrefetchValid; @@ -548,10 +540,6 @@ VOID NTAPI Fast486DumpState(PFAST486_STATE State); -VOID -NTAPI -Fast486Interrupt(PFAST486_STATE State, UCHAR Number); - VOID NTAPI Fast486InterruptSignal(PFAST486_STATE State); diff --git a/reactos/lib/fast486/fast486.c b/reactos/lib/fast486/fast486.c index 12a37685869..bc9748d5791 100644 --- a/reactos/lib/fast486/fast486.c +++ b/reactos/lib/fast486/fast486.c @@ -85,7 +85,12 @@ NextInst: * Check if there is an interrupt to execute, or a hardware interrupt signal * while interrupts are enabled. */ - if (State->Flags.Tf && !State->Halted) + if (State->DoNotInterrupt) + { + /* Clear the interrupt delay flag */ + State->DoNotInterrupt = FALSE; + } + else if (State->Flags.Tf && !State->Halted) { /* Perform the interrupt */ Fast486PerformInterrupt(State, 0x01); @@ -99,29 +104,16 @@ NextInst: */ State->Flags.Tf = FALSE; } - else if (State->IntStatus == FAST486_INT_EXECUTE) + else if (State->Flags.If && State->IntSignaled) { /* No longer halted */ State->Halted = FALSE; - /* Perform the interrupt */ - Fast486PerformInterrupt(State, State->PendingIntNum); + /* Acknowledge the interrupt and perform it */ + Fast486PerformInterrupt(State, State->IntAckCallback(State)); /* Clear the interrupt status */ - State->IntStatus = FAST486_INT_NONE; - } - else if (State->Flags.If && (State->IntStatus == FAST486_INT_SIGNAL)) - { - /* Acknowledge the interrupt to get the number */ - State->PendingIntNum = State->IntAckCallback(State); - - /* Set the interrupt status to execute on the next instruction */ - State->IntStatus = FAST486_INT_EXECUTE; - } - else if (State->IntStatus == FAST486_INT_DELAYED) - { - /* Restore the old state */ - State->IntStatus = FAST486_INT_EXECUTE; + State->IntSignaled = FALSE; } } while ((Command == FAST486_CONTINUE) || @@ -284,21 +276,11 @@ Fast486Reset(PFAST486_STATE State) State->Tlb = Tlb; } -VOID -NTAPI -Fast486Interrupt(PFAST486_STATE State, UCHAR Number) -{ - /* Set the interrupt status and the number */ - State->IntStatus = FAST486_INT_EXECUTE; - State->PendingIntNum = Number; -} - VOID NTAPI Fast486InterruptSignal(PFAST486_STATE State) { - /* Set the interrupt status */ - State->IntStatus = FAST486_INT_SIGNAL; + State->IntSignaled = TRUE; } VOID diff --git a/reactos/lib/fast486/opcodes.c b/reactos/lib/fast486/opcodes.c index 9337988fd34..29c10d85246 100644 --- a/reactos/lib/fast486/opcodes.c +++ b/reactos/lib/fast486/opcodes.c @@ -2635,7 +2635,11 @@ FAST486_OPCODE_HANDLER(Fast486OpcodePopSs) } /* Call the internal API */ - Fast486LoadSegment(State, FAST486_REG_SS, LOWORD(NewSelector)); + if (Fast486LoadSegment(State, FAST486_REG_SS, LOWORD(NewSelector))) + { + /* Inhibit all interrupts until the next instruction */ + State->DoNotInterrupt = TRUE; + } } FAST486_OPCODE_HANDLER(Fast486OpcodeSbbByteModrm) @@ -3953,7 +3957,11 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeMovLoadSeg) return; } - Fast486LoadSegment(State, ModRegRm.Register, LOWORD(Selector)); + if (!Fast486LoadSegment(State, ModRegRm.Register, LOWORD(Selector))) + { + /* Exception occurred */ + return; + } } else { @@ -3965,7 +3973,17 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeMovLoadSeg) return; } - Fast486LoadSegment(State, ModRegRm.Register, Selector); + if (Fast486LoadSegment(State, ModRegRm.Register, Selector)) + { + /* Exception occurred */ + return; + } + } + + if ((INT)ModRegRm.Register == FAST486_REG_SS) + { + /* Inhibit all interrupts until the next instruction */ + State->DoNotInterrupt = TRUE; } } @@ -4261,10 +4279,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeLdsLes) * changes the CS:IP, the interrupt handler won't execute and the * stack pointer will never be restored. */ - if (State->IntStatus == FAST486_INT_EXECUTE) - { - State->IntStatus = FAST486_INT_DELAYED; - } + State->DoNotInterrupt = TRUE; return; } diff --git a/reactos/subsystems/ntvdm/emulator.c b/reactos/subsystems/ntvdm/emulator.c index b8a43b6aeae..d2e95e27e15 100644 --- a/reactos/subsystems/ntvdm/emulator.c +++ b/reactos/subsystems/ntvdm/emulator.c @@ -250,12 +250,6 @@ VOID EmulatorTerminate(VOID) VdmRunning = FALSE; } -VOID EmulatorInterrupt(BYTE Number) -{ - /* Call the Fast486 API */ - Fast486Interrupt(&EmulatorContext, Number); -} - VOID EmulatorInterruptSignal(VOID) { /* Call the Fast486 API */ diff --git a/reactos/subsystems/ntvdm/emulator.h b/reactos/subsystems/ntvdm/emulator.h index 4b4928e3313..3c209ccedf2 100644 --- a/reactos/subsystems/ntvdm/emulator.h +++ b/reactos/subsystems/ntvdm/emulator.h @@ -96,7 +96,6 @@ VOID EmulatorException(BYTE ExceptionNumber, LPWORD Stack); VOID EmulatorTerminate(VOID); -VOID EmulatorInterrupt(BYTE Number); VOID EmulatorInterruptSignal(VOID); VOID EmulatorSetA20(BOOLEAN Enabled); diff --git a/reactos/subsystems/ntvdm/ntvdm.c b/reactos/subsystems/ntvdm/ntvdm.c index ab75aff6530..8a194e16ce3 100644 --- a/reactos/subsystems/ntvdm/ntvdm.c +++ b/reactos/subsystems/ntvdm/ntvdm.c @@ -204,9 +204,9 @@ ConsoleCtrlHandler(DWORD ControlType) case CTRL_C_EVENT: case CTRL_BREAK_EVENT: { - /* Call INT 23h */ - DPRINT1("Ctrl-C/Break: Call INT 23h\n"); - EmulatorInterrupt(0x23); + /* HACK: Stop the VDM */ + EmulatorTerminate(); + break; } case CTRL_LAST_CLOSE_EVENT: From 891d638347c88fcb0ea94004c3ceac42568cf295 Mon Sep 17 00:00:00 2001 From: Aleksandar Andrejevic Date: Tue, 28 Oct 2014 00:53:02 +0000 Subject: [PATCH 87/91] [FAST486] Fix a typo in r65061. svn path=/trunk/; revision=65062 --- reactos/lib/fast486/opcodes.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reactos/lib/fast486/opcodes.c b/reactos/lib/fast486/opcodes.c index 29c10d85246..1a8e247acee 100644 --- a/reactos/lib/fast486/opcodes.c +++ b/reactos/lib/fast486/opcodes.c @@ -3973,7 +3973,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeMovLoadSeg) return; } - if (Fast486LoadSegment(State, ModRegRm.Register, Selector)) + if (!Fast486LoadSegment(State, ModRegRm.Register, Selector)) { /* Exception occurred */ return; From c8e18b66a9f58f86b825727e25a1b8e8fbc8face Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Tue, 28 Oct 2014 00:55:22 +0000 Subject: [PATCH 88/91] [GDI32] - Use GdiGetDcAttr instead of GdiGetHandleUserData where appropriate - Add a few missing SetLastError() - Fix return failure return value of GetBkColor() - Improve order of operations in SelectObject (needs more fixing) svn path=/trunk/; revision=65063 --- reactos/win32ss/gdi/gdi32/objects/dc.c | 118 +++++++++++++++++++------ 1 file changed, 91 insertions(+), 27 deletions(-) diff --git a/reactos/win32ss/gdi/gdi32/objects/dc.c b/reactos/win32ss/gdi/gdi32/objects/dc.c index c6c7608dfce..f928928669f 100644 --- a/reactos/win32ss/gdi/gdi32/objects/dc.c +++ b/reactos/win32ss/gdi/gdi32/objects/dc.c @@ -438,9 +438,12 @@ GetCurrentObject( (uObjectType == OBJ_BRUSH) || (uObjectType == OBJ_COLORSPACE)) { - /* Get the dc attribute */ + /* Get the DC attribute */ pdcattr = GdiGetDcAttr(hdc); - if (!pdcattr) return NULL; + if (pdcattr == NULL) + { + return NULL; + } } /* Check what object was requested */ @@ -519,8 +522,14 @@ GetDeviceCaps( } else { - if (!GdiGetHandleUserData(hdc, GDI_OBJECT_TYPE_DC, (PVOID*)&pdcattr)) + /* Get the DC attribute */ + pdcattr = GdiGetDcAttr(hdc); + if (pdcattr == NULL) + { + SetLastError(ERROR_INVALID_PARAMETER); return 0; + } + if (!(pdcattr->ulDirty_ & DC_PRIMARY_DISPLAY) ) return NtGdiGetDeviceCaps(hdc, nIndex); } @@ -966,8 +975,12 @@ GetDCBrushColor( PDC_ATTR pdcattr; /* Get the DC attribute */ - if (!GdiGetHandleUserData(hdc, GDI_OBJECT_TYPE_DC, (PVOID*)&pdcattr)) + pdcattr = GdiGetDcAttr(hdc); + if (pdcattr == NULL) + { + SetLastError(ERROR_INVALID_PARAMETER); return CLR_INVALID; + } return pdcattr->ulBrushClr; } @@ -982,8 +995,13 @@ GetDCPenColor( { PDC_ATTR pdcattr; - if (!GdiGetHandleUserData(hdc, GDI_OBJECT_TYPE_DC, (PVOID*)&pdcattr)) + /* Get the DC attribute */ + pdcattr = GdiGetDcAttr(hdc); + if (pdcattr == NULL) + { + SetLastError(ERROR_INVALID_PARAMETER); return CLR_INVALID; + } return pdcattr->ulPenClr; } @@ -1001,8 +1019,12 @@ SetDCBrushColor( COLORREF crOldColor; /* Get the DC attribute */ - if (!GdiGetHandleUserData(hdc, GDI_OBJECT_TYPE_DC, (PVOID*)&pdcattr)) + pdcattr = GdiGetDcAttr(hdc); + if (pdcattr == NULL) + { + SetLastError(ERROR_INVALID_PARAMETER); return CLR_INVALID; + } /* Get old color and store the new */ crOldColor = pdcattr->ulBrushClr; @@ -1062,8 +1084,12 @@ GetBkColor( PDC_ATTR pdcattr; /* Get the DC attribute */ - if (!GdiGetHandleUserData(hdc, GDI_OBJECT_TYPE_DC, (PVOID*)&pdcattr)) - return 0; + pdcattr = GdiGetDcAttr(hdc); + if (pdcattr == NULL) + { + /* Don't set LastError here! */ + return CLR_INVALID; + } return pdcattr->ulBackgroundClr; } @@ -1081,8 +1107,12 @@ SetBkColor( COLORREF crOldColor; /* Get the DC attribute */ - if (!GdiGetHandleUserData(hdc, GDI_OBJECT_TYPE_DC, (PVOID*)&pdcattr)) + pdcattr = GdiGetDcAttr(hdc); + if (pdcattr == NULL) + { + SetLastError(ERROR_INVALID_PARAMETER); return CLR_INVALID; + } #if 0 if (GDI_HANDLE_GET_TYPE(hdc) != GDI_OBJECT_TYPE_DC) @@ -1129,8 +1159,12 @@ GetBkMode(HDC hdc) PDC_ATTR pdcattr; /* Get the DC attribute */ - if (!GdiGetHandleUserData(hdc, GDI_OBJECT_TYPE_DC, (PVOID*)&pdcattr)) + pdcattr = GdiGetDcAttr(hdc); + if (pdcattr == NULL) + { + /* Don't set LastError here! */ return 0; + } return pdcattr->lBkMode; } @@ -1149,8 +1183,13 @@ SetBkMode( INT iOldMode; /* Get the DC attribute */ - if (!GdiGetHandleUserData(hdc, GDI_OBJECT_TYPE_DC, (PVOID*)&pdcattr)) + pdcattr = GdiGetDcAttr(hdc); + if (pdcattr == NULL) + { + SetLastError(ERROR_INVALID_PARAMETER); return 0; + } + #if 0 if (GDI_HANDLE_GET_TYPE(hdc) != GDI_OBJECT_TYPE_DC) { @@ -1193,6 +1232,7 @@ GetPolyFillMode(HDC hdc) pdcattr = GdiGetDcAttr(hdc); if (pdcattr == NULL) { + /* Don't set LastError here! */ return 0; } @@ -1233,9 +1273,11 @@ SetPolyFillMode( } #endif - /* Get DC attribute */ - if (!GdiGetHandleUserData(hdc, GDI_OBJECT_TYPE_DC, (PVOID*)&pdcattr)) + /* Get the DC attribute */ + pdcattr = GdiGetDcAttr(hdc); + if (pdcattr == NULL) { + SetLastError(ERROR_INVALID_PARAMETER); return 0; } @@ -1264,9 +1306,11 @@ GetGraphicsMode(HDC hdc) { PDC_ATTR pdcattr; - /* Get DC attribute */ - if (!GdiGetHandleUserData(hdc, GDI_OBJECT_TYPE_DC, (PVOID*)&pdcattr)) + /* Get the DC attribute */ + pdcattr = GdiGetDcAttr(hdc); + if (pdcattr == NULL) { + /* Don't set LastError here! */ return 0; } @@ -1293,9 +1337,11 @@ SetGraphicsMode( return 0; } - /* Get DC attribute */ - if (!GdiGetHandleUserData(hdc, GDI_OBJECT_TYPE_DC, (PVOID*)&pdcattr)) + /* Get the DC attribute */ + pdcattr = GdiGetDcAttr(hdc); + if (pdcattr == NULL) { + SetLastError(ERROR_INVALID_PARAMETER); return 0; } @@ -1505,8 +1551,12 @@ GetMapMode(HDC hdc) PDC_ATTR pdcattr; /* Get the DC attribute */ - if (!GdiGetHandleUserData((HGDIOBJ) hdc, GDI_OBJECT_TYPE_DC, (PVOID) &pdcattr)) + pdcattr = GdiGetDcAttr(hdc); + if (pdcattr == NULL) + { + SetLastError(ERROR_INVALID_PARAMETER); return 0; + } return pdcattr->iMapMode; } @@ -1563,8 +1613,12 @@ GetStretchBltMode(HDC hdc) PDC_ATTR pdcattr; /* Get the DC attribute */ - if (!GdiGetHandleUserData(hdc, GDI_OBJECT_TYPE_DC, (PVOID*)&pdcattr)) + pdcattr = GdiGetDcAttr(hdc); + if (pdcattr == NULL) + { + /* Don't set LastError here! */ return 0; + } return pdcattr->lStretchBltMode; } @@ -1600,8 +1654,13 @@ SetStretchBltMode( } } #endif - if (!GdiGetHandleUserData(hdc, GDI_OBJECT_TYPE_DC, (PVOID*)&pdcattr)) + /* Get the DC attribute */ + pdcattr = GdiGetDcAttr(hdc); + if (pdcattr == NULL) + { + SetLastError(ERROR_INVALID_PARAMETER); return 0; + } iOldMode = pdcattr->lStretchBltMode; pdcattr->lStretchBltMode = iStretchMode; @@ -1624,8 +1683,10 @@ GetHFONT(HDC hdc) PDC_ATTR pdcattr; /* Get the DC attribute */ - if (!GdiGetHandleUserData(hdc, GDI_OBJECT_TYPE_DC, (PVOID*)&pdcattr)) + pdcattr = GdiGetDcAttr(hdc); + if (pdcattr == NULL) { + /* Don't set LastError here! */ return NULL; } @@ -1648,18 +1709,21 @@ SelectObject( HGDIOBJ hOldObj = NULL; UINT uType; - if(!GdiGetHandleUserData(hdc, GDI_OBJECT_TYPE_DC, (PVOID*)&pdcattr)) - { - SetLastError(ERROR_INVALID_HANDLE); - return NULL; - } - + /* Fix up 16 bit handles */ hGdiObj = GdiFixUpHandle(hGdiObj); if (!GdiIsHandleValid(hGdiObj)) { return NULL; } + /* Get the DC attribute */ + pdcattr = GdiGetDcAttr(hdc); + if (pdcattr == NULL) + { + SetLastError(ERROR_INVALID_PARAMETER); + return NULL; + } + uType = GDI_HANDLE_GET_TYPE(hGdiObj); switch (uType) From 27b8f91dbd78b7928ecb57f7d6f3ea2368fece82 Mon Sep 17 00:00:00 2001 From: Christoph von Wittich Date: Tue, 28 Oct 2014 08:15:49 +0000 Subject: [PATCH 89/91] [DRIVERS] don't use uninitialized variables svn path=/trunk/; revision=65066 --- reactos/drivers/bus/acpi/main.c | 2 +- reactos/drivers/bus/pcix/fdo.c | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/reactos/drivers/bus/acpi/main.c b/reactos/drivers/bus/acpi/main.c index afc9a1f2e4f..32b74c5d496 100644 --- a/reactos/drivers/bus/acpi/main.c +++ b/reactos/drivers/bus/acpi/main.c @@ -450,7 +450,7 @@ GetProcessorInformation(VOID) LPWSTR ProcessorVendorIdentifier = NULL; LPWSTR HardwareIdsBuffer = NULL; HANDLE ProcessorHandle = NULL; - ULONG Length, Level1Length = 0, Level2Length = 0, Level3Length = 0; + ULONG Length = 0, Level1Length = 0, Level2Length = 0, Level3Length = 0; SIZE_T HardwareIdsLength = 0; SIZE_T VendorIdentifierLength; ULONG i; diff --git a/reactos/drivers/bus/pcix/fdo.c b/reactos/drivers/bus/pcix/fdo.c index 77698b288ea..6d6e84e26fd 100644 --- a/reactos/drivers/bus/pcix/fdo.c +++ b/reactos/drivers/bus/pcix/fdo.c @@ -478,6 +478,8 @@ PciAddDevice(IN PDRIVER_OBJECT DriverObject, AttachedTo = NULL; FdoExtension = NULL; PdoExtension = NULL; + DeviceObject = NULL; + do { /* Check if there's already a device extension for this bus */ From 1bc1ae75f3a5321d1f6450e9d254be8a98dbb0e7 Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Tue, 28 Oct 2014 09:06:33 +0000 Subject: [PATCH 90/91] [GDI32] Implement separate functions for all SelectObject cases. svn path=/trunk/; revision=65067 --- reactos/win32ss/gdi/gdi32/objects/dc.c | 192 ++++++++++++++++--------- 1 file changed, 127 insertions(+), 65 deletions(-) diff --git a/reactos/win32ss/gdi/gdi32/objects/dc.c b/reactos/win32ss/gdi/gdi32/objects/dc.c index f928928669f..07eac4fb885 100644 --- a/reactos/win32ss/gdi/gdi32/objects/dc.c +++ b/reactos/win32ss/gdi/gdi32/objects/dc.c @@ -1695,26 +1695,23 @@ GetHFONT(HDC hdc) } -/* - * @implemented - * - */ -HGDIOBJ +HBITMAP WINAPI -SelectObject( +GdiSelectBitmap( _In_ HDC hdc, - _In_ HGDIOBJ hGdiObj) + _In_ HBITMAP hbmp) +{ + return NtGdiSelectBitmap(hdc, hbmp); +} + +HBRUSH +WINAPI +GdiSelectBrush( + _In_ HDC hdc, + _In_ HBRUSH hbr) { PDC_ATTR pdcattr; - HGDIOBJ hOldObj = NULL; - UINT uType; - - /* Fix up 16 bit handles */ - hGdiObj = GdiFixUpHandle(hGdiObj); - if (!GdiIsHandleValid(hGdiObj)) - { - return NULL; - } + HBRUSH hbrOld; /* Get the DC attribute */ pdcattr = GdiGetDcAttr(hdc); @@ -1724,68 +1721,133 @@ SelectObject( return NULL; } - uType = GDI_HANDLE_GET_TYPE(hGdiObj); + /* Get the current brush. If it matches the new brush, we're done */ + hbrOld = pdcattr->hbrush; + if (hbrOld == hbr) + return hbrOld; - switch (uType) + /* Set the new brush and update dirty flags */ + pdcattr->hbrush = hbr; + pdcattr->ulDirty_ |= DC_BRUSH_DIRTY; + return hbrOld; +} + +HPEN +WINAPI +GdiSelectPen( + _In_ HDC hdc, + _In_ HPEN hpen) +{ + PDC_ATTR pdcattr; + HPEN hpenOld; + + /* Get the DC attribute */ + pdcattr = GdiGetDcAttr(hdc); + if (pdcattr == NULL) { - case GDI_OBJECT_TYPE_REGION: - return (HGDIOBJ)ExtSelectClipRgn(hdc, hGdiObj, RGN_COPY); + SetLastError(ERROR_INVALID_PARAMETER); + return NULL; + } - case GDI_OBJECT_TYPE_BITMAP: - return NtGdiSelectBitmap(hdc, hGdiObj); + /* Get the current pen. If it matches the new pen, we're done */ + hpenOld = pdcattr->hpen; + if (hpenOld == hpen) + return hpenOld; - case GDI_OBJECT_TYPE_BRUSH: - hOldObj = pdcattr->hbrush; - pdcattr->ulDirty_ |= DC_BRUSH_DIRTY; - pdcattr->hbrush = hGdiObj; - return hOldObj; -// return NtGdiSelectBrush(hdc, hGdiObj); + /* Set the new pen and update dirty flags */ + pdcattr->ulDirty_ |= DC_PEN_DIRTY; + pdcattr->hpen = hpen; + return hpenOld; +} - case GDI_OBJECT_TYPE_PEN: - case GDI_OBJECT_TYPE_EXTPEN: - hOldObj = pdcattr->hpen; - pdcattr->ulDirty_ |= DC_PEN_DIRTY; - pdcattr->hpen = hGdiObj; - return hOldObj; -// return NtGdiSelectPen(hdc, hGdiObj); +HFONT +WINAPI +GdiSelectFont( + _In_ HDC hdc, + _In_ HFONT hfont) +{ + PDC_ATTR pdcattr; + HFONT hfontOld; - case GDI_OBJECT_TYPE_FONT: - hOldObj = pdcattr->hlfntNew; - if (hOldObj == hGdiObj) return hOldObj; + /* Get the DC attribute */ + pdcattr = GdiGetDcAttr(hdc); + if (pdcattr == NULL) + { + SetLastError(ERROR_INVALID_PARAMETER); + return NULL; + } - pdcattr->ulDirty_ &= ~SLOW_WIDTHS; - pdcattr->ulDirty_ |= DIRTY_CHARSET; - pdcattr->hlfntNew = hGdiObj; + /* Get the current font. If it matches the new font, we're done */ + hfontOld = pdcattr->hlfntNew; + if (hfontOld == hfont) + return hfontOld; - if (!(pdcattr->ulDirty_ & DC_DIBSECTION)) - { - PGDIBSOBJECT pgO; + /* Set the new font and update dirty flags */ + pdcattr->hlfntNew = hfont; + pdcattr->ulDirty_ &= ~SLOW_WIDTHS; + pdcattr->ulDirty_ |= DIRTY_CHARSET; - pgO = GdiAllocBatchCommand(hdc, GdiBCSelObj); - if (pgO) - { - pgO->hgdiobj = hGdiObj; - return hOldObj; - } - } + /* If the DC does not have a DIB section selected, try a batch command */ + if (!(pdcattr->ulDirty_ & DC_DIBSECTION)) + { + PGDIBSOBJECT pgO; - // default for select object font - return NtGdiSelectFont(hdc, hGdiObj); + pgO = GdiAllocBatchCommand(hdc, GdiBCSelObj); + if (pgO) + { + pgO->hgdiobj = hfont; + return hfontOld; + } + } -#if 0 - case GDI_OBJECT_TYPE_METADC: - return MFDRV_SelectObject(hdc, hGdiObj); - case GDI_OBJECT_TYPE_EMF: - PLDC pLDC = GdiGetLDC(hdc); - if (!pLDC) return NULL; - return EMFDRV_SelectObject(hdc, hGdiObj); -#endif - case GDI_OBJECT_TYPE_COLORSPACE: - SetColorSpace(hdc, (HCOLORSPACE) hGdiObj); - return NULL; + /* We could not use the batch command, call win32k */ + return NtGdiSelectFont(hdc, hfont); +} - case GDI_OBJECT_TYPE_PALETTE: + +/* + * @implemented + * + */ +HGDIOBJ +WINAPI +SelectObject( + _In_ HDC hdc, + _In_ HGDIOBJ hobj) +{ + /* Fix up 16 bit handles */ + hobj = GdiFixUpHandle(hobj); + if (!GdiIsHandleValid(hobj)) + { + return NULL; + } + + /* Call the appropriate select function */ + switch (GDI_HANDLE_GET_TYPE(hobj)) + { + case GDILoObjType_LO_REGION_TYPE: + return (HGDIOBJ)ExtSelectClipRgn(hdc, hobj, RGN_COPY); + + case GDILoObjType_LO_BITMAP_TYPE: + case GDILoObjType_LO_DIBSECTION_TYPE: + return GdiSelectBitmap(hdc, hobj); + + case GDILoObjType_LO_BRUSH_TYPE: + return GdiSelectBrush(hdc, hobj); + + case GDILoObjType_LO_PEN_TYPE: + case GDILoObjType_LO_EXTPEN_TYPE: + return GdiSelectPen(hdc, hobj); + + case GDILoObjType_LO_FONT_TYPE: + return GdiSelectFont(hdc, hobj); + + case GDILoObjType_LO_ICMLCS_TYPE: + return SetColorSpace(hdc, hobj); + + case GDILoObjType_LO_PALETTE_TYPE: SetLastError(ERROR_INVALID_FUNCTION); + default: return NULL; } From d6fa9e709437c211b321f78612da1040544d63f5 Mon Sep 17 00:00:00 2001 From: Pierre Schweitzer Date: Tue, 28 Oct 2014 10:26:47 +0000 Subject: [PATCH 91/91] [NTFS] ReleaseAttributeContext() is to be used out of mft.c I believe that at some point, we're leaking memory... svn path=/trunk/; revision=65068 --- reactos/drivers/filesystems/ntfs/ntfs.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/reactos/drivers/filesystems/ntfs/ntfs.h b/reactos/drivers/filesystems/ntfs/ntfs.h index d53bdc54e88..504473b58c3 100644 --- a/reactos/drivers/filesystems/ntfs/ntfs.h +++ b/reactos/drivers/filesystems/ntfs/ntfs.h @@ -600,6 +600,9 @@ NtfsFsdFileSystemControl(PDEVICE_OBJECT DeviceObject, /* mft.c */ +VOID +ReleaseAttributeContext(PNTFS_ATTR_CONTEXT Context); + ULONG ReadAttribute(PDEVICE_EXTENSION Vcb, PNTFS_ATTR_CONTEXT Context,