IPB

Welcome Guest ( Log In | Register )

> Hydrogenaudio Forum Rules

- No Warez. This includes warez links, cracks and/or requests for help in getting illegal software or copyrighted music tracks!
- No Spamming or Trolling on the boards, this includes useless posts, trying to only increase post count or trying to deliberately create a flame war.
- No Hateful or Disrespectful posts. This includes: bashing, name-calling or insults directed at a board member.
- Click here for complete Hydrogenaudio Terms of Service

 
Reply to this topicStart new topic
need windows-specific help for FLAC
jcoalson
post Oct 20 2006, 05:41
Post #1


FLAC Developer


Group: Developer
Posts: 1526
Joined: 27-February 02
Member No.: 1408



this is pretty far off-topic but I'm hoping someone familiar with win APIs here will see it...

flac (1.1.3) needs to be able to figure out if two filenames refer to the same file. in POSIX this is easy, you just stat() both of them and compare st_dev and st_ino (device and inode). but at least for me on NT4 with MSVC6 the inode is always 0.

so does anyone know what the win-specific way to do this? I question being able to get it right by just trying to normalize the file names with the current working directory.

Josh
Go to the top of the page
+Quote Post
Egor
post Oct 26 2006, 20:13
Post #2





Group: Members
Posts: 826
Joined: 29-September 04
Member No.: 17374



QUOTE (jcoalson @ Oct 20 2006, 11:41) *
but at least for me on NT4 with MSVC6 the inode is always 0.

QUOTE
The inode, and therefore st_ino, has no meaning in the FAT, HPFS, or NTFS file systems.


QUOTE (jcoalson @ Oct 20 2006, 11:41) *
so does anyone know what the win-specific way to do this?

hope this will be useful smile.gif

GetFileInformationByHandle, BY_HANDLE_FILE_INFORMATION, CreateFile.
QUOTE (BY_HANDLE_FILE_INFORMATION)
nFileIndexHigh
High-order part of a unique identifier that is associated with a file. For more information, see nFileIndexLow.
nFileIndexLow
Low-order part of a unique identifier that is associated with a file.

This value is useful only while the file is open by at least one process. If no processes have it open, the index may change the next time the file is opened.

The identifier (low and high parts) and the volume serial number that uniquely identify a file on a single computer. To determine whether two open handles represent the same file, combine this identifier and the volume serial number for each file and compare them.

QUOTE
#include <Windows.h>
#include <Winbase.h>
...
HANDLE hFile = CreateFile("D:\\audio\\flac.exe", GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
BY_HANDLE_FILE_INFORMATION info;
GetFileInformationByHandle(hFile, &info);
CloseHandle(hFile);
printf("File info %ld-%ld\n", info.nFileIndexHigh, info.nFileIndexLow);
Go to the top of the page
+Quote Post
jcoalson
post Oct 26 2006, 21:30
Post #3


FLAC Developer


Group: Developer
Posts: 1526
Joined: 27-February 02
Member No.: 1408



whew, thanks! I'll try that.

Josh
Go to the top of the page
+Quote Post
jcoalson
post Nov 2 2006, 05:08
Post #4


FLAC Developer


Group: Developer
Posts: 1526
Joined: 27-February 02
Member No.: 1408



cool, it works, just checked it in.
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



RSS Lo-Fi Version Time is now: 20th April 2014 - 22:34