From ed822f3f72c98f308761dd86dfa4ef3b17e9d3d2 Mon Sep 17 00:00:00 2001 From: Nils Durner Date: Mon, 21 Jun 2010 17:27:20 +0000 Subject: [PATCH] Windows impl of GNUNET_DISK_file_get_identifiers, untested --- src/util/disk.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) 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; } -- 2.25.1