instead of SetFilePointerEx.
Fix a couple of uninitialized variables.
From: Denis B MARTIN
SVN-Revision: 3807
#define IO_REPARSE_TAG_SYMLINK 0xA000000CL
#endif
+static BOOL SetFilePointerEx_perso(HANDLE hFile,
+ LARGE_INTEGER liDistanceToMove,
+ PLARGE_INTEGER lpNewFilePointer,
+ DWORD dwMoveMethod)
+{
+ LARGE_INTEGER li;
+ li.QuadPart = liDistanceToMove.QuadPart;
+ li.LowPart = SetFilePointer(
+ hFile, li.LowPart, &li.HighPart, dwMoveMethod);
+ if(lpNewFilePointer) {
+ lpNewFilePointer->QuadPart = li.QuadPart;
+ }
+ return li.LowPart != -1 || GetLastError() == NO_ERROR;
+}
+
/*-
* This is a new directory-walking system that addresses a number
* of problems I've had with fts(3). In particular, it has no
if (t->current_sparse->offset > t->entry_total) {
LARGE_INTEGER distance;
distance.QuadPart = t->current_sparse->offset;
- if (!SetFilePointerEx(t->entry_fh, distance, NULL, FILE_BEGIN)) {
+ if (!SetFilePointerEx_perso(t->entry_fh, distance, NULL, FILE_BEGIN)) {
DWORD lasterr;
lasterr = GetLastError();
const char *name;
HANDLE h;
BY_HANDLE_FILE_INFORMATION bhfi;
- DWORD fileAttributes;
+ DWORD fileAttributes = 0;
int r;
archive_clear_error(_a);
#define EPOC_TIME ARCHIVE_LITERAL_ULL(116444736000000000)
-#if defined(_MSC_VER) && _MSC_VER < 1300
-/* VS 6 does not provide SetFilePointerEx, so define it here. */
-static BOOL SetFilePointerEx(HANDLE hFile,
+static BOOL SetFilePointerEx_perso(HANDLE hFile,
LARGE_INTEGER liDistanceToMove,
PLARGE_INTEGER lpNewFilePointer,
DWORD dwMoveMethod)
}
return li.LowPart != -1 || GetLastError() == NO_ERROR;
}
-#endif
struct ustat {
int64_t st_atime;
return (-1);
}
distance.QuadPart = offset;
- if (!SetFilePointerEx(handle, distance, &newpointer, whence)) {
+ if (!SetFilePointerEx_perso(handle, distance, &newpointer, whence)) {
DWORD lasterr;
lasterr = GetLastError();
#define IO_REPARSE_TAG_SYMLINK 0xA000000CL
#endif
+static BOOL SetFilePointerEx_perso(HANDLE hFile,
+ LARGE_INTEGER liDistanceToMove,
+ PLARGE_INTEGER lpNewFilePointer,
+ DWORD dwMoveMethod)
+{
+ LARGE_INTEGER li;
+ li.QuadPart = liDistanceToMove.QuadPart;
+ li.LowPart = SetFilePointer(
+ hFile, li.LowPart, &li.HighPart, dwMoveMethod);
+ if(lpNewFilePointer) {
+ lpNewFilePointer->QuadPart = li.QuadPart;
+ }
+ return li.LowPart != -1 || GetLastError() == NO_ERROR;
+}
+
struct fixup_entry {
struct fixup_entry *next;
struct archive_acl acl;
return (-1);
}
distance.QuadPart = length;
- if (!SetFilePointerEx(handle, distance, NULL, FILE_BEGIN)) {
+ if (!SetFilePointerEx_perso(handle, distance, NULL, FILE_BEGIN)) {
la_dosmaperr(GetLastError());
return (-1);
}
if (a->offset != a->fd_offset) {
LARGE_INTEGER distance;
distance.QuadPart = a->offset;
- if (SetFilePointerEx(a->fh, distance, NULL, FILE_BEGIN) == 0) {
+ if (SetFilePointerEx_perso(a->fh, distance, NULL, FILE_BEGIN) == 0) {
DWORD lasterr = GetLastError();
if (lasterr == ERROR_ACCESS_DENIED)
errno = EBADF;
const char nul = '\0';
LARGE_INTEGER distance;
distance.QuadPart = a->filesize - 1;
- if (!SetFilePointerEx(a->fh, distance, NULL, FILE_BEGIN)) {
+ if (!SetFilePointerEx_perso(a->fh, distance, NULL, FILE_BEGIN)) {
DWORD lasterr = GetLastError();
if (lasterr == ERROR_ACCESS_DENIED)
errno = EBADF;
#define WINTIME(sec, nsec) ((Int32x32To64(sec, 10000000) + EPOC_TIME)\
+ (((nsec)/1000)*10))
- HANDLE hw;
+ HANDLE hw = 0;
ULARGE_INTEGER wintm;
FILETIME *pfbtime;
FILETIME fatime, fbtime, fmtime;