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