{"id":2160,"date":"2018-08-30T19:12:29","date_gmt":"2018-08-30T23:12:29","guid":{"rendered":"http:\/\/ninecrows.com\/career\/?p=2160"},"modified":"2018-09-08T10:52:53","modified_gmt":"2018-09-08T14:52:53","slug":"full-file-id-api-in-win32","status":"publish","type":"post","link":"https:\/\/ninecrows.com\/career\/2018\/08\/30\/full-file-id-api-in-win32\/","title":{"rendered":"Full file ID API in Win32"},"content":{"rendered":"<p>In order to get the full ID of a file in Win32 the&nbsp;<a href=\"https:\/\/docs.microsoft.com\/en-us\/windows\/desktop\/api\/fileapi\/nf-fileapi-getfileinformationbyhandle\">GetFileInformationByHandle&nbsp;<\/a>&nbsp;returning a&nbsp;<a href=\"https:\/\/docs.microsoft.com\/en-us\/windows\/desktop\/api\/fileapi\/ns-fileapi-_by_handle_file_information\">BY_HANDLE_FILE_INFORMATION<\/a> which contains 64 bits of file ID (and the volume id where the file resides) is a start.<\/p>\n<p>The&nbsp;<a href=\"https:\/\/docs.microsoft.com\/en-us\/windows\/desktop\/api\/winbase\/nf-winbase-getfileinformationbyhandleex\">GetFileInformationByHandleEx<\/a>&nbsp; with&nbsp;FILE_INFO_BY_HANDLE_CLASS of returns&nbsp;<a href=\"https:\/\/docs.microsoft.com\/en-us\/windows\/desktop\/api\/winbase\/ns-winbase-_file_id_info\">FILE_ID_INFO<\/a> which provides the full (potentially) 128 bit file id as required for&nbsp;ReFS.<\/p>\n<p>I&#8217;ll likely provide support for both of these shortly, likely using C++\/CLI to simplify the interface.<\/p>\n<p>Given these two pieces of information it should&nbsp; be much safer to clear out duplicate files as various sorts of links and mount points will still show the ultimate file identity properly and avoid deleting apparent duplicates that are really just aliased paths to the same file.<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In order to get the full ID of a file in Win32 the&nbsp;GetFileInformationByHandle&nbsp;&nbsp;returning a&nbsp;BY_HANDLE_FILE_INFORMATION which contains 64 bits of file ID (and the volume id where the file resides) is a start. The&nbsp;GetFileInformationByHandleEx&nbsp; with&nbsp;FILE_INFO_BY_HANDLE_CLASS of returns&nbsp;FILE_ID_INFO which provides the full (potentially) 128 bit file id as required for&nbsp;ReFS. I&#8217;ll likely provide support for both of &hellip; <a href=\"https:\/\/ninecrows.com\/career\/2018\/08\/30\/full-file-id-api-in-win32\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Full file ID API in Win32<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","enabled":false},"version":2}},"categories":[43,9,2,22,44],"tags":[],"class_list":["post-2160","post","type-post","status-publish","format-standard","hentry","category-c","category-daily-blog","category-projects","category-sandbox","category-win32"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p7F2Qc-yQ","jetpack-related-posts":[],"jetpack_likes_enabled":true,"_links":{"self":[{"href":"https:\/\/ninecrows.com\/career\/wp-json\/wp\/v2\/posts\/2160"}],"collection":[{"href":"https:\/\/ninecrows.com\/career\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ninecrows.com\/career\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ninecrows.com\/career\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ninecrows.com\/career\/wp-json\/wp\/v2\/comments?post=2160"}],"version-history":[{"count":4,"href":"https:\/\/ninecrows.com\/career\/wp-json\/wp\/v2\/posts\/2160\/revisions"}],"predecessor-version":[{"id":2167,"href":"https:\/\/ninecrows.com\/career\/wp-json\/wp\/v2\/posts\/2160\/revisions\/2167"}],"wp:attachment":[{"href":"https:\/\/ninecrows.com\/career\/wp-json\/wp\/v2\/media?parent=2160"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ninecrows.com\/career\/wp-json\/wp\/v2\/categories?post=2160"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ninecrows.com\/career\/wp-json\/wp\/v2\/tags?post=2160"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}