• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
How do I read sectors of disk in objective c cocoa application?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

How do I read sectors of disk in objective c cocoa application?


  • Subject: How do I read sectors of disk in objective c cocoa application?
  • From: Waqar Ahmad <email@hidden>
  • Date: Thu, 08 Dec 2011 11:27:27 +0500

Hi,

 

I have studied this article of HFS Plus file system at http://dubeiko.com/development/FileSystems/HFSPLUS/tn1150.html and wants to implement this in Mac and for this I need to access disk drives at raw level so that I can read all parameters given in this article that’s why em asking for any help that could lead me to this…

 

In windows I can do this using c but how its works in Mac no idea so need help….

 

#include "stdafx.h"

#include <stdio.h>

#include <stdlib.h>

#include <windows.h>

#include <tchar.h>

#include <iostream>

#include <winioctl.h>

using namespace std;

 

 

unsigned long  diskread(unsigned char Buffer[])

{

      int _nsect=1;

      unsigned long dwRet = 0;

    HANDLE hDev=CreateFile(L"\\\\.\\PHYSICALDRIVE0",GENERIC_READ,FILE_SHARE_WRITE,0,OPEN_EXISTING,0,0);

      SetFilePointer(hDev,_nsect*512,0,FILE_BEGIN);

    ReadFile(hDev,Buffer,1024,&dwRet,0);

      //ReadFile

    CloseHandle(hDev);

      return dwRet;

}

unsigned long  diskwrite(unsigned char Buffer[])

{

      unsigned long dwRet = 0;

    HANDLE hDev=CreateFile(L"\\\\.\\PHYSICALDRIVE0",GENERIC_WRITE,FILE_SHARE_WRITE,0,OPEN_EXISTING,0,0);

    WriteFile(hDev,Buffer,512,&dwRet,0);

    CloseHandle(hDev);

      return dwRet;

}

 

//int _tmain(int argc, _TCHAR* argv[])

void main(void)

{

     

    unsigned char Buffer[1024]={0};

      unsigned long dwRet = 0;

      dwRet = diskread(Buffer);

 

      int a=0;

//    std::cin>>a;

      //scanf("%d",a);

 

      printf("dwRet = %ld", dwRet);

      for(int i = 0; i < 1024; i++)

      {

            if(i == 0)

                  printf("\n\t");

                  printf("  ");

            printf("X", Buffer[i]);

      }

      printf("\n");    

      //cin>>a;

 

      //diskwrite(Buffer);

      //return 0;

}

 

 

 

Regards,

Waqar Ahmad


       Vibrant Technologies Pvt. Ltd.
       www.vibranttechsolutions.com

 

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Filesystem-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: How do I read sectors of disk in objective c cocoa application?
      • From: Wenguang Wang <email@hidden>
  • Prev by Date: Re: How do I read sectors of disk in objective c cocoa application?
  • Next by Date: Re: How do I read sectors of disk in objective c cocoa application?
  • Previous by thread: Re: How do I read sectors of disk in objective c cocoa application?
  • Next by thread: Re: How do I read sectors of disk in objective c cocoa application?
  • Index(es):
    • Date
    • Thread