Though it is interesting that the problem was noticed only after the new patch!
int copy_file(ccs src, ccs dst)
{
FILE *fin = fopen(src, read_bin);
if (fin==NULL) return 0;
fseek(fin, 0, SEEK_END);
int size = ftell(fin);
if (size==-1)
{
fclose(fin);
return 0;
}
fseek(fin, 0, SEEK_SET);
byte *mem = new byte[size];
fread(mem, 1, size, fin);
fclose(fin);
FILE *fout = fopen(dst, write_bin);
if (fout==NULL)
{
delete [] mem;
return 0;
}
fwrite(mem, 1, size, fout);
fclose(fout);
delete [] mem;
return 1;
}
int copy_file(ccs src, ccs dst)
{
return CopyFile(src, dst, FALSE);
}
DWORD allowedBits = 0x31A7;
LPSTR pszFileName = "copied_file.dat";
DWORD attrs = GetFileAttributes(pszFileName);
if (attrs & FILE_ATTRIBUTE_READONLY) {
attrs &= ~FILE_ATTRIBUTE_READONLY & allowedBits;
SetFileAttributes(pszFileName, attrs);
}