在 Linux 系統的解法如下
#include < stdio.h >
#include < sys/types.h >
#include < unistd.h >
#include < sys/stat.h >
#include < fcntl.h >
int main(void)
{
int fd;
unsigned char data;
fd = open("/dev/nvram", O_RDWR);
if (fd==-1) {
printf("Opening /dev/nvram failed\n");
return 1;
}
printf("Disabling WiFi whitelist check.\n");
/* BIG INFORMATIONAL WARNING */
/* The linux nvram driver doesn't give access to the first 14 bytes of
the CMOS. As a result, we seek to 0x5c rather than 0x6a. If you're
implementing this under another OS, then you'll have to go to whichever
address is appropriate for your access method */
lseek(fd, 0x5c, SEEK_SET);
read(fd, &data, 1);
printf("CMOS address 0x5c: %02x->", data);
data |= 0x80;
printf("%02x\n", data);
lseek(fd, 0x5c, SEEK_SET);
if (write(fd, &data, 1)<0 br="br"> printf("Unable to write to /dev/nvram - hack failed\n");
close(fd);
return 2;
}
close(fd);
printf("Done.\n");
return 0;
}
0>