Windows 7 Calling CopyFileEx with the COPY_FILE_NOBUFFERING flag no longer works; it HANGS the computer

  • Thread starter Thread starter DennisAd
  • Start date Start date
D

DennisAd

This month, MS released KB3121255. One of the two problems it's said to solve: When you call the CopyFileEx function together with the COPY_FILE_NO_BUFFERING option to copy files on a read-only volume in Windows Server 2012, Volume Shadow Copy Service (VSS) backup of the PI Data server fails with an "ERROR_INVALID_PARAMETER" error message.


I started running into CopyFileEx + COPY_FILE_NO_BUFFERING problems in the past few days. It is part of a supercharged version of Replace.exe that I've been using and enhancing for years. Because I wanted to see when each file was actually COPIED successfully, I was always turning off COPY_FILE_NO_BUFFERING. I tried using my Replace code today, and as soon as it notified me it was copying, it hangs HARD. So I loaded it into the debugger and instrumented it like crazy, focusing especially on the CopyFileEx calls. These calls are happening on a single computer, though I also use Replace to update software on other Win 7 machines (32 & 64-bit) on my home network.


Sure enough, CopyFileEx is where it is hanging. Let me define hanging for you (Replace is a console app):

  1. Make CopyFileEx call with the COPY_FILE_NO_BUFFERING option (btw, my code tests the OS version to ensure the option is supported before using it).
  2. The sytem STOPS dead; if I try to open another command prompt, that hangs too.
  3. Use Ctrl-Alt-Break to break into the debugger (running under VS 2012). It breaks out, and notes the system is deadlocked. It is so deadlocked that you cannot even force a shutdown. VS works fine, and I can see the call stack, variables in the source files, etc. While I can close several apps, including VS, the Replace app launched by VS won't go anywhere. You must hold the PCs power button down to do a forced power-off, then power back on again.

I installed KB3121255 hoping it would cure the problem, but it did not. To try to learn more about when/where it hangs, I then coded a CopyProgressRoutine() callback so I could see a bit more about what Windows was doing before it choked and hung hard. For those familiar with CopyProgressRoutines, I was able to see a single entry, notifying me of the very first data stream. Not ready to copy data, just notifying the Callback that a stream has been found. As soon as I return from CopyProgressRoutine() to the OS, it is over. Deadlocked & hung.


When I no longer use the COPY_FILE_NO_BUFFERING option, this all goes away. I am tired and have no more time for testing (almost 5am and I've been chasing this down for the last 7 hours -- when you have to reboot several times it really drags things out).


HEY MICROSOFT: I hope someone will look into this. KB3121255 DID NOT fix this issue in Windows 7!


thanks ...


- dennis


I am running Windows 7 x64 SP1. I install all security updates as they come out, and some optional ones as well (like KB3121255). Here is a SYSTEMINFO run, in case that is helpful:

Host Name: DENNIS
OS Name: Microsoft Windows 7 Professional
OS Version: 6.1.7601 Service Pack 1 Build 7601
OS Manufacturer: Microsoft Corporation
OS Configuration: Standalone Workstation
OS Build Type: Multiprocessor Free
Registered Owner: dennis
Registered Organization:
Product ID: 00371-177-6350957-85666
Original Install Date: 4/27/2011, 8:52:36 PM
System Boot Time: 4/12/2016, 3:51:11 AM
System Manufacturer: Lenovo
System Model: IdeaCentre K330
System Type: x64-based PC
Processor(s): 1 Processor(s) Installed.
[01]: Intel64 Family 6 Model 42 Stepping 7 GenuineIntel ~2584 Mhz
BIOS Version: LENOVO DKKT18AUS, 2/15/2011
Windows Directory: C:\windows
System Directory: C:\windows\system32
Boot Device: \Device\HarddiskVolume1
System Locale: en-us;English (United States)
Input Locale: en-us;English (United States)
Time Zone: (UTC-08:00) Pacific Time (US & Canada)
Total Physical Memory: 12,271 MB
Available Physical Memory: 8,899 MB
Virtual Memory: Max Size: 24,539 MB
Virtual Memory: Available: 20,715 MB
Virtual Memory: In Use: 3,824 MB
Page File Location(s): C:\pagefile.sys
Domain: HOME
Logon Server: \\DENNIS
Hotfix(s): 413 Hotfix(s) Installed.
[01]: KB2849697
[02]: KB2849696
[03]: KB2841134
[04]: KB2670838
[05]: KB2830477
[06]: KB2592687
[07]: KB971033
[08]: KB958559
[09]: KB2305420
[10]: KB2393802
[11]: KB2479943
[12]: KB2491683
[13]: KB2492386
[14]: KB2506014
[15]: KB2506212
[16]: KB2506928
[17]: KB2509553
[18]: KB2511455
[19]: KB2515325
[20]: KB2533552
[21]: KB2534366
[22]: KB2536275
[23]: KB2536276
[24]: KB2541014
[25]: KB2544893
[26]: KB2545698
[27]: KB2547666
[28]: KB2552343
[29]: KB2556532
[30]: KB2560656
[31]: KB2563227
[32]: KB2564958
[33]: KB2570947
[34]: KB2574819
[35]: KB2579686
[36]: KB2584146
[37]: KB2585542
[38]: KB2603229
[39]: KB2604115
[40]: KB2619339
[41]: KB2620704
[42]: KB2621440
[43]: KB2631813
[44]: KB2639308
[45]: KB2640148
[46]: KB2644615
[47]: KB2645640
[48]: KB2647753
[49]: KB2653956
[50]: KB2654428
[51]: KB2660075
[52]: KB2661254
[53]: KB2664825
[54]: KB2667402
[55]: KB2676562
[56]: KB2679255
[57]: KB2685811
[58]: KB2685813
[59]: KB2685939
[60]: KB2690533
[61]: KB2698365
[62]: KB2699779
[63]: KB2705219
[64]: KB2709630
[65]: KB2709715
[66]: KB2709981
[67]: KB2712808
[68]: KB2718704
[69]: KB2719857
[70]: KB2724197
[71]: KB2726535
[72]: KB2727528
[73]: KB2729094
[74]: KB2729452
[75]: KB2732059
[76]: KB2732487
[77]: KB2732500
[78]: KB2735855
[79]: KB2736422
[80]: KB2742599
[81]: KB2743555
[82]: KB2750841
[83]: KB2756921
[84]: KB2757638
[85]: KB2761217
[86]: KB2763523
[87]: KB2770660
[88]: KB2773072
[89]: KB2785220
[90]: KB2786081
[91]: KB2789645
[92]: KB2790655
[93]: KB2791765
[94]: KB2798162
[95]: KB2799494
[96]: KB2799926
[97]: KB2800095
[98]: KB2803821
[99]: KB2807986
[100]: KB2808679
[101]: KB2813170
[102]: KB2813347
[103]: KB2813430
[104]: KB2813956
[105]: KB2820197
[106]: KB2820331
[107]: KB2832414
[108]: KB2833946
[109]: KB2834140
[110]: KB2834886
[111]: KB2835361
[112]: KB2835364
[113]: KB2836502
[114]: KB2836943
[115]: KB2839894
[116]: KB2840149
[117]: KB2840631
[118]: KB2844286
[119]: KB2845187
[120]: KB2845690
[121]: KB2847311
[122]: KB2847927
[123]: KB2849470
[124]: KB2852386
[125]: KB2857650
[126]: KB2861191
[127]: KB2861698
[128]: KB2861855
[129]: KB2862152
[130]: KB2862330
[131]: KB2862335
[132]: KB2862966
[133]: KB2862973
[134]: KB2863058
[135]: KB2863240
[136]: KB2864058
[137]: KB2864202
[138]: KB2868038
[139]: KB2868116
[140]: KB2868623
[141]: KB2868626
[142]: KB2868725
[143]: KB2871997
[144]: KB2872339
[145]: KB2875783
[146]: KB2876284
[147]: KB2876331
[148]: KB2882822
[149]: KB2883150
[150]: KB2884256
[151]: KB2887069
[152]: KB2888049
[153]: KB2891804
[154]: KB2892074
[155]: KB2893294
[156]: KB2893519
[157]: KB2893984
[158]: KB2894844
[159]: KB2898857
[160]: KB2900986
[161]: KB2901112
[162]: KB2904266
[163]: KB2911501
[164]: KB2912390
[165]: KB2913152
[166]: KB2913431
[167]: KB2913602
[168]: KB2913751
[169]: KB2916036
[170]: KB2918614
[171]: KB2919469
[172]: KB2922229
[173]: KB2923545
[174]: KB2926765
[175]: KB2928562
[176]: KB2929437
[177]: KB2929733
[178]: KB2929755
[179]: KB2929961
[180]: KB2930275
[181]: KB2931356
[182]: KB2937610
[183]: KB2939576
[184]: KB2943357
[185]: KB2949927
[186]: KB2957189
[187]: KB2957503
[188]: KB2957509
[189]: KB2957689
[190]: KB2961072
[191]: KB2962872
[192]: KB2965788
[193]: KB2968294
[194]: KB2970228
[195]: KB2971850
[196]: KB2972100
[197]: KB2972211
[198]: KB2972280
[199]: KB2973112
[200]: KB2973201
[201]: KB2973337
[202]: KB2973351
[203]: KB2976627
[204]: KB2976897
[205]: KB2977292
[206]: KB2977629
[207]: KB2977728
[208]: KB2978092
[209]: KB2978120
[210]: KB2978668
[211]: KB2978742
[212]: KB2979570
[213]: KB2980245
[214]: KB2981580
[215]: KB2982378
[216]: KB2984972
[217]: KB2984976
[218]: KB2984981
[219]: KB2987107
[220]: KB2990214
[221]: KB2991963
[222]: KB2992611
[223]: KB2993651
[224]: KB2993958
[225]: KB2994023
[226]: KB2998527
[227]: KB2999226
[228]: KB3000061
[229]: KB3000869
[230]: KB3000988
[231]: KB3001554
[232]: KB3002885
[233]: KB3003057
[234]: KB3003743
[235]: KB3004361
[236]: KB3004375
[237]: KB3005607
[238]: KB3006121
[239]: KB3006137
[240]: KB3006226
[241]: KB3008627
[242]: KB3008923
[243]: KB3009736
[244]: KB3010788
[245]: KB3011780
[246]:
Network Card(s): 1 NIC(s) Installed.
[01]: Intel(R) 82579V Gigabit Network Connection
Connection Name: Local Connection
DHCP Enabled: Yes
DHCP Server: 192.168.1.1
IP address(es)
[01]: 192.168.1.221
[02]: fe80::a962:4d4c:1f37:afef
[03]: 2601:602:8f01:1900:5105:b4fb:7ace:c8cd
[04]: 2601:602:8f01:1900:a962:4d4c:1f37:afef

Continue reading...
 
Back
Top