Skip to content

Fix startup error on Windows XP caused by SHCreateItemFromParsingName#9412

Closed
mere-human wants to merge 1 commit intonotepad-plus-plus:masterfrom
mere-human:issue-9378-win-xp
Closed

Fix startup error on Windows XP caused by SHCreateItemFromParsingName#9412
mere-human wants to merge 1 commit intonotepad-plus-plus:masterfrom
mere-human:issue-9378-win-xp

Conversation

@mere-human
Copy link
Contributor

Load shell32.dll and resolve the necessary symbol at runtime.
This makes it possible to run the app on Windows XP.

Address discussion comments in issue #9378

Load shell32.dll and resolve the necessary symbol at runtime.
This makes it possible to run the app on Windows XP.

Address discussion comments in issue notepad-plus-plus#9378
@Uhf7
Copy link
Contributor

Uhf7 commented Jan 19, 2021

I don't think it is necessary to go this way, if we drop XP support anyway.

But another question arises here. If we drop XP support for one of the most interesting base functions of the software (saving files), then perhaps it would be good not to start Notepad++ under XP at all.

@ArkadiuszMichalski
Copy link
Contributor

ArkadiuszMichalski commented Jan 19, 2021

If some critical things no longer work under XP, an alert should pop up as to inform which latest version working under this system and the program should be closed (not to cause damage).

@mere-human
Copy link
Contributor Author

If we drop XP support for one of the most interesting base functions of the software (saving files), then perhaps it would be good not to start Notepad++ under XP at all.

For now, only some places are affected like the dialog from File > Save Session.
But we can come up with a workaround. For example, we can show FileDialog that uses GetSaveFileName on Windows XP.

@Uhf7
Copy link
Contributor

Uhf7 commented Jan 19, 2021

an alert should pop up as to inform which latest version working under this system

This would be ideal, but the problem here is, that in order to show such a message box under XP, we have to assure, that no post-XP function is used without a LoadLibrary wrap around. As soon as one post-XP function is used in the natural way, then Notepad++ would stop working before showing such a message box.

To load all post-XP functions at run time with LoadLibrary, seems not practicable to me. In so far, the system error Notepad++ cannot load SHCr... message box was not too bad at all. It assures that the user cannot start Notepad++ accidentally.

For now, only some places are affected like the dialog from File > Save Session.
But we can come up with a workaround. For example, we can show FileDialog that uses GetSaveFileName on Windows XP.

I think, all of the load/save file dialogs will follow sooner or later, and over the long run, it will not be easy to maintain and test 3 versions of each dialog every time. Since the new style file dialogs have some advantages, it would be better and more future-save to drop XP like suggested here #9378 (comment) and focus on a single implementation of each load/save dialog.

@ArkadiuszMichalski
Copy link
Contributor

I open separate bug #9423 because support for older systems appears in other bugs and it is worth having a clear position on this matter.

@sasumner
Copy link
Contributor

it will not be easy to maintain and test 3 versions of each dialog every time

+1

@donho donho self-assigned this Jan 19, 2021
@donho
Copy link
Member

donho commented Jan 20, 2021

It took time to download & install XP SP3 and configure VirtualBox to make file transfer working from host to client.
Anyway, I finally did some tests with this PR under XP.

The test code contains :
1) this PR
2) revert of 45912a3
3) 051b17c

But since 2) is revert, due to symbol COPY_FILE_NO_BUFFERING in 3), I have had to add A or B into NppIO.cpp :

A

#if defined(_WIN32_WINNT) && (!defined(_WIN32_WINNT_VISTA) || (_WIN32_WINNT < _WIN32_WINNT_VISTA))
#undef _WIN32_WINNT
#define _WIN32_WINNT _WIN32_WINNT_VISTA
#endif

B

#ifndef COPY_FILE_NO_BUFFERING
#define COPY_FILE_NO_BUFFERING                0x00001000
#endif

The result with B works fine, Notepad++ is launched without any problem, whereas the result with A crashed.

Conclusion: If both A & B worked, I would include this PR and keep making Notepad++ running under XP, because this compact PR (little effort) can make these prehistoric people happy.
The failure (with A) reminds us that keeping supporting very old OS will decrease our code quality.
So XP will be dropped in the next release. Thank you @mere-human for your effort (still).

@donho donho closed this Jan 20, 2021
@sasumner
Copy link
Contributor

So XP will be dropped in the next release.

If only I could believe that this is a FINAL decision. :-)

Thank you @mere-human for your effort (still).

Remember, it was mere-human that started this whole thing, what with those fancy new dialogs.
...which is nothing but praise for mere-human because the new dialogs are great!

@mere-human
Copy link
Contributor Author

Remember, it was mere-human that started this whole thing, what with those fancy new dialogs.
...which is nothing but praise for mere-human because the new dialogs are great!

I plan to go on 🙂

@mere-human mere-human deleted the issue-9378-win-xp branch January 23, 2021 20:54
@mere-human mere-human restored the issue-9378-win-xp branch January 23, 2021 20:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants