notepad-plus-plus / wingup

WinGup - Generic Updater for Windows
http://wingup.org/
GNU Lesser General Public License v3.0
47 stars 31 forks source link

VERY difficult to diagnose an exception in GUP.exe, with an unspecified environment TEMP variable! #16

Closed jurekl closed 2 years ago

jurekl commented 2 years ago

Today I tried to search and install the plugin for NPP. It did not manage, ever, each time the error message appeared in Wingup. Of course, as in M$ Windows, without any details. I had to download the sources and compile the Debug version, which with the help of Debugger vs2017 helped to determine the cause of unpleasant surprise.

After setting the TEMP environment variable, without any changes to the source code, everything started working as it should.

The case is prosaic. In the WinMain.cpp file, there is a fragment in a row 1074:

// Install
 std::wstring dlDest = _wgetenv(L"TEMP"); <=== Here !!!

String constructor with NULL ... we know how it ends :-(

It so happened that for a few days the env variableTEMP is indefinite for me (I moved the TEMP catalog to another drive!), It was enough to immobilize the functionality of GUP !! :-(

mere-human commented 2 years ago

Can you provide the debug info?

mere-human commented 2 years ago

But anyway it is quite unusual to see TEMP undefined.

jurekl commented 2 years ago

It just so happened that on my computer, this variable had been undefined for several days. I think some (negligible) percentage of Windows machines may also have this situation, right? I think it is MORE important that thanks to this, I detected an unhandled exception that is a consequence of a NULL pointer in the code. I forgot the content of the error messages. They were rather stupid and not specific, like at Microsoft! Something that the program ended suddenly, as if I didn't know it myself :-( So I checked the situation live, in Visual Studio, after compiling the debug version of gup.exe. I checked and confirmed the diagnosis that the lack of the TEMP variable causes the program to crash. I thought this information would be useful to the developers of the program. If not, forget about this issue. Regards!

P.S.

By chance, I managed to dig up this report:

Version=1
EventType=APPCRASH
EventTime=132745388252572723
ReportType=2
Consent=1
ReportIdentifier=6e031ac4-072d-11ec-a5b2-c8ce9cb76f75
IntegratorReportIdentifier=6e031ac3-072d-11ec-a5b2-c8ce9cb76f75
WOW64=1
Response.type=4
Sig[0].Name=Nazwa aplikacji
Sig[0].Value=gup.exe
Sig[1].Name=Wersja aplikacji
Sig[1].Value=5.2.0.0
Sig[2].Name=Sygnatura czasowa aplikacji
Sig[2].Value=60a2a633
Sig[3].Name=Nazwa modułu z błędem
Sig[3].Value=gup.exe
Sig[4].Name=Wersja modułu z błędem
Sig[4].Value=5.2.0.0
Sig[5].Name=Sygnatura czasowa modułu z błędem
Sig[5].Value=60a2a633
Sig[6].Name=Kod wyjątku
Sig[6].Value=c0000005
Sig[7].Name=Przesunięcie wyjątku
Sig[7].Value=000116a2
DynamicSig[1].Name=Wersja systemu operacyjnego
DynamicSig[1].Value=6.1.7601.2.1.0.256.48
DynamicSig[2].Name=Identyfikator ustawień regionalnych
DynamicSig[2].Value=1045
DynamicSig[22].Name=Dodatkowe informacje 1
DynamicSig[22].Value=0a9e
DynamicSig[23].Name=Dodatkowe informacje 2
DynamicSig[23].Value=0a9e372d3b4ad19135b953a78882e789
DynamicSig[24].Name=Dodatkowe informacje 3
DynamicSig[24].Value=0a9e
DynamicSig[25].Name=Dodatkowe informacje 4
DynamicSig[25].Value=0a9e372d3b4ad19135b953a78882e789
UI[2]=D:\Program Files (x86)\Notepad++.port\updater\gup.exe
UI[3]=Program WinGup for Notepad++ przestał działać.
UI[4]=System Windows może wyszukać rozwiązanie tego problemu w trybie online.
UI[5]=Wyszukaj rozwiązanie w trybie online i zamknij program
UI[6]=Wyszukaj rozwiązanie w trybie online później i zamknij program
UI[7]=Zamknij program
LoadedModule[0]=D:\Program Files (x86)\Notepad++.port\updater\gup.exe
LoadedModule[1]=C:\Windows\SysWOW64\ntdll.dll
LoadedModule[2]=C:\Windows\syswow64\kernel32.dll
LoadedModule[3]=C:\Windows\syswow64\KERNELBASE.dll
LoadedModule[4]=D:\Program Files (x86)\Notepad++.port\updater\libcurl.dll
LoadedModule[5]=C:\Windows\syswow64\WS2_32.dll
LoadedModule[6]=C:\Windows\syswow64\msvcrt.dll
LoadedModule[7]=C:\Windows\syswow64\RPCRT4.dll
LoadedModule[8]=C:\Windows\syswow64\SspiCli.dll
LoadedModule[9]=C:\Windows\syswow64\CRYPTBASE.dll
LoadedModule[10]=C:\Windows\SysWOW64\sechost.dll
LoadedModule[11]=C:\Windows\syswow64\NSI.dll
LoadedModule[12]=C:\Windows\syswow64\WLDAP32.dll
LoadedModule[13]=C:\Windows\syswow64\ADVAPI32.dll
LoadedModule[14]=C:\Windows\syswow64\Normaliz.dll
LoadedModule[15]=C:\Windows\syswow64\CRYPT32.dll
LoadedModule[16]=C:\Windows\syswow64\MSASN1.dll
LoadedModule[17]=C:\Windows\WinSxS\x86_microsoft.windows.common-controls_6595b64144ccf1df_6.0.7601.24483_none_2b200f664577e14b\COMCTL32.dll
LoadedModule[18]=C:\Windows\syswow64\GDI32.dll
LoadedModule[19]=C:\Windows\syswow64\USER32.dll
LoadedModule[20]=C:\Windows\syswow64\LPK.dll
LoadedModule[21]=C:\Windows\syswow64\USP10.dll
LoadedModule[22]=C:\Windows\syswow64\SHLWAPI.dll
LoadedModule[23]=C:\Windows\syswow64\SHELL32.dll
LoadedModule[24]=C:\Windows\system32\api-ms-win-core-synch-l1-2-0.DLL
LoadedModule[25]=C:\Windows\system32\IMM32.DLL
LoadedModule[26]=C:\Windows\syswow64\MSCTF.dll
LoadedModule[27]=C:\Windows\SysWOW64\nvinit.dll
LoadedModule[28]=C:\Program Files (x86)\NVIDIA Corporation\CoProcManager\detoured.dll
LoadedModule[29]=C:\Program Files (x86)\NVIDIA Corporation\CoProcManager\nvd3d9wrap.dll
LoadedModule[30]=C:\Windows\syswow64\SETUPAPI.dll
LoadedModule[31]=C:\Windows\syswow64\CFGMGR32.dll
LoadedModule[32]=C:\Windows\syswow64\OLEAUT32.dll
LoadedModule[33]=C:\Windows\syswow64\ole32.dll
LoadedModule[34]=C:\Windows\syswow64\DEVOBJ.dll
LoadedModule[35]=C:\Program Files (x86)\NVIDIA Corporation\CoProcManager\nvdxgiwrap.dll
FriendlyEventName=Zatrzymano działanie.
ConsentKey=APPCRASH
AppName=WinGup for Notepad++
AppPath=D:\Program Files (x86)\Notepad++.port\updater\gup.exe
mere-human commented 2 years ago

@jurekl Do you have other variables set? Like TMP or APPDATA? This can be checked if you open ⊞ Win > cmd and type set. It will show you all your environment variables. I'm just thinking of alternatives to TEMP.

jurekl commented 2 years ago

@mere-human, thank you, I'm fine! I explained everything in detail in the first post. While experimenting with the drive / directory for temporary files (several days ago),, I deleted the TEMP + TMP definition ... and forgot about it. Yesterday I set its value again and thus eliminated the occurrence of NULL pointer in the gup code. only benefits were the result :-) However, I suggest checking the mandatory return values from API functions, like here:

std::wstring dlDest = _wgetenv(L"TEMP");

to avoid unpleasant surprises like in this case :-)

I'm finishing my adventure with searching for this error, I hope I helped! Hello, best regards!

mere-human commented 2 years ago

to avoid unpleasant surprises like in this case :-)

I've already came up with a fix.

I'm finishing my adventure with searching for this error, I hope I helped!

Thank you for finding this out and reporting it here!

mere-human commented 2 years ago

By the way, if auto-update failed for some reason, it is always possible to download the installer manually: https://notepad-plus-plus.org/downloads/

jurekl commented 2 years ago

Thank you for finding this out and reporting it here!

Thanks for your cooperation, all the best!

donho commented 2 years ago

@jurekl @mere-human How can I reproduce the crash? I have removed TMP & TEMP from env :

image

But I can still update from v8.1.3 to v8.1.4 with no problem.

mere-human commented 2 years ago

How can I reproduce the crash?

See steps in PR. Use Visual Studio.

jurekl commented 2 years ago

Hi, I detected the error when trying to install the notepad ++ plugin, not updating the NPP itself. With the TEMP variable missing, this resulted in the errors described previously.

I have just done a retest / confirmation test. In the environment variable editor (Win7), I changed TEMP ==> TEMP__, after trying to install any NPP plugin. It cannot be done due to the error described above. image