ReplaceFile_3.patch

Thomas Beutlich, 04 Sep 2014 05:33

Download (1.3 KB)

View differences:

src/basicio.cpp (working copy)
722 722
                    ReplaceFileW_t pfcn_ReplaceFileW = (ReplaceFileW_t)GetProcAddress(hKernel, "ReplaceFileW");
723 723
                    if (pfcn_ReplaceFileW) {
724 724
                        BOOL ret = pfcn_ReplaceFileW(wpf, fileIo->wpath().c_str(), NULL, REPLACEFILE_IGNORE_MERGE_ERRORS, NULL, NULL);
725
                        FreeLibrary(hKernel);
725 726
                        if (ret == 0) {
726 727
                            if (GetLastError() == ERROR_FILE_NOT_FOUND) {
727 728
                                if (::_wrename(fileIo->wpath().c_str(), wpf) == -1) {
......
735 736
                        }
736 737
                    }
737 738
                    else {
739
                        FreeLibrary(hKernel);
738 740
                        if (fileExists(wpf) && ::_wremove(wpf) != 0) {
739 741
                            throw WError(2, wpf, strError().c_str(), "::_wremove");
740 742
                        }
......
743 745
                        }
744 746
                        ::_wremove(fileIo->wpath().c_str());
745 747
                    }
746
                    FreeLibrary(hKernel);
747 748
                }
748 749
#else
749 750
                if (fileExists(wpf) && ::_wremove(wpf) != 0) {
Redmine Appliance - Powered by TurnKey Linux