-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcopyfile.c
41 lines (30 loc) · 923 Bytes
/
copyfile.c
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
34
35
36
37
38
39
40
41
// copyfile.c
//
// Time-stamp: <04/01/01 12:02:42 keuchel@lightning>
#include "celib.h"
BOOL
XCECopyFileA(const char *lpName1, const char *lpName2, BOOL bFail)
{
wchar_t *lpNameNew1 = NULL;
int len1 = strlen(lpName1) + 1;
wchar_t *lpNameNew2 = NULL;
int len2 = strlen(lpName2) + 1;
BOOL res;
lpNameNew1 = malloc(len1 * 2);
lpNameNew2 = malloc(len2 * 2);
MultiByteToWideChar(CP_ACP, 0, lpName1, -1, lpNameNew1, len1);
MultiByteToWideChar(CP_ACP, 0, lpName2, -1, lpNameNew2, len2);
res = XCECopyFileW(lpNameNew1, lpNameNew2, bFail);
free(lpNameNew1);
free(lpNameNew2);
return res;
}
BOOL
XCECopyFileW(const wchar_t *oldpath1, const wchar_t *oldpath2, BOOL bFail)
{
wchar_t newpath1[MAX_PATH];
wchar_t newpath2[MAX_PATH];
XCEFixPathW(oldpath1, newpath1);
XCEFixPathW(oldpath2, newpath2);
return CopyFileW(newpath1, newpath2, bFail);
}