Re: [ros-dev] [ros-diffs] [reactos] 01/01: [DESK][SHELL32] Allow Desk.cpl to run standalone on WinXP/2003 again CORE-15412

2018-12-17 Thread David Quintana (gigaherz)
You did not commit that, Joachim Henze did.

On Mon, 17 Dec 2018 at 22:28, katahiromz 
wrote:

> Schweitzer,
>
> I will revert it tomorrow.
> Sorry for inconvenience.
>
> Best regards
> 片山博文MZ
>
> 2018年12月18日(火) 6:19、Pierre Schweitzer さん(pie...@reactos.org)のメッセージ:
>
>> Hi,
>>
>> I definitely don't like that commit, nor appreciate the way it was done.
>> If we read CORE-15412 carefully, we have three developers (namely:
>> Thomas, Mark, Giannis) expressing that they are again this revert, and
>> thus this commit.
>> Then, why was it pushed to HEAD?
>>
>> Cheers,
>> Pierre
>>
>> Le 17/12/2018 à 22:02, Joachim Henze a écrit :
>> >
>> https://git.reactos.org/?p=reactos.git;a=commitdiff;h=6f8cb05cad142a8679872e695f317dc1f9728d55
>> >
>> > commit 6f8cb05cad142a8679872e695f317dc1f9728d55
>> > Author: Joachim Henze 
>> > AuthorDate: Mon Dec 17 22:01:49 2018 +0100
>> > Commit: Joachim Henze 
>> > CommitDate: Mon Dec 17 22:01:49 2018 +0100
>> >
>> > [DESK][SHELL32] Allow Desk.cpl to run standalone on WinXP/2003
>> again CORE-15412
>> >
>> > addendum to 0.4.10-dev-502-g
>> > d559ca9c982f9766acc5db3ea887ef2bc27acdff
>> >
>> > That copy-paste was done once intentionally to keep our imports
>> similar to 2003.
>> > It's worth reading the conversation in PR #748: Getequ seems to be
>> ok with this.
>> >
>> > The ideal solution most likely would be to instead *statically*
>> > link against RegLoadMUIStringW() from advapi32_vista when
>> WINNT=0x502.
>> > For now the stuff runs again at least.
>> > I left the func existing in advapi32_vista.dll.
>> > ---
>> >  dll/cpl/desk/CMakeLists.txt  |   6 +-
>> >  dll/cpl/desk/desk.h  |   9 ++
>> >  dll/cpl/desk/muireg.c| 144 ++
>> >  dll/win32/shell32/CMakeLists.txt |   3 +-
>> >  dll/win32/shell32/vista.c| 218
>> +++
>> >  5 files changed, 375 insertions(+), 5 deletions(-)
>> >
>> > diff --git a/dll/cpl/desk/CMakeLists.txt b/dll/cpl/desk/CMakeLists.txt
>> > index 24d9bb1e60..ae7fb83825 100644
>> > --- a/dll/cpl/desk/CMakeLists.txt
>> > +++ b/dll/cpl/desk/CMakeLists.txt
>> > @@ -2,9 +2,6 @@
>> >  add_definitions(-D_WIN32)
>> >  spec2def(desk.cpl desk.spec)
>> >
>> > -remove_definitions(-D_WIN32_WINNT=0x502)
>> > -add_definitions(-D_WIN32_WINNT=0x600)
>> > -
>> >  list(APPEND SOURCE
>> >  advmon.c
>> >  appearance.c
>> > @@ -23,6 +20,7 @@ list(APPEND SOURCE
>> >  general.c
>> >  draw.c
>> >  theme.c
>> > +muireg.c
>> >  desk.h)
>> >
>> >  file(GLOB desk_rc_deps resources/*.*)
>> > @@ -36,6 +34,6 @@ add_library(desk SHARED
>> >
>> >  set_module_type(desk cpl UNICODE)
>> >  target_link_libraries(desk uuid)
>> > -add_importlibs(desk user32 advapi32 advapi32_vista gdi32 comctl32
>> comdlg32 ole32 setupapi shell32 shlwapi uxtheme gdiplus msvcrt kernel32
>> ntdll)
>> > +add_importlibs(desk user32 advapi32 gdi32 comctl32 comdlg32 ole32
>> setupapi shell32 shlwapi uxtheme gdiplus msvcrt kernel32 ntdll)
>> >  add_pch(desk desk.h SOURCE)
>> >  add_cd_file(TARGET desk DESTINATION reactos/system32 FOR all)
>> > diff --git a/dll/cpl/desk/desk.h b/dll/cpl/desk/desk.h
>> > index 3bb02f3a74..3c479251cf 100644
>> > --- a/dll/cpl/desk/desk.h
>> > +++ b/dll/cpl/desk/desk.h
>> > @@ -122,4 +122,13 @@ HPSXA WINAPI
>> SHCreatePropSheetExtArrayEx(HKEY,LPCWSTR,UINT,IDataObject*);
>> >  INT_PTR CALLBACK
>> >  AdvGeneralPageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM
>> lParam);
>> >
>> > +LONG
>> > +RegLoadMUIStringW(IN HKEY hKey,
>> > +  IN LPCWSTR pszValue  OPTIONAL,
>> > +  OUT LPWSTR pszOutBuf,
>> > +  IN DWORD cbOutBuf,
>> > +  OUT LPDWORD pcbData OPTIONAL,
>> > +  IN DWORD Flags,
>> > +  IN LPCWSTR pszDirectory  OPTIONAL);
>> > +
>> >  #endif /* _DESK_H */
>> > diff --git a/dll/cpl/desk/muireg.c b/dll/cpl/desk/muireg.c
>> > new file mode 100644
>> > index 00..8754b43655
>> > --- /dev/null
>> > +++ b/dll/cpl/desk/muireg.c
>> > @@ -0,0 +1,144 @@
>> > +#include "desk.h"
>> > +
>> >
>> +/**
>> > + * load_string [Internal]
>> > + *
>> > + * This is basically a copy of user32/resource.c's LoadStringW.
>> Necessary to
>> > + * avoid importing user32, which is higher level than advapi32. Helper
>> for
>> > + * RegLoadMUIString.
>> > + */
>> > +static int load_string(HINSTANCE hModule, UINT resId, LPWSTR
>> pwszBuffer, INT cMaxChars)
>> > +{
>> > +HGLOBAL hMemory;
>> > +HRSRC hResource;
>> > +WCHAR *pString;
>> > +int idxString;
>> > +
>> > +/* Negative values have to be inverted. */
>> > +if (HIWORD(resId) == 0x)
>> > +resId = (UINT)(-((INT)resId));
>> > +
>> > +/* Load the resource into memory and get a pointer to it. */
>> > +hResource = FindResourceW(hModule, MAKEINTRESOURCEW(LOWORD(resId
>> >> 4) + 1), 

Re: [ros-dev] [ros-diffs] [reactos] 01/01: [DESK][SHELL32] Allow Desk.cpl to run standalone on WinXP/2003 again CORE-15412

2018-12-17 Thread katahiromz
Schweitzer,

I will revert it tomorrow.
Sorry for inconvenience.

Best regards
片山博文MZ

2018年12月18日(火) 6:19、Pierre Schweitzer さん(pie...@reactos.org)のメッセージ:

> Hi,
>
> I definitely don't like that commit, nor appreciate the way it was done.
> If we read CORE-15412 carefully, we have three developers (namely:
> Thomas, Mark, Giannis) expressing that they are again this revert, and
> thus this commit.
> Then, why was it pushed to HEAD?
>
> Cheers,
> Pierre
>
> Le 17/12/2018 à 22:02, Joachim Henze a écrit :
> >
> https://git.reactos.org/?p=reactos.git;a=commitdiff;h=6f8cb05cad142a8679872e695f317dc1f9728d55
> >
> > commit 6f8cb05cad142a8679872e695f317dc1f9728d55
> > Author: Joachim Henze 
> > AuthorDate: Mon Dec 17 22:01:49 2018 +0100
> > Commit: Joachim Henze 
> > CommitDate: Mon Dec 17 22:01:49 2018 +0100
> >
> > [DESK][SHELL32] Allow Desk.cpl to run standalone on WinXP/2003 again
> CORE-15412
> >
> > addendum to 0.4.10-dev-502-g
> > d559ca9c982f9766acc5db3ea887ef2bc27acdff
> >
> > That copy-paste was done once intentionally to keep our imports
> similar to 2003.
> > It's worth reading the conversation in PR #748: Getequ seems to be
> ok with this.
> >
> > The ideal solution most likely would be to instead *statically*
> > link against RegLoadMUIStringW() from advapi32_vista when
> WINNT=0x502.
> > For now the stuff runs again at least.
> > I left the func existing in advapi32_vista.dll.
> > ---
> >  dll/cpl/desk/CMakeLists.txt  |   6 +-
> >  dll/cpl/desk/desk.h  |   9 ++
> >  dll/cpl/desk/muireg.c| 144 ++
> >  dll/win32/shell32/CMakeLists.txt |   3 +-
> >  dll/win32/shell32/vista.c| 218
> +++
> >  5 files changed, 375 insertions(+), 5 deletions(-)
> >
> > diff --git a/dll/cpl/desk/CMakeLists.txt b/dll/cpl/desk/CMakeLists.txt
> > index 24d9bb1e60..ae7fb83825 100644
> > --- a/dll/cpl/desk/CMakeLists.txt
> > +++ b/dll/cpl/desk/CMakeLists.txt
> > @@ -2,9 +2,6 @@
> >  add_definitions(-D_WIN32)
> >  spec2def(desk.cpl desk.spec)
> >
> > -remove_definitions(-D_WIN32_WINNT=0x502)
> > -add_definitions(-D_WIN32_WINNT=0x600)
> > -
> >  list(APPEND SOURCE
> >  advmon.c
> >  appearance.c
> > @@ -23,6 +20,7 @@ list(APPEND SOURCE
> >  general.c
> >  draw.c
> >  theme.c
> > +muireg.c
> >  desk.h)
> >
> >  file(GLOB desk_rc_deps resources/*.*)
> > @@ -36,6 +34,6 @@ add_library(desk SHARED
> >
> >  set_module_type(desk cpl UNICODE)
> >  target_link_libraries(desk uuid)
> > -add_importlibs(desk user32 advapi32 advapi32_vista gdi32 comctl32
> comdlg32 ole32 setupapi shell32 shlwapi uxtheme gdiplus msvcrt kernel32
> ntdll)
> > +add_importlibs(desk user32 advapi32 gdi32 comctl32 comdlg32 ole32
> setupapi shell32 shlwapi uxtheme gdiplus msvcrt kernel32 ntdll)
> >  add_pch(desk desk.h SOURCE)
> >  add_cd_file(TARGET desk DESTINATION reactos/system32 FOR all)
> > diff --git a/dll/cpl/desk/desk.h b/dll/cpl/desk/desk.h
> > index 3bb02f3a74..3c479251cf 100644
> > --- a/dll/cpl/desk/desk.h
> > +++ b/dll/cpl/desk/desk.h
> > @@ -122,4 +122,13 @@ HPSXA WINAPI
> SHCreatePropSheetExtArrayEx(HKEY,LPCWSTR,UINT,IDataObject*);
> >  INT_PTR CALLBACK
> >  AdvGeneralPageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM
> lParam);
> >
> > +LONG
> > +RegLoadMUIStringW(IN HKEY hKey,
> > +  IN LPCWSTR pszValue  OPTIONAL,
> > +  OUT LPWSTR pszOutBuf,
> > +  IN DWORD cbOutBuf,
> > +  OUT LPDWORD pcbData OPTIONAL,
> > +  IN DWORD Flags,
> > +  IN LPCWSTR pszDirectory  OPTIONAL);
> > +
> >  #endif /* _DESK_H */
> > diff --git a/dll/cpl/desk/muireg.c b/dll/cpl/desk/muireg.c
> > new file mode 100644
> > index 00..8754b43655
> > --- /dev/null
> > +++ b/dll/cpl/desk/muireg.c
> > @@ -0,0 +1,144 @@
> > +#include "desk.h"
> > +
> >
> +/**
> > + * load_string [Internal]
> > + *
> > + * This is basically a copy of user32/resource.c's LoadStringW.
> Necessary to
> > + * avoid importing user32, which is higher level than advapi32. Helper
> for
> > + * RegLoadMUIString.
> > + */
> > +static int load_string(HINSTANCE hModule, UINT resId, LPWSTR
> pwszBuffer, INT cMaxChars)
> > +{
> > +HGLOBAL hMemory;
> > +HRSRC hResource;
> > +WCHAR *pString;
> > +int idxString;
> > +
> > +/* Negative values have to be inverted. */
> > +if (HIWORD(resId) == 0x)
> > +resId = (UINT)(-((INT)resId));
> > +
> > +/* Load the resource into memory and get a pointer to it. */
> > +hResource = FindResourceW(hModule, MAKEINTRESOURCEW(LOWORD(resId >>
> 4) + 1), (LPWSTR)RT_STRING);
> > +if (!hResource) return 0;
> > +hMemory = LoadResource(hModule, hResource);
> > +if (!hMemory) return 0;
> > +pString = LockResource(hMemory);
> > +
> > +/* Strings are length-prefixed. Lowest nibble of resId 

Re: [ros-dev] [ros-diffs] [reactos] 01/01: [DESK][SHELL32] Allow Desk.cpl to run standalone on WinXP/2003 again CORE-15412

2018-12-17 Thread Pierre Schweitzer
Hi,

I definitely don't like that commit, nor appreciate the way it was done.
If we read CORE-15412 carefully, we have three developers (namely:
Thomas, Mark, Giannis) expressing that they are again this revert, and
thus this commit.
Then, why was it pushed to HEAD?

Cheers,
Pierre

Le 17/12/2018 à 22:02, Joachim Henze a écrit :
> https://git.reactos.org/?p=reactos.git;a=commitdiff;h=6f8cb05cad142a8679872e695f317dc1f9728d55
> 
> commit 6f8cb05cad142a8679872e695f317dc1f9728d55
> Author: Joachim Henze 
> AuthorDate: Mon Dec 17 22:01:49 2018 +0100
> Commit: Joachim Henze 
> CommitDate: Mon Dec 17 22:01:49 2018 +0100
> 
> [DESK][SHELL32] Allow Desk.cpl to run standalone on WinXP/2003 again 
> CORE-15412
> 
> addendum to 0.4.10-dev-502-g
> d559ca9c982f9766acc5db3ea887ef2bc27acdff
> 
> That copy-paste was done once intentionally to keep our imports similar 
> to 2003.
> It's worth reading the conversation in PR #748: Getequ seems to be ok 
> with this.
> 
> The ideal solution most likely would be to instead *statically*
> link against RegLoadMUIStringW() from advapi32_vista when WINNT=0x502.
> For now the stuff runs again at least.
> I left the func existing in advapi32_vista.dll.
> ---
>  dll/cpl/desk/CMakeLists.txt  |   6 +-
>  dll/cpl/desk/desk.h  |   9 ++
>  dll/cpl/desk/muireg.c| 144 ++
>  dll/win32/shell32/CMakeLists.txt |   3 +-
>  dll/win32/shell32/vista.c| 218 
> +++
>  5 files changed, 375 insertions(+), 5 deletions(-)
> 
> diff --git a/dll/cpl/desk/CMakeLists.txt b/dll/cpl/desk/CMakeLists.txt
> index 24d9bb1e60..ae7fb83825 100644
> --- a/dll/cpl/desk/CMakeLists.txt
> +++ b/dll/cpl/desk/CMakeLists.txt
> @@ -2,9 +2,6 @@
>  add_definitions(-D_WIN32)
>  spec2def(desk.cpl desk.spec)
>  
> -remove_definitions(-D_WIN32_WINNT=0x502)
> -add_definitions(-D_WIN32_WINNT=0x600)
> -
>  list(APPEND SOURCE
>  advmon.c
>  appearance.c
> @@ -23,6 +20,7 @@ list(APPEND SOURCE
>  general.c
>  draw.c
>  theme.c
> +muireg.c
>  desk.h)
>  
>  file(GLOB desk_rc_deps resources/*.*)
> @@ -36,6 +34,6 @@ add_library(desk SHARED
>  
>  set_module_type(desk cpl UNICODE)
>  target_link_libraries(desk uuid)
> -add_importlibs(desk user32 advapi32 advapi32_vista gdi32 comctl32 comdlg32 
> ole32 setupapi shell32 shlwapi uxtheme gdiplus msvcrt kernel32 ntdll)
> +add_importlibs(desk user32 advapi32 gdi32 comctl32 comdlg32 ole32 setupapi 
> shell32 shlwapi uxtheme gdiplus msvcrt kernel32 ntdll)
>  add_pch(desk desk.h SOURCE)
>  add_cd_file(TARGET desk DESTINATION reactos/system32 FOR all)
> diff --git a/dll/cpl/desk/desk.h b/dll/cpl/desk/desk.h
> index 3bb02f3a74..3c479251cf 100644
> --- a/dll/cpl/desk/desk.h
> +++ b/dll/cpl/desk/desk.h
> @@ -122,4 +122,13 @@ HPSXA WINAPI 
> SHCreatePropSheetExtArrayEx(HKEY,LPCWSTR,UINT,IDataObject*);
>  INT_PTR CALLBACK
>  AdvGeneralPageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
>  
> +LONG
> +RegLoadMUIStringW(IN HKEY hKey,
> +  IN LPCWSTR pszValue  OPTIONAL,
> +  OUT LPWSTR pszOutBuf,
> +  IN DWORD cbOutBuf,
> +  OUT LPDWORD pcbData OPTIONAL,
> +  IN DWORD Flags,
> +  IN LPCWSTR pszDirectory  OPTIONAL);
> +
>  #endif /* _DESK_H */
> diff --git a/dll/cpl/desk/muireg.c b/dll/cpl/desk/muireg.c
> new file mode 100644
> index 00..8754b43655
> --- /dev/null
> +++ b/dll/cpl/desk/muireg.c
> @@ -0,0 +1,144 @@
> +#include "desk.h"
> +
> +/**
> + * load_string [Internal]
> + *
> + * This is basically a copy of user32/resource.c's LoadStringW. Necessary to
> + * avoid importing user32, which is higher level than advapi32. Helper for
> + * RegLoadMUIString.
> + */
> +static int load_string(HINSTANCE hModule, UINT resId, LPWSTR pwszBuffer, INT 
> cMaxChars)
> +{
> +HGLOBAL hMemory;
> +HRSRC hResource;
> +WCHAR *pString;
> +int idxString;
> +
> +/* Negative values have to be inverted. */
> +if (HIWORD(resId) == 0x)
> +resId = (UINT)(-((INT)resId));
> +
> +/* Load the resource into memory and get a pointer to it. */
> +hResource = FindResourceW(hModule, MAKEINTRESOURCEW(LOWORD(resId >> 4) + 
> 1), (LPWSTR)RT_STRING);
> +if (!hResource) return 0;
> +hMemory = LoadResource(hModule, hResource);
> +if (!hMemory) return 0;
> +pString = LockResource(hMemory);
> +
> +/* Strings are length-prefixed. Lowest nibble of resId is an index. */
> +idxString = resId & 0xf;
> +while (idxString--) pString += *pString + 1;
> +
> +/* If no buffer is given, return length of the string. */
> +if (!pwszBuffer) return *pString;
> +
> +/* Else copy over the string, respecting the buffer size. */
> +cMaxChars = (*pString < cMaxChars) ? *pString : (cMaxChars - 1);
> +if (cMaxChars >=