blob: 1fa71bc233d48579cae29377674ec7440f0ad4a5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information.
#include "precomp.h"
int __cdecl wmain(
__in int argc,
__in LPWSTR argv[]
)
{
HRESULT hr = S_OK;
DWORD dwExitCode = 0;
LPCWSTR wzDestinationFile = argc > 1 ? argv[1] : NULL;
LPCWSTR wzGoodFile = argc > 2 ? argv[2] : NULL;
LPCWSTR wzBadFile = argc > 3 ? argv[3] : NULL;
if (argc != 4)
{
ExitWithRootFailure(hr, E_INVALIDARG, "Invalid args");
}
if (!::MoveFileW(wzDestinationFile, wzBadFile))
{
ExitWithLastError(hr, "Failed to move bad file");
}
if (!::MoveFileW(wzGoodFile, wzDestinationFile))
{
ExitWithLastError(hr, "Failed to move good file");
}
LExit:
return FAILED(hr) ? (int)hr : (int)dwExitCode;
}
|