SetFilePointerEx doesn't seek my memory flash, why is this?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Gilberto Gil
    New Member
    • Jun 2011
    • 14

    SetFilePointerEx doesn't seek my memory flash, why is this?

    Hello...I've a problems trying to move the pointer forward.. I'm trying to read my flash memory as array of bytes... Using SetFilePointerE x API function I've already did it, but, the problems is that it always read begening at 0 byte, I can't begin with offset of 512 bytes for example... why is this.....Note: it works pretty well seeking a file like .txt file. Some help.. please....I really need some help..

    My code:

    Code:
    SafeFileHandle ptrFile = CreateFile("\\\\.\\u:", DesiredAccess.GENERIC_READ | DesiredAccess.GENERIC_WRITE, ShareMode.FILE_SHARE_READ_AND_WRITE, IntPtr.Zero, CreationDisposition.OPEN_EXISTING, FlagsAndAttributes.FILE_ATTRIBUTE_NORMAL, IntPtr.Zero);
     
            byte[] buffer = new byte[512];
     
            uint readed = 0;
            try
            {
               bool retor = SetFilePointerEx(ptrFile, 512, IntPtr.Zero,      MoveMethod.FILE_BEGIN);
            }
            catch (Exception)
            {
               throw new Win32Exception(Marshal.GetLastWin32Error());
            }
     
            bool b = ReadFile(ptrFile, buffer,512 , out readed, IntPtr.Zero)
    ;
Working...