Re: [PATCH] scrrun: Add MoveFile().

Fabian Maurer <[email protected]> Sun, 16 Sep 2018 15:48:39 +0200
Newsgroups gmane.comp.emulators.wine.patches
Message-ID <1801392.9NKejRn9qR@arch>
This is a multi-part message in MIME format.

--===============2100156984177926826==
Content-Type: multipart/alternative; boundary="nextPart51240465.MgrppfnxNo"
Content-Transfer-Encoding: 7Bit

This is a multi-part message in MIME format.

--nextPart51240465.MgrppfnxNo
Content-Transfer-Encoding: 7Bit
Content-Type: text/plain; charset="us-ascii"

> +    TRACE("%p %s %s\n", iface, debugstr_w(src), debugstr_w(dest));
> +
> +    if (MoveFileW(src, dest))
> +        return S_OK;
> +
> +    error = GetLastError();
> +    switch (error)
> +    {
> +    case ERROR_ALREADY_EXISTS:
> +        return CTL_E_FILEALREADYEXISTS;
> +    case ERROR_FILE_NOT_FOUND:
> +        return CTL_E_FILENOTFOUND;
> +    default:
> +        return HRESULT_FROM_WIN32(error);
> +    }

That doesn't seem quite correct.
As the docs I linked from https://bugs.winehq.org/show_bug.cgi?id=45839 state, this 
function also accepts wildcards. On my win7 machine that works, but MoveFileW can't 
handle this.

Regards,
Fabian Maurer


--nextPart51240465.MgrppfnxNo
Content-Transfer-Encoding: 7Bit
Content-Type: text/html; charset="us-ascii"

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
p, li { white-space: pre-wrap; }
</style></head><body style=" font-family:'Hack'; font-size:9pt; font-weight:400; font-style:normal;">
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; +    TRACE(&quot;%p %s %s\n&quot;, iface, debugstr_w(src), debugstr_w(dest));</p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; +</p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; +    if (MoveFileW(src, dest))</p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; +        return S_OK;</p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; +</p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; +    error = GetLastError();</p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; +    switch (error)</p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; +    {</p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; +    case ERROR_ALREADY_EXISTS:</p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; +        return CTL_E_FILEALREADYEXISTS;</p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; +    case ERROR_FILE_NOT_FOUND:</p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; +        return CTL_E_FILENOTFOUND;</p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; +    default:</p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; +        return HRESULT_FROM_WIN32(error);</p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; +    }</p>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; ">&nbsp;</p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">That doesn't seem quite correct.</p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">As the docs I linked from https://bugs.winehq.org/show_bug.cgi?id=45839 state, this function also accepts wildcards. On my win7 machine that works, but MoveFileW can't handle this.</p>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; ">&nbsp;</p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">Regards,</p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">Fabian Maurer</p>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; ">&nbsp;</p></body></html>
--nextPart51240465.MgrppfnxNo--





--===============2100156984177926826==
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: base64
Content-Disposition: inline

Cg==

--===============2100156984177926826==--