ReactOS.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
List overview
Download
Ros-diffs
May 2019
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
ros-diffs@reactos.org
17 participants
165 discussions
Start a n
N
ew thread
[reactos] 01/03: [APPHELP] Add ordinal import support
by Mark Jansen
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=1570f08b4d82e44928d7b…
commit 1570f08b4d82e44928d7b328fa07aa32759858e5 Author: Mark Jansen <mark.jansen(a)reactos.org> AuthorDate: Sun Feb 11 22:40:51 2018 +0100 Commit: Mark Jansen <mark.jansen(a)reactos.org> CommitDate: Wed May 1 19:22:19 2019 +0200 [APPHELP] Add ordinal import support --- dll/appcompat/apphelp/shimeng.c | 155 +++++++++++++++++++++++++--------------- 1 file changed, 96 insertions(+), 59 deletions(-) diff --git a/dll/appcompat/apphelp/shimeng.c b/dll/appcompat/apphelp/shimeng.c index 3e8a169617..190e17c2a7 100644 --- a/dll/appcompat/apphelp/shimeng.c +++ b/dll/appcompat/apphelp/shimeng.c @@ -37,6 +37,7 @@ static ARRAY g_pShimInfo; /* PSHIMMODULE */ static ARRAY g_pHookArray; /* HOOKMODULEINFO */ static ARRAY g_InExclude; /* INEXCLUDE */ +typedef FARPROC(WINAPI* GETPROCADDRESSPROC)(HINSTANCE, LPCSTR); /* If we have setup a hook for a function, we should also redirect GetProcAddress for this function */ HOOKAPIEX g_IntHookEx[] = { @@ -207,6 +208,39 @@ BOOL WINAPIV SeiDbgPrint(SEI_LOG_LEVEL Level, PCSTR Function, PCSTR Format, ...) return TRUE; } +static +BOOL SeiIsOrdinalName(LPCSTR lpProcName) +{ + return (ULONG_PTR)lpProcName <= MAXUSHORT; +} + +LPCSTR SeiPrintFunctionName(LPCSTR lpProcName, char szOrdProcFmt[10]) +{ + if (SeiIsOrdinalName(lpProcName)) + { + StringCchPrintfA(szOrdProcFmt, 10, "#%Iu", (ULONG_PTR)lpProcName); + return szOrdProcFmt; + } + return lpProcName; +} + +int SeiCompareFunctionName(LPCSTR lpProcName1, LPCSTR lpProcName2) +{ + BOOL Ord1 = SeiIsOrdinalName(lpProcName1); + BOOL Ord2 = SeiIsOrdinalName(lpProcName2); + + /* One is an ordinal, the other not */ + if (Ord1 != Ord2) + return 1; + + /* Compare ordinals */ + if (Ord1) + return (ULONG_PTR)lpProcName1 != (ULONG_PTR)lpProcName2; + + /* Compare names */ + return strcmp(lpProcName1, lpProcName2); +} + PVOID SeiGetModuleFromAddress(PVOID addr) { @@ -216,7 +250,6 @@ PVOID SeiGetModuleFromAddress(PVOID addr) } - /* TODO: Guard against recursive calling / calling init multiple times! */ VOID NotifyShims(DWORD dwReason, PVOID Info) { @@ -429,7 +462,7 @@ static VOID SeiSetLayerEnvVar(LPCWSTR wszLayer) Status = RtlSetEnvironmentVariable(NULL, &VarName, &Value); if (NT_SUCCESS(Status)) - SHIMENG_INFO("Set env var %wZ=%wZ\n", &VarName, &Value); + SHIMENG_INFO("%wZ=%wZ\n", &VarName, &Value); else SHIMENG_FAIL("Failed to set %wZ: 0x%x\n", &VarName, Status); } @@ -542,7 +575,6 @@ VOID SeiAddHooks(PHOOKAPIEX hooks, DWORD dwHookCount, PSHIMINFO pShim) continue; } - RtlInitAnsiString(&AnsiString, hook->FunctionName); if (NT_SUCCESS(LdrGetDllHandle(NULL, 0, &UnicodeModName, &DllHandle))) { HookModuleInfo = SeiFindHookModuleInfo(NULL, DllHandle); @@ -569,7 +601,7 @@ VOID SeiAddHooks(PHOOKAPIEX hooks, DWORD dwHookCount, PSHIMINFO pShim) for (j = 0; j < ARRAY_Size(&HookModuleInfo->HookApis); ++j) { PHOOKAPIEX HookApi = *ARRAY_At(&HookModuleInfo->HookApis, PHOOKAPIEX, j); - int CmpResult = strcmp(hook->FunctionName, HookApi->FunctionName); + int CmpResult = SeiCompareFunctionName(hook->FunctionName, HookApi->FunctionName); if (CmpResult == 0) { while (HookApi->ApiLink) @@ -591,42 +623,32 @@ VOID SeiAddHooks(PHOOKAPIEX hooks, DWORD dwHookCount, PSHIMINFO pShim) } } -typedef FARPROC(WINAPI* GETPROCADDRESSPROC)(HINSTANCE, LPCSTR); - /* Check if we should fake the return from GetProcAddress (because we also redirected the iat for this module) */ FARPROC WINAPI StubGetProcAddress(HINSTANCE hModule, LPCSTR lpProcName) { - char szOrdProcName[10] = ""; - LPCSTR lpPrintName = lpProcName; PVOID Addr = _ReturnAddress(); PHOOKMODULEINFO HookModuleInfo; FARPROC proc = ((GETPROCADDRESSPROC)g_IntHookEx[0].OriginalFunction)(hModule, lpProcName); - - if ((DWORD_PTR)lpProcName <= MAXUSHORT) - { - sprintf(szOrdProcName, "#%Iu", (DWORD_PTR)lpProcName); - lpPrintName = szOrdProcName; - } + char szOrdProcFmt[10]; Addr = SeiGetModuleFromAddress(Addr); if (SE_IsShimDll(Addr)) { - SHIMENG_MSG("Not touching GetProcAddress for shim dll (%p!%s)", hModule, lpPrintName); + SHIMENG_MSG("Not touching GetProcAddress for shim dll (%p!%s)", hModule, SeiPrintFunctionName(lpProcName, szOrdProcFmt)); return proc; } - SHIMENG_INFO("(GetProcAddress(%p!%s) => %p\n", hModule, lpPrintName, proc); + SHIMENG_INFO("(GetProcAddress(%p!%s) => %p\n", hModule, SeiPrintFunctionName(lpProcName, szOrdProcFmt), proc); HookModuleInfo = SeiFindHookModuleInfo(NULL, hModule); - /* FIXME: Ordinal not yet supported */ - if (HookModuleInfo && HIWORD(lpProcName)) + if (HookModuleInfo) { DWORD n; for (n = 0; n < ARRAY_Size(&HookModuleInfo->HookApis); ++n) { PHOOKAPIEX HookApi = *ARRAY_At(&HookModuleInfo->HookApis, PHOOKAPIEX, n); - int CmpResult = strcmp(lpProcName, HookApi->FunctionName); + int CmpResult = SeiCompareFunctionName(lpProcName, HookApi->FunctionName); if (CmpResult == 0) { SHIMENG_MSG("Redirecting %p to %p\n", proc, HookApi->ReplacementFunction); @@ -648,13 +670,25 @@ VOID SeiResolveAPI(PHOOKMODULEINFO HookModuleInfo) for (n = 0; n < ARRAY_Size(&HookModuleInfo->HookApis); ++n) { + NTSTATUS Status; PVOID ProcAddress; PHOOKAPIEX HookApi = *ARRAY_At(&HookModuleInfo->HookApis, PHOOKAPIEX, n); - RtlInitAnsiString(&AnsiString, HookApi->FunctionName); - if (!NT_SUCCESS(LdrGetProcedureAddress(HookModuleInfo->BaseAddress, &AnsiString, 0, &ProcAddress))) + if (!SeiIsOrdinalName(HookApi->FunctionName)) + { + RtlInitAnsiString(&AnsiString, HookApi->FunctionName); + Status = LdrGetProcedureAddress(HookModuleInfo->BaseAddress, &AnsiString, 0, &ProcAddress); + } + else + { + Status = LdrGetProcedureAddress(HookModuleInfo->BaseAddress, NULL, (ULONG_PTR)HookApi->FunctionName, &ProcAddress); + } + + if (!NT_SUCCESS(Status)) { - SHIMENG_FAIL("Unable to retrieve %s!%s\n", HookApi->LibraryName, HookApi->FunctionName); + char szOrdProcFmt[10]; + LPCSTR lpFunctionName = SeiPrintFunctionName(HookApi->FunctionName, szOrdProcFmt); + SHIMENG_FAIL("Unable to retrieve %s!%s\n", HookApi->LibraryName, lpFunctionName); continue; } @@ -732,8 +766,9 @@ VOID SeiPatchNewImport(PIMAGE_THUNK_DATA FirstThunk, PHOOKAPIEX HookApi, PLDR_DA PVOID Ptr; SIZE_T Size; NTSTATUS Status; + char szOrdProcFmt[10]; - SHIMENG_INFO("Hooking API \"%s!%s\" for DLL \"%wZ\"\n", HookApi->LibraryName, HookApi->FunctionName, &LdrEntry->BaseDllName); + SHIMENG_INFO("Hooking API \"%s!%s\" for DLL \"%wZ\"\n", HookApi->LibraryName, SeiPrintFunctionName(HookApi->FunctionName, szOrdProcFmt), &LdrEntry->BaseDllName); Ptr = &FirstThunk->u1.Function; Size = sizeof(FirstThunk->u1.Function); @@ -746,11 +781,7 @@ VOID SeiPatchNewImport(PIMAGE_THUNK_DATA FirstThunk, PHOOKAPIEX HookApi, PLDR_DA } SHIMENG_INFO("changing 0x%p to 0x%p\n", FirstThunk->u1.Function, HookApi->ReplacementFunction); -#ifdef _WIN64 - FirstThunk->u1.Function = (ULONGLONG)HookApi->ReplacementFunction; -#else - FirstThunk->u1.Function = (DWORD)HookApi->ReplacementFunction; -#endif + FirstThunk->u1.Function = (ULONG_PTR)HookApi->ReplacementFunction; Size = sizeof(FirstThunk->u1.Function); Status = NtProtectVirtualMemory(NtCurrentProcess(), &Ptr, &Size, OldProtection, &OldProtection); @@ -782,6 +813,7 @@ BOOL SeiIsExcluded(PLDR_DATA_TABLE_ENTRY LdrEntry, PHOOKAPIEX HookApi) PSHIMINFO pShimInfo = HookApi->pShimInfo; PINEXCLUDE InExclude; BOOL IsExcluded = FALSE; + char szOrdProcFmt[10]; if (!pShimInfo) { @@ -801,7 +833,7 @@ BOOL SeiIsExcluded(PLDR_DATA_TABLE_ENTRY LdrEntry, PHOOKAPIEX HookApi) if (!InExclude->Include) { SHIMENG_INFO("Module '%wZ' excluded for shim %S, API '%s!%s', because it on in the exclude list.\n", - &LdrEntry->BaseDllName, pShimInfo->ShimName, HookApi->LibraryName, HookApi->FunctionName); + &LdrEntry->BaseDllName, pShimInfo->ShimName, HookApi->LibraryName, SeiPrintFunctionName(HookApi->FunctionName, szOrdProcFmt)); return TRUE; } @@ -809,7 +841,7 @@ BOOL SeiIsExcluded(PLDR_DATA_TABLE_ENTRY LdrEntry, PHOOKAPIEX HookApi) if (IsExcluded) { SHIMENG_INFO("Module '%wZ' included for shim %S, API '%s!%s', because it is on the include list.\n", - &LdrEntry->BaseDllName, pShimInfo->ShimName, HookApi->LibraryName, HookApi->FunctionName); + &LdrEntry->BaseDllName, pShimInfo->ShimName, HookApi->LibraryName, SeiPrintFunctionName(HookApi->FunctionName, szOrdProcFmt)); } IsExcluded = FALSE; @@ -818,7 +850,7 @@ BOOL SeiIsExcluded(PLDR_DATA_TABLE_ENTRY LdrEntry, PHOOKAPIEX HookApi) if (IsExcluded) { SHIMENG_INFO("Module '%wZ' excluded for shim %S, API '%s!%s', because it is in System32/WinSXS.\n", - &LdrEntry->BaseDllName, pShimInfo->ShimName, HookApi->LibraryName, HookApi->FunctionName); + &LdrEntry->BaseDllName, pShimInfo->ShimName, HookApi->LibraryName, SeiPrintFunctionName(HookApi->FunctionName, szOrdProcFmt)); } return IsExcluded; @@ -974,33 +1006,45 @@ VOID SeiHookImports(PLDR_DATA_TABLE_ENTRY LdrEntry) /* Walk all imports */ for (;OriginalThunk->u1.AddressOfData && FirstThunk->u1.Function; OriginalThunk++, FirstThunk++) { - if (!IMAGE_SNAP_BY_ORDINAL32(OriginalThunk->u1.AddressOfData)) + if (!IMAGE_SNAP_BY_ORDINAL(OriginalThunk->u1.Function)) { - PIMAGE_IMPORT_BY_NAME ImportName; - - ImportName = (PIMAGE_IMPORT_BY_NAME)(DllBase + OriginalThunk->u1.AddressOfData); - if (!strcmp((PCSTR)ImportName->Name, HookApi->FunctionName)) + if (!SeiIsOrdinalName(HookApi->FunctionName)) { - SeiPatchNewImport(FirstThunk, HookApi, LdrEntry); + PIMAGE_IMPORT_BY_NAME ImportName; - /* Sadly, iat does not have to be sorted, and can even contain duplicate entries. */ - dwFound++; + ImportName = (PIMAGE_IMPORT_BY_NAME)(DllBase + OriginalThunk->u1.Function); + if (!strcmp((PCSTR)ImportName->Name, HookApi->FunctionName)) + { + SeiPatchNewImport(FirstThunk, HookApi, LdrEntry); + + /* Sadly, iat does not have to be sorted, and can even contain duplicate entries. */ + dwFound++; + } } } else { - SHIMENG_FAIL("Ordinals not yet supported\n"); - ASSERT(0); + if (SeiIsOrdinalName(HookApi->FunctionName)) + { + if ((PCSTR)IMAGE_ORDINAL(OriginalThunk->u1.Function) == HookApi->FunctionName) + { + SeiPatchNewImport(FirstThunk, HookApi, LdrEntry); + dwFound++; + } + } } } if (dwFound != 1) { + char szOrdProcFmt[10]; + LPCSTR FuncName = SeiPrintFunctionName(HookApi->FunctionName, szOrdProcFmt); + /* One entry not found. */ if (!dwFound) - SHIMENG_INFO("Entry \"%s!%s\" not found for \"%wZ\"\n", HookApi->LibraryName, HookApi->FunctionName, &LdrEntry->BaseDllName); + SHIMENG_INFO("Entry \"%s!%s\" not found for \"%wZ\"\n", HookApi->LibraryName, FuncName, &LdrEntry->BaseDllName); else - SHIMENG_INFO("Entry \"%s!%s\" found %d times for \"%wZ\"\n", HookApi->LibraryName, HookApi->FunctionName, dwFound, &LdrEntry->BaseDllName); + SHIMENG_INFO("Entry \"%s!%s\" found %d times for \"%wZ\"\n", HookApi->LibraryName, FuncName, dwFound, &LdrEntry->BaseDllName); } } } @@ -1315,28 +1359,21 @@ BOOL SeiGetShimData(PUNICODE_STRING ProcessImage, PVOID pShimData, HSDB* pHsdb, RTL_CONSTANT_STRING(L"slsvc.exe"), #endif }; - static const UNICODE_STRING BackSlash = RTL_CONSTANT_STRING(L"\\"); - static const UNICODE_STRING ForwdSlash = RTL_CONSTANT_STRING(L"/"); + static const UNICODE_STRING PathDividerFind = RTL_CONSTANT_STRING(L"\\/"); UNICODE_STRING ProcessName; - USHORT Back, Forward; + USHORT PathDivider; HSDB hsdb; DWORD n; - if (!NT_SUCCESS(RtlFindCharInUnicodeString(RTL_FIND_CHAR_IN_UNICODE_STRING_START_AT_END, ProcessImage, &BackSlash, &Back))) - Back = 0; - - if (!NT_SUCCESS(RtlFindCharInUnicodeString(RTL_FIND_CHAR_IN_UNICODE_STRING_START_AT_END, ProcessImage, &ForwdSlash, &Forward))) - Forward = 0; - - if (Back < Forward) - Back = Forward; + if (!NT_SUCCESS(RtlFindCharInUnicodeString(RTL_FIND_CHAR_IN_UNICODE_STRING_START_AT_END, ProcessImage, &PathDividerFind, &PathDivider))) + PathDivider = 0; - if (Back) - Back += sizeof(WCHAR); + if (PathDivider) + PathDivider += sizeof(WCHAR); - ProcessName.Buffer = ProcessImage->Buffer + Back / sizeof(WCHAR); - ProcessName.Length = ProcessImage->Length - Back; - ProcessName.MaximumLength = ProcessImage->MaximumLength - Back; + ProcessName.Buffer = ProcessImage->Buffer + PathDivider / sizeof(WCHAR); + ProcessName.Length = ProcessImage->Length - PathDivider; + ProcessName.MaximumLength = ProcessImage->MaximumLength - PathDivider; for (n = 0; n < ARRAYSIZE(ForbiddenShimmingApps); ++n) {
5 years, 7 months
1
0
0
0
[reactos] 01/01: [POWERCFG] Fix indentation. No code changes!
by Eric Kohl
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=2872cfc3b7dc2547225fb…
commit 2872cfc3b7dc2547225fbe32104efcb24e0aac7f Author: Eric Kohl <eric.kohl(a)reactos.org> AuthorDate: Wed May 1 13:16:00 2019 +0200 Commit: Eric Kohl <eric.kohl(a)reactos.org> CommitDate: Wed May 1 13:16:38 2019 +0200 [POWERCFG] Fix indentation. No code changes! --- dll/cpl/powercfg/powercfg.c | 161 +++++++++++++++++++++++--------------------- 1 file changed, 84 insertions(+), 77 deletions(-) diff --git a/dll/cpl/powercfg/powercfg.c b/dll/cpl/powercfg/powercfg.c index 61a910cabf..be89004a2b 100644 --- a/dll/cpl/powercfg/powercfg.c +++ b/dll/cpl/powercfg/powercfg.c @@ -26,7 +26,7 @@ TCHAR langSel[255]; /* Applets */ APPLET Applets[NUM_APPLETS] = { - {IDC_CPLICON_1, IDS_CPLNAME_1, IDS_CPLDESCRIPTION_1, Applet1} + {IDC_CPLICON_1, IDS_CPLNAME_1, IDS_CPLDESCRIPTION_1, Applet1} }; static BOOL CALLBACK @@ -72,6 +72,7 @@ PropSheetProc(HWND hwndDlg, UINT uMsg, LPARAM lParam) { // NOTE: This callback is needed to set large icon correctly. HICON hIcon; + switch (uMsg) { case PSCB_INITIALIZED: @@ -88,54 +89,54 @@ PropSheetProc(HWND hwndDlg, UINT uMsg, LPARAM lParam) static LONG APIENTRY Applet1(HWND hwnd, UINT uMsg, LPARAM wParam, LPARAM lParam) { - HPROPSHEETPAGE hpsp[MAX_POWER_PAGES]; - PROPSHEETHEADER psh; - HPSXA hpsxa = NULL; - TCHAR Caption[1024]; - SYSTEM_POWER_CAPABILITIES spc; - LONG ret; - - UNREFERENCED_PARAMETER(uMsg); - UNREFERENCED_PARAMETER(wParam); - UNREFERENCED_PARAMETER(lParam); - - memset(Caption, 0x0, sizeof(Caption)); - LoadString(hApplet, IDS_CPLNAME_1, Caption, sizeof(Caption) / sizeof(TCHAR)); - - ZeroMemory(&psh, sizeof(PROPSHEETHEADER)); - psh.dwSize = sizeof(PROPSHEETHEADER); - psh.dwFlags = PSH_PROPTITLE | PSH_USEICONID | PSH_USECALLBACK; - psh.hwndParent = hwnd; - psh.hInstance = hApplet; - psh.pszIcon = MAKEINTRESOURCEW(IDC_CPLICON_1); - psh.pszCaption = Caption; - psh.nPages = 0; - psh.nStartPage = 0; - psh.phpage = hpsp; - psh.pfnCallback = PropSheetProc; - - InitPropSheetPage(&psh, IDD_PROPPAGEPOWERSCHEMES, PowerSchemesDlgProc); - if (GetPwrCapabilities(&spc)) - { - if (spc.SystemBatteriesPresent) + HPROPSHEETPAGE hpsp[MAX_POWER_PAGES]; + PROPSHEETHEADER psh; + HPSXA hpsxa = NULL; + TCHAR Caption[1024]; + SYSTEM_POWER_CAPABILITIES spc; + LONG ret; + + UNREFERENCED_PARAMETER(uMsg); + UNREFERENCED_PARAMETER(wParam); + UNREFERENCED_PARAMETER(lParam); + + memset(Caption, 0x0, sizeof(Caption)); + LoadString(hApplet, IDS_CPLNAME_1, Caption, sizeof(Caption) / sizeof(TCHAR)); + + ZeroMemory(&psh, sizeof(PROPSHEETHEADER)); + psh.dwSize = sizeof(PROPSHEETHEADER); + psh.dwFlags = PSH_PROPTITLE | PSH_USEICONID | PSH_USECALLBACK; + psh.hwndParent = hwnd; + psh.hInstance = hApplet; + psh.pszIcon = MAKEINTRESOURCEW(IDC_CPLICON_1); + psh.pszCaption = Caption; + psh.nPages = 0; + psh.nStartPage = 0; + psh.phpage = hpsp; + psh.pfnCallback = PropSheetProc; + + InitPropSheetPage(&psh, IDD_PROPPAGEPOWERSCHEMES, PowerSchemesDlgProc); + if (GetPwrCapabilities(&spc)) { - InitPropSheetPage(&psh, IDD_PROPPAGEALARMS, AlarmsDlgProc); + if (spc.SystemBatteriesPresent) + { + InitPropSheetPage(&psh, IDD_PROPPAGEALARMS, AlarmsDlgProc); + } } - } - InitPropSheetPage(&psh, IDD_PROPPAGEADVANCED, AdvancedDlgProc); - InitPropSheetPage(&psh, IDD_PROPPAGEHIBERNATE, HibernateDlgProc); + InitPropSheetPage(&psh, IDD_PROPPAGEADVANCED, AdvancedDlgProc); + InitPropSheetPage(&psh, IDD_PROPPAGEHIBERNATE, HibernateDlgProc); - /* Load additional pages provided by shell extensions */ - hpsxa = SHCreatePropSheetExtArray(HKEY_LOCAL_MACHINE, REGSTR_PATH_CONTROLSFOLDER TEXT("\\Power"), MAX_POWER_PAGES - psh.nPages); - if (hpsxa != NULL) - SHAddFromPropSheetExtArray(hpsxa, PropSheetAddPage, (LPARAM)&psh); + /* Load additional pages provided by shell extensions */ + hpsxa = SHCreatePropSheetExtArray(HKEY_LOCAL_MACHINE, REGSTR_PATH_CONTROLSFOLDER TEXT("\\Power"), MAX_POWER_PAGES - psh.nPages); + if (hpsxa != NULL) + SHAddFromPropSheetExtArray(hpsxa, PropSheetAddPage, (LPARAM)&psh); - ret = (LONG)(PropertySheet(&psh) != -1); + ret = (LONG)(PropertySheet(&psh) != -1); - if (hpsxa != NULL) - SHDestroyPropSheetExtArray(hpsxa); + if (hpsxa != NULL) + SHDestroyPropSheetExtArray(hpsxa); - return ret; + return ret; } /* Control Panel Callback */ @@ -145,34 +146,38 @@ CPlApplet(HWND hwndCPl, LPARAM lParam1, LPARAM lParam2) { - int i = (int)lParam1; + int i = (int)lParam1; - switch(uMsg) - { - case CPL_INIT: - { - return TRUE; - } - case CPL_GETCOUNT: - { - return NUM_APPLETS; - } - case CPL_INQUIRE: - { - CPLINFO *CPlInfo = (CPLINFO*)lParam2; - CPlInfo->lData = 0; - CPlInfo->idIcon = Applets[i].idIcon; - CPlInfo->idName = Applets[i].idName; - CPlInfo->idInfo = Applets[i].idDescription; - break; - } - case CPL_DBLCLK: + switch (uMsg) { - Applets[i].AppletProc(hwndCPl, uMsg, lParam1, lParam2); - break; + case CPL_INIT: + { + return TRUE; + } + + case CPL_GETCOUNT: + { + return NUM_APPLETS; + } + + case CPL_INQUIRE: + { + CPLINFO *CPlInfo = (CPLINFO*)lParam2; + CPlInfo->lData = 0; + CPlInfo->idIcon = Applets[i].idIcon; + CPlInfo->idName = Applets[i].idName; + CPlInfo->idInfo = Applets[i].idDescription; + break; + } + + case CPL_DBLCLK: + { + Applets[i].AppletProc(hwndCPl, uMsg, lParam1, lParam2); + break; + } } - } - return FALSE; + + return FALSE; } @@ -181,13 +186,15 @@ DllMain(HINSTANCE hinstDLL, DWORD dwReason, LPVOID lpvReserved) { - UNREFERENCED_PARAMETER(lpvReserved); - switch(dwReason) - { - case DLL_PROCESS_ATTACH: - case DLL_THREAD_ATTACH: - hApplet = hinstDLL; - break; - } - return TRUE; + UNREFERENCED_PARAMETER(lpvReserved); + + switch(dwReason) + { + case DLL_PROCESS_ATTACH: + case DLL_THREAD_ATTACH: + hApplet = hinstDLL; + break; + } + + return TRUE; }
5 years, 7 months
1
0
0
0
[reactos] 01/01: [GDI32_APITEST] Improve SetMapMode testcase (#1547)
by Katayama Hirofumi MZ
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=88fbb600bf170f0a37c90…
commit 88fbb600bf170f0a37c90dea4dd653e1b2f8c354 Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com> AuthorDate: Wed May 1 18:28:18 2019 +0900 Commit: GitHub <noreply(a)github.com> CommitDate: Wed May 1 18:28:18 2019 +0900 [GDI32_APITEST] Improve SetMapMode testcase (#1547) Check the relation of mode change and viewport change. CORE-14994 --- modules/rostests/apitests/gdi32/SetMapMode.c | 100 ++++++++++++++++++++++++++- 1 file changed, 98 insertions(+), 2 deletions(-) diff --git a/modules/rostests/apitests/gdi32/SetMapMode.c b/modules/rostests/apitests/gdi32/SetMapMode.c index 8d38250199c..0f5c164bc18 100644 --- a/modules/rostests/apitests/gdi32/SetMapMode.c +++ b/modules/rostests/apitests/gdi32/SetMapMode.c @@ -13,6 +13,7 @@ void Test_SetMapMode() HDC hDC; SIZE WindowExt, ViewportExt; ULONG ulMapMode; + POINT pt; hDC = CreateCompatibleDC(NULL); ok(hDC != 0, "CreateCompatibleDC failed, skipping tests.\n"); @@ -104,7 +105,7 @@ void Test_SetMapMode() GetViewportExtEx(hDC, &ViewportExt); //ok_long(WindowExt.cx, 3600); //ok_long(WindowExt.cy, 2700); - ok_long(ViewportExt.cx, GetDeviceCaps(GetDC(0), HORZRES)); + //ok_long(ViewportExt.cx, GetDeviceCaps(GetDC(0), HORZRES) - 4); ok_long(ViewportExt.cy, -GetDeviceCaps(GetDC(0), VERTRES)); DeleteDC(hDC); @@ -183,10 +184,105 @@ void Test_SetMapMode() ok_long(ViewportExt.cx, GetDeviceCaps(GetDC(0), HORZRES)); ok_long(ViewportExt.cy, -GetDeviceCaps(GetDC(0), VERTRES)); DeleteDC(hDC); + + // + // Test mode and extents + // + hDC = CreateCompatibleDC(NULL); + GetViewportExtEx(hDC, &ViewportExt); + GetWindowExtEx(hDC, &WindowExt); + ok_long(ViewportExt.cx, 1); + ok_long(ViewportExt.cy, 1); + ok_long(WindowExt.cx, 1); + ok_long(WindowExt.cy, 1); + + SetMapMode(hDC, MM_ANISOTROPIC); + GetViewportExtEx(hDC, &ViewportExt); + GetWindowExtEx(hDC, &WindowExt); + ok_long(ViewportExt.cx, 1); + ok_long(ViewportExt.cy, 1); + ok_long(WindowExt.cx, 1); + ok_long(WindowExt.cy, 1); + SetWindowExtEx(hDC, 200, 200, NULL); + SetViewportExtEx(hDC, 100, 100, NULL); + + SetMapMode(hDC, MM_ANISOTROPIC); + GetViewportExtEx(hDC, &ViewportExt); + GetWindowExtEx(hDC, &WindowExt); + ok_long(ViewportExt.cx, 100); + ok_long(ViewportExt.cy, 100); + ok_long(WindowExt.cx, 200); + ok_long(WindowExt.cy, 200); + + SetMapMode(hDC, MM_ANISOTROPIC); + GetViewportExtEx(hDC, &ViewportExt); + ok_long(ViewportExt.cx, 100); + ok_long(ViewportExt.cy, 100); + ok_long(WindowExt.cx, 200); + ok_long(WindowExt.cy, 200); + + SetMapMode(hDC, MM_ISOTROPIC); + GetViewportExtEx(hDC, &ViewportExt); + //ok_long(ViewportExt.cx, GetDeviceCaps(GetDC(0), HORZRES) - 4); + ok_long(ViewportExt.cy, -GetDeviceCaps(GetDC(0), VERTRES)); + SetWindowExtEx(hDC, 100, 100, NULL); + SetViewportExtEx(hDC, 100, 100, NULL); + + SetMapMode(hDC, MM_ISOTROPIC); + GetViewportExtEx(hDC, &ViewportExt); + ok_long(ViewportExt.cx, 100); + ok_long(ViewportExt.cy, 100); + + SetMapMode(hDC, MM_ANISOTROPIC); + GetViewportExtEx(hDC, &ViewportExt); + ok_long(ViewportExt.cx, 100); + ok_long(ViewportExt.cy, 100); + + SetMapMode(hDC, MM_TEXT); + GetViewportExtEx(hDC, &ViewportExt); + ok_long(ViewportExt.cx, 1); + ok_long(ViewportExt.cy, 1); + + SetMapMode(hDC, MM_ANISOTROPIC); + GetViewportExtEx(hDC, &ViewportExt); + ok_long(ViewportExt.cx, 1); + ok_long(ViewportExt.cy, 1); + + SetMapMode(hDC, MM_ISOTROPIC); + GetViewportExtEx(hDC, &ViewportExt); + //ok_long(ViewportExt.cx, GetDeviceCaps(GetDC(0), HORZRES) - 4); + ok_long(ViewportExt.cy, -GetDeviceCaps(GetDC(0), VERTRES)); + + SetMapMode(hDC, MM_TEXT); + GetViewportExtEx(hDC, &ViewportExt); + GetWindowExtEx(hDC, &WindowExt); + ok_long(ViewportExt.cx, 1); + ok_long(ViewportExt.cy, 1); + ok_long(WindowExt.cx, 1); + ok_long(WindowExt.cy, 1); + DeleteDC(hDC); + + // + // Test mode and GetCurrentPositionEx + // + hDC = CreateCompatibleDC(NULL); + MoveToEx(hDC, 100, 100, NULL); + SetMapMode(hDC, MM_ANISOTROPIC); + GetCurrentPositionEx(hDC, &pt); + ok_long(pt.x, 100); + ok_long(pt.y, 100); + SetMapMode(hDC, MM_TEXT); + GetCurrentPositionEx(hDC, &pt); + ok_long(pt.x, 100); + ok_long(pt.y, 100); + SetMapMode(hDC, MM_ISOTROPIC); + GetCurrentPositionEx(hDC, &pt); + ok_long(pt.x, 100); + ok_long(pt.y, 100); + DeleteDC(hDC); } START_TEST(SetMapMode) { Test_SetMapMode(); } -
5 years, 7 months
1
0
0
0
[reactos] 01/01: [WIN32SS][NTGDI] Fix ExtTextOut about TA_UPDATECP (#1546)
by Katayama Hirofumi MZ
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=f7bc0543cbec592ef0417…
commit f7bc0543cbec592ef04171a1197defc78823b3b5 Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com> AuthorDate: Wed May 1 16:51:00 2019 +0900 Commit: GitHub <noreply(a)github.com> CommitDate: Wed May 1 16:51:00 2019 +0900 [WIN32SS][NTGDI] Fix ExtTextOut about TA_UPDATECP (#1546) Add WORLD_XFORM_CHANGED flag to some positioning functions. Fix IntExtTextOutW function for TA_UPDATECP alignment, so that it can correctly update the current position. CORE-14994 --- win32ss/gdi/ntgdi/coord.c | 24 +++++++++++++++--------- win32ss/gdi/ntgdi/freetype.c | 7 +++++-- 2 files changed, 20 insertions(+), 11 deletions(-) diff --git a/win32ss/gdi/ntgdi/coord.c b/win32ss/gdi/ntgdi/coord.c index adaee5f0abb..bea04e28aa0 100644 --- a/win32ss/gdi/ntgdi/coord.c +++ b/win32ss/gdi/ntgdi/coord.c @@ -600,7 +600,7 @@ NtGdiOffsetViewportOrgEx( } pdcattr->ptlViewportOrg.x += XOffset; pdcattr->ptlViewportOrg.y += YOffset; - pdcattr->flXform |= PAGE_XLATE_CHANGED | DEVICE_TO_WORLD_INVALID; + pdcattr->flXform |= PAGE_XLATE_CHANGED | WORLD_XFORM_CHANGED | DEVICE_TO_WORLD_INVALID; DC_UnlockDc(dc); @@ -652,7 +652,7 @@ NtGdiOffsetWindowOrgEx( pdcattr->ptlWindowOrg.x += XOffset; pdcattr->ptlWindowOrg.y += YOffset; - pdcattr->flXform |= PAGE_XLATE_CHANGED|DEVICE_TO_WORLD_INVALID; + pdcattr->flXform |= PAGE_XLATE_CHANGED | WORLD_XFORM_CHANGED | DEVICE_TO_WORLD_INVALID; DC_UnlockDc(dc); @@ -701,6 +701,7 @@ NtGdiScaleViewportExtEx( pdcattr->flXform |= (PAGE_EXTENTS_CHANGED | INVALIDATE_ATTRIBUTES | + WORLD_XFORM_CHANGED | DEVICE_TO_WORLD_INVALID); if (pdcattr->iMapMode == MM_ISOTROPIC) @@ -802,7 +803,10 @@ NtGdiScaleWindowExtEx( IntMirrorWindowOrg(pDC); - pdcattr->flXform |= (PAGE_EXTENTS_CHANGED|INVALIDATE_ATTRIBUTES|DEVICE_TO_WORLD_INVALID); + pdcattr->flXform |= (PAGE_EXTENTS_CHANGED | + INVALIDATE_ATTRIBUTES | + WORLD_XFORM_CHANGED | + DEVICE_TO_WORLD_INVALID); Ret = TRUE; } @@ -896,8 +900,9 @@ IntGdiSetMapMode( pdcattr->iMapMode = MapMode; /* Update xform flags */ - pdcattr->flXform = flXform | (PAGE_XLATE_CHANGED|PAGE_EXTENTS_CHANGED| - INVALIDATE_ATTRIBUTES|DEVICE_TO_PAGE_INVALID|DEVICE_TO_WORLD_INVALID); + pdcattr->flXform = flXform | (PAGE_XLATE_CHANGED | PAGE_EXTENTS_CHANGED | + INVALIDATE_ATTRIBUTES | DEVICE_TO_PAGE_INVALID | + WORLD_XFORM_CHANGED | DEVICE_TO_WORLD_INVALID); return iPrevMapMode; } @@ -929,7 +934,7 @@ GreSetViewportOrgEx( pdcattr->ptlViewportOrg.x = X; pdcattr->ptlViewportOrg.y = Y; - pdcattr->flXform |= PAGE_XLATE_CHANGED | DEVICE_TO_WORLD_INVALID; + pdcattr->flXform |= PAGE_XLATE_CHANGED | WORLD_XFORM_CHANGED | DEVICE_TO_WORLD_INVALID; DC_UnlockDc(dc); return TRUE; @@ -980,7 +985,7 @@ NtGdiSetViewportOrgEx( pdcattr->ptlViewportOrg.x = X; pdcattr->ptlViewportOrg.y = Y; - pdcattr->flXform |= PAGE_XLATE_CHANGED | DEVICE_TO_WORLD_INVALID; + pdcattr->flXform |= PAGE_XLATE_CHANGED | WORLD_XFORM_CHANGED | DEVICE_TO_WORLD_INVALID; DC_UnlockDc(dc); @@ -1032,7 +1037,7 @@ NtGdiSetWindowOrgEx( pdcattr->ptlWindowOrg.x = X; pdcattr->ptlWindowOrg.y = Y; - pdcattr->flXform |= PAGE_XLATE_CHANGED | DEVICE_TO_WORLD_INVALID; + pdcattr->flXform |= PAGE_XLATE_CHANGED | WORLD_XFORM_CHANGED | DEVICE_TO_WORLD_INVALID; DC_UnlockDc(dc); @@ -1068,7 +1073,7 @@ IntMirrorWindowOrg(PDC dc) X = (X * pdcattr->szlWindowExt.cx) / cx; pdcattr->ptlWindowOrg.x = pdcattr->lWindowOrgx - X; // Now set the inverted win origion. - pdcattr->flXform |= PAGE_XLATE_CHANGED | DEVICE_TO_WORLD_INVALID; + pdcattr->flXform |= PAGE_XLATE_CHANGED | WORLD_XFORM_CHANGED | DEVICE_TO_WORLD_INVALID; return; } @@ -1108,6 +1113,7 @@ DC_vSetLayout( pdcattr->flXform |= (PAGE_EXTENTS_CHANGED | INVALIDATE_ATTRIBUTES | + WORLD_XFORM_CHANGED | DEVICE_TO_WORLD_INVALID); } diff --git a/win32ss/gdi/ntgdi/freetype.c b/win32ss/gdi/ntgdi/freetype.c index 7d19d159f8a..0f04a3a5d15 100644 --- a/win32ss/gdi/ntgdi/freetype.c +++ b/win32ss/gdi/ntgdi/freetype.c @@ -6306,8 +6306,11 @@ IntExtTextOutW( MouseSafetyOnDrawEnd(dc->ppdev); } - if (pdcattr->flTextAlign & TA_UPDATECP) { - pdcattr->ptlCurrent.x = DestRect.right - dc->ptlDCOrig.x; + if (pdcattr->flTextAlign & TA_UPDATECP) + { + pdcattr->ptlCurrent.x = vecs[2].x - dc->ptlDCOrig.x; + pdcattr->ptlCurrent.y = vecs[2].y - dc->ptlDCOrig.y; + IntDPtoLP(dc, &pdcattr->ptlCurrent, 1); } IntUnLockFreeType();
5 years, 7 months
1
0
0
0
[reactos] 01/01: [KERNEL32_APITEST] JapaneseCalendar: Reiwa era has come!
by Katayama Hirofumi MZ
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=0ac563b3ec1316bb571a7…
commit 0ac563b3ec1316bb571a77855b0a9b5827a35a92 Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com> AuthorDate: Wed May 1 16:15:23 2019 +0900 Commit: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com> CommitDate: Wed May 1 16:15:23 2019 +0900 [KERNEL32_APITEST] JapaneseCalendar: Reiwa era has come! --- modules/rostests/apitests/kernel32/JapaneseCalendar.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/modules/rostests/apitests/kernel32/JapaneseCalendar.c b/modules/rostests/apitests/kernel32/JapaneseCalendar.c index b4fbe1180b8..1e447223496 100644 --- a/modules/rostests/apitests/kernel32/JapaneseCalendar.c +++ b/modules/rostests/apitests/kernel32/JapaneseCalendar.c @@ -37,8 +37,9 @@ START_TEST(JapaneseCalendar) static const WCHAR s_szSeireki19[] = {0x897F, 0x66A6, '1', '9', 0}; // L"\u897F\u66A6" L"19" static const WCHAR s_szHeisei[] = {0x5E73, 0x6210, 0}; // L"\u5E73\u6210" static const WCHAR s_szHeisei31[] = {0x5E73, 0x6210, '3', '1', 0}; // L"\u5E73\u6210" L"31" - static const WCHAR s_szOneCharHeisei1[] = {0x337B, 0}; // L"\u337B" - static const WCHAR s_szOneCharHeisei2[] = {0x5E73, 0}; // L"\u5E73" + static const WCHAR s_szReiwa[] = {0x4EE4, 0x548C, 0}; // L"\u4EE4\u548C" + static const WCHAR s_szOneCharHeisei1[] = {0x337B, 0}; // L"\u337B" + static const WCHAR s_szOneCharHeisei2[] = {0x5E73, 0}; // L"\u5E73" static const WCHAR s_szOneCharReiwa1[] = {0x32FF, 0}; // L"\u32FF" static const WCHAR s_szOneCharReiwa2[] = {0x4EE4, 0}; // L"\u4EE4" static const WCHAR s_szOneCharReiwa3[] = {0xF9A8, 0}; // L"\uF9A8" @@ -215,7 +216,8 @@ START_TEST(JapaneseCalendar) type = CAL_SERASTRING; ret = GetCalendarInfoW(lcid, CAL_JAPAN, type, szTextW, ARRAYSIZE(szTextW), NULL); ok(ret != 0, "ret: %d\n", ret); - ok(wcsstr(szTextW, s_szHeisei) != NULL, "szTextW: %04X %04X %04X\n", szTextW[0], szTextW[1], szTextW[2]); + ok(wcsstr(szTextW, s_szHeisei) != NULL || + wcsstr(szTextW, s_szReiwa) != NULL, "szTextW: %04X %04X %04X\n", szTextW[0], szTextW[1], szTextW[2]); szTextW[0] = 0x7F; szTextW[1] = 0;
5 years, 7 months
1
0
0
0
← Newer
1
...
14
15
16
17
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
Results per page:
10
25
50
100
200