-/*
- * Bacula low level File I/O routines. This routine simulates
- * open(), read(), write(), and close(), but using native routines.
- * I.e. on Windows, we use Windows APIs.
- *
- * Kern Sibbald, April MMIII
- *
- * Version $Id$
- *
- */
/*
Bacula® - The Network Backup Solution
(FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich,
Switzerland, email:ftf@fsfeurope.org.
*/
+/*
+ * Bacula low level File I/O routines. This routine simulates
+ * open(), read(), write(), and close(), but using native routines.
+ * I.e. on Windows, we use Windows APIs.
+ *
+ * Kern Sibbald, April MMIII
+ *
+ * Version $Id$
+ *
+ */
#include "bacula.h"
#include "find.h"
dwflags = 0;
}
- // unicode or ascii open for create write
if (p_CreateFileW && p_MultiByteToWideChar) {
+ // unicode open for create write
bfd->fh = p_CreateFileW((LPCWSTR)win32_fname_wchar,
dwaccess, /* Requested access */
0, /* Shared mode */
dwflags, /* Flags and attributes */
NULL); /* TemplateFile */
} else {
+ // ascii open
bfd->fh = p_CreateFileA(win32_fname,
dwaccess, /* Requested access */
0, /* Shared mode */
} else if (flags & O_WRONLY) { /* Open existing for write */
if (bfd->use_backup_api) {
dwaccess = GENERIC_WRITE|WRITE_OWNER|WRITE_DAC;
- dwflags = FILE_FLAG_BACKUP_SEMANTICS;
+ dwflags = FILE_FLAG_BACKUP_SEMANTICS | FILE_FLAG_OPEN_REPARSE_POINT;
} else {
dwaccess = GENERIC_WRITE;
dwflags = 0;
}
- // unicode or ascii open for open existing write
if (p_CreateFileW && p_MultiByteToWideChar) {
+ // unicode open for open existing write
bfd->fh = p_CreateFileW((LPCWSTR)win32_fname_wchar,
dwaccess, /* Requested access */
0, /* Shared mode */
dwflags, /* Flags and attributes */
NULL); /* TemplateFile */
} else {
+ // ascii open
bfd->fh = p_CreateFileA(win32_fname,
dwaccess, /* Requested access */
0, /* Shared mode */
} else { /* Read */
if (bfd->use_backup_api) {
dwaccess = GENERIC_READ|READ_CONTROL|ACCESS_SYSTEM_SECURITY;
- dwflags = FILE_FLAG_BACKUP_SEMANTICS;
+ dwflags = FILE_FLAG_BACKUP_SEMANTICS | FILE_FLAG_SEQUENTIAL_SCAN |
+ FILE_FLAG_OPEN_REPARSE_POINT;
dwshare = FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE;
} else {
dwaccess = GENERIC_READ;
dwshare = FILE_SHARE_READ|FILE_SHARE_WRITE;
}
- // unicode or ascii open for open existing read
if (p_CreateFileW && p_MultiByteToWideChar) {
+ // unicode open for open existing read
bfd->fh = p_CreateFileW((LPCWSTR)win32_fname_wchar,
dwaccess, /* Requested access */
dwshare, /* Share modes */
dwflags, /* Flags and attributes */
NULL); /* TemplateFile */
} else {
+ // ascii open
bfd->fh = p_CreateFileA(win32_fname,
dwaccess, /* Requested access */
dwshare, /* Share modes */