<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Форум Рутокен &mdash; Чтение файла с использованием rtAPIlt из C#]]></title>
	<link rel="self" href="https://forum.rutoken.ru/feed/atom/topic/2389/" />
	<updated>2016-03-16T04:54:25Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.rutoken.ru/topic/2389/</id>
		<entry>
			<title type="html"><![CDATA[Re: Чтение файла с использованием rtAPIlt из C#]]></title>
			<link rel="alternate" href="https://forum.rutoken.ru/post/9418/#p9418" />
			<content type="html"><![CDATA[<p>Спасибо! Проблема была действительно в последнем параметре. Теперь всё работает.</p>]]></content>
			<author>
				<name><![CDATA[rowexn]]></name>
				<uri>https://forum.rutoken.ru/user/10052/</uri>
			</author>
			<updated>2016-03-16T04:54:25Z</updated>
			<id>https://forum.rutoken.ru/post/9418/#p9418</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Чтение файла с использованием rtAPIlt из C#]]></title>
			<link rel="alternate" href="https://forum.rutoken.ru/post/9417/#p9417" />
			<content type="html"><![CDATA[<p>пока вот такое нашли:</p><p>var buff = new byte[6];<br />uint length = 0;<br />fixed (byte* pBuff = &amp;buff[0])<br />byte* outBuff = pBuff; var err = RtAPIltImport.rtlReadFile(file, 0, 6, outBuff, &amp;length); <br />в length надо класть длину массива, после того, как размер файла известен.</p>]]></content>
			<author>
				<name><![CDATA[Кирилл Мещеряков]]></name>
				<uri>https://forum.rutoken.ru/user/6786/</uri>
			</author>
			<updated>2016-03-15T15:03:26Z</updated>
			<id>https://forum.rutoken.ru/post/9417/#p9417</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Чтение файла с использованием rtAPIlt из C#]]></title>
			<link rel="alternate" href="https://forum.rutoken.ru/post/9416/#p9416" />
			<content type="html"><![CDATA[<p>будьте добры пришлите CS файлик с описанием dllimport и пример вызова функции?</p>]]></content>
			<author>
				<name><![CDATA[Кирилл Мещеряков]]></name>
				<uri>https://forum.rutoken.ru/user/6786/</uri>
			</author>
			<updated>2016-03-15T14:15:32Z</updated>
			<id>https://forum.rutoken.ru/post/9416/#p9416</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Чтение файла с использованием rtAPIlt из C#]]></title>
			<link rel="alternate" href="https://forum.rutoken.ru/post/9415/#p9415" />
			<content type="html"><![CDATA[<p>спасибо за ваш вопрос, посмотрим.</p>]]></content>
			<author>
				<name><![CDATA[Кирилл Мещеряков]]></name>
				<uri>https://forum.rutoken.ru/user/6786/</uri>
			</author>
			<updated>2016-03-15T14:14:12Z</updated>
			<id>https://forum.rutoken.ru/post/9415/#p9415</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Чтение файла с использованием rtAPIlt из C#]]></title>
			<link rel="alternate" href="https://forum.rutoken.ru/post/9414/#p9414" />
			<content type="html"><![CDATA[<p>Добрый день!<br />Описал DllImport для функций библиотеки rtAPIlt.dll. Практически все функции работают корректно (включая создание директорий и файлов, запись&nbsp; файла, ...). Проблема только с функцией rtlReadFile.<br />Перебрал все возможные способы импорта функции и передаваемых параметров. При вызове всегда возвращается 0x8007007a (Область данных, переданная по системному вызову, слишком мала). При этом <br />в dataLen возвращается правильная длина файла, а буфер с данными не заполняется.<br />Пример одного из вариантов импорта:<br />&nbsp; &nbsp; &nbsp; &nbsp; [DllImport(&quot;rtAPIlt.dll&quot;, EntryPoint = &quot;rtlReadFile&quot;, CharSet = CharSet.Ansi,<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; SetLastError = true, CallingConvention = CallingConvention.StdCall)]<br />&nbsp; &nbsp; &nbsp; &nbsp; public static extern unsafe uint rtlReadFile(RTLFile file, uint offset, uint length, byte* data, uint* dataLen);</p><p>Вызов:<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; var buff = new byte[6];<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; uint length = 0;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; fixed (byte* pBuff = &amp;buff[0])<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; byte* outBuff = pBuff;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; var err = RtAPIltImport.rtlReadFile(file, 0, 6, outBuff, &amp;length);<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</p><p>Пробовал варианты с IntPtr и много других вариантов, поведение не меняется.</p>]]></content>
			<author>
				<name><![CDATA[rowexn]]></name>
				<uri>https://forum.rutoken.ru/user/10052/</uri>
			</author>
			<updated>2016-03-15T11:32:06Z</updated>
			<id>https://forum.rutoken.ru/post/9414/#p9414</id>
		</entry>
</feed>
