Skip to content

Instantly share code, notes, and snippets.

@bruce30262
Created August 22, 2017 12:22
Show Gist options
  • Save bruce30262/973416c95fee03b2d5d7cbea32f6efc8 to your computer and use it in GitHub Desktop.
Save bruce30262/973416c95fee03b2d5d7cbea32f6efc8 to your computer and use it in GitHub Desktop.
#include <stdio.h>
#include <stdlib.h>
#include <windows.h>
int main()
{
char v1[1000]; // ebx@3
signed int result; // eax@7
DWORD BytesReturned; // [sp+Ch] [bp-1Ch]@2
char OutBuffer[1000]; // [sp+10h] [bp-18h]@2
LONG lDistanceToMove = 512; // [sp+24h] [bp-4h]@3
HANDLE v0 = CreateFileA("\\\\.\\C:", GENERIC_READ, 3, 0, 3, 0, 0);
if ( v0 )
{
if ( DeviceIoControl(v0, 0x70000u, 0, 0, OutBuffer, 0x18u, &BytesReturned, 0) )
{
//v1 = LocalAlloc(0, 10 * lDistanceToMove);
if ( v1 )
{
SetFilePointer(v0, lDistanceToMove, 0, 0);
ReadFile(v0, v1, 512, &BytesReturned, 0);
int i = 0;
int cnt = 0;
for(i = 0 ; i < 512 ; i++)
{
printf("%02x ", v1[i]&0xff);
cnt++;
if(cnt == 16)
{
puts("");
cnt = 0;
}
}
LocalFree(v1);
}
}
CloseHandle(v0);
}
printf("Hello world!\n");
system("pause");
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment