Chinese garbled code in LUA script。Waiting for reply Online

The current operating system is WIN10,Locale is Chinese。
Illustration:


.vmp file path is : E:\工作内容\test.dll.vmp

Call “print(“Path:\t”..stripfilename(vmpCore:projectFileName()))” in script,print “E:\工作内容\test.dll.vmp” is ok。

But there is a mistake in the other use(configFile = io.open(vmpCore:projectFileName(), “r”)). the “configFile” is nil。

Sample code:

function OnBeforeCompilation()

	vmpCore:inputArchitecture():file()
	
	print("Path:\t"..vmpCore:projectFileName())

	configFilePath = vmpCore:projectFileName()
	print("Path:"..configFilePath)  -- is ok
		
	configFile = io.open(configFilePath, "r") --is error
	if configFile == nil then
		print("Open config text file \""..configFilePath.."\" error!No such config file or directory!")
		return
	end
end

How to solve this problem。

proposal:
1、Allow running script to abort;
2、Allow script control “Lock To Serial Number”;

“vmpCore” is unitialized variable. Anyway, it seems LUA doesn’t support unicode file names for “io.open”:

static int io_open (lua_State *L) {
  const char *filename = luaL_checkstring(L, 1);
  const char *mode = luaL_optstring(L, 2, "r");
  LStream *p = newfile(L);
  const char *md = mode;  /* to traverse/check mode */
  luaL_argcheck(L, l_checkmode(md), 2, "invalid mode");
  p->f = fopen(filename, mode);
  return (p->f == NULL) ? luaL_fileresult(L, 0, filename) : 1;
}



1、Allow running script to abort;

Just use it:

error("ERROR MESSAGE")



2、Allow script control “Lock To Serial Number”;


	local file = vmprotect.core():inputFile():item(1)
	local function = file:functions():itemByName("FUNCTION NAME")
	if function then
		function:setLockToKey(true)
	end

Can conversion functions be provided:

Examples:

int MultiByteToWideChar(unsigned int CodePage,
    unsigned long dwFlags,
    const char* lpMultiByteStr,
    int cbMultiByte,
    wchar_t* lpWideCharStr,
    int cchWideChar);

int WideCharToMultiByte(unsigned int CodePage,
    unsigned long dwFlags,
    const wchar_t* lpWideCharStr,
    int cchWideChar,
    char* lpMultiByteStr,
    int cchMultiByte,
    const char* lpDefaultChar,
    int* pfUsedDefaultChar);

proposal:
1、Can external script files be referenced? Examples:“XXX.vmp” Support like “LicenseDataFileName="licencemanager.vmp”;
2、Can FFI library be supported?FFI Library
3、Can BitOp library be supported? http://bitop.luajit.org

2、Can FFI library be supported?> FFI Library


function OnBeforeCompilation()
	MessageBox(0, 'OnBeforeCompilation', 'MessageBox from user32.dll', 0x40)
end

function OnAfterCompilation()
	MessageBox(0, 'OnAfterCompilation', 'MessageBox from user32.dll', 0x40)
end

user32 = vmprotect.openLib('user32.dll')
MessageBox = user32:getFunction('MessageBoxA', {ret = 'int', 'size_t', 'string', 'string', 'uint'})



3、Can BitOp library be supported?

Bitwise operations are already supported:

“oi.open” fixed in the 1261 build:
http://vmpsoft.com/files/VMProtectDemo.exe