From: Nils Durner Date: Mon, 21 Jun 2010 17:27:20 +0000 (+0000) Subject: Windows impl of GNUNET_DISK_file_get_identifiers, untested X-Git-Tag: initial-import-from-subversion-38251~21305 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=ed822f3f72c98f308761dd86dfa4ef3b17e9d3d2;p=oweals%2Fgnunet.git Windows impl of GNUNET_DISK_file_get_identifiers, untested --- diff --git a/src/util/disk.c b/src/util/disk.c index 6cac1f70c..60288bc5d 100644 --- a/src/util/disk.c +++ b/src/util/disk.c @@ -260,6 +260,26 @@ GNUNET_DISK_file_get_identifiers (const char *filename, *ino = (uint64_t) sbuf.st_ino; return GNUNET_OK; } +#elif WINDOWS + // FIXME NILS: test this + struct GNUNET_DISK_FileHandle *fh; + BY_HANDLE_FILE_INFORMATION info; + int succ; + + fh = GNUNET_DISK_file_open(filename, GNUNET_DISK_OPEN_READ, 0); + if (fh == NULL) + return GNUNET_SYSERR; + succ = GetFileInformationByHandle(fh->h, &info); + GNUNET_DISK_file_close(fh); + if (succ) + { + *dev = info.dwVolumeSerialNumber; + *ino = ((info.nFileIndexHigh << sizeof(DWORD)) | info.nFileIndexLow); + return GNUNET_OK; + } + else + return GNUNET_SYSERR; + #endif return GNUNET_SYSERR; }