Yam Code
Sign up
Login
New paste
Home
Trending
Archive
English
English
Tiếng Việt
भारत
Sign up
Login
New Paste
Browse
#include "type_fix.h" #pragma pack(1) uint64_t reverseByte(uint8_t* byte, unsigned int count) { uint64_t result = 0; int i; for (i = count - 1; i >= 0; i--) result = (result << 8) | byte[i]; return result; } int ReadSector(LPCWSTR drive, int readPoint, BYTE sector[512], long posSector) { int retCode = 0; DWORD bytesRead; HANDLE device = NULL; device = CreateFile(drive, // Drive to open GENERIC_READ, // Access mode FILE_SHARE_READ | FILE_SHARE_WRITE, // Share Mode NULL, // Security Descriptor OPEN_EXISTING, // How to create 0, // File attributes NULL); // Handle to template if (device == INVALID_HANDLE_VALUE) // Open Error { printf("CreateFile: %u\n", GetLastError()); return 1; } SetFilePointer(device, readPoint + 512 * posSector, NULL, FILE_BEGIN);//Set a Point to Read if (!ReadFile(device, sector, 512, &bytesRead, NULL)) { printf("ReadFile: %u\n", GetLastError()); } else { printf("Success!\n"); } } #pragma pack() void PrintFloppyInformationNTFS(NTFS _ntfs) { printf("Floppy Disk Information: \n"); printf("===========================\n"); printf("FAT: %s\n", _ntfs.OEMID); //Loai FAT printf("Bytes per sector: %d\n", reverseByte(_ntfs.Bytes_Sector, 2)); // So Byte cho 1 sector printf("Sector per cluster: %d\n", _ntfs.Sectors_Cluster); // So Sector cho 1 cluster printf("Reserved Sector: %d\n", reverseByte(_ntfs.Reserved_Sector, 2)); // So Sector vung boot Sector printf("Total Sectors : %lld\n", _ntfs.total_sectors); //Tong so sector, kich thuoc Volume printf("Logical Cluster Number for the file $MFT : %lld\n", _ntfs.Logical_MFT); // so cum cluster cho MFT printf("Logical Cluster Number for the file $MFTMirr : %lld\n", _ntfs.Logical_MFTMirr); // so cum cluster cho MFTMIRR } int PrintFloppyInformationFAT32(FAT32 fat32) { printf("FAT: %s\n", fat32.Fat_name); //Loai FAT printf("Bytes per sector: %d\n", reverseByte(fat32.bytePerSector, 2));// So Byte cho 1 sector printf("Sector per cluster: %d\n", fat32.sectorPerCluster);// So Sector cho 1 cluster printf("Reserved sectors (Sb): %d\n", reverseByte(fat32.reservedSector, 2));// So Sector vung boot Sector printf("FAT copies: %d\n", fat32.fatCopy); // So bang FAT printf("Total sector: %d\n", reverseByte(fat32.Total_sector, 4));//Tong so sector, kich thuoc Volume printf("Sector per FAT: %d\n", reverseByte(fat32.SectorperFAT, 4));// so sector cho 1 bang fat printf("Root directory entries: %d\n", reverseByte(fat32.rdetEntry, 2)); // So Entry cho bang RDET printf("first sector of FAT1: %d\n", reverseByte(fat32.reservedSector, 2)); // sector dau tien cua bang FAT1 int s = int(reverseByte(fat32.reservedSector, 2)) + int(reverseByte(fat32.SectorperFAT, 4)) * int(fat32.fatCopy); printf("first sector of RDET: %d\n", s); // sector dau tien cua vung RDET int d = s + int(reverseByte(fat32.rdetEntry, 2)); printf("first sector of DATA: %d\n", s); // sector dau tien cua vung DATA return s; } int main(int argc, TCHAR* argv[], TCHAR* envp[]) { BYTE sector[512]; NTFS ntfs; FAT32 fat32; ReadSector(L"\\\\.\\H:", 0, sector,0); memcpy(&ntfs, sector, 512); long size = 0; if (ntfs.OEMID[0] == 'N') PrintFloppyInformationNTFS(ntfs); else { memcpy(&fat32, sector, 512); size = PrintFloppyInformationFAT32(fat32); } printf("%d", size * 512); ReadSector(L"\\\\.\\H:", 0, sector, size); system("pause"); }
Paste Settings
Paste Title :
[Optional]
Paste Folder :
[Optional]
Select
Syntax Highlighting :
[Optional]
Select
Markup
CSS
JavaScript
Bash
C
C#
C++
Java
JSON
Lua
Plaintext
C-like
ABAP
ActionScript
Ada
Apache Configuration
APL
AppleScript
Arduino
ARFF
AsciiDoc
6502 Assembly
ASP.NET (C#)
AutoHotKey
AutoIt
Basic
Batch
Bison
Brainfuck
Bro
CoffeeScript
Clojure
Crystal
Content-Security-Policy
CSS Extras
D
Dart
Diff
Django/Jinja2
Docker
Eiffel
Elixir
Elm
ERB
Erlang
F#
Flow
Fortran
GEDCOM
Gherkin
Git
GLSL
GameMaker Language
Go
GraphQL
Groovy
Haml
Handlebars
Haskell
Haxe
HTTP
HTTP Public-Key-Pins
HTTP Strict-Transport-Security
IchigoJam
Icon
Inform 7
INI
IO
J
Jolie
Julia
Keyman
Kotlin
LaTeX
Less
Liquid
Lisp
LiveScript
LOLCODE
Makefile
Markdown
Markup templating
MATLAB
MEL
Mizar
Monkey
N4JS
NASM
nginx
Nim
Nix
NSIS
Objective-C
OCaml
OpenCL
Oz
PARI/GP
Parser
Pascal
Perl
PHP
PHP Extras
PL/SQL
PowerShell
Processing
Prolog
.properties
Protocol Buffers
Pug
Puppet
Pure
Python
Q (kdb+ database)
Qore
R
React JSX
React TSX
Ren'py
Reason
reST (reStructuredText)
Rip
Roboconf
Ruby
Rust
SAS
Sass (Sass)
Sass (Scss)
Scala
Scheme
Smalltalk
Smarty
SQL
Soy (Closure Template)
Stylus
Swift
TAP
Tcl
Textile
Template Toolkit 2
Twig
TypeScript
VB.Net
Velocity
Verilog
VHDL
vim
Visual Basic
WebAssembly
Wiki markup
Xeora
Xojo (REALbasic)
XQuery
YAML
HTML
Paste Expiration :
[Optional]
Never
Self Destroy
10 Minutes
1 Hour
1 Day
1 Week
2 Weeks
1 Month
6 Months
1 Year
Paste Status :
[Optional]
Public
Unlisted
Private (members only)
Password :
[Optional]
Description:
[Optional]
Tags:
[Optional]
Encrypt Paste
(
?
)
Create New Paste
You are currently not logged in, this means you can not edit or delete anything you paste.
Sign Up
or
Login
Site Languages
×
English
Tiếng Việt
भारत