일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
Tags
- DFS
- Lotto
- dataframe
- GitHub
- pip
- imread
- RNN
- Numpy
- E-P1
- 알고리즘
- keras
- Series
- Button
- index
- install
- LSTM
- CNN
- pandas
- Python
- javascript
- 삼성소프트웨어멤버십
- SPL
- synology
- ipad
- Splunk
- pycharm
- SciPy
- mean
- mariadb
- GT-S80
Archives
- Today
- Total
잠토의 잠망경
File System 본문
- #include <stdio.h>
- #include <stdlib.h>
- #include <windows.h>
- unsigned int HDD_read (int drv, unsigned int SecAddr, unsigned int blocks, char* buf)
- {
- unsigned int ret = 0;
- char cur_drv[100]="";
- //wsprintf(cur_drv,"\\\\.\\PhysicalDrive%d",drv);
- wsprintf(cur_drv,"\\\\.\\C:",drv);
- HANDLE g_hDevice = CreateFile( cur_drv,
- GENERIC_READ,
- FILE_SHARE_READ|FILE_SHARE_WRITE,
- NULL,
- OPEN_EXISTING,
- FILE_ATTRIBUTE_NORMAL,
- 0);
- if(INVALID_HANDLE_VALUE == g_hDevice) return 1;
- unsigned int Low = SecAddr*512;
- unsigned int High= 0;
- if(0xFFFFFFFF == SetFilePointer(g_hDevice,Low,(long*)&High,FILE_BEGIN)) return 2;
- ULONG readNum = 0;
- ret = ReadFile(g_hDevice,buf,blocks*512,&readNum,NULL);
- CloseHandle(g_hDevice);
- return ret;
- }
- unsigned int HDD_write(unsigned char drv, unsigned int SecAddr, unsigned int blocks, unsigned char* buf);
- void HexDump(unsigned char* addr, unsigned int len)
- {
- unsigned char *s=addr, *endPtr=(unsigned char*)((unsigned int)addr+len);
- unsigned int i, remainder=len%16;
- printf("\n Offset Hex Value Ascii value\n");
- // print out 16 byte blocks.
- while (s+16<=endPtr){
- // offset 출력.
- printf("0x%08lx ", (long)(s-addr));
- // 16 bytes 단위로 내용 출력.
- for (i=0; i<16; i++){
- printf("%02x ", s[i]);
- }
- printf(" ");
- for (i=0; i<16; i++){
- if (s[i]>=32 && s[i]<=125)printf("%c", s[i]);
- else printf(".");
- }
- s += 16;
- printf("\n");
- }
- // Print out remainder.
- if (remainder){
- // offset 출력.
- printf("0x%08lx ", (long)(s-addr));
- // 16 bytes 단위로 출력하고 남은 것 출력.
- for (i=0; i<remainder; i++){
- printf("%02x ", s[i]);
- }
- for (i=0; i<(16-remainder); i++){
- printf(" ");
- }
- printf(" ");
- for (i=0; i<remainder; i++){
- if (s[i]>=32 && s[i]<=125) printf("%c", s[i]);
- else printf(".");
- }
- for (i=0; i<(16-remainder); i++){
- printf(" ");
- }
- printf("\n");
- }
- return;
- } // HexDump.
- int main(void)
- {
- char dumpData[512]="";
- HDD_read(0,0,1,dumpData);
- HexDump((unsigned char*)dumpData,512);
- return 0;
- }
Comments