<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">

<head>
<meta http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<meta name=Generator content="Microsoft Word 12 (filtered medium)">
<style>
<!--
 /* Font Definitions */
 @font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
span.EstiloCorreo17
        {mso-style-type:personal-compose;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;}
@page Section1
        {size:612.0pt 792.0pt;
        margin:70.85pt 3.0cm 70.85pt 3.0cm;}
div.Section1
        {page:Section1;}
-->
</style>
<!--[if gte mso 9]><xml>
 <o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
 <o:shapelayout v:ext="edit">
  <o:idmap v:ext="edit" data="1" />
 </o:shapelayout></xml><![endif]-->
</head>

<body lang=ES link=blue vlink=purple>

<div class=Section1>

<p class=MsoNormal>Saludos colegas:<o:p></o:p></p>

<p class=MsoNormal><o:p> </o:p></p>

<p class=MsoNormal>Estoy haciendo una herramienta forense de recuperación en la
que tengo que recorrer la superficie de una memoria flash y tengo que leer sus
entradas byte a byte…  para poderlas recuperar. Sé que existen clases y
funciones en .NET, maravillosas pero el proyecto requiere que muestre dominio de
la estructura FAT32. La aplicación la estoy desarrollando el VS2008 Express
Edition en C#.<o:p></o:p></p>

<p class=MsoNormal><o:p> </o:p></p>

<p class=MsoNormal>Para leer un área de memoria y luego analizar los bytes leídos,
estoy usando las funciones “CreateFile” y “ReadFile” de
la API de Windows de esta manera<o:p></o:p></p>

<p class=MsoNormal>-----------------------------------------<o:p></o:p></p>

<p class=MsoNormal style='text-autospace:none'><span lang=EN-US
style='font-size:10.0pt;font-family:"Courier New";color:blue'>byte</span><span
lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'>[] data = <span
style='color:blue'>new</span> <span style='color:blue'>byte</span>[count];<o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span lang=EN-US
style='font-size:10.0pt;font-family:"Courier New";color:blue'>int</span><span
lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'> n = 0;<o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span lang=EN-US
style='font-size:10.0pt;font-family:"Courier New"'>IntPtr handle =
CreateFile(FileName, GENERIC_READ, 0, 0, OPEN_EXISTING, 0, 0);<u><span
style='color:blue'><o:p></o:p></span></u></span></p>

<p class=MsoNormal style='text-autospace:none'><span lang=EN-US
style='font-size:10.0pt;font-family:"Courier New";color:blue'>fixed</span><span
lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'> (<span
style='color:blue'>byte</span>* p = data)<o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span lang=EN-US
style='font-size:10.0pt;font-family:"Courier New"'>{<o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span lang=EN-US
style='font-size:10.0pt;font-family:"Courier New"'>      <o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span lang=EN-US
style='font-size:10.0pt;font-family:"Courier New"'>    <span style='color:blue'>if</span>
(!ReadFile(handle, p, count, &n, 0))<o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span lang=EN-US
style='font-size:10.0pt;font-family:"Courier New"'>        </span><span
style='font-size:10.0pt;font-family:"Courier New";color:#2B91AF'>Console</span><span
style='font-size:10.0pt;font-family:"Courier New"'>.WriteLine(<span
style='color:#A31515'>"Error de lectura en el medio"</span>);<o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span lang=EN-US
style='font-size:10.0pt;font-family:"Courier New"'>}<o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span lang=EN-US
style='font-size:10.0pt;font-family:"Courier New"'><o:p> </o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span lang=EN-US
style='font-size:10.0pt;font-family:"Courier New";color:blue'>if</span><span
lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'> (n > 0)<o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span lang=EN-US
style='font-size:10.0pt;font-family:"Courier New"'>{<o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span lang=EN-US
style='font-size:10.0pt;font-family:"Courier New"'>    <span style='color:#2B91AF'>MemoryStream</span>
memStream = <span style='color:blue'>new</span> <span style='color:#2B91AF'>MemoryStream</span>(data);<o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span lang=EN-US
style='font-size:10.0pt;font-family:"Courier New"'>    </span><span
style='font-size:10.0pt;font-family:"Courier New";color:blue'>return</span><span
style='font-size:10.0pt;font-family:"Courier New"'> memStream;<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New"'>}<o:p></o:p></span></p>

<p class=MsoNormal>-----------------------------------------<o:p></o:p></p>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New"'>De esta
forma puedo leer los primeros bytes incluso como hasta 10 megas, poniendo en  “count”
la representación en bytes.<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New"'><o:p> </o:p></span></p>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New"'>El
problema es el siguiente. Esta manera siempre lee a partir del inicio de la
memoria y cuando tengo que leer en el area de los datos, la cantidad de momoria
al parecer es mucha y me da error… es decir, no me lee. Lo que quiero es
ver la posibilidad de realizar algún offset, tal ves del handle, no se?? O de
alguna manera en caso de que quiera leer un simple sector o cluster…
posicionarme en ese lugar y luego leer… y punto solo un pedacito, no todo
el disco completo hasta esa posición.<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New"'><o:p> </o:p></span></p>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New"'>Necesito
saber si esto es posible o si estoy muscando pinguinos en el Amazona.<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New"'><o:p> </o:p></span></p>

<p class=MsoNormal>De antemano agradecido..<o:p></o:p></p>

<p class=MsoNormal>EEDEM<u><o:p></o:p></u></p>

</div>

</body>

</html>