Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <inttypes.h>
- #include <stdio.h>
- #include <windows.h>
- typedef struct {
- int value;
- uint32_t next_pointer;
- } Node;
- int
- main(int argc, char ** argv)
- {
- HANDLE file = CreateFileA(argv[1], GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
- while(1) {
- Node a;
- DWORD empty_dword;
- if (!ReadFile(file, &a.value, 4, &empty_dword, NULL) || !empty_dword)
- break;
- ReadFile(file, &a.next_pointer, 4, &empty_dword, NULL);
- printf("%d\n", a.value);
- if (!a.next_pointer)
- break;
- LARGE_INTEGER crutch;
- crutch.QuadPart = a.next_pointer;
- SetFilePointerEx(file, crutch, NULL, FILE_BEGIN);
- }
- CloseHandle(file);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement