//
// _getdrive from 0x18013471c to 0x180134812 (246 bytes)
//
// 3 xrefs:
// > get_drive_number_from_path @ 0x180129692
// > common_getdcwd @ 0x18013bf46
// > ??> @ 0x180203278
//
// This function is hookable on this platform!
//
// Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings
//
int __cdecl getdrive()
{
DWORD CurrentDirectoryW; // eax
int v1; // edi
int v2; // edi
DWORD v3; // esi
WCHAR *v4; // rax
WCHAR *v5; // rbx
int v6; // ecx
int v7; // edi
WCHAR Buffer[264]; // [rsp+20h] [rbp-228h] BYREF
memset(Buffer, 0, 0x20Au);
CurrentDirectoryW = GetCurrentDirectoryW(0x105u, Buffer);
if ( CurrentDirectoryW > 0x104 )
{
v3 = CurrentDirectoryW + 1;
v4 = (WCHAR *)calloc_base(CurrentDirectoryW + 1, 2u);
v1 = 0;
v5 = v4;
if ( v4 && GetCurrentDirectoryW(v3, v4) )
{
if ( *v5 && v5[1] == 58 )
{
v6 = *v5;
v7 = v6 - 32;
if ( (unsigned int)(v6 - 97) > 0x19 )
v7 = *v5;
v1 = v7 - 64;
}
}
else
{
*errno() = 12;
}
free_base(v5);
}
else
{
v1 = 0;
if ( Buffer[0] && Buffer[1] == 58 )
{
v2 = Buffer[0] - 32;
if ( (unsigned int)Buffer[0] - 97 > 0x19 )
v2 = Buffer[0];
return v2 - 64;
}
}
return v1;
}