ReactOS 0.4.16-dev-889-g9563c07
wrename.cpp
Go to the documentation of this file.
1//
2// wrename.cpp
3//
4// Copyright (c) Microsoft Corporation. All rights reserved.
5//
6// The _wrename() function, which renames a file.
7//
8#include <corecrt_internal.h>
9#include <io.h>
10
11
12
13// Renames the file named 'old_name' to be named 'new_name'. Returns zero if
14// successful; returns -1 and sets errno and _doserrno on failure.
15extern "C" int __cdecl _wrename(wchar_t const* const old_name, wchar_t const* const new_name)
16{
17 // The MOVEFILE_COPY_ALLOWED flag alloes moving to a different volume.
18 if (!MoveFileExW(old_name, new_name, MOVEFILE_COPY_ALLOWED))
19 {
21 return -1;
22 }
23
24 return 0;
25}
#define __cdecl
Definition: accygwin.h:79
void __cdecl __acrt_errno_map_os_error(unsigned long)
Definition: errno.cpp:91
BOOL WINAPI MoveFileExW(IN LPCWSTR lpExistingFileName, IN LPCWSTR lpNewFileName OPTIONAL, IN DWORD dwFlags)
Definition: move.c:1120
#define MOVEFILE_COPY_ALLOWED
Definition: filesup.h:29
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
int __cdecl _wrename(wchar_t const *const old_name, wchar_t const *const new_name)
Definition: wrename.cpp:15