Привет всем. Помогите написать обертку к ReadFile:
X++:
client server static int ReadFile( int _hFile, int _nNumberOfBytesToRead )
{
Binary data = new Binary(_nNumberOfBytesToRead);
Binary data2 = new Binary(0x4);
DLL _winApiDLL = new DLL('KERNEL32');
DLLFunction _readFile = new DLLFunction(_winApiDLL, 'ReadFile');
boolean _ret;
int iErr;
str strErr;
_readFile.returns(ExtTypes::DWord);
_readFile.arg( ExtTypes::DWord,
ExtTypes::Pointer,
ExtTypes::DWord,
ExtTypes::Pointer,
ExtTypes::DWord);
_ret =_readFile.call(_hFile, data, _nNumberOfBytesToRead, data2, 0);
if (!_ret)
{
iErr = winApi::getLastError();
strErr = winApi::formatMessage(iErr);
error(strErr);
}
return data.dWord(0);
}
пишет "Отказано в доступе ", хандл файла получаю через createfile