From: Eric Biggers Date: Tue, 21 May 2013 00:56:36 +0000 (-0500) Subject: Win32: Use OPEN_EXISTING creation disposition on drive root X-Git-Tag: v1.4.1~71 X-Git-Url: https://wimlib.net/git/?p=wimlib;a=commitdiff_plain;h=d5447ec541b245fa91dac72ce2822bdaafc30f6c Win32: Use OPEN_EXISTING creation disposition on drive root --- diff --git a/src/win32_apply.c b/src/win32_apply.c index 11104f24..972224ef 100644 --- a/src/win32_apply.c +++ b/src/win32_apply.c @@ -601,18 +601,19 @@ win32_begin_extract_unnamed_stream(const struct wim_inode *inode, /* Directories must be created with CreateDirectoryW(). Then the call * to CreateFileW() will merely open the directory that was already * created rather than creating a new file. */ - if (inode->i_attributes & FILE_ATTRIBUTE_DIRECTORY && - !path_is_root_of_drive(path)) { - if (!CreateDirectoryW(path, NULL)) { - err = GetLastError(); - if (err != ERROR_ALREADY_EXISTS) { - ERROR("Failed to create directory \"%ls\"", - path); - win32_error(err); - return WIMLIB_ERR_MKDIR; + if (inode->i_attributes & FILE_ATTRIBUTE_DIRECTORY) { + if (!path_is_root_of_drive(path)) { + if (!CreateDirectoryW(path, NULL)) { + err = GetLastError(); + if (err != ERROR_ALREADY_EXISTS) { + ERROR("Failed to create directory \"%ls\"", + path); + win32_error(err); + return WIMLIB_ERR_MKDIR; + } } + DEBUG("Created directory \"%ls\"", path); } - DEBUG("Created directory \"%ls\"", path); *creationDisposition_ret = OPEN_EXISTING; } if (inode->i_attributes & FILE_ATTRIBUTE_ENCRYPTED &&