From ce2a12e067554fc270e7d4f54302bf41c2310fc8 Mon Sep 17 00:00:00 2001 From: MikalaiR Date: Sun, 24 Jan 2016 10:48:07 +0000 Subject: Mirlua: CopyFile winapi function git-svn-id: http://svn.miranda-ng.org/main/trunk@16162 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/MirLua/Modules/WinAPI/src/winapi.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'plugins/MirLua/Modules/WinAPI/src') diff --git a/plugins/MirLua/Modules/WinAPI/src/winapi.cpp b/plugins/MirLua/Modules/WinAPI/src/winapi.cpp index 28456f2013..974010d7b6 100644 --- a/plugins/MirLua/Modules/WinAPI/src/winapi.cpp +++ b/plugins/MirLua/Modules/WinAPI/src/winapi.cpp @@ -1037,6 +1037,17 @@ static int global_DeleteFile(lua_State *L) return 1; } +static int global_CopyFile(lua_State *L) +{ + LPCSTR szFrom = luaL_checkstring(L, 1); + LPCSTR szTo = luaL_checkstring(L, 2); + BOOL bError = luaL_optnumber(L, 3, 0); + + BOOL res = CopyFileA(szFrom, szTo, bError); + lua_pushboolean(L, res); + return 1; +} + static int global_WaitForSingleObject(lua_State *L) { HANDLE h = (HANDLE)(intptr_t)luaL_checknumber(L, 1); DWORD t = (DWORD)luaL_checknumber(L, 2); @@ -1910,6 +1921,7 @@ static luaL_Reg winApi[] = { "ReadFile", global_ReadFile }, { "WriteFile", global_WriteFile }, { "DeleteFile", global_DeleteFile }, + { "CopyFile", global_CopyFile }, { "TerminateProcess", global_TerminateProcess }, { "GetExitCodeProcess", global_GetExitCodeProcess }, { "WaitForSingleObject", global_WaitForSingleObject }, -- cgit v1.2.3