How to write some bytes to Fat???????

he,everyone

i want to write some informations to the location of FAT

in FAT ,there are some bytes that OS have no use we may write some thing in FAT

for example:

i write some things in bootsector BS_OEMNAME (8 BYTES)
OffSet 3 length 8
i can read 8 bytes BS_OEMNAME from bootsector but i can not
write:

unsigned long bytesread;
char stropen[MAX_PATH] = {0};
strcpy (stropen, “\\.\”);
strcat (stropen, “g:”);
hDevice = CreateFile(stropen,GENERIC_ALL, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL);
if (hDevice == INVALID_HANDLE_VALUE)
return NULL;
DWORD dwWrite = 0;
DWORD dwEnWrite = 8;
int nw = WriteFile(hDevice,bufferWrite,dwEnWrite,&dwWrite,NULL);
DWORD dwWriteError = GetLastError();
dwWriteError = 87
if (!ReadFile(hDevice, buffer,512, &bytesread, NULL))
return NULL;
CloseHandle(hDevice);

How can write some things to bootsector?

thanks !


ÎÞÏÞÈÝÁ¿ÑÅ»¢Ïà²á£¬Ô­Í¼µÈ´óÏÂÔØ£¬³¬¿ìËÙ¶È£¬¸Ï¿ìÇÀ×¢£¡

First, I question why you would need to write anything to the
bootsector. I would hope that everyone on this list would interogate you
regarding your need to do this. I can think of no other reason to write
data to the boot sector other than creating a root kit or virus.

Second, regarding viruses, most antivirus products protect the
bootsector, so you’ll have a difficult time implementing this if you
have an antivirus product installed.

xinling zhang wrote:

he,everyone
i want to write some informations to the location of FAT
in FAT ,there are some bytes that OS have no use we may write some
thing in FAT
for example:
i write some things in bootsector BS_OEMNAME (8 BYTES)
OffSet 3 length 8
i can read 8 bytes BS_OEMNAME from bootsector but i can not
write:
unsigned long bytesread;
char stropen[MAX_PATH] = {0};
strcpy (stropen, “\\.\”);
strcat (stropen, “g:”);
hDevice = CreateFile(stropen,GENERIC_ALL, FILE_SHARE_READ |
FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL);
if (hDevice == INVALID_HANDLE_VALUE)
return NULL;
DWORD dwWrite = 0;
DWORD dwEnWrite = 8;
int nw = WriteFile(hDevice,bufferWrite,dwEnWrite,&dwWrite,NULL);
DWORD dwWriteError = GetLastError();
dwWriteError = 87
if (!ReadFile(hDevice, buffer,512, &bytesread, NULL))
return NULL;
CloseHandle(hDevice);
How can write some things to bootsector?
thanks !


ÎÞÏÞÈÝÁ¿ÑÅ»¢Ïà²á£¬Ô­Í¼µÈ´óÏÂÔØ£¬³¬¿ìËÙ¶È£¬¸Ï¿ìÇÀ×¢£¡
https:
> Questions? First check the IFS FAQ at
> https://www.osronline.com/article.cfm?id=17 You are currently
> subscribed to ntfsd as: xxxxx@comcast.net To unsubscribe send a
> blank email to xxxxx@lists.osr.com</https:>