Skip to content

Commit

Permalink
- Adding Win10 function to user32_wrapper;
Browse files Browse the repository at this point in the history
- Fixing Windows backup by change return on hooked function on advapi32_wrapper;
- Adding RtlDecompressBufferEx to next;
- Fixing high cpu usage on firefox introduced on rc4;
- Fixing logic of IShellLink usage case be explorer or msiexc (shell32 extension - shellex;
  • Loading branch information
skulltrail committed Nov 5, 2024
1 parent 0ef3ba6 commit e921bdf
Show file tree
Hide file tree
Showing 18 changed files with 388 additions and 222 deletions.
2 changes: 1 addition & 1 deletion dll/ntdll/def/ntdll.spec
Original file line number Diff line number Diff line change
Expand Up @@ -1295,7 +1295,7 @@
@ cdecl -arch=i386 _aulldvrm()
@ cdecl -arch=i386 -ret64 _aullrem(double double)
@ cdecl -arch=i386 _aullshr()
@ extern -arch=i386 _chkstk
@ cdecl -arch=i386 _chkstk()
@ cdecl -arch=i386,x86_64,arm _fltused()
@ cdecl -arch=i386 -ret64 _ftol()
@ cdecl _i64toa(double ptr long)
Expand Down
5 changes: 4 additions & 1 deletion dll/win32/ws2_32/ws2_32.spec
Original file line number Diff line number Diff line change
Expand Up @@ -131,4 +131,7 @@
@ stdcall -arch=x86_64 WSCUnInstallNameSpace32(ptr)
@ stdcall -arch=x86_64 WSCWriteNameSpaceOrder32(ptr long)
@ stdcall -arch=x86_64 WSCWriteProviderOrder32(ptr long)
@ stdcall -arch=x86_64 WSCUpdateProvider32(ptr wstr ptr long ptr)
@ stdcall -arch=x86_64 WSCUpdateProvider32(ptr wstr ptr long ptr)

#Vista stubs
@ stdcall -stub inet_ntop(long ptr str long)
50 changes: 49 additions & 1 deletion wrappers/base/user32_wrapper/hooks.c
Original file line number Diff line number Diff line change
Expand Up @@ -126,4 +126,52 @@ SystemParametersInfoAInternal(
return SystemParametersInfoA(uiAction, uiParam, pvParam, fWinIni);
}
return SystemParametersInfoA(uiAction, uiParam, pvParam, fWinIni);
}
}

/*
* GetUserObjectSecurity
*
* Retrieves security information for user object specified
* with handle 'hObject'. Descriptor returned in self-relative
* format.
*
* Arguments:
* 1) hObject - handle to an object to retrieve information for
* 2) pSecurityInfo - type of information to retrieve
* 3) pSecurityDescriptor - buffer which receives descriptor
* 4) dwLength - size, in bytes, of buffer 'pSecurityDescriptor'
* 5) pdwLengthNeeded - reseives actual size of descriptor
*
* Return Vaules:
* TRUE on success
* FALSE on failure, call GetLastError() for more information
*/
/*
* @implemented
*/
BOOL
WINAPI
GetUserObjectSecurityInternal(
IN HANDLE hObject,
IN PSECURITY_INFORMATION pSecurityInfo,
OUT PSECURITY_DESCRIPTOR pSecurityDescriptor,
IN DWORD dwLength,
OUT PDWORD pdwLengthNeeded
)
{
NTSTATUS Status;

Status = NtQuerySecurityObject(hObject,
*pSecurityInfo,
pSecurityDescriptor,
dwLength,
pdwLengthNeeded);
if (!NT_SUCCESS(Status))
{
DbgPrint("GetUserObjectSecurity::NtQuerySecurityObject returned Status: 0x%08lx\n", Status);
UserSetLastNTError(Status);
return FALSE;
}

return TRUE;
}
3 changes: 2 additions & 1 deletion wrappers/base/user32_wrapper/user32_wrapper.spec
Original file line number Diff line number Diff line change
Expand Up @@ -752,7 +752,7 @@
@ stdcall GetAutoRotationState(ptr)

#Hooks
@ stdcall GetUserObjectSecurity (long ptr ptr long ptr) GetUserObjectSecurityInternal
@ stdcall GetUserObjectSecurity (long ptr ptr long ptr) #GetUserObjectSecurityInternal
@ stdcall SystemParametersInfoA(long long ptr long) SystemParametersInfoAInternal
@ stdcall SystemParametersInfoW(long long ptr long) SystemParametersInfoWInternal

Expand Down Expand Up @@ -912,6 +912,7 @@
@ stdcall AreDpiAwarenessContextsEqual(long long)
@ stdcall EnableNonClientDpiScaling(long)
@ stdcall IsValidDpiAwarenessContext(long)
@ stdcall IsWindowArranged(long)
@ stdcall GetSystemMetricsForDpi(long long)
@ stdcall GetDpiForSystem()
@ stdcall GetDpiForWindow(long)
Expand Down
6 changes: 6 additions & 0 deletions wrappers/base/user32_wrapper/window.c
Original file line number Diff line number Diff line change
Expand Up @@ -333,4 +333,10 @@ LONG_PTR WINAPI SetWindowLongPtrW_Internal(HWND hWnd,int nIndex,LONG_PTR dwNewLo
Result ^= 0x8000000000000000;
}
return Result;
}

// Even though this API claims it's from "1903+" it exists on 10.0.10240.
// Fixes Chromium 132 "Crash On Move Window"
BOOL WINAPI IsWindowArranged(HWND hwnd) {
return FALSE; // No such thing as "Aero Snap" on XP.
}
4 changes: 2 additions & 2 deletions wrappers/extensions/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
add_subdirectory(advapiex)
add_subdirectory(bcryptext)
add_subdirectory(browseex)
#add_subdirectory(bcryptext)
#add_subdirectory(browseex)
add_subdirectory(cfgmgrex)
add_subdirectory(comdlgex)
add_subdirectory(cryptex)
Expand Down
2 changes: 1 addition & 1 deletion wrappers/extensions/advapiex/hooks.c
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ GetTokenInformationInternal (
if(TokenInformationClass == TokenElevationType ){
TokenInformation = (PVOID)2;
TokenInformationLength = sizeof(ULONG);
return STATUS_SUCCESS;
return TRUE;
}

if(TokenInformationClass == TokenIntegrityLevel ||
Expand Down
File renamed without changes.
110 changes: 55 additions & 55 deletions wrappers/extensions/kernelex/locale.c
Original file line number Diff line number Diff line change
Expand Up @@ -3284,66 +3284,66 @@ FindNLSString(
0);
}

// /******************************************************************************
// * FindNLSStringEx (KERNEL32.@)
// */
/******************************************************************************
* FindNLSStringEx (KERNEL32.@)
*/

// INT
// WINAPI
// FindNLSStringEx(
// const WCHAR *localename,
// DWORD flags,
// const WCHAR *src,
// INT src_size,
// const WCHAR *value,
// INT value_size,
// INT *found,
// NLSVERSIONINFO *version_info,
// void *reserved,
// LPARAM sort_handle
// )
// {
INT
WINAPI
FindNLSStringEx(
const WCHAR *localename,
DWORD flags,
const WCHAR *src,
INT src_size,
const WCHAR *value,
INT value_size,
INT *found,
NLSVERSIONINFO *version_info,
void *reserved,
LPARAM sort_handle
)
{

// /* FIXME: this function should normalize strings before calling CompareStringEx() */
// DWORD mask = flags;
// int offset, inc, count;
/* FIXME: this function should normalize strings before calling CompareStringEx() */
DWORD mask = flags;
int offset, inc, count;

// TRACE("%s %x %s %d %s %d %p %p %p %ld\n", wine_dbgstr_w(localename), flags,
// wine_dbgstr_w(src), src_size, wine_dbgstr_w(value), value_size, found,
// version_info, reserved, sort_handle);
TRACE("%s %x %s %d %s %d %p %p %p %ld\n", wine_dbgstr_w(localename), flags,
wine_dbgstr_w(src), src_size, wine_dbgstr_w(value), value_size, found,
version_info, reserved, sort_handle);

// if (version_info != NULL || reserved != NULL || sort_handle != 0 ||
// !IsValidLocaleName(localename) || src == NULL || src_size == 0 ||
// src_size < -1 || value == NULL || value_size == 0 || value_size < -1)
// {
// SetLastError(ERROR_INVALID_PARAMETER);
// return -1;
// }
// if (src_size == -1)
// src_size = strlenW(src);
// if (value_size == -1)
// value_size = strlenW(value);

// src_size -= value_size;
// if (src_size < 0) return -1;

// mask = flags & ~(FIND_FROMSTART | FIND_FROMEND | FIND_STARTSWITH | FIND_ENDSWITH);
// count = flags & (FIND_FROMSTART | FIND_FROMEND) ? src_size + 1 : 1;
// offset = flags & (FIND_FROMSTART | FIND_STARTSWITH) ? 0 : src_size;
// inc = flags & (FIND_FROMSTART | FIND_STARTSWITH) ? 1 : -1;
// while (count--)
// {
// if (CompareStringEx(localename, mask, src + offset, value_size, value, value_size, NULL, NULL, 0) == CSTR_EQUAL)
// {
// if (found)
// *found = value_size;
// return offset;
// }
// offset += inc;
// }
if (version_info != NULL || reserved != NULL || sort_handle != 0 ||
!IsValidLocaleName(localename) || src == NULL || src_size == 0 ||
src_size < -1 || value == NULL || value_size == 0 || value_size < -1)
{
SetLastError(ERROR_INVALID_PARAMETER);
return -1;
}
if (src_size == -1)
src_size = strlenW(src);
if (value_size == -1)
value_size = strlenW(value);

// return -1;
// }
src_size -= value_size;
if (src_size < 0) return -1;

mask = flags & ~(FIND_FROMSTART | FIND_FROMEND | FIND_STARTSWITH | FIND_ENDSWITH);
count = flags & (FIND_FROMSTART | FIND_FROMEND) ? src_size + 1 : 1;
offset = flags & (FIND_FROMSTART | FIND_STARTSWITH) ? 0 : src_size;
inc = flags & (FIND_FROMSTART | FIND_STARTSWITH) ? 1 : -1;
while (count--)
{
if (CompareStringEx(localename, mask, src + offset, value_size, value, value_size, NULL, NULL, 0) == CSTR_EQUAL)
{
if (found)
*found = value_size;
return offset;
}
offset += inc;
}

return -1;
}

// int
// WINAPI
Expand Down
Loading

0 comments on commit e921bdf

Please sign in to comment.