Issue 1:
Hi, I'm trying to use getAllDisplays() API under Windows and I have a very strange behaviour.

Code:

const screen = require('electron').screen
const arr = screen.getAllDisplays()
console.log(arr)

Use case:

Start the electron app

Call the above code

I get the monitor array in the output

I change the resolution/disable external monitor/etc

I re run the code of above (without relaunching the electron app)

I obtain the same output of the point 3), nothing changed. (in some case I get duplicate monitors)

Under OSX there's no problem.

I guess this problem is related to #3075.

In conclusion, work with the screen API under Windows is basically impossible.

Electron version: 0.37.4

Operating system: Windows

Issue 2:
Preflight Checklist

I have read the Contributing Guidelines for this project.

I agree to follow the Code of Conduct that this project adheres to.

I have searched the issue tracker for an issue that matches the one I want to file, without success.

Issue Details

Electron Version:

5.0.x

Operating System:

Windows

Last Known Working Electron version:

4.2.6

Expected Behavior

The PE "time date stamp" compiled into electron.exe is the ~"unix epoch timestamp" when electron was compiled (specifically, when the .exe was generated by the compiler/linker).

Actual Behavior

Starting in Electron 5.0.0-beta.1 and to latest 5.x, the PE timestamp embedded in the electron.exe final build output seems to be some kind of pre-generated number, possibly based on my checkout date (when doing custom builds)? It seems that the latest 4.x build (4.2.6) might work correctly, so this maybe was introduced in 5.x. I have no idea if it's due to chrome or electron build system specifically?

Here is a partial list of some historical builds I had on my machine (some also come from official electron builds). Pay special attention to the more recent builds' timestamps:

E.g., for /F %i in ('dir electron.exe/a/s/b') do @dumpbin /headers %i | findstr /C:"time date stamp" && echo %i

56AC4993 time date stamp Fri Jan 29 21:26:43 2016 electron-0.36.7\electron.exe
57F60AB8 time date stamp Thu Oct 6 01:26:32 2016 electron143\electron.exe

58753971 time date stamp Tue Jan 10 11:43:45 2017 electron1414\electron.exe
58878D77 time date stamp Tue Jan 24 09:23:03 2017 electron150\electron.exe
5898AEF2 time date stamp Mon Feb 6 09:14:26 2017 electron151\electron.exe
58992869 time date stamp Mon Feb 6 17:52:41 2017 electron160\electron.exe
58DEADD3 time date stamp Fri Mar 31 12:28:19 2017 electron165\electron.exe
5939BCEF time date stamp Thu Jun 8 14:09:03 2017 electron173\electron.exe
59DE5A37 time date stamp Wed Oct 11 10:51:51 2017 electron1615\electron.exe
5A21F071 time date stamp Fri Dec 1 16:14:41 2017 electron1823\electron.exe
5A21F078 time date stamp Fri Dec 1 16:14:48 2017 e182\electron.exe

5A665B0A time date stamp Mon Jan 22 13:43:38 2018 electron1711\electron.exe
5A66A39B time date stamp Mon Jan 22 18:53:15 2018 electron1824\electron.exe
5A7213D6 time date stamp Wed Jan 31 11:07:02 2018 electron1825\electron.exe
5A722031 time date stamp Wed Jan 31 11:59:45 2018 electron1712\electron.exe
5A7A2A0A time date stamp Tue Feb 6 14:19:54 2018 electron182-release\electron.exe
5ABAAD0C time date stamp Tue Mar 27 13:43:56 2018 electron200\electron.exe
5BDB4BCC time date stamp Thu Nov 1 11:54:04 2018 electron306\electron.exe
5BF32835 time date stamp Mon Nov 19 13:16:37 2018 electron3010-64\electron.exe
5BFE35B4 time date stamp Tue Nov 27 22:29:08 2018 electron3010-32\electron.exe
5C1B39D3 time date stamp Wed Dec 19 22:42:27 2018 e3013-32\electron.exe
5C1B8D30 time date stamp Thu Dec 20 04:38:08 2018 e3013-64\electron.exe
5C1BED9A time date stamp Thu Dec 20 11:29:30 2018 e400\electron.exe

5C342E50 time date stamp Mon Jan 7 21:00:00 2019 e500-b1\electron.exe
5C61F745 time date stamp Mon Feb 11 14:29:25 2019 e3015-64-rc.1\electron.exe
5C737650 time date stamp Sun Feb 24 21:00:00 2019 e500-b4\electron.exe
5C82EFC5 time date stamp Fri Mar 8 14:42:13 2019 e3016-32-rc.1\electron.exe
5C832872 time date stamp Fri Mar 8 18:44:02 2019 e3016-64-rc.1\electron.exe
5C91C8D0 time date stamp Tue Mar 19 22:00:00 2019 e500-b6\electron.exe
5C931A50 time date stamp Wed Mar 20 22:00:00 2019 e5-old\electron.exe
5C9B0350 time date stamp Tue Mar 26 22:00:00 2019 e500-b7\electron.exe
5CB6B2D0 time date stamp Tue Apr 16 22:00:00 2019 e5-64\electron.exe
5CC53350 time date stamp Sat Apr 27 22:00:00 2019 e500-64-rc.1\electron.exe
5CC53350 time date stamp Sat Apr 27 22:00:00 2019 e500-64-rc.2\electron.exe
5CC53350 time date stamp Sat Apr 27 22:00:00 2019 e500-64-rc.3\electron.exe

5CC684D0 time date stamp Sun Apr 28 22:00:00 2019 e5-32-working\electron.exe
5CE4D750 time date stamp Tue May 21 22:00:00 2019 e502-32-rc.1\electron.exe
5CE4D750 time date stamp Tue May 21 22:00:00 2019 e502-64-rc.1\electron.exe
5CE4D750 time date stamp Tue May 21 22:00:00 2019 e502-64-rc.2\electron.exe
5CE4D750 time date stamp Tue May 21 22:00:00 2019 e502-64-rc.3\electron.exe
5CE4D750 time date stamp Tue May 21 22:00:00 2019 e502-64-rc.5\electron.exe
5D12FBD0 time date stamp Tue Jun 25 22:00:00 2019 electron506\electron.exe
5D1A879B time date stamp Mon Jul 1 15:22:19 2019 e426\electron.exe
5D22CDD0 time date stamp Sun Jul 7 22:00:00 2019 e506-32\electron.exe
5D22CDD0 time date stamp Sun Jul 7 22:00:00 2019 e506-64\electron.exe
5D22CDD0 time date stamp Sun Jul 7 22:00:00 2019 e506\electron.exe
5D241F50 time date stamp Mon Jul 8 22:00:00 2019 e506b-64\electron.exe

Strangely, all the electron 5 builds have a "time" of exactly 22:00:00 (except outside DST where it has 21:00:00). The dates vary from build to build. HOWEVER, if I check out a build, build it, then a week later make changes and rebuild the same checkout, the date stays the same. For example, all the e500 and e502 builds above have the same date. This is despite:

05/31/2019 11:14 AM 99,663,168 e502-64-rc.1\electron.exe
06/06/2019 03:32 PM 99,663,168 e502-64-rc.2\electron.exe
06/06/2019 04:27 PM 99,663,168 e502-64-rc.3\electron.exe
06/13/2019 03:49 PM 99,663,680 e502-64-rc.5\electron.exe

The actual compile time being very different (over a couple weeks). It seems that when I update the exe, it reuses some old pre-generated timestamp. Additionally, if I delete electron.exe and rebuild, I still get the old timestamp (not sure if incremental linking would be a thing there, but at the very least, deleting just the .exe was not enough to produce a new build timestamp).

To Reproduce

Check out and build Electron 5 on Windows. Observe that the PE timestamp (dumpbin /headers) has an exact minute/second of 00:00, which is weird. If you wait a day or longer, and rebuild, the time/date stamp will be identical, even though the day has changed.

Additional Information

Why this is important to us: When we build Electron, we store symbols for each build of Electron so that we can investigate crash dumps and the like. In Windows, symbols/dumps use the PE image timedatestamp+sizeofimage as a "key" to uniquely identify every build. .dmp files specifically include this key so that debuggers can find the correct .exe/.dll and from there find the associated .pdb file. Because of this issue, the "key" is no longer unique and is being reused between Electron builds. This causes our PE symbol store to be overwritten with the wrong files and so older PDB files become orphaned and unusable. End result: This means we can't properly debug crashes.

We also prefer if possible to not do a full checkout+rebuild of Electron (as that takes a significant amount of time) and we're usually rebuilding due to fixing bugs/security issues (small changes that are very fast to make and recompile). Also, if we do more than one build in a day (since the build timestamps seem to be quantized to "day"), then we get trashed symbols even if we do have separate clean checkouts.