X-Git-Url: https://wimlib.net/git/?p=wimlib;a=blobdiff_plain;f=src%2Fwin32_capture.c;h=7f6df42e49393e65614ab512cfecdb1af17d0b25;hp=e2d98078702f840b68ff8a14848999ad8309f43e;hb=2e44f90c21db693058037f83f92ad136c818ce9d;hpb=9d457f3498edc3778ae5315ed5230800b3e0870e diff --git a/src/win32_capture.c b/src/win32_capture.c index e2d98078..7f6df42e 100644 --- a/src/win32_capture.c +++ b/src/win32_capture.c @@ -23,11 +23,18 @@ #ifdef __WIN32__ -#include "win32_common.h" -#include "wimlib_internal.h" -#include "lookup_table.h" -#include "security.h" -#include "endianness.h" +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#include "wimlib/win32_common.h" + +#include "wimlib/capture.h" +#include "wimlib/endianness.h" +#include "wimlib/error.h" +#include "wimlib/lookup_table.h" +#include "wimlib/paths.h" +#include "wimlib/reparse.h" #define MAX_GET_SD_ACCESS_DENIED_WARNINGS 1 #define MAX_GET_SACL_PRIV_NOTHELD_WARNINGS 1 @@ -254,7 +261,7 @@ win32_get_short_name(struct wim_dentry *dentry, const wchar_t *path) static int win32_get_security_descriptor(struct wim_dentry *dentry, - struct sd_set *sd_set, + struct wim_sd_set *sd_set, const wchar_t *path, struct win32_capture_state *state, int add_flags) @@ -417,40 +424,6 @@ out_find_close: return ret; } -int -win32_get_file_and_vol_ids(const wchar_t *path, u64 *ino_ret, u64 *dev_ret) -{ - HANDLE hFile; - DWORD err; - BY_HANDLE_FILE_INFORMATION file_info; - int ret; - - hFile = win32_open_existing_file(path, FILE_READ_ATTRIBUTES); - if (hFile == INVALID_HANDLE_VALUE) { - err = GetLastError(); - if (err != ERROR_FILE_NOT_FOUND) { - WARNING("Failed to open \"%ls\" to get file " - "and volume IDs", path); - win32_error(err); - } - return WIMLIB_ERR_OPEN; - } - - if (!GetFileInformationByHandle(hFile, &file_info)) { - err = GetLastError(); - ERROR("Failed to get file information for \"%ls\"", path); - win32_error(err); - ret = WIMLIB_ERR_STAT; - } else { - *ino_ret = ((u64)file_info.nFileIndexHigh << 32) | - (u64)file_info.nFileIndexLow; - *dev_ret = file_info.dwVolumeSerialNumber; - ret = 0; - } - CloseHandle(hFile); - return ret; -} - /* Reparse point fixup status code */ enum rp_status { /* Reparse point corresponded to an absolute symbolic link or junction @@ -1030,7 +1003,7 @@ win32_build_dentry_tree_recursive(struct wim_dentry **root_ret, * only 1 link and refuse to hard link them. This is because Windows * has a bug where it can return duplicate File IDs for files and * directories on the FAT filesystem. */ - ret = inode_table_new_dentry(params->inode_table, + ret = inode_table_new_dentry(¶ms->inode_table, path_basename_with_len(path, path_num_chars), ((u64)file_info.nFileIndexHigh << 32) | (u64)file_info.nFileIndexLow, @@ -1061,7 +1034,7 @@ win32_build_dentry_tree_recursive(struct wim_dentry **root_ret, if (!(params->add_flags & WIMLIB_ADD_FLAG_NO_ACLS) && (vol_flags & FILE_PERSISTENT_ACLS)) { - ret = win32_get_security_descriptor(root, params->sd_set, + ret = win32_get_security_descriptor(root, ¶ms->sd_set, path, state, params->add_flags); if (ret)