Advertisement
Guest User

Untitled

a guest
Nov 18th, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. #include <inttypes.h>
  2. #include <stdio.h>
  3. #include <windows.h>
  4.  
  5. typedef struct {
  6. int value;
  7. uint32_t next_pointer;
  8. } Node;
  9.  
  10. int
  11. main(int argc, char ** argv)
  12. {
  13. HANDLE file = CreateFileA(argv[1], GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
  14. while(1) {
  15. Node a;
  16. DWORD empty_dword;
  17. if (!ReadFile(file, &a.value, 4, &empty_dword, NULL) || !empty_dword)
  18. break;
  19. ReadFile(file, &a.next_pointer, 4, &empty_dword, NULL);
  20. printf("%d\n", a.value);
  21. if (!a.next_pointer)
  22. break;
  23. LARGE_INTEGER crutch;
  24. crutch.QuadPart = a.next_pointer;
  25. SetFilePointerEx(file, crutch, NULL, FILE_BEGIN);
  26. }
  27. CloseHandle(file);
  28. return 0;
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement